...
|
...
|
@@ -9,7 +9,8 @@ var $ = require('yoho.jquery'), |
|
|
$receiptInfoSaveBtn = $('.receipt-info .save-receipt'),
|
|
|
$receiptInfoCancelBtn = $('.receipt-info .cancel-receipt'),
|
|
|
$eReceiptBtn = $('.receipt-type .e-receipt'),
|
|
|
$paperReceiptBtn = $('.receipt-type .paper-receipt');
|
|
|
$paperReceiptBtn = $('.receipt-type .paper-receipt'),
|
|
|
$yohoCoinHelp = $('.yoho-coin-help');
|
|
|
|
|
|
|
|
|
var address = require('./address'),
|
...
|
...
|
@@ -112,6 +113,10 @@ var Order = { |
|
|
|
|
|
var pan = $(this).parent('dl.pan');
|
|
|
|
|
|
if ($(this).hasClass('not-btn')) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (pan.find('dd').is(':hidden')) {
|
|
|
c.winShow(pan);
|
|
|
|
...
|
...
|
@@ -272,15 +277,21 @@ var Order = { |
|
|
e.$toPay.html((data.last_order_amount).toFixed(2));
|
|
|
|
|
|
//有货币清零状态更新
|
|
|
$('#biprice').val(accMul(100, data.use_yoho_coin));
|
|
|
if (~~data.use_yoho_coin === 0) {
|
|
|
$('.errbitip').text('');
|
|
|
} else {
|
|
|
$('.errbitip').text('抵扣' + data.use_yoho_coin.toFixed(2) + '元');
|
|
|
$('dl.play-bi-pan').find('dt').removeClass('not-btn');
|
|
|
$('.not-btn-tip').addClass('hide');
|
|
|
if (!data.yohoCoinCompute.yohoCoinClick) {
|
|
|
//不可以使用状态
|
|
|
$('dl.play-bi-pan').find('dt').addClass('not-btn');
|
|
|
$('.not-btn-tip').removeClass('hide');
|
|
|
}
|
|
|
$('#biprice').data('.yoho-coin-click', data.yohoCoinCompute.yohoCoinClick);
|
|
|
$('#biprice').find('.num-limit-coin').html(data.yohoCoinCompute.yoho_coin_pay_rule.num_limit);
|
|
|
$('#biprice').find('.totalYohoCoinNum').html(data.yohoCoinCompute.totalYohoCoinNum);
|
|
|
$('#biprice').find('.yohoCoinNum').html(data.yohoCoinCompute.yohoCoinNum);
|
|
|
$('#biprice').find('.yohoCoin').html(data.yohoCoinCompute.yohoCoin);
|
|
|
|
|
|
//使用的红包
|
|
|
envelopesVal = e.$useEnvelopesInput.data('all') - data.use_red_envelopes;
|
|
|
|
|
|
if (~~data.use_red_envelopes > 0) {
|
|
|
e.$useEnvelopes.find('span').html('-¥' + data.use_red_envelopes.toFixed(2));
|
|
|
e.$useEnvelopes.find('input').attr('data-use', data.use_red_envelopes);
|
...
|
...
|
@@ -378,7 +389,7 @@ var Order = { |
|
|
|
|
|
var $juangroupInput = $('.play-juan.is-select input[name="juangroup"]:checked');
|
|
|
var expressVal = $('.express-list input[name="carriagegroup"]:checked').val();
|
|
|
var biVal = $('#biprice.is-select').val();
|
|
|
var biVal = $('#biprice.is-select').data('yoho-coin-num') * 1;
|
|
|
var codeVal = $juangroupInput.val();
|
|
|
var cartType = $('.address-manage').attr('cart-type');
|
|
|
var redEnvelopes = $('.use-envelopes input:checked').attr('data-use');
|
...
|
...
|
@@ -462,9 +473,11 @@ var Order = { |
|
|
|
|
|
e.$loading.show();
|
|
|
|
|
|
|
|
|
options = {
|
|
|
type: 'POST',
|
|
|
url: '/cart/index/orderCompute',
|
|
|
|
|
|
data: d,
|
|
|
success: function(data) {
|
|
|
|
...
|
...
|
@@ -497,18 +510,18 @@ var Order = { |
|
|
|
|
|
// 优惠券修改
|
|
|
$(document).on('click', '.juan-modify', function() {
|
|
|
|
|
|
|
|
|
var $pan = $('.play-juan-pan');
|
|
|
|
|
|
c.winShow($pan);
|
|
|
c.winShow($('.play-juan-pan'));
|
|
|
});
|
|
|
|
|
|
e.$biok.click(function() {
|
|
|
|
|
|
var pan = $(this).parents('dl.pan');
|
|
|
var juanText;
|
|
|
|
|
|
if (!$('#biprice').data('yoho-coin-click')) {
|
|
|
$('.errbitip').html('抱歉,您的订单实付款不满足有货币使用条件');
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
$('#biprice').addClass('is-select');
|
|
|
|
|
|
getSelectData(function(d) {
|
...
|
...
|
@@ -517,43 +530,33 @@ var Order = { |
|
|
juanText = $('.play-juan input[value="' + d.couponCode + '"]').next().text();
|
|
|
}
|
|
|
|
|
|
//if (d.yohoCoin * 1 === 0) {
|
|
|
if (!/^\d+$/.test(d.yohoCoin + '') || d.yohoCoin * 1 === 0) {
|
|
|
if (d.yohoCoin * 1 <= 0) {
|
|
|
$('.errbitip').html('请输入一个正整数');
|
|
|
$('#biprice').removeClass('is-select');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
} else if (d.yohoCoin * 1 > $('.play-pan em').text() * 1) {
|
|
|
|
|
|
$('.errbitip').html('您的有货币不足');
|
|
|
$('#biprice').removeClass('is-select');
|
|
|
|
|
|
} else {
|
|
|
e.$loading.show();
|
|
|
|
|
|
options = {
|
|
|
type: 'POST',
|
|
|
url: '/cart/index/orderCompute',
|
|
|
data: d,
|
|
|
success: function(data) {
|
|
|
|
|
|
e.$loading.hide();
|
|
|
e.$loading.show();
|
|
|
options = {
|
|
|
type: 'POST',
|
|
|
url: '/cart/index/orderCompute',
|
|
|
data: d,
|
|
|
success: function(data) {
|
|
|
|
|
|
if (data.code === 200) {
|
|
|
e.$loading.hide();
|
|
|
|
|
|
u.render(data.data, juanText);
|
|
|
c.winHide(pan);
|
|
|
if (data.code === 200) {
|
|
|
|
|
|
//$('.play-bi-pan dt').hide();
|
|
|
u.render(data.data, juanText);
|
|
|
c.winHide(pan);
|
|
|
|
|
|
} else {
|
|
|
$('.errbitip').html(data.message);
|
|
|
$('#biprice').removeClass('is-select');
|
|
|
}
|
|
|
} else {
|
|
|
$('.errbitip').html(data.message);
|
|
|
$('#biprice').removeClass('is-select');
|
|
|
}
|
|
|
};
|
|
|
|
|
|
$.ajax(options);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
$.ajax(options);
|
|
|
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -567,20 +570,6 @@ var Order = { |
|
|
c.winShow($pan);
|
|
|
});
|
|
|
|
|
|
e.$bp.keyup(function() {
|
|
|
|
|
|
var val = $(this).val();
|
|
|
|
|
|
//if (val * 1 < 0 || val.indexOf('.') > 0) {
|
|
|
if (!/^\d+$/.test(val + '')) {
|
|
|
e.$errorTip.html('请输入一个正整数');
|
|
|
} else if (val * 1 > $(this).data('bi') * 1) {
|
|
|
e.$errorTip.html('您的有货币不足');
|
|
|
} else {
|
|
|
e.$errorTip.html('抵扣' + (val / 100).toFixed(2) + '元');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 取消yoho 币
|
|
|
$('.cancel-bi').click(function() {
|
|
|
|
...
|
...
|
@@ -788,6 +777,7 @@ $('.why').click(function() { |
|
|
$('#differentBag').click(function() {
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
$(document).click(function() {
|
|
|
$('#differentBag').hide();
|
|
|
});
|
...
|
...
|
@@ -1058,3 +1048,10 @@ $('#input-mobile').bind('input propertychange', function() { |
|
|
|
|
|
// 订单确认页默认埋点
|
|
|
window.addPoint('YB_SC_ORDER_ENSURE');
|
|
|
|
|
|
//有货币帮助弹框
|
|
|
$yohoCoinHelp.hover(function() {
|
|
|
$(this).find('.yoho-coin-help-dialog').removeClass('hide');
|
|
|
}, function() {
|
|
|
$(this).find('.yoho-coin-help-dialog').addClass('hide');
|
|
|
}); |
...
|
...
|
|