xiaoe_mp_npm 0.1.9 → 0.1.10

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.
@@ -1,5 +1,5 @@
1
1
  import {connect} from '../../store/index'
2
- import {toast} from '../../utils'
2
+ import {toast, hasKey} from '../../utils'
3
3
 
4
4
  const computedBehavior = require('miniprogram-computed').behavior
5
5
 
@@ -8,6 +8,8 @@ const mapState = state => ({
8
8
  addressInfo: state.addressInfo,
9
9
  addressSubmitCallback: state.addressSubmitCallback
10
10
  })
11
+
12
+
11
13
  Component(
12
14
  connect(mapState)({
13
15
  behaviors: [computedBehavior],
@@ -20,7 +22,11 @@ Component(
20
22
  return Object.keys(data.addressQuery).length > 0
21
23
  },
22
24
  isAddressInfoReady(data) {
23
- return data.addressInfo.addressInfo && Object.keys(data.addressInfo.addressInfo).length > 0;
25
+ const { addressInfo } = data
26
+ if(addressInfo.express_type === 2) {
27
+ return hasKey(addressInfo.pickerUserInfo) && hasKey(addressInfo.picksiteInfo)
28
+ }
29
+ return hasKey(addressInfo.addressInfo)
24
30
  }
25
31
  },
26
32
  observers: {},
@@ -45,16 +51,13 @@ Component(
45
51
  onStateChange({detail: isEntry}) {
46
52
  this.setData({isEntry})
47
53
  },
48
- hasKey(obj) {
49
- return obj && Object.keys(obj).length > 0
50
- },
51
54
  validateSubmitInfo() {
52
55
  const info = this.data.addressInfo
53
- if (info.express_type === 1 && !this.hasKey(info.addressInfo)) {
56
+ if (info.express_type === 1 && !hasKey(info.addressInfo)) {
54
57
  toast('请先添加收货地址')
55
58
  return false
56
59
  }
57
- if (info.express_type === 2 && !(this.hasKey(info.pickerUserInfo) && this.hasKey(info.picksiteInfo))) {
60
+ if (info.express_type === 2 && !(hasKey(info.pickerUserInfo) && hasKey(info.picksiteInfo))) {
58
61
  toast('请完善提货信息')
59
62
  return false
60
63
  }
@@ -67,4 +70,4 @@ Component(
67
70
  }
68
71
  }
69
72
  })
70
- )
73
+ )
@@ -62,3 +62,7 @@ export function delay(duration = 0) {
62
62
  }, duration)
63
63
  })
64
64
  }
65
+
66
+ export function hasKey(obj) {
67
+ return obj && Object.keys(obj).length > 0
68
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xiaoe_mp_npm",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "",
5
5
  "main": "miniprogram_dist/index.js",
6
6
  "scripts": {
@@ -1,22 +1,22 @@
1
- .pickup-select-content .van-cell__value {
2
- flex: 3;
3
- }
4
- .pickup-select-content .right {
5
- display: flex;
6
- flex-direction: column;
7
- align-items: flex-end;
8
- }
9
- .pickup-select-content .right .custom-title {
10
- max-width: 450rpx;
11
- overflow: hidden;
12
- white-space: nowrap;
13
- text-overflow: ellipsis;
14
- margin-left: 16rpx;
15
- }
16
- .pickup-select-content .right .custom-site {
17
- max-width: 450rpx;
18
- overflow: hidden;
19
- white-space: nowrap;
20
- text-overflow: ellipsis;
21
- margin-left: 16rpx;
22
- }
1
+ .pickup-select-content .van-cell__value {
2
+ flex: 3;
3
+ }
4
+ .pickup-select-content .right {
5
+ display: flex;
6
+ flex-direction: column;
7
+ align-items: flex-end;
8
+ }
9
+ .pickup-select-content .right .custom-title {
10
+ max-width: 450rpx;
11
+ overflow: hidden;
12
+ white-space: nowrap;
13
+ text-overflow: ellipsis;
14
+ margin-left: 16rpx;
15
+ }
16
+ .pickup-select-content .right .custom-site {
17
+ max-width: 450rpx;
18
+ overflow: hidden;
19
+ white-space: nowrap;
20
+ text-overflow: ellipsis;
21
+ margin-left: 16rpx;
22
+ }
@@ -1,5 +1,5 @@
1
1
  import {connect} from '../../store/index'
2
- import {toast} from '../../utils'
2
+ import {toast, hasKey} from '../../utils'
3
3
 
4
4
  const computedBehavior = require('miniprogram-computed').behavior
5
5
 
@@ -8,6 +8,8 @@ const mapState = state => ({
8
8
  addressInfo: state.addressInfo,
9
9
  addressSubmitCallback: state.addressSubmitCallback
10
10
  })
11
+
12
+
11
13
  Component(
12
14
  connect(mapState)({
13
15
  behaviors: [computedBehavior],
@@ -20,7 +22,11 @@ Component(
20
22
  return Object.keys(data.addressQuery).length > 0
21
23
  },
22
24
  isAddressInfoReady(data) {
23
- return data.addressInfo.addressInfo && Object.keys(data.addressInfo.addressInfo).length > 0;
25
+ const { addressInfo } = data
26
+ if(addressInfo.express_type === 2) {
27
+ return hasKey(addressInfo.pickerUserInfo) && hasKey(addressInfo.picksiteInfo)
28
+ }
29
+ return hasKey(addressInfo.addressInfo)
24
30
  }
25
31
  },
26
32
  observers: {},
@@ -45,16 +51,13 @@ Component(
45
51
  onStateChange({detail: isEntry}) {
46
52
  this.setData({isEntry})
47
53
  },
48
- hasKey(obj) {
49
- return obj && Object.keys(obj).length > 0
50
- },
51
54
  validateSubmitInfo() {
52
55
  const info = this.data.addressInfo
53
- if (info.express_type === 1 && !this.hasKey(info.addressInfo)) {
56
+ if (info.express_type === 1 && !hasKey(info.addressInfo)) {
54
57
  toast('请先添加收货地址')
55
58
  return false
56
59
  }
57
- if (info.express_type === 2 && !(this.hasKey(info.pickerUserInfo) && this.hasKey(info.picksiteInfo))) {
60
+ if (info.express_type === 2 && !(hasKey(info.pickerUserInfo) && hasKey(info.picksiteInfo))) {
58
61
  toast('请完善提货信息')
59
62
  return false
60
63
  }
@@ -67,4 +70,4 @@ Component(
67
70
  }
68
71
  }
69
72
  })
70
- )
73
+ )
@@ -62,3 +62,7 @@ export function delay(duration = 0) {
62
62
  }, duration)
63
63
  })
64
64
  }
65
+
66
+ export function hasKey(obj) {
67
+ return obj && Object.keys(obj).length > 0
68
+ }