xiaoe_mp_npm 0.1.7 → 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.
@@ -219,6 +219,17 @@ Component({
219
219
  },
220
220
  },
221
221
  observers: {
222
+ distributionMode(val) {
223
+ if (val === 1) {
224
+ this.setData({
225
+ express_type: val
226
+ })
227
+ } else if (val === 2) {
228
+ this.setData({
229
+ express_type: val
230
+ })
231
+ }
232
+ },
222
233
  marketingData(marketingData) {
223
234
  // 这里的逻辑应该是存在拼团的时候那么payment_type就要赋值为13,如果是限时折扣或者是单买的话,payment_type不做赋值默认为2
224
235
  if (
@@ -1,9 +1,24 @@
1
1
  .pickup-select-content {
2
2
  .van-cell__value {
3
3
  flex: 3;
4
- text-align: right;
5
4
  }
6
- .custom-title {
7
- margin-left: 16rpx;
5
+ .right {
6
+ display: flex;
7
+ flex-direction: column;
8
+ align-items: flex-end;
9
+ .custom-title {
10
+ max-width: 450rpx;
11
+ overflow: hidden;
12
+ white-space: nowrap;
13
+ text-overflow: ellipsis;
14
+ margin-left: 16rpx;
15
+ }
16
+ .custom-site {
17
+ max-width: 450rpx;
18
+ overflow: hidden;
19
+ white-space: nowrap;
20
+ text-overflow: ellipsis;
21
+ margin-left: 16rpx;
22
+ }
8
23
  }
9
24
  }
@@ -5,8 +5,10 @@
5
5
  <view slot="title">
6
6
  <van-tag color="#EBF1FF" text-color="#105CFB">自提</van-tag>
7
7
  </view>
8
- <view class="custom-title">{{ setPlace_name }}</view>
9
- <view class="custom-site">{{ setPlace_area }}</view>
8
+ <view class="right">
9
+ <view class="custom-title">{{ setPlace_name }}</view>
10
+ <view class="custom-site">{{ setPlace_area }}</view>
11
+ </view>
10
12
  </van-cell>
11
13
  </van-cell-group>
12
14
  </view>
@@ -1,7 +1,22 @@
1
1
  .pickup-select-content .van-cell__value {
2
2
  flex: 3;
3
- text-align: right;
4
3
  }
5
- .pickup-select-content .custom-title {
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;
6
21
  margin-left: 16rpx;
7
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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xiaoe_mp_npm",
3
- "version": "0.1.7",
3
+ "version": "0.1.10",
4
4
  "description": "",
5
5
  "main": "miniprogram_dist/index.js",
6
6
  "scripts": {
@@ -219,6 +219,17 @@ Component({
219
219
  },
220
220
  },
221
221
  observers: {
222
+ distributionMode(val) {
223
+ if (val === 1) {
224
+ this.setData({
225
+ express_type: val
226
+ })
227
+ } else if (val === 2) {
228
+ this.setData({
229
+ express_type: val
230
+ })
231
+ }
232
+ },
222
233
  marketingData(marketingData) {
223
234
  // 这里的逻辑应该是存在拼团的时候那么payment_type就要赋值为13,如果是限时折扣或者是单买的话,payment_type不做赋值默认为2
224
235
  if (
@@ -1,9 +1,24 @@
1
1
  .pickup-select-content {
2
2
  .van-cell__value {
3
3
  flex: 3;
4
- text-align: right;
5
4
  }
6
- .custom-title {
7
- margin-left: 16rpx;
5
+ .right {
6
+ display: flex;
7
+ flex-direction: column;
8
+ align-items: flex-end;
9
+ .custom-title {
10
+ max-width: 450rpx;
11
+ overflow: hidden;
12
+ white-space: nowrap;
13
+ text-overflow: ellipsis;
14
+ margin-left: 16rpx;
15
+ }
16
+ .custom-site {
17
+ max-width: 450rpx;
18
+ overflow: hidden;
19
+ white-space: nowrap;
20
+ text-overflow: ellipsis;
21
+ margin-left: 16rpx;
22
+ }
8
23
  }
9
24
  }
@@ -5,8 +5,10 @@
5
5
  <view slot="title">
6
6
  <van-tag color="#EBF1FF" text-color="#105CFB">自提</van-tag>
7
7
  </view>
8
- <view class="custom-title">{{ setPlace_name }}</view>
9
- <view class="custom-site">{{ setPlace_area }}</view>
8
+ <view class="right">
9
+ <view class="custom-title">{{ setPlace_name }}</view>
10
+ <view class="custom-site">{{ setPlace_area }}</view>
11
+ </view>
10
12
  </van-cell>
11
13
  </van-cell-group>
12
14
  </view>
@@ -1,7 +1,22 @@
1
1
  .pickup-select-content .van-cell__value {
2
2
  flex: 3;
3
- text-align: right;
4
3
  }
5
- .pickup-select-content .custom-title {
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;
6
21
  margin-left: 16rpx;
7
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
+ }