Showing
15 changed files
with
667 additions
and
14 deletions
1 | const config = { | 1 | const config = { |
2 | domains: { | 2 | domains: { |
3 | // test3 | 3 | // test3 |
4 | - api: 'http://api-test3.dev.yohocorp.com', | 4 | + // api: 'http://api-test3.dev.yohocorp.com', |
5 | 5 | ||
6 | // test1 | 6 | // test1 |
7 | // api: 'http://api-test1.dev.yohocorp.com', | 7 | // api: 'http://api-test1.dev.yohocorp.com', |
8 | 8 | ||
9 | // gray | 9 | // gray |
10 | - // api: 'http://apigray.yoho.cn', | 10 | + api: 'http://apigray.yoho.cn', |
11 | 11 | ||
12 | // production | 12 | // production |
13 | // api: 'https://api.yoho.cn', | 13 | // api: 'https://api.yoho.cn', |
1 | +Component({ | ||
2 | + properties: { | ||
3 | + item: { | ||
4 | + type: Object, | ||
5 | + value: {}, | ||
6 | + observer: '_itemChange' | ||
7 | + }, | ||
8 | + index: { | ||
9 | + type: Number, | ||
10 | + value: 0 | ||
11 | + } | ||
12 | + }, | ||
13 | + methods: { | ||
14 | + _itemChange(item) { | ||
15 | + console.log(this); | ||
16 | + if (item) { | ||
17 | + item.mark_price = item.sales_price; | ||
18 | + | ||
19 | + switch (item.goods_type) { | ||
20 | + case 'price_gift': | ||
21 | + item.sales_price = +item.last_price; | ||
22 | + break; | ||
23 | + case 'gift': | ||
24 | + item.sales_price = 0; | ||
25 | + break; | ||
26 | + default: | ||
27 | + if (item.last_vip_price < item.sales_price) { | ||
28 | + item.sales_price = item.last_vip_price; | ||
29 | + } | ||
30 | + break; | ||
31 | + } | ||
32 | + | ||
33 | + if (item.mark_price <= item.sales_price) { | ||
34 | + delete item.mark_price; | ||
35 | + } | ||
36 | + | ||
37 | + this.setData({item}); | ||
38 | + } | ||
39 | + }, | ||
40 | + itemTapped() { | ||
41 | + this.triggerEvent('itemTapped', this.data.item); | ||
42 | + } | ||
43 | + } | ||
44 | +}); |
1 | +<wxs src="../../../wxs/helper.wxs" module="helper" /> | ||
2 | + | ||
3 | +<view class="goods-item" bindtap="itemTapped"> | ||
4 | + <view class="choose-btn"> | ||
5 | + <block wx:if="{{item.goods_type !== 'gift' && !item.batch_no && !item.bundle_activity_id}}"> | ||
6 | + <text class="iconfont icon-duihao-fill" wx:if="{{item.selected === 'Y'}}"></text> | ||
7 | + <text class="iconfont icon-round" wx:else></text> | ||
8 | + </block> | ||
9 | + </view> | ||
10 | + | ||
11 | + <image class="thumb" src="{{helper.image(item.goods_images || item.goods_image, 76, 100)}}"> | ||
12 | + <view class="goods-type price-gift-tag" wx:if="{{item.goods_type === 'price_gift'}}"> | ||
13 | + <text>加价购</text> | ||
14 | + </view> | ||
15 | + <view class="goods-type gift-tag" wx:if="{{item.goods_type === 'gift'}}"> | ||
16 | + <text>赠品</text> | ||
17 | + </view> | ||
18 | + <view class="goods-type virtual-tag" wx:if="{{item.goods_type === 'ticket'}}"> | ||
19 | + <text>虚拟商品</text> | ||
20 | + </view> | ||
21 | + <view class="goods-type advance-tag" wx:if="{{item.goods_type === 'advance'}}"> | ||
22 | + <text>预售</text> | ||
23 | + </view> | ||
24 | + <view class="goods-type low-storage-tag" wx:if="{{item.bLackStorage}}"> | ||
25 | + <text>库存不足</text> | ||
26 | + </view> | ||
27 | + </image> | ||
28 | + | ||
29 | + <view class="info"> | ||
30 | + <view class="info-wrap"> | ||
31 | + <view class="name">{{item.product_name}}</view> | ||
32 | + <view class="color-size">颜色:{{item.factory_goods_name}} 尺码:{{item.size_name}}</view> | ||
33 | + <view class="price"> | ||
34 | + <text class="sale-price">¥ {{helper.round(item.sales_price)}}</text> | ||
35 | + <text wx:if="{{item.mark_price}}" class="mark-price">¥ {{helper.round(item.mark_price)}}</text> | ||
36 | + </view> | ||
37 | + <view class="price-down" wx:if="{{item.price_down > 0}}"> | ||
38 | + <text>已降¥{{item.price_down}}</text> | ||
39 | + </view> | ||
40 | + </view> | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + </view> | ||
45 | + <view class="buy-num"> | ||
46 | + <text>x {{item.buy_number}}</text> | ||
47 | + </view> | ||
48 | +</view> |
1 | +@import "../../../iconfont.wxss"; | ||
2 | + | ||
3 | +.goods-item { | ||
4 | + width: 100%; | ||
5 | + height: 200rpx; | ||
6 | + line-height: 200rpx; | ||
7 | + padding: 20rpx 0; | ||
8 | + font-size: 26rpx; | ||
9 | + display: flex; | ||
10 | + flex-direction: row; | ||
11 | + position: relative; | ||
12 | +} | ||
13 | + | ||
14 | +.goods-item:before { | ||
15 | + content: ''; | ||
16 | + height: 1rpx; | ||
17 | + position: absolute; | ||
18 | + left: 100rpx; | ||
19 | + right: 0; | ||
20 | + top: -1rpx; | ||
21 | + background-color: #f0f0f0; | ||
22 | +} | ||
23 | + | ||
24 | +.goods-item.top-none:before { | ||
25 | + display: none; | ||
26 | +} | ||
27 | + | ||
28 | +.goods-item .red { | ||
29 | + color: #d0021b; | ||
30 | +} | ||
31 | + | ||
32 | +.goods-item .choose-btn { | ||
33 | + width: 100rpx; | ||
34 | + text-align: center; | ||
35 | + display: flex; | ||
36 | + flex-direction: row; | ||
37 | +} | ||
38 | + | ||
39 | +.goods-item .choose-btn .iconfont { | ||
40 | + margin: auto; | ||
41 | +} | ||
42 | + | ||
43 | +.goods-item .thumb { | ||
44 | + width: 150rpx; | ||
45 | + height: 200rpx; | ||
46 | + background-color: #f3f3f3; | ||
47 | + display: flex; | ||
48 | + flex-direction: row; | ||
49 | + position: relative; | ||
50 | +} | ||
51 | + | ||
52 | +.goods-item .thumb .goods-type { | ||
53 | + width: 100%; | ||
54 | + height: 30rpx; | ||
55 | + line-height: 30rpx; | ||
56 | + font-size: 20rpx; | ||
57 | + background-color: #444; | ||
58 | + color: #fff; | ||
59 | + text-align: center; | ||
60 | + position: absolute; | ||
61 | + left: 0; | ||
62 | + bottom: 0; | ||
63 | +} | ||
64 | + | ||
65 | +.goods-item .thumb .price-gift-tag { | ||
66 | + background-color: #fc1261; | ||
67 | +} | ||
68 | + | ||
69 | +.goods-item .thumb .gift-tag { | ||
70 | + background-color: #85c45c; | ||
71 | +} | ||
72 | + | ||
73 | +.goods-item .thumb .low-storage-tag { | ||
74 | + background-color: #b0b0b0; | ||
75 | +} | ||
76 | + | ||
77 | +.goods-item .thumb .virtual-tag { | ||
78 | + background-color: #c80813; | ||
79 | +} | ||
80 | + | ||
81 | +.goods-item .info { | ||
82 | + line-height: 1.5; | ||
83 | + display: flex; | ||
84 | + flex-direction: row; | ||
85 | +} | ||
86 | + | ||
87 | +.goods-item .info-wrap { | ||
88 | + width: 350rpx; | ||
89 | + padding-left: 20rpx; | ||
90 | +} | ||
91 | + | ||
92 | +.goods-item .info-wrap .name { | ||
93 | + line-height: 1.4; | ||
94 | + direction: flex; | ||
95 | + display: -webkit-box; | ||
96 | + overflow: hidden; | ||
97 | + text-overflow: ellipsis; | ||
98 | + -webkit-line-clamp: 2; | ||
99 | + -webkit-box-orient: vertical; | ||
100 | + margin-top: 20rpx; | ||
101 | +} | ||
102 | + | ||
103 | +.goods-item .info-wrap .color-size { | ||
104 | + padding: 10rpx 0; | ||
105 | + line-height: 1.3; | ||
106 | + color: #b0b0b0; | ||
107 | + font-size: 24rpx; | ||
108 | +} | ||
109 | + | ||
110 | +.goods-item .info-wrap .sale-price { | ||
111 | + color: #d0021b; | ||
112 | + margin-right: 10rpx; | ||
113 | +} | ||
114 | + | ||
115 | +.goods-item .info-wrap .mark-price { | ||
116 | + color: #b0b0b0; | ||
117 | +} | ||
118 | + | ||
119 | + | ||
120 | + | ||
121 | +.goods-item .buy-num { | ||
122 | + padding-top: 20rpx; | ||
123 | + line-height: 1.4; | ||
124 | + color: #b0b0b0; | ||
125 | + position: absolute; | ||
126 | + right: 30rpx; | ||
127 | +} |
app/models/cart/cart-handle.js
0 → 100644
1 | + | ||
2 | +function AllGoodsSelect() { | ||
3 | + let isSelectAll = true; | ||
4 | + | ||
5 | + this.check = function(list) { | ||
6 | + (list || []).map(item => { | ||
7 | + if (!item.bLackStorage && item.goods_type !== 'gift' && item.selected !== 'Y') { | ||
8 | + isSelectAll = false; | ||
9 | + } | ||
10 | + }); | ||
11 | + }; | ||
12 | + | ||
13 | + this.val = function() { | ||
14 | + return isSelectAll; | ||
15 | + }; | ||
16 | + | ||
17 | + return this; | ||
18 | +} | ||
19 | + | ||
20 | +function _processPromotion(promotionList, isSub) { | ||
21 | + if (!promotionList || !promotionList.length) { | ||
22 | + return false; | ||
23 | + } | ||
24 | + | ||
25 | + promotionList.map(promotion => { | ||
26 | + let statuString = ''; | ||
27 | + | ||
28 | + switch (+promotion.status) { | ||
29 | + case 0: | ||
30 | + statuString = '去凑单'; | ||
31 | + break; | ||
32 | + case 10: | ||
33 | + if (promotion.promotion_type == 'Gift') { //Cashreduce, Degressdiscount, Cheapestfree, Discount,Gift,Needpaygift,SpecifiedAmount | ||
34 | + statuString = '领赠品'; | ||
35 | + } else if (promotion.promotion_type == 'Needpaygift') { | ||
36 | + statuString = '去换购'; | ||
37 | + } | ||
38 | + break; | ||
39 | + case 20: | ||
40 | + statuString = '已抢光'; | ||
41 | + promotion.soldOut = true; | ||
42 | + break; | ||
43 | + case 30: | ||
44 | + statuString = '更换'; | ||
45 | + break; | ||
46 | + default: | ||
47 | + break; | ||
48 | + } | ||
49 | + | ||
50 | + promotion.statuString = statuString; | ||
51 | + | ||
52 | + if (isSub) { | ||
53 | + let typeString = ''; | ||
54 | + | ||
55 | + switch (promotion.promotion_type) { | ||
56 | + case 'Gift': | ||
57 | + typeString = '赠品'; | ||
58 | + break; | ||
59 | + case 'Needpaygift': | ||
60 | + typeString = '加价购'; | ||
61 | + break; | ||
62 | + case 'Cashreduce': | ||
63 | + typeString = '满减'; | ||
64 | + break; | ||
65 | + default: | ||
66 | + typeString = '折扣'; | ||
67 | + break; | ||
68 | + } | ||
69 | + | ||
70 | + promotion.typeString = typeString; | ||
71 | + } | ||
72 | + }); | ||
73 | + | ||
74 | + return promotionList; | ||
75 | +} | ||
76 | + | ||
77 | + | ||
78 | +function _processGiftList(list, isGift) { | ||
79 | + let result = { | ||
80 | + isGift, | ||
81 | + title: isGift ? '赠品' : '全场加价购', | ||
82 | + statusString: '已抢光' | ||
83 | + }; | ||
84 | + | ||
85 | + if (!list || !list.length) { | ||
86 | + return false; | ||
87 | + } | ||
88 | + | ||
89 | + let statusCount10 = 0;//已满足 | ||
90 | + let statusCount20 = 0;//已售罄 | ||
91 | + let promotionArr = []; | ||
92 | + | ||
93 | + list.map(item => { | ||
94 | + switch (+item.status) { | ||
95 | + case 10: | ||
96 | + statusCount10++; | ||
97 | + promotionArr.push(item.promotion_id); | ||
98 | + break; | ||
99 | + case 20: | ||
100 | + statusCount20++; | ||
101 | + break; | ||
102 | + default: | ||
103 | + break; | ||
104 | + } | ||
105 | + }); | ||
106 | + | ||
107 | + if (statusCount10 === 0 && statusCount20 !== list.length) { | ||
108 | + return false; | ||
109 | + } | ||
110 | + | ||
111 | + result.promotion_ids = promotionArr.join(','); | ||
112 | + | ||
113 | + if (promotionArr.length > 0) { | ||
114 | + result.statusString = isGift ? '领赠品' : '去换购'; | ||
115 | + result.showArrow = true; | ||
116 | + } | ||
117 | + | ||
118 | + return result; | ||
119 | +} | ||
120 | + | ||
121 | +/** | ||
122 | + * 购物车数据 | ||
123 | + * @param params | ||
124 | + * @returns {*} | ||
125 | + */ | ||
126 | +const formatOrdinaryCartData = (data) => { | ||
127 | + data = data || {}; | ||
128 | + data = data.ordinary_cart_data || {}; | ||
129 | + | ||
130 | + let ordinaryCart = {}; | ||
131 | + let isEmptyCart = true; | ||
132 | + | ||
133 | + // 免邮提示 | ||
134 | + if (data.shipping_cost_prompt) { | ||
135 | + ordinaryCart.shippingCostTips = data.shipping_cost_prompt.shipping_cost_tips || ''; | ||
136 | + } | ||
137 | + | ||
138 | + // 降价提示 | ||
139 | + if (data.price_down_prompt) { | ||
140 | + ordinaryCart.priceDownTips = data.price_down_prompt.price_down_tips || ''; | ||
141 | + } | ||
142 | + | ||
143 | + const allGoodsSelect = new AllGoodsSelect(); | ||
144 | + | ||
145 | + // 商品池 | ||
146 | + let goodsPoolList = data.goods_pool_list; | ||
147 | + if (goodsPoolList && goodsPoolList.length) { | ||
148 | + goodsPoolList.map(item => { | ||
149 | + if (item.pool_batch_no && item.pool_id) { | ||
150 | + //套餐商品参数转换 | ||
151 | + item.int_pool_buy_number = parseInt(item.pool_buy_number, 10); | ||
152 | + item.int_pool_storage_number = parseInt(item.pool_storage_number, 10); | ||
153 | + } | ||
154 | + | ||
155 | + item.isPromotionExpanded = false; | ||
156 | + item.goods_list && allGoodsSelect.check(item.goods_list); | ||
157 | + item.promotion_list = _processPromotion(item.promotion_list); | ||
158 | + | ||
159 | + if (item.sub_pool && item.sub_pool.length) { | ||
160 | + item.sub_pool.map(spItem => { | ||
161 | + spItem.promotion_list = _processPromotion(spItem.promotion_list, true); | ||
162 | + spItem.goods_list && allGoodsSelect.check(spItem.goods_list); | ||
163 | + }) | ||
164 | + } | ||
165 | + }); | ||
166 | + | ||
167 | + isEmptyCart = false; | ||
168 | + ordinaryCart.goodsPoolList = goodsPoolList; | ||
169 | + } | ||
170 | + | ||
171 | + // 商品列表 | ||
172 | + let goodsList = data.goods_list; | ||
173 | + if (goodsList && goodsList.length) { | ||
174 | + isEmptyCart = false; | ||
175 | + allGoodsSelect.check(item.goods_list); | ||
176 | + ordinaryCart.goodsList = goodsList; | ||
177 | + } | ||
178 | + | ||
179 | + // 加价购&赠品 | ||
180 | + let gGiftAndPriceGiftList = []; | ||
181 | + let giftItem = _processGiftList(data.g_gift_list, true); | ||
182 | + let priceGiftItem = _processGiftList(data.g_price_gift_list); | ||
183 | + | ||
184 | + giftItem && gGiftAndPriceGiftList.push(giftItem); | ||
185 | + priceGiftItem && gGiftAndPriceGiftList.push(priceGiftItem); | ||
186 | + | ||
187 | + if (gGiftAndPriceGiftList.length) { | ||
188 | + ordinaryCart.gGiftAndPriceGiftList = gGiftAndPriceGiftList; | ||
189 | + } | ||
190 | + | ||
191 | + //失效商品 | ||
192 | + ordinaryCart.invalidGoodsList = [...(data.off_shelves_goods_list || []), ...(data.sold_out_goods_list || [])]; | ||
193 | + if (ordinaryCart.invalidGoodsList.length) { | ||
194 | + isEmptyCart = false; | ||
195 | + } | ||
196 | + | ||
197 | + ordinaryCart.isValidGoodsSelectAll = allGoodsSelect.val(); | ||
198 | + ordinaryCart.shoppingCartData = data.shopping_cart_data; | ||
199 | + | ||
200 | +console.log(ordinaryCart); | ||
201 | + return { | ||
202 | + isEmptyCart, | ||
203 | + ...ordinaryCart | ||
204 | + }; | ||
205 | +} | ||
206 | + | ||
207 | +export default { | ||
208 | + formatOrdinaryCartData | ||
209 | +}; |
1 | import cartModel from '../../models/cart/cart'; | 1 | import cartModel from '../../models/cart/cart'; |
2 | +import cartHandle from '../../models/cart/cart-handle'; | ||
2 | 3 | ||
3 | const app = getApp(); | 4 | const app = getApp(); |
4 | const router = global.router; | 5 | const router = global.router; |
5 | 6 | ||
6 | Page({ | 7 | Page({ |
7 | data: { | 8 | data: { |
9 | + isEditing: false | ||
8 | }, | 10 | }, |
9 | onLoad() { | 11 | onLoad() { |
10 | 12 | ||
@@ -20,14 +22,14 @@ Page({ | @@ -20,14 +22,14 @@ Page({ | ||
20 | cartModel.getCartData({uid: app.getUid()}) | 22 | cartModel.getCartData({uid: app.getUid()}) |
21 | .then(res => { | 23 | .then(res => { |
22 | if (res.code === 200 && res.data) { | 24 | if (res.code === 200 && res.data) { |
23 | - this._resolveCartData(res.data); | 25 | + this.setData(cartHandle.formatOrdinaryCartData(res.data)); |
24 | } else { | 26 | } else { |
25 | return Promise.reject(); | 27 | return Promise.reject(); |
26 | } | 28 | } |
27 | }) | 29 | }) |
28 | .catch(() => {}); | 30 | .catch(() => {}); |
29 | }, | 31 | }, |
30 | - _resolveCartData() { | ||
31 | - | 32 | + editCartAction() { |
33 | + this.setData({isEditing: !this.data.isEditing}); | ||
32 | } | 34 | } |
33 | }); | 35 | }); |
1 | -<block wx:if="{{false}}"> | ||
2 | - 我是购物车内容 | ||
3 | -</block> | ||
4 | -<block wx:else> | ||
5 | - <view class='empty-cart'> | 1 | +<import src="./template/cart/goods-pool.wxml"/> |
2 | + | ||
3 | +<block wx:if="{{isEmptyCart}}"> | ||
4 | + <view class="empty-cart"> | ||
6 | <image src='../../static/images/empty_cart.png' class='empty-img'></image> | 5 | <image src='../../static/images/empty_cart.png' class='empty-img'></image> |
7 | <text class='empty-desc'>购物车空空如也\n去挑选中意的商品</text> | 6 | <text class='empty-desc'>购物车空空如也\n去挑选中意的商品</text> |
8 | <view class='shopping-btn' bindtap='goShopping'>去逛逛</view> | 7 | <view class='shopping-btn' bindtap='goShopping'>去逛逛</view> |
9 | </view> | 8 | </view> |
10 | -</block> | ||
9 | +</block> | ||
10 | +<block wx:else> | ||
11 | + <scroll-view scroll-y style="height: 100%;"> | ||
12 | + <view class="tips-wrap"> | ||
13 | + <view class="hold-text"> | ||
14 | + <text>{{priceDownTips || shippingCostTips}}</text> | ||
15 | + </view> | ||
16 | + <view wx:if="{{shippingCostTips || priceDownTips}}" class="fixed-top-tips"> | ||
17 | + <view wx:if="{{priceDownTips}}" class="price-down-tips"> | ||
18 | + <text>{{priceDownTips}}</text> | ||
19 | + <text class="iconfont icon-top" bindtap='tapPriceDownTipsAction'></text> | ||
20 | + </view> | ||
21 | + <view wx:else class="shipping-cost-tips">{{shippingCostTips}}</view> | ||
22 | + <view class="edit-cart-btn" bindtap="editCartAction">{{isEditing ? '完成' : '编辑商品'}}</view> | ||
23 | + </view> | ||
24 | + </view> | ||
25 | + | ||
26 | + <template is="cartGoodsPool" data="{{goodsPoolList}}"/> | ||
27 | + | ||
28 | + </scroll-view> | ||
29 | +</block> |
1 | +@import "./template/cart/goods-pool.wxss"; | ||
2 | + | ||
3 | +page { | ||
4 | + height: 100%; | ||
5 | + color: #444; | ||
6 | +} | ||
1 | 7 | ||
2 | .empty-cart .empty-img { | 8 | .empty-cart .empty-img { |
3 | display: block; | 9 | display: block; |
@@ -26,3 +32,50 @@ | @@ -26,3 +32,50 @@ | ||
26 | border-radius: 4rpx; | 32 | border-radius: 4rpx; |
27 | background-color: #444; | 33 | background-color: #444; |
28 | } | 34 | } |
35 | + | ||
36 | +.tips-wrap { | ||
37 | + width: 100%; | ||
38 | + font-size: 24rpx; | ||
39 | +} | ||
40 | + | ||
41 | +.tips-wrap .hold-text, | ||
42 | +.tips-wrap .fixed-top-tips { | ||
43 | + padding: 16rpx 30rpx; | ||
44 | + line-height: 1.5; | ||
45 | + background-color: #f0f0f0; | ||
46 | + box-sizing: border-box; | ||
47 | +} | ||
48 | + | ||
49 | +.tips-wrap .fixed-top-tips { | ||
50 | + width: 100%; | ||
51 | + position: fixed; | ||
52 | + top: 0; | ||
53 | + left: 0; | ||
54 | + overflow: hidden; | ||
55 | + z-index: 10; | ||
56 | +} | ||
57 | + | ||
58 | +.tips-wrap .hold-text, | ||
59 | +.tips-wrap .price-down-tips, | ||
60 | +.tips-wrap .shipping-cost-tips { | ||
61 | + display: inline-block; | ||
62 | + max-width: 70%; | ||
63 | + vertical-align: middle; | ||
64 | +} | ||
65 | + | ||
66 | +.tips-wrap .edit-cart-btn { | ||
67 | + height: 60rpx; | ||
68 | + line-height: 60rpx; | ||
69 | + position: absolute; | ||
70 | + top: 50%; | ||
71 | + right: 30rpx; | ||
72 | + margin-top: -30rpx; | ||
73 | + font-family: PingFang-SC-Regular; | ||
74 | + color: #d0021b; | ||
75 | +} | ||
76 | + | ||
77 | +.split-line { | ||
78 | + width: 100%; | ||
79 | + height: 20rpx; | ||
80 | + background-color: #eee; | ||
81 | +} |
app/pages/cart/template/cart/goods-pool.wxml
0 → 100644
1 | +<import src="./promotion-list.wxml"/> | ||
2 | + | ||
3 | +<template name="cartGoodsPool"> | ||
4 | + <div class="goods-pool-list"> | ||
5 | + <block wx:for="{{goodsPoolList}}" wx:key="unique"> | ||
6 | + <template is="cartPromotionList" data="{{promotion_list: item.promotion_list, isPromotionExpanded: item.isPromotionExpanded}}"/> | ||
7 | + | ||
8 | + <block wx:if="{{item.sub_pool}}"> | ||
9 | + <block wx:for="{{item.sub_pool}}" wx:for-item="sItem" wx:for-index="sIndex" wx:key="unique"> | ||
10 | + <template is="cartPromotionList" data="{{promotion_list: sItem.promotion_list, isPromotionExpanded: item.isPromotionExpanded, isSub: true}}"/> | ||
11 | + | ||
12 | + <view class="list-warp"> | ||
13 | + <block wx:for="{{sItem.goods_list}}" wx:for-item="spgItem" wx:for-index="spgIndex" wx:key="unique"> | ||
14 | + <cart-item item="{{spgItem}}" index="{{spgIndex}}"></cart-item> | ||
15 | + </block> | ||
16 | + </view> | ||
17 | + </block> | ||
18 | + </block> | ||
19 | + | ||
20 | + <!-- TODO 套餐 --> | ||
21 | + | ||
22 | + | ||
23 | + <block wx:if="{{item.goods_list.length}}"> | ||
24 | + <block wx:for="{{item.goods_list}}" wx:for-item="sgItem" wx:for-index="sgIndex" wx:key="unique"> | ||
25 | + <cart-item item="{{sgItem}}" index="{{sgIndex}}"></cart-item> | ||
26 | + </block> | ||
27 | + </block> | ||
28 | + | ||
29 | + <view class="split-line"></view> | ||
30 | + </block> | ||
31 | + </div> | ||
32 | +</template> |
app/pages/cart/template/cart/goods-pool.wxss
0 → 100644
1 | +<template name="cartPromotionList"> | ||
2 | + <view class="promotion-wrap {{isSub ? 'sub-promotion-wrap' : ''}}" wx:if="{{promotion_list}}"> | ||
3 | + <view class="inner-wrap"> | ||
4 | + <block wx:for="{{promotion_list}}" wx:key="unique"> | ||
5 | + <view class="promotion-item" data-promotion="{{item}}" bindtap="navToPromotionPage"> | ||
6 | + <view class="right-option"> | ||
7 | + <text class="promotion-status {{item.soldOut ? 'soldOut' : ''}}">{{item.statuString}}</text> | ||
8 | + <text class="iconfont icon-right"></text> | ||
9 | + </view> | ||
10 | + <view class="left-text"> | ||
11 | + <view class="promotion-type" wx:if="{{isSub && item.typeString}}">{{item.typeString}}</view> | ||
12 | + <text class="iconfont icon-warn-fill" wx:if="{{!isSub}}"></text> | ||
13 | + <text class="promotion-desc">{{item.promotion_desc}}</text> | ||
14 | + </view> | ||
15 | + </view> | ||
16 | + </block> | ||
17 | + </view> | ||
18 | + <block wx:if="{{promotion_list.length > 1}}"> | ||
19 | + <view class="show-more-promotion" bindtap="flexOrUnflexPromotion"> | ||
20 | + <text class="iconfont {{isPromotionExpanded ? 'icon-top' : 'icon-bottom'}}"></text> | ||
21 | + </view> | ||
22 | + </block> | ||
23 | + </view> | ||
24 | +</template> |
1 | +.promotion-wrap { | ||
2 | + border-bottom: 1rpx solid #f0f0f0; | ||
3 | + border-top:1rpx solid #f0f0f0; | ||
4 | + padding: 20rpx 30rpx; | ||
5 | + margin-top:-1rpx; | ||
6 | + position: relative; | ||
7 | + box-sizing: border-box; | ||
8 | +} | ||
9 | + | ||
10 | +.sub-promotion-wrap { | ||
11 | + margin-left: 100rpx; | ||
12 | + padding-left: 0; | ||
13 | +} | ||
14 | + | ||
15 | +.promotion-wrap .inner-wrap { | ||
16 | + max-height: 40rpx; | ||
17 | + overflow: hidden; | ||
18 | +} | ||
19 | + | ||
20 | +.promotion-wrap .promotion-item { | ||
21 | + height: 40rpx; | ||
22 | + line-height: 40rpx; | ||
23 | + position: relative; | ||
24 | +} | ||
25 | + | ||
26 | +.promotion-item .left-text { | ||
27 | + font-size: 26rpx; | ||
28 | + max-width: 80%; | ||
29 | + overflow: hidden; | ||
30 | + text-overflow: ellipsis; | ||
31 | + white-space: nowrap; | ||
32 | +} | ||
33 | + | ||
34 | +.promotion-item .promotion-type { | ||
35 | + display: inline-block; | ||
36 | + line-height: 26rpx; | ||
37 | + font-size: 18rpx; | ||
38 | + color: #ff575c; | ||
39 | + border: 1px solid #ff575c; | ||
40 | + border-radius: 6rpx; | ||
41 | + padding: 0 16rpx; | ||
42 | + position: relative; | ||
43 | + top: -2rpx; | ||
44 | +} | ||
45 | + | ||
46 | +.promotion-item .promotion-desc { | ||
47 | + margin-left: 10rpx; | ||
48 | +} | ||
49 | + | ||
50 | +.promotion-item .right-option { | ||
51 | + float: right; | ||
52 | +} | ||
53 | + | ||
54 | +.promotion-item .promotion-status { | ||
55 | + color: #ff575c; | ||
56 | +} | ||
57 | + | ||
58 | +.promotion-item .soldOut { | ||
59 | + color: #eee; | ||
60 | +} | ||
61 | + | ||
62 | +.promotion-wrap .show-more-promotion { | ||
63 | + width: 100rpx; | ||
64 | + color: #ccc; | ||
65 | + position: absolute; | ||
66 | + bottom: -6rpx; | ||
67 | + left: 50%; | ||
68 | + margin-left: -50rpx; | ||
69 | +} | ||
70 | + | ||
71 | +.promotion-wrap .show-more-promotion .iconfont { | ||
72 | + font-size: 30rpx; | ||
73 | +} |
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | "compileType": "miniprogram", | 10 | "compileType": "miniprogram", |
11 | "libVersion": "1.9.1", | 11 | "libVersion": "1.9.1", |
12 | "appid": "wx66ecf50a505afefa", | 12 | "appid": "wx66ecf50a505afefa", |
13 | - "projectname": "%E7%BA%A2%E4%BA%BA%E5%B0%8F%E5%BA%97", | 13 | + "projectname": "%E5%B0%8F%E7%A8%8B%E5%BA%8F%E7%94%B5%E5%95%86", |
14 | "condition": { | 14 | "condition": { |
15 | "search": { | 15 | "search": { |
16 | "current": -1, | 16 | "current": -1, |
@@ -29,7 +29,7 @@ | @@ -29,7 +29,7 @@ | ||
29 | "list": [] | 29 | "list": [] |
30 | }, | 30 | }, |
31 | "miniprogram": { | 31 | "miniprogram": { |
32 | - "current": -1, | 32 | + "current": 14, |
33 | "list": [ | 33 | "list": [ |
34 | { | 34 | { |
35 | "id": 1, | 35 | "id": 1, |
@@ -114,6 +114,12 @@ | @@ -114,6 +114,12 @@ | ||
114 | "name": "商品详情页", | 114 | "name": "商品详情页", |
115 | "pathName": "pages/product/detail/detail", | 115 | "pathName": "pages/product/detail/detail", |
116 | "query": "fromPage=home&fromParam=&productSkn=51829280" | 116 | "query": "fromPage=home&fromParam=&productSkn=51829280" |
117 | + }, | ||
118 | + { | ||
119 | + "id": -1, | ||
120 | + "name": "购物车", | ||
121 | + "pathName": "pages/cart/cart", | ||
122 | + "query": "" | ||
117 | } | 123 | } |
118 | ] | 124 | ] |
119 | } | 125 | } |
-
Please register or login to post a comment