From c3501daa1d6cf6f0cb8428afcaa329755ca16621 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期五, 07 六月 2024 16:40:30 +0800
Subject: [PATCH] ‘’

---
 h5/pages/staff/vehicle/applePeo.vue |   71 ++++++++++++++++++++---------------
 1 files changed, 41 insertions(+), 30 deletions(-)

diff --git a/h5/pages/staff/vehicle/applePeo.vue b/h5/pages/staff/vehicle/applePeo.vue
index 8dc231d..52d13c5 100644
--- a/h5/pages/staff/vehicle/applePeo.vue
+++ b/h5/pages/staff/vehicle/applePeo.vue
@@ -113,43 +113,66 @@
       param: {},
       selList: [],
 
-      isShowSelMem: false
+      isShowSelMem: false,
+      pagination: {
+        capacity: 20,
+        page: 1
+      },
     }
   },
   onLoad() {
     this.initData()
   },
+  onReachBottom() {
+    // if(){}
+  },
   mounted() {
-    this.$eventBus.$on('applePeoDetail', (res)=>{
+    this.$eventBus.$on('applePeoDetail', (res) => {
       res.forEach(item => {
-        this.changeMem(item)
+        this.memberList.forEach(mem => {
+          if (item.id === mem.id) {
+            mem.checked = !mem.checked
+          }
+        })
       })
-      this.$nextnick(() => {
+      this.selList = this.memberList.filter(i => i.checked)
+      this.$nextTick(() => {
         this.$forceUpdate()
       })
     })
   },
   methods: {
+    initData() {
+      const { param, pagination } = this
+      findTypeMemberInfo({
+        // model: {
+        name: param.name,
+        // },
+        type: '2',
+        ...pagination
+      }).then(res => {
+        this.memberList = res.data || []
+        this.memberList.forEach(i => {
+          i.checked = false
+        })
+      })
+    },
     onSubmit() {
+      if (this.selList.length === 0) return uni.showToast({
+        title: '璇峰厛閫夋嫨浜哄憳',
+        icon: 'none'
+      })
       this.$eventBus.$emit('applePeo', this.selList)
       uni.navigateBack()
     },
     changeMem(item, index) {
+      // this.memberList.forEach(mem => {
+      //   if(item.id === mem.id){
+      //     item.checked = !item.checked
+      //   }
+      // })
       item.checked = !item.checked
       this.selList = this.memberList.filter(i => i.checked)
-      // const arr = e.detail.value
-      // let arrTemp = arr.map(item => {
-      //   let obj = {}
-      //   this.memberList.forEach(ite => {
-      //     if (item == ite.id) {
-      //       obj.name = ite.name.split('-')[0]
-      //       obj.componey = ite.name.split('-')[1] || ''
-      //       obj.id = ite.id
-      //     }
-      //   })
-      //   return obj
-      // })
-      // this.selList = arrTemp
       this.$forceUpdate()
     },
     handleRemove(item) {
@@ -161,18 +184,6 @@
       // console.log(this.memberList);
       this.$forceUpdate()
     },
-    initData() {
-      const { param } = this
-      findTypeMemberInfo({
-        name: param.name,
-        type: '2'
-      }).then(res => {
-        this.memberList = res.data || []
-        this.memberList.forEach(i => {
-          i.checked = false
-        })
-      })
-    }
   }
 };
 </script>
@@ -302,7 +313,7 @@
         }
       }
     }
-    .checked{
+    .checked {
       width: 48rpx;
     }
   }

--
Gitblit v1.9.3