Explorar o código

收藏夹修复bug

xiaohaizhao hai 1 ano
pai
achega
6f7a709fb8
Modificáronse 2 ficheiros con 13 adicións e 5 borrados
  1. 4 0
      packageA/favorites/index.js
  2. 9 5
      packageA/market/detail.js

+ 4 - 0
packageA/favorites/index.js

@@ -284,7 +284,11 @@ Page({
             icon: "none"
           });
           if (res.msg != '成功') return;
+          this.setData({
+            results: this.data.results.filter(v => v != item.sa_favoritesid)
+          })
           this.getList(true)
+          this.computeSum();
           getApp().globalData.getFavoriteCount()
         })
       }

+ 9 - 5
packageA/market/detail.js

@@ -39,10 +39,9 @@ Page({
 		this.setData({
 			userrole: wx.getStorageSync('userrole')
 		})
-		this.getDetail(true);
 	},
 	/* 获取详情 */
-	getDetail(init = false) {
+	getDetail(init = false, getCustom = true) {
 		let content = this.data.content;
 		if (sys_enterpriseid) content.sys_enterpriseid = sys_enterpriseid;
 		_Http.basic({
@@ -79,7 +78,7 @@ Page({
 				itemCount: ['specRows', 'cheekRows', 'materialRows', 'colorRows'].filter(v => res.data[v].length).length
 			});
 			//是否定制
-			if (item.iscustomsize == 1) this.selectComponent("#customMade").init(item);
+			if (getCustom && item.iscustomsize == 1) this.selectComponent("#customMade").init(item);
 		})
 	},
 	/* 预览媒体 */
@@ -147,7 +146,6 @@ Page({
 		})
 		this.getDetail(valuename == "spec")
 	},
-
 	clickBut() {
 		this.data.detail.tradefield.length >= 2 ? wx.showToast({
 			title: '请选择加入产品领域',
@@ -288,5 +286,11 @@ Page({
 			detail: "Collect"
 		})
 		wx.navigateBack();
-	}
+	},
+	onShow() {
+		this.setData({
+			favoriteCount: getApp().globalData.favoriteCount
+		})
+		this.getDetail(true,this.data.loading);
+	},
 })