create-weapp-vite 2.0.30 → 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.
- package/README.md +1 -0
- package/dist/{chunk-HT7GOIHP.js → chunk-IT75MAH3.js} +3 -2
- package/dist/cli.js +5 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/templates/tailwindcss/package.json +1 -1
- package/templates/tdesign/package.json +1 -1
- package/templates/vant/package.json +1 -1
- package/templates/wevu-retail/.editorconfig +9 -0
- package/templates/wevu-retail/.vscode/settings.json +10 -0
- package/templates/wevu-retail/AGENTS.md +35 -0
- package/templates/wevu-retail/README.md +26 -0
- package/templates/wevu-retail/auto-import-components.json +1 -0
- package/templates/wevu-retail/gitignore +35 -0
- package/templates/wevu-retail/package.json +42 -0
- package/templates/wevu-retail/postcss.config.js +6 -0
- package/templates/wevu-retail/project.config.json +44 -0
- package/templates/wevu-retail/project.private.config.json +8 -0
- package/templates/wevu-retail/src/app.vue +104 -0
- package/templates/wevu-retail/src/common/updateManager.ts +29 -0
- package/templates/wevu-retail/src/components/filter/index.vue +134 -0
- package/templates/wevu-retail/src/components/filter-popup/index.vue +67 -0
- package/templates/wevu-retail/src/components/goods-card/index.vue +219 -0
- package/templates/wevu-retail/src/components/goods-list/index.vue +91 -0
- package/templates/wevu-retail/src/components/load-more/index.vue +99 -0
- package/templates/wevu-retail/src/components/loading-content/index.vue +48 -0
- package/templates/wevu-retail/src/components/price/index.vue +104 -0
- package/templates/wevu-retail/src/components/promotion/ui-coupon-card/index.vue +143 -0
- package/templates/wevu-retail/src/components/promotion/ui-coupon-card/tools.wxs +18 -0
- package/templates/wevu-retail/src/components/swipeout/index.vue +118 -0
- package/templates/wevu-retail/src/components/swipeout/swipe.wxs +151 -0
- package/templates/wevu-retail/src/components/webp-image/index.vue +105 -0
- package/templates/wevu-retail/src/components/webp-image/utils.wxs +140 -0
- package/templates/wevu-retail/src/config/index.ts +20437 -0
- package/templates/wevu-retail/src/custom-tab-bar/data.ts +22 -0
- package/templates/wevu-retail/src/custom-tab-bar/index.vue +62 -0
- package/templates/wevu-retail/src/model/activities.ts +7 -0
- package/templates/wevu-retail/src/model/activity.ts +18 -0
- package/templates/wevu-retail/src/model/address.ts +31 -0
- package/templates/wevu-retail/src/model/cart.ts +306 -0
- package/templates/wevu-retail/src/model/category.ts +175 -0
- package/templates/wevu-retail/src/model/comments/queryDetail.ts +50 -0
- package/templates/wevu-retail/src/model/comments.ts +298 -0
- package/templates/wevu-retail/src/model/coupon.ts +39 -0
- package/templates/wevu-retail/src/model/detailsComments.ts +30 -0
- package/templates/wevu-retail/src/model/good.ts +1904 -0
- package/templates/wevu-retail/src/model/goods.ts +7 -0
- package/templates/wevu-retail/src/model/order/applyService.ts +329 -0
- package/templates/wevu-retail/src/model/order/orderConfirm.ts +147 -0
- package/templates/wevu-retail/src/model/order/orderDetail.ts +1191 -0
- package/templates/wevu-retail/src/model/order/orderList.ts +1033 -0
- package/templates/wevu-retail/src/model/promotion.ts +20 -0
- package/templates/wevu-retail/src/model/search.ts +60 -0
- package/templates/wevu-retail/src/model/submitComment.ts +58 -0
- package/templates/wevu-retail/src/model/swiper.ts +39 -0
- package/templates/wevu-retail/src/model/usercenter.ts +52 -0
- package/templates/wevu-retail/src/pages/cart/components/cart-bar/index.vue +104 -0
- package/templates/wevu-retail/src/pages/cart/components/cart-empty/index.vue +41 -0
- package/templates/wevu-retail/src/pages/cart/components/cart-group/index.vue +333 -0
- package/templates/wevu-retail/src/pages/cart/components/cart-group/index.wxs +5 -0
- package/templates/wevu-retail/src/pages/cart/components/cart-group/utils.wxs +20 -0
- package/templates/wevu-retail/src/pages/cart/components/goods-card/index.vue +334 -0
- package/templates/wevu-retail/src/pages/cart/components/specs-popup/index.vue +100 -0
- package/templates/wevu-retail/src/pages/cart/index.vue +342 -0
- package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/README.md +95 -0
- package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/c-sidebar-item/index.vue +73 -0
- package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-sidebar/index.vue +121 -0
- package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-tabbar/c-tabbar-more/index.vue +74 -0
- package/templates/wevu-retail/src/pages/category/components/goods-category/components/c-tabbar/index.vue +102 -0
- package/templates/wevu-retail/src/pages/category/components/goods-category/index.vue +137 -0
- package/templates/wevu-retail/src/pages/category/index.vue +50 -0
- package/templates/wevu-retail/src/pages/coupon/components/coupon-card/index.vue +95 -0
- package/templates/wevu-retail/src/pages/coupon/components/floating-button/index.vue +44 -0
- package/templates/wevu-retail/src/pages/coupon/coupon-activity-goods/index.vue +135 -0
- package/templates/wevu-retail/src/pages/coupon/coupon-detail/index.vue +94 -0
- package/templates/wevu-retail/src/pages/coupon/coupon-list/index.vue +136 -0
- package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/images-videos/assets/play.png +0 -0
- package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/images-videos/index.vue +65 -0
- package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/components/my-video/index.vue +92 -0
- package/templates/wevu-retail/src/pages/goods/comments/components/comments-card/index.vue +93 -0
- package/templates/wevu-retail/src/pages/goods/comments/create/index.vue +196 -0
- package/templates/wevu-retail/src/pages/goods/comments/index.vue +293 -0
- package/templates/wevu-retail/src/pages/goods/details/components/buy-bar/index.vue +117 -0
- package/templates/wevu-retail/src/pages/goods/details/components/goods-specs-popup/index.vue +440 -0
- package/templates/wevu-retail/src/pages/goods/details/components/promotion-popup/index.vue +83 -0
- package/templates/wevu-retail/src/pages/goods/details/index.vue +598 -0
- package/templates/wevu-retail/src/pages/goods/list/index.vue +299 -0
- package/templates/wevu-retail/src/pages/goods/result/index.vue +350 -0
- package/templates/wevu-retail/src/pages/goods/search/index.vue +196 -0
- package/templates/wevu-retail/src/pages/home/home.vue +215 -0
- package/templates/wevu-retail/src/pages/home/readme +8 -0
- package/templates/wevu-retail/src/pages/order/after-service-detail/api.ts +34 -0
- package/templates/wevu-retail/src/pages/order/after-service-detail/index.vue +430 -0
- package/templates/wevu-retail/src/pages/order/after-service-list/api.ts +1262 -0
- package/templates/wevu-retail/src/pages/order/after-service-list/index.vue +299 -0
- package/templates/wevu-retail/src/pages/order/apply-service/index.vue +665 -0
- package/templates/wevu-retail/src/pages/order/components/after-service-button-bar/index.vue +142 -0
- package/templates/wevu-retail/src/pages/order/components/customer-service/index.vue +75 -0
- package/templates/wevu-retail/src/pages/order/components/goods-card/index.vue +356 -0
- package/templates/wevu-retail/src/pages/order/components/noGoods/noGood.wxs +17 -0
- package/templates/wevu-retail/src/pages/order/components/noGoods/noGoods.vue +125 -0
- package/templates/wevu-retail/src/pages/order/components/order-button-bar/index.vue +262 -0
- package/templates/wevu-retail/src/pages/order/components/order-card/index.vue +126 -0
- package/templates/wevu-retail/src/pages/order/components/order-goods-card/index.vue +86 -0
- package/templates/wevu-retail/src/pages/order/components/reason-sheet/index.vue +161 -0
- package/templates/wevu-retail/src/pages/order/components/reason-sheet/reasonSheet.ts +25 -0
- package/templates/wevu-retail/src/pages/order/components/selectCoupons/mock.ts +22 -0
- package/templates/wevu-retail/src/pages/order/components/selectCoupons/selectCoupon.wxs +16 -0
- package/templates/wevu-retail/src/pages/order/components/selectCoupons/selectCoupons.vue +207 -0
- package/templates/wevu-retail/src/pages/order/components/specs-goods-card/index.vue +185 -0
- package/templates/wevu-retail/src/pages/order/config.ts +94 -0
- package/templates/wevu-retail/src/pages/order/delivery-detail/index.vue +145 -0
- package/templates/wevu-retail/src/pages/order/delivery-detail/isUrl.wxs +7 -0
- package/templates/wevu-retail/src/pages/order/fill-tracking-no/api.ts +71 -0
- package/templates/wevu-retail/src/pages/order/fill-tracking-no/index.vue +267 -0
- package/templates/wevu-retail/src/pages/order/invoice/index.vue +94 -0
- package/templates/wevu-retail/src/pages/order/order-confirm/components/address-card/index.vue +78 -0
- package/templates/wevu-retail/src/pages/order/order-confirm/getNotes.wxs +11 -0
- package/templates/wevu-retail/src/pages/order/order-confirm/handleInvoice.wxs +11 -0
- package/templates/wevu-retail/src/pages/order/order-confirm/index.vue +707 -0
- package/templates/wevu-retail/src/pages/order/order-confirm/order.wxs +8 -0
- package/templates/wevu-retail/src/pages/order/order-confirm/pay.ts +115 -0
- package/templates/wevu-retail/src/pages/order/order-detail/index.vue +456 -0
- package/templates/wevu-retail/src/pages/order/order-list/index.vue +288 -0
- package/templates/wevu-retail/src/pages/order/pay-result/index.vue +77 -0
- package/templates/wevu-retail/src/pages/order/receipt/index.vue +336 -0
- package/templates/wevu-retail/src/pages/promotion/promotion-detail/index.vue +145 -0
- package/templates/wevu-retail/src/pages/user/address/edit/index.vue +514 -0
- package/templates/wevu-retail/src/pages/user/address/list/index.vue +249 -0
- package/templates/wevu-retail/src/pages/user/components/t-location/index.vue +156 -0
- package/templates/wevu-retail/src/pages/user/components/ui-address-item/index.vue +92 -0
- package/templates/wevu-retail/src/pages/user/name-edit/index.vue +49 -0
- package/templates/wevu-retail/src/pages/user/person-info/index.vue +198 -0
- package/templates/wevu-retail/src/pages/usercenter/address/edit/util.ts +33 -0
- package/templates/wevu-retail/src/pages/usercenter/components/order-group/index.vue +90 -0
- package/templates/wevu-retail/src/pages/usercenter/components/ui-select-picker/index.vue +108 -0
- package/templates/wevu-retail/src/pages/usercenter/components/user-center-card/index.vue +82 -0
- package/templates/wevu-retail/src/pages/usercenter/index.vue +301 -0
- package/templates/wevu-retail/src/services/_utils/delay.ts +3 -0
- package/templates/wevu-retail/src/services/_utils/timeout.ts +3 -0
- package/templates/wevu-retail/src/services/activity/fetchActivity.ts +20 -0
- package/templates/wevu-retail/src/services/activity/fetchActivityList.ts +20 -0
- package/templates/wevu-retail/src/services/address/edit.ts +33 -0
- package/templates/wevu-retail/src/services/address/fetchAddress.ts +48 -0
- package/templates/wevu-retail/src/services/address/list.ts +31 -0
- package/templates/wevu-retail/src/services/cart/cart.ts +20 -0
- package/templates/wevu-retail/src/services/comments/fetchComments.ts +18 -0
- package/templates/wevu-retail/src/services/comments/fetchCommentsCount.ts +18 -0
- package/templates/wevu-retail/src/services/coupon/index.ts +65 -0
- package/templates/wevu-retail/src/services/good/comments/fetchCommentDetail.ts +20 -0
- package/templates/wevu-retail/src/services/good/fetchCategoryList.ts +18 -0
- package/templates/wevu-retail/src/services/good/fetchGood.ts +18 -0
- package/templates/wevu-retail/src/services/good/fetchGoods.ts +29 -0
- package/templates/wevu-retail/src/services/good/fetchGoodsDetailsComments.ts +37 -0
- package/templates/wevu-retail/src/services/good/fetchGoodsList.ts +39 -0
- package/templates/wevu-retail/src/services/good/fetchSearchHistory.ts +35 -0
- package/templates/wevu-retail/src/services/good/fetchSearchResult.ts +38 -0
- package/templates/wevu-retail/src/services/home/home.ts +53 -0
- package/templates/wevu-retail/src/services/order/applyService.ts +70 -0
- package/templates/wevu-retail/src/services/order/orderConfirm.ts +69 -0
- package/templates/wevu-retail/src/services/order/orderDetail.ts +39 -0
- package/templates/wevu-retail/src/services/order/orderList.ts +39 -0
- package/templates/wevu-retail/src/services/order/orderSubmitComment.ts +22 -0
- package/templates/wevu-retail/src/services/promotion/detail.ts +18 -0
- package/templates/wevu-retail/src/services/usercenter/fetchPerson.ts +28 -0
- package/templates/wevu-retail/src/services/usercenter/fetchUsercenter.ts +18 -0
- package/templates/wevu-retail/src/sitemap.json +7 -0
- package/templates/wevu-retail/src/utils/addressParse.ts +25 -0
- package/templates/wevu-retail/src/utils/getPermission.ts +45 -0
- package/templates/wevu-retail/src/utils/mock.ts +51 -0
- package/templates/wevu-retail/src/utils/util.ts +134 -0
- package/templates/wevu-retail/src/vite-env.d.ts +1 -0
- package/templates/wevu-retail/tailwind.config.ts +15 -0
- package/templates/wevu-retail/tsconfig.app.json +58 -0
- package/templates/wevu-retail/tsconfig.json +11 -0
- package/templates/wevu-retail/tsconfig.node.json +33 -0
- package/templates/wevu-retail/vite.config.ts +14 -0
- package/templates/wevu-tdesign/package.json +1 -1
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/* eslint-disable no-param-reassign */
|
|
3
|
+
/* eslint-disable no-nested-ternary */
|
|
4
|
+
import Toast from 'tdesign-miniprogram/toast/index';
|
|
5
|
+
|
|
6
|
+
Component({
|
|
7
|
+
options: {
|
|
8
|
+
multipleSlots: true,
|
|
9
|
+
addGlobalClass: true,
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
properties: {
|
|
13
|
+
src: {
|
|
14
|
+
type: String,
|
|
15
|
+
},
|
|
16
|
+
title: String,
|
|
17
|
+
show: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
value: false,
|
|
20
|
+
},
|
|
21
|
+
limitBuyInfo: {
|
|
22
|
+
type: String,
|
|
23
|
+
value: '',
|
|
24
|
+
},
|
|
25
|
+
isStock: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
value: true,
|
|
28
|
+
},
|
|
29
|
+
limitMaxCount: {
|
|
30
|
+
type: Number,
|
|
31
|
+
value: 999,
|
|
32
|
+
},
|
|
33
|
+
limitMinCount: {
|
|
34
|
+
type: Number,
|
|
35
|
+
value: 1,
|
|
36
|
+
},
|
|
37
|
+
skuList: {
|
|
38
|
+
type: Array,
|
|
39
|
+
value: [],
|
|
40
|
+
observer(skuList) {
|
|
41
|
+
if (skuList && skuList.length > 0) {
|
|
42
|
+
if (this.initStatus) {
|
|
43
|
+
this.initData();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
specList: {
|
|
49
|
+
type: Array,
|
|
50
|
+
value: [],
|
|
51
|
+
observer(specList) {
|
|
52
|
+
if (specList && specList.length > 0) {
|
|
53
|
+
this.initData();
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
outOperateStatus: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
value: false,
|
|
60
|
+
},
|
|
61
|
+
hasAuth: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
value: false,
|
|
64
|
+
},
|
|
65
|
+
count: {
|
|
66
|
+
type: Number,
|
|
67
|
+
value: 1,
|
|
68
|
+
observer(count) {
|
|
69
|
+
this.setData({
|
|
70
|
+
buyNum: count,
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
initStatus: false,
|
|
77
|
+
selectedSku: {},
|
|
78
|
+
selectSpecObj: {},
|
|
79
|
+
|
|
80
|
+
data: {
|
|
81
|
+
buyNum: 1,
|
|
82
|
+
isAllSelectedSku: false,
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
methods: {
|
|
86
|
+
initData() {
|
|
87
|
+
const { skuList } = this.properties;
|
|
88
|
+
const { specList } = this.properties;
|
|
89
|
+
specList.forEach((item) => {
|
|
90
|
+
if (item.specValueList.length > 0) {
|
|
91
|
+
item.specValueList.forEach((subItem) => {
|
|
92
|
+
const obj = this.checkSkuStockQuantity(subItem.specValueId, skuList);
|
|
93
|
+
subItem.hasStockObj = obj;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
const selectedSku = {};
|
|
98
|
+
specList.forEach((item) => {
|
|
99
|
+
selectedSku[item.specId] = '';
|
|
100
|
+
});
|
|
101
|
+
this.setData({
|
|
102
|
+
specList,
|
|
103
|
+
});
|
|
104
|
+
this.selectSpecObj = {};
|
|
105
|
+
this.selectedSku = {};
|
|
106
|
+
this.initStatus = true;
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
checkSkuStockQuantity(specValueId, skuList) {
|
|
110
|
+
let hasStock = false;
|
|
111
|
+
const array = [];
|
|
112
|
+
skuList.forEach((item) => {
|
|
113
|
+
(item.specInfo || []).forEach((subItem) => {
|
|
114
|
+
if (subItem.specValueId === specValueId && item.quantity > 0) {
|
|
115
|
+
const subArray = [];
|
|
116
|
+
(item.specInfo || []).forEach((specItem) => {
|
|
117
|
+
subArray.push(specItem.specValueId);
|
|
118
|
+
});
|
|
119
|
+
array.push(subArray);
|
|
120
|
+
hasStock = true;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
return {
|
|
125
|
+
hasStock,
|
|
126
|
+
specsArray: array,
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
chooseSpecValueId(specValueId, specId) {
|
|
131
|
+
const { selectSpecObj } = this;
|
|
132
|
+
const { skuList, specList } = this.properties;
|
|
133
|
+
if (selectSpecObj[specId]) {
|
|
134
|
+
selectSpecObj[specId] = [];
|
|
135
|
+
this.selectSpecObj = selectSpecObj;
|
|
136
|
+
} else {
|
|
137
|
+
selectSpecObj[specId] = [];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const itemAllSpecArray = [];
|
|
141
|
+
const itemUnSelectArray = [];
|
|
142
|
+
const itemSelectArray = [];
|
|
143
|
+
specList.forEach((item) => {
|
|
144
|
+
if (item.specId === specId) {
|
|
145
|
+
const subSpecValueItem = item.specValueList.find((subItem) => subItem.specValueId === specValueId);
|
|
146
|
+
let specSelectStatus = false;
|
|
147
|
+
item.specValueList.forEach((n) => {
|
|
148
|
+
itemAllSpecArray.push(n.hasStockObj.specsArray);
|
|
149
|
+
if (n.isSelected) {
|
|
150
|
+
specSelectStatus = true;
|
|
151
|
+
}
|
|
152
|
+
if (n.hasStockObj.hasStock) {
|
|
153
|
+
itemSelectArray.push(n.specValueId);
|
|
154
|
+
} else {
|
|
155
|
+
itemUnSelectArray.push(n.specValueId);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
if (specSelectStatus) {
|
|
159
|
+
selectSpecObj[specId] = this.flatten(subSpecValueItem?.hasStockObj.specsArray.concat(itemSelectArray));
|
|
160
|
+
} else {
|
|
161
|
+
const subSet = function (arr1, arr2) {
|
|
162
|
+
const set2 = new Set(arr2);
|
|
163
|
+
const subset = [];
|
|
164
|
+
arr1.forEach((val) => {
|
|
165
|
+
if (!set2.has(val)) {
|
|
166
|
+
subset.push(val);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
return subset;
|
|
170
|
+
};
|
|
171
|
+
selectSpecObj[specId] = subSet(this.flatten(itemAllSpecArray), this.flatten(itemUnSelectArray));
|
|
172
|
+
}
|
|
173
|
+
} else {
|
|
174
|
+
// 未点击规格的逻辑
|
|
175
|
+
const itemSelectArray = [];
|
|
176
|
+
let specSelectStatus = false;
|
|
177
|
+
item.specValueList.map(
|
|
178
|
+
// 找到有库存的规格数组
|
|
179
|
+
(n) => {
|
|
180
|
+
itemSelectArray.push(n.hasStockObj.specsArray);
|
|
181
|
+
if (n.isSelected) {
|
|
182
|
+
specSelectStatus = true;
|
|
183
|
+
}
|
|
184
|
+
n.hasStockObj.hasStock = true;
|
|
185
|
+
return n;
|
|
186
|
+
},
|
|
187
|
+
);
|
|
188
|
+
if (specSelectStatus) {
|
|
189
|
+
selectSpecObj[item.specId] = this.flatten(itemSelectArray);
|
|
190
|
+
} else {
|
|
191
|
+
delete selectSpecObj[item.specId];
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
this.selectSpecObj = selectSpecObj;
|
|
195
|
+
});
|
|
196
|
+
const combatArray = Object.values(selectSpecObj);
|
|
197
|
+
if (combatArray.length > 0) {
|
|
198
|
+
const showArray = combatArray.reduce((x, y) => this.getIntersection(x, y));
|
|
199
|
+
const lastResult = Array.from(new Set(showArray));
|
|
200
|
+
specList.forEach((item) => {
|
|
201
|
+
item.specValueList.forEach((subItem) => {
|
|
202
|
+
if (lastResult.includes(subItem.specValueId)) {
|
|
203
|
+
subItem.hasStockObj.hasStock = true;
|
|
204
|
+
} else {
|
|
205
|
+
subItem.hasStockObj.hasStock = false;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
} else {
|
|
210
|
+
specList.forEach((item) => {
|
|
211
|
+
if (item.specValueList.length > 0) {
|
|
212
|
+
item.specValueList.forEach((subItem) => {
|
|
213
|
+
const obj = this.checkSkuStockQuantity(subItem.specValueId, skuList);
|
|
214
|
+
subItem.hasStockObj = obj;
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
this.setData({
|
|
220
|
+
specList,
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
flatten(input) {
|
|
225
|
+
const stack = [...input];
|
|
226
|
+
const res = [];
|
|
227
|
+
while (stack.length) {
|
|
228
|
+
const next = stack.pop();
|
|
229
|
+
if (Array.isArray(next)) {
|
|
230
|
+
stack.push(...next);
|
|
231
|
+
} else {
|
|
232
|
+
res.push(next);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return res.reverse();
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
getIntersection(array, nextArray) {
|
|
239
|
+
return array.filter((item) => nextArray.includes(item));
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
toChooseItem(e) {
|
|
243
|
+
const { isStock } = this.properties;
|
|
244
|
+
if (!isStock) return;
|
|
245
|
+
const { id } = e.currentTarget.dataset;
|
|
246
|
+
const specId = e.currentTarget.dataset.specid;
|
|
247
|
+
const hasStock = e.currentTarget.dataset.hasstock;
|
|
248
|
+
if (!hasStock) {
|
|
249
|
+
Toast({
|
|
250
|
+
context: this,
|
|
251
|
+
selector: '#t-toast',
|
|
252
|
+
message: '该规格已售罄',
|
|
253
|
+
icon: '',
|
|
254
|
+
duration: 1000,
|
|
255
|
+
});
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
let { selectedSku } = this;
|
|
260
|
+
const { specList } = this.properties;
|
|
261
|
+
selectedSku =
|
|
262
|
+
selectedSku[specId] === id ? { ...this.selectedSku, [specId]: '' } : { ...this.selectedSku, [specId]: id };
|
|
263
|
+
specList.forEach((item) => {
|
|
264
|
+
item.specValueList.forEach((valuesItem) => {
|
|
265
|
+
if (item.specId === specId) {
|
|
266
|
+
valuesItem.isSelected = valuesItem.specValueId === selectedSku[specId];
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
this.chooseSpecValueId(id, specId);
|
|
271
|
+
const isAllSelectedSku = this.isAllSelected(specList, selectedSku);
|
|
272
|
+
if (!isAllSelectedSku) {
|
|
273
|
+
this.setData({
|
|
274
|
+
selectSkuSellsPrice: 0,
|
|
275
|
+
selectSkuImg: '',
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
this.setData({
|
|
279
|
+
specList,
|
|
280
|
+
isAllSelectedSku,
|
|
281
|
+
});
|
|
282
|
+
this.selectedSku = selectedSku;
|
|
283
|
+
this.triggerEvent('change', {
|
|
284
|
+
specList,
|
|
285
|
+
selectedSku,
|
|
286
|
+
isAllSelectedSku,
|
|
287
|
+
});
|
|
288
|
+
},
|
|
289
|
+
|
|
290
|
+
// 判断是否所有的sku都已经选中
|
|
291
|
+
isAllSelected(skuTree, selectedSku) {
|
|
292
|
+
const selected = Object.keys(selectedSku).filter((skuKeyStr) => selectedSku[skuKeyStr] !== '');
|
|
293
|
+
return skuTree.length === selected.length;
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
handlePopupHide() {
|
|
297
|
+
this.triggerEvent('closeSpecsPopup', {
|
|
298
|
+
show: false,
|
|
299
|
+
});
|
|
300
|
+
},
|
|
301
|
+
|
|
302
|
+
specsConfirm() {
|
|
303
|
+
const { isStock } = this.properties;
|
|
304
|
+
if (!isStock) return;
|
|
305
|
+
this.triggerEvent('specsConfirm');
|
|
306
|
+
},
|
|
307
|
+
|
|
308
|
+
addCart() {
|
|
309
|
+
const { isStock } = this.properties;
|
|
310
|
+
if (!isStock) return;
|
|
311
|
+
this.triggerEvent('addCart');
|
|
312
|
+
},
|
|
313
|
+
|
|
314
|
+
buyNow() {
|
|
315
|
+
const { isAllSelectedSku } = this.data;
|
|
316
|
+
const { isStock } = this.properties;
|
|
317
|
+
if (!isStock) return;
|
|
318
|
+
this.triggerEvent('buyNow', {
|
|
319
|
+
isAllSelectedSku,
|
|
320
|
+
});
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
// 总处理
|
|
324
|
+
setBuyNum(buyNum) {
|
|
325
|
+
this.setData({
|
|
326
|
+
buyNum,
|
|
327
|
+
});
|
|
328
|
+
this.triggerEvent('changeNum', {
|
|
329
|
+
buyNum,
|
|
330
|
+
});
|
|
331
|
+
},
|
|
332
|
+
|
|
333
|
+
handleBuyNumChange(e) {
|
|
334
|
+
const { value } = e.detail;
|
|
335
|
+
this.setData({
|
|
336
|
+
buyNum: value,
|
|
337
|
+
});
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
});
|
|
341
|
+
</script>
|
|
342
|
+
|
|
343
|
+
<template>
|
|
344
|
+
<t-popup visible="{{show}}" placement="bottom" bind:visible-change="handlePopupHide">
|
|
345
|
+
<view class="popup-container [background-color:#ffffff] [position:relative] [z-index:100] [border-radius:16rpx_16rpx_0_0] [padding-bottom:calc(env(safe-area-inset-bottom)_+_20rpx)] [&_.popup-close]:[position:absolute] [&_.popup-close]:[right:30rpx] [&_.popup-close]:[top:30rpx] [&_.popup-close]:[z-index:9] [&_.popup-close]:[color:#999999] [&_.single-confirm-btn]:[border-radius:48rpx] [&_.single-confirm-btn]:[color:#ffffff] [&_.single-confirm-btn]:[margin:0_32rpx] [&_.single-confirm-btn]:[font-size:32rpx] [&_.single-confirm-btn]:[height:80rpx] [&_.single-confirm-btn]:[text-align:center] [&_.single-confirm-btn]:[line-height:88rpx] [&_.single-confirm-btn]:[background-color:#fa4126] [&_.single-confirm-btn_.disabled]:[font-size:32rpx] [&_.single-confirm-btn_.disabled]:[color:#fff] [&_.single-confirm-btn_.disabled]:[background-color:#dddddd]">
|
|
346
|
+
<view class="popup-close" bindtap="handlePopupHide">
|
|
347
|
+
<t-icon name="close" size="36rpx" />
|
|
348
|
+
</view>
|
|
349
|
+
<view class="popup-sku-header [display:flex] [padding:30rpx_28rpx_0_30rpx] [&_.popup-sku-header__img]:[width:176rpx] [&_.popup-sku-header__img]:[height:176rpx] [&_.popup-sku-header__img]:[border-radius:8rpx] [&_.popup-sku-header__img]:[background:#d8d8d8] [&_.popup-sku-header__img]:[margin-right:24rpx] [&_.popup-sku-header__goods-info]:[position:relative] [&_.popup-sku-header__goods-info]:[width:500rpx] [&_.popup-sku-header__goods-info_.popup-sku__goods-name]:[font-size:28rpx] [&_.popup-sku-header__goods-info_.popup-sku__goods-name]:[line-height:40rpx] [&_.popup-sku-header__goods-info_.popup-sku__goods-name]:[display:-webkit-box] [&_.popup-sku-header__goods-info_.popup-sku__goods-name]:[-webkit-line-clamp:2] [&_.popup-sku-header__goods-info_.popup-sku__goods-name]:[-webkit-box-orient:vertical] [&_.popup-sku-header__goods-info_.popup-sku__goods-name]:[white-space:normal] [&_.popup-sku-header__goods-info_.popup-sku__goods-name]:[overflow:hidden] [&_.popup-sku-header__goods-info_.popup-sku__goods-name]:[width:430rpx] [&_.popup-sku-header__goods-info_.popup-sku__goods-name]:[text-overflow:ellipsis] [&_.popup-sku-header__goods-info_.popup-sku__selected-spec]:[display:flex] [&_.popup-sku-header__goods-info_.popup-sku__selected-spec]:[color:#333333] [&_.popup-sku-header__goods-info_.popup-sku__selected-spec]:[font-size:26rpx] [&_.popup-sku-header__goods-info_.popup-sku__selected-spec]:[line-height:36rpx] [&_.popup-sku-header__goods-info_.popup-sku__selected-spec_.popup-sku__selected-item]:[margin-right:10rpx]">
|
|
350
|
+
<t-image t-class="popup-sku-header__img" src="{{src}}" />
|
|
351
|
+
<view class="popup-sku-header__goods-info">
|
|
352
|
+
<view class="popup-sku__goods-name">{{title}}</view>
|
|
353
|
+
<view class="goods-price-container">
|
|
354
|
+
<slot name="goods-price" />
|
|
355
|
+
</view>
|
|
356
|
+
<!-- 已选规格 -->
|
|
357
|
+
<view class="popup-sku__selected-spec">
|
|
358
|
+
<view>选择:</view>
|
|
359
|
+
<view wx:for="{{specList}}" wx:key="specId">
|
|
360
|
+
<view
|
|
361
|
+
class="popup-sku__selected-item"
|
|
362
|
+
wx:for="{{item.specValueList}}"
|
|
363
|
+
wx:for-item="selectedItem"
|
|
364
|
+
wx:if="{{selectedItem.isSelected}}"
|
|
365
|
+
wx:key="specValueId"
|
|
366
|
+
>
|
|
367
|
+
{{selectedItem.specValue}}
|
|
368
|
+
</view>
|
|
369
|
+
</view>
|
|
370
|
+
</view>
|
|
371
|
+
</view>
|
|
372
|
+
</view>
|
|
373
|
+
<view class="popup-sku-body [margin:0_30rpx_40rpx] [max-height:600rpx] [overflow-y:scroll] [-webkit-overflow-scrolling:touch] [&_.popup-sku-group-container_.popup-sku-row]:[padding:32rpx_0] [&_.popup-sku-group-container_.popup-sku-row]:[border-bottom:1rpx_solid_#f5f5f5] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__title]:[font-size:26rpx] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__title]:[color:#333] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__item]:[font-size:24rpx] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__item]:[color:#333] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__item]:[min-width:128rpx] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__item]:[height:56rpx] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__item]:[background-color:#f5f5f5] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__item]:[border-radius:8rpx] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__item]:[border:2rpx_solid_#f5f5f5] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__item]:[margin:19rpx_26rpx_0_0] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__item]:[padding:0_16rpx] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__item]:[display:inline-flex] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__item]:[align-items:center] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__item]:[justify-content:center] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__item_.popup-sku-row__item--active]:[border:2rpx_solid_#fa4126] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__item_.popup-sku-row__item--active]:[color:#fa4126] [&_.popup-sku-group-container_.popup-sku-row_.popup-sku-row__item_.popup-sku-row__item--active]:[background:rgba(255,_95,_21,_0.04)] [&_.popup-sku-group-container_.popup-sku-row_.disabled-sku-selected]:[background:#f5f5f5] [&_.popup-sku-group-container_.popup-sku-row_.disabled-sku-selected]:[color:#cccccc] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container]:[display:flex] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container]:[align-items:center] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container]:[justify-content:space-between] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container]:[margin:40rpx_0] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-sku__stepper-title]:[display:flex] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-sku__stepper-title]:[font-size:26rpx] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-sku__stepper-title]:[color:#333] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-sku__stepper-title_.limit-text]:[margin-left:10rpx] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-sku__stepper-title_.limit-text]:[color:#999999] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper]:[display:flex] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper]:[flex-flow:row_nowrap] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper]:[align-items:center] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper]:[font-size:28px] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper]:[height:48rpx] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper]:[line-height:62rpx] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-btn]:[position:relative] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-btn]:[height:100%] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-btn]:[text-align:center] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-btn]:[background-color:#f5f5f5] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-btn]:[border-radius:4rpx] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-num-wrap]:[position:relative] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-num-wrap]:[height:100%] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-num-wrap]:[text-align:center] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-num-wrap]:[background-color:#f5f5f5] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-num-wrap]:[border-radius:4rpx] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-num-wrap]:[color:#282828] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-num-wrap]:[display:flex] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-num-wrap]:[max-width:76rpx] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-num-wrap]:[align-items:center] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-num-wrap]:[justify-content:space-between] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-num-wrap_.input-num]:[height:100%] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-num-wrap_.input-num]:[width:auto] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-num-wrap_.input-num]:[font-weight:600] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-num-wrap_.input-num]:[font-size:30rpx] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.input-btn]:[width:48rpx] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.popup-stepper__minus]:[margin-right:4rpx] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.popup-stepper__minus]:[border-radius:4rpx] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.popup-stepper__minus]:[color:#9a979b] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.popup-stepper__minus]:[display:flex] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.popup-stepper__minus]:[align-items:center] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.popup-stepper__minus]:[justify-content:center] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.popup-stepper__plus]:[margin-left:4rpx] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.popup-stepper__plus]:[border-radius:4rpx] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.popup-stepper__plus]:[color:#9a979b] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.popup-stepper__plus]:[display:flex] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.popup-stepper__plus]:[align-items:center] [&_.popup-sku-stepper-stock_.popup-sku-stepper-container_.popup-stepper_.popup-stepper__plus]:[justify-content:center]">
|
|
374
|
+
<view class="popup-sku-group-container">
|
|
375
|
+
<view class="popup-sku-row" wx:for="{{specList}}" wx:key="specId">
|
|
376
|
+
<view class="popup-sku-row__title">{{item.title}}</view>
|
|
377
|
+
<block
|
|
378
|
+
wx:for="{{item.specValueList}}"
|
|
379
|
+
wx:for-item="valuesItem"
|
|
380
|
+
wx:for-index="valuesIndex"
|
|
381
|
+
wx:key="specValueId"
|
|
382
|
+
>
|
|
383
|
+
<view
|
|
384
|
+
class="popup-sku-row__item {{valuesItem.isSelected ? 'popup-sku-row__item--active' : ''}} {{!valuesItem.hasStockObj.hasStock || !isStock ? 'disabled-sku-selected' : ''}}"
|
|
385
|
+
data-specid="{{item.specId}}"
|
|
386
|
+
data-id="{{valuesItem.specValueId}}"
|
|
387
|
+
data-val="{{valuesItem.specValue}}"
|
|
388
|
+
data-hasStock="{{valuesItem.hasStockObj.hasStock}}"
|
|
389
|
+
bindtap="toChooseItem"
|
|
390
|
+
>
|
|
391
|
+
{{valuesItem.specValue}}
|
|
392
|
+
</view>
|
|
393
|
+
</block>
|
|
394
|
+
</view>
|
|
395
|
+
</view>
|
|
396
|
+
<view class="popup-sku-stepper-stock">
|
|
397
|
+
<view class="popup-sku-stepper-container">
|
|
398
|
+
<view class="popup-sku__stepper-title">
|
|
399
|
+
购买数量
|
|
400
|
+
<view class="limit-text" wx:if="{{limitBuyInfo}}"> ({{limitBuyInfo}}) </view>
|
|
401
|
+
</view>
|
|
402
|
+
<t-stepper value="{{buyNum}}" min="{{1}}" max="{{2}}" theme="filled" bind:change="handleBuyNumChange" />
|
|
403
|
+
</view>
|
|
404
|
+
</view>
|
|
405
|
+
</view>
|
|
406
|
+
<view wx:if="{{outOperateStatus}}" class="single-confirm-btn {{!isStock ? 'disabled' : ''}}" bindtap="specsConfirm">
|
|
407
|
+
确定
|
|
408
|
+
</view>
|
|
409
|
+
<view
|
|
410
|
+
class="popup-sku-actions flex flex-between {{!isStock ? 'popup-sku-disabled' : ''}} [font-size:32rpx] [height:80rpx] [text-align:center] [line-height:80rpx] [padding:0_20rpx] [&_.sku-operate]:[height:80rpx] [&_.sku-operate]:[width:50%] [&_.sku-operate]:[color:#fff] [&_.sku-operate]:[border-radius:48rpx] [&_.sku-operate_.sku-operate-addCart]:[background-color:#ffece9] [&_.sku-operate_.sku-operate-addCart]:[color:#fa4126] [&_.sku-operate_.sku-operate-addCart]:[border-radius:48rpx_0_0_48rpx] [&_.sku-operate_.sku-operate-addCart_.disabled]:[background:rgb(221,_221,_221)] [&_.sku-operate_.sku-operate-addCart_.disabled]:[color:#fff] [&_.sku-operate_.sku-operate-buyNow]:[background-color:#fa4126] [&_.sku-operate_.sku-operate-buyNow]:[border-radius:0_48rpx_48rpx_0] [&_.sku-operate_.sku-operate-buyNow_.disabled]:[color:#fff] [&_.sku-operate_.sku-operate-buyNow_.disabled]:[background:rgb(198,_198,_198)] [&_.sku-operate_.selected-sku-btn]:[width:100%]"
|
|
411
|
+
wx:if="{{!outOperateStatus}}"
|
|
412
|
+
>
|
|
413
|
+
<view class="sku-operate">
|
|
414
|
+
<view class="selected-sku-btn sku-operate-addCart {{!isStock ? 'disabled' : ''}}" bindtap="addCart">
|
|
415
|
+
加入购物车
|
|
416
|
+
</view>
|
|
417
|
+
</view>
|
|
418
|
+
<view class="sku-operate">
|
|
419
|
+
<view class="selected-sku-btn sku-operate-buyNow {{!isStock ? 'disabled' : ''}}" bindtap="buyNow">
|
|
420
|
+
立即购买
|
|
421
|
+
</view>
|
|
422
|
+
</view>
|
|
423
|
+
</view>
|
|
424
|
+
<slot name="bottomSlot" />
|
|
425
|
+
</view>
|
|
426
|
+
</t-popup>
|
|
427
|
+
<t-toast id="t-toast" />
|
|
428
|
+
</template>
|
|
429
|
+
|
|
430
|
+
<json>
|
|
431
|
+
{
|
|
432
|
+
"component": true,
|
|
433
|
+
"usingComponents": {
|
|
434
|
+
"t-popup": "tdesign-miniprogram/popup/popup",
|
|
435
|
+
"t-icon": "tdesign-miniprogram/icon/icon",
|
|
436
|
+
"t-image": "/components/webp-image/index",
|
|
437
|
+
"t-stepper": "tdesign-miniprogram/stepper/stepper",
|
|
438
|
+
"t-toast": "tdesign-miniprogram/toast/toast"
|
|
439
|
+
}
|
|
440
|
+
}</json>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
Component({
|
|
3
|
+
options: {
|
|
4
|
+
multipleSlots: true,
|
|
5
|
+
},
|
|
6
|
+
|
|
7
|
+
properties: {
|
|
8
|
+
list: Array,
|
|
9
|
+
title: {
|
|
10
|
+
type: String,
|
|
11
|
+
value: '促销说明',
|
|
12
|
+
},
|
|
13
|
+
show: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
// data: {
|
|
19
|
+
// list: [],
|
|
20
|
+
// },
|
|
21
|
+
|
|
22
|
+
methods: {
|
|
23
|
+
change(e) {
|
|
24
|
+
const { index } = e.currentTarget.dataset;
|
|
25
|
+
this.triggerEvent('promotionChange', {
|
|
26
|
+
index,
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
closePromotionPopup() {
|
|
31
|
+
this.triggerEvent('closePromotionPopup', {
|
|
32
|
+
show: false,
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<template>
|
|
40
|
+
<t-popup visible="{{show}}" placement="bottom" bind:visible-change="closePromotionPopup">
|
|
41
|
+
<view class="promotion-popup-container [background-color:#ffffff] [position:relative] [z-index:100] [border-radius:16rpx_16rpx_0_0] [&_.promotion-popup-close]:[position:absolute] [&_.promotion-popup-close]:[right:30rpx] [&_.promotion-popup-close]:[top:30rpx] [&_.promotion-popup-close]:[z-index:9] [&_.promotion-popup-close]:[color:rgba(153,_153,_153,_1)] [&_.promotion-popup-close_.market]:[font-size:25rpx] [&_.promotion-popup-close_.market]:[color:#999] [&_.promotion-popup-title]:[height:100rpx] [&_.promotion-popup-title]:[position:relative] [&_.promotion-popup-title]:[display:flex] [&_.promotion-popup-title]:[align-items:center] [&_.promotion-popup-title]:[justify-content:center] [&_.promotion-popup-title]:[font-size:32rpx] [&_.promotion-popup-title]:[color:#222427] [&_.promotion-popup-title]:[font-weight:600] [&_.promotion-popup-content]:[min-height:400rpx] [&_.promotion-popup-content]:[max-height:600rpx] [&_.promotion-popup-content]:[padding-bottom:calc(env(safe-area-inset-bottom)_+_20rpx)] [&_.promotion-popup-content]:[overflow-y:scroll] [&_.promotion-popup-content]:[-webkit-overflow-scrolling:touch] [&_.promotion-popup-content_.promotion-detail-list]:[margin:0_30rpx] [&_.promotion-popup-content_.promotion-detail-list_.list-item:last-child]:[margin-bottom:env(safe-area-inset-bottom)] [&_.promotion-popup-content_.promotion-detail-list_.list-item:last-child]:[border-bottom:0] [&_.promotion-popup-content_.promotion-detail-list_.list-item:last-child]:[padding-bottom:calc(28rpx_+_env(safe-area-inset-bottom))] [&_.promotion-popup-content_.promotion-detail-list_.list-item]:[display:flex] [&_.promotion-popup-content_.promotion-detail-list_.list-item]:[justify-content:space-between] [&_.promotion-popup-content_.promotion-detail-list_.list-item]:[padding:10rpx_0_28rpx] [&_.promotion-popup-content_.promotion-detail-list_.list-item]:[position:relative] [&_.promotion-popup-content_.promotion-detail-list_.list-item]:[font-size:24rpx] [&_.promotion-popup-content_.promotion-detail-list_.list-item]:[color:#222427] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.tag]:[box-sizing:border-box] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.tag]:[font-size:20rpx] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.tag]:[line-height:32rpx] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.tag]:[padding:2rpx_12rpx] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.tag]:[background-color:#ffece9] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.tag]:[margin-right:16rpx] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.tag]:[display:inline-flex] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.tag]:[color:#fa4126] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.tag]:[border-radius:54rpx] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.tag]:[flex-shrink:0] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.tag]:[position:relative] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.tag]:[top:2rpx] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.content]:[font-size:28rpx] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.content]:[color:#222427] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.content]:[flex:1] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.content]:[line-height:40rpx] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.content]:[display:flex] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.content_.list-content]:[width:440rpx] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.content_.list-content]:[white-space:nowrap] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.content_.list-content]:[text-overflow:ellipsis] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.content_.list-content]:[overflow:hidden] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.content_.list-content]:[display:inline-block] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.collect-btn]:[font-size:24rpx] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.collect-btn]:[flex-shrink:0] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.collect-btn]:[margin-left:20rpx] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.collect-btn]:[display:flex] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.collect-btn]:[align-items:center] [&_.promotion-popup-content_.promotion-detail-list_.list-item_.collect-btn_.linkText]:[margin-right:8rpx]">
|
|
42
|
+
<view class="promotion-popup-close" bindtap="closePromotionPopup">
|
|
43
|
+
<t-icon name="close" size="36rpx" />
|
|
44
|
+
</view>
|
|
45
|
+
<view class="promotion-popup-title">
|
|
46
|
+
<view class="title">{{title}}</view>
|
|
47
|
+
</view>
|
|
48
|
+
<view class="promotion-popup-content">
|
|
49
|
+
<view class="promotion-detail-list">
|
|
50
|
+
<view
|
|
51
|
+
class="list-item"
|
|
52
|
+
wx:for="{{list}}"
|
|
53
|
+
wx:key="index"
|
|
54
|
+
bindtap="change"
|
|
55
|
+
data-index="{{index}}"
|
|
56
|
+
>
|
|
57
|
+
<view class="tag">{{item.tag}}</view>
|
|
58
|
+
<view class="content">
|
|
59
|
+
<text class="list-content">{{item.label ? item.label : ''}}</text>
|
|
60
|
+
</view>
|
|
61
|
+
<t-icon
|
|
62
|
+
class="collect-btn"
|
|
63
|
+
name="chevron-right"
|
|
64
|
+
size="40rpx"
|
|
65
|
+
color="#bbb"
|
|
66
|
+
/>
|
|
67
|
+
</view>
|
|
68
|
+
</view>
|
|
69
|
+
</view>
|
|
70
|
+
<slot name="promotion-bottom" />
|
|
71
|
+
</view>
|
|
72
|
+
</t-popup>
|
|
73
|
+
|
|
74
|
+
</template>
|
|
75
|
+
|
|
76
|
+
<json>
|
|
77
|
+
{
|
|
78
|
+
"component": true,
|
|
79
|
+
"usingComponents": {
|
|
80
|
+
"t-popup": "tdesign-miniprogram/popup/popup",
|
|
81
|
+
"t-icon": "tdesign-miniprogram/icon/icon"
|
|
82
|
+
}
|
|
83
|
+
}</json>
|