소스 검색

促销活动先选中产品,在修改数量提交订单未保存数量问题

xiaohaizhao 1 년 전
부모
커밋
5ae0caee15
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      packageA/activity/selectProduct/index.js

+ 4 - 0
packageA/activity/selectProduct/index.js

@@ -297,6 +297,8 @@ Page({
     this.setData({
       [`list[${index}].qty`]: qty
     });
+    let i = this.data.resultList.findIndex(v => v.itemid == item.itemid);
+    if (i !== -1) this.data.resultList[i].qty = qty;
   },
   stepperChange(e) {
     const {
@@ -311,6 +313,8 @@ Page({
     this.setData({
       [`list[${index}]`]: item
     })
+    let i = this.data.resultList.findIndex(v => v.itemid == item.itemid);
+    if (i !== -1) this.data.resultList[i] = item;
   },
   onUnload() {
     //回收数据