Jelajahi Sumber

促销产品id修改

xiaohaizhao 10 bulan lalu
induk
melakukan
1f35d971ca

+ 1 - 0
packageA/activity/selectProduct/cart/index.js

@@ -107,6 +107,7 @@ Page({
 			return {
 				"sa_orderitemsid": 0,
 				"itemid": v.itemid,
+				"sa_promotion_itemsid": v.sa_promotion_itemsid,
 				"sa_brandid": v.sa_brandid,
 				"qty": v.qty,
 				width: v.width || 0,

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

@@ -13,7 +13,7 @@ Page({
     loading: true,
     params: {}, //请求体
     result: [], //返回结果
-    idname: "itemid", //idkey
+    idname: "sa_promotion_itemsid", //idkey
     showName: "itemname",
     newPrice: "price",
     oldPrice: "oldprice",
@@ -22,6 +22,7 @@ Page({
     privacyFieldC: []
   },
   onLoad(options) {
+    console.log(options)
     if (options.params) {
       let params = JSON.parse(options.params);
       if (!params.content.pageNumber || !params.content.pageTotal) {
@@ -83,14 +84,16 @@ Page({
         "content": {
           sa_promotionid: this.data.params.content.sa_promotionid,
           items: this.data.resultList.map(v => {
+            console.log(v)
             return {
               "sa_brandid": this.data.params.content.sa_brandid,
               "sa_promotionid": this.data.params.content.sa_promotionid,
-              "itemid": v.itemid,
+              "sa_promotion_itemsid": v.sa_promotion_itemsid,
               "qty": v.qty,
               "itemno": v.itemno,
               "tradefield": v.tradefield.map(s => s.tradefield).join(","),
               sa_promotion_itemsid: v.sa_promotion_itemsid,
+              itemid: v.itemid,
               "width": v.width || 0,
               "length": v.length || 0,
             }
@@ -321,7 +324,7 @@ Page({
     this.setData({
       [`list[${index}].qty`]: qty
     });
-    let i = this.data.resultList.findIndex(v => v.itemid == item.itemid);
+    let i = this.data.resultList.findIndex(v => v.sa_promotion_itemsid == item.sa_promotion_itemsid);
     if (i !== -1) this.data.resultList[i].qty = qty;
   },
   stepperChange(e) {
@@ -337,7 +340,7 @@ Page({
     this.setData({
       [`list[${index}]`]: item
     })
-    let i = this.data.resultList.findIndex(v => v.itemid == item.itemid);
+    let i = this.data.resultList.findIndex(v => v.sa_promotion_itemsid == item.sa_promotion_itemsid);
     if (i !== -1) this.data.resultList[i] = item;
   },
   onUnload() {

+ 2 - 2
packageA/activity/selectProduct/index.wxml

@@ -1,7 +1,7 @@
 <van-search class="search" value="{{ params.content.where.condition }}" shape="round" placeholder="请输入搜索关键词" bind:search='startSearch' bind:clear='onClear' />
 <custom id="Custom" isOldPrice='{{true}}' />
 <Yl_ListBox id='ListBox' bind:getlist='getList'>
-	<navigator url="#" wx:for="{{list}}" wx:key="itemid" class="item-box">
+	<navigator url="#" wx:for="{{list}}" wx:key="sa_promotion_itemsid" class="item-box">
 		<view class="top" bindtap="changeResults" data-id="{{item[idname]}}" data-item="{{item}}" bindtap="{{item.groupqty!=0 && item.maxQty<=0?'':'changeResult'}}">
 			<view class="image">
 				<van-image width="100%" height="100%" fit="cover" src="{{item.attinfos[0].subfiles[0].url||item.attinfos[0].url||item.cover||123123}}" use-loading-slot use-error-slot lazy-load>
@@ -12,7 +12,7 @@
 			<view class="content">
 				<view class="title">
 					<text class="line-1">{{item.itemname}}</text>
-					<van-checkbox wx:if="{{!(item.groupqty!=0 && item.maxQty<=0)}}" custom-class="iconfont" shape='square' icon-size='24rpx' value="{{ decide.checked(item.itemid,result) }}" />
+					<van-checkbox wx:if="{{!(item.groupqty!=0 && item.maxQty<=0)}}" custom-class="iconfont" shape='square' icon-size='24rpx' value="{{ decide.checked(item.sa_promotion_itemsid,result) }}" />
 				</view>
 				<view class="exp">编号:{{item.itemno}}</view>
 				<view class="exp">规格:{{item.standards ||" --"}}</view>