create-weapp-vite 2.0.32 → 2.0.34

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 (180) hide show
  1. package/README.md +0 -1
  2. package/dist/{chunk-IT75MAH3.js → chunk-6CRKNZN2.js} +2 -3
  3. package/dist/cli.js +1 -5
  4. package/dist/index.d.ts +0 -1
  5. package/dist/index.js +1 -1
  6. package/package.json +2 -2
  7. package/templates/tailwindcss/package.json +1 -1
  8. package/templates/tdesign/package.json +1 -1
  9. package/templates/vant/package.json +1 -1
  10. package/templates/wevu/package.json +1 -1
  11. package/templates/wevu-tdesign/package.json +2 -2
  12. package/templates/wevu-retail/.editorconfig +0 -9
  13. package/templates/wevu-retail/.vscode/settings.json +0 -10
  14. package/templates/wevu-retail/AGENTS.md +0 -35
  15. package/templates/wevu-retail/README.md +0 -26
  16. package/templates/wevu-retail/auto-import-components.json +0 -1
  17. package/templates/wevu-retail/gitignore +0 -35
  18. package/templates/wevu-retail/package.json +0 -42
  19. package/templates/wevu-retail/postcss.config.js +0 -6
  20. package/templates/wevu-retail/project.config.json +0 -44
  21. package/templates/wevu-retail/project.private.config.json +0 -8
  22. package/templates/wevu-retail/src/app.vue +0 -104
  23. package/templates/wevu-retail/src/common/updateManager.ts +0 -29
  24. package/templates/wevu-retail/src/components/filter/index.vue +0 -134
  25. package/templates/wevu-retail/src/components/filter-popup/index.vue +0 -67
  26. package/templates/wevu-retail/src/components/goods-card/index.vue +0 -219
  27. package/templates/wevu-retail/src/components/goods-list/index.vue +0 -91
  28. package/templates/wevu-retail/src/components/load-more/index.vue +0 -99
  29. package/templates/wevu-retail/src/components/loading-content/index.vue +0 -48
  30. package/templates/wevu-retail/src/components/price/index.vue +0 -104
  31. package/templates/wevu-retail/src/components/promotion/ui-coupon-card/index.vue +0 -143
  32. package/templates/wevu-retail/src/components/promotion/ui-coupon-card/tools.wxs +0 -18
  33. package/templates/wevu-retail/src/components/swipeout/index.vue +0 -118
  34. package/templates/wevu-retail/src/components/swipeout/swipe.wxs +0 -151
  35. package/templates/wevu-retail/src/components/webp-image/index.vue +0 -105
  36. package/templates/wevu-retail/src/components/webp-image/utils.wxs +0 -140
  37. package/templates/wevu-retail/src/config/index.ts +0 -20437
  38. package/templates/wevu-retail/src/custom-tab-bar/data.ts +0 -22
  39. package/templates/wevu-retail/src/custom-tab-bar/index.vue +0 -62
  40. package/templates/wevu-retail/src/model/activities.ts +0 -7
  41. package/templates/wevu-retail/src/model/activity.ts +0 -18
  42. package/templates/wevu-retail/src/model/address.ts +0 -31
  43. package/templates/wevu-retail/src/model/cart.ts +0 -306
  44. package/templates/wevu-retail/src/model/category.ts +0 -175
  45. package/templates/wevu-retail/src/model/comments/queryDetail.ts +0 -50
  46. package/templates/wevu-retail/src/model/comments.ts +0 -298
  47. package/templates/wevu-retail/src/model/coupon.ts +0 -39
  48. package/templates/wevu-retail/src/model/detailsComments.ts +0 -30
  49. package/templates/wevu-retail/src/model/good.ts +0 -1904
  50. package/templates/wevu-retail/src/model/goods.ts +0 -7
  51. package/templates/wevu-retail/src/model/order/applyService.ts +0 -329
  52. package/templates/wevu-retail/src/model/order/orderConfirm.ts +0 -147
  53. package/templates/wevu-retail/src/model/order/orderDetail.ts +0 -1191
  54. package/templates/wevu-retail/src/model/order/orderList.ts +0 -1033
  55. package/templates/wevu-retail/src/model/promotion.ts +0 -20
  56. package/templates/wevu-retail/src/model/search.ts +0 -60
  57. package/templates/wevu-retail/src/model/submitComment.ts +0 -58
  58. package/templates/wevu-retail/src/model/swiper.ts +0 -39
  59. package/templates/wevu-retail/src/model/usercenter.ts +0 -52
  60. package/templates/wevu-retail/src/pages/cart/components/cart-bar/index.vue +0 -104
  61. package/templates/wevu-retail/src/pages/cart/components/cart-empty/index.vue +0 -41
  62. package/templates/wevu-retail/src/pages/cart/components/cart-group/index.vue +0 -333
  63. package/templates/wevu-retail/src/pages/cart/components/cart-group/index.wxs +0 -5
  64. package/templates/wevu-retail/src/pages/cart/components/cart-group/utils.wxs +0 -20
  65. package/templates/wevu-retail/src/pages/cart/components/goods-card/index.vue +0 -334
  66. package/templates/wevu-retail/src/pages/cart/components/specs-popup/index.vue +0 -100
  67. package/templates/wevu-retail/src/pages/cart/index.vue +0 -342
  68. package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/README.md +0 -95
  69. package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/c-sidebar-item/index.vue +0 -73
  70. package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/index.vue +0 -121
  71. package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-tabbar/c-tabbar-more/index.vue +0 -74
  72. package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-tabbar/index.vue +0 -102
  73. package/templates/wevu-retail/src/pages/category/components/goods-category/index.vue +0 -137
  74. package/templates/wevu-retail/src/pages/category/index.vue +0 -50
  75. package/templates/wevu-retail/src/pages/coupon/components/coupon-card/index.vue +0 -95
  76. package/templates/wevu-retail/src/pages/coupon/components/floating-button/index.vue +0 -44
  77. package/templates/wevu-retail/src/pages/coupon/coupon-activity-goods/index.vue +0 -135
  78. package/templates/wevu-retail/src/pages/coupon/coupon-detail/index.vue +0 -94
  79. package/templates/wevu-retail/src/pages/coupon/coupon-list/index.vue +0 -136
  80. package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/images-videos/assets/play.png +0 -0
  81. package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/images-videos/index.vue +0 -65
  82. package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/my-video/index.vue +0 -92
  83. package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/index.vue +0 -93
  84. package/templates/wevu-retail/src/pages/goods/comments/create/index.vue +0 -196
  85. package/templates/wevu-retail/src/pages/goods/comments/index.vue +0 -293
  86. package/templates/wevu-retail/src/pages/goods/details/components/buy-bar/index.vue +0 -117
  87. package/templates/wevu-retail/src/pages/goods/details/components/goods-specs-popup/index.vue +0 -440
  88. package/templates/wevu-retail/src/pages/goods/details/components/promotion-popup/index.vue +0 -83
  89. package/templates/wevu-retail/src/pages/goods/details/index.vue +0 -598
  90. package/templates/wevu-retail/src/pages/goods/list/index.vue +0 -299
  91. package/templates/wevu-retail/src/pages/goods/result/index.vue +0 -350
  92. package/templates/wevu-retail/src/pages/goods/search/index.vue +0 -196
  93. package/templates/wevu-retail/src/pages/home/home.vue +0 -215
  94. package/templates/wevu-retail/src/pages/home/readme +0 -8
  95. package/templates/wevu-retail/src/pages/order/after-service-detail/api.ts +0 -34
  96. package/templates/wevu-retail/src/pages/order/after-service-detail/index.vue +0 -430
  97. package/templates/wevu-retail/src/pages/order/after-service-list/api.ts +0 -1262
  98. package/templates/wevu-retail/src/pages/order/after-service-list/index.vue +0 -299
  99. package/templates/wevu-retail/src/pages/order/apply-service/index.vue +0 -665
  100. package/templates/wevu-retail/src/pages/order/components/after-service-button-bar/index.vue +0 -142
  101. package/templates/wevu-retail/src/pages/order/components/customer-service/index.vue +0 -75
  102. package/templates/wevu-retail/src/pages/order/components/goods-card/index.vue +0 -356
  103. package/templates/wevu-retail/src/pages/order/components/noGoods/noGood.wxs +0 -17
  104. package/templates/wevu-retail/src/pages/order/components/noGoods/noGoods.vue +0 -125
  105. package/templates/wevu-retail/src/pages/order/components/order-button-bar/index.vue +0 -262
  106. package/templates/wevu-retail/src/pages/order/components/order-card/index.vue +0 -126
  107. package/templates/wevu-retail/src/pages/order/components/order-goods-card/index.vue +0 -86
  108. package/templates/wevu-retail/src/pages/order/components/reason-sheet/index.vue +0 -161
  109. package/templates/wevu-retail/src/pages/order/components/reason-sheet/reasonSheet.ts +0 -25
  110. package/templates/wevu-retail/src/pages/order/components/selectCoupons/mock.ts +0 -22
  111. package/templates/wevu-retail/src/pages/order/components/selectCoupons/selectCoupon.wxs +0 -16
  112. package/templates/wevu-retail/src/pages/order/components/selectCoupons/selectCoupons.vue +0 -207
  113. package/templates/wevu-retail/src/pages/order/components/specs-goods-card/index.vue +0 -185
  114. package/templates/wevu-retail/src/pages/order/config.ts +0 -94
  115. package/templates/wevu-retail/src/pages/order/delivery-detail/index.vue +0 -145
  116. package/templates/wevu-retail/src/pages/order/delivery-detail/isUrl.wxs +0 -7
  117. package/templates/wevu-retail/src/pages/order/fill-tracking-no/api.ts +0 -71
  118. package/templates/wevu-retail/src/pages/order/fill-tracking-no/index.vue +0 -267
  119. package/templates/wevu-retail/src/pages/order/invoice/index.vue +0 -94
  120. package/templates/wevu-retail/src/pages/order/order-confirm/components/address-card/index.vue +0 -78
  121. package/templates/wevu-retail/src/pages/order/order-confirm/getNotes.wxs +0 -11
  122. package/templates/wevu-retail/src/pages/order/order-confirm/handleInvoice.wxs +0 -11
  123. package/templates/wevu-retail/src/pages/order/order-confirm/index.vue +0 -707
  124. package/templates/wevu-retail/src/pages/order/order-confirm/order.wxs +0 -8
  125. package/templates/wevu-retail/src/pages/order/order-confirm/pay.ts +0 -115
  126. package/templates/wevu-retail/src/pages/order/order-detail/index.vue +0 -456
  127. package/templates/wevu-retail/src/pages/order/order-list/index.vue +0 -288
  128. package/templates/wevu-retail/src/pages/order/pay-result/index.vue +0 -77
  129. package/templates/wevu-retail/src/pages/order/receipt/index.vue +0 -336
  130. package/templates/wevu-retail/src/pages/promotion/promotion-detail/index.vue +0 -145
  131. package/templates/wevu-retail/src/pages/user/address/edit/index.vue +0 -514
  132. package/templates/wevu-retail/src/pages/user/address/list/index.vue +0 -249
  133. package/templates/wevu-retail/src/pages/user/components/t-location/index.vue +0 -156
  134. package/templates/wevu-retail/src/pages/user/components/ui-address-item/index.vue +0 -92
  135. package/templates/wevu-retail/src/pages/user/name-edit/index.vue +0 -49
  136. package/templates/wevu-retail/src/pages/user/person-info/index.vue +0 -198
  137. package/templates/wevu-retail/src/pages/usercenter/address/edit/util.ts +0 -33
  138. package/templates/wevu-retail/src/pages/usercenter/components/order-group/index.vue +0 -90
  139. package/templates/wevu-retail/src/pages/usercenter/components/ui-select-picker/index.vue +0 -108
  140. package/templates/wevu-retail/src/pages/usercenter/components/user-center-card/index.vue +0 -82
  141. package/templates/wevu-retail/src/pages/usercenter/index.vue +0 -301
  142. package/templates/wevu-retail/src/services/_utils/delay.ts +0 -3
  143. package/templates/wevu-retail/src/services/_utils/timeout.ts +0 -3
  144. package/templates/wevu-retail/src/services/activity/fetchActivity.ts +0 -20
  145. package/templates/wevu-retail/src/services/activity/fetchActivityList.ts +0 -20
  146. package/templates/wevu-retail/src/services/address/edit.ts +0 -33
  147. package/templates/wevu-retail/src/services/address/fetchAddress.ts +0 -48
  148. package/templates/wevu-retail/src/services/address/list.ts +0 -31
  149. package/templates/wevu-retail/src/services/cart/cart.ts +0 -20
  150. package/templates/wevu-retail/src/services/comments/fetchComments.ts +0 -18
  151. package/templates/wevu-retail/src/services/comments/fetchCommentsCount.ts +0 -18
  152. package/templates/wevu-retail/src/services/coupon/index.ts +0 -65
  153. package/templates/wevu-retail/src/services/good/comments/fetchCommentDetail.ts +0 -20
  154. package/templates/wevu-retail/src/services/good/fetchCategoryList.ts +0 -18
  155. package/templates/wevu-retail/src/services/good/fetchGood.ts +0 -18
  156. package/templates/wevu-retail/src/services/good/fetchGoods.ts +0 -29
  157. package/templates/wevu-retail/src/services/good/fetchGoodsDetailsComments.ts +0 -37
  158. package/templates/wevu-retail/src/services/good/fetchGoodsList.ts +0 -39
  159. package/templates/wevu-retail/src/services/good/fetchSearchHistory.ts +0 -35
  160. package/templates/wevu-retail/src/services/good/fetchSearchResult.ts +0 -38
  161. package/templates/wevu-retail/src/services/home/home.ts +0 -53
  162. package/templates/wevu-retail/src/services/order/applyService.ts +0 -70
  163. package/templates/wevu-retail/src/services/order/orderConfirm.ts +0 -69
  164. package/templates/wevu-retail/src/services/order/orderDetail.ts +0 -39
  165. package/templates/wevu-retail/src/services/order/orderList.ts +0 -39
  166. package/templates/wevu-retail/src/services/order/orderSubmitComment.ts +0 -22
  167. package/templates/wevu-retail/src/services/promotion/detail.ts +0 -18
  168. package/templates/wevu-retail/src/services/usercenter/fetchPerson.ts +0 -28
  169. package/templates/wevu-retail/src/services/usercenter/fetchUsercenter.ts +0 -18
  170. package/templates/wevu-retail/src/sitemap.json +0 -7
  171. package/templates/wevu-retail/src/utils/addressParse.ts +0 -25
  172. package/templates/wevu-retail/src/utils/getPermission.ts +0 -45
  173. package/templates/wevu-retail/src/utils/mock.ts +0 -51
  174. package/templates/wevu-retail/src/utils/util.ts +0 -134
  175. package/templates/wevu-retail/src/vite-env.d.ts +0 -1
  176. package/templates/wevu-retail/tailwind.config.ts +0 -15
  177. package/templates/wevu-retail/tsconfig.app.json +0 -58
  178. package/templates/wevu-retail/tsconfig.json +0 -11
  179. package/templates/wevu-retail/tsconfig.node.json +0 -33
  180. package/templates/wevu-retail/vite.config.ts +0 -14
