create-weapp-vite 2.0.31 → 2.0.32

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.
Files changed (175) hide show
  1. package/README.md +1 -0
  2. package/dist/{chunk-FGMHC2DJ.js → chunk-IT75MAH3.js} +3 -2
  3. package/dist/cli.js +5 -1
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +1 -1
  6. package/package.json +1 -1
  7. package/templates/wevu-retail/.editorconfig +9 -0
  8. package/templates/wevu-retail/.vscode/settings.json +10 -0
  9. package/templates/wevu-retail/AGENTS.md +35 -0
  10. package/templates/wevu-retail/README.md +26 -0
  11. package/templates/wevu-retail/auto-import-components.json +1 -0
  12. package/templates/wevu-retail/gitignore +35 -0
  13. package/templates/wevu-retail/package.json +42 -0
  14. package/templates/wevu-retail/postcss.config.js +6 -0
  15. package/templates/wevu-retail/project.config.json +44 -0
  16. package/templates/wevu-retail/project.private.config.json +8 -0
  17. package/templates/wevu-retail/src/app.vue +104 -0
  18. package/templates/wevu-retail/src/common/updateManager.ts +29 -0
  19. package/templates/wevu-retail/src/components/filter/index.vue +134 -0
  20. package/templates/wevu-retail/src/components/filter-popup/index.vue +67 -0
  21. package/templates/wevu-retail/src/components/goods-card/index.vue +219 -0
  22. package/templates/wevu-retail/src/components/goods-list/index.vue +91 -0
  23. package/templates/wevu-retail/src/components/load-more/index.vue +99 -0
  24. package/templates/wevu-retail/src/components/loading-content/index.vue +48 -0
  25. package/templates/wevu-retail/src/components/price/index.vue +104 -0
  26. package/templates/wevu-retail/src/components/promotion/ui-coupon-card/index.vue +143 -0
  27. package/templates/wevu-retail/src/components/promotion/ui-coupon-card/tools.wxs +18 -0
  28. package/templates/wevu-retail/src/components/swipeout/index.vue +118 -0
  29. package/templates/wevu-retail/src/components/swipeout/swipe.wxs +151 -0
  30. package/templates/wevu-retail/src/components/webp-image/index.vue +105 -0
  31. package/templates/wevu-retail/src/components/webp-image/utils.wxs +140 -0
  32. package/templates/wevu-retail/src/config/index.ts +20437 -0
  33. package/templates/wevu-retail/src/custom-tab-bar/data.ts +22 -0
  34. package/templates/wevu-retail/src/custom-tab-bar/index.vue +62 -0
  35. package/templates/wevu-retail/src/model/activities.ts +7 -0
  36. package/templates/wevu-retail/src/model/activity.ts +18 -0
  37. package/templates/wevu-retail/src/model/address.ts +31 -0
  38. package/templates/wevu-retail/src/model/cart.ts +306 -0
  39. package/templates/wevu-retail/src/model/category.ts +175 -0
  40. package/templates/wevu-retail/src/model/comments/queryDetail.ts +50 -0
  41. package/templates/wevu-retail/src/model/comments.ts +298 -0
  42. package/templates/wevu-retail/src/model/coupon.ts +39 -0
  43. package/templates/wevu-retail/src/model/detailsComments.ts +30 -0
  44. package/templates/wevu-retail/src/model/good.ts +1904 -0
  45. package/templates/wevu-retail/src/model/goods.ts +7 -0
  46. package/templates/wevu-retail/src/model/order/applyService.ts +329 -0
  47. package/templates/wevu-retail/src/model/order/orderConfirm.ts +147 -0
  48. package/templates/wevu-retail/src/model/order/orderDetail.ts +1191 -0
  49. package/templates/wevu-retail/src/model/order/orderList.ts +1033 -0
  50. package/templates/wevu-retail/src/model/promotion.ts +20 -0
  51. package/templates/wevu-retail/src/model/search.ts +60 -0
  52. package/templates/wevu-retail/src/model/submitComment.ts +58 -0
  53. package/templates/wevu-retail/src/model/swiper.ts +39 -0
  54. package/templates/wevu-retail/src/model/usercenter.ts +52 -0
  55. package/templates/wevu-retail/src/pages/cart/components/cart-bar/index.vue +104 -0
  56. package/templates/wevu-retail/src/pages/cart/components/cart-empty/index.vue +41 -0
  57. package/templates/wevu-retail/src/pages/cart/components/cart-group/index.vue +333 -0
  58. package/templates/wevu-retail/src/pages/cart/components/cart-group/index.wxs +5 -0
  59. package/templates/wevu-retail/src/pages/cart/components/cart-group/utils.wxs +20 -0
  60. package/templates/wevu-retail/src/pages/cart/components/goods-card/index.vue +334 -0
  61. package/templates/wevu-retail/src/pages/cart/components/specs-popup/index.vue +100 -0
  62. package/templates/wevu-retail/src/pages/cart/index.vue +342 -0
  63. package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/README.md +95 -0
  64. package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/c-sidebar-item/index.vue +73 -0
  65. package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/index.vue +121 -0
  66. package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-tabbar/c-tabbar-more/index.vue +74 -0
  67. package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-tabbar/index.vue +102 -0
  68. package/templates/wevu-retail/src/pages/category/components/goods-category/index.vue +137 -0
  69. package/templates/wevu-retail/src/pages/category/index.vue +50 -0
  70. package/templates/wevu-retail/src/pages/coupon/components/coupon-card/index.vue +95 -0
  71. package/templates/wevu-retail/src/pages/coupon/components/floating-button/index.vue +44 -0
  72. package/templates/wevu-retail/src/pages/coupon/coupon-activity-goods/index.vue +135 -0
  73. package/templates/wevu-retail/src/pages/coupon/coupon-detail/index.vue +94 -0
  74. package/templates/wevu-retail/src/pages/coupon/coupon-list/index.vue +136 -0
  75. package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/images-videos/assets/play.png +0 -0
  76. package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/images-videos/index.vue +65 -0
  77. package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/my-video/index.vue +92 -0
  78. package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/index.vue +93 -0
  79. package/templates/wevu-retail/src/pages/goods/comments/create/index.vue +196 -0
  80. package/templates/wevu-retail/src/pages/goods/comments/index.vue +293 -0
  81. package/templates/wevu-retail/src/pages/goods/details/components/buy-bar/index.vue +117 -0
  82. package/templates/wevu-retail/src/pages/goods/details/components/goods-specs-popup/index.vue +440 -0
  83. package/templates/wevu-retail/src/pages/goods/details/components/promotion-popup/index.vue +83 -0
  84. package/templates/wevu-retail/src/pages/goods/details/index.vue +598 -0
  85. package/templates/wevu-retail/src/pages/goods/list/index.vue +299 -0
  86. package/templates/wevu-retail/src/pages/goods/result/index.vue +350 -0
  87. package/templates/wevu-retail/src/pages/goods/search/index.vue +196 -0
  88. package/templates/wevu-retail/src/pages/home/home.vue +215 -0
  89. package/templates/wevu-retail/src/pages/home/readme +8 -0
  90. package/templates/wevu-retail/src/pages/order/after-service-detail/api.ts +34 -0
  91. package/templates/wevu-retail/src/pages/order/after-service-detail/index.vue +430 -0
  92. package/templates/wevu-retail/src/pages/order/after-service-list/api.ts +1262 -0
  93. package/templates/wevu-retail/src/pages/order/after-service-list/index.vue +299 -0
  94. package/templates/wevu-retail/src/pages/order/apply-service/index.vue +665 -0
  95. package/templates/wevu-retail/src/pages/order/components/after-service-button-bar/index.vue +142 -0
  96. package/templates/wevu-retail/src/pages/order/components/customer-service/index.vue +75 -0
  97. package/templates/wevu-retail/src/pages/order/components/goods-card/index.vue +356 -0
  98. package/templates/wevu-retail/src/pages/order/components/noGoods/noGood.wxs +17 -0
  99. package/templates/wevu-retail/src/pages/order/components/noGoods/noGoods.vue +125 -0
  100. package/templates/wevu-retail/src/pages/order/components/order-button-bar/index.vue +262 -0
  101. package/templates/wevu-retail/src/pages/order/components/order-card/index.vue +126 -0
  102. package/templates/wevu-retail/src/pages/order/components/order-goods-card/index.vue +86 -0
  103. package/templates/wevu-retail/src/pages/order/components/reason-sheet/index.vue +161 -0
  104. package/templates/wevu-retail/src/pages/order/components/reason-sheet/reasonSheet.ts +25 -0
  105. package/templates/wevu-retail/src/pages/order/components/selectCoupons/mock.ts +22 -0
  106. package/templates/wevu-retail/src/pages/order/components/selectCoupons/selectCoupon.wxs +16 -0
  107. package/templates/wevu-retail/src/pages/order/components/selectCoupons/selectCoupons.vue +207 -0
  108. package/templates/wevu-retail/src/pages/order/components/specs-goods-card/index.vue +185 -0
  109. package/templates/wevu-retail/src/pages/order/config.ts +94 -0
  110. package/templates/wevu-retail/src/pages/order/delivery-detail/index.vue +145 -0
  111. package/templates/wevu-retail/src/pages/order/delivery-detail/isUrl.wxs +7 -0
  112. package/templates/wevu-retail/src/pages/order/fill-tracking-no/api.ts +71 -0
  113. package/templates/wevu-retail/src/pages/order/fill-tracking-no/index.vue +267 -0
  114. package/templates/wevu-retail/src/pages/order/invoice/index.vue +94 -0
  115. package/templates/wevu-retail/src/pages/order/order-confirm/components/address-card/index.vue +78 -0
  116. package/templates/wevu-retail/src/pages/order/order-confirm/getNotes.wxs +11 -0
  117. package/templates/wevu-retail/src/pages/order/order-confirm/handleInvoice.wxs +11 -0
  118. package/templates/wevu-retail/src/pages/order/order-confirm/index.vue +707 -0
  119. package/templates/wevu-retail/src/pages/order/order-confirm/order.wxs +8 -0
  120. package/templates/wevu-retail/src/pages/order/order-confirm/pay.ts +115 -0
  121. package/templates/wevu-retail/src/pages/order/order-detail/index.vue +456 -0
  122. package/templates/wevu-retail/src/pages/order/order-list/index.vue +288 -0
  123. package/templates/wevu-retail/src/pages/order/pay-result/index.vue +77 -0
  124. package/templates/wevu-retail/src/pages/order/receipt/index.vue +336 -0
  125. package/templates/wevu-retail/src/pages/promotion/promotion-detail/index.vue +145 -0
  126. package/templates/wevu-retail/src/pages/user/address/edit/index.vue +514 -0
  127. package/templates/wevu-retail/src/pages/user/address/list/index.vue +249 -0
  128. package/templates/wevu-retail/src/pages/user/components/t-location/index.vue +156 -0
  129. package/templates/wevu-retail/src/pages/user/components/ui-address-item/index.vue +92 -0
  130. package/templates/wevu-retail/src/pages/user/name-edit/index.vue +49 -0
  131. package/templates/wevu-retail/src/pages/user/person-info/index.vue +198 -0
  132. package/templates/wevu-retail/src/pages/usercenter/address/edit/util.ts +33 -0
  133. package/templates/wevu-retail/src/pages/usercenter/components/order-group/index.vue +90 -0
  134. package/templates/wevu-retail/src/pages/usercenter/components/ui-select-picker/index.vue +108 -0
  135. package/templates/wevu-retail/src/pages/usercenter/components/user-center-card/index.vue +82 -0
  136. package/templates/wevu-retail/src/pages/usercenter/index.vue +301 -0
  137. package/templates/wevu-retail/src/services/_utils/delay.ts +3 -0
  138. package/templates/wevu-retail/src/services/_utils/timeout.ts +3 -0
  139. package/templates/wevu-retail/src/services/activity/fetchActivity.ts +20 -0
  140. package/templates/wevu-retail/src/services/activity/fetchActivityList.ts +20 -0
  141. package/templates/wevu-retail/src/services/address/edit.ts +33 -0
  142. package/templates/wevu-retail/src/services/address/fetchAddress.ts +48 -0
  143. package/templates/wevu-retail/src/services/address/list.ts +31 -0
  144. package/templates/wevu-retail/src/services/cart/cart.ts +20 -0
  145. package/templates/wevu-retail/src/services/comments/fetchComments.ts +18 -0
  146. package/templates/wevu-retail/src/services/comments/fetchCommentsCount.ts +18 -0
  147. package/templates/wevu-retail/src/services/coupon/index.ts +65 -0
  148. package/templates/wevu-retail/src/services/good/comments/fetchCommentDetail.ts +20 -0
  149. package/templates/wevu-retail/src/services/good/fetchCategoryList.ts +18 -0
  150. package/templates/wevu-retail/src/services/good/fetchGood.ts +18 -0
  151. package/templates/wevu-retail/src/services/good/fetchGoods.ts +29 -0
  152. package/templates/wevu-retail/src/services/good/fetchGoodsDetailsComments.ts +37 -0
  153. package/templates/wevu-retail/src/services/good/fetchGoodsList.ts +39 -0
  154. package/templates/wevu-retail/src/services/good/fetchSearchHistory.ts +35 -0
  155. package/templates/wevu-retail/src/services/good/fetchSearchResult.ts +38 -0
  156. package/templates/wevu-retail/src/services/home/home.ts +53 -0
  157. package/templates/wevu-retail/src/services/order/applyService.ts +70 -0
  158. package/templates/wevu-retail/src/services/order/orderConfirm.ts +69 -0
  159. package/templates/wevu-retail/src/services/order/orderDetail.ts +39 -0
  160. package/templates/wevu-retail/src/services/order/orderList.ts +39 -0
  161. package/templates/wevu-retail/src/services/order/orderSubmitComment.ts +22 -0
  162. package/templates/wevu-retail/src/services/promotion/detail.ts +18 -0
  163. package/templates/wevu-retail/src/services/usercenter/fetchPerson.ts +28 -0
  164. package/templates/wevu-retail/src/services/usercenter/fetchUsercenter.ts +18 -0
  165. package/templates/wevu-retail/src/sitemap.json +7 -0
  166. package/templates/wevu-retail/src/utils/addressParse.ts +25 -0
  167. package/templates/wevu-retail/src/utils/getPermission.ts +45 -0
  168. package/templates/wevu-retail/src/utils/mock.ts +51 -0
  169. package/templates/wevu-retail/src/utils/util.ts +134 -0
  170. package/templates/wevu-retail/src/vite-env.d.ts +1 -0
  171. package/templates/wevu-retail/tailwind.config.ts +15 -0
  172. package/templates/wevu-retail/tsconfig.app.json +58 -0
  173. package/templates/wevu-retail/tsconfig.json +11 -0
  174. package/templates/wevu-retail/tsconfig.node.json +33 -0
  175. package/templates/wevu-retail/vite.config.ts +14 -0
