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,102 @@
1
+ <script lang="ts">
2
+ Component({
3
+ externalClasses: ['custom-class'],
4
+
5
+ properties: {
6
+ activeKey: {
7
+ type: Number,
8
+ value: 0,
9
+ },
10
+ tabList: {
11
+ type: Array,
12
+ value: [],
13
+ },
14
+ showMore: Boolean, // 是否需要下拉功能
15
+ },
16
+ observers: {
17
+ activeKey(newVal) {
18
+ if (this.properties.tabList && newVal) {
19
+ this.setActive(newVal).catch((e) => {
20
+ console.error(e);
21
+ });
22
+ }
23
+ },
24
+ },
25
+
26
+ data: {
27
+ currentActive: -1,
28
+ },
29
+ attached() {
30
+ this.setActive(this.properties.activeKey).catch((e) => {
31
+ console.error(e);
32
+ });
33
+ },
34
+
35
+ methods: {
36
+ setActive(activeKey) {
37
+ if (!this.properties.tabList[activeKey] || this.properties.tabList[activeKey].disabled) {
38
+ return Promise.reject('数据异常或不可操作');
39
+ }
40
+ return new Promise((resolve) => {
41
+ this.setData(
42
+ {
43
+ currentActive: activeKey,
44
+ },
45
+ () => resolve(),
46
+ );
47
+ });
48
+ },
49
+ onClick(event) {
50
+ let activeKey;
51
+ if (event.type === 'select') {
52
+ activeKey = event.detail;
53
+ } else {
54
+ activeKey = event.currentTarget.dataset.index;
55
+ }
56
+ this.setActive(activeKey)
57
+ .then(() => {
58
+ const { currentActive } = this.data;
59
+ this.triggerEvent('change', { index: currentActive });
60
+ })
61
+ .catch((e) => {
62
+ console.error(e);
63
+ });
64
+ },
65
+ },
66
+ });
67
+ </script>
68
+
69
+ <template>
70
+ <view class="c-tabbar custom-class [width:100%] [height:100%] [position:relative] [--tabbar-height:100rpx] [--tabbar-fontsize:28rpx] [--tabbar-background-color:white]">
71
+ <scroll-view
72
+ wx:if="{{ tabList.length > 0 }}"
73
+ class="c-tabbar__scroll [position:relative]"
74
+ scroll-x="true"
75
+ scroll-into-view="{{ 'id-' + currentActive }}"
76
+ >
77
+ <view class="c-tabbar__inner {{showMore && tabList.length > 4 ? 'c-tabbar__inner_more' : ''}} [display:flex] [flex-flow:row_nowrap]">
78
+ <view
79
+ wx:for="{{ tabList }}"
80
+ wx:key="index"
81
+ id="{{ 'id-' + index }}"
82
+ class="c-tabbar-item {{ currentActive === index ? 'active' : '' }} {{ item.disabled ? 'disabled' : '' }} [flex:none] [height:100rpx] [color:#282828] [font-size:28rpx] [padding:0_20rpx] [&_.disabled]:[color:#ccc]"
83
+ bind:tap="onClick"
84
+ data-index="{{index}}"
85
+ >
86
+ <view class="c-tabbar-item__text [width:100%] [text-align:center] [height:100rpx] [line-height:100rpx]"> {{ item.name }} </view>
87
+ </view>
88
+ </view>
89
+ </scroll-view>
90
+ <c-tabbar-more wx:if="{{ showMore && tabList.length > 4 }}" tabList="{{tabList}}" bindselect="onClick" />
91
+ <slot />
92
+ </view>
93
+ </template>
94
+
95
+ <json>
96
+ {
97
+ "component": true,
98
+ "usingComponents": {
99
+ "c-tabbar-more": "./c-tabbar-more/index"
100
+ }
101
+ }
102
+ </json>
@@ -0,0 +1,137 @@
1
+ <script lang="ts">
2
+ Component({
3
+ externalClasses: ['custom-class'],
4
+
5
+ properties: {
6
+ category: {
7
+ type: Array,
8
+ },
9
+ initActive: {
10
+ type: Array,
11
+ value: [],
12
+ observer(newVal, oldVal) {
13
+ if (newVal[0] !== oldVal[0]) {
14
+ this.setActiveKey(newVal[0], 0);
15
+ }
16
+ },
17
+ },
18
+ isSlotRight: {
19
+ type: Boolean,
20
+ value: false,
21
+ },
22
+ level: {
23
+ type: Number,
24
+ value: 3,
25
+ },
26
+ },
27
+ data: {
28
+ activeKey: 0,
29
+ subActiveKey: 0,
30
+ },
31
+ attached() {
32
+ if (this.properties.initActive && this.properties.initActive.length > 0) {
33
+ this.setData({
34
+ activeKey: this.properties.initActive[0],
35
+ subActiveKey: this.properties.initActive[1] || 0,
36
+ });
37
+ }
38
+ },
39
+ methods: {
40
+ onParentChange(event) {
41
+ this.setActiveKey(event.detail.index, 0).then(() => {
42
+ this.triggerEvent('change', [this.data.activeKey, this.data.subActiveKey]);
43
+ });
44
+ },
45
+ onChildChange(event) {
46
+ this.setActiveKey(this.data.activeKey, event.detail.index).then(() => {
47
+ this.triggerEvent('change', [this.data.activeKey, this.data.subActiveKey]);
48
+ });
49
+ },
50
+ changCategory(event) {
51
+ const { item } = event.currentTarget.dataset;
52
+ this.triggerEvent('changeCategory', {
53
+ item,
54
+ });
55
+ },
56
+ setActiveKey(key, subKey) {
57
+ return new Promise((resolve) => {
58
+ this.setData(
59
+ {
60
+ activeKey: key,
61
+ subActiveKey: subKey,
62
+ },
63
+ () => {
64
+ resolve();
65
+ },
66
+ );
67
+ });
68
+ },
69
+ },
70
+ });
71
+ </script>
72
+
73
+ <template>
74
+ <view class="goods-category custom-class [display:flex] [&_.custom-sidebar]:[background-color:#f5f5f5]">
75
+ <c-sidebar custom-class="custom-sidebar [height:100%] [width:180rpx] [height:100vh]" bindchange="onParentChange" activeKey="{{activeKey}}">
76
+ <c-sidebar-item wx:for="{{ category }}" wx:key="index" title="{{ item.name }}" disabled="{{ item.disabled }}" />
77
+ </c-sidebar>
78
+ <view class="goods-category__right [height:100%] [flex:auto] [width:0] [position:relative] [overflow:scroll] [-webkit-overflow-scrolling:touch] [background-color:white] [display:flex]">
79
+ <c-tabbar wx:if="{{isSlotRight}}" activeKey="{{subActiveKey}}" bindchange="onChildChange" showMore>
80
+ <slot />
81
+ </c-tabbar>
82
+ <view wx:if="{{!isSlotRight}}" class="goods-category-normal [margin:28rpx_34rpx_0rpx_32rpx]">
83
+ <view
84
+ class="goods-category-normal-item"
85
+ wx:if="{{category[activeKey].children && category[activeKey].children.length > 0}}"
86
+ >
87
+ <block
88
+ wx:for="{{category[activeKey].children}}"
89
+ wx:key="index"
90
+ wx:if="{{level === 3 && item.children && item.children.length > 0}}"
91
+ >
92
+ <view class="flex goods-category-normal-item-title [display:flex] [font-size:28rpx] [font-weight:500]"> {{item.name}} </view>
93
+ <view class="goods-category-normal-item-container [background-color:#fff] [border-radius:8rpx] [padding-top:28rpx] [margin-top:-24rpx] [margin-bottom:30rpx] [display:flex] [flex-wrap:wrap]">
94
+ <view
95
+ class="goods-category-normal-item-container-item [height:196rpx] [display:flex] [flex-direction:column] [align-items:center] [margin-top:24rpx] [width:33.3%] [&_.image]:[width:144rpx] [&_.image]:[height:144rpx]"
96
+ wx:for="{{item.children}}"
97
+ wx:for-index="subIndex"
98
+ wx:key="subIndex"
99
+ wx:for-item="subItem"
100
+ bindtap="changCategory"
101
+ data-item="{{subItem}}"
102
+ >
103
+ <t-image src="{{subItem.thumbnail}}" t-class="image" />
104
+ <view class="flex goods-category-normal-item-container-item-title [display:flex] [justify-content:center] [font-size:24rpx] [color:#666666] [margin-top:20rpx]"> {{subItem.name}} </view>
105
+ </view>
106
+ </view>
107
+ </block>
108
+ <view class="goods-category-normal-item-second-container [background-color:#fff] [border-radius:8rpx] [margin-top:8rpx] [margin-bottom:30rpx] [display:grid] [grid-template-columns:33.33%_33.33%_33.33%]" wx:if="{{level === 2}}">
109
+ <block wx:for="{{category[activeKey].children}}" wx:key="index">
110
+ <view
111
+ class="goods-category-normal-item-second-container-item [height:200rpx] [text-align:center] [margin-top:20rpx] [&_.image]:[width:144rpx] [&_.image]:[height:144rpx]"
112
+ wx:for-key="index"
113
+ bindtap="changCategory"
114
+ data-item="{{item}}"
115
+ >
116
+ <t-image src="{{item.thumbnail}}" t-class="image" />
117
+ <view class="flex goods-category-normal-item-container-item-title [display:flex] [justify-content:center] [font-size:24rpx] [color:#666666] [margin-top:20rpx]"> {{item.name}} </view>
118
+ </view>
119
+ </block>
120
+ </view>
121
+ </view>
122
+ </view>
123
+ </view>
124
+ </view>
125
+ </template>
126
+
127
+ <json>
128
+ {
129
+ "component": true,
130
+ "usingComponents": {
131
+ "c-tabbar": "./components/c-tabbar/index",
132
+ "c-sidebar": "./components/c-sidebar/index",
133
+ "c-sidebar-item": "./components/c-sidebar/c-sidebar-item/index",
134
+ "t-image": "/components/webp-image/index"
135
+ }
136
+ }
137
+ </json>
@@ -0,0 +1,50 @@
1
+ <script lang="ts">
2
+ import { getCategoryList } from '../../services/good/fetchCategoryList';
3
+ Page({
4
+ data: {
5
+ list: [],
6
+ },
7
+ async init() {
8
+ try {
9
+ const result = await getCategoryList();
10
+ this.setData({
11
+ list: result,
12
+ });
13
+ } catch (error) {
14
+ console.error('err:', error);
15
+ }
16
+ },
17
+
18
+ onShow() {
19
+ this.getTabBar().init();
20
+ },
21
+ onChange() {
22
+ wx.navigateTo({
23
+ url: '/pages/goods/list/index',
24
+ });
25
+ },
26
+ onLoad() {
27
+ this.init(true);
28
+ },
29
+ });
30
+ </script>
31
+
32
+ <template>
33
+ <view class="wrap [height:100vh] [overflow:hidden]">
34
+ <goods-category
35
+ level="{{3}}"
36
+ custom-class="goods-category-class ![background-color:#f6f6f6] [height:100%] [&_.goods-category-normal-item-container-item]:[margin-top:20rpx]"
37
+ category="{{list}}"
38
+ bind:changeCategory="onChange"
39
+ />
40
+ </view>
41
+ </template>
42
+
43
+ <json>
44
+ {
45
+ "navigationBarTitleText": "分类",
46
+ "usingComponents": {
47
+ "goods-category": "./components/goods-category/index"
48
+ }
49
+ }
50
+ </json>
@@ -0,0 +1,95 @@
1
+ <script lang="ts">
2
+ const statusMap = {
3
+ default: { text: '去使用', theme: 'primary' },
4
+ useless: { text: '已使用', theme: 'default' },
5
+ disabled: { text: '已过期', theme: 'default' },
6
+ };
7
+ Component({
8
+ options: {
9
+ addGlobalClass: true,
10
+ multipleSlots: true, // 在组件定义时的选项中启用多slot支持
11
+ },
12
+
13
+ externalClasses: ['coupon-class'],
14
+
15
+ properties: {
16
+ couponDTO: {
17
+ type: Object,
18
+ value: {}, // 优惠券数据
19
+ },
20
+ },
21
+
22
+ data: {
23
+ btnText: '',
24
+ btnTheme: '',
25
+ },
26
+
27
+ observers: {
28
+ couponDTO: function (couponDTO) {
29
+ if (!couponDTO) {
30
+ return;
31
+ }
32
+ const statusInfo = statusMap[couponDTO.status];
33
+
34
+ this.setData({
35
+ btnText: statusInfo.text,
36
+ btnTheme: statusInfo.theme,
37
+ });
38
+ },
39
+ },
40
+
41
+ attached() {},
42
+
43
+ methods: {
44
+ // 跳转到详情页
45
+ gotoDetail() {
46
+ wx.navigateTo({
47
+ url: `/pages/coupon/coupon-detail/index?id=${this.data.couponDTO.key}`,
48
+ });
49
+ },
50
+
51
+ // 跳转到商品列表
52
+ gotoGoodsList() {
53
+ wx.navigateTo({
54
+ url: `/pages/coupon/coupon-activity-goods/index?id=${this.data.couponDTO.key}`,
55
+ });
56
+ },
57
+ },
58
+ });
59
+ </script>
60
+
61
+ <template>
62
+ <ui-coupon-card
63
+ title="{{couponDTO.title || ''}}"
64
+ type="{{couponDTO.type || ''}}"
65
+ value="{{couponDTO.value || '0'}}"
66
+ tag="{{couponDTO.tag || ''}}"
67
+ desc="{{couponDTO.desc || ''}}"
68
+ currency="{{couponDTO.currency || ''}}"
69
+ timeLimit="{{couponDTO.timeLimit || ''}}"
70
+ status="{{couponDTO.status || ''}}"
71
+ bind:tap="gotoDetail"
72
+ >
73
+ <view slot="operator" class="coupon-btn-slot">
74
+ <t-button
75
+ t-class="coupon-btn-{{btnTheme}}"
76
+ theme="{{btnTheme}}"
77
+ variant="outline"
78
+ shape="round"
79
+ size="extra-small"
80
+ bind:tap="gotoGoodsList"
81
+ >{{btnText}}
82
+ </t-button>
83
+ </view>
84
+ </ui-coupon-card>
85
+ </template>
86
+
87
+ <json>
88
+ {
89
+ "component": true,
90
+ "usingComponents": {
91
+ "ui-coupon-card": "/components/promotion/ui-coupon-card/index",
92
+ "t-button": "tdesign-miniprogram/button/button"
93
+ }
94
+ }
95
+ </json>
@@ -0,0 +1,44 @@
1
+ <script lang="ts">
2
+ Component({
3
+ data: { icon: 'cart' },
4
+
5
+ properties: {
6
+ count: {
7
+ type: Number,
8
+ },
9
+ },
10
+
11
+ methods: {
12
+ goToCart() {
13
+ wx.switchTab({
14
+ url: '/pages/cart/index',
15
+ });
16
+ },
17
+ },
18
+ });
19
+ </script>
20
+
21
+ <template>
22
+ <view class="floating-button [position:fixed] [right:20rpx] [bottom:108rpx] [&_.floating-inner-container]:[display:flex] [&_.floating-inner-container]:[align-items:center] [&_.floating-inner-container]:[justify-content:center] [&_.floating-inner-container]:[height:96rpx] [&_.floating-inner-container]:[width:96rpx] [&_.floating-inner-container]:[background-color:rgba(0,_0,_0,_0.8)] [&_.floating-inner-container]:[opacity:0.7] [&_.floating-inner-container]:[border-radius:48rpx] [&_.floating-right-top]:[position:absolute] [&_.floating-right-top]:[right:0rpx] [&_.floating-right-top]:[top:0rpx] [&_.floating-right-top]:[height:28rpx] [&_.floating-right-top]:[background:#fa4126] [&_.floating-right-top]:[border-radius:64rpx] [&_.floating-right-top]:[font-weight:bold] [&_.floating-right-top]:[font-size:22rpx] [&_.floating-right-top]:[line-height:28rpx] [&_.floating-right-top]:[color:#fff] [&_.floating-right-top]:[padding:0_8rpx]" bind:tap="goToCart">
23
+ <view class="floating-inner-container">
24
+ <t-icon
25
+ prefix="wr"
26
+ name="{{icon}}"
27
+ size="42rpx"
28
+ color="#FFFFFF"
29
+ />
30
+ </view>
31
+ <view class="floating-right-top">
32
+ {{count}}
33
+ </view>
34
+ </view>
35
+
36
+ </template>
37
+
38
+ <json>
39
+ {
40
+ "component": true,
41
+ "usingComponents": {
42
+ "t-icon": "tdesign-miniprogram/icon/icon"
43
+ }
44
+ }</json>
@@ -0,0 +1,135 @@
1
+ <script lang="ts">
2
+ import { fetchCouponDetail } from '../../../services/coupon/index';
3
+ import { fetchGoodsList } from '../../../services/good/fetchGoods';
4
+ import Toast from 'tdesign-miniprogram/toast/index';
5
+
6
+ Page({
7
+ data: {
8
+ goods: [],
9
+ detail: {},
10
+ couponTypeDesc: '',
11
+ showStoreInfoList: false,
12
+ cartNum: 2,
13
+ },
14
+
15
+ id: '',
16
+
17
+ onLoad(query) {
18
+ const id = parseInt(query.id);
19
+ this.id = id;
20
+
21
+ this.getCouponDetail(id);
22
+ this.getGoodsList(id);
23
+ },
24
+
25
+ getCouponDetail(id) {
26
+ fetchCouponDetail(id).then(({ detail }) => {
27
+ this.setData({ detail });
28
+ if (detail.type === 2) {
29
+ if (detail.base > 0) {
30
+ this.setData({
31
+ couponTypeDesc: `满${detail.base / 100}元${detail.value}折`,
32
+ });
33
+ } else {
34
+ this.setData({ couponTypeDesc: `${detail.value}折` });
35
+ }
36
+ } else if (detail.type === 1) {
37
+ if (detail.base > 0) {
38
+ this.setData({
39
+ couponTypeDesc: `满${detail.base / 100}元减${detail.value / 100}元`,
40
+ });
41
+ } else {
42
+ this.setData({ couponTypeDesc: `减${detail.value / 100}元` });
43
+ }
44
+ }
45
+ });
46
+ },
47
+
48
+ getGoodsList(id) {
49
+ fetchGoodsList(id).then((goods) => {
50
+ this.setData({ goods });
51
+ });
52
+ },
53
+
54
+ openStoreList() {
55
+ this.setData({
56
+ showStoreInfoList: true,
57
+ });
58
+ },
59
+
60
+ closeStoreList() {
61
+ this.setData({
62
+ showStoreInfoList: false,
63
+ });
64
+ },
65
+
66
+ goodClickHandle(e) {
67
+ const { index } = e.detail;
68
+ const { spuId } = this.data.goods[index];
69
+ wx.navigateTo({ url: `/pages/goods/details/index?spuId=${spuId}` });
70
+ },
71
+
72
+ cartClickHandle() {
73
+ Toast({
74
+ context: this,
75
+ selector: '#t-toast',
76
+ message: '点击加入购物车',
77
+ });
78
+ },
79
+ });
80
+ </script>
81
+
82
+ <template>
83
+ <view class="coupon-page-container [&_.notice-bar-content]:[display:flex] [&_.notice-bar-content]:[flex-direction:row] [&_.notice-bar-content]:[align-items:center] [&_.notice-bar-content]:[padding:8rpx_0] [&_.notice-bar-text]:[font-size:26rpx] [&_.notice-bar-text]:[line-height:36rpx] [&_.notice-bar-text]:[font-weight:400] [&_.notice-bar-text]:[color:#666666] [&_.notice-bar-text]:[margin-left:24rpx] [&_.notice-bar-text]:[margin-right:12rpx] [&_.notice-bar-text_.height-light]:[color:#fa550f] [&_.popup-content-wrap]:[background-color:#fff] [&_.popup-content-wrap]:[border-top-left-radius:20rpx] [&_.popup-content-wrap]:[border-top-right-radius:20rpx] [&_.popup-content-title]:[font-size:32rpx] [&_.popup-content-title]:[color:#333] [&_.popup-content-title]:[text-align:center] [&_.popup-content-title]:[height:104rpx] [&_.popup-content-title]:[line-height:104rpx] [&_.popup-content-title]:[position:relative] [&_.desc-group-wrap]:[padding-bottom:env(safe-area-inset-bottom)] [&_.desc-group-wrap_.item-wrap]:[margin:0_30rpx_30rpx] [&_.desc-group-wrap_.item-title]:[font-size:26rpx] [&_.desc-group-wrap_.item-title]:[color:#333] [&_.desc-group-wrap_.item-title]:[font-weight:500] [&_.desc-group-wrap_.item-label]:[font-size:24rpx] [&_.desc-group-wrap_.item-label]:[color:#666] [&_.desc-group-wrap_.item-label]:[margin-top:12rpx] [&_.desc-group-wrap_.item-label]:[white-space:pre-line] [&_.desc-group-wrap_.item-label]:[word-break:break-all] [&_.desc-group-wrap_.item-label]:[line-height:34rpx] [&_.goods-list-container]:[margin:0_24rpx_24rpx] [&_.goods-list-wrap]:[background:#f5f5f5]">
84
+ <view class="notice-bar-content">
85
+ <view class="notice-bar-text">
86
+ 以下商品可使用
87
+ <text class="height-light">{{couponTypeDesc}}</text>
88
+ 优惠券
89
+ </view>
90
+ <t-icon name="help-circle" size="32rpx" color="#AAAAAA" bind:tap="openStoreList" />
91
+ </view>
92
+ <view class="goods-list-container">
93
+ <goods-list
94
+ wr-class="goods-list-wrap"
95
+ goodsList="{{goods}}"
96
+ bind:click="goodClickHandle"
97
+ bind:addcart="cartClickHandle"
98
+ />
99
+ </view>
100
+ <floating-button count="{{cartNum}}" />
101
+ <t-popup visible="{{showStoreInfoList}}" placement="bottom" bind:visible-change="closeStoreList">
102
+ <t-icon slot="closeBtn" name="close" size="40rpx" bind:tap="closeStoreList" />
103
+ <view class="popup-content-wrap">
104
+ <view class="popup-content-title"> 规则详情 </view>
105
+ <view class="desc-group-wrap">
106
+ <view wx:if="{{detail && detail.timeLimit}}" class="item-wrap">
107
+ <view class="item-title">优惠券有效时间</view>
108
+ <view class="item-label">{{detail.timeLimit}}</view>
109
+ </view>
110
+ <view wx:if="{{detail && detail.desc}}" class="item-wrap">
111
+ <view class="item-title">优惠券说明</view>
112
+ <view class="item-label">{{detail.desc}}</view>
113
+ </view>
114
+ <view wx:if="{{detail && detail.useNotes}}" class="item-wrap">
115
+ <view class="item-title">使用须知</view>
116
+ <view class="item-label">{{detail.useNotes}}</view>
117
+ </view>
118
+ </view>
119
+ </view>
120
+ </t-popup>
121
+ </view>
122
+ <t-toast id="t-toast" />
123
+ </template>
124
+
125
+ <json>
126
+ {
127
+ "navigationBarTitleText": "活动商品",
128
+ "usingComponents": {
129
+ "t-icon": "tdesign-miniprogram/icon/icon",
130
+ "t-popup": "tdesign-miniprogram/popup/popup",
131
+ "t-toast": "tdesign-miniprogram/toast/toast",
132
+ "goods-list": "/components/goods-list/index",
133
+ "floating-button": "../components/floating-button/index"
134
+ }
135
+ }</json>
@@ -0,0 +1,94 @@
1
+ <script lang="ts">
2
+ import { fetchCouponDetail } from '../../../services/coupon/index';
3
+
4
+ Page({
5
+ data: {
6
+ detail: null,
7
+ storeInfoList: [],
8
+ storeInfoStr: '',
9
+ showStoreInfoList: false,
10
+ },
11
+
12
+ id: '',
13
+
14
+ onLoad(query) {
15
+ const id = parseInt(query.id);
16
+ this.id = id;
17
+ this.getGoodsList(id);
18
+ },
19
+
20
+ getGoodsList(id) {
21
+ fetchCouponDetail(id).then(({ detail }) => {
22
+ this.setData({
23
+ detail,
24
+ });
25
+ });
26
+ },
27
+
28
+ navGoodListHandle() {
29
+ wx.navigateTo({
30
+ url: `/pages/coupon/coupon-activity-goods/index?id=${this.id}`,
31
+ });
32
+ },
33
+ });
34
+ </script>
35
+
36
+ <template>
37
+ <!-- 优惠券 -->
38
+ <view class="coupon-card-wrap [background-color:#fff] [padding:32rpx_32rpx_1rpx]">
39
+ <coupon-card couponDTO="{{detail}}" />
40
+ </view>
41
+ <!-- 说明 -->
42
+ <view class="desc-wrap [margin-top:24rpx] [&_.button-wrap]:[margin:50rpx_32rpx_0]">
43
+ <t-cell-group t-class="desc-group-wrap [border-radius:8rpx] [overflow:hidden] [--cell-label-font-size:26rpx] [--cell-label-line-height:36rpx] [--cell-label-color:#999] [&_.t-class-cell]:[align-items:flex-start] [&_.t-class-title]:[font-size:26rpx] [&_.t-class-title]:[width:140rpx] [&_.t-class-title]:[flex:none] [&_.t-class-title]:[color:#888] [&_.t-class-note]:[font-size:26rpx] [&_.t-class-note]:[word-break:break-all] [&_.t-class-note]:[white-space:pre-line] [&_.t-class-note]:[justify-content:flex-start] [&_.t-class-note]:[color:#333] [&_.t-class-note]:[width:440rpx] [&_.in-popup]:[border-radius:0] [&_.in-popup]:[overflow:auto] [&_.in-popup]:[max-height:828rpx] [&_.wr-cell__title]:[color:#333] [&_.wr-cell__title]:[font-size:28rpx]">
44
+ <t-cell
45
+ wx:if="{{detail && detail.desc}}"
46
+ t-class="t-class-cell"
47
+ t-class-title="t-class-title"
48
+ t-class-note="t-class-note"
49
+ title="规则说明"
50
+ note="{{detail && detail.desc}}"
51
+ />
52
+ <t-cell
53
+ wx:if="{{detail && detail.timeLimit}}"
54
+ t-class="t-class-cell"
55
+ t-class-title="t-class-title"
56
+ t-class-note="t-class-note"
57
+ title="有效时间"
58
+ note="{{detail && detail.timeLimit}}"
59
+ />
60
+ <t-cell
61
+ wx:if="{{detail && detail.storeAdapt}}"
62
+ t-class="t-class-cell"
63
+ t-class-title="t-class-title"
64
+ t-class-note="t-class-note"
65
+ title="适用范围"
66
+ note="{{detail && detail.storeAdapt}}"
67
+ />
68
+ <t-cell
69
+ wx:if="{{detail && detail.useNotes}}"
70
+ t-class="t-class-cell"
71
+ t-class-title="t-class-title"
72
+ t-class-note="t-class-note"
73
+ title="使用须知"
74
+ note="{{detail && detail.useNotes}}"
75
+ />
76
+ </t-cell-group>
77
+ <!-- 查看可用商品 -->
78
+ <view class="button-wrap">
79
+ <t-button shape="round" block bindtap="navGoodListHandle"> 查看可用商品 </t-button>
80
+ </view>
81
+ </view>
82
+ </template>
83
+
84
+ <json>
85
+ {
86
+ "navigationBarTitleText": "优惠券详情",
87
+ "usingComponents": {
88
+ "coupon-card": "../components/coupon-card/index",
89
+ "t-cell": "tdesign-miniprogram/cell/cell",
90
+ "t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
91
+ "t-button": "tdesign-miniprogram/button/button",
92
+ "t-icon": "tdesign-miniprogram/icon/icon"
93
+ }
94
+ }</json>