Authored by xuqi

order submit

... ... @@ -99,32 +99,51 @@ const compute = (uid, yohoCoin) => {
* @param number uid user id
* @param number address_id 地址id
* @param number yohoCoin 使用的有货币
* @param string invoiceTitle 发票抬头
* @param int invoiceId 发票类型
* @param number invoices_type 发票类型(1-纸质发票,2-电子发票)
* @param string invoices_title 发票抬头
* @param int invoices_content 发票内容
* @param string receiverMobile 收票人手机
* @param string remark 备注
* @param boolean isPrintPrice 是否打印价格
* @param number delivery_time 送货时间
* @param number delivery_way 送货方式(1-普通,2-顺丰)
* @param number payment_id 支付id
* @param number payment_type 支付类型
*/
const _submit = (uid, address, yohoCoin, invoiceTitle, invoiceId, remark, isPrintPrice) => api.get('', {
const _submit = (uid, other) => api.get('', {
method: 'app.Shopping.submit',
uid: uid,
address_id: address,
yohoCoin: yohoCoin,
invoiceTitle: invoiceTitle,
invoiceId: invoiceId,
remark: remark,
isPrintPrice: isPrintPrice
address_id: other.address_id,
yohoCoin: other.yohoCoin,
invoices_type: other.invoices_type,
invoices_title: other.invoices_title,
invoices_content: other.invoices_content,
recevierMobile: other.recevierMobile,
remark: other.remark,
isPrintPrice: other.isPrintPrice,
delivery_time: other.delivery_time,
delivery_way: other.delivery_way,
payment_id: other.payment_id,
payment_type: other.payment_type
});
const submit = (uid, other) => {
let theOther = {};
let coin = other.coin;
Object.assign(theOther, other, {
delivery_time: 2, // 平时和周末都送货
delivery_way: 1, // 普通快递
payment_id: 1, // 支付宝
payment_type: 1 // 在线支付
});
// 有货币稀释
if (coin) {
coin = coin / 100;
}
return _submit(
uid, other.address_id, coin, other.remark, other.isPrintPrice).then(result => result);
return _submit(uid, theOther).then(result => result);
};
module.exports = {
... ...
... ... @@ -196,8 +196,10 @@ $('#submit-order').click(function() {
$invoiceDetail = $invoice.find('.invoice-detail');
$.extend(reqParam, {
invoiceTitle: $invoiceDetail.data('title'),
invoiceId: $invoiceDetail.data('content')
invoices_type: $invoiceDetail.data('type'),
invoices_title: $invoiceDetail.data('title'),
invoices_content: $invoiceDetail.data('content'),
recevierMobile: $invoiceDetail.data('phone')
});
}
... ...
... ... @@ -54,7 +54,7 @@ function validateInvoice($el) {
}
// 发票抬头为单位
if ($el.invioceTitleType === 2 && name === '') {
if ($el.invioceTitleType === 1 && name === '') {
pass = false;
$el.find('.invoice-title-tip').removeClass('hide');
}
... ... @@ -77,10 +77,10 @@ function invoiceDialogFactory() {
var invoiceType;
if (validateInvoice($el)) {
invoiceType = $invoceTab.children().not('no-focus').hasClass('el-invoice') ? 2 : 1;
invoiceType = $invoceTab.children().not('no-focus').hasClass('el-invoice') ? 1 : 2;
$invoiceContent.html(checkedInvoiceTpl({
type: invoiceType,
invoiceTypeText: invoiceType === 1 ? '电子发票' : '纸质发票',
invoiceTypeText: invoiceType === 2 ? '电子发票' : '纸质发票',
invoiceTitle: $el.invoiceTitleType === 1 ? '个人' : $invoiceTitleInput.val(),
content: $el.invoiceContent,
invoiceContent: $el.find('.invoice-content-radio .checked').next('label').text(),
... ...