...
|
...
|
@@ -7,6 +7,8 @@ |
|
|
var $ = require('yoho-jquery'),
|
|
|
lazyLoad = require('yoho-jquery-lazyload');
|
|
|
|
|
|
var Alert = require('../plugins/dialog').Alert;
|
|
|
|
|
|
var minusPlus = {
|
|
|
minus: '',
|
|
|
plus: ''
|
...
|
...
|
@@ -28,6 +30,10 @@ var $coin = $('#input-coin'), |
|
|
var $balanceCost = $('#balance-cost'),
|
|
|
$balanceCoin = $('#balance-coin');
|
|
|
|
|
|
var $printPrice = $('#print-price');
|
|
|
|
|
|
var $invoice = $('#invoice-content');
|
|
|
|
|
|
require('../plugins/check'); // before 地址和发票
|
|
|
|
|
|
require('./order/address'); // 地址
|
...
|
...
|
@@ -127,16 +133,20 @@ function compute(coin) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
$coinSure.click(function() {
|
|
|
var coin;
|
|
|
// 获取已使用的有货币
|
|
|
function getCoinUsed() {
|
|
|
var coin = $coinUsed.text();
|
|
|
|
|
|
return coin === '' ? 0 : parseInt(coin, 10); // 使用parseInt可以排除异常情况的转化影响
|
|
|
}
|
|
|
|
|
|
$coinSure.click(function() {
|
|
|
if ($coinSure.hasClass('disable')) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// 切换显示
|
|
|
coin = $coinUsed.text();
|
|
|
compute(coin === '' ? 0 : parseInt(coin, 10)); // 使用parseInt可以排除异常情况的转化影响
|
|
|
compute(getCoinUsed());
|
|
|
|
|
|
toggleCoinPanel();
|
|
|
});
|
...
|
...
|
@@ -158,7 +168,48 @@ $('.used-coin').on('click', '.modify', function() { |
|
|
});
|
|
|
|
|
|
// 添加备注-是否打印价格
|
|
|
$printPrice.printPrice = true; //默认为true
|
|
|
|
|
|
$('.print-price-radio').check({
|
|
|
type: 'radio',
|
|
|
group: 'print-price'
|
|
|
group: 'print-price',
|
|
|
onChange: function(el, checked, value) {
|
|
|
if (checked) {
|
|
|
$printPrice.isPrintPrice = value === 1 ? true : false;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 订单提交
|
|
|
$('#submit-order').click(function() {
|
|
|
var reqParam = {
|
|
|
address_id: $('.address.focus').data('id'),
|
|
|
yohoCoin: getCoinUsed(),
|
|
|
remark: $('#remark-content').val(),
|
|
|
isPrintPrice: $printPrice.printPrice
|
|
|
};
|
|
|
|
|
|
var $invoiceDetail;
|
|
|
|
|
|
// 发票信息
|
|
|
if ($invoice.find('.checked').length > 0) {
|
|
|
$invoiceDetail = $invoice.find('.invoice-detail');
|
|
|
|
|
|
$.extend(reqParam, {
|
|
|
invoiceTitle: $invoiceDetail.data('title'),
|
|
|
invoiceId: $invoiceDetail.data('content')
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/shopping/order/submit',
|
|
|
data: reqParam
|
|
|
}).then(function(data) {
|
|
|
if (data.code === 200) {
|
|
|
location.href = data.data.payUrl;
|
|
|
} else {
|
|
|
new Alert(data.message).show();
|
|
|
}
|
|
|
});
|
|
|
}); |
...
|
...
|
|