@@ -1,342 +0,0 @@
1
- <script lang="ts">
2
- import Dialog from 'tdesign-miniprogram/dialog/index';
3
- import Toast from 'tdesign-miniprogram/toast/index';
4
- import { fetchCartGroupData } from '../../services/cart/cart';
5
-
6
- Page({
7
- data: {
8
- cartGroupData: null,
9
- },
10
-
11
- // 调用自定义tabbar的init函数,使页面与tabbar激活状态保持一致
12
- onShow() {
13
- this.getTabBar().init();
14
- },
15
-
16
- onLoad() {
17
- this.refreshData();
18
- },
19
-
20
- refreshData() {
21
- this.getCartGroupData().then((res) => {
22
- let isEmpty = true;
23
- const cartGroupData = res.data;
24
- // 一些组件中需要的字段可能接口并没有返回,或者返回的数据结构与预期不一致,需要在此先对数据做一些处理
25
- // 统计门店下加购的商品是否全选、是否存在缺货/无货
26
- for (const store of cartGroupData.storeGoods) {
27
- store.isSelected = true; // 该门店已加购商品是否全选
28
- store.storeStockShortage = false; // 该门店已加购商品是否存在库存不足
29
- if (!store.shortageGoodsList) {
30
- store.shortageGoodsList = []; // 该门店已加购商品如果库存为0需单独分组
31
- }
32
- for (const activity of store.promotionGoodsList) {
33
- activity.goodsPromotionList = activity.goodsPromotionList.filter((goods) => {
34
- goods.originPrice = undefined;
35
-
36
- // 统计是否有加购数大于库存数的商品
37
- if (goods.quantity > goods.stockQuantity) {
38
- store.storeStockShortage = true;
39
- }
40
- // 统计是否全选
41
- if (!goods.isSelected) {
42
- store.isSelected = false;
43
- }
44
- // 库存为0(无货)的商品单独分组
45
- if (goods.stockQuantity > 0) {
46
- return true;
47
- }
48
- store.shortageGoodsList.push(goods);
49
- return false;
50
- });
51
-
52
- if (activity.goodsPromotionList.length > 0) {
53
- isEmpty = false;
54
- }
55
- }
56
- if (store.shortageGoodsList.length > 0) {
57
- isEmpty = false;
58
- }
59
- }
60
- cartGroupData.invalidGoodItems = cartGroupData.invalidGoodItems.map((goods) => {
61
- goods.originPrice = undefined;
62
- return goods;
63
- });
64
- cartGroupData.isNotEmpty = !isEmpty;
65
- this.setData({ cartGroupData });
66
- });
67
- },
68
-
69
- findGoods(spuId, skuId) {
70
- let currentStore;
71
- let currentActivity;
72
- let currentGoods;
73
- const { storeGoods } = this.data.cartGroupData;
74
- for (const store of storeGoods) {
75
- for (const activity of store.promotionGoodsList) {
76
- for (const goods of activity.goodsPromotionList) {
77
- if (goods.spuId === spuId && goods.skuId === skuId) {
78
- currentStore = store;
79
- currentActivity = currentActivity;
80
- currentGoods = goods;
81
- return {
82
- currentStore,
83
- currentActivity,
84
- currentGoods,
85
- };
86
- }
87
- }
88
- }
89
- }
90
- return {
91
- currentStore,
92
- currentActivity,
93
- currentGoods,
94
- };
95
- },
96
-
97
- // 注:实际场景时应该调用接口获取购物车数据
98
- getCartGroupData() {
99
- const { cartGroupData } = this.data;
100
- if (!cartGroupData) {
101
- return fetchCartGroupData();
102
- }
103
- return Promise.resolve({ data: cartGroupData });
104
- },
105
-
106
- // 选择单个商品
107
- // 注:实际场景时应该调用接口更改选中状态
108
- selectGoodsService({ spuId, skuId, isSelected }) {
109
- this.findGoods(spuId, skuId).currentGoods.isSelected = isSelected;
110
- return Promise.resolve();
111
- },
112
-
113
- // 全选门店
114
- // 注:实际场景时应该调用接口更改选中状态
115
- selectStoreService({ storeId, isSelected }) {
116
- const currentStore = this.data.cartGroupData.storeGoods.find((s) => s.storeId === storeId);
117
- currentStore.isSelected = isSelected;
118
- currentStore.promotionGoodsList.forEach((activity) => {
119
- activity.goodsPromotionList.forEach((goods) => {
120
- goods.isSelected = isSelected;
121
- });
122
- });
123
- return Promise.resolve();
124
- },
125
-
126
- // 加购数量变更
127
- // 注:实际场景时应该调用接口
128
- changeQuantityService({ spuId, skuId, quantity }) {
129
- this.findGoods(spuId, skuId).currentGoods.quantity = quantity;
130
- return Promise.resolve();
131
- },
132
-
133
- // 删除加购商品
134
- // 注:实际场景时应该调用接口
135
- deleteGoodsService({ spuId, skuId }) {
136
- function deleteGoods(group) {
137
- for (const gindex in group) {
138
- const goods = group[gindex];
139
- if (goods.spuId === spuId && goods.skuId === skuId) {
140
- group.splice(gindex, 1);
141
- return gindex;
142
- }
143
- }
144
- return -1;
145
- }
146
- const { storeGoods, invalidGoodItems } = this.data.cartGroupData;
147
- for (const store of storeGoods) {
148
- for (const activity of store.promotionGoodsList) {
149
- if (deleteGoods(activity.goodsPromotionList) > -1) {
150
- return Promise.resolve();
151
- }
152
- }
153
- if (deleteGoods(store.shortageGoodsList) > -1) {
154
- return Promise.resolve();
155
- }
156
- }
157
- if (deleteGoods(invalidGoodItems) > -1) {
158
- return Promise.resolve();
159
- }
160
- return Promise.reject();
161
- },
162
-
163
- // 清空失效商品
164
- // 注:实际场景时应该调用接口
165
- clearInvalidGoodsService() {
166
- this.data.cartGroupData.invalidGoodItems = [];
167
- return Promise.resolve();
168
- },
169
-
170
- onGoodsSelect(e) {
171
- const {
172
- goods: { spuId, skuId },
173
- isSelected,
174
- } = e.detail;
175
- const { currentGoods } = this.findGoods(spuId, skuId);
176
- Toast({
177
- context: this,
178
- selector: '#t-toast',
179
- message: `${isSelected ? '选择' : '取消'}"${
180
- currentGoods.title.length > 5 ? `${currentGoods.title.slice(0, 5)}...` : currentGoods.title
181
- }"`,
182
- icon: '',
183
- });
184
- this.selectGoodsService({ spuId, skuId, isSelected }).then(() => this.refreshData());
185
- },
186
-
187
- onStoreSelect(e) {
188
- const {
189
- store: { storeId },
190
- isSelected,
191
- } = e.detail;
192
- this.selectStoreService({ storeId, isSelected }).then(() => this.refreshData());
193
- },
194
-
195
- onQuantityChange(e) {
196
- const {
197
- goods: { spuId, skuId },
198
- quantity,
199
- } = e.detail;
200
- const { currentGoods } = this.findGoods(spuId, skuId);
201
- const stockQuantity = currentGoods.stockQuantity > 0 ? currentGoods.stockQuantity : 0; // 避免后端返回的是-1
202
- // 加购数量超过库存数量
203
- if (quantity > stockQuantity) {
204
- // 加购数量等于库存数量的情况下继续加购
205
- if (currentGoods.quantity === stockQuantity && quantity - stockQuantity === 1) {
206
- Toast({
207
- context: this,
208
- selector: '#t-toast',
209
- message: '当前商品库存不足',
210
- });
211
- return;
212
- }
213
- Dialog.confirm({
214
- title: '商品库存不足',
215
- content: `当前商品库存不足,最大可购买数量为${stockQuantity}件`,
216
- confirmBtn: '修改为最大可购买数量',
217
- cancelBtn: '取消',
218
- })
219
- .then(() => {
220
- this.changeQuantityService({
221
- spuId,
222
- skuId,
223
- quantity: stockQuantity,
224
- }).then(() => this.refreshData());
225
- })
226
- .catch(() => {});
227
- return;
228
- }
229
- this.changeQuantityService({ spuId, skuId, quantity }).then(() => this.refreshData());
230
- },
231
-
232
- goCollect() {
233
- /** 活动肯定有一个活动ID,用来获取活动banner,活动商品列表等 */
234
- const promotionID = '123';
235
- wx.navigateTo({
236
- url: `/pages/promotion/promotion-detail/index?promotion_id=${promotionID}`,
237
- });
238
- },
239
-
240
- goGoodsDetail(e) {
241
- const { spuId, storeId } = e.detail.goods;
242
- wx.navigateTo({
243
- url: `/pages/goods/details/index?spuId=${spuId}&storeId=${storeId}`,
244
- });
245
- },
246
-
247
- clearInvalidGoods() {
248
- // 实际场景时应该调用接口清空失效商品
249
- this.clearInvalidGoodsService().then(() => this.refreshData());
250
- },
251
-
252
- onGoodsDelete(e) {
253
- const {
254
- goods: { spuId, skuId },
255
- } = e.detail;
256
- Dialog.confirm({
257
- content: '确认删除该商品吗?',
258
- confirmBtn: '确定',
259
- cancelBtn: '取消',
260
- }).then(() => {
261
- this.deleteGoodsService({ spuId, skuId }).then(() => {
262
- Toast({ context: this, selector: '#t-toast', message: '商品删除成功' });
263
- this.refreshData();
264
- });
265
- });
266
- },
267
-
268
- onSelectAll(event) {
269
- const { isAllSelected } = event?.detail ?? {};
270
- Toast({
271
- context: this,
272
- selector: '#t-toast',
273
- message: `${isAllSelected ? '取消' : '点击'}了全选按钮`,
274
- });
275
- // 调用接口改变全选
276
- },
277
-
278
- onToSettle() {
279
- const goodsRequestList = [];
280
- this.data.cartGroupData.storeGoods.forEach((store) => {
281
- store.promotionGoodsList.forEach((promotion) => {
282
- promotion.goodsPromotionList.forEach((m) => {
283
- if (m.isSelected == 1) {
284
- goodsRequestList.push(m);
285
- }
286
- });
287
- });
288
- });
289
- wx.setStorageSync('order.goodsRequestList', JSON.stringify(goodsRequestList));
290
- wx.navigateTo({ url: '/pages/order/order-confirm/index?type=cart' });
291
- },
292
- onGotoHome() {
293
- wx.switchTab({ url: '/pages/home/home' });
294
- },
295
- });
296
- </script>
297
-
298
- <template>
299
- <!-- 分层购物车 -->
300
- <block wx:if="{{cartGroupData.isNotEmpty}}">
301
- <cart-group
302
- store-goods="{{ cartGroupData.storeGoods }}"
303
- invalid-good-items="{{ cartGroupData.invalidGoodItems }}"
304
- bindselectgoods="onGoodsSelect"
305
- bindselectstore="onStoreSelect"
306
- bindchangequantity="onQuantityChange"
307
- bindgocollect="goCollect"
308
- bindgoodsclick="goGoodsDetail"
309
- bindclearinvalidgoods="clearInvalidGoods"
310
- binddelete="onGoodsDelete"
311
- />
312
-
313
- <view class="gap [height:100rpx] [width:100%]" />
314
- <!-- 商品小计以及结算按钮 -->
315
- <cart-bar
316
- is-all-selected="{{cartGroupData.isAllSelected}}"
317
- total-amount="{{cartGroupData.totalAmount}}"
318
- total-goods-num="{{cartGroupData.selectedGoodsCount}}"
319
- total-discount-amount="{{cartGroupData.totalDiscountAmount}}"
320
- fixed="{{true}}"
321
- bottomHeight="{{110}}"
322
- bindhandleSelectAll="onSelectAll"
323
- bindhandleToSettle="onToSettle"
324
- />
325
- </block>
326
- <!-- 购物车空态 -->
327
- <cart-empty wx:else bind:handleClick="onGotoHome" />
328
- <t-toast id="t-toast" />
329
- <t-dialog id="t-dialog" />
330
- </template>
331
-
332
- <json>
333
- {
334
- "navigationBarTitleText": "购物车",
335
- "usingComponents": {
336
- "cart-group": "./components/cart-group/index",
337
- "cart-empty": "./components/cart-empty/index",
338
- "cart-bar": "./components/cart-bar/index",
339
- "t-toast": "tdesign-miniprogram/toast/toast",
340
- "t-dialog": "tdesign-miniprogram/dialog/dialog"
341
- }
342
- }</json>
@@ -1,95 +0,0 @@
1
- # Sidebar 侧边导航
2
-
3
- ### 引入
4
-
5
- 全局引入,在miniprogram根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
6
-
7
- ```json
8
- // app.json 或 index.json
9
- "usingComponents": {
10
- "wr-sidebar": "path/to/components/goods-category/wr-sidebar/index",
11
- "wr-sidebar-item": "path/to/component/goods-category/wr-sidebar/wr-sidebar-item/index"
12
- }
13
- ```
14
-
15
- ## 代码演示
16
-
17
- ### 基础用法
18
-
19
- 通过在`wr-sidebar`上设置`activeKey`属性来控制选中项
20
-
21
- ```html
22
- <wr-sidebar active-key="{{ activeKey }}" bind:change="onChange">
23
- <wr-sidebar-item title="标签名称" />
24
- <wr-sidebar-item title="标签名称" />
25
- <wr-sidebar-item title="标签名称" />
26
- </wr-sidebar>
27
- ```
28
-
29
- ``` javascript
30
- Page({
31
- data: {
32
- activeKey: 0
33
- },
34
-
35
- onChange(event) {
36
- wx.showToast({
37
- icon: 'none',
38
- title: `切换至第${event.detail}项`
39
- });
40
- }
41
- });
42
- ```
43
-
44
- ### 提示气泡(暂未实现)
45
-
46
- 设置`dot`属性后,会在右上角展示一个小红点。设置`info`属性后,会在右上角展示相应的徽标
47
-
48
- ```html
49
- <wr-sidebar active-key="{{ activeKey }}">
50
- <wr-sidebar-item title="标签名称" dot />
51
- <wr-sidebar-item title="标签名称" info="5" />
52
- <wr-sidebar-item title="标签名称" info="99+" />
53
- </wr-sidebar>
54
- ```
55
-
56
- ## API
57
-
58
- ### Sidebar Props
59
-
60
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
61
- |-----------|-----------|-----------|-------------|-------------|
62
- | activeKey | 选中项的索引 | *string \| number* | `0` | - |
63
-
64
- ### Sidebar Event
65
-
66
- | 事件名 | 说明 | 参数 |
67
- |------|------|------|
68
- | change | 切换选项时触发 | 当前选中选项的索引 |
69
-
70
- ### Sidebar 外部样式类
71
-
72
- | 类名 | 说明 |
73
- |-----------|-----------|
74
- | custom-class | 根节点样式类 |
75
-
76
- ### SidebarItem Props
77
-
78
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
79
- |-----------|-----------|-----------|-------------|-------------|
80
- | title | 内容 | *string* | `''` | - |
81
- | disabled | 是否禁用 | | *boolean* | `false` | - |
82
- | dot | 是否显示右上角小红点 | *boolean* | `false` | - |
83
- | info | 提示消息 | *string \| number* | `''` | - |
84
-
85
- ### SidebarItem Event
86
-
87
- | 事件名 | 说明 | 参数 |
88
- |------|------|------|
89
- | click | 点击徽章时触发 | 当前徽章的索引 |
90
-
91
- ### SidebarItem 外部样式类
92
-
93
- | 类名 | 说明 |
94
- |-----------|-----------|
95
- | custom-class | 根节点样式类 |
@@ -1,73 +0,0 @@
1
- <script lang="ts">
2
- Component({
3
- relations: {
4
- '../../c-sidebar/index': {
5
- type: 'ancestor',
6
- linked(target) {
7
- this.parent = target;
8
- },
9
- },
10
- },
11
-
12
- externalClasses: ['custom-class'],
13
- properties: {
14
- title: String,
15
- disabled: Boolean,
16
- },
17
-
18
- data: {
19
- topRightRadius: false,
20
- bottomRightRadius: false,
21
- },
22
-
23
- methods: {
24
- setActive(selected) {
25
- return this.setData({ selected });
26
- },
27
- onClick() {
28
- const { parent } = this;
29
-
30
- if (!parent || this.properties.disabled) {
31
- return;
32
- }
33
-
34
- const index = parent.children.indexOf(this);
35
-
36
- parent.setActive(index).then(() => {
37
- this.triggerEvent('click', index);
38
- parent.triggerEvent('change', { index });
39
- });
40
- },
41
- setTopRightRadius(val) {
42
- return this.setData({
43
- topRightRadius: val,
44
- });
45
- },
46
- setBottomRightRadius(val) {
47
- return this.setData({
48
- bottomRightRadius: val,
49
- });
50
- },
51
- },
52
- });
53
- </script>
54
-
55
- <template>
56
- <view class="c-sidebar-item-container [background-color:white]">
57
- <view
58
- class="c-sidebar-item {{ selected ? 'active' : '' }} {{ disabled ? 'disabled' : '' }} {{topRightRadius ? 'top-right-radius' : ''}} {{bottomRightRadius ? 'bottom-right-radius' : ''}} custom-class [display:flex] [justify-content:center] [text-align:center] [background-color:#f5f5f5] [color:#222427] [padding:20rpx_0] [font-size:26rpx] [&_.active]:[position:relative] [&_.active]:[background:white] [&_.active_.c-sidebar-item__text]:[background-color:white] [&_.active_.c-sidebar-item__text]:[border-radius:36rpx] [&_.active_.c-sidebar-item__text]:[color:#fa4126] [border-top-right-radius:16rpx] [border-bottom-right-radius:16rpx]"
59
- hover-class="c-sidebar-item--hover"
60
- hover-stay-time="70"
61
- bind:tap="onClick"
62
- >
63
- <view class="c-sidebar-item__text text-overflow [width:136rpx] [height:36rpx] [padding:8rpx_0] [line-height:36rpx] [text-align:center] [font-size:28rpx] [color:#666666] [overflow:hidden] [text-overflow:ellipsis] [white-space:nowrap]"> {{ title }} </view>
64
- </view>
65
- </view>
66
- </template>
67
-
68
- <json>
69
- {
70
- "component": true,
71
- "usingComponents": {}
72
- }
73
- </json>
@@ -1,121 +0,0 @@
1
- <script lang="ts">
2
- Component({
3
- relations: {
4
- './c-sidebar-item/index': {
5
- type: 'descendant',
6
- linked(target) {
7
- this.children.push(target);
8
- this.setActive(this.properties.activeKey, true);
9
- },
10
- unlinked(target) {
11
- this.children = this.children.filter((item) => item !== target);
12
- this.setActive(this.properties.activeKey, true);
13
- },
14
- },
15
- },
16
-
17
- externalClasses: ['custom-class'],
18
-
19
- properties: {
20
- activeKey: {
21
- type: Number,
22
- value: 0,
23
- },
24
- },
25
- observers: {
26
- activeKey(newVal) {
27
- this.setActive(newVal);
28
- },
29
- },
30
-
31
- created() {
32
- this.children = [];
33
- this.currentActive = -1;
34
- this.topRightRadiusItemIndexs = [];
35
- this.bottomRightRadiusItemIndexs = [];
36
- },
37
-
38
- methods: {
39
- setActive(activeKey, isChildrenChange) {
40
- const {
41
- children,
42
- currentActive,
43
- topRightRadiusItemIndexs: preTopRightRadiusItemIndexs,
44
- bottomRightRadiusItemIndexs: preBottomRightRadiusItemIndexs,
45
- } = this;
46
-
47
- if (!children.length) {
48
- return Promise.resolve();
49
- }
50
-
51
- if (activeKey === currentActive && !isChildrenChange) {
52
- return Promise.resolve();
53
- }
54
-
55
- this.currentActive = activeKey;
56
- this.topRightRadiusItemIndexs = this.getTopRightRadiusItemIndexs(activeKey, children);
57
- this.bottomRightRadiusItemIndexs = this.getBottomRightRadiusItemIndexs(activeKey, children);
58
-
59
- const stack = []; // 任务列表,存放调用子组件的setActive后返回的一堆promise
60
- const pushChildTask = (itemIndex, method, value) => {
61
- const child = children[itemIndex];
62
- if (!child || typeof child[method] !== 'function') {
63
- return;
64
- }
65
- stack.push(child[method](value));
66
- };
67
-
68
- // 将旧的选中项改为false
69
- if (currentActive !== activeKey && children[currentActive]) {
70
- stack.push(children[currentActive].setActive(false));
71
- }
72
-
73
- // 将新的选中项改为true
74
- if (children[activeKey]) {
75
- stack.push(children[activeKey].setActive(true));
76
- }
77
-
78
- preTopRightRadiusItemIndexs.forEach((item) => {
79
- pushChildTask(item, 'setTopRightRadius', false);
80
- });
81
-
82
- preBottomRightRadiusItemIndexs.forEach((item) => {
83
- pushChildTask(item, 'setBottomRightRadius', false);
84
- });
85
-
86
- this.topRightRadiusItemIndexs.forEach((item) => {
87
- pushChildTask(item, 'setTopRightRadius', true);
88
- });
89
-
90
- this.bottomRightRadiusItemIndexs.forEach((item) => {
91
- pushChildTask(item, 'setBottomRightRadius', true);
92
- });
93
-
94
- return Promise.all(stack);
95
- },
96
- getTopRightRadiusItemIndexs(activeKey, children) {
97
- const { length } = children;
98
- if (activeKey !== 0 && activeKey < length - 1) return [0, activeKey + 1];
99
- if (activeKey !== 0) return [0];
100
- if (activeKey < length - 1) return [activeKey + 1];
101
- return [];
102
- },
103
- getBottomRightRadiusItemIndexs(activeKey) {
104
- if (activeKey !== 0) return [activeKey - 1];
105
- return [];
106
- },
107
- },
108
- });
109
- </script>
110
-
111
- <template>
112
- <scroll-view class="c-sidebar custom-class [width:176rpx] [height:100vh]" scroll-y>
113
- <slot />
114
- </scroll-view>
115
- </template>
116
-
117
- <json>
118
- {
119
- "component": true
120
- }
121
- </json>
@@ -1,74 +0,0 @@
1
- <script lang="ts">
2
- Component({
3
- externalClasses: ['custom-class'],
4
-
5
- properties: {
6
- tabList: Array,
7
- },
8
-
9
- data: {
10
- unfolded: false,
11
- boardMaxHeight: null,
12
- },
13
- attached() {
14
- wx.createSelectorQuery()
15
- .in(this)
16
- .select('.c-tabbar-more')
17
- .boundingClientRect((rect) => {
18
- this.setData({ boardMaxHeight: rect.height });
19
- })
20
- .exec();
21
- },
22
-
23
- methods: {
24
- changeFold() {
25
- this.setData({
26
- unfolded: !this.data.unfolded,
27
- });
28
- const { unfolded } = this.data;
29
- this.triggerEvent('change', { unfolded });
30
- },
31
-
32
- onSelect(event) {
33
- const activeKey = event.currentTarget.dataset.index;
34
- this.triggerEvent('select', activeKey);
35
- this.changeFold();
36
- },
37
- },
38
- });
39
- </script>
40
-
41
- <template>
42
- <view class="c-tabbar-more [width:100%] [height:calc(100%_-_var(--tabbar-height,_100rpx))] [position:absolute] [top:var(--tabbar-height,_100rpx)]">
43
- <view class="c-tabbar-more__btn [position:absolute] [top:calc(0rpx_-_var(--tabbar-height,_100rpx))] [right:0] [width:80rpx] [height:var(--tabbar-height,_100rpx)] [line-height:var(--tabbar-height,_100rpx)] [background-color:var(--tabbar-background-color,_white)] [box-shadow:-20rpx_0_20rpx_-10rpx_var(--tabbar-background-color,_white)] [text-align:center] [&_.market]:[font-size:20rpx]" bind:tap="changeFold">
44
- <view class="wr {{unfolded ? 'wr-arrow-up':'wr-arrow-down'}}"></view>
45
- </view>
46
- <view class="t-tabbar-more__boardwrapper [position:absolute] [top:0] [left:0] [width:100%] [height:100%]" wx:if="{{ unfolded }}">
47
- <view class="t-tabbar-more__mask [width:100%] [height:100%] [background-color:rgba(0,_0,_0,_0.5)]"></view>
48
- <scroll-view
49
- class="c-tabbar-more__board [position:absolute] [top:0] [left:0] [width:100%] [max-height:100%]"
50
- style="{{ boardMaxHeight ? 'height:' + boardMaxHeight + 'px;' : '' }}"
51
- scroll-y
52
- >
53
- <view class="c-tabbar-more__boardinner [padding:20rpx_0_20rpx_20rpx] [background-color:var(--tabbar-background-color,_white)] [display:flex] [flex-flow:row_wrap]">
54
- <view
55
- class="c-tabbar-more__item text-overflow [margin:0_20rpx_20rpx_0] [flex:0_0_calc((100%_-_60rpx)_/_3)] [box-sizing:border-box] [padding:0_10rpx] [border-radius:30rpx] [height:60rpx] [line-height:60rpx] [text-align:center] [font-size:22rpx] [color:#5d5d5d] [background-color:#eee] [overflow:hidden] [text-overflow:ellipsis] [white-space:nowrap]"
56
- wx:for="{{ tabList }}"
57
- wx:key="index"
58
- data-index="{{ index }}"
59
- bind:tap="onSelect"
60
- >
61
- {{ item.name }}
62
- </view>
63
- </view>
64
- </scroll-view>
65
- </view>
66
- </view>
67
- </template>
68
-
69
- <json>
70
- {
71
- "component": true,
72
- "usingComponents": {}
73
- }
74
- </json>