Quellcode durchsuchen

修改自由商品列表重复数据

付晓文。 vor 2 Monaten
Ursprung
Commit
41eaeb9c7b
1 geänderte Dateien mit 19 neuen und 16 gelöschten Zeilen
  1. 19 16
      pages/product/creatStandard.vue

+ 19 - 16
pages/product/creatStandard.vue

@@ -89,10 +89,11 @@
 				productName: '',
 				productList: [],
 				merchantId: '',
+				_isFirstShow: true,
 				api: {
-        	url: '/app/product/purveyor/list',
-        	method: 'GET'
-      	},
+				url: '/app/product/purveyor/list',
+				method: 'GET'
+				},
       	initParams: {},
 			}
 		},
@@ -189,27 +190,29 @@
     	},
 		},
 		onShow() {
-			
-			let that = this
-			uni.getStorage({
-				key: 'login_user_info',
-				success: function(res) {
-					that.merchantId = res.data.merchantId
-					that.getProductList()
-				}
-			})
+			if (this._isFirstShow) {
+				this._isFirstShow = false;
+			} else {
+				this.getProductList();
+			}
 			uni.removeStorage({
 				key: 'smdate',
 			});
 			uni.removeStorage({
 				key: 'group',
 			});
-
 		},
 		onLoad() {
-  	  // 初始化列表
-  	  this.getProductList();
-  	}
+			const userInfo = uni.getStorageSync('login_user_info');
+			if (userInfo) {
+				this.merchantId = userInfo.merchantId;
+			}
+			this.initParams = {
+				merchantId: this.merchantId,
+				productStatus: this.productStatus,
+				productName: this.productName
+			};
+		}
 		// async onShow() {
 		// 	let that = this
 		// 	uni.getStorage({