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.
Files changed (177) hide show
  1. package/README.md +0 -1
  2. package/dist/{chunk-IT75MAH3.js → chunk-MXKCD6NA.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/wevu/package.json +1 -1
  8. package/templates/wevu-tdesign/package.json +1 -1
  9. package/templates/wevu-retail/.editorconfig +0 -9
  10. package/templates/wevu-retail/.vscode/settings.json +0 -10
  11. package/templates/wevu-retail/AGENTS.md +0 -35
  12. package/templates/wevu-retail/README.md +0 -26
  13. package/templates/wevu-retail/auto-import-components.json +0 -1
  14. package/templates/wevu-retail/gitignore +0 -35
  15. package/templates/wevu-retail/package.json +0 -42
  16. package/templates/wevu-retail/postcss.config.js +0 -6
  17. package/templates/wevu-retail/project.config.json +0 -44
  18. package/templates/wevu-retail/project.private.config.json +0 -8
  19. package/templates/wevu-retail/src/app.vue +0 -104
  20. package/templates/wevu-retail/src/common/updateManager.ts +0 -29
  21. package/templates/wevu-retail/src/components/filter/index.vue +0 -134
  22. package/templates/wevu-retail/src/components/filter-popup/index.vue +0 -67
  23. package/templates/wevu-retail/src/components/goods-card/index.vue +0 -219
  24. package/templates/wevu-retail/src/components/goods-list/index.vue +0 -91
  25. package/templates/wevu-retail/src/components/load-more/index.vue +0 -99
  26. package/templates/wevu-retail/src/components/loading-content/index.vue +0 -48
  27. package/templates/wevu-retail/src/components/price/index.vue +0 -104
  28. package/templates/wevu-retail/src/components/promotion/ui-coupon-card/index.vue +0 -143
  29. package/templates/wevu-retail/src/components/promotion/ui-coupon-card/tools.wxs +0 -18
  30. package/templates/wevu-retail/src/components/swipeout/index.vue +0 -118
  31. package/templates/wevu-retail/src/components/swipeout/swipe.wxs +0 -151
  32. package/templates/wevu-retail/src/components/webp-image/index.vue +0 -105
  33. package/templates/wevu-retail/src/components/webp-image/utils.wxs +0 -140
  34. package/templates/wevu-retail/src/config/index.ts +0 -20437
  35. package/templates/wevu-retail/src/custom-tab-bar/data.ts +0 -22
  36. package/templates/wevu-retail/src/custom-tab-bar/index.vue +0 -62
  37. package/templates/wevu-retail/src/model/activities.ts +0 -7
  38. package/templates/wevu-retail/src/model/activity.ts +0 -18
  39. package/templates/wevu-retail/src/model/address.ts +0 -31
  40. package/templates/wevu-retail/src/model/cart.ts +0 -306
  41. package/templates/wevu-retail/src/model/category.ts +0 -175
  42. package/templates/wevu-retail/src/model/comments/queryDetail.ts +0 -50
  43. package/templates/wevu-retail/src/model/comments.ts +0 -298
  44. package/templates/wevu-retail/src/model/coupon.ts +0 -39
  45. package/templates/wevu-retail/src/model/detailsComments.ts +0 -30
  46. package/templates/wevu-retail/src/model/good.ts +0 -1904
  47. package/templates/wevu-retail/src/model/goods.ts +0 -7
  48. package/templates/wevu-retail/src/model/order/applyService.ts +0 -329
  49. package/templates/wevu-retail/src/model/order/orderConfirm.ts +0 -147
  50. package/templates/wevu-retail/src/model/order/orderDetail.ts +0 -1191
  51. package/templates/wevu-retail/src/model/order/orderList.ts +0 -1033
  52. package/templates/wevu-retail/src/model/promotion.ts +0 -20
  53. package/templates/wevu-retail/src/model/search.ts +0 -60
  54. package/templates/wevu-retail/src/model/submitComment.ts +0 -58
  55. package/templates/wevu-retail/src/model/swiper.ts +0 -39
  56. package/templates/wevu-retail/src/model/usercenter.ts +0 -52
  57. package/templates/wevu-retail/src/pages/cart/components/cart-bar/index.vue +0 -104
  58. package/templates/wevu-retail/src/pages/cart/components/cart-empty/index.vue +0 -41
  59. package/templates/wevu-retail/src/pages/cart/components/cart-group/index.vue +0 -333
  60. package/templates/wevu-retail/src/pages/cart/components/cart-group/index.wxs +0 -5
  61. package/templates/wevu-retail/src/pages/cart/components/cart-group/utils.wxs +0 -20
  62. package/templates/wevu-retail/src/pages/cart/components/goods-card/index.vue +0 -334
  63. package/templates/wevu-retail/src/pages/cart/components/specs-popup/index.vue +0 -100
  64. package/templates/wevu-retail/src/pages/cart/index.vue +0 -342
  65. package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/README.md +0 -95
  66. package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/c-sidebar-item/index.vue +0 -73
  67. package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/index.vue +0 -121
  68. package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-tabbar/c-tabbar-more/index.vue +0 -74
  69. package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-tabbar/index.vue +0 -102
  70. package/templates/wevu-retail/src/pages/category/components/goods-category/index.vue +0 -137
  71. package/templates/wevu-retail/src/pages/category/index.vue +0 -50
  72. package/templates/wevu-retail/src/pages/coupon/components/coupon-card/index.vue +0 -95
  73. package/templates/wevu-retail/src/pages/coupon/components/floating-button/index.vue +0 -44
  74. package/templates/wevu-retail/src/pages/coupon/coupon-activity-goods/index.vue +0 -135
  75. package/templates/wevu-retail/src/pages/coupon/coupon-detail/index.vue +0 -94
  76. package/templates/wevu-retail/src/pages/coupon/coupon-list/index.vue +0 -136
  77. package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/images-videos/assets/play.png +0 -0
  78. package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/images-videos/index.vue +0 -65
  79. package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/my-video/index.vue +0 -92
  80. package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/index.vue +0 -93
  81. package/templates/wevu-retail/src/pages/goods/comments/create/index.vue +0 -196
  82. package/templates/wevu-retail/src/pages/goods/comments/index.vue +0 -293
  83. package/templates/wevu-retail/src/pages/goods/details/components/buy-bar/index.vue +0 -117
  84. package/templates/wevu-retail/src/pages/goods/details/components/goods-specs-popup/index.vue +0 -440
  85. package/templates/wevu-retail/src/pages/goods/details/components/promotion-popup/index.vue +0 -83
  86. package/templates/wevu-retail/src/pages/goods/details/index.vue +0 -598
  87. package/templates/wevu-retail/src/pages/goods/list/index.vue +0 -299
  88. package/templates/wevu-retail/src/pages/goods/result/index.vue +0 -350
  89. package/templates/wevu-retail/src/pages/goods/search/index.vue +0 -196
  90. package/templates/wevu-retail/src/pages/home/home.vue +0 -215
  91. package/templates/wevu-retail/src/pages/home/readme +0 -8
  92. package/templates/wevu-retail/src/pages/order/after-service-detail/api.ts +0 -34
  93. package/templates/wevu-retail/src/pages/order/after-service-detail/index.vue +0 -430
  94. package/templates/wevu-retail/src/pages/order/after-service-list/api.ts +0 -1262
  95. package/templates/wevu-retail/src/pages/order/after-service-list/index.vue +0 -299
  96. package/templates/wevu-retail/src/pages/order/apply-service/index.vue +0 -665
  97. package/templates/wevu-retail/src/pages/order/components/after-service-button-bar/index.vue +0 -142
  98. package/templates/wevu-retail/src/pages/order/components/customer-service/index.vue +0 -75
  99. package/templates/wevu-retail/src/pages/order/components/goods-card/index.vue +0 -356
  100. package/templates/wevu-retail/src/pages/order/components/noGoods/noGood.wxs +0 -17
  101. package/templates/wevu-retail/src/pages/order/components/noGoods/noGoods.vue +0 -125
  102. package/templates/wevu-retail/src/pages/order/components/order-button-bar/index.vue +0 -262
  103. package/templates/wevu-retail/src/pages/order/components/order-card/index.vue +0 -126
  104. package/templates/wevu-retail/src/pages/order/components/order-goods-card/index.vue +0 -86
  105. package/templates/wevu-retail/src/pages/order/components/reason-sheet/index.vue +0 -161
  106. package/templates/wevu-retail/src/pages/order/components/reason-sheet/reasonSheet.ts +0 -25
  107. package/templates/wevu-retail/src/pages/order/components/selectCoupons/mock.ts +0 -22
  108. package/templates/wevu-retail/src/pages/order/components/selectCoupons/selectCoupon.wxs +0 -16
  109. package/templates/wevu-retail/src/pages/order/components/selectCoupons/selectCoupons.vue +0 -207
  110. package/templates/wevu-retail/src/pages/order/components/specs-goods-card/index.vue +0 -185
  111. package/templates/wevu-retail/src/pages/order/config.ts +0 -94
  112. package/templates/wevu-retail/src/pages/order/delivery-detail/index.vue +0 -145
  113. package/templates/wevu-retail/src/pages/order/delivery-detail/isUrl.wxs +0 -7
  114. package/templates/wevu-retail/src/pages/order/fill-tracking-no/api.ts +0 -71
  115. package/templates/wevu-retail/src/pages/order/fill-tracking-no/index.vue +0 -267
  116. package/templates/wevu-retail/src/pages/order/invoice/index.vue +0 -94
  117. package/templates/wevu-retail/src/pages/order/order-confirm/components/address-card/index.vue +0 -78
  118. package/templates/wevu-retail/src/pages/order/order-confirm/getNotes.wxs +0 -11
  119. package/templates/wevu-retail/src/pages/order/order-confirm/handleInvoice.wxs +0 -11
  120. package/templates/wevu-retail/src/pages/order/order-confirm/index.vue +0 -707
  121. package/templates/wevu-retail/src/pages/order/order-confirm/order.wxs +0 -8
  122. package/templates/wevu-retail/src/pages/order/order-confirm/pay.ts +0 -115
  123. package/templates/wevu-retail/src/pages/order/order-detail/index.vue +0 -456
  124. package/templates/wevu-retail/src/pages/order/order-list/index.vue +0 -288
  125. package/templates/wevu-retail/src/pages/order/pay-result/index.vue +0 -77
  126. package/templates/wevu-retail/src/pages/order/receipt/index.vue +0 -336
  127. package/templates/wevu-retail/src/pages/promotion/promotion-detail/index.vue +0 -145
  128. package/templates/wevu-retail/src/pages/user/address/edit/index.vue +0 -514
  129. package/templates/wevu-retail/src/pages/user/address/list/index.vue +0 -249
  130. package/templates/wevu-retail/src/pages/user/components/t-location/index.vue +0 -156
  131. package/templates/wevu-retail/src/pages/user/components/ui-address-item/index.vue +0 -92
  132. package/templates/wevu-retail/src/pages/user/name-edit/index.vue +0 -49
  133. package/templates/wevu-retail/src/pages/user/person-info/index.vue +0 -198
  134. package/templates/wevu-retail/src/pages/usercenter/address/edit/util.ts +0 -33
  135. package/templates/wevu-retail/src/pages/usercenter/components/order-group/index.vue +0 -90
  136. package/templates/wevu-retail/src/pages/usercenter/components/ui-select-picker/index.vue +0 -108
  137. package/templates/wevu-retail/src/pages/usercenter/components/user-center-card/index.vue +0 -82
  138. package/templates/wevu-retail/src/pages/usercenter/index.vue +0 -301
  139. package/templates/wevu-retail/src/services/_utils/delay.ts +0 -3
  140. package/templates/wevu-retail/src/services/_utils/timeout.ts +0 -3
  141. package/templates/wevu-retail/src/services/activity/fetchActivity.ts +0 -20
  142. package/templates/wevu-retail/src/services/activity/fetchActivityList.ts +0 -20
  143. package/templates/wevu-retail/src/services/address/edit.ts +0 -33
  144. package/templates/wevu-retail/src/services/address/fetchAddress.ts +0 -48
  145. package/templates/wevu-retail/src/services/address/list.ts +0 -31
  146. package/templates/wevu-retail/src/services/cart/cart.ts +0 -20
  147. package/templates/wevu-retail/src/services/comments/fetchComments.ts +0 -18
  148. package/templates/wevu-retail/src/services/comments/fetchCommentsCount.ts +0 -18
  149. package/templates/wevu-retail/src/services/coupon/index.ts +0 -65
  150. package/templates/wevu-retail/src/services/good/comments/fetchCommentDetail.ts +0 -20
  151. package/templates/wevu-retail/src/services/good/fetchCategoryList.ts +0 -18
  152. package/templates/wevu-retail/src/services/good/fetchGood.ts +0 -18
  153. package/templates/wevu-retail/src/services/good/fetchGoods.ts +0 -29
  154. package/templates/wevu-retail/src/services/good/fetchGoodsDetailsComments.ts +0 -37
  155. package/templates/wevu-retail/src/services/good/fetchGoodsList.ts +0 -39
  156. package/templates/wevu-retail/src/services/good/fetchSearchHistory.ts +0 -35
  157. package/templates/wevu-retail/src/services/good/fetchSearchResult.ts +0 -38
  158. package/templates/wevu-retail/src/services/home/home.ts +0 -53
  159. package/templates/wevu-retail/src/services/order/applyService.ts +0 -70
  160. package/templates/wevu-retail/src/services/order/orderConfirm.ts +0 -69
  161. package/templates/wevu-retail/src/services/order/orderDetail.ts +0 -39
  162. package/templates/wevu-retail/src/services/order/orderList.ts +0 -39
  163. package/templates/wevu-retail/src/services/order/orderSubmitComment.ts +0 -22
  164. package/templates/wevu-retail/src/services/promotion/detail.ts +0 -18
  165. package/templates/wevu-retail/src/services/usercenter/fetchPerson.ts +0 -28
  166. package/templates/wevu-retail/src/services/usercenter/fetchUsercenter.ts +0 -18
  167. package/templates/wevu-retail/src/sitemap.json +0 -7
  168. package/templates/wevu-retail/src/utils/addressParse.ts +0 -25
  169. package/templates/wevu-retail/src/utils/getPermission.ts +0 -45
  170. package/templates/wevu-retail/src/utils/mock.ts +0 -51
  171. package/templates/wevu-retail/src/utils/util.ts +0 -134
  172. package/templates/wevu-retail/src/vite-env.d.ts +0 -1
  173. package/templates/wevu-retail/tailwind.config.ts +0 -15
  174. package/templates/wevu-retail/tsconfig.app.json +0 -58
  175. package/templates/wevu-retail/tsconfig.json +0 -11
  176. package/templates/wevu-retail/tsconfig.node.json +0 -33
  177. package/templates/wevu-retail/vite.config.ts +0 -14
@@ -1,161 +0,0 @@
1
- <script lang="ts">
2
- Component({
3
- options: {
4
- addGlobalClass: true,
5
- },
6
- properties: {
7
- show: Boolean,
8
- title: String,
9
- options: {
10
- type: Object,
11
- observer() {
12
- this.init();
13
- },
14
- },
15
- multiple: {
16
- type: Boolean,
17
- observer() {
18
- this.init();
19
- },
20
- },
21
- showConfirmButton: Boolean,
22
- showCloseButton: Boolean,
23
- confirmButtonText: {
24
- type: String,
25
- value: '确定',
26
- },
27
- cancelButtonText: {
28
- type: String,
29
- value: '取消',
30
- },
31
- emptyTip: {
32
- type: String,
33
- value: '请选择',
34
- },
35
- },
36
-
37
- data: {
38
- _options: [],
39
- checkedIndexes: [],
40
- },
41
-
42
- methods: {
43
- attached() {
44
- this.toast = this.selectComponent('#t-toast');
45
- },
46
-
47
- init() {
48
- const checkedIndexes = [];
49
- const _options = this.properties.options.map((opt, i) => {
50
- const checked = !!opt.checked;
51
- if (checked) {
52
- if (this.properties.multiple) checkedIndexes[0] = i;
53
- else checkedIndexes.push(i);
54
- }
55
- return {
56
- title: opt.title,
57
- checked,
58
- };
59
- });
60
- this.setData({ checkedIndexes, _options });
61
- },
62
-
63
- onOptionTap(e) {
64
- const { index } = e.currentTarget.dataset;
65
- const { checkedIndexes } = this.data;
66
- let data = {};
67
- if (this.properties.multiple) {
68
- if (checkedIndexes.includes(index)) {
69
- checkedIndexes.splice(index, 1);
70
- data = { checkedIndexes, [`_options[${index}].checked`]: false };
71
- } else {
72
- checkedIndexes.push(index);
73
- data = { checkedIndexes, [`_options[${index}].checked`]: true };
74
- }
75
- } else {
76
- if (checkedIndexes[0] === index) {
77
- // 单选不可取消选择
78
- return;
79
- }
80
- data = {
81
- [`_options[${index}].checked`]: true,
82
- checkedIndexes: [index],
83
- };
84
- if (checkedIndexes[0] !== undefined) {
85
- data[`_options[${checkedIndexes[0]}].checked`] = false;
86
- }
87
- }
88
- this.setData(data);
89
- this.triggerEvent('select', { index });
90
- this._onOptionTap && this._onOptionTap(index);
91
- if (!this.properties.showConfirmButton && !this.properties.multiple) {
92
- // 没有确认按钮且是单选的情况下,选择选项则自动确定
93
- this._onConfirm && this._onConfirm([index]);
94
- this.setData({ show: false });
95
- }
96
- },
97
-
98
- onCancel() {
99
- this.triggerEvent('cancel');
100
- this._onCancel && this._onCancel();
101
- this.setData({ show: false });
102
- },
103
-
104
- onConfirm() {
105
- if (this.data.checkedIndexes.length === 0) {
106
- this.toast.show({
107
- icon: '',
108
- text: this.properties.emptyTip,
109
- });
110
- return;
111
- }
112
- const indexed = this.data.checkedIndexes;
113
- this.triggerEvent('confirm', { indexed });
114
- this._onConfirm && this._onConfirm(indexed);
115
- this.setData({ show: false });
116
- },
117
- },
118
- });
119
- </script>
120
-
121
- <template>
122
- <t-popup visible="{{show}}" placement="bottom" bind:visible-change="onCancel" close-btn="{{showCloseButton}}">
123
- <view class="popup-content [background-color:white] [color:#222427] [border-radius:20rpx_20rpx_0_0] [overflow:hidden] [&_.header]:[height:100rpx] [&_.header]:[line-height:100rpx] [&_.header]:[text-align:center] [&_.header]:[vertical-align:middle] [&_.header]:[font-size:32rpx] [&_.header]:[font-weight:bold] [&_.header]:[position:relative] [&_.options]:[max-height:60vh] [&_.options]:[overflow-y:scroll] [&_.options]:[-webkit-overflow-scrolling:touch] [&_.options_.cell]:[height:100rpx] [&_.options_.cell]:[align-items:center] [&_.options_.cell]:[font-size:30rpx] [&_.options_.cell]:[color:#333333] [&_.button-bar]:[width:100%] [&_.button-bar]:[padding:20rpx_30rpx] [&_.button-bar]:[display:flex] [&_.button-bar]:[flex-wrap:nowrap] [&_.button-bar]:[align-items:center] [&_.button-bar]:[justify-content:space-between] [&_.button-bar_.btn]:[width:100%] [&_.button-bar_.btn]:[background:#fa4126] [&_.button-bar_.btn]:[color:#fff] [&_.button-bar_.btn]:[border-radius:48rpx]">
124
- <view class="header"> {{title}} </view>
125
- <view class="options cell--noborder">
126
- <t-cell
127
- wx:for="{{_options}}"
128
- wx:key="title"
129
- t-class="cell"
130
- title="{{item.title}}"
131
- bindclick="onOptionTap"
132
- data-index="{{index}}"
133
- border="{{false}}"
134
- >
135
- <view slot="right-icon">
136
- <t-icon name="check-circle-filled" size="36rpx" color="#fa4126" wx:if="{{item.checked}}" />
137
- <t-icon name="circle" size="36rpx" color="#C7C7C7" wx:else />
138
- </view>
139
- </t-cell>
140
- </view>
141
- <view class="button-bar [&_.btnWrapper]:[width:100%]" wx:if="{{showConfirmButton}}">
142
- <t-button class="btnWrapper" wx:if="{{showConfirmButton}}" t-class="btn" bindtap="onConfirm">
143
- {{confirmButtonText}}
144
- </t-button>
145
- </view>
146
- </view>
147
- </t-popup>
148
- <t-toast id="t-toast" />
149
- </template>
150
-
151
- <json>
152
- {
153
- "component": true,
154
- "usingComponents": {
155
- "t-icon": "tdesign-miniprogram/icon/icon",
156
- "t-popup": "tdesign-miniprogram/popup/popup",
157
- "t-cell": "tdesign-miniprogram/cell/cell",
158
- "t-toast": "tdesign-miniprogram/toast/toast",
159
- "t-button": "tdesign-miniprogram/button/button"
160
- }
161
- }</json>
@@ -1,25 +0,0 @@
1
- function getInstance(context, selector = '#wr-reason-sheet') {
2
- if (!context) {
3
- const pages = getCurrentPages();
4
- const page = pages[pages.length - 1];
5
- context = page;
6
- }
7
- const instance = context && context.selectComponent(selector);
8
- if (!instance) {
9
- console.warn(`未找到reason-sheet组件,请检查selector是否正确`);
10
- return null;
11
- }
12
- return instance;
13
- }
14
-
15
- export default function (options) {
16
- const { context, selector, ..._options } = options;
17
- return new Promise((resolve, reject) => {
18
- const instance = getInstance(context, selector);
19
- if (instance) {
20
- instance.setData(Object.assign({}, _options));
21
- instance._onCancel = () => reject();
22
- instance._onConfirm = (indexes) => resolve(indexes);
23
- }
24
- });
25
- }
@@ -1,22 +0,0 @@
1
- export const couponsData = {
2
- couponResultList: [
3
- {
4
- couponVO: {
5
- condition: '满200元可用',
6
- couponId: 11,
7
- endTime: 1584530282686,
8
- name: '折扣券',
9
- profit: '5.5折',
10
- promotionCode: 90,
11
- promotionSubCode: 1,
12
- scopeText: '部分商品可用',
13
- startTime: 1584530282686,
14
- storeId: 90,
15
- value: 550,
16
- type: 2,
17
- },
18
- status: 0, // 0:未勾选。1:勾选。-1:置灰
19
- },
20
- ],
21
- reduce: 1000,
22
- };
@@ -1,16 +0,0 @@
1
- function formatDays(value) {
2
- if (value < 10) {
3
- return '0' + value;
4
- }
5
- return value;
6
- }
7
- var dateFormat = function (d) {
8
- var date = getDate(+d);
9
- return (
10
- date.getFullYear() +
11
- '-' +
12
- formatDays(date.getMonth() + 1) +
13
- formatDays(date.getDate())
14
- );
15
- };
16
- module.exports.dateFormat = dateFormat;
@@ -1,207 +0,0 @@
1
- <script lang="ts">
2
- import dayjs from 'dayjs';
3
- import { couponsData } from './mock';
4
-
5
- const emptyCouponImg = `https://tdesign.gtimg.com/miniprogram/template/retail/coupon/ordersure-coupon-newempty.png`;
6
-
7
- Component({
8
- properties: {
9
- storeId: String,
10
- promotionGoodsList: {
11
- type: Array,
12
- value: [],
13
- },
14
- orderSureCouponList: {
15
- type: Array,
16
- value: [],
17
- },
18
- couponsShow: {
19
- type: Boolean,
20
- value: false,
21
- observer(couponsShow) {
22
- if (couponsShow) {
23
- const { promotionGoodsList, orderSureCouponList, storeId } = this.data;
24
- const products =
25
- promotionGoodsList &&
26
- promotionGoodsList.map((goods) => {
27
- this.storeId = goods.storeId;
28
- return {
29
- skuId: goods.skuId,
30
- spuId: goods.spuId,
31
- storeId: goods.storeId,
32
- selected: true,
33
- quantity: goods.num,
34
- prices: {
35
- sale: goods.settlePrice,
36
- },
37
- };
38
- });
39
- const selectedCoupons =
40
- orderSureCouponList &&
41
- orderSureCouponList.map((ele) => {
42
- return {
43
- promotionId: ele.promotionId,
44
- storeId: ele.storeId,
45
- couponId: ele.couponId,
46
- };
47
- });
48
- this.setData({
49
- products,
50
- });
51
- this.coupons({
52
- products,
53
- selectedCoupons,
54
- storeId,
55
- }).then((res) => {
56
- this.initData(res);
57
- });
58
- }
59
- },
60
- },
61
- },
62
- data: {
63
- emptyCouponImg,
64
- goodsList: [],
65
- selectedList: [],
66
- couponsList: [],
67
- orderSureCouponList: [],
68
- promotionGoodsList: [],
69
- },
70
- methods: {
71
- initData(data = {}) {
72
- const { couponResultList = [], reduce = 0 } = data;
73
- const selectedList = [];
74
- let selectedNum = 0;
75
- const couponsList =
76
- couponResultList &&
77
- couponResultList.map((coupon) => {
78
- const { status, couponVO } = coupon;
79
- const { couponId, condition = '', endTime = 0, name = '', startTime = 0, value, type } = couponVO;
80
- if (status === 1) {
81
- selectedNum++;
82
- selectedList.push({
83
- couponId,
84
- promotionId: ruleId,
85
- storeId: this.storeId,
86
- });
87
- }
88
- const val = type === 2 ? value / 100 : value / 10;
89
- return {
90
- key: couponId,
91
- title: name,
92
- isSelected: false,
93
- timeLimit: `${dayjs(+startTime).format('YYYY-MM-DD')}-${dayjs(+endTime).format('YYYY-MM-DD')}`,
94
- value: val,
95
- status: status === -1 ? 'useless' : 'default',
96
- desc: condition,
97
- type,
98
- tag: '',
99
- };
100
- });
101
- this.setData({
102
- selectedList,
103
- couponsList,
104
- reduce,
105
- selectedNum,
106
- });
107
- },
108
- selectCoupon(e) {
109
- const { key } = e.currentTarget.dataset;
110
- const { couponsList, selectedList } = this.data;
111
- couponsList.forEach((coupon) => {
112
- if (coupon.key === key) {
113
- coupon.isSelected = !coupon.isSelected;
114
- }
115
- });
116
-
117
- const couponSelected = couponsList.filter((coupon) => coupon.isSelected === true);
118
-
119
- this.setData({
120
- selectedList: [...selectedList, ...couponSelected],
121
- couponsList: [...couponsList],
122
- });
123
-
124
- this.triggerEvent('sure', {
125
- selectedList: [...selectedList, ...couponSelected],
126
- });
127
- },
128
- hide() {
129
- this.setData({
130
- couponsShow: false,
131
- });
132
- },
133
- coupons(coupon = {}) {
134
- return new Promise((resolve, reject) => {
135
- if (coupon?.selectedCoupons) {
136
- resolve({
137
- couponResultList: couponsData.couponResultList,
138
- reduce: couponsData.reduce,
139
- });
140
- }
141
- return reject({
142
- couponResultList: [],
143
- reduce: undefined,
144
- });
145
- });
146
- },
147
- },
148
- });
149
- </script>
150
-
151
- <template>
152
- <wxs src="./selectCoupon.wxs" module="m1" />
153
-
154
- <t-popup visible="{{couponsShow}}" placement="bottom" bind:visible-change="hide">
155
- <view class="select-coupons [background:#fff] [width:100%] [position:relative] [border-radius:20rpx_20rpx_0_0] [padding-top:28rpx] [padding-bottom:env(safe-area-inset-bottom)] [&_.title]:[width:100%] [&_.title]:[text-align:center] [&_.title]:[font-size:32rpx] [&_.title]:[color:#333] [&_.title]:[font-weight:600] [&_.title]:[line-height:44rpx] [&_.info]:[width:100%] [&_.info]:[height:34rpx] [&_.info]:[font-size:24rpx] [&_.info]:[color:#999] [&_.info]:[line-height:34rpx] [&_.info]:[margin:20rpx_0] [&_.info]:[padding:0_20rpx] [&_.info_.price]:[color:#fa4126] [&_.coupons-list]:[max-height:500rpx] [&_.coupons-list_.coupons-wrap]:[padding:0rpx_20rpx] [&_.coupons-list_.disable]:[font-size:24rpx] [&_.coupons-list_.disable]:[color:#ff2525] [&_.coupons-list_.disable]:[padding-top:20rpx] [&_.coupons-list_.slot-radio]:[position:absolute] [&_.coupons-list_.slot-radio]:[right:22rpx] [&_.coupons-list_.slot-radio]:[top:50%] [&_.coupons-list_.slot-radio]:[transform:translateY(-50%)] [&_.coupons-list_.slot-radio]:[display:inline-block] [&_.coupons-list_.slot-radio_.wr-check-filled]:[font-size:36rpx] [&_.coupons-list_.slot-radio_.check]:[width:36rpx] [&_.coupons-list_.slot-radio_.text-primary]:[color:#fa4126] [&_.coupons-list_.slot-radio_.wr-check]:[font-size:36rpx] [&_.coupons-list_.slot-radio_.wr-uncheck]:[font-size:36rpx] [&_.coupons-list_.slot-radio_.wr-uncheck]:[color:#999] [&_.couponp-empty-wrap]:[padding:40rpx] [&_.couponp-empty-wrap_.couponp-empty-img]:[display:block] [&_.couponp-empty-wrap_.couponp-empty-img]:[width:240rpx] [&_.couponp-empty-wrap_.couponp-empty-img]:[height:240rpx] [&_.couponp-empty-wrap_.couponp-empty-img]:[margin:0_auto] [&_.couponp-empty-wrap_.couponp-empty-title]:[font-size:28rpx] [&_.couponp-empty-wrap_.couponp-empty-title]:[color:#999] [&_.couponp-empty-wrap_.couponp-empty-title]:[text-align:center] [&_.couponp-empty-wrap_.couponp-empty-title]:[line-height:40rpx] [&_.couponp-empty-wrap_.couponp-empty-title]:[margin-top:40rpx] [&_.coupons-cover]:[height:112rpx] [&_.coupons-cover]:[width:100%] [&_.coupons-cover]:[box-sizing:border-box] [&_.coupons-cover]:[margin-top:30rpx] [&_.coupons-cover]:[padding:12rpx_32rpx] [&_.coupons-cover]:[display:flex] [&_.coupons-cover]:[justify-content:space-between] [&_.coupons-cover]:[align-items:center] [&_.coupons-cover_.btn]:[width:332rpx] [&_.coupons-cover_.btn]:[height:88rpx] [&_.coupons-cover_.btn]:[text-align:center] [&_.coupons-cover_.btn]:[line-height:88rpx] [&_.coupons-cover_.btn]:[font-size:32rpx] [&_.coupons-cover_.btn]:[border-radius:44rpx] [&_.coupons-cover_.btn]:[box-sizing:border-box] [&_.coupons-cover_.btn]:[border:2rpx_solid_#dddddd] [&_.coupons-cover_.btn]:[color:#333333] [&_.coupons-cover_.red]:[border-color:#fa4126] [&_.coupons-cover_.red]:[background-color:#fa4126] [&_.coupons-cover_.red]:[color:#ffffff]">
156
- <view class="title">选择优惠券</view>
157
- <block wx:if="{{couponsList && couponsList.length > 0}}">
158
- <view class="info">
159
- <block wx:if="{{!selectedNum}}">你有{{couponsList.length}}张可用优惠券</block>
160
- <block wx:else>
161
- 已选中{{selectedNum}}张推荐优惠券, 共抵扣
162
- <wr-price fill="{{false}}" price="{{reduce || 0}}" />
163
- </block>
164
- </view>
165
- <scroll-view class="coupons-list" scroll-y="true">
166
- <view class="coupons-wrap">
167
- <block wx:for="{{couponsList}}" wx:key="index" wx:for-item="coupon">
168
- <coupon-card
169
- title="{{coupon.title}}"
170
- type="{{coupon.type}}"
171
- status="{{coupon.status}}"
172
- desc="{{coupon.desc}}"
173
- value="{{coupon.value}}"
174
- tag="{{coupon.tag}}"
175
- timeLimit="{{coupon.timeLimit}}"
176
- >
177
- <view class="slot-radio" slot="operator">
178
- <t-icon bindtap="selectCoupon" data-key="{{coupon.key}}" name="{{coupon.isSelected ? 'check-circle-filled' : 'circle'}}" color="#fa4126" size="40rpx"/>
179
- </view>
180
- </coupon-card>
181
- <view class="disable" wx:if="{{coupon.status == 'useless'}}">此优惠券不能和已勾选的优惠券叠加使用</view>
182
- </block>
183
- </view>
184
- </scroll-view>
185
- </block>
186
- <view wx:else class="couponp-empty-wrap">
187
- <t-image t-class="couponp-empty-img" src="{{emptyCouponImg}}" />
188
- <view class="couponp-empty-title">暂无优惠券</view>
189
- </view>
190
- <view class="coupons-cover" />
191
- </view>
192
- </t-popup>
193
-
194
- </template>
195
-
196
- <json>
197
- {
198
- "component": true,
199
- "usingComponents": {
200
- "t-popup": "tdesign-miniprogram/popup/popup",
201
- "t-icon": "tdesign-miniprogram/icon/icon",
202
- "t-image": "/components/webp-image/index",
203
- "wr-price": "/components/price/index",
204
- "coupon-card": "/components/promotion/ui-coupon-card/index"
205
- }
206
- }
207
- </json>
@@ -1,185 +0,0 @@
1
- <script lang="ts">
2
- Component({
3
- options: {
4
- addGlobalClass: true,
5
- multipleSlots: true, // 在组件定义时的选项中启用多slot支持
6
- },
7
-
8
- externalClasses: [
9
- 'title-class',
10
- 'desc-class',
11
- 'num-class',
12
- 'thumb-class',
13
- 'specs-class',
14
- 'price-class',
15
- 'origin-price-class',
16
- 'price-prefix-class',
17
- ],
18
-
19
- relations: {
20
- '../order-card/index': {
21
- type: 'ancestor',
22
- linked(target) {
23
- this.parent = target;
24
- },
25
- },
26
- },
27
-
28
- properties: {
29
- id: String,
30
- hidden: {
31
- // 设置为null代表不做类型转换
32
- type: null,
33
- observer(hidden) {
34
- // null就是代表没有设置,没有设置的话不setData,防止祖先组件触发的setHidden操作被覆盖
35
- if (hidden !== null) {
36
- this.setHidden(!!hidden);
37
- }
38
- },
39
- },
40
- data: Object,
41
- layout: {
42
- type: String,
43
- value: 'horizontal',
44
- },
45
- thumbMode: {
46
- type: String,
47
- value: 'aspectFill',
48
- },
49
- thumbWidth: Number,
50
- thumbHeight: Number,
51
- thumbWidthInPopup: Number,
52
- thumbHeightInPopup: Number,
53
- priceFill: {
54
- type: Boolean,
55
- value: true,
56
- },
57
- currency: {
58
- type: String,
59
- value: '¥',
60
- },
61
- lazyLoad: Boolean,
62
- centered: Boolean,
63
- showCart: Boolean,
64
- pricePrefix: String,
65
- cartSize: {
66
- type: Number,
67
- value: 48,
68
- },
69
- cartColor: {
70
- type: String,
71
- value: '#FA550F',
72
- },
73
- disablePopup: Boolean,
74
- },
75
-
76
- data: {
77
- hiddenInData: false,
78
- specsPopup: {
79
- insert: false,
80
- show: false,
81
- },
82
- },
83
-
84
- currentInTapSpecs: false,
85
-
86
- lifetimes: {
87
- ready() {
88
- const { hidden } = this.properties;
89
- if (hidden !== null) {
90
- this.setHidden(!!hidden);
91
- }
92
- },
93
- },
94
-
95
- methods: {
96
- closeSpecsPopup() {
97
- this.setData({
98
- 'specsPopup.show': false,
99
- });
100
- this.triggerEvent('specsclose', { good: this.properties.data });
101
- },
102
-
103
- removeSpecsPopup() {
104
- this.setData({
105
- 'specsPopup.insert': false,
106
- });
107
- },
108
-
109
- onClick(e) {
110
- if (this.currentInTapSpecs) {
111
- this.currentInTapSpecs = false;
112
- return;
113
- }
114
- this.triggerEvent('click', e.detail);
115
- },
116
-
117
- onClickThumb(e) {
118
- this.triggerEvent('thumb', e.detail);
119
- },
120
-
121
- onClickTag(e) {
122
- this.triggerEvent('tag', e.detail);
123
- },
124
-
125
- onClickCart(e) {
126
- this.triggerEvent('add-cart', e.detail);
127
- },
128
-
129
- setHidden(hidden) {
130
- this.setData({ hiddenInData: !!hidden });
131
- },
132
- },
133
- });
134
- </script>
135
-
136
- <template>
137
- <goods-card
138
- class="wr-specs-goods-card"
139
- id="{{id}}"
140
- layout="{{layout}}"
141
- data="{{data}}"
142
- currency="{{currency}}"
143
- price-fill="{{priceFill}}"
144
- lazy-load="{{lazyLoad}}"
145
- centered="{{centered}}"
146
- thumb-mode="{{thumbMode}}"
147
- thumb-width="{{thumbWidth}}"
148
- thumb-height="{{thumbHeight}}"
149
- show-cart="{{showCart}}"
150
- cart-size="{{cartSize}}"
151
- cart-color="{{cartColor}}"
152
- card-class="{{index === goodsList.length - 1 ? 'wr-goods-card__no-border' : 'wr-goods-card'}}"
153
- title-class="title-class"
154
- desc-class="desc-class"
155
- num-class="num-class"
156
- thumb-class="thumb-class"
157
- specs-class="specs-class"
158
- price-class="price-class"
159
- origin-price-class="origin-price-class"
160
- price-prefix-class="price-prefix-class"
161
- bind:thumb="onClickThumb"
162
- bind:tag="onClickTag"
163
- bind:add-cart="onClickCart"
164
- bind:click="onClick"
165
- hidden="{{hiddenInData}}"
166
- >
167
- <!-- 透传good-card组件的slot -->
168
- <slot name="thumb-cover" slot="thumb-cover" />
169
- <slot name="after-title" slot="after-title" />
170
- <slot name="after-desc" slot="after-desc" />
171
- <slot name="price-prefix" slot="price-prefix" />
172
- <slot name="append-body" slot="append-body" />
173
- <slot name="footer" slot="footer" />
174
- <slot name="append-card" slot="append-card" />
175
- </goods-card>
176
-
177
- </template>
178
-
179
- <json>
180
- {
181
- "component": true,
182
- "usingComponents": {
183
- "goods-card": "../goods-card/index"
184
- }
185
- }</json>