From 1fb44496929548b4f07b37796d506dedc494d44a Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期二, 30 七月 2024 17:29:35 +0800
Subject: [PATCH] update 问题修复

---
 sub_pages/customer/shopping/shopping.vue |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/sub_pages/customer/shopping/shopping.vue b/sub_pages/customer/shopping/shopping.vue
index 76ea10c..a9f17ef 100644
--- a/sub_pages/customer/shopping/shopping.vue
+++ b/sub_pages/customer/shopping/shopping.vue
@@ -17,7 +17,8 @@
 
 
 				<view class="sup-title">
-					<radio :checked="ids.indexOf(item.id)>=0" @click="changeItem(item,'supplier')"></radio>
+					<radio :checked="ids.indexOf('supplier@'+item.supplierId)>=0" @click="changeItem(item,'supplier')">
+					</radio>
 					{{ item.supplierName || '-' }}
 				</view>
 				<u-divider></u-divider>
@@ -218,6 +219,9 @@
 								this.ids.push(item.id)
 							}
 						})
+						if (this.ids.indexOf('supplier@' + dto.supplierId) < 0) {
+							this.ids.push('supplier@' + dto.supplierId)
+						}
 					})
 					this.checkall = true
 				}
@@ -236,8 +240,9 @@
 					} else {
 						this.checkall = false
 						this.ids.splice(this.ids.indexOf('supplier@' + dto.supplierId), 1)
+						console.log('this.ids splice', this.ids)
 						dto.flowerList.forEach(item => {
-							this.ids.splice(this.ids.indexOf('supplier@' + item.supplierId), 1)
+							this.ids.splice(this.ids.indexOf(item.id), 1)
 						})
 					}
 
@@ -260,10 +265,13 @@
 							}
 						}
 						if (has) {
-							this.ids.push(dto.supplierId)
-							this.$forceUpdate()
-						}else{
-							console.log('has',this.ids,dto)
+							if (this.ids.indexOf('supplier@' + dto.supplierId) < 0) {
+								this.ids.push('supplier@' + dto.supplierId)
+								this.$forceUpdate()
+							}
+
+						} else {
+							console.log('has', this.ids, dto)
 						}
 
 					} else {
@@ -272,6 +280,11 @@
 						if (this.ids.indexOf(dto.id) >= 0) {
 							this.ids.splice(this.ids.indexOf(dto.id), 1)
 						}
+						//还要删除供应商的id
+						if (this.ids.indexOf('supplier@' + dto.supplierId) >= 0) {
+							this.ids.splice(this.ids.indexOf('supplier@' + dto.supplierId), 1)
+						}
+
 					}
 
 				}

--
Gitblit v1.9.3