|
@@ -13,6 +13,7 @@ var $pdUsed = $('#pay-delivery-used'); |
|
@@ -13,6 +13,7 @@ var $pdUsed = $('#pay-delivery-used'); |
13
|
var $balance = $('#balance-detail');
|
13
|
var $balance = $('#balance-detail');
|
14
|
|
14
|
|
15
|
var couponsTpl = Hbs.compile($('#coupons-tpl').html());
|
15
|
var couponsTpl = Hbs.compile($('#coupons-tpl').html());
|
|
|
16
|
+var coinTpl = Hbs.compile($('#yoho-coin-tpl').html());
|
16
|
var promotionTpl = Hbs.compile($('#promotion-list-tpl').html());
|
17
|
var promotionTpl = Hbs.compile($('#promotion-list-tpl').html());
|
17
|
|
18
|
|
18
|
var $coin = $('#coin-used');
|
19
|
var $coin = $('#coin-used');
|
|
@@ -58,16 +59,19 @@ function updateUsedPdShow(info) { |
|
@@ -58,16 +59,19 @@ function updateUsedPdShow(info) { |
58
|
}
|
59
|
}
|
59
|
|
60
|
|
60
|
// 订单计算
|
61
|
// 订单计算
|
61
|
-function compute() {
|
|
|
62
|
- var coinUsed = $coin.data('coin');
|
62
|
+// 传有货币数量则使用有货币,否者不使用,更改订单总价有货币使用数量重置为0
|
|
|
63
|
+function compute(coin) {
|
63
|
var d = {
|
64
|
var d = {
|
64
|
cartType: window.queryString().type,
|
65
|
cartType: window.queryString().type,
|
65
|
deliveryWay: $('input[name="delivery-way-radio"]:checked').val(),
|
66
|
deliveryWay: $('input[name="delivery-way-radio"]:checked').val(),
|
66
|
paymentType: $('#payment-way').data('id'),
|
67
|
paymentType: $('#payment-way').data('id'),
|
67
|
- coin: coinUsed ? parseInt(coinUsed, 10) : 0
|
68
|
+ coin: coin ? parseInt(coin, 10) : 0
|
68
|
};
|
69
|
};
|
69
|
var couponCode = $('#coupons-sure').data('coupons');
|
70
|
var couponCode = $('#coupons-sure').data('coupons');
|
70
|
|
71
|
|
|
|
72
|
+
|
|
|
73
|
+ $coin.data('coin', d.coin);
|
|
|
74
|
+
|
71
|
if (couponCode) {
|
75
|
if (couponCode) {
|
72
|
d.couponCode = couponCode;
|
76
|
d.couponCode = couponCode;
|
73
|
}
|
77
|
}
|
|
@@ -97,6 +101,9 @@ function compute() { |
|
@@ -97,6 +101,9 @@ function compute() { |
97
|
|
101
|
|
98
|
res = data.data;
|
102
|
res = data.data;
|
99
|
|
103
|
|
|
|
104
|
+ // update yoho coin using
|
|
|
105
|
+ $('#using-coin-cont').html(coinTpl(res));
|
|
|
106
|
+
|
100
|
// update last order amount
|
107
|
// update last order amount
|
101
|
$('#sum-row em').html(res.last_order_amount);
|
108
|
$('#sum-row em').html(res.last_order_amount);
|
102
|
|
109
|
|
|
@@ -170,7 +177,7 @@ if ($('#use-coupons').length) { |
|
@@ -170,7 +177,7 @@ if ($('#use-coupons').length) { |
170
|
|
177
|
|
171
|
// 有货币
|
178
|
// 有货币
|
172
|
if ($coin) {
|
179
|
if ($coin) {
|
173
|
- $coin.data($coin.data()); // 防止人为更改有货币使用数量
|
180
|
+ $coin.data($coin.data()); // 防止人为页面更改有货币使用数量
|
174
|
}
|
181
|
}
|
175
|
|
182
|
|
176
|
$('#use-coin, #coin-sure, #coin-cancel').click(function() {
|
183
|
$('#use-coin, #coin-sure, #coin-cancel').click(function() {
|
|
@@ -185,10 +192,8 @@ $coinSure.click(function() { |
|
@@ -185,10 +192,8 @@ $coinSure.click(function() { |
185
|
return;
|
192
|
return;
|
186
|
}
|
193
|
}
|
187
|
|
194
|
|
188
|
- $coin.data('coin', data.max);
|
|
|
189
|
-
|
|
|
190
|
// coin change trigger compute
|
195
|
// coin change trigger compute
|
191
|
- compute();
|
196
|
+ compute(data.max);
|
192
|
});
|
197
|
});
|
193
|
|
198
|
|
194
|
$('#coin-cancel').click(function() {
|
199
|
$('#coin-cancel').click(function() {
|
|
@@ -197,7 +202,6 @@ $('#coin-cancel').click(function() { |
|
@@ -197,7 +202,6 @@ $('#coin-cancel').click(function() { |
197
|
if (data.coin * 1 === 0) {
|
202
|
if (data.coin * 1 === 0) {
|
198
|
return;
|
203
|
return;
|
199
|
}
|
204
|
}
|
200
|
- $coin.data('coin', 0);
|
|
|
201
|
|
205
|
|
202
|
// coin cancel trigger compute
|
206
|
// coin cancel trigger compute
|
203
|
compute();
|
207
|
compute();
|
|
@@ -205,7 +209,7 @@ $('#coin-cancel').click(function() { |
|
@@ -205,7 +209,7 @@ $('#coin-cancel').click(function() { |
205
|
|
209
|
|
206
|
// 结算信息列表中修改有货币按钮
|
210
|
// 结算信息列表中修改有货币按钮
|
207
|
$('.balance-detail').on('click', '.modify-coin', function() {
|
211
|
$('.balance-detail').on('click', '.modify-coin', function() {
|
208
|
- $('.coin-trigger').filter('.use-coin').addClass('hide').end().filter('.using-coin').removeClass('hide');
|
212
|
+ $('#use-coin').trigger('click');
|
209
|
});
|
213
|
});
|
210
|
|
214
|
|
211
|
// delivery way change trigger compute
|
215
|
// delivery way change trigger compute
|