xiaoe_mp_npm 0.5.44-test1 → 0.5.44-test10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/miniprogram_dist/ConfirmOrder/components/ConfirmOrderContent/index.js +3 -0
- package/miniprogram_dist/ConfirmOrder/components/ConfirmOrderContent/index.wxml +1 -0
- package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/index.js +40 -3
- package/miniprogram_dist/coupon/index.js +30 -0
- package/package.json +1 -1
- package/src/ConfirmOrder/components/ConfirmOrderContent/index.js +3 -0
- package/src/ConfirmOrder/components/ConfirmOrderContent/index.wxml +1 -0
- package/src/ConfirmOrder/components/GoodsInfo/index.js +40 -3
- package/src/coupon/index.js +30 -0
|
@@ -487,6 +487,7 @@ Component({
|
|
|
487
487
|
* @param {Boolean} data.triggerPrePay 本次修改是否触发批价
|
|
488
488
|
*/
|
|
489
489
|
payInfoChange(val) {
|
|
490
|
+
console.log('子组件传参父组件',val)
|
|
490
491
|
let data = {};
|
|
491
492
|
val.detail ? data = val.detail : data = val
|
|
492
493
|
this.setData({
|
|
@@ -541,6 +542,8 @@ Component({
|
|
|
541
542
|
})
|
|
542
543
|
}
|
|
543
544
|
}
|
|
545
|
+
console.log('prePayParams',this.data.prePayParams);
|
|
546
|
+
console.log('payParams',this.data.payParams);
|
|
544
547
|
},
|
|
545
548
|
// 返回箭头点击事件
|
|
546
549
|
backClick() {
|
|
@@ -83,7 +83,11 @@ Component({
|
|
|
83
83
|
isFullScreen: {
|
|
84
84
|
type: Boolean,
|
|
85
85
|
value: false
|
|
86
|
-
}
|
|
86
|
+
},
|
|
87
|
+
prePayInfo: {
|
|
88
|
+
type: Object,
|
|
89
|
+
value: () => {},
|
|
90
|
+
},
|
|
87
91
|
},
|
|
88
92
|
|
|
89
93
|
/**
|
|
@@ -91,7 +95,10 @@ Component({
|
|
|
91
95
|
*/
|
|
92
96
|
data: {
|
|
93
97
|
goodsCount: 1,
|
|
94
|
-
first: true
|
|
98
|
+
first: true,
|
|
99
|
+
usedPromoCode: '',
|
|
100
|
+
couponList: []
|
|
101
|
+
|
|
95
102
|
},
|
|
96
103
|
computed: {
|
|
97
104
|
historyBuy(data) {
|
|
@@ -306,6 +313,15 @@ Component({
|
|
|
306
313
|
this.changeVal(event)
|
|
307
314
|
}
|
|
308
315
|
},
|
|
316
|
+
'prePayInfo': function(data) {
|
|
317
|
+
console.log('data',data)
|
|
318
|
+
if(data) {
|
|
319
|
+
this.setData({
|
|
320
|
+
usedPromoCode: data?.promo_code || '',
|
|
321
|
+
couponList: this.changeCouponId(data?.coupon?.valid || []),
|
|
322
|
+
})
|
|
323
|
+
}
|
|
324
|
+
},
|
|
309
325
|
},
|
|
310
326
|
lifetimes: {
|
|
311
327
|
attached: function () {
|
|
@@ -323,6 +339,13 @@ Component({
|
|
|
323
339
|
})
|
|
324
340
|
this.countBlur(true);
|
|
325
341
|
},
|
|
342
|
+
changeCouponId(list) {
|
|
343
|
+
const arr = [];
|
|
344
|
+
for (let i = 0; i < list.length; i++) {
|
|
345
|
+
arr[i] = list[i].cu_id;
|
|
346
|
+
}
|
|
347
|
+
return arr
|
|
348
|
+
},
|
|
326
349
|
overlimit(limitType) {
|
|
327
350
|
if (limitType.detail === 'plus') {
|
|
328
351
|
if (this.data.goodsInfo?.stock === this.data.count || this.data.count > this.data.goodsInfo?.stock) {
|
|
@@ -387,9 +410,23 @@ Component({
|
|
|
387
410
|
this.setData({
|
|
388
411
|
first: false
|
|
389
412
|
})
|
|
390
|
-
this.countBlur()
|
|
413
|
+
this.countBlur();
|
|
414
|
+
this.couponCheck();
|
|
391
415
|
})
|
|
392
416
|
},
|
|
417
|
+
couponCheck(){
|
|
418
|
+
this.triggerEvent("dataChange", {
|
|
419
|
+
name: "goodsInfo",
|
|
420
|
+
prePayParams: {
|
|
421
|
+
cu_id: this.data.couponList,
|
|
422
|
+
promo_code: this.data.usedPromoCode
|
|
423
|
+
},
|
|
424
|
+
payParams: {
|
|
425
|
+
cu_id: this.data.couponList,
|
|
426
|
+
promo_code: this.data.usedPromoCode
|
|
427
|
+
},
|
|
428
|
+
});
|
|
429
|
+
},
|
|
393
430
|
// init 是否初次触发
|
|
394
431
|
countBlur(init) {
|
|
395
432
|
console.log('init',init)
|
|
@@ -30,6 +30,26 @@ Component({
|
|
|
30
30
|
setCoupon: true
|
|
31
31
|
})
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
wx.getStorage({
|
|
35
|
+
key: 'oldChooseCouponList',
|
|
36
|
+
success : (res)=> {
|
|
37
|
+
console.log('oldChooseCouponList',res)
|
|
38
|
+
if(this.changeCouponId(this.data.chooseCouponList) != JSON.parse(res.data) ){
|
|
39
|
+
this.setPricingInfo(this.changeCouponId(this.data.chooseCouponList), this.data.usedPromoCode)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
wx.getStorage({
|
|
45
|
+
key: 'oldUsedPromoCode',
|
|
46
|
+
success : (res)=> {
|
|
47
|
+
console.log('oldUsedPromoCode',res)
|
|
48
|
+
if(this.data.usedPromoCode != res.data ){
|
|
49
|
+
this.setPricingInfo(this.changeCouponId(this.data.chooseCouponList), this.data.usedPromoCode)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
})
|
|
33
53
|
}
|
|
34
54
|
},
|
|
35
55
|
},
|
|
@@ -102,6 +122,7 @@ Component({
|
|
|
102
122
|
})
|
|
103
123
|
},
|
|
104
124
|
setPricingInfoFirst(cu_id, promo_code) {
|
|
125
|
+
console.log('cu_id_first',cu_id)
|
|
105
126
|
this.triggerEvent('dataChange', {
|
|
106
127
|
name: "couponSelect",
|
|
107
128
|
payParams: {
|
|
@@ -111,6 +132,7 @@ Component({
|
|
|
111
132
|
})
|
|
112
133
|
},
|
|
113
134
|
setPricingInfo(cu_id, promo_code) {
|
|
135
|
+
console.log('cu_id',cu_id)
|
|
114
136
|
this.triggerEvent('dataChange', {
|
|
115
137
|
name: "couponSelect",
|
|
116
138
|
payParams: {
|
|
@@ -194,6 +216,14 @@ Component({
|
|
|
194
216
|
// 判断当前显示文案
|
|
195
217
|
choosedType () {
|
|
196
218
|
console.log('properties', this.properties)
|
|
219
|
+
wx.setStorage({
|
|
220
|
+
key:"oldChooseCouponList",
|
|
221
|
+
data: JSON.stringify(this.changeCouponId(this.data.chooseCouponList))
|
|
222
|
+
})
|
|
223
|
+
wx.setStorage({
|
|
224
|
+
key:"oldUsedPromoCode",
|
|
225
|
+
data: this.data.usedPromoCode
|
|
226
|
+
})
|
|
197
227
|
if (this.properties.usedPromoCode) {
|
|
198
228
|
return `已选优惠码`;
|
|
199
229
|
}
|
package/package.json
CHANGED
|
@@ -487,6 +487,7 @@ Component({
|
|
|
487
487
|
* @param {Boolean} data.triggerPrePay 本次修改是否触发批价
|
|
488
488
|
*/
|
|
489
489
|
payInfoChange(val) {
|
|
490
|
+
console.log('子组件传参父组件',val)
|
|
490
491
|
let data = {};
|
|
491
492
|
val.detail ? data = val.detail : data = val
|
|
492
493
|
this.setData({
|
|
@@ -541,6 +542,8 @@ Component({
|
|
|
541
542
|
})
|
|
542
543
|
}
|
|
543
544
|
}
|
|
545
|
+
console.log('prePayParams',this.data.prePayParams);
|
|
546
|
+
console.log('payParams',this.data.payParams);
|
|
544
547
|
},
|
|
545
548
|
// 返回箭头点击事件
|
|
546
549
|
backClick() {
|
|
@@ -83,7 +83,11 @@ Component({
|
|
|
83
83
|
isFullScreen: {
|
|
84
84
|
type: Boolean,
|
|
85
85
|
value: false
|
|
86
|
-
}
|
|
86
|
+
},
|
|
87
|
+
prePayInfo: {
|
|
88
|
+
type: Object,
|
|
89
|
+
value: () => {},
|
|
90
|
+
},
|
|
87
91
|
},
|
|
88
92
|
|
|
89
93
|
/**
|
|
@@ -91,7 +95,10 @@ Component({
|
|
|
91
95
|
*/
|
|
92
96
|
data: {
|
|
93
97
|
goodsCount: 1,
|
|
94
|
-
first: true
|
|
98
|
+
first: true,
|
|
99
|
+
usedPromoCode: '',
|
|
100
|
+
couponList: []
|
|
101
|
+
|
|
95
102
|
},
|
|
96
103
|
computed: {
|
|
97
104
|
historyBuy(data) {
|
|
@@ -306,6 +313,15 @@ Component({
|
|
|
306
313
|
this.changeVal(event)
|
|
307
314
|
}
|
|
308
315
|
},
|
|
316
|
+
'prePayInfo': function(data) {
|
|
317
|
+
console.log('data',data)
|
|
318
|
+
if(data) {
|
|
319
|
+
this.setData({
|
|
320
|
+
usedPromoCode: data?.promo_code || '',
|
|
321
|
+
couponList: this.changeCouponId(data?.coupon?.valid || []),
|
|
322
|
+
})
|
|
323
|
+
}
|
|
324
|
+
},
|
|
309
325
|
},
|
|
310
326
|
lifetimes: {
|
|
311
327
|
attached: function () {
|
|
@@ -323,6 +339,13 @@ Component({
|
|
|
323
339
|
})
|
|
324
340
|
this.countBlur(true);
|
|
325
341
|
},
|
|
342
|
+
changeCouponId(list) {
|
|
343
|
+
const arr = [];
|
|
344
|
+
for (let i = 0; i < list.length; i++) {
|
|
345
|
+
arr[i] = list[i].cu_id;
|
|
346
|
+
}
|
|
347
|
+
return arr
|
|
348
|
+
},
|
|
326
349
|
overlimit(limitType) {
|
|
327
350
|
if (limitType.detail === 'plus') {
|
|
328
351
|
if (this.data.goodsInfo?.stock === this.data.count || this.data.count > this.data.goodsInfo?.stock) {
|
|
@@ -387,9 +410,23 @@ Component({
|
|
|
387
410
|
this.setData({
|
|
388
411
|
first: false
|
|
389
412
|
})
|
|
390
|
-
this.countBlur()
|
|
413
|
+
this.countBlur();
|
|
414
|
+
this.couponCheck();
|
|
391
415
|
})
|
|
392
416
|
},
|
|
417
|
+
couponCheck(){
|
|
418
|
+
this.triggerEvent("dataChange", {
|
|
419
|
+
name: "goodsInfo",
|
|
420
|
+
prePayParams: {
|
|
421
|
+
cu_id: this.data.couponList,
|
|
422
|
+
promo_code: this.data.usedPromoCode
|
|
423
|
+
},
|
|
424
|
+
payParams: {
|
|
425
|
+
cu_id: this.data.couponList,
|
|
426
|
+
promo_code: this.data.usedPromoCode
|
|
427
|
+
},
|
|
428
|
+
});
|
|
429
|
+
},
|
|
393
430
|
// init 是否初次触发
|
|
394
431
|
countBlur(init) {
|
|
395
432
|
console.log('init',init)
|
package/src/coupon/index.js
CHANGED
|
@@ -30,6 +30,26 @@ Component({
|
|
|
30
30
|
setCoupon: true
|
|
31
31
|
})
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
wx.getStorage({
|
|
35
|
+
key: 'oldChooseCouponList',
|
|
36
|
+
success : (res)=> {
|
|
37
|
+
console.log('oldChooseCouponList',res)
|
|
38
|
+
if(this.changeCouponId(this.data.chooseCouponList) != JSON.parse(res.data) ){
|
|
39
|
+
this.setPricingInfo(this.changeCouponId(this.data.chooseCouponList), this.data.usedPromoCode)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
wx.getStorage({
|
|
45
|
+
key: 'oldUsedPromoCode',
|
|
46
|
+
success : (res)=> {
|
|
47
|
+
console.log('oldUsedPromoCode',res)
|
|
48
|
+
if(this.data.usedPromoCode != res.data ){
|
|
49
|
+
this.setPricingInfo(this.changeCouponId(this.data.chooseCouponList), this.data.usedPromoCode)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
})
|
|
33
53
|
}
|
|
34
54
|
},
|
|
35
55
|
},
|
|
@@ -102,6 +122,7 @@ Component({
|
|
|
102
122
|
})
|
|
103
123
|
},
|
|
104
124
|
setPricingInfoFirst(cu_id, promo_code) {
|
|
125
|
+
console.log('cu_id_first',cu_id)
|
|
105
126
|
this.triggerEvent('dataChange', {
|
|
106
127
|
name: "couponSelect",
|
|
107
128
|
payParams: {
|
|
@@ -111,6 +132,7 @@ Component({
|
|
|
111
132
|
})
|
|
112
133
|
},
|
|
113
134
|
setPricingInfo(cu_id, promo_code) {
|
|
135
|
+
console.log('cu_id',cu_id)
|
|
114
136
|
this.triggerEvent('dataChange', {
|
|
115
137
|
name: "couponSelect",
|
|
116
138
|
payParams: {
|
|
@@ -194,6 +216,14 @@ Component({
|
|
|
194
216
|
// 判断当前显示文案
|
|
195
217
|
choosedType () {
|
|
196
218
|
console.log('properties', this.properties)
|
|
219
|
+
wx.setStorage({
|
|
220
|
+
key:"oldChooseCouponList",
|
|
221
|
+
data: JSON.stringify(this.changeCouponId(this.data.chooseCouponList))
|
|
222
|
+
})
|
|
223
|
+
wx.setStorage({
|
|
224
|
+
key:"oldUsedPromoCode",
|
|
225
|
+
data: this.data.usedPromoCode
|
|
226
|
+
})
|
|
197
227
|
if (this.properties.usedPromoCode) {
|
|
198
228
|
return `已选优惠码`;
|
|
199
229
|
}
|