xiaoe_mp_npm 0.5.44-test7 → 0.5.44-test9

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.
@@ -410,9 +410,23 @@ Component({
410
410
  this.setData({
411
411
  first: false
412
412
  })
413
- this.countBlur()
413
+ this.countBlur();
414
+ this.couponCheck();
414
415
  })
415
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
+ },
416
430
  // init 是否初次触发
417
431
  countBlur(init) {
418
432
  console.log('init',init)
@@ -11,7 +11,6 @@ Component({
11
11
  })
12
12
  },
13
13
  'prePayInfo': function(data) {
14
- console.log('data',data)
15
14
  if(data) {
16
15
  this.setData({
17
16
  couponDiscount: data?.coupon_discount || 0,
@@ -25,13 +24,17 @@ Component({
25
24
  goodsPrice: data?.goods_price
26
25
  })
27
26
  if(!this.data.setCoupon) {
28
- console.log('this.data.chooseCouponList',this.data.chooseCouponList)
29
27
  let chooseCouponList = this.changeCouponId(this.data.chooseCouponList)
30
28
  this.setPricingInfoFirst(chooseCouponList, this.data.usedPromoCode)
31
29
  this.setData({
32
30
  setCoupon: true
33
31
  })
34
32
  }
33
+ let oldChooseCouponList = JSON.parse(sessionStorage.getItem('oldChooseCouponList'))
34
+ let oldUsedPromoCode = sessionStorage.getItem('oldUsedPromoCode')
35
+ if(this.changeCouponId(this.data.chooseCouponList) != oldChooseCouponList || this.data.usedPromoCode != oldUsedPromoCode){
36
+ this.setPricingInfo(this.changeCouponId(this.data.chooseCouponList), this.data.usedPromoCode)
37
+ }
35
38
  }
36
39
  },
37
40
  },
@@ -198,6 +201,9 @@ Component({
198
201
  // 判断当前显示文案
199
202
  choosedType () {
200
203
  console.log('properties', this.properties)
204
+ sessionStorage.setItem('oldChooseCouponList', JSON.stringify(this.changeCouponId(this.data.chooseCouponList)))
205
+ sessionStorage.setItem('oldUsedPromoCode',this.data.usedPromoCode)
206
+ console.log('oldChooseCouponList',JSON.parse(sessionStorage.getItem('oldChooseCouponList')));
201
207
  if (this.properties.usedPromoCode) {
202
208
  return `已选优惠码`;
203
209
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xiaoe_mp_npm",
3
- "version": "0.5.44-test7",
3
+ "version": "0.5.44-test9",
4
4
  "description": "",
5
5
  "main": "miniprogram_dist/index.js",
6
6
  "scripts": {
@@ -410,9 +410,23 @@ Component({
410
410
  this.setData({
411
411
  first: false
412
412
  })
413
- this.countBlur()
413
+ this.countBlur();
414
+ this.couponCheck();
414
415
  })
415
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
+ },
416
430
  // init 是否初次触发
417
431
  countBlur(init) {
418
432
  console.log('init',init)
@@ -11,7 +11,6 @@ Component({
11
11
  })
12
12
  },
13
13
  'prePayInfo': function(data) {
14
- console.log('data',data)
15
14
  if(data) {
16
15
  this.setData({
17
16
  couponDiscount: data?.coupon_discount || 0,
@@ -25,13 +24,17 @@ Component({
25
24
  goodsPrice: data?.goods_price
26
25
  })
27
26
  if(!this.data.setCoupon) {
28
- console.log('this.data.chooseCouponList',this.data.chooseCouponList)
29
27
  let chooseCouponList = this.changeCouponId(this.data.chooseCouponList)
30
28
  this.setPricingInfoFirst(chooseCouponList, this.data.usedPromoCode)
31
29
  this.setData({
32
30
  setCoupon: true
33
31
  })
34
32
  }
33
+ let oldChooseCouponList = JSON.parse(sessionStorage.getItem('oldChooseCouponList'))
34
+ let oldUsedPromoCode = sessionStorage.getItem('oldUsedPromoCode')
35
+ if(this.changeCouponId(this.data.chooseCouponList) != oldChooseCouponList || this.data.usedPromoCode != oldUsedPromoCode){
36
+ this.setPricingInfo(this.changeCouponId(this.data.chooseCouponList), this.data.usedPromoCode)
37
+ }
35
38
  }
36
39
  },
37
40
  },
@@ -198,6 +201,9 @@ Component({
198
201
  // 判断当前显示文案
199
202
  choosedType () {
200
203
  console.log('properties', this.properties)
204
+ sessionStorage.setItem('oldChooseCouponList', JSON.stringify(this.changeCouponId(this.data.chooseCouponList)))
205
+ sessionStorage.setItem('oldUsedPromoCode',this.data.usedPromoCode)
206
+ console.log('oldChooseCouponList',JSON.parse(sessionStorage.getItem('oldChooseCouponList')));
201
207
  if (this.properties.usedPromoCode) {
202
208
  return `已选优惠码`;
203
209
  }