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,334 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
Component({
|
|
3
|
+
options: {
|
|
4
|
+
multipleSlots: true, // 在组件定义时的选项中启用多slot支持
|
|
5
|
+
addGlobalClass: true,
|
|
6
|
+
},
|
|
7
|
+
intersectionObserverContext: null,
|
|
8
|
+
|
|
9
|
+
externalClasses: [
|
|
10
|
+
'card-class',
|
|
11
|
+
'title-class',
|
|
12
|
+
'desc-class',
|
|
13
|
+
'num-class',
|
|
14
|
+
'thumb-class',
|
|
15
|
+
'specs-class',
|
|
16
|
+
'price-class',
|
|
17
|
+
'origin-price-class',
|
|
18
|
+
'price-prefix-class',
|
|
19
|
+
],
|
|
20
|
+
|
|
21
|
+
properties: {
|
|
22
|
+
hidden: {
|
|
23
|
+
// 设置为null代表不做类型转换
|
|
24
|
+
type: null,
|
|
25
|
+
value: false,
|
|
26
|
+
observer(hidden) {
|
|
27
|
+
// null就是代表没有设置,没有设置的话不setData,防止祖先组件触发的setHidden操作被覆盖
|
|
28
|
+
if (hidden !== null) {
|
|
29
|
+
this.setHidden(!!hidden);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
id: {
|
|
34
|
+
type: String,
|
|
35
|
+
// `goods-card-88888888`
|
|
36
|
+
// 不能在这里写生成逻辑,如果在这里写,那么假设有多个goods-list时,他们将共享这个值
|
|
37
|
+
value: '',
|
|
38
|
+
observer: (id) => {
|
|
39
|
+
this.genIndependentID(id);
|
|
40
|
+
if (this.properties.thresholds?.length) {
|
|
41
|
+
this.createIntersectionObserverHandle();
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
data: {
|
|
46
|
+
type: Object,
|
|
47
|
+
observer(goods) {
|
|
48
|
+
// 有ID的商品才渲染
|
|
49
|
+
if (!goods) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** 划线价是否有效 */
|
|
54
|
+
let isValidityLinePrice = true;
|
|
55
|
+
// 判断一次划线价格是否合理
|
|
56
|
+
if (
|
|
57
|
+
goods.originPrice &&
|
|
58
|
+
goods.price &&
|
|
59
|
+
goods.originPrice < goods.price
|
|
60
|
+
) {
|
|
61
|
+
isValidityLinePrice = false;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 敲定换行数量默认值
|
|
65
|
+
if (goods.lineClamp === undefined || goods.lineClamp <= 0) {
|
|
66
|
+
// tag数组长度 大于0 且 可见
|
|
67
|
+
// 指定换行为1行
|
|
68
|
+
if ((goods.tags?.length || 0) > 0 && !goods.hideKey?.tags) {
|
|
69
|
+
goods.lineClamp = 1;
|
|
70
|
+
} else {
|
|
71
|
+
goods.lineClamp = 2;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
this.setData({ goods, isValidityLinePrice });
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
layout: {
|
|
79
|
+
type: String,
|
|
80
|
+
value: 'horizontal',
|
|
81
|
+
},
|
|
82
|
+
thumbMode: {
|
|
83
|
+
type: String,
|
|
84
|
+
value: 'aspectFill',
|
|
85
|
+
},
|
|
86
|
+
priceFill: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
value: true,
|
|
89
|
+
},
|
|
90
|
+
currency: {
|
|
91
|
+
type: String,
|
|
92
|
+
value: '¥',
|
|
93
|
+
},
|
|
94
|
+
lazyLoad: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
value: false,
|
|
97
|
+
},
|
|
98
|
+
centered: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
value: false,
|
|
101
|
+
},
|
|
102
|
+
pricePrefix: {
|
|
103
|
+
type: String,
|
|
104
|
+
value: '',
|
|
105
|
+
},
|
|
106
|
+
/** 元素可见监控阈值, 数组长度大于0就创建 */
|
|
107
|
+
thresholds: {
|
|
108
|
+
type: Array,
|
|
109
|
+
value: [],
|
|
110
|
+
observer(current) {
|
|
111
|
+
if (current && current.length) {
|
|
112
|
+
this.createIntersectionObserverHandle();
|
|
113
|
+
} else {
|
|
114
|
+
this.clearIntersectionObserverHandle();
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
specsIconClassPrefix: {
|
|
119
|
+
type: String,
|
|
120
|
+
value: 'wr',
|
|
121
|
+
},
|
|
122
|
+
specsIcon: {
|
|
123
|
+
type: String,
|
|
124
|
+
value: 'expand_more',
|
|
125
|
+
},
|
|
126
|
+
addCartIconClassPrefix: {
|
|
127
|
+
type: String,
|
|
128
|
+
value: 'wr',
|
|
129
|
+
},
|
|
130
|
+
addCartIcon: {
|
|
131
|
+
type: String,
|
|
132
|
+
value: 'cart',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
data: {
|
|
137
|
+
hiddenInData: false,
|
|
138
|
+
independentID: '',
|
|
139
|
+
goods: { id: '' },
|
|
140
|
+
/** 保证划线价格不小于原价,否则不渲染划线价 */
|
|
141
|
+
isValidityLinePrice: false,
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
lifetimes: {
|
|
145
|
+
ready() {
|
|
146
|
+
this.init();
|
|
147
|
+
},
|
|
148
|
+
detached() {
|
|
149
|
+
this.clear();
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
methods: {
|
|
154
|
+
clickHandle() {
|
|
155
|
+
this.triggerEvent('click', { goods: this.data.goods });
|
|
156
|
+
},
|
|
157
|
+
clickThumbHandle() {
|
|
158
|
+
this.triggerEvent('thumb', { goods: this.data.goods });
|
|
159
|
+
},
|
|
160
|
+
clickSpecsHandle() {
|
|
161
|
+
this.triggerEvent('specs', { goods: this.data.goods });
|
|
162
|
+
},
|
|
163
|
+
clickTagHandle(evt) {
|
|
164
|
+
const { index } = evt.currentTarget.dataset;
|
|
165
|
+
this.triggerEvent('tag', { goods: this.data.goods, index });
|
|
166
|
+
},
|
|
167
|
+
// 加入购物车
|
|
168
|
+
addCartHandle(e) {
|
|
169
|
+
const { id } = e.currentTarget;
|
|
170
|
+
const { id: cardID } = e.currentTarget.dataset;
|
|
171
|
+
this.triggerEvent('add-cart', {
|
|
172
|
+
...e.detail,
|
|
173
|
+
id,
|
|
174
|
+
cardID,
|
|
175
|
+
goods: this.data.goods,
|
|
176
|
+
});
|
|
177
|
+
},
|
|
178
|
+
genIndependentID(id, cb) {
|
|
179
|
+
let independentID;
|
|
180
|
+
if (id) {
|
|
181
|
+
independentID = id;
|
|
182
|
+
} else {
|
|
183
|
+
independentID = `goods-card-${~~(Math.random() * 10 ** 8)}`;
|
|
184
|
+
}
|
|
185
|
+
this.setData({ independentID }, cb);
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
init() {
|
|
189
|
+
const { thresholds, id, hidden } = this.properties;
|
|
190
|
+
if (hidden !== null) {
|
|
191
|
+
this.setHidden(!!hidden);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
this.genIndependentID(id || '', () => {
|
|
195
|
+
if (thresholds && thresholds.length) {
|
|
196
|
+
this.createIntersectionObserverHandle();
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
clear() {
|
|
202
|
+
this.clearIntersectionObserverHandle();
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
setHidden(hidden) {
|
|
206
|
+
this.setData({ hiddenInData: !!hidden });
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
createIntersectionObserverHandle() {
|
|
210
|
+
if (this.intersectionObserverContext || !this.data.independentID) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
this.intersectionObserverContext = wx
|
|
215
|
+
.createIntersectionObserver(this, {
|
|
216
|
+
thresholds: this.properties.thresholds,
|
|
217
|
+
})
|
|
218
|
+
.relativeToViewport();
|
|
219
|
+
|
|
220
|
+
this.intersectionObserverContext.observe(
|
|
221
|
+
`#${this.data.independentID}`,
|
|
222
|
+
(res) => {
|
|
223
|
+
this.intersectionObserverCB(res);
|
|
224
|
+
},
|
|
225
|
+
);
|
|
226
|
+
},
|
|
227
|
+
intersectionObserverCB(ob) {
|
|
228
|
+
this.triggerEvent('ob', {
|
|
229
|
+
goods: this.data.goods,
|
|
230
|
+
context: this.intersectionObserverContext,
|
|
231
|
+
ob,
|
|
232
|
+
});
|
|
233
|
+
},
|
|
234
|
+
clearIntersectionObserverHandle() {
|
|
235
|
+
if (this.intersectionObserverContext) {
|
|
236
|
+
try {
|
|
237
|
+
this.intersectionObserverContext.disconnect();
|
|
238
|
+
} catch (e) {}
|
|
239
|
+
|
|
240
|
+
this.intersectionObserverContext = null;
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
});
|
|
245
|
+
</script>
|
|
246
|
+
|
|
247
|
+
<template>
|
|
248
|
+
<view
|
|
249
|
+
id="{{independentID}}"
|
|
250
|
+
class="wr-goods-card card-class {{ layout }} {{ centered ? 'center' : ''}} [box-sizing:border-box] [font-size:24rpx] [&_.center_.wr-goods-card__main]:[align-items:flex-start] [&_.center_.wr-goods-card__main]:[justify-content:center] [&_.horizontal-wrap_.wr-goods-card__thumb]:[width:192rpx] [&_.horizontal-wrap_.wr-goods-card__thumb]:[height:192rpx] [&_.horizontal-wrap_.wr-goods-card__thumb]:[border-radius:8rpx] [&_.horizontal-wrap_.wr-goods-card__thumb]:[overflow:hidden] [&_.horizontal-wrap_.wr-goods-card__body]:[flex-direction:column] [&_.horizontal-wrap_.wr-goods-card__short_content]:[flex-direction:row] [&_.horizontal-wrap_.wr-goods-card__short_content]:[align-items:center] [&_.horizontal-wrap_.wr-goods-card__short_content]:[margin:16rpx_0_0_0] [&_.horizontal-wrap_.wr-goods-card__num]:[margin:0_0_0_auto] [&_.vertical_.wr-goods-card__main]:[padding:0_0_22rpx_0] [&_.vertical_.wr-goods-card__main]:[flex-direction:column] [&_.vertical_.wr-goods-card__thumb]:[width:340rpx] [&_.vertical_.wr-goods-card__thumb]:[height:340rpx] [&_.vertical_.wr-goods-card__body]:[margin:20rpx_20rpx_0_20rpx] [&_.vertical_.wr-goods-card__body]:[flex-direction:column] [&_.vertical_.wr-goods-card__long_content]:[overflow:hidden] [&_.vertical_.wr-goods-card__title]:[line-height:36rpx] [&_.vertical_.wr-goods-card__short_content]:[margin:20rpx_0_0_0] [&_.vertical_.wr-goods-card__price]:[order:2] [&_.vertical_.wr-goods-card__price]:[color:#fa4126] [&_.vertical_.wr-goods-card__price]:[margin:20rpx_0_0_0] [&_.vertical_.wr-goods-card__origin-price]:[order:1] [&_.vertical_.wr-goods-card__add-cart]:[position:absolute] [&_.vertical_.wr-goods-card__add-cart]:[bottom:20rpx] [&_.vertical_.wr-goods-card__add-cart]:[right:20rpx]"
|
|
251
|
+
bind:tap="clickHandle"
|
|
252
|
+
data-goods="{{ goods }}"
|
|
253
|
+
hidden="{{hiddenInData}}"
|
|
254
|
+
>
|
|
255
|
+
<view class="wr-goods-card__main [position:relative] [display:flex] [padding:0] [background:transparent]">
|
|
256
|
+
<view class="wr-goods-card__thumb thumb-class [flex-shrink:0] [position:relative] [width:140rpx] [height:140rpx] [&:empty]:[display:none] [&:empty]:[margin:0]" bind:tap="clickThumbHandle">
|
|
257
|
+
<!-- data-src 是方便加购动画读取图片用的 -->
|
|
258
|
+
<t-image
|
|
259
|
+
t-class="wr-goods-card__thumb-com [width:192rpx] [height:192rpx] [border-radius:8rpx] [overflow:hidden]"
|
|
260
|
+
wx:if="{{ !!goods.thumb && !goods.hideKey.thumb }}"
|
|
261
|
+
src="{{ goods.thumb }}"
|
|
262
|
+
mode="{{ thumbMode }}"
|
|
263
|
+
lazy-load="{{ lazyLoad }}"
|
|
264
|
+
/>
|
|
265
|
+
<slot name="thumb-cover" />
|
|
266
|
+
</view>
|
|
267
|
+
<view class="wr-goods-card__body [display:flex] [margin:0_0_0_20rpx] [flex-direction:row] [flex:1_1_auto] [min-height:192rpx]">
|
|
268
|
+
<view class="wr-goods-card__long_content [display:flex] [flex-direction:column] [overflow:hidden] [flex:1_1_auto] [&_.goods_tips]:[width:100%] [&_.goods_tips]:[margin-top:16rpx] [&_.goods_tips]:[text-align:right] [&_.goods_tips]:[color:#fa4126] [&_.goods_tips]:[font-size:24rpx] [&_.goods_tips]:[line-height:32rpx] [&_.goods_tips]:[font-weight:bold]">
|
|
269
|
+
<view wx:if="{{ goods.title && !goods.hideKey.title }}" class="wr-goods-card__title title-class [flex-shrink:0] [font-size:28rpx] [color:#333] [line-height:40rpx] [font-weight:400] [display:-webkit-box] [-webkit-box-orient:vertical] [overflow:hidden] [word-break:break-word]" style="-webkit-line-clamp: {{ goods.lineClamp }};">
|
|
270
|
+
<slot name="before-title" />
|
|
271
|
+
{{ goods.title }}
|
|
272
|
+
</view>
|
|
273
|
+
<slot name="after-title" />
|
|
274
|
+
<view wx:if="{{ goods.desc && !goods.hideKey.desc }}" class="wr-goods-card__desc desc-class [font-size:24rpx] [color:#f5f5f5] [line-height:40rpx] [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2] [overflow:hidden]">{{ goods.desc }}</view>
|
|
275
|
+
<slot name="after-desc" />
|
|
276
|
+
<view wx:if="{{ goods.specs && goods.specs.length > 0 && !goods.hideKey.specs }}" class="wr-goods-card__specs__desc specs-class [font-size:24rpx] [height:32rpx] [line-height:32rpx] [color:#999999] [margin:8rpx_0] [display:flex] [align-self:flex-start] [flex-direction:row] [background:#f5f5f5] [border-radius:8rpx] [padding:4rpx_8rpx]" bind:tap="clickSpecsHandle">
|
|
277
|
+
<view class="wr-goods-card__specs__desc-text [height:100%] [max-width:380rpx] [word-break:break-all] [overflow:hidden] [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:1]">{{ goods.specs }}</view>
|
|
278
|
+
<t-icon name="chevron-down" size="32rpx" color="#999999" />
|
|
279
|
+
</view>
|
|
280
|
+
<view class="goods_tips" wx:if="{{goods.stockQuantity !== 0 && goods.quantity >= goods.stockQuantity}}">库存不足</view>
|
|
281
|
+
</view>
|
|
282
|
+
<view class="wr-goods-card__short_content [display:flex] [flex-direction:column] [justify-content:flex-start] [align-items:flex-end] [margin:0_0_0_46rpx] [&_.no_storage]:[display:flex] [&_.no_storage]:[align-items:center] [&_.no_storage]:[justify-content:space-between] [&_.no_storage]:[height:40rpx] [&_.no_storage]:[color:#333] [&_.no_storage]:[font-size:24rpx] [&_.no_storage]:[line-height:32rpx] [&_.no_storage]:[width:100%]">
|
|
283
|
+
<block wx:if="{{goods.stockQuantity !== 0}}">
|
|
284
|
+
<view wx:if="{{ pricePrefix }}" class="wr-goods-card__price__prefix price-prefix-class [order:0] [color:#666] [margin:0]">{{ pricePrefix }}</view>
|
|
285
|
+
<slot name="price-prefix" />
|
|
286
|
+
<view wx:if="{{ goods.price && !goods.hideKey.price }}" class="wr-goods-card__price [white-space:nowrap] [font-weight:bold] [order:1] [color:#fa4126] [font-size:36rpx] [margin:0] [line-height:48rpx]">
|
|
287
|
+
<price
|
|
288
|
+
wr-class="price-class"
|
|
289
|
+
symbol="{{currency}}"
|
|
290
|
+
price="{{goods.price}}"
|
|
291
|
+
fill="{{priceFill}}"
|
|
292
|
+
decimalSmaller
|
|
293
|
+
/>
|
|
294
|
+
</view>
|
|
295
|
+
<view wx:if="{{ goods.originPrice && !goods.hideKey.originPrice && isValidityLinePrice }}" class="wr-goods-card__origin-price [white-space:nowrap] [font-weight:normal] [order:2] [color:#aaaaaa] [font-size:24rpx] [margin:0]">
|
|
296
|
+
<price
|
|
297
|
+
wr-class="origin-price-class"
|
|
298
|
+
symbol="{{currency}}"
|
|
299
|
+
price="{{goods.originPrice}}"
|
|
300
|
+
fill="{{priceFill}}"
|
|
301
|
+
/>
|
|
302
|
+
</view>
|
|
303
|
+
<slot name="origin-price" />
|
|
304
|
+
<view wx:if="{{goods.num && !goods.hideKey.num}}" class="wr-goods-card__num num-class [white-space:nowrap] [order:4] [font-size:24rpx] [color:#999] [margin:20rpx_0_0_auto]">
|
|
305
|
+
<text class="wr-goods-card__num__prefix [color:inherit]">x </text>
|
|
306
|
+
{{ goods.num }}
|
|
307
|
+
</view>
|
|
308
|
+
</block>
|
|
309
|
+
<block wx:else>
|
|
310
|
+
<view class="no_storage [&_.no_storage__right]:[width:80rpx] [&_.no_storage__right]:[height:40rpx] [&_.no_storage__right]:[border-radius:20rpx] [&_.no_storage__right]:[border:2rpx_solid_#fa4126] [&_.no_storage__right]:[line-height:40rpx] [&_.no_storage__right]:[text-align:center] [&_.no_storage__right]:[color:#fa4126]">
|
|
311
|
+
<view>请重新选择商品规格</view>
|
|
312
|
+
<view class="no_storage__right">重选</view>
|
|
313
|
+
</view>
|
|
314
|
+
</block>
|
|
315
|
+
</view>
|
|
316
|
+
<slot name="append-body" />
|
|
317
|
+
</view>
|
|
318
|
+
<slot name="footer" />
|
|
319
|
+
</view>
|
|
320
|
+
<slot name="append-card" />
|
|
321
|
+
</view>
|
|
322
|
+
|
|
323
|
+
</template>
|
|
324
|
+
|
|
325
|
+
<json>
|
|
326
|
+
{
|
|
327
|
+
"component": true,
|
|
328
|
+
"usingComponents": {
|
|
329
|
+
"price": "/components/price/index",
|
|
330
|
+
"t-tag": "tdesign-miniprogram/tag/tag",
|
|
331
|
+
"t-image": "/components/webp-image/index",
|
|
332
|
+
"t-icon": "tdesign-miniprogram/icon/icon"
|
|
333
|
+
}
|
|
334
|
+
}</json>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
Component({
|
|
3
|
+
options: {
|
|
4
|
+
addGlobalClass: true,
|
|
5
|
+
multipleSlots: true, // 在组件定义时的选项中启用多slot支持
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
properties: {
|
|
9
|
+
show: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
value: false,
|
|
12
|
+
},
|
|
13
|
+
value: {
|
|
14
|
+
type: String,
|
|
15
|
+
value: '',
|
|
16
|
+
},
|
|
17
|
+
title: {
|
|
18
|
+
type: String,
|
|
19
|
+
observer(newVal) {
|
|
20
|
+
this.setData({ 'goods.title': newVal });
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
price: {
|
|
24
|
+
type: String,
|
|
25
|
+
value: '',
|
|
26
|
+
observer(newVal) {
|
|
27
|
+
this.setData({ 'goods.price': newVal });
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
thumb: {
|
|
31
|
+
type: String,
|
|
32
|
+
value: '',
|
|
33
|
+
observer(newVal) {
|
|
34
|
+
this.setData({ 'goods.thumb': newVal });
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
thumbMode: {
|
|
38
|
+
type: String,
|
|
39
|
+
value: 'aspectFit',
|
|
40
|
+
},
|
|
41
|
+
zIndex: {
|
|
42
|
+
type: Number,
|
|
43
|
+
value: 99,
|
|
44
|
+
},
|
|
45
|
+
specs: {
|
|
46
|
+
type: Array,
|
|
47
|
+
value: [],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
data: {
|
|
52
|
+
goods: {
|
|
53
|
+
title: '',
|
|
54
|
+
thumb: '',
|
|
55
|
+
price: '',
|
|
56
|
+
hideKey: {
|
|
57
|
+
originPrice: true,
|
|
58
|
+
tags: true,
|
|
59
|
+
specs: true,
|
|
60
|
+
num: true,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
methods: {
|
|
65
|
+
onClose() {
|
|
66
|
+
this.triggerEvent('close');
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
onCloseOver() {
|
|
70
|
+
this.triggerEvent('closeover');
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<template>
|
|
77
|
+
<t-popup visible="{{show}}" placement="bottom" z-index="{{zIndex}}" bind:visible-change="onClose">
|
|
78
|
+
<view class="specs-popup [width:100vw] [box-sizing:border-box] [padding:32rpx_32rpx_calc(20rpx_+_env(safe-area-inset-bottom))_32rpx] [max-height:80vh] [display:flex] [flex-direction:column] [background-color:white] [border-radius:20rpx_20rpx_0_0] [&_.section]:[margin-top:44rpx] [&_.section]:[flex:auto] [&_.section]:[overflow-y:scroll] [&_.section]:[overflow-x:hidden] [&_.section]:[-webkit-overflow-scrolling:touch] [&_.section_.title]:[font-size:26rpx] [&_.section_.title]:[color:#4f5356] [&_.section_.options]:[color:#333333] [&_.section_.options]:[font-size:24rpx] [&_.section_.options]:[margin-right:-26rpx] [&_.section_.options_.option]:[display:inline-block] [&_.section_.options_.option]:[margin-top:24rpx] [&_.section_.options_.option]:[height:56rpx] [&_.section_.options_.option]:[line-height:56rpx] [&_.section_.options_.option]:[padding:0_16rpx] [&_.section_.options_.option]:[border-radius:8rpx] [&_.section_.options_.option]:[background-color:#f5f5f5] [&_.section_.options_.option]:[max-width:100%] [&_.section_.options_.option]:[box-sizing:border-box] [&_.section_.options_.option]:[white-space:nowrap] [&_.section_.options_.option]:[overflow:hidden] [&_.section_.options_.option]:[text-overflow:ellipsis] [&_.bottom-btn]:[margin-top:42rpx] [&_.bottom-btn]:[position:relative] [&_.bottom-btn]:[height:80rpx] [&_.bottom-btn]:[line-height:80rpx] [&_.bottom-btn]:[text-align:center] [&_.bottom-btn]:[background-color:white] [&_.bottom-btn]:[color:#fa4126] [&_.bottom-btn--active]:[opacity:0.5]">
|
|
79
|
+
<view>
|
|
80
|
+
<goods-card data="{{goods}}" layout="horizontal-wrap" thumb-mode="{{thumbMode}}" />
|
|
81
|
+
<view class="section">
|
|
82
|
+
<view class="title">已选规格</view>
|
|
83
|
+
<view class="options">
|
|
84
|
+
<view wx:for="{{specs}}" wx:for-item="spec" wx:key="spec" class="option">{{spec}} </view>
|
|
85
|
+
</view>
|
|
86
|
+
</view>
|
|
87
|
+
</view>
|
|
88
|
+
<view class="bottom-btn" hover-class="bottom-btn--active" bindtap="onClose">我知道了</view>
|
|
89
|
+
</view>
|
|
90
|
+
</t-popup>
|
|
91
|
+
</template>
|
|
92
|
+
|
|
93
|
+
<json>
|
|
94
|
+
{
|
|
95
|
+
"component": true,
|
|
96
|
+
"usingComponents": {
|
|
97
|
+
"t-popup": "tdesign-miniprogram/popup/popup",
|
|
98
|
+
"goods-card": "../../components/goods-card/index"
|
|
99
|
+
}
|
|
100
|
+
}</json>
|