create-weapp-vite 2.0.32 → 2.0.33
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/README.md +0 -1
- package/dist/{chunk-IT75MAH3.js → chunk-MXKCD6NA.js} +2 -3
- package/dist/cli.js +1 -5
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/templates/wevu/package.json +1 -1
- package/templates/wevu-tdesign/package.json +1 -1
- package/templates/wevu-retail/.editorconfig +0 -9
- package/templates/wevu-retail/.vscode/settings.json +0 -10
- package/templates/wevu-retail/AGENTS.md +0 -35
- package/templates/wevu-retail/README.md +0 -26
- package/templates/wevu-retail/auto-import-components.json +0 -1
- package/templates/wevu-retail/gitignore +0 -35
- package/templates/wevu-retail/package.json +0 -42
- package/templates/wevu-retail/postcss.config.js +0 -6
- package/templates/wevu-retail/project.config.json +0 -44
- package/templates/wevu-retail/project.private.config.json +0 -8
- package/templates/wevu-retail/src/app.vue +0 -104
- package/templates/wevu-retail/src/common/updateManager.ts +0 -29
- package/templates/wevu-retail/src/components/filter/index.vue +0 -134
- package/templates/wevu-retail/src/components/filter-popup/index.vue +0 -67
- package/templates/wevu-retail/src/components/goods-card/index.vue +0 -219
- package/templates/wevu-retail/src/components/goods-list/index.vue +0 -91
- package/templates/wevu-retail/src/components/load-more/index.vue +0 -99
- package/templates/wevu-retail/src/components/loading-content/index.vue +0 -48
- package/templates/wevu-retail/src/components/price/index.vue +0 -104
- package/templates/wevu-retail/src/components/promotion/ui-coupon-card/index.vue +0 -143
- package/templates/wevu-retail/src/components/promotion/ui-coupon-card/tools.wxs +0 -18
- package/templates/wevu-retail/src/components/swipeout/index.vue +0 -118
- package/templates/wevu-retail/src/components/swipeout/swipe.wxs +0 -151
- package/templates/wevu-retail/src/components/webp-image/index.vue +0 -105
- package/templates/wevu-retail/src/components/webp-image/utils.wxs +0 -140
- package/templates/wevu-retail/src/config/index.ts +0 -20437
- package/templates/wevu-retail/src/custom-tab-bar/data.ts +0 -22
- package/templates/wevu-retail/src/custom-tab-bar/index.vue +0 -62
- package/templates/wevu-retail/src/model/activities.ts +0 -7
- package/templates/wevu-retail/src/model/activity.ts +0 -18
- package/templates/wevu-retail/src/model/address.ts +0 -31
- package/templates/wevu-retail/src/model/cart.ts +0 -306
- package/templates/wevu-retail/src/model/category.ts +0 -175
- package/templates/wevu-retail/src/model/comments/queryDetail.ts +0 -50
- package/templates/wevu-retail/src/model/comments.ts +0 -298
- package/templates/wevu-retail/src/model/coupon.ts +0 -39
- package/templates/wevu-retail/src/model/detailsComments.ts +0 -30
- package/templates/wevu-retail/src/model/good.ts +0 -1904
- package/templates/wevu-retail/src/model/goods.ts +0 -7
- package/templates/wevu-retail/src/model/order/applyService.ts +0 -329
- package/templates/wevu-retail/src/model/order/orderConfirm.ts +0 -147
- package/templates/wevu-retail/src/model/order/orderDetail.ts +0 -1191
- package/templates/wevu-retail/src/model/order/orderList.ts +0 -1033
- package/templates/wevu-retail/src/model/promotion.ts +0 -20
- package/templates/wevu-retail/src/model/search.ts +0 -60
- package/templates/wevu-retail/src/model/submitComment.ts +0 -58
- package/templates/wevu-retail/src/model/swiper.ts +0 -39
- package/templates/wevu-retail/src/model/usercenter.ts +0 -52
- package/templates/wevu-retail/src/pages/cart/components/cart-bar/index.vue +0 -104
- package/templates/wevu-retail/src/pages/cart/components/cart-empty/index.vue +0 -41
- package/templates/wevu-retail/src/pages/cart/components/cart-group/index.vue +0 -333
- package/templates/wevu-retail/src/pages/cart/components/cart-group/index.wxs +0 -5
- package/templates/wevu-retail/src/pages/cart/components/cart-group/utils.wxs +0 -20
- package/templates/wevu-retail/src/pages/cart/components/goods-card/index.vue +0 -334
- package/templates/wevu-retail/src/pages/cart/components/specs-popup/index.vue +0 -100
- package/templates/wevu-retail/src/pages/cart/index.vue +0 -342
- package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/README.md +0 -95
- package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/c-sidebar-item/index.vue +0 -73
- package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/index.vue +0 -121
- package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-tabbar/c-tabbar-more/index.vue +0 -74
- package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-tabbar/index.vue +0 -102
- package/templates/wevu-retail/src/pages/category/components/goods-category/index.vue +0 -137
- package/templates/wevu-retail/src/pages/category/index.vue +0 -50
- package/templates/wevu-retail/src/pages/coupon/components/coupon-card/index.vue +0 -95
- package/templates/wevu-retail/src/pages/coupon/components/floating-button/index.vue +0 -44
- package/templates/wevu-retail/src/pages/coupon/coupon-activity-goods/index.vue +0 -135
- package/templates/wevu-retail/src/pages/coupon/coupon-detail/index.vue +0 -94
- package/templates/wevu-retail/src/pages/coupon/coupon-list/index.vue +0 -136
- package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/images-videos/assets/play.png +0 -0
- package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/images-videos/index.vue +0 -65
- package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/my-video/index.vue +0 -92
- package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/index.vue +0 -93
- package/templates/wevu-retail/src/pages/goods/comments/create/index.vue +0 -196
- package/templates/wevu-retail/src/pages/goods/comments/index.vue +0 -293
- package/templates/wevu-retail/src/pages/goods/details/components/buy-bar/index.vue +0 -117
- package/templates/wevu-retail/src/pages/goods/details/components/goods-specs-popup/index.vue +0 -440
- package/templates/wevu-retail/src/pages/goods/details/components/promotion-popup/index.vue +0 -83
- package/templates/wevu-retail/src/pages/goods/details/index.vue +0 -598
- package/templates/wevu-retail/src/pages/goods/list/index.vue +0 -299
- package/templates/wevu-retail/src/pages/goods/result/index.vue +0 -350
- package/templates/wevu-retail/src/pages/goods/search/index.vue +0 -196
- package/templates/wevu-retail/src/pages/home/home.vue +0 -215
- package/templates/wevu-retail/src/pages/home/readme +0 -8
- package/templates/wevu-retail/src/pages/order/after-service-detail/api.ts +0 -34
- package/templates/wevu-retail/src/pages/order/after-service-detail/index.vue +0 -430
- package/templates/wevu-retail/src/pages/order/after-service-list/api.ts +0 -1262
- package/templates/wevu-retail/src/pages/order/after-service-list/index.vue +0 -299
- package/templates/wevu-retail/src/pages/order/apply-service/index.vue +0 -665
- package/templates/wevu-retail/src/pages/order/components/after-service-button-bar/index.vue +0 -142
- package/templates/wevu-retail/src/pages/order/components/customer-service/index.vue +0 -75
- package/templates/wevu-retail/src/pages/order/components/goods-card/index.vue +0 -356
- package/templates/wevu-retail/src/pages/order/components/noGoods/noGood.wxs +0 -17
- package/templates/wevu-retail/src/pages/order/components/noGoods/noGoods.vue +0 -125
- package/templates/wevu-retail/src/pages/order/components/order-button-bar/index.vue +0 -262
- package/templates/wevu-retail/src/pages/order/components/order-card/index.vue +0 -126
- package/templates/wevu-retail/src/pages/order/components/order-goods-card/index.vue +0 -86
- package/templates/wevu-retail/src/pages/order/components/reason-sheet/index.vue +0 -161
- package/templates/wevu-retail/src/pages/order/components/reason-sheet/reasonSheet.ts +0 -25
- package/templates/wevu-retail/src/pages/order/components/selectCoupons/mock.ts +0 -22
- package/templates/wevu-retail/src/pages/order/components/selectCoupons/selectCoupon.wxs +0 -16
- package/templates/wevu-retail/src/pages/order/components/selectCoupons/selectCoupons.vue +0 -207
- package/templates/wevu-retail/src/pages/order/components/specs-goods-card/index.vue +0 -185
- package/templates/wevu-retail/src/pages/order/config.ts +0 -94
- package/templates/wevu-retail/src/pages/order/delivery-detail/index.vue +0 -145
- package/templates/wevu-retail/src/pages/order/delivery-detail/isUrl.wxs +0 -7
- package/templates/wevu-retail/src/pages/order/fill-tracking-no/api.ts +0 -71
- package/templates/wevu-retail/src/pages/order/fill-tracking-no/index.vue +0 -267
- package/templates/wevu-retail/src/pages/order/invoice/index.vue +0 -94
- package/templates/wevu-retail/src/pages/order/order-confirm/components/address-card/index.vue +0 -78
- package/templates/wevu-retail/src/pages/order/order-confirm/getNotes.wxs +0 -11
- package/templates/wevu-retail/src/pages/order/order-confirm/handleInvoice.wxs +0 -11
- package/templates/wevu-retail/src/pages/order/order-confirm/index.vue +0 -707
- package/templates/wevu-retail/src/pages/order/order-confirm/order.wxs +0 -8
- package/templates/wevu-retail/src/pages/order/order-confirm/pay.ts +0 -115
- package/templates/wevu-retail/src/pages/order/order-detail/index.vue +0 -456
- package/templates/wevu-retail/src/pages/order/order-list/index.vue +0 -288
- package/templates/wevu-retail/src/pages/order/pay-result/index.vue +0 -77
- package/templates/wevu-retail/src/pages/order/receipt/index.vue +0 -336
- package/templates/wevu-retail/src/pages/promotion/promotion-detail/index.vue +0 -145
- package/templates/wevu-retail/src/pages/user/address/edit/index.vue +0 -514
- package/templates/wevu-retail/src/pages/user/address/list/index.vue +0 -249
- package/templates/wevu-retail/src/pages/user/components/t-location/index.vue +0 -156
- package/templates/wevu-retail/src/pages/user/components/ui-address-item/index.vue +0 -92
- package/templates/wevu-retail/src/pages/user/name-edit/index.vue +0 -49
- package/templates/wevu-retail/src/pages/user/person-info/index.vue +0 -198
- package/templates/wevu-retail/src/pages/usercenter/address/edit/util.ts +0 -33
- package/templates/wevu-retail/src/pages/usercenter/components/order-group/index.vue +0 -90
- package/templates/wevu-retail/src/pages/usercenter/components/ui-select-picker/index.vue +0 -108
- package/templates/wevu-retail/src/pages/usercenter/components/user-center-card/index.vue +0 -82
- package/templates/wevu-retail/src/pages/usercenter/index.vue +0 -301
- package/templates/wevu-retail/src/services/_utils/delay.ts +0 -3
- package/templates/wevu-retail/src/services/_utils/timeout.ts +0 -3
- package/templates/wevu-retail/src/services/activity/fetchActivity.ts +0 -20
- package/templates/wevu-retail/src/services/activity/fetchActivityList.ts +0 -20
- package/templates/wevu-retail/src/services/address/edit.ts +0 -33
- package/templates/wevu-retail/src/services/address/fetchAddress.ts +0 -48
- package/templates/wevu-retail/src/services/address/list.ts +0 -31
- package/templates/wevu-retail/src/services/cart/cart.ts +0 -20
- package/templates/wevu-retail/src/services/comments/fetchComments.ts +0 -18
- package/templates/wevu-retail/src/services/comments/fetchCommentsCount.ts +0 -18
- package/templates/wevu-retail/src/services/coupon/index.ts +0 -65
- package/templates/wevu-retail/src/services/good/comments/fetchCommentDetail.ts +0 -20
- package/templates/wevu-retail/src/services/good/fetchCategoryList.ts +0 -18
- package/templates/wevu-retail/src/services/good/fetchGood.ts +0 -18
- package/templates/wevu-retail/src/services/good/fetchGoods.ts +0 -29
- package/templates/wevu-retail/src/services/good/fetchGoodsDetailsComments.ts +0 -37
- package/templates/wevu-retail/src/services/good/fetchGoodsList.ts +0 -39
- package/templates/wevu-retail/src/services/good/fetchSearchHistory.ts +0 -35
- package/templates/wevu-retail/src/services/good/fetchSearchResult.ts +0 -38
- package/templates/wevu-retail/src/services/home/home.ts +0 -53
- package/templates/wevu-retail/src/services/order/applyService.ts +0 -70
- package/templates/wevu-retail/src/services/order/orderConfirm.ts +0 -69
- package/templates/wevu-retail/src/services/order/orderDetail.ts +0 -39
- package/templates/wevu-retail/src/services/order/orderList.ts +0 -39
- package/templates/wevu-retail/src/services/order/orderSubmitComment.ts +0 -22
- package/templates/wevu-retail/src/services/promotion/detail.ts +0 -18
- package/templates/wevu-retail/src/services/usercenter/fetchPerson.ts +0 -28
- package/templates/wevu-retail/src/services/usercenter/fetchUsercenter.ts +0 -18
- package/templates/wevu-retail/src/sitemap.json +0 -7
- package/templates/wevu-retail/src/utils/addressParse.ts +0 -25
- package/templates/wevu-retail/src/utils/getPermission.ts +0 -45
- package/templates/wevu-retail/src/utils/mock.ts +0 -51
- package/templates/wevu-retail/src/utils/util.ts +0 -134
- package/templates/wevu-retail/src/vite-env.d.ts +0 -1
- package/templates/wevu-retail/tailwind.config.ts +0 -15
- package/templates/wevu-retail/tsconfig.app.json +0 -58
- package/templates/wevu-retail/tsconfig.json +0 -11
- package/templates/wevu-retail/tsconfig.node.json +0 -33
- package/templates/wevu-retail/vite.config.ts +0 -14
|
@@ -1,514 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import Toast from 'tdesign-miniprogram/toast/index';
|
|
3
|
-
import { fetchDeliveryAddress } from '../../../../services/address/fetchAddress';
|
|
4
|
-
import { areaData } from '../../../../config/index';
|
|
5
|
-
import { resolveAddress, rejectAddress } from '../../../../services/address/list';
|
|
6
|
-
|
|
7
|
-
const innerPhoneReg = '^1(?:3\\d|4[4-9]|5[0-35-9]|6[67]|7[0-8]|8\\d|9\\d)\\d{8}$';
|
|
8
|
-
const innerNameReg = '^[a-zA-Z\\d\\u4e00-\\u9fa5]+$';
|
|
9
|
-
const labelsOptions = [
|
|
10
|
-
{ id: 0, name: '家' },
|
|
11
|
-
{ id: 1, name: '公司' },
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
Page({
|
|
15
|
-
options: {
|
|
16
|
-
multipleSlots: true,
|
|
17
|
-
},
|
|
18
|
-
externalClasses: ['theme-wrapper-class'],
|
|
19
|
-
data: {
|
|
20
|
-
locationState: {
|
|
21
|
-
labelIndex: null,
|
|
22
|
-
addressId: '',
|
|
23
|
-
addressTag: '',
|
|
24
|
-
cityCode: '',
|
|
25
|
-
cityName: '',
|
|
26
|
-
countryCode: '',
|
|
27
|
-
countryName: '',
|
|
28
|
-
detailAddress: '',
|
|
29
|
-
districtCode: '',
|
|
30
|
-
districtName: '',
|
|
31
|
-
isDefault: false,
|
|
32
|
-
name: '',
|
|
33
|
-
phone: '',
|
|
34
|
-
provinceCode: '',
|
|
35
|
-
provinceName: '',
|
|
36
|
-
isEdit: false,
|
|
37
|
-
isOrderDetail: false,
|
|
38
|
-
isOrderSure: false,
|
|
39
|
-
},
|
|
40
|
-
areaData: areaData,
|
|
41
|
-
labels: labelsOptions,
|
|
42
|
-
areaPickerVisible: false,
|
|
43
|
-
submitActive: false,
|
|
44
|
-
visible: false,
|
|
45
|
-
labelValue: '',
|
|
46
|
-
columns: 3,
|
|
47
|
-
},
|
|
48
|
-
privateData: {
|
|
49
|
-
verifyTips: '',
|
|
50
|
-
},
|
|
51
|
-
onLoad(options) {
|
|
52
|
-
const { id } = options;
|
|
53
|
-
this.init(id);
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
onUnload() {
|
|
57
|
-
if (!this.hasSava) {
|
|
58
|
-
rejectAddress();
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
hasSava: false,
|
|
63
|
-
|
|
64
|
-
init(id) {
|
|
65
|
-
if (id) {
|
|
66
|
-
this.getAddressDetail(Number(id));
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
getAddressDetail(id) {
|
|
70
|
-
fetchDeliveryAddress(id).then((detail) => {
|
|
71
|
-
this.setData({ locationState: detail }, () => {
|
|
72
|
-
const { isLegal, tips } = this.onVerifyInputLegal();
|
|
73
|
-
this.setData({
|
|
74
|
-
submitActive: isLegal,
|
|
75
|
-
});
|
|
76
|
-
this.privateData.verifyTips = tips;
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
},
|
|
80
|
-
onInputValue(e) {
|
|
81
|
-
const { item } = e.currentTarget.dataset;
|
|
82
|
-
if (item === 'address') {
|
|
83
|
-
const { selectedOptions = [] } = e.detail;
|
|
84
|
-
this.setData(
|
|
85
|
-
{
|
|
86
|
-
'locationState.provinceCode': selectedOptions[0].value,
|
|
87
|
-
'locationState.provinceName': selectedOptions[0].label,
|
|
88
|
-
'locationState.cityName': selectedOptions[1].label,
|
|
89
|
-
'locationState.cityCode': selectedOptions[1].value,
|
|
90
|
-
'locationState.districtCode': selectedOptions[2].value,
|
|
91
|
-
'locationState.districtName': selectedOptions[2].label,
|
|
92
|
-
areaPickerVisible: false,
|
|
93
|
-
},
|
|
94
|
-
() => {
|
|
95
|
-
const { isLegal, tips } = this.onVerifyInputLegal();
|
|
96
|
-
this.setData({
|
|
97
|
-
submitActive: isLegal,
|
|
98
|
-
});
|
|
99
|
-
this.privateData.verifyTips = tips;
|
|
100
|
-
},
|
|
101
|
-
);
|
|
102
|
-
} else {
|
|
103
|
-
const { value = '' } = e.detail;
|
|
104
|
-
this.setData(
|
|
105
|
-
{
|
|
106
|
-
[`locationState.${item}`]: value,
|
|
107
|
-
},
|
|
108
|
-
() => {
|
|
109
|
-
const { isLegal, tips } = this.onVerifyInputLegal();
|
|
110
|
-
this.setData({
|
|
111
|
-
submitActive: isLegal,
|
|
112
|
-
});
|
|
113
|
-
this.privateData.verifyTips = tips;
|
|
114
|
-
},
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
onPickArea() {
|
|
119
|
-
this.setData({ areaPickerVisible: true });
|
|
120
|
-
},
|
|
121
|
-
onPickLabels(e) {
|
|
122
|
-
const { item } = e.currentTarget.dataset;
|
|
123
|
-
const {
|
|
124
|
-
locationState: { labelIndex = undefined },
|
|
125
|
-
labels = [],
|
|
126
|
-
} = this.data;
|
|
127
|
-
let payload = {
|
|
128
|
-
labelIndex: item,
|
|
129
|
-
addressTag: labels[item].name,
|
|
130
|
-
};
|
|
131
|
-
if (item === labelIndex) {
|
|
132
|
-
payload = { labelIndex: null, addressTag: '' };
|
|
133
|
-
}
|
|
134
|
-
this.setData({
|
|
135
|
-
'locationState.labelIndex': payload.labelIndex,
|
|
136
|
-
});
|
|
137
|
-
this.triggerEvent('triggerUpdateValue', payload);
|
|
138
|
-
},
|
|
139
|
-
addLabels() {
|
|
140
|
-
this.setData({
|
|
141
|
-
visible: true,
|
|
142
|
-
});
|
|
143
|
-
},
|
|
144
|
-
confirmHandle() {
|
|
145
|
-
const { labels, labelValue } = this.data;
|
|
146
|
-
this.setData({
|
|
147
|
-
visible: false,
|
|
148
|
-
labels: [...labels, { id: labels[labels.length - 1].id + 1, name: labelValue }],
|
|
149
|
-
labelValue: '',
|
|
150
|
-
});
|
|
151
|
-
},
|
|
152
|
-
cancelHandle() {
|
|
153
|
-
this.setData({
|
|
154
|
-
visible: false,
|
|
155
|
-
labelValue: '',
|
|
156
|
-
});
|
|
157
|
-
},
|
|
158
|
-
onCheckDefaultAddress({ detail }) {
|
|
159
|
-
const { value } = detail;
|
|
160
|
-
this.setData({
|
|
161
|
-
'locationState.isDefault': value,
|
|
162
|
-
});
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
onVerifyInputLegal() {
|
|
166
|
-
const { name, phone, detailAddress, districtName } = this.data.locationState;
|
|
167
|
-
const prefixPhoneReg = String(this.properties.phoneReg || innerPhoneReg);
|
|
168
|
-
const prefixNameReg = String(this.properties.nameReg || innerNameReg);
|
|
169
|
-
const nameRegExp = new RegExp(prefixNameReg);
|
|
170
|
-
const phoneRegExp = new RegExp(prefixPhoneReg);
|
|
171
|
-
|
|
172
|
-
if (!name || !name.trim()) {
|
|
173
|
-
return {
|
|
174
|
-
isLegal: false,
|
|
175
|
-
tips: '请填写收货人',
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
if (!nameRegExp.test(name)) {
|
|
179
|
-
return {
|
|
180
|
-
isLegal: false,
|
|
181
|
-
tips: '收货人仅支持输入中文、英文(区分大小写)、数字',
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
if (!phone || !phone.trim()) {
|
|
185
|
-
return {
|
|
186
|
-
isLegal: false,
|
|
187
|
-
tips: '请填写手机号',
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
if (!phoneRegExp.test(phone)) {
|
|
191
|
-
return {
|
|
192
|
-
isLegal: false,
|
|
193
|
-
tips: '请填写正确的手机号',
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
if (!districtName || !districtName.trim()) {
|
|
197
|
-
return {
|
|
198
|
-
isLegal: false,
|
|
199
|
-
tips: '请选择省市区信息',
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
if (!detailAddress || !detailAddress.trim()) {
|
|
203
|
-
return {
|
|
204
|
-
isLegal: false,
|
|
205
|
-
tips: '请完善详细地址',
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
if (detailAddress && detailAddress.trim().length > 50) {
|
|
209
|
-
return {
|
|
210
|
-
isLegal: false,
|
|
211
|
-
tips: '详细地址不能超过50个字符',
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
return {
|
|
215
|
-
isLegal: true,
|
|
216
|
-
tips: '添加成功',
|
|
217
|
-
};
|
|
218
|
-
},
|
|
219
|
-
|
|
220
|
-
builtInSearch({ code, name }) {
|
|
221
|
-
return new Promise((resolve, reject) => {
|
|
222
|
-
wx.getSetting({
|
|
223
|
-
success: (res) => {
|
|
224
|
-
if (res.authSetting[code] === false) {
|
|
225
|
-
wx.showModal({
|
|
226
|
-
title: `获取${name}失败`,
|
|
227
|
-
content: `获取${name}失败,请在【右上角】-小程序【设置】项中,将【${name}】开启。`,
|
|
228
|
-
confirmText: '去设置',
|
|
229
|
-
confirmColor: '#FA550F',
|
|
230
|
-
cancelColor: '取消',
|
|
231
|
-
success(res) {
|
|
232
|
-
if (res.confirm) {
|
|
233
|
-
wx.openSetting({
|
|
234
|
-
success(settinRes) {
|
|
235
|
-
if (settinRes.authSetting[code] === true) {
|
|
236
|
-
resolve();
|
|
237
|
-
} else {
|
|
238
|
-
console.warn('用户未打开权限', name, code);
|
|
239
|
-
reject();
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
});
|
|
243
|
-
} else {
|
|
244
|
-
reject();
|
|
245
|
-
}
|
|
246
|
-
},
|
|
247
|
-
fail() {
|
|
248
|
-
reject();
|
|
249
|
-
},
|
|
250
|
-
});
|
|
251
|
-
} else {
|
|
252
|
-
resolve();
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
fail() {
|
|
256
|
-
reject();
|
|
257
|
-
},
|
|
258
|
-
});
|
|
259
|
-
});
|
|
260
|
-
},
|
|
261
|
-
|
|
262
|
-
onSearchAddress() {
|
|
263
|
-
this.builtInSearch({ code: 'scope.userLocation', name: '地址位置' }).then(() => {
|
|
264
|
-
wx.chooseLocation({
|
|
265
|
-
success: (res) => {
|
|
266
|
-
if (res.name) {
|
|
267
|
-
this.triggerEvent('addressParse', {
|
|
268
|
-
address: res.address,
|
|
269
|
-
name: res.name,
|
|
270
|
-
latitude: res.latitude,
|
|
271
|
-
longitude: res.longitude,
|
|
272
|
-
});
|
|
273
|
-
} else {
|
|
274
|
-
Toast({
|
|
275
|
-
context: this,
|
|
276
|
-
selector: '#t-toast',
|
|
277
|
-
message: '地点为空,请重新选择',
|
|
278
|
-
icon: '',
|
|
279
|
-
duration: 1000,
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
},
|
|
283
|
-
fail: function (res) {
|
|
284
|
-
console.warn(`wx.chooseLocation fail: ${JSON.stringify(res)}`);
|
|
285
|
-
if (res.errMsg !== 'chooseLocation:fail cancel') {
|
|
286
|
-
Toast({
|
|
287
|
-
context: this,
|
|
288
|
-
selector: '#t-toast',
|
|
289
|
-
message: '地点错误,请重新选择',
|
|
290
|
-
icon: '',
|
|
291
|
-
duration: 1000,
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
},
|
|
295
|
-
});
|
|
296
|
-
});
|
|
297
|
-
},
|
|
298
|
-
formSubmit() {
|
|
299
|
-
const { submitActive } = this.data;
|
|
300
|
-
if (!submitActive) {
|
|
301
|
-
Toast({
|
|
302
|
-
context: this,
|
|
303
|
-
selector: '#t-toast',
|
|
304
|
-
message: this.privateData.verifyTips,
|
|
305
|
-
icon: '',
|
|
306
|
-
duration: 1000,
|
|
307
|
-
});
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
const { locationState } = this.data;
|
|
311
|
-
|
|
312
|
-
this.hasSava = true;
|
|
313
|
-
|
|
314
|
-
resolveAddress({
|
|
315
|
-
saasId: '88888888',
|
|
316
|
-
uid: `88888888205500`,
|
|
317
|
-
authToken: null,
|
|
318
|
-
id: locationState.addressId,
|
|
319
|
-
addressId: locationState.addressId,
|
|
320
|
-
phone: locationState.phone,
|
|
321
|
-
name: locationState.name,
|
|
322
|
-
countryName: locationState.countryName,
|
|
323
|
-
countryCode: locationState.countryCode,
|
|
324
|
-
provinceName: locationState.provinceName,
|
|
325
|
-
provinceCode: locationState.provinceCode,
|
|
326
|
-
cityName: locationState.cityName,
|
|
327
|
-
cityCode: locationState.cityCode,
|
|
328
|
-
districtName: locationState.districtName,
|
|
329
|
-
districtCode: locationState.districtCode,
|
|
330
|
-
detailAddress: locationState.detailAddress,
|
|
331
|
-
isDefault: locationState.isDefault === 1 ? 1 : 0,
|
|
332
|
-
addressTag: locationState.addressTag,
|
|
333
|
-
latitude: locationState.latitude,
|
|
334
|
-
longitude: locationState.longitude,
|
|
335
|
-
storeId: null,
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
wx.navigateBack({ delta: 1 });
|
|
339
|
-
},
|
|
340
|
-
|
|
341
|
-
getWeixinAddress(e) {
|
|
342
|
-
const { locationState } = this.data;
|
|
343
|
-
const weixinAddress = e.detail;
|
|
344
|
-
this.setData(
|
|
345
|
-
{
|
|
346
|
-
locationState: { ...locationState, ...weixinAddress },
|
|
347
|
-
},
|
|
348
|
-
() => {
|
|
349
|
-
const { isLegal, tips } = this.onVerifyInputLegal();
|
|
350
|
-
this.setData({
|
|
351
|
-
submitActive: isLegal,
|
|
352
|
-
});
|
|
353
|
-
this.privateData.verifyTips = tips;
|
|
354
|
-
},
|
|
355
|
-
);
|
|
356
|
-
},
|
|
357
|
-
});
|
|
358
|
-
</script>
|
|
359
|
-
|
|
360
|
-
<template>
|
|
361
|
-
<view class="address-detail [font-size:30rpx]">
|
|
362
|
-
<view class="divider-line [width:100%] [height:20rpx] [background-color:#f5f5f5]" />
|
|
363
|
-
<t-location
|
|
364
|
-
title="获取微信收获地址"
|
|
365
|
-
isCustomStyle
|
|
366
|
-
t-class="address-detail-wx-location [background:#fff] [padding:24rpx_32rpx] [display:flex] [align-items:center] [justify-content:space-between]"
|
|
367
|
-
bind:change="getWeixinAddress"
|
|
368
|
-
>
|
|
369
|
-
<t-icon class="address-detail-wx-arrow [align-items:flex-end]" name="arrow_forward" prefix="wr" color="#bbb" size="32rpx" />
|
|
370
|
-
</t-location>
|
|
371
|
-
<view class="divider-line [width:100%] [height:20rpx] [background-color:#f5f5f5]" />
|
|
372
|
-
<view class="form-address [&_.map]:[font-size:48rpx] [&_.map]:[margin-left:20rpx] [&_.map]:[color:#9d9d9f] [&_.label-list]:[background:#f5f5f5] [&_.label-list]:[color:#333] [&_.label-list]:[min-width:100rpx] [&_.label-list]:[margin-right:32rpx] [&_.label-list]:[font-size:26rpx] [&_.label-list]:[border:2rpx_solid_transparent] [&_.label-list]:[width:auto] [&_.active-btn]:[color:#fa4126] [&_.active-btn]:[border:2rpx_solid_#fa4126] [&_.active-btn]:[background:rgba(255,_95,_21,_0.04)]">
|
|
373
|
-
<form class="form-content">
|
|
374
|
-
<t-cell-group>
|
|
375
|
-
<t-cell class="form-cell [&_.t-cell__title]:[width:144rpx] [&_.t-cell__title]:[padding-right:32rpx] [&_.t-cell__title]:[flex:none]" t-class-title="t-cell-title" title="收货人" t-class-note="t-cell-note">
|
|
376
|
-
<t-input
|
|
377
|
-
class="t-input"
|
|
378
|
-
slot="note"
|
|
379
|
-
t-class="field-text"
|
|
380
|
-
borderless
|
|
381
|
-
data-item="name"
|
|
382
|
-
maxlength="20"
|
|
383
|
-
type="text"
|
|
384
|
-
value="{{locationState.name}}"
|
|
385
|
-
placeholder="您的姓名"
|
|
386
|
-
bind:change="onInputValue"
|
|
387
|
-
/>
|
|
388
|
-
</t-cell>
|
|
389
|
-
<t-cell class="form-cell [&_.t-cell__title]:[width:144rpx] [&_.t-cell__title]:[padding-right:32rpx] [&_.t-cell__title]:[flex:none]" t-class-title="t-cell-title" title="手机号">
|
|
390
|
-
<t-input
|
|
391
|
-
slot="note"
|
|
392
|
-
class="t-input"
|
|
393
|
-
t-class="field-text"
|
|
394
|
-
borderless
|
|
395
|
-
type="number"
|
|
396
|
-
value="{{locationState.phone}}"
|
|
397
|
-
maxlength="11"
|
|
398
|
-
placeholder="联系您的手机号"
|
|
399
|
-
bind:change="onInputValue"
|
|
400
|
-
data-item="phone"
|
|
401
|
-
/>
|
|
402
|
-
</t-cell>
|
|
403
|
-
<t-cell class="form-cell [&_.t-cell__title]:[width:144rpx] [&_.t-cell__title]:[padding-right:32rpx] [&_.t-cell__title]:[flex:none]" t-class-title="t-cell-title" title="地区">
|
|
404
|
-
<t-input
|
|
405
|
-
slot="note"
|
|
406
|
-
class="t-input"
|
|
407
|
-
t-class="field-text"
|
|
408
|
-
borderless
|
|
409
|
-
placeholder="省/市/区"
|
|
410
|
-
data-item="address"
|
|
411
|
-
value="{{locationState.provinceName ? locationState.provinceName+'/':'' }}{{locationState.cityName ? locationState.cityName+'/':''}}{{locationState.districtName}}"
|
|
412
|
-
catch:tap="onPickArea"
|
|
413
|
-
disabled
|
|
414
|
-
/>
|
|
415
|
-
<t-icon slot="right-icon" t-class="map" prefix="wr" name="location" catch:tap="onSearchAddress" />
|
|
416
|
-
</t-cell>
|
|
417
|
-
<t-cell class="form-cell [&_.t-cell__title]:[width:144rpx] [&_.t-cell__title]:[padding-right:32rpx] [&_.t-cell__title]:[flex:none]" t-class-title="t-cell-title" title="详细地址" bordered="{{false}}">
|
|
418
|
-
<view slot="note" class="textarea__wrapper [width:100%] [&_.t-textarea]:[padding:0]">
|
|
419
|
-
<t-textarea
|
|
420
|
-
slot="note"
|
|
421
|
-
type="text"
|
|
422
|
-
value="{{locationState.detailAddress}}"
|
|
423
|
-
placeholder="门牌号等(例如:10栋1001号)"
|
|
424
|
-
autosize
|
|
425
|
-
bind:change="onInputValue"
|
|
426
|
-
data-item="detailAddress"
|
|
427
|
-
/>
|
|
428
|
-
</view>
|
|
429
|
-
</t-cell>
|
|
430
|
-
|
|
431
|
-
<view class="divider-line [width:100%] [height:20rpx] [background-color:#f5f5f5]" />
|
|
432
|
-
<t-cell
|
|
433
|
-
class="form-cell [&_.t-cell__title]:[width:144rpx] [&_.t-cell__title]:[padding-right:32rpx] [&_.t-cell__title]:[flex:none]"
|
|
434
|
-
t-class-note="t-cell-note address__tag"
|
|
435
|
-
t-class-title="t-cell-title"
|
|
436
|
-
title="标签"
|
|
437
|
-
bordered="{{false}}"
|
|
438
|
-
>
|
|
439
|
-
<view class="t-input address-flex-box [display:flex] [flex-wrap:wrap]" slot="note">
|
|
440
|
-
<t-button
|
|
441
|
-
wx:for="{{labels}}"
|
|
442
|
-
wx:for-item="label"
|
|
443
|
-
wx:key="index"
|
|
444
|
-
size="extra-small"
|
|
445
|
-
t-class="label-list {{locationState.labelIndex === index ? 'active-btn':''}}"
|
|
446
|
-
bindtap="onPickLabels"
|
|
447
|
-
data-item="{{index}}"
|
|
448
|
-
>
|
|
449
|
-
{{label.name}}
|
|
450
|
-
</t-button>
|
|
451
|
-
<t-button size="extra-small" t-class="label-list" bindtap="addLabels">
|
|
452
|
-
<t-icon name="add" size="40rpx" color="#bbb" />
|
|
453
|
-
</t-button>
|
|
454
|
-
</view>
|
|
455
|
-
</t-cell>
|
|
456
|
-
<view class="divider-line [width:100%] [height:20rpx] [background-color:#f5f5f5]" />
|
|
457
|
-
<t-cell title="设置为默认收货地址" bordered="{{false}}">
|
|
458
|
-
<t-switch
|
|
459
|
-
value="{{locationState.isDefault}}"
|
|
460
|
-
slot="note"
|
|
461
|
-
colors="{{['#0ABF5B', '#c6c6c6']}}"
|
|
462
|
-
bind:change="onCheckDefaultAddress"
|
|
463
|
-
/>
|
|
464
|
-
</t-cell>
|
|
465
|
-
</t-cell-group>
|
|
466
|
-
<view class="submit [box-sizing:border-box] [padding:64rpx_30rpx_88rpx_30rpx] [&_.btn-submit-address]:[background:#fa4126] [&_.btn-submit-address]:[color:#fff]">
|
|
467
|
-
<t-button shape="round" block disabled="{{!submitActive}}" bind:tap="formSubmit"> 保存 </t-button>
|
|
468
|
-
</view>
|
|
469
|
-
</form>
|
|
470
|
-
</view>
|
|
471
|
-
<t-cascader
|
|
472
|
-
data-item="address"
|
|
473
|
-
data-type="1"
|
|
474
|
-
visible="{{areaPickerVisible}}"
|
|
475
|
-
theme="tab"
|
|
476
|
-
options="{{areaData}}"
|
|
477
|
-
value="{{locationState.districtCode}}"
|
|
478
|
-
title="选择地区"
|
|
479
|
-
bind:change="onInputValue"
|
|
480
|
-
></t-cascader>
|
|
481
|
-
</view>
|
|
482
|
-
<t-dialog
|
|
483
|
-
visible="{{visible}}"
|
|
484
|
-
t-class-confirm="dialog__button-confirm"
|
|
485
|
-
t-class-cancel="dialog__button-cancel"
|
|
486
|
-
title="填写标签名称"
|
|
487
|
-
confirm-btn="确定"
|
|
488
|
-
cancel-btn="取消"
|
|
489
|
-
bind:confirm="confirmHandle"
|
|
490
|
-
bind:cancel="cancelHandle"
|
|
491
|
-
>
|
|
492
|
-
<t-input slot="content" class="dialog__input [margin-top:32rpx] [border-radius:8rpx] [box-sizing:border-box] [--td-input-vertical-padding:12px] [--td-input-bg-color:#f3f3f3]" model:value="{{labelValue}}" placeholder="请输入标签名称" borderless />
|
|
493
|
-
</t-dialog>
|
|
494
|
-
<t-toast id="t-toast" />
|
|
495
|
-
</template>
|
|
496
|
-
|
|
497
|
-
<json>
|
|
498
|
-
{
|
|
499
|
-
"navigationBarTitleText": "添加新地址",
|
|
500
|
-
"usingComponents": {
|
|
501
|
-
"t-textarea": "tdesign-miniprogram/textarea/textarea",
|
|
502
|
-
"t-icon": "tdesign-miniprogram/icon/icon",
|
|
503
|
-
"t-input": "tdesign-miniprogram/input/input",
|
|
504
|
-
"t-button": "tdesign-miniprogram/button/button",
|
|
505
|
-
"t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
|
|
506
|
-
"t-cell": "tdesign-miniprogram/cell/cell",
|
|
507
|
-
"t-toast": "tdesign-miniprogram/toast/toast",
|
|
508
|
-
"t-dialog": "tdesign-miniprogram/dialog/dialog",
|
|
509
|
-
"t-switch": "tdesign-miniprogram/switch/switch",
|
|
510
|
-
"t-location": "/pages/user/components/t-location/index",
|
|
511
|
-
"t-cascader": "tdesign-miniprogram/cascader/cascader"
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
</json>
|