xiaoe_mp_npm 0.5.43 → 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/.gitlab-ci.yml CHANGED
@@ -7,6 +7,7 @@ build_test:
7
7
  - feature/live_marketing_iteration
8
8
  - feature/remove-error-report
9
9
  - fix/record-lottery
10
+ - feature/coupon_fix
10
11
  tags:
11
12
  - fe-group-prod-runner-2
12
13
  script:
@@ -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() {
@@ -49,6 +49,7 @@
49
49
  ></ChoosePicker>
50
50
  <!-- 商品信息 -->
51
51
  <GoodsInfo
52
+ prePayInfo="{{prePayInfo}}"
52
53
  marketingData="{{ marketingData.marketing_info }}"
53
54
  goodsInfo="{{ goodsInfo }}"
54
55
  confirmOrderInfo="{{ confirmOrderInfo }}"
@@ -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) {
@@ -372,6 +395,7 @@ Component({
372
395
  }
373
396
  },
374
397
  changeVal(event) {
398
+ console.log('event',event)
375
399
  let data = event.detail
376
400
  if (data <= 0) {
377
401
  data = 1
@@ -386,11 +410,26 @@ Component({
386
410
  this.setData({
387
411
  first: false
388
412
  })
389
- this.countBlur()
413
+ this.countBlur();
414
+ this.couponCheck();
390
415
  })
391
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
+ },
392
430
  // init 是否初次触发
393
431
  countBlur(init) {
432
+ console.log('init',init)
394
433
  if (this.data.count === this.data.goodsCount && init !== true) {
395
434
  return false;
396
435
  }
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xiaoe_mp_npm",
3
- "version": "0.5.43",
3
+ "version": "0.5.44-test10",
4
4
  "description": "",
5
5
  "main": "miniprogram_dist/index.js",
6
6
  "scripts": {
@@ -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() {
@@ -49,6 +49,7 @@
49
49
  ></ChoosePicker>
50
50
  <!-- 商品信息 -->
51
51
  <GoodsInfo
52
+ prePayInfo="{{prePayInfo}}"
52
53
  marketingData="{{ marketingData.marketing_info }}"
53
54
  goodsInfo="{{ goodsInfo }}"
54
55
  confirmOrderInfo="{{ confirmOrderInfo }}"
@@ -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) {
@@ -372,6 +395,7 @@ Component({
372
395
  }
373
396
  },
374
397
  changeVal(event) {
398
+ console.log('event',event)
375
399
  let data = event.detail
376
400
  if (data <= 0) {
377
401
  data = 1
@@ -386,11 +410,26 @@ Component({
386
410
  this.setData({
387
411
  first: false
388
412
  })
389
- this.countBlur()
413
+ this.countBlur();
414
+ this.couponCheck();
390
415
  })
391
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
+ },
392
430
  // init 是否初次触发
393
431
  countBlur(init) {
432
+ console.log('init',init)
394
433
  if (this.data.count === this.data.goodsCount && init !== true) {
395
434
  return false;
396
435
  }
@@ -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
  }