Authored by yyq

Merge branch 'feature/shoppingCart' into release/5.4.1

... ... @@ -75,6 +75,7 @@
</script>
<script id="invoice-chose-tpl" type="text/html">
<div class="invoice-close"><i class="iconfont">&#xe60d;</i></div>
<p class="invoice-header">发票信息</p>
<ul class="invoice-type">
<li class="el-invoice focus">电子发票</li>
... ...
... ... @@ -60,7 +60,7 @@ Hbs.registerHelper('round', function(num, precision) {
// 订单计算
// 传有货币数量则使用有货币,否者不使用,更改订单总价有货币使用数量重置为0
function compute(coin) {
function compute(coin, cb) {
var reqData = {
cartType: order.cartType,
coin: coin ? coin : 0
... ... @@ -112,6 +112,11 @@ function compute(coin) {
// update promotion formula list
$balanceDetail.html(promotionTpl(res));
// callback
if (cb && typeof cb === 'function') {
return cb();
}
} else if (data.code === 317) {
if (coupon.$errorTip) {
coupon.$errorTip.text(data.message);
... ... @@ -479,30 +484,25 @@ coupon = {
that.cancelTicketUse();
}).on('change', '.coupon-code', function() {
that.$errorTip.empty();
}).on('click', '.opt-area > label', function() {
}).on('click', '.sure-use-ticket', function() {
that.close();
}).on('click', '.sure-use-code', function() {
var $this = $(this);
var couponId, data;
var couponId;
if ($this.hasClass('sure-use-ticket')) {
data = that.$radios.filter('.on').data();
if (data) {
that.$ticketUseTip.find('.price').text('- ¥' + data.price);
that.$ticketUseTip.removeClass('hide');
couponId = data.id;
}
} else {
couponId = $this.siblings('.coupon-code').val();
}
couponId = $this.siblings('.coupon-code').val();
if (couponId) {
order.couponCode = couponId;
// 重新计算订单价格
compute();
compute(0, function() {
that.close();
});
}
}).on('click', '.coupon-radio', function() {
var $this = $(this);
var $this = $(this),
data, couponId;
if ($this.hasClass('on')) {
return;
... ... @@ -512,6 +512,20 @@ coupon = {
that.$radios.filter('.on').removeClass('on');
}
$this.addClass('on');
data = $this.data();
if (data) {
that.$ticketUseTip.find('.price').text('- ¥' + data.price);
that.$ticketUseTip.removeClass('hide');
couponId = data.id;
}
if (couponId) {
order.couponCode = couponId;
// 重新计算订单价格
compute();
}
});
},
cancelTicketUse: function() {
... ... @@ -531,6 +545,9 @@ coupon = {
delete order.couponCode;
compute(); // 重新计算订单价格
}
},
close: function() {
this.$el.children('.locker-switch').trigger('click');
}
};
... ... @@ -584,6 +601,7 @@ $('.locker-switch').click(function() {
(function() {
var $redSureBtn = $('#red-packet-sure');
var $redPacketBox = $('#red-packet-box');
var used;
if (!$redSureBtn.length) {
... ... @@ -598,12 +616,15 @@ $('.locker-switch').click(function() {
$redSureBtn.siblings('.radio-btn').addClass('on');
}
$('#red-packet-box').on('click', '.radio-btn', function() {
$redPacketBox.on('click', '.radio-btn', function() {
$(this).toggleClass('on');
}).on('click', '.sure-btn', function() {
var $this = $(this),
num = $this.data('num');
// 触发关闭事件
$redPacketBox.prev().children('.locker-switch').trigger('click');
if (!num) {
return;
}
... ...
... ... @@ -100,6 +100,10 @@ function bindInvoiceEvent($el) {
$goodsTypeWrap.find('.on').removeClass('on');
$this.addClass('on');
});
$el.on('click', '.invoice-close', function() {
$('.btn-close', $el).trigger('click');
});
}
function bindInvoiceInfo($el, info) {
... ...
... ... @@ -713,7 +713,7 @@
b {
display: inline-block;
vertical-align: bottom;
max-width: 120px;
max-width: 110px;
margin-right: 10px;
overflow: hidden;
text-overflow: ellipsis;
... ...
... ... @@ -1521,6 +1521,21 @@
color: #444;
background-color: #fff;
> .close {
display: none;
}
.invoice-close {
position: absolute;
top: 10px;
right: 12px;
cursor: pointer;
.iconfont {
font-size: 32px;
}
}
.radio-btn {
&:before {
content: '';
... ... @@ -1540,15 +1555,6 @@
}
}
> .close {
top: 10px;
right: 12px;
.iconfont {
font-size: 32px;
}
}
> .content {
text-align: left;
}
... ...