Showing
6 changed files
with
57 additions
and
40 deletions
@@ -98,21 +98,7 @@ | @@ -98,21 +98,7 @@ | ||
98 | {{#if isOrdinaryCart}} | 98 | {{#if isOrdinaryCart}} |
99 | <li class="coupon"> | 99 | <li class="coupon"> |
100 | <a href="{{selectCouponUrl}}"> | 100 | <a href="{{selectCouponUrl}}"> |
101 | - <span class="title">优惠券</span> | ||
102 | - {{# coupon}} | ||
103 | - {{#if isLimit}} | ||
104 | - <span class="coupon-info pull-right"> | ||
105 | - 该商品不可使用优惠券 | ||
106 | - <i class="iconfont"></i> | ||
107 | - </span> | ||
108 | - {{^}} | ||
109 | - <span class="count">{{#if selectedAmount}}已选{{selectedAmount}}张{{^}}{{count}}张可用{{/if}}</span> | ||
110 | - <span class="coupon-info pull-right"> | ||
111 | - {{info}}<i class="iconfont"></i> | ||
112 | - </span> | ||
113 | - {{/if}} | ||
114 | - {{/coupon}} | ||
115 | - <span class="iconfont icon-wenhao coupon-help"></span> | 101 | + {{> cart/coupon-info}} |
116 | </a> | 102 | </a> |
117 | </li> | 103 | </li> |
118 | {{/if}} | 104 | {{/if}} |
@@ -226,6 +212,9 @@ | @@ -226,6 +212,9 @@ | ||
226 | {{/if}} | 212 | {{/if}} |
227 | 213 | ||
228 | <input type="hidden" id="product-sku" name="product-sku" value="{{sku}}"> | 214 | <input type="hidden" id="product-sku" name="product-sku" value="{{sku}}"> |
215 | + {{#if couponPayRule}} | ||
216 | + {{> cart/coupon-dialog}} | ||
217 | + {{/if}} | ||
229 | {{#with seckill}} | 218 | {{#with seckill}} |
230 | <input type="hidden" id="activity-id" name="activity-id" value="{{activityId}}"> | 219 | <input type="hidden" id="activity-id" name="activity-id" value="{{activityId}}"> |
231 | {{/with}} | 220 | {{/with}} |
@@ -103,21 +103,7 @@ | @@ -103,21 +103,7 @@ | ||
103 | {{#if isOrdinaryCart}} | 103 | {{#if isOrdinaryCart}} |
104 | <li class="coupon"> | 104 | <li class="coupon"> |
105 | <a href="{{#if isLimit}}javascript:void(0);{{else}}/cart/index/new/selectCoupon{{/if}}"> | 105 | <a href="{{#if isLimit}}javascript:void(0);{{else}}/cart/index/new/selectCoupon{{/if}}"> |
106 | - <span class="title">优惠券</span> | ||
107 | - {{# coupon}} | ||
108 | - {{#if isLimit}} | ||
109 | - <span class="coupon-info pull-right"> | ||
110 | - 该商品不可使用优惠券 | ||
111 | - <i class="iconfont"></i> | ||
112 | - </span> | ||
113 | - {{^}} | ||
114 | - <span class="count">{{#if selectedAmount}}已选{{selectedAmount}}张{{^}}{{count}}张可用{{/if}}</span> | ||
115 | - <span class="coupon-info pull-right{{#isEqualOr info '无可用'}} no-can-use{{/isEqualOr}}"> | ||
116 | - {{info}}<i class="iconfont"></i> | ||
117 | - </span> | ||
118 | - {{/if}} | ||
119 | - {{/coupon}} | ||
120 | - <span class="iconfont icon-wenhao coupon-help"></span> | 106 | + {{> cart/coupon-info}} |
121 | </a> | 107 | </a> |
122 | </li> | 108 | </li> |
123 | {{/if}} | 109 | {{/if}} |
@@ -224,6 +210,9 @@ | @@ -224,6 +210,9 @@ | ||
224 | </div> | 210 | </div> |
225 | 211 | ||
226 | <input type="hidden" id="product-sku" name="product-sku" value="{{sku}}"> | 212 | <input type="hidden" id="product-sku" name="product-sku" value="{{sku}}"> |
213 | + {{#if couponPayRule}} | ||
214 | + {{> cart/coupon-dialog}} | ||
215 | + {{/if}} | ||
227 | {{#with seckill}} | 216 | {{#with seckill}} |
228 | <input type="hidden" id="activity-id" name="activity-id" value="{{activityId}}"> | 217 | <input type="hidden" id="activity-id" name="activity-id" value="{{activityId}}"> |
229 | {{/with}} | 218 | {{/with}} |
1 | +<div id="conponDialogWrapper" class="dialog-wrapper"> | ||
2 | + <div class="dialog-box" style="top: 50%; margin-top: -119px;"> | ||
3 | + <div class="dialog-header">优惠券使用规则</div> | ||
4 | + <div class="dialog-content">{{{couponPayRule}}}</div> | ||
5 | + <div class="dialog-footer"> | ||
6 | + <span class="dialog-center-btn tap-hightlight" id="conponDialogCancel">我知道了</span> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | +</div> |
apps/cart/views/partial/cart/coupon-info.hbs
0 → 100644
1 | +<span class="title">优惠券</span> | ||
2 | +{{# coupon}} | ||
3 | + {{#if isLimit}} | ||
4 | + <span class="coupon-info pull-right"> | ||
5 | + 该商品不可使用优惠券 | ||
6 | + <i class="iconfont"></i> | ||
7 | + </span> | ||
8 | + {{^}} | ||
9 | + <span class="count"> | ||
10 | + {{#if selectedAmount}}已选{{selectedAmount}}张{{^}}{{count}}张可用{{/if}} | ||
11 | + </span> | ||
12 | + <span class="coupon-info pull-right{{#isEqualOr info '无可用'}} no-can-use{{/isEqualOr}}"> | ||
13 | + {{info}} | ||
14 | + <i class="iconfont"></i> | ||
15 | + </span> | ||
16 | + {{/if}} | ||
17 | +{{/coupon}} | ||
18 | +<span class="iconfont icon-wenhao coupon-help"></span> |
@@ -14,7 +14,9 @@ class OrderEnsure extends Page { | @@ -14,7 +14,9 @@ class OrderEnsure extends Page { | ||
14 | invoice: $('.invoice'), | 14 | invoice: $('.invoice'), |
15 | invoiceType: $('.invoice-type'), | 15 | invoiceType: $('.invoice-type'), |
16 | userMobile: $('.user-mobile'), | 16 | userMobile: $('.user-mobile'), |
17 | - couponHelp: $('.coupon-help') | 17 | + couponHelp: $('.coupon-help'), |
18 | + conponDialogWrapper: $('#conponDialogWrapper'), | ||
19 | + conponDialogCancel: $('#conponDialogCancel') | ||
18 | }; | 20 | }; |
19 | 21 | ||
20 | this.init(); | 22 | this.init(); |
@@ -31,22 +33,25 @@ class OrderEnsure extends Page { | @@ -31,22 +33,25 @@ class OrderEnsure extends Page { | ||
31 | bindEvents() { | 33 | bindEvents() { |
32 | this.selector.invoice.on('click', '.checkbox', this.needInvoice.bind(this)); | 34 | this.selector.invoice.on('click', '.checkbox', this.needInvoice.bind(this)); |
33 | this.selector.couponHelp.on('click', this.showCouponHelp.bind(this)); | 35 | this.selector.couponHelp.on('click', this.showCouponHelp.bind(this)); |
36 | + this.selector.conponDialogCancel.on('click', this.cancelCouponHelp.bind(this)); | ||
34 | } | 37 | } |
35 | 38 | ||
36 | /** | 39 | /** |
37 | - * 优惠券帮助弹窗 | 40 | + * 展示优惠券帮助弹窗 |
38 | */ | 41 | */ |
39 | showCouponHelp(e) { | 42 | showCouponHelp(e) { |
40 | - dialog.showDialog({ | ||
41 | - hasHeader: '优惠券使用规则', | ||
42 | - dialogText: `<p>1.店铺券、活动券、运费券可叠加使用,叠加时优先抵用店铺券;</p> | ||
43 | - <p>2.不同店铺的店铺券可以叠加使用,同店铺的店铺券不可叠加使用。</p>`, | ||
44 | - hasFooter: { | ||
45 | - centerBtnText: '我知道了' | ||
46 | - } | ||
47 | - }); | 43 | + this.selector.conponDialogWrapper.show(); |
44 | + e.preventDefault(); | ||
48 | e.stopPropagation(); | 45 | e.stopPropagation(); |
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * 关闭优惠券帮助弹窗 | ||
50 | + */ | ||
51 | + cancelCouponHelp(e) { | ||
52 | + this.selector.conponDialogWrapper.hide(); | ||
49 | e.preventDefault(); | 53 | e.preventDefault(); |
54 | + e.stopPropagation(); | ||
50 | } | 55 | } |
51 | 56 | ||
52 | /** | 57 | /** |
@@ -327,6 +327,13 @@ function tranformPayment(data, orderInfo, cartType, skuList, orderComputeData) { | @@ -327,6 +327,13 @@ function tranformPayment(data, orderInfo, cartType, skuList, orderComputeData) { | ||
327 | orderInfo.msg && (result.msg = orderInfo.msg); | 327 | orderInfo.msg && (result.msg = orderInfo.msg); |
328 | result.isPrintPrice = true; // 是否不打印价格,默认不勾选,预留 | 328 | result.isPrintPrice = true; // 是否不打印价格,默认不勾选,预留 |
329 | 329 | ||
330 | + // 优惠券 | ||
331 | + let couponPayRule = _.get(data, 'coupon_pay_rule.desc', null); | ||
332 | + | ||
333 | + if (couponPayRule) { | ||
334 | + result.couponPayRule = _.replace(couponPayRule, '\n', '<br>'); | ||
335 | + } | ||
336 | + | ||
330 | return result; | 337 | return result; |
331 | } | 338 | } |
332 | 339 |
-
Please register or login to post a comment