Showing
4 changed files
with
65 additions
and
10 deletions
@@ -14,6 +14,14 @@ const TICKETS = { | @@ -14,6 +14,14 @@ const TICKETS = { | ||
14 | }; | 14 | }; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | + * 格式化价格 | ||
18 | + * @private | ||
19 | + */ | ||
20 | +const transPrice = (price, isSepcialZero) => { | ||
21 | + return (price > 0 || isSepcialZero) ? parseFloat(price).toFixed(2) : 0; | ||
22 | +}; | ||
23 | + | ||
24 | +/** | ||
17 | * 格式化订单商品 | 25 | * 格式化订单商品 |
18 | * @private | 26 | * @private |
19 | */ | 27 | */ |
@@ -26,18 +34,27 @@ const _formatOrderGoods = (orderGoods, count, haveLink, tickets) => { | @@ -26,18 +34,27 @@ const _formatOrderGoods = (orderGoods, count, haveLink, tickets) => { | ||
26 | name: value.product_name, | 34 | name: value.product_name, |
27 | color: value.factory_color_name ? value.factory_color_name : value.color_name, | 35 | color: value.factory_color_name ? value.factory_color_name : value.color_name, |
28 | size: value.size_name, | 36 | size: value.size_name, |
29 | - price: value.goods_price, | ||
30 | - count: value.buy_number | 37 | + payPrice: value.real_pay_price, |
38 | + salePrice: transPrice(value.sales_price) || value.good, | ||
39 | + count: value.buy_number, | ||
40 | + isVipPrice: value.discount_tag === 'V', | ||
41 | + isStudebt: value.discount_tag === 'S' | ||
31 | }; | 42 | }; |
32 | 43 | ||
44 | + if (parseInt(value.real_pay_price, 10) === parseInt(value.sales_price, 10)) { | ||
45 | + goods.salePrice = false; | ||
46 | + } | ||
47 | + | ||
33 | /* gift=>是否赠品,advanceBuy=>是否加价购 */ | 48 | /* gift=>是否赠品,advanceBuy=>是否加价购 */ |
34 | if (value.goods_type === 'gift') { | 49 | if (value.goods_type === 'gift') { |
35 | Object.assign(goods, { | 50 | Object.assign(goods, { |
36 | - gift: true | 51 | + gift: true, |
52 | + salePrice: transPrice(value.sales_price) | ||
37 | }); | 53 | }); |
38 | } else if (value.goods_type === 'price_gift') { | 54 | } else if (value.goods_type === 'price_gift') { |
39 | Object.assign(goods, { | 55 | Object.assign(goods, { |
40 | - advanceBuy: true | 56 | + advanceBuy: true, |
57 | + salePrice: transPrice(value.sales_price) | ||
41 | }); | 58 | }); |
42 | } | 59 | } |
43 | 60 |
@@ -183,17 +183,26 @@ const orderDetailData = (uid, orderCode) => { | @@ -183,17 +183,26 @@ const orderDetailData = (uid, orderCode) => { | ||
183 | name: data.productName, | 183 | name: data.productName, |
184 | color: data.factoryColorName ? data.factoryColorName : data.colorName, | 184 | color: data.factoryColorName ? data.factoryColorName : data.colorName, |
185 | size: data.sizeName, | 185 | size: data.sizeName, |
186 | - price: data.goodsPrice, | ||
187 | - count: count | 186 | + payPrice: data.realPayPrice, |
187 | + salePrice: parseFloat(data.salesPrice).toFixed(2), | ||
188 | + count: count, | ||
189 | + isVipPrice: data.discountTag === 'V', | ||
190 | + isStudebt: data.discountTag === 'S' | ||
188 | }); | 191 | }); |
189 | 192 | ||
193 | + if (parseInt(data.realPayPrice, 10) === parseInt(data.salesPrice, 10)) { | ||
194 | + obj.salePrice = false; | ||
195 | + } | ||
196 | + | ||
190 | if (data.goodsType === 'gift') { | 197 | if (data.goodsType === 'gift') { |
191 | obj = _.assign(obj, { | 198 | obj = _.assign(obj, { |
192 | - gift: true | 199 | + gift: true, |
200 | + salePrice: parseFloat(data.salesPrice).toFixed(2) | ||
193 | }); | 201 | }); |
194 | } else if (data.goodsType === 'priceGift') { | 202 | } else if (data.goodsType === 'priceGift') { |
195 | obj = _.assign(obj, { | 203 | obj = _.assign(obj, { |
196 | - advanceBuy: true | 204 | + advanceBuy: true, |
205 | + salePrice: parseFloat(data.salesPrice).toFixed(2) | ||
197 | }); | 206 | }); |
198 | } | 207 | } |
199 | 208 |
@@ -26,9 +26,20 @@ | @@ -26,9 +26,20 @@ | ||
26 | <span class="appear-date">上市期:{{appearDate}}</span> | 26 | <span class="appear-date">上市期:{{appearDate}}</span> |
27 | {{/if}} | 27 | {{/if}} |
28 | <p class="row price-wrap"> | 28 | <p class="row price-wrap"> |
29 | + {{#if isVipPrice}} | ||
30 | + <span class="fill-text">VIP</span> | ||
31 | + {{/if}} | ||
32 | + {{#if isStudebt}} | ||
33 | + <span class="fill-text">学</span> | ||
34 | + {{/if}} | ||
29 | <span class="price"> | 35 | <span class="price"> |
30 | - ¥{{price}} | 36 | + ¥{{payPrice}} |
31 | </span> | 37 | </span> |
38 | + {{#if salePrice}} | ||
39 | + <span class="sale-price"> | ||
40 | + ¥{{salePrice}} | ||
41 | + </span> | ||
42 | + {{/if}} | ||
32 | <span class="count"> | 43 | <span class="count"> |
33 | ×{{count}} | 44 | ×{{count}} |
34 | </span> | 45 | </span> |
@@ -306,7 +306,7 @@ | @@ -306,7 +306,7 @@ | ||
306 | 306 | ||
307 | .name { | 307 | .name { |
308 | font-size: 28px; | 308 | font-size: 28px; |
309 | - max-width: 70%; | 309 | + max-width: 63%; |
310 | overflow: hidden; | 310 | overflow: hidden; |
311 | text-overflow: ellipsis; | 311 | text-overflow: ellipsis; |
312 | display: -webkit-box; | 312 | display: -webkit-box; |
@@ -345,10 +345,28 @@ | @@ -345,10 +345,28 @@ | ||
345 | text-align: right; | 345 | text-align: right; |
346 | } | 346 | } |
347 | 347 | ||
348 | + .fill-text { | ||
349 | + padding: 0.05rem 0.2rem; | ||
350 | + color: #fff; | ||
351 | + font-size: 0.5rem; | ||
352 | + line-height: 0.65rem; | ||
353 | + border-radius: 0.75rem; | ||
354 | + display: inline-block; | ||
355 | + background-color: #e01; | ||
356 | + } | ||
357 | + | ||
348 | .price { | 358 | .price { |
349 | color: #e01; | 359 | color: #e01; |
350 | } | 360 | } |
351 | 361 | ||
362 | + .sale-price { | ||
363 | + display: block; | ||
364 | + color: #999; | ||
365 | + text-align: right; | ||
366 | + line-height: 45px; | ||
367 | + text-decoration: line-through; | ||
368 | + } | ||
369 | + | ||
352 | .count { | 370 | .count { |
353 | display: block; | 371 | display: block; |
354 | color: #999; | 372 | color: #999; |
-
Please register or login to post a comment