vlist.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="car">
  3. <!-- tab栏 -->
  4. <view class="cartop">
  5. <view class="tabtop flexc">
  6. <view class="tabt" :class="tabval==ite.val?'act':''" v-for="(ite,idx) in tablist" :key="idx" @click="getTabFn(ite.val)">{{ite.tit}}</view>
  7. </view>
  8. </view>
  9. <!-- 列表 -->
  10. <view class="carlists">
  11. <box-list :datainfo="list" :fkztList="fkztList" :wtdt="wtdt" type='visitor' @getDetail="getDetail" @getDelFn="getDelFn"></box-list>
  12. </view>
  13. <loading></loading>
  14. </view>
  15. </template>
  16. <script>
  17. import config from '@/config'
  18. const baseUrl = config.baseUrl
  19. import boxList from "@/work/components/box/list.vue"
  20. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  21. import {reservList,reservDel} from "@/api/work/people.js"
  22. import {getDictionaryFn} from "@/api/system/user.js"
  23. import {houseInfolistNoPage} from "@/api/work/work.js"
  24. export default{
  25. components:{boxList},
  26. data(){
  27. return{
  28. // reset:require('@/work/static/car/reset.png'),
  29. // search:require('@/work/static/car/search.png'),
  30. // up:require('@/work/static/car/up.png'),
  31. cxrq:"",
  32. text:'',
  33. list:[],
  34. pageSize: 10,
  35. pageNum: 1,
  36. reachflag: true,
  37. wtdt:'',
  38. fkztList:[],
  39. tabval:"",
  40. tablist:[],
  41. userId:this.$store.state.user.userId,
  42. }
  43. },
  44. onLoad: function(e) {
  45. this.init()
  46. },
  47. // 上拉触底加载更多触发事件
  48. onReachBottom() {
  49. if (this.reachflag) {
  50. this.pageNum++
  51. this.getDataFn()
  52. }
  53. },
  54. methods:{
  55. checkPermi, checkRole,
  56. getDetail(id){
  57. this.$tab.navigateTo("/work/pages/visitor/vdetail?id="+id)
  58. },
  59. init(){
  60. // 访客状态
  61. getDictionaryFn('yuyetype').then(res=>{
  62. if(res.code==200){
  63. this.fkztList = res.data.map(v => {
  64. return {
  65. dictLabel: v.dictLabel,
  66. dictValue: v.dictValue
  67. }
  68. })
  69. }
  70. })
  71. var params={
  72. userId:this.userId,
  73. pageSize: 100,
  74. pageNum: 1,
  75. }
  76. houseInfolistNoPage(params).then(res=>{
  77. if(res.code==200){
  78. if(res.rows&&res.rows.length){
  79. var data=res.rows[0];
  80. this.tabval=data.houseId;
  81. this.getDataFn()
  82. }
  83. this.tablist= res.rows.map(v => {
  84. return {
  85. tit: v.detailedAddress,
  86. val: v.houseId,
  87. }
  88. })
  89. }
  90. })
  91. },
  92. getConfirm(){
  93. this.getrefreshData()
  94. },
  95. getReset(){
  96. this.cxrq='';
  97. this.text='';
  98. this.getrefreshData()
  99. },
  100. getrefreshData(){
  101. this.pageNum=1;
  102. this.list=[];
  103. this.reachflag=true;
  104. this.getDataFn()
  105. },
  106. getTabFn(val){
  107. this.tabval=val;
  108. this.getrefreshData();
  109. },
  110. bindDateChangea(e){
  111. var val=e.detail.value;
  112. this.cxrq=val;
  113. },
  114. getDelFn(data){
  115. var that=this;
  116. reservDel(data).then(res=>{
  117. if(res.code==200){
  118. this.$toast("删除成功");
  119. setTimeout(function(){
  120. that.getrefreshData()
  121. },1500)
  122. }
  123. })
  124. },
  125. getDataFn(){
  126. var params={
  127. pageSize:this.pageSize,
  128. pageNum: this.pageNum,
  129. portalId:this.tabval
  130. }
  131. reservList(params).then(res=>{
  132. if(res.code==200){
  133. if (res.rows.length < this.pageSize) {
  134. this.reachflag = false
  135. this.wtdt = '到底了~';
  136. } else {
  137. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  138. if (num < res.total) {
  139. this.reachflag = true
  140. this.wtdt = ''
  141. } else {
  142. this.reachflag = false
  143. this.wtdt = '到底了~';
  144. }
  145. }
  146. var newArr=JSON.parse(JSON.stringify(res.rows))
  147. newArr.forEach(ite=>{
  148. ite.right=0;
  149. })
  150. if (this.pageNum == 1) {
  151. this.list = newArr;
  152. } else {
  153. this.list = this.list.concat(newArr)
  154. }
  155. }else{
  156. this.$toast(res.msg)
  157. }
  158. })
  159. },
  160. }
  161. }
  162. </script>
  163. <style>
  164. page{background: #F3F3F0;}
  165. </style>
  166. <style lang="scss" scoped>
  167. .car{padding: 146rpx 0 10rpx;}
  168. .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
  169. .topa{padding: 20rpx ;
  170. .resetimg{width: 36rpx;height: 36rpx;margin-right: 24rpx;flex: 0 0 auto;}
  171. .chekt{min-width: 180rpx;
  172. view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;}
  173. image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;}
  174. }
  175. .search{flex: 1;margin-left: 16rpx;height: 64rpx;background: #EEEEEE;border-radius: 32rpx;border: 2rpx solid #E6E6E6;padding-left: 24rpx;box-sizing: border-box;
  176. image{width: 32rpx;height: 34rpx;margin-right: 22rpx;flex: 0 0 auto;}
  177. input{flex: 1;font-size: 26rpx;color: #272727;}
  178. .btn{width: 100rpx;height: 64rpx;background: #3565ED;border-radius: 32rpx;flex: 0 0 auto;font-weight: bold;text-align: center;line-height: 64rpx;
  179. font-size: 26rpx;
  180. color: #FFFFFF;}
  181. }
  182. }
  183. .tabtop{padding-bottom: 40rpx;padding-top: 26rpx;overflow: auto;
  184. .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx;flex: 0 0 auto;text-align: center;margin: 0 10rpx;padding: 0 20rpx;
  185. &.act{font-weight: bold;font-size: 32rpx;color: #272727;
  186. &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
  187. }
  188. }
  189. }
  190. }
  191. .carlists{padding: 0 18rpx;}
  192. </style>