xiaoe_mp_npm 0.5.44-test8 → 0.5.44

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.
@@ -487,7 +487,6 @@ Component({
487
487
  * @param {Boolean} data.triggerPrePay 本次修改是否触发批价
488
488
  */
489
489
  payInfoChange(val) {
490
- console.log('子组件传参父组件',val)
491
490
  let data = {};
492
491
  val.detail ? data = val.detail : data = val
493
492
  this.setData({
@@ -542,8 +541,6 @@ Component({
542
541
  })
543
542
  }
544
543
  }
545
- console.log('prePayParams',this.data.prePayParams);
546
- console.log('payParams',this.data.payParams);
547
544
  },
548
545
  // 返回箭头点击事件
549
546
  backClick() {
@@ -49,7 +49,6 @@
49
49
  ></ChoosePicker>
50
50
  <!-- 商品信息 -->
51
51
  <GoodsInfo
52
- prePayInfo="{{prePayInfo}}"
53
52
  marketingData="{{ marketingData.marketing_info }}"
54
53
  goodsInfo="{{ goodsInfo }}"
55
54
  confirmOrderInfo="{{ confirmOrderInfo }}"
@@ -84,10 +84,6 @@ Component({
84
84
  type: Boolean,
85
85
  value: false
86
86
  },
87
- prePayInfo: {
88
- type: Object,
89
- value: () => {},
90
- },
91
87
  },
92
88
 
93
89
  /**
@@ -96,9 +92,6 @@ Component({
96
92
  data: {
97
93
  goodsCount: 1,
98
94
  first: true,
99
- usedPromoCode: '',
100
- couponList: []
101
-
102
95
  },
103
96
  computed: {
104
97
  historyBuy(data) {
@@ -312,16 +305,7 @@ Component({
312
305
  if (count != 1 && this.data.goodsInfo.sku_min_purchase <= 1) {
313
306
  this.changeVal(event)
314
307
  }
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
- },
308
+ }
325
309
  },
326
310
  lifetimes: {
327
311
  attached: function () {
@@ -339,13 +323,6 @@ Component({
339
323
  })
340
324
  this.countBlur(true);
341
325
  },
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
- },
349
326
  overlimit(limitType) {
350
327
  if (limitType.detail === 'plus') {
351
328
  if (this.data.goodsInfo?.stock === this.data.count || this.data.count > this.data.goodsInfo?.stock) {
@@ -411,25 +388,10 @@ Component({
411
388
  first: false
412
389
  })
413
390
  this.countBlur();
414
- this.couponCheck();
415
391
  })
416
392
  },
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
- },
430
393
  // init 是否初次触发
431
394
  countBlur(init) {
432
- console.log('init',init)
433
395
  if (this.data.count === this.data.goodsCount && init !== true) {
434
396
  return false;
435
397
  }
@@ -79,6 +79,8 @@ Component({
79
79
  this.setData({
80
80
  showPopup: false
81
81
  });
82
+ wx.removeStorage('oldChooseCouponList')
83
+ wx.removeStorage('oldUsedPromoCode')
82
84
  this.triggerEvent("closePop")
83
85
  },
84
86
  changeSheetInfo(val) {
@@ -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,
@@ -24,14 +23,39 @@ Component({
24
23
  originalPrice: data?.original_price,
25
24
  goodsPrice: data?.goods_price
26
25
  })
27
- if(!this.data.setCoupon) {
28
- console.log('this.data.chooseCouponList',this.data.chooseCouponList)
29
- let chooseCouponList = this.changeCouponId(this.data.chooseCouponList)
30
- this.setPricingInfoFirst(chooseCouponList, this.data.usedPromoCode)
31
- this.setData({
32
- setCoupon: true
33
- })
34
- }
26
+ // if(!this.data.setCoupon) {
27
+ // let chooseCouponList = this.changeCouponId(this.data.chooseCouponList)
28
+ // this.setPricingInfoFirst(chooseCouponList, this.data.usedPromoCode)
29
+ // this.setData({
30
+ // setCoupon: true
31
+ // })
32
+ // }
33
+ wx.getStorage({
34
+ key: 'oldChooseCouponList',
35
+ success : (res)=> {
36
+ console.log('this.changeCouponId(this.data.chooseCouponList)',this.changeCouponId(this.data.chooseCouponList))
37
+ console.log('oldChooseCouponList',res)
38
+ if(JSON.stringify(this.changeCouponId(this.data.chooseCouponList)) != res.data ){
39
+ this.setPricingInfoFirst(this.changeCouponId(this.data.chooseCouponList), this.data.usedPromoCode)
40
+ }
41
+ }
42
+ })
43
+ wx.getStorage({
44
+ key: 'oldUsedPromoCode',
45
+ success : (res)=> {
46
+ if(this.data.usedPromoCode != res.data ){
47
+ this.setPricingInfoFirst(this.changeCouponId(this.data.chooseCouponList), this.data.usedPromoCode)
48
+ }
49
+ }
50
+ })
51
+ wx.setStorage({
52
+ key:"oldChooseCouponList",
53
+ data: JSON.stringify(this.changeCouponId(this.data.chooseCouponList))
54
+ })
55
+ wx.setStorage({
56
+ key:"oldUsedPromoCode",
57
+ data: this.data.usedPromoCode
58
+ })
35
59
  }
36
60
  },
37
61
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xiaoe_mp_npm",
3
- "version": "0.5.44-test8",
3
+ "version": "0.5.44",
4
4
  "description": "",
5
5
  "main": "miniprogram_dist/index.js",
6
6
  "scripts": {
@@ -487,7 +487,6 @@ Component({
487
487
  * @param {Boolean} data.triggerPrePay 本次修改是否触发批价
488
488
  */
489
489
  payInfoChange(val) {
490
- console.log('子组件传参父组件',val)
491
490
  let data = {};
492
491
  val.detail ? data = val.detail : data = val
493
492
  this.setData({
@@ -542,8 +541,6 @@ Component({
542
541
  })
543
542
  }
544
543
  }
545
- console.log('prePayParams',this.data.prePayParams);
546
- console.log('payParams',this.data.payParams);
547
544
  },
548
545
  // 返回箭头点击事件
549
546
  backClick() {
@@ -49,7 +49,6 @@
49
49
  ></ChoosePicker>
50
50
  <!-- 商品信息 -->
51
51
  <GoodsInfo
52
- prePayInfo="{{prePayInfo}}"
53
52
  marketingData="{{ marketingData.marketing_info }}"
54
53
  goodsInfo="{{ goodsInfo }}"
55
54
  confirmOrderInfo="{{ confirmOrderInfo }}"
@@ -84,10 +84,6 @@ Component({
84
84
  type: Boolean,
85
85
  value: false
86
86
  },
87
- prePayInfo: {
88
- type: Object,
89
- value: () => {},
90
- },
91
87
  },
92
88
 
93
89
  /**
@@ -96,9 +92,6 @@ Component({
96
92
  data: {
97
93
  goodsCount: 1,
98
94
  first: true,
99
- usedPromoCode: '',
100
- couponList: []
101
-
102
95
  },
103
96
  computed: {
104
97
  historyBuy(data) {
@@ -312,16 +305,7 @@ Component({
312
305
  if (count != 1 && this.data.goodsInfo.sku_min_purchase <= 1) {
313
306
  this.changeVal(event)
314
307
  }
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
- },
308
+ }
325
309
  },
326
310
  lifetimes: {
327
311
  attached: function () {
@@ -339,13 +323,6 @@ Component({
339
323
  })
340
324
  this.countBlur(true);
341
325
  },
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
- },
349
326
  overlimit(limitType) {
350
327
  if (limitType.detail === 'plus') {
351
328
  if (this.data.goodsInfo?.stock === this.data.count || this.data.count > this.data.goodsInfo?.stock) {
@@ -411,25 +388,10 @@ Component({
411
388
  first: false
412
389
  })
413
390
  this.countBlur();
414
- this.couponCheck();
415
391
  })
416
392
  },
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
- },
430
393
  // init 是否初次触发
431
394
  countBlur(init) {
432
- console.log('init',init)
433
395
  if (this.data.count === this.data.goodsCount && init !== true) {
434
396
  return false;
435
397
  }
@@ -79,6 +79,8 @@ Component({
79
79
  this.setData({
80
80
  showPopup: false
81
81
  });
82
+ wx.removeStorage('oldChooseCouponList')
83
+ wx.removeStorage('oldUsedPromoCode')
82
84
  this.triggerEvent("closePop")
83
85
  },
84
86
  changeSheetInfo(val) {
@@ -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,
@@ -24,14 +23,39 @@ Component({
24
23
  originalPrice: data?.original_price,
25
24
  goodsPrice: data?.goods_price
26
25
  })
27
- if(!this.data.setCoupon) {
28
- console.log('this.data.chooseCouponList',this.data.chooseCouponList)
29
- let chooseCouponList = this.changeCouponId(this.data.chooseCouponList)
30
- this.setPricingInfoFirst(chooseCouponList, this.data.usedPromoCode)
31
- this.setData({
32
- setCoupon: true
33
- })
34
- }
26
+ // if(!this.data.setCoupon) {
27
+ // let chooseCouponList = this.changeCouponId(this.data.chooseCouponList)
28
+ // this.setPricingInfoFirst(chooseCouponList, this.data.usedPromoCode)
29
+ // this.setData({
30
+ // setCoupon: true
31
+ // })
32
+ // }
33
+ wx.getStorage({
34
+ key: 'oldChooseCouponList',
35
+ success : (res)=> {
36
+ console.log('this.changeCouponId(this.data.chooseCouponList)',this.changeCouponId(this.data.chooseCouponList))
37
+ console.log('oldChooseCouponList',res)
38
+ if(JSON.stringify(this.changeCouponId(this.data.chooseCouponList)) != res.data ){
39
+ this.setPricingInfoFirst(this.changeCouponId(this.data.chooseCouponList), this.data.usedPromoCode)
40
+ }
41
+ }
42
+ })
43
+ wx.getStorage({
44
+ key: 'oldUsedPromoCode',
45
+ success : (res)=> {
46
+ if(this.data.usedPromoCode != res.data ){
47
+ this.setPricingInfoFirst(this.changeCouponId(this.data.chooseCouponList), this.data.usedPromoCode)
48
+ }
49
+ }
50
+ })
51
+ wx.setStorage({
52
+ key:"oldChooseCouponList",
53
+ data: JSON.stringify(this.changeCouponId(this.data.chooseCouponList))
54
+ })
55
+ wx.setStorage({
56
+ key:"oldUsedPromoCode",
57
+ data: this.data.usedPromoCode
58
+ })
35
59
  }
36
60
  },
37
61
  },