...
|
...
|
@@ -143,92 +143,86 @@ exports.checkTickets = (uid, productSku, buyNumber, useYohoCoin, yohoCoinMode) = |
|
|
* @param @param otherParams 其他参数
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
exports.orderSub = (uid, addressId, cartType, deliveryTime,
|
|
|
deliveryWay, invoices, paymentId, paymentType, remark, couponCode,
|
|
|
yohoCoin, skuList, times, activityInfo, otherParams) => {
|
|
|
if (!activityInfo) {
|
|
|
activityInfo = null;
|
|
|
}
|
|
|
|
|
|
let params = {
|
|
|
method: activityInfo ? 'app.Shopping.easySubmit' : 'app.Shopping.submit',
|
|
|
address_id: addressId,
|
|
|
cart_type: cartType,
|
|
|
delivery_time: deliveryTime,
|
|
|
delivery_way: deliveryWay,
|
|
|
payment_id: paymentId,
|
|
|
payment_type: paymentType,
|
|
|
remark: remark,
|
|
|
uid: uid,
|
|
|
udid: otherParams.udid,
|
|
|
is_print_price: otherParams.isPrintPrice
|
|
|
exports.orderSub = (params) => {
|
|
|
let finalParams = {
|
|
|
method: params.activityInfo ? 'app.Shopping.easySubmit' : 'app.Shopping.submit',
|
|
|
address_id: params.address_id,
|
|
|
cart_type: params.cart_type,
|
|
|
delivery_time: params.delivery_time,
|
|
|
delivery_way: params.delivery_way,
|
|
|
payment_id: params.payment_id,
|
|
|
payment_type: params.payment_type,
|
|
|
remark: params.remark,
|
|
|
uid: params.uid,
|
|
|
udid: params.udid,
|
|
|
is_print_price: params.is_print_price
|
|
|
};
|
|
|
|
|
|
/* tar add 161130 结算优化 */
|
|
|
if (times === 2 || times === '2') {
|
|
|
params.is_continue_buy = 'Y';
|
|
|
if (params.times === 2 || params.times === '2') {
|
|
|
finalParams.is_continue_buy = 'Y';
|
|
|
} else {
|
|
|
params.is_continue_buy = 'N';
|
|
|
finalParams.is_continue_buy = 'N';
|
|
|
}
|
|
|
|
|
|
// 发票内容写死明细
|
|
|
if (invoices.invoices_type_id) {
|
|
|
params.invoice_content = 12;
|
|
|
if (params.invoices.invoices_type_id) {
|
|
|
finalParams.invoice_content = 12;
|
|
|
}
|
|
|
|
|
|
// 发票类型 纸质 1 ,电子 2
|
|
|
if (invoices.invoices_type) {
|
|
|
params.invoices_type = invoices.invoices_type;
|
|
|
if (params.invoices.invoices_type) {
|
|
|
finalParams.invoices_type = params.invoices.invoices_type;
|
|
|
}
|
|
|
|
|
|
// 收票人手机号码
|
|
|
if (invoices.receiverMobile) {
|
|
|
params.receiverMobile = invoices.receiverMobile;
|
|
|
if (params.invoices.receiverMobile) {
|
|
|
finalParams.receiverMobile = params.invoices.receiverMobile;
|
|
|
}
|
|
|
|
|
|
// 发票抬头
|
|
|
if (invoices.invoices_title) {
|
|
|
params.invoices_title = invoices.invoices_title;
|
|
|
if (params.invoices.invoices_title) {
|
|
|
finalParams.invoices_title = params.invoices.invoices_title;
|
|
|
}
|
|
|
|
|
|
// 购买方纳税人识别号,需要开具电子发票且发票抬头为单位信息时为必填项
|
|
|
if (invoices.buyerTaxNumber) {
|
|
|
params.buyerTaxNumber = invoices.buyerTaxNumber;
|
|
|
if (params.invoices.buyerTaxNumber) {
|
|
|
finalParams.buyerTaxNumber = params.invoices.buyerTaxNumber;
|
|
|
}
|
|
|
|
|
|
if (couponCode) {
|
|
|
params.coupon_code = couponCode;
|
|
|
if (params.coupon_code) {
|
|
|
finalParams.coupon_code = params.coupon_code;
|
|
|
}
|
|
|
|
|
|
if (yohoCoin) {
|
|
|
params.use_yoho_coin = yohoCoin;
|
|
|
if (params.use_yoho_coin) {
|
|
|
finalParams.use_yoho_coin = params.use_yoho_coin;
|
|
|
}
|
|
|
|
|
|
// 购买限购商品时需要传递product_sku_list参数
|
|
|
if (skuList && !activityInfo) {
|
|
|
params.product_sku_list = JSON.stringify(skuList);
|
|
|
if (params.product_sku_list && !params.activityInfo) {
|
|
|
finalParams.product_sku_list = JSON.stringify(params.product_sku_list);
|
|
|
}
|
|
|
|
|
|
// 购买套餐商品需要的数据
|
|
|
if (activityInfo) {
|
|
|
params.activity_id = activityInfo.activity_id;
|
|
|
params.product_sku_list = JSON.stringify(activityInfo.product_sku_list); // TODO 检查 JSON 是否正常
|
|
|
if (params.activityInfo) {
|
|
|
finalParams.activity_id = params.activityInfo.activity_id;
|
|
|
finalParams.product_sku_list = JSON.stringify(params.activityInfo.product_sku_list); // TODO 检查 JSON 是否正常
|
|
|
}
|
|
|
|
|
|
// 友盟有关信息的传递
|
|
|
if (otherParams.unionKey) {
|
|
|
params.qhy_union = otherParams.unionKey;
|
|
|
if (params.qhy_union) {
|
|
|
finalParams.qhy_union = params.qhy_union;
|
|
|
}
|
|
|
|
|
|
// 是否是微信商城
|
|
|
if (otherParams.isWechat) {
|
|
|
params.client_type = 'wechat';
|
|
|
if (params.isWechat) {
|
|
|
finalParams.client_type = 'wechat';
|
|
|
}
|
|
|
|
|
|
return api.post('', params, {
|
|
|
return api.post('', finalParams, {
|
|
|
headers: {
|
|
|
'X-Forwarded-For': otherParams.ip || '',
|
|
|
'User-Agent': otherParams.userAgent
|
|
|
'X-Forwarded-For': params.ip || '',
|
|
|
'User-Agent': params.userAgent
|
|
|
}
|
|
|
});
|
|
|
};
|
...
|
...
|
|