...
|
...
|
@@ -8,6 +8,7 @@ const $ = require('yoho-jquery'); |
|
|
const lazyLoad = require('yoho-jquery-lazyload');
|
|
|
const cookie = require('yoho-cookie');
|
|
|
const qs = require('yoho-qs');
|
|
|
const OrderEnsure = require('./cartbuynow/order-ensure');
|
|
|
|
|
|
let tip = require('plugin/tip'),
|
|
|
loading = require('plugin/loading'),
|
...
|
...
|
@@ -27,9 +28,6 @@ let $invoice = $('.invoice'), |
|
|
isSubmiting,
|
|
|
dispatchInfo,
|
|
|
total,
|
|
|
isTickets = $('#ticketsPage').val(),
|
|
|
productSku = $('#productSku').val(),
|
|
|
buyNumber = $('#buyNumber').val(),
|
|
|
headerTop = $('#yoho-header').outerHeight(),
|
|
|
isYohoCoinClick = $coinLi.data('yoho-coin-click') * 1, // 判断有货币是否可以单击
|
|
|
addressTop = $('.address-wrap').outerHeight(),
|
...
|
...
|
@@ -37,8 +35,7 @@ let $invoice = $('.invoice'), |
|
|
delivery = 0,
|
|
|
$noPrintPrice = $('.no-print-price');
|
|
|
|
|
|
let $invoiceType = $('.invoice-type');
|
|
|
let $userMobile = $('.user-mobile');
|
|
|
new OrderEnsure(order);
|
|
|
|
|
|
require('common');
|
|
|
|
...
|
...
|
@@ -47,78 +44,6 @@ lazyLoad(); |
|
|
// 存 COOKIE
|
|
|
orderInfo('product_sku', qs.product_sku);
|
|
|
|
|
|
function getQueryParam() {
|
|
|
let queryArray = location.search.substr(1).split('&'),
|
|
|
i,
|
|
|
subArr = [],
|
|
|
obj = {};
|
|
|
|
|
|
for (i = 0; i < queryArray.length; i++) {
|
|
|
subArr = queryArray[i].split('=');
|
|
|
obj[subArr[0]] = subArr[1];
|
|
|
subArr = [];
|
|
|
}
|
|
|
|
|
|
return obj;
|
|
|
}
|
|
|
|
|
|
function isLimitGood() {
|
|
|
return getQueryParam().limitproductcode;
|
|
|
}
|
|
|
|
|
|
// 电子票下单
|
|
|
function _ticketsConfirm() {
|
|
|
let data = {
|
|
|
productSku: productSku,
|
|
|
buyNumber: buyNumber,
|
|
|
mobile: $ticketsMobile.val(),
|
|
|
useYohoCoin: orderInfo('use_yoho_coin')
|
|
|
};
|
|
|
|
|
|
if (!$ticketsMobile.val()) {
|
|
|
tip.show('手机号必填');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
url: '/cart/index/submitTicket',
|
|
|
type: 'POST',
|
|
|
dataType: 'json',
|
|
|
data: data,
|
|
|
success: function(ticket) {
|
|
|
|
|
|
// 下单成功调整支付页面
|
|
|
if (ticket.code === 200) {
|
|
|
window.location.href = '/home/orders/paynew?order_code=' + ticket.data.order_code;
|
|
|
} else {
|
|
|
tip.show(ticket.message);
|
|
|
}
|
|
|
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络异常~');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
if (window.getUid() !== orderInfo('uid')) {
|
|
|
order.init();
|
|
|
window.location.reload();
|
|
|
}
|
|
|
|
|
|
isLimitGood() && (function() {
|
|
|
let a = [];
|
|
|
|
|
|
let data = getQueryParam();
|
|
|
|
|
|
data.type = 'limitcode';
|
|
|
|
|
|
a.push(data);
|
|
|
orderInfo('skuList', JSON.stringify(a));
|
|
|
orderInfo('limitUrlSufix', location.search);
|
|
|
}());
|
|
|
|
|
|
if (queryString.cartType || queryString.carttype || !orderInfo('cartType')) {
|
|
|
orderInfo('cartType', queryString.cartType || queryString.carttype || 'ordinary');
|
|
|
}
|
...
|
...
|
@@ -140,32 +65,6 @@ $('.checkbox').on('touchstart', function(e) { |
|
|
}
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
* 是否需要开发票
|
|
|
*/
|
|
|
$invoice.on('touchend', '.checkbox', function(e) {
|
|
|
let $this = $(this);
|
|
|
|
|
|
orderInfo('invoice', $this.hasClass('icon-cb-radio'));
|
|
|
if ($this.hasClass('icon-cb-radio')) {
|
|
|
$invoice.addClass('focus');
|
|
|
$invoiceType.html('电子发票(个人)<i class="iconfont"></i>');
|
|
|
orderInfo('receiverMobile', $userMobile.val());
|
|
|
orderInfo('invoices_type', 2);
|
|
|
}
|
|
|
if ($this.hasClass('icon-radio')) {
|
|
|
$invoice.removeClass('focus');
|
|
|
$invoiceType.html('');
|
|
|
orderInfo('invoices_title', null);
|
|
|
orderInfo('invoices_type', null);
|
|
|
orderInfo('receiverMobile', null);
|
|
|
orderInfo('buyerTaxNumber', null);
|
|
|
}
|
|
|
e.preventDefault();
|
|
|
e.stopPropagation();
|
|
|
});
|
|
|
|
|
|
|
|
|
function updateDeliverWay(deliver_way) {
|
|
|
let $moreJit = $('.more-jit a').get(0),
|
|
|
url;
|
...
|
...
|
@@ -193,8 +92,7 @@ function orderCompute() { |
|
|
delivery_way: orderInfo('delivery_way'),
|
|
|
payment_type: orderInfo('payment_type'),
|
|
|
coupon_code: orderInfo('coupon_code'),
|
|
|
use_yoho_coin: use_yoho_coin,
|
|
|
skuList: isLimitGood() ? orderInfo('skuList') : void 0
|
|
|
use_yoho_coin: use_yoho_coin
|
|
|
};
|
|
|
|
|
|
loading.showLoadingMask();
|
...
|
...
|
@@ -493,11 +391,6 @@ $subBlock.on('touchstart', 'li', function() { |
|
|
$('.bill a').on('touchstart', function() {
|
|
|
let $paymentType;
|
|
|
|
|
|
if (isTickets) {
|
|
|
_ticketsConfirm();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$paymentType = $('.payment-type .icon-cb-radio');
|
|
|
orderInfo('payment_id', $paymentType.data('id')); // 支付方式id
|
|
|
orderInfo('payment_type', $paymentType.data('payment-type')); // 支付方式
|
...
|
...
|
|