...
|
...
|
@@ -66,8 +66,6 @@ function compute(coin, cb) { |
|
|
coin: coin ? coin : 0
|
|
|
};
|
|
|
|
|
|
order.coin = reqData.coin;
|
|
|
|
|
|
// 支付方式
|
|
|
if (order.paymentType) {
|
|
|
reqData.paymentType = order.paymentType;
|
...
|
...
|
@@ -85,6 +83,11 @@ function compute(coin, cb) { |
|
|
reqData.promotionCode = order.promotionCode;
|
|
|
}
|
|
|
|
|
|
// 有货币(保证更改其他价格yoho币不清零,调接口传最大数量,接口限制可使用数量)
|
|
|
if (!coin && order.coin) {
|
|
|
reqData.coin = yohoCoin.totalCoin;
|
|
|
}
|
|
|
|
|
|
// 红包
|
|
|
if (order.redEnvelopes) {
|
|
|
reqData.redEnvelopes = order.redEnvelopes;
|
...
|
...
|
@@ -100,14 +103,14 @@ function compute(coin, cb) { |
|
|
if (data.code === 200) {
|
|
|
res = data.data;
|
|
|
|
|
|
// update order used yoho coin
|
|
|
order.coin = res.usedCoinNum;
|
|
|
|
|
|
// update yoho coin max use num
|
|
|
yohoCoin.maxCoin = res.canUseCoinNum;
|
|
|
|
|
|
// update yoho coin using
|
|
|
yohoCoin.$el.html(coinTpl(res));
|
|
|
if (!reqData.coin) {
|
|
|
yohoCoin.$el.removeClass('used');
|
|
|
}
|
|
|
|
|
|
// update last order amount
|
|
|
$orderPrice.html('¥ ' + res.last_order_amount);
|
...
|
...
|
@@ -115,18 +118,11 @@ function compute(coin, cb) { |
|
|
// 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);
|
|
|
}
|
|
|
|
|
|
if (order.couponCode) {
|
|
|
delete order.couponCode;
|
|
|
}
|
|
|
}
|
|
|
// callback
|
|
|
if (cb && typeof cb === 'function') {
|
|
|
return cb(data);
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -498,8 +494,16 @@ coupon = { |
|
|
order.promotionCode = couponId;
|
|
|
|
|
|
// 重新计算订单价格
|
|
|
compute(0, function() {
|
|
|
that.close();
|
|
|
compute(0, function(resData) {
|
|
|
if (resData.code === 200) {
|
|
|
that.close();
|
|
|
} else {
|
|
|
that.$errorTip.text(resData.message);
|
|
|
|
|
|
if (order.promotionCode) {
|
|
|
delete order.promotionCode;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}).on('click', '.coupon-radio', function() {
|
...
|
...
|
@@ -576,6 +580,7 @@ yohoCoin = { |
|
|
if (data) {
|
|
|
order.coin = data.coin || 0;
|
|
|
this.maxCoin = data.max;
|
|
|
this.totalCoin = data.total;
|
|
|
}
|
|
|
|
|
|
this.eventBind();
|
...
|
...
|
@@ -591,6 +596,7 @@ yohoCoin = { |
|
|
that.close();
|
|
|
}).on('click', '.coin-cancel-btn', function() {
|
|
|
if (order.coin * 1 !== 0) {
|
|
|
order.coin = 0;
|
|
|
compute();
|
|
|
}
|
|
|
|
...
|
...
|
|