Authored by 郭成尧

coupon-help-dialog

... ... @@ -98,21 +98,7 @@
{{#if isOrdinaryCart}}
<li class="coupon">
<a href="{{selectCouponUrl}}">
<span class="title">优惠券</span>
{{# coupon}}
{{#if isLimit}}
<span class="coupon-info pull-right">
该商品不可使用优惠券
<i class="iconfont">&#xe614;</i>
</span>
{{^}}
<span class="count">{{#if selectedAmount}}已选{{selectedAmount}}{{^}}{{count}}张可用{{/if}}</span>
<span class="coupon-info pull-right">
{{info}}<i class="iconfont">&#xe614;</i>
</span>
{{/if}}
{{/coupon}}
<span class="iconfont icon-wenhao coupon-help"></span>
{{> cart/coupon-info}}
</a>
</li>
{{/if}}
... ... @@ -226,6 +212,9 @@
{{/if}}
<input type="hidden" id="product-sku" name="product-sku" value="{{sku}}">
{{#if couponPayRule}}
{{> cart/coupon-dialog}}
{{/if}}
{{#with seckill}}
<input type="hidden" id="activity-id" name="activity-id" value="{{activityId}}">
{{/with}}
... ...
... ... @@ -103,21 +103,7 @@
{{#if isOrdinaryCart}}
<li class="coupon">
<a href="{{#if isLimit}}javascript:void(0);{{else}}/cart/index/new/selectCoupon{{/if}}">
<span class="title">优惠券</span>
{{# coupon}}
{{#if isLimit}}
<span class="coupon-info pull-right">
该商品不可使用优惠券
<i class="iconfont">&#xe614;</i>
</span>
{{^}}
<span class="count">{{#if selectedAmount}}已选{{selectedAmount}}{{^}}{{count}}张可用{{/if}}</span>
<span class="coupon-info pull-right{{#isEqualOr info '无可用'}} no-can-use{{/isEqualOr}}">
{{info}}<i class="iconfont">&#xe614;</i>
</span>
{{/if}}
{{/coupon}}
<span class="iconfont icon-wenhao coupon-help"></span>
{{> cart/coupon-info}}
</a>
</li>
{{/if}}
... ... @@ -224,6 +210,9 @@
</div>
<input type="hidden" id="product-sku" name="product-sku" value="{{sku}}">
{{#if couponPayRule}}
{{> cart/coupon-dialog}}
{{/if}}
{{#with seckill}}
<input type="hidden" id="activity-id" name="activity-id" value="{{activityId}}">
{{/with}}
... ...
<div id="conponDialogWrapper" class="dialog-wrapper">
<div class="dialog-box" style="top: 50%; margin-top: -119px;">
<div class="dialog-header">优惠券使用规则</div>
<div class="dialog-content">{{{couponPayRule}}}</div>
<div class="dialog-footer">
<span class="dialog-center-btn tap-hightlight" id="conponDialogCancel">我知道了</span>
</div>
</div>
</div>
... ...
<span class="title">优惠券</span>
{{# coupon}}
{{#if isLimit}}
<span class="coupon-info pull-right">
该商品不可使用优惠券
<i class="iconfont">&#xe614;</i>
</span>
{{^}}
<span class="count">
{{#if selectedAmount}}已选{{selectedAmount}}{{^}}{{count}}张可用{{/if}}
</span>
<span class="coupon-info pull-right{{#isEqualOr info '无可用'}} no-can-use{{/isEqualOr}}">
{{info}}
<i class="iconfont">&#xe614;</i>
</span>
{{/if}}
{{/coupon}}
<span class="iconfont icon-wenhao coupon-help"></span>
... ...
... ... @@ -14,7 +14,9 @@ class OrderEnsure extends Page {
invoice: $('.invoice'),
invoiceType: $('.invoice-type'),
userMobile: $('.user-mobile'),
couponHelp: $('.coupon-help')
couponHelp: $('.coupon-help'),
conponDialogWrapper: $('#conponDialogWrapper'),
conponDialogCancel: $('#conponDialogCancel')
};
this.init();
... ... @@ -31,22 +33,25 @@ class OrderEnsure extends Page {
bindEvents() {
this.selector.invoice.on('click', '.checkbox', this.needInvoice.bind(this));
this.selector.couponHelp.on('click', this.showCouponHelp.bind(this));
this.selector.conponDialogCancel.on('click', this.cancelCouponHelp.bind(this));
}
/**
* 优惠券帮助弹窗
* 展示优惠券帮助弹窗
*/
showCouponHelp(e) {
dialog.showDialog({
hasHeader: '优惠券使用规则',
dialogText: `<p>1.店铺券、活动券、运费券可叠加使用,叠加时优先抵用店铺券;</p>
<p>2.不同店铺的店铺券可以叠加使用,同店铺的店铺券不可叠加使用。</p>`,
hasFooter: {
centerBtnText: '我知道了'
}
});
this.selector.conponDialogWrapper.show();
e.preventDefault();
e.stopPropagation();
}
/**
* 关闭优惠券帮助弹窗
*/
cancelCouponHelp(e) {
this.selector.conponDialogWrapper.hide();
e.preventDefault();
e.stopPropagation();
}
/**
... ...
... ... @@ -327,6 +327,13 @@ function tranformPayment(data, orderInfo, cartType, skuList, orderComputeData) {
orderInfo.msg && (result.msg = orderInfo.msg);
result.isPrintPrice = true; // 是否不打印价格,默认不勾选,预留
// 优惠券
let couponPayRule = _.get(data, 'coupon_pay_rule.desc', null);
if (couponPayRule) {
result.couponPayRule = _.replace(couponPayRule, '\n', '<br>');
}
return result;
}
... ...