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