@@ -0,0 +1,249 @@
1
+ <script lang="ts">
2
+ /* eslint-disable no-param-reassign */
3
+ import { fetchDeliveryAddressList } from '../../../../services/address/fetchAddress';
4
+ import Toast from 'tdesign-miniprogram/toast/index';
5
+ import { resolveAddress, rejectAddress } from '../../../../services/address/list';
6
+ import { getAddressPromise } from '../../../../services/address/edit';
7
+
8
+ Page({
9
+ data: {
10
+ addressList: [],
11
+ deleteID: '',
12
+ showDeleteConfirm: false,
13
+ isOrderSure: false,
14
+ },
15
+
16
+ /** 选择模式 */
17
+ selectMode: false,
18
+ /** 是否已经选择地址,不置为true的话页面离开时会触发取消选择行为 */
19
+ hasSelect: false,
20
+
21
+ onLoad(query) {
22
+ const { selectMode = '', isOrderSure = '', id = '' } = query;
23
+ this.setData({
24
+ isOrderSure: !!isOrderSure,
25
+ id,
26
+ });
27
+ this.selectMode = !!selectMode;
28
+ this.init();
29
+ },
30
+
31
+ init() {
32
+ this.getAddressList();
33
+ },
34
+ onUnload() {
35
+ if (this.selectMode && !this.hasSelect) {
36
+ rejectAddress();
37
+ }
38
+ },
39
+ getAddressList() {
40
+ const { id } = this.data;
41
+ fetchDeliveryAddressList().then((addressList) => {
42
+ addressList.forEach((address) => {
43
+ if (address.id === id) {
44
+ address.checked = true;
45
+ }
46
+ });
47
+ this.setData({ addressList });
48
+ });
49
+ },
50
+ getWXAddressHandle() {
51
+ wx.chooseAddress({
52
+ success: (res) => {
53
+ if (res.errMsg.indexOf('ok') === -1) {
54
+ Toast({
55
+ context: this,
56
+ selector: '#t-toast',
57
+ message: res.errMsg,
58
+ icon: '',
59
+ duration: 1000,
60
+ });
61
+ return;
62
+ }
63
+ Toast({
64
+ context: this,
65
+ selector: '#t-toast',
66
+ message: '添加成功',
67
+ icon: '',
68
+ duration: 1000,
69
+ });
70
+ const { length: len } = this.data.addressList;
71
+ this.setData({
72
+ [`addressList[${len}]`]: {
73
+ name: res.userName,
74
+ phoneNumber: res.telNumber,
75
+ address: `${res.provinceName}${res.cityName}${res.countryName}${res.detailInfo}`,
76
+ isDefault: 0,
77
+ tag: '微信地址',
78
+ id: len,
79
+ },
80
+ });
81
+ },
82
+ });
83
+ },
84
+ confirmDeleteHandle({ detail }) {
85
+ const { id } = detail || {};
86
+ if (id !== undefined) {
87
+ this.setData({ deleteID: id, showDeleteConfirm: true });
88
+ Toast({
89
+ context: this,
90
+ selector: '#t-toast',
91
+ message: '地址删除成功',
92
+ theme: 'success',
93
+ duration: 1000,
94
+ });
95
+ } else {
96
+ Toast({
97
+ context: this,
98
+ selector: '#t-toast',
99
+ message: '需要组件库发新版才能拿到地址ID',
100
+ icon: '',
101
+ duration: 1000,
102
+ });
103
+ }
104
+ },
105
+ deleteAddressHandle(e) {
106
+ const { id } = e.currentTarget.dataset;
107
+ this.setData({
108
+ addressList: this.data.addressList.filter((address) => address.id !== id),
109
+ deleteID: '',
110
+ showDeleteConfirm: false,
111
+ });
112
+ },
113
+ editAddressHandle({ detail }) {
114
+ this.waitForNewAddress();
115
+
116
+ const { id } = detail || {};
117
+ wx.navigateTo({ url: `/pages/user/address/edit/index?id=${id}` });
118
+ },
119
+ selectHandle({ detail }) {
120
+ if (this.selectMode) {
121
+ this.hasSelect = true;
122
+ resolveAddress(detail);
123
+ wx.navigateBack({ delta: 1 });
124
+ } else {
125
+ this.editAddressHandle({ detail });
126
+ }
127
+ },
128
+ createHandle() {
129
+ this.waitForNewAddress();
130
+ wx.navigateTo({ url: '/pages/user/address/edit/index' });
131
+ },
132
+
133
+ waitForNewAddress() {
134
+ getAddressPromise()
135
+ .then((newAddress) => {
136
+ let addressList = [...this.data.addressList];
137
+
138
+ newAddress.phoneNumber = newAddress.phone;
139
+ newAddress.address = `${newAddress.provinceName}${newAddress.cityName}${newAddress.districtName}${newAddress.detailAddress}`;
140
+ newAddress.tag = newAddress.addressTag;
141
+
142
+ if (!newAddress.addressId) {
143
+ newAddress.id = `${addressList.length}`;
144
+ newAddress.addressId = `${addressList.length}`;
145
+
146
+ if (newAddress.isDefault === 1) {
147
+ addressList = addressList.map((address) => {
148
+ address.isDefault = 0;
149
+
150
+ return address;
151
+ });
152
+ } else {
153
+ newAddress.isDefault = 0;
154
+ }
155
+
156
+ addressList.push(newAddress);
157
+ } else {
158
+ addressList = addressList.map((address) => {
159
+ if (address.addressId === newAddress.addressId) {
160
+ return newAddress;
161
+ }
162
+ return address;
163
+ });
164
+ }
165
+
166
+ addressList.sort((prevAddress, nextAddress) => {
167
+ if (prevAddress.isDefault && !nextAddress.isDefault) {
168
+ return -1;
169
+ }
170
+ if (!prevAddress.isDefault && nextAddress.isDefault) {
171
+ return 1;
172
+ }
173
+ return 0;
174
+ });
175
+
176
+ this.setData({
177
+ addressList: addressList,
178
+ });
179
+ })
180
+ .catch((e) => {
181
+ if (e.message !== 'cancel') {
182
+ Toast({
183
+ context: this,
184
+ selector: '#t-toast',
185
+ message: '地址编辑发生错误',
186
+ icon: '',
187
+ duration: 1000,
188
+ });
189
+ }
190
+ });
191
+ },
192
+ });
193
+ </script>
194
+
195
+ <template>
196
+ <view class="address-container [display:flex] [flex-direction:column] [align-items:stretch] [padding-bottom:calc(env(safe-area-inset-bottom)_+_172rpx)] [&_.address-list]:[font-size:24rpx] [&_.address-list]:[background-color:#ffffff] [&_.address-list]:[-webkit-overflow-scrolling:touch] [&_.bottom-fixed]:[border-top:1rpx_solid_#e5e5e5] [&_.bottom-fixed]:[position:fixed] [&_.bottom-fixed]:[bottom:0] [&_.bottom-fixed]:[left:0] [&_.bottom-fixed]:[right:0] [&_.bottom-fixed]:[z-index:1000] [&_.bottom-fixed]:[background:#fff] [&_.bottom-fixed]:[display:flex] [&_.bottom-fixed]:[justify-content:center] [&_.bottom-fixed]:[flex-direction:column] [&_.bottom-fixed]:[align-items:center] [&_.bottom-fixed]:[padding:12rpx_32rpx_calc(env(safe-area-inset-bottom)_+_12rpx)_32rpx] [&_.btn-wrap]:[width:100%] [&_.btn-wrap]:[display:flex] [&_.btn-wrap]:[justify-content:space-between] [&_.btn-wrap]:[align-items:center] [&_.btn-wrap]:[font-size:32rpx] [&_.btn-wrap]:[font-weight:bold] [&_.btn-wrap_.location-btn]:[width:332rpx] [&_.btn-wrap_.location-btn]:[height:88rpx] [&_.btn-wrap_.location-btn]:[display:flex] [&_.btn-wrap_.location-btn]:[justify-content:center] [&_.btn-wrap_.location-btn]:[align-items:center] [&_.btn-wrap_.location-btn]:[background-color:#ffffff] [&_.btn-wrap_.location-btn]:[color:#333] [&_.btn-wrap_.location-btn]:[position:relative] [&_.btn-wrap_.address-btn]:[width:332rpx] [&_.btn-wrap_.address-btn]:[height:88rpx] [&_.btn-wrap_.address-btn]:[display:flex] [&_.btn-wrap_.address-btn]:[justify-content:center] [&_.btn-wrap_.address-btn]:[align-items:center] [&_.btn-wrap_.address-btn]:[background-color:#fa4126] [&_.btn-wrap_.address-btn]:[border-radius:44rpx] [&_.btn-wrap_.address-btn]:[color:#fff] [&_.btn-wrap_.btn-default]:[background:#c6c6c6] [&_.bottom-fixed_.footer]:[margin-top:10rpx] [&_.bottom-fixed_.footer]:[display:inline-block] [&_.bottom-fixed_.footer]:[width:100%] [&_.bottom-fixed_.footer]:[text-align:center] [&_.bottom-fixed_.footer]:[font-size:24rpx] [&_.bottom-fixed_.footer]:[font-weight:400] [&_.bottom-fixed_.footer]:[color:#ff2525] [&_.bottom-fixed_.footer]:[line-height:60rpx] [&_.bottom-fixed_.footer]:[height:60rpx] [&_.message]:[margin-top:48rpx] [&_.custom-class]:[margin-right:12rpx] [&_.custom-class]:[font-weight:normal]">
197
+ <view class="address-list [&_.no-address]:[width:750rpx] [&_.no-address]:[padding-top:30vh] [&_.no-address]:[display:flex] [&_.no-address]:[flex-direction:column] [&_.no-address]:[justify-content:flex-start] [&_.no-address]:[align-items:center] [&_.no-address__icon]:[width:224rpx] [&_.no-address__icon]:[height:224rpx] [&_.no-address__text]:[font-size:28rpx] [&_.no-address__text]:[line-height:40rpx] [&_.no-address__text]:[color:#999999] [&_.no-address__text]:[margin-top:24rpx]" wx:if="{{addressList.length > 0}}">
198
+ <block wx:for="{{addressList}}" wx:for-index="index" wx:for-item="address" wx:key="addressId">
199
+ <t-address-item
200
+ isDrawLine="{{index+1 !== addressList.length}}"
201
+ extra-space="{{extraSpace}}"
202
+ class-prefix="ym"
203
+ address="{{address}}"
204
+ data-id="{{address.id}}"
205
+ bind:onSelect="selectHandle"
206
+ bind:onDelete="deleteAddressHandle"
207
+ bind:onEdit="editAddressHandle"
208
+ />
209
+ </block>
210
+ </view>
211
+ <view wx:else class="no-address">
212
+ <t-empty icon="" description="暂无收货地址,赶快添加吧" />
213
+ </view>
214
+ <view class="bottom-fixed">
215
+ <view class="btn-wrap">
216
+ <t-location
217
+ title="微信地址导入"
218
+ isOrderSure="{{isOrderSure}}"
219
+ isDisabledBtn="{{addressList.length >= 20}}"
220
+ navigateUrl="/pages/user/address/edit/index"
221
+ navigateEvent="onWeixinAddressPassed"
222
+ t-class="location-btn"
223
+ isCustomStyle="{{true}}"
224
+ bind:navigate="waitForNewAddress"
225
+ />
226
+ <view class="address-btn {{addressList.length >= 20 ? 'btn-default':''}}" bind:tap="createHandle">
227
+ <t-icon name="add" size="48rpx" color="#fff" t-class="custom-class" />
228
+ <text>新建收货地址</text>
229
+ </view>
230
+ </view>
231
+ <view class="footer" wx:if="{{addressList.length >= 20}}">最多支持添加20个收货地址</view>
232
+ </view>
233
+ </view>
234
+ <t-toast id="t-toast" />
235
+ </template>
236
+
237
+ <json>
238
+ {
239
+ "navigationBarTitleText": "收货地址",
240
+ "usingComponents": {
241
+ "t-icon": "tdesign-miniprogram/icon/icon",
242
+ "t-image": "/components/webp-image/index",
243
+ "t-toast": "tdesign-miniprogram/toast/toast",
244
+ "t-address-item": "/pages/user/components/ui-address-item/index",
245
+ "t-location": "/pages/user/components/t-location/index",
246
+ "t-empty": "tdesign-miniprogram/empty/empty"
247
+ }
248
+ }
249
+ </json>
@@ -0,0 +1,156 @@
1
+ <script lang="ts">
2
+ import { getPermission } from '../../../../utils/getPermission';
3
+ import { phoneRegCheck } from '../../../../utils/util';
4
+ import Toast from 'tdesign-miniprogram/toast/index';
5
+ import { addressParse } from '../../../../utils/addressParse';
6
+ import { resolveAddress, rejectAddress } from '../../../../services/address/list';
7
+
8
+ Component({
9
+ externalClasses: ['t-class'],
10
+ properties: {
11
+ title: {
12
+ type: String,
13
+ },
14
+ navigateUrl: {
15
+ type: String,
16
+ },
17
+ navigateEvent: {
18
+ type: String,
19
+ },
20
+ isCustomStyle: {
21
+ type: Boolean,
22
+ value: false,
23
+ },
24
+ isDisabledBtn: {
25
+ type: Boolean,
26
+ value: false,
27
+ },
28
+ isOrderSure: {
29
+ type: Boolean,
30
+ value: false,
31
+ },
32
+ },
33
+ methods: {
34
+ getWxLocation() {
35
+ if (this.properties.isDisabledBtn) return;
36
+ getPermission({ code: 'scope.address', name: '通讯地址' }).then(() => {
37
+ wx.chooseAddress({
38
+ success: async (options) => {
39
+ const { provinceName, cityName, countyName, detailInfo, userName, telNumber } = options;
40
+
41
+ if (!phoneRegCheck(telNumber)) {
42
+ Toast({
43
+ context: this,
44
+ selector: '#t-toast',
45
+ message: '请填写正确的手机号',
46
+ });
47
+ return;
48
+ }
49
+
50
+ const target = {
51
+ name: userName,
52
+ phone: telNumber,
53
+ countryName: '中国',
54
+ countryCode: 'chn',
55
+ detailAddress: detailInfo,
56
+ provinceName: provinceName,
57
+ cityName: cityName,
58
+ districtName: countyName,
59
+ isDefault: false,
60
+ isOrderSure: this.properties.isOrderSure,
61
+ };
62
+
63
+ try {
64
+ const { provinceCode, cityCode, districtCode } = await addressParse(provinceName, cityName, countyName);
65
+
66
+ const params = Object.assign(target, {
67
+ provinceCode,
68
+ cityCode,
69
+ districtCode,
70
+ });
71
+ if (this.properties.isOrderSure) {
72
+ this.onHandleSubmit(params);
73
+ } else if (this.properties.navigateUrl != '') {
74
+ const { navigateEvent } = this.properties;
75
+ this.triggerEvent('navigate');
76
+ wx.navigateTo({
77
+ url: this.properties.navigateUrl,
78
+ success: function (res) {
79
+ res.eventChannel.emit(navigateEvent, params);
80
+ },
81
+ });
82
+ } else {
83
+ this.triggerEvent('change', params);
84
+ }
85
+ } catch (error) {
86
+ wx.showToast({ title: '地址解析出错,请稍后再试', icon: 'none' });
87
+ }
88
+ },
89
+ fail(err) {
90
+ console.warn('未选择微信收货地址', err);
91
+ },
92
+ });
93
+ });
94
+ },
95
+
96
+ async queryAddress(addressId) {
97
+ try {
98
+ const { data } = await apis.userInfo.queryAddress({ addressId });
99
+ return data.userAddressVO;
100
+ } catch (err) {
101
+ console.error('查询地址错误', err);
102
+ throw err;
103
+ }
104
+ },
105
+
106
+ findPage(pageRouteUrl) {
107
+ const currentRoutes = getCurrentPages().map((v) => v.route);
108
+ return currentRoutes.indexOf(pageRouteUrl);
109
+ },
110
+
111
+ async onHandleSubmit(params) {
112
+ try {
113
+ const orderPageDeltaNum = this.findPage('pages/order/order-confirm/index');
114
+ if (orderPageDeltaNum > -1) {
115
+ wx.navigateBack({ delta: 1 });
116
+ resolveAddress(params);
117
+ return;
118
+ }
119
+ } catch (err) {
120
+ rejectAddress(params);
121
+ console.error(err);
122
+ }
123
+ },
124
+ },
125
+ });
126
+ </script>
127
+
128
+ <template>
129
+ <view class="wx-address t-class [&_.weixin]:[display:inline-block] [&_.weixin]:[font-size:48rpx] [&_.weixin]:[margin-right:20rpx] [&_.weixin]:[font-weight:normal] [&_.cell]:[padding:32rpx_30rpx] [&_.cell]:[border-radius:8rpx] [&_.cell__title]:[font-size:30rpx] [&_.cell__title]:[color:#333333]" bind:tap="getWxLocation">
130
+ <block wx:if="{{isCustomStyle}}">
131
+ <view class="wx-address-custom [display:flex] [align-items:center] [font-size:32rpx]">
132
+ <t-icon prefix="wr" t-class="weixin" color="#0ABF5B" name="wechat" size="48rpx" />
133
+ <text>{{title}}</text>
134
+ </view>
135
+ <slot />
136
+ </block>
137
+ <block wx:else>
138
+ <t-cell title="{{title}}" title-class="cell__title" wr-class="cell" border="{{false}}">
139
+ <t-icon t-class="weixin" slot="icon" color="#0ABF5B" name="logo-windows" size="48rpx" />
140
+ <t-icon slot="right-icon" name="chevron-right" class="custom-icon" color="#bbb" />
141
+ </t-cell>
142
+ </block>
143
+ </view>
144
+ <t-toast id="t-toast" />
145
+ </template>
146
+
147
+ <json>
148
+ {
149
+ "component": true,
150
+ "usingComponents": {
151
+ "t-cell": "tdesign-miniprogram/cell/cell",
152
+ "t-icon": "tdesign-miniprogram/icon/icon",
153
+ "t-toast": "tdesign-miniprogram/toast/toast"
154
+ }
155
+ }
156
+ </json>
@@ -0,0 +1,92 @@
1
+ <script lang="ts">
2
+ Component({
3
+ options: {
4
+ addGlobalClass: true,
5
+ multipleSlots: true,
6
+ },
7
+ properties: {
8
+ address: {
9
+ type: Object,
10
+ value: {},
11
+ },
12
+ customIcon: {
13
+ type: String,
14
+ value: 'edit-1',
15
+ },
16
+ extraSpace: {
17
+ type: Boolean,
18
+ value: true,
19
+ },
20
+ isDrawLine: {
21
+ type: Boolean,
22
+ value: true,
23
+ },
24
+ },
25
+ externalClasses: [
26
+ 'item-wrapper-class',
27
+ 'title-class',
28
+ 'default-tag-class',
29
+ 'normal-tag-class',
30
+ 'address-info-class',
31
+ 'delete-class',
32
+ ],
33
+ methods: {
34
+ onDelete(e) {
35
+ const { item } = e.currentTarget.dataset;
36
+ this.triggerEvent('onDelete', item);
37
+ },
38
+ onSelect(e) {
39
+ const { item } = e.currentTarget.dataset;
40
+ this.triggerEvent('onSelect', item);
41
+ },
42
+ onEdit(e) {
43
+ const { item } = e.currentTarget.dataset;
44
+ this.triggerEvent('onEdit', item);
45
+ },
46
+ },
47
+ });
48
+ </script>
49
+
50
+ <template>
51
+ <wxs module="phoneReg">
52
+ var toHide = function(array) { var mphone = array.substring(0, 3) + '****' + array.substring(7); return mphone; }
53
+ module.exports.toHide = toHide;
54
+ </wxs>
55
+ <view class="address-item-wrapper item-wrapper-class [overflow:hidden] [&_.swipe-out_.wr-swiper-cell]:[margin-top:20rpx] [&_.swipe-out_.swipe-right-del]:[display:flex] [&_.swipe-out_.swipe-right-del]:[justify-content:center] [&_.swipe-out_.swipe-right-del]:[align-items:center] [&_.swipe-out_.swipe-right-del]:[width:144rpx] [&_.swipe-out_.swipe-right-del]:[height:100%] [&_.swipe-out_.swipe-right-del]:[background-color:#fa4126] [&_.swipe-out_.swipe-right-del]:[color:#fff] [&_.swipe-out_.swipe-right-del]:[font-size:28rpx] [&_.swipe-out_.swipe-right-del]:[line-height:40rpx] [&_.draw-line]:[position:relative] [&_.address]:[display:flex] [&_.address]:[justify-content:space-between] [&_.address]:[align-items:center] [&_.address]:[padding:32rpx] [&_.address]:[background-color:#fff] [&_.address_.address-edit]:[padding:20rpx_0_20rpx_46rpx] [&_.address_.address-left]:[width:80rpx] [&_.address_.address-left]:[display:flex] [&_.address_.address-left]:[justify-content:center] [&_.address_.address-content]:[display:flex] [&_.address_.address-content]:[flex-direction:column] [&_.address_.address-content]:[flex:1] [&_.address_.address-content_.title]:[font-size:32rpx] [&_.address_.address-content_.title]:[line-height:48rpx] [&_.address_.address-content_.title]:[margin-bottom:16rpx] [&_.address_.address-content_.title]:[color:#333333] [&_.address_.address-content_.title]:[font-weight:bold] [&_.address_.address-content_.title]:[display:flex] [&_.address_.address-content_.title_.text-style]:[margin-right:8rpx] [&_.address_.address-content_.title_.text-style]:[overflow:hidden] [&_.address_.address-content_.title_.text-style]:[text-overflow:ellipsis] [&_.address_.address-content_.title_.text-style]:[white-space:nowrap] [&_.address_.address-content_.title_.text-style]:[max-width:280rpx] [&_.address_.address-content_.label-adds]:[display:flex] [&_.address_.address-content_.label-adds_.adds]:[display:-webkit-box] [&_.address_.address-content_.label-adds_.adds]:[overflow:hidden] [&_.address_.address-content_.label-adds_.adds]:[text-overflow:ellipsis] [&_.address_.address-content_.label-adds_.adds]:[-webkit-box-orient:vertical] [&_.address_.address-content_.label-adds_.adds]:[-webkit-line-clamp:2] [&_.address_.address-content_.label-adds_.adds]:[color:#999999] [&_.address_.address-content_.label-adds_.tag]:[display:inline-block] [&_.address_.address-content_.label-adds_.tag]:[padding:0rpx_8rpx] [&_.address_.address-content_.label-adds_.tag]:[min-width:40rpx] [&_.address_.address-content_.label-adds_.tag]:[height:32rpx] [&_.address_.address-content_.label-adds_.tag]:[border-radius:18rpx] [&_.address_.address-content_.label-adds_.tag]:[font-size:20rpx] [&_.address_.address-content_.label-adds_.tag]:[line-height:32rpx] [&_.address_.address-content_.label-adds_.tag]:[text-align:center] [&_.address_.address-content_.label-adds_.tag]:[margin-right:8rpx] [&_.address_.address-content_.label-adds_.tag]:[vertical-align:text-top] [&_.address_.address-content_.label-adds_.tag-default]:[background:#ffece9] [&_.address_.address-content_.label-adds_.tag-default]:[color:#fa4126] [&_.address_.address-content_.label-adds_.tag-primary]:[background:#f0f1ff] [&_.address_.address-content_.label-adds_.tag-primary]:[color:#5a66ff] [&_.address_.address-content_.label-adds_.address-text]:[font-size:28rpx] [&_.address_.address-content_.label-adds_.address-text]:[line-height:40rpx] [&_.address_.address-content_.label-adds_.address-text]:[color:#999999]">
56
+ <t-swipe-cell class="swipe-out">
57
+ <view class="address {{isDrawLine ? 'draw-line' : ''}}" bindtap="onSelect" data-item="{{address}}">
58
+ <view class="address-left" wx:if="{{extraSpace}}">
59
+ <t-icon wx:if="{{address.checked}}" name="check" color="#FA4126" class-prefix="{{classPrefix}}" size="46rpx" />
60
+ </view>
61
+ <view class="address-content">
62
+ <view class="title title-class">
63
+ <text class="text-style">{{address.name}}</text>
64
+ <text>{{phoneReg.toHide(address.phoneNumber || '')}}</text>
65
+ </view>
66
+ <view class="label-adds">
67
+ <text class="adds address-info-class">
68
+ <text wx:if="{{address.isDefault === 1}}" class="tag tag-default default-tag-class">默认</text>
69
+ <text wx:if="{{address.tag}}" class="tag tag-primary normal-tag-class">{{address.tag}}</text>
70
+ <text class="address-text">{{address.address}}</text>
71
+ </text>
72
+ </view>
73
+ </view>
74
+ <view catch:tap="onEdit" data-item="{{address}}" class="address-edit">
75
+ <t-icon name="{{customIcon}}" class-prefix="{{classPrefix}}" size="46rpx" color="#BBBBBB" />
76
+ </view>
77
+ </view>
78
+ <view slot="right" class="swipe-right-del delete-class" bindtap="onDelete" data-item="{{address}}"> 删除 </view>
79
+ </t-swipe-cell>
80
+ </view>
81
+ </template>
82
+
83
+ <json>
84
+ {
85
+ "component": true,
86
+ "usingComponents": {
87
+ "t-icon": "tdesign-miniprogram/icon/icon",
88
+ "t-tag": "tdesign-miniprogram/tag/tag",
89
+ "t-swipe-cell": "tdesign-miniprogram/swipe-cell/swipe-cell"
90
+ }
91
+ }
92
+ </json>
@@ -0,0 +1,49 @@
1
+ <script lang="ts">
2
+ Page({
3
+ data: {
4
+ nameValue: '',
5
+ },
6
+ onLoad(options) {
7
+ const { name } = options;
8
+ this.setData({
9
+ nameValue: name,
10
+ });
11
+ },
12
+ onSubmit() {
13
+ wx.navigateBack({ backRefresh: true });
14
+ },
15
+ clearContent() {
16
+ this.setData({
17
+ nameValue: '',
18
+ });
19
+ },
20
+ });
21
+ </script>
22
+
23
+ <template>
24
+ <view class="name-edit [padding-top:20rpx] [&_.name-edit__input--desc]:[font-size:26rpx] [&_.name-edit__input--desc]:[padding:16rpx_32rpx] [&_.name-edit__input--desc]:[color:#999] [&_.name-edit__input--desc]:[margin-bottom:200rpx] [&_.name-edit__wrapper]:[margin:0_32rpx]">
25
+ <t-input
26
+ borderless
27
+ model:value="{{nameValue}}"
28
+ placeholder="请输入文字"
29
+ label="昵称"
30
+ clearable
31
+ bind:clear="clearContent"
32
+ />
33
+ <view class="name-edit__input--desc"> 最多可输入15个字 </view>
34
+ <view class="name-edit__wrapper">
35
+ <t-button block shape="round" disabled="{{!nameValue}}" bind:tap="onSubmit">保存</t-button>
36
+ </view>
37
+ </view>
38
+ </template>
39
+
40
+ <json>
41
+ {
42
+ "navigationBarTitleText": "昵称",
43
+ "usingComponents": {
44
+ "t-input": "tdesign-miniprogram/input/input",
45
+ "t-icon": "tdesign-miniprogram/icon/icon",
46
+ "t-button": "tdesign-miniprogram/button/button"
47
+ }
48
+ }
49
+ </json>