Ver Fonte

Merge branch 'bug/收藏夹优化' into 测试

xiaohaizhao há 1 ano atrás
pai
commit
1305927601
2 ficheiros alterados com 42 adições e 21 exclusões
  1. 41 20
      packageA/favorites/index.js
  2. 1 1
      packageA/favorites/index.wxml

+ 41 - 20
packageA/favorites/index.js

@@ -76,26 +76,35 @@ Page({
         obj[name] = custom[key]
       }
       return new Promise((resolve) => {
-        _Http.basic({
-          "id": 20231121143403,
-          "content": {
-            "itemid": item.itemid,
-            "sa_favoritesid": item.sa_favoritesid,
-            "favoritesqty": item.favoritesqty,
-            "qty": item.favoritesqty,
-            ...obj,
-            ...custom,
-            "iscollection": true
-          },
-        }).then(res => {
-          console.log("修改定制", res)
-          wx.showToast({
-            title: res.msg != '成功' ? res.msg : '修改成功',
-            icon: "none"
-          });
-          this.getList()
-          resolve(true)
+        console.log('定制信息', custom)
+        let index = this.data.list.findIndex(v => v.sa_favoritesid == item.sa_favoritesid);
+        item = Object.assign(item, custom);
+        item.customText = getCustomText(item, 'favorites')
+        this.setData({
+          [`list[${index}]`]: item
         })
+        this.computeSum()
+        resolve(true)
+        /*   _Http.basic({
+            "id": 20231121143403,
+            "content": {
+              "itemid": item.itemid,
+              "sa_favoritesid": item.sa_favoritesid,
+              "favoritesqty": item.favoritesqty,
+              "qty": item.favoritesqty,
+              ...obj,
+              ...custom,
+              "iscollection": true
+            },
+          }).then(res => {
+            console.log("修改定制", res)
+            wx.showToast({
+              title: res.msg != '成功' ? res.msg : '修改成功',
+              icon: "none"
+            });
+            this.getList()
+            resolve(true)
+          }) */
       })
     }
     if (item) this.selectComponent("#Custom").onClick(item)
@@ -124,7 +133,7 @@ Page({
       this.setData({
         list: res.data.map(v => {
           v.showPrice = CNY(v.gradeprice)
-          if (v.iscustomsize) v.customText = getCustomText(v, 'favorites');
+          if (v.iscustomsize) v.customText = ""; //getCustomText(v, 'favorites')
           return v
         })
       });
@@ -195,6 +204,12 @@ Page({
   /* 处理生成订单 */
   handleSubmit(index) {
     let data = this.data.classList[index];
+    let illegals = data.list.filter(v => v.iscustomsize && v.customText == "").map(v => v.erpitemname);
+    if (illegals.length) return wx.showModal({
+      title: '提示',
+      content: `${illegals}定制信息有误,请检查!`,
+      showCancel: false
+    })
     wx.showLoading({
       title: '生成中...',
     })
@@ -260,6 +275,12 @@ Page({
   },
   addToShoppingCart(index) {
     let data = this.data.classList[index];
+    let illegals = data.list.filter(v => v.iscustomsize && v.customText == "").map(v => v.erpitemname);
+    if (illegals.length) return wx.showModal({
+      title: '提示',
+      content: `${illegals}定制信息有误,请检查!`,
+      showCancel: false
+    })
     wx.showLoading({
       title: '处理中...',
     })

+ 1 - 1
packageA/favorites/index.wxml

@@ -20,7 +20,7 @@
 					<view class="exp">品牌:{{item.brandname ||" --"}}</view>
 					<view class="exp">领域:{{item.tradefield_shoppingcart ||" --"}}</view>
 					<view class="exp" wx:if="{{item.iscustomsize}}" data-item="{{item}}" catch:tap="customization" style="color:#085CDF;">
-						{{item.customText}}
+						{{item.customText||'定制信息'}}
 						<van-icon name="arrow-down" />
 					</view>
 					<view class="price" style="bottom: {{item.iscustomsize?'40rpx':'0rpx'}};">{{handleHide.verify(item.showPrice,'收藏夹价格',privacyFieldC)}}/{{item.unitname}}</view>