...
|
...
|
@@ -26,14 +26,18 @@ const closeReasons = () => { |
|
|
* 获取快递有关信息
|
|
|
* @private
|
|
|
*/
|
|
|
const _assignExpressInfo = (showLogistics, order, result) => {
|
|
|
if (showLogistics && order.express_company.caption && order.express_number) {
|
|
|
Object.assign(result, {
|
|
|
logisticsUrl: helpers.urlFormat('/home/logistic', {order_code: order.order_code}),
|
|
|
logisticsCompany: order.express_company.caption,
|
|
|
logisticsNum: order.express_number
|
|
|
});
|
|
|
const _assignExpressInfo = (showLogistics, order) => {
|
|
|
let data = {};
|
|
|
|
|
|
if (showLogistics && order.expressCompany.caption) {
|
|
|
data = {
|
|
|
logisticsUrl: helpers.urlFormat('/home/logistic', {order_code: order.orderCode}),
|
|
|
logisticsCompany: order.expressCompany.caption,
|
|
|
logisticsNum: order.expressNumber || ''
|
|
|
};
|
|
|
}
|
|
|
|
|
|
return data;
|
|
|
};
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -49,10 +53,12 @@ const _getOrderStatus = (order, showLogistics) => { |
|
|
};
|
|
|
}
|
|
|
|
|
|
order.status = parseInt(order.status, 10);
|
|
|
|
|
|
// 先判断订单付款方式,根据不同的付款方式计算订单状态。(注:货到付款没有待付款状态)
|
|
|
// 支付方式为非货到付款时,计算订单状态。
|
|
|
if (parseInt(order.paymentType, 10) !== 2) {
|
|
|
switch (parseInt(order.status, 10)) {
|
|
|
switch (order.status) {
|
|
|
case 0:
|
|
|
|
|
|
/* 待付款 */
|
...
|
...
|
@@ -84,7 +90,7 @@ const _getOrderStatus = (order, showLogistics) => { |
|
|
qrcode: helpers.urlFormat(`/home/QRcode/${order.order_code}`)
|
|
|
});
|
|
|
} else {
|
|
|
_assignExpressInfo(showLogistics, order, result);
|
|
|
Object.assign(result, _assignExpressInfo(showLogistics, order));
|
|
|
}
|
|
|
break;
|
|
|
case 6:
|
...
|
...
|
@@ -100,7 +106,7 @@ const _getOrderStatus = (order, showLogistics) => { |
|
|
qrcode: helpers.urlFormat(`/home/QRcode/${order.order_code}`)
|
|
|
});
|
|
|
} else {
|
|
|
_assignExpressInfo(showLogistics, order, result);
|
|
|
Object.assign(result, _assignExpressInfo(showLogistics, order));
|
|
|
}
|
|
|
break;
|
|
|
default:
|
...
|
...
|
@@ -109,7 +115,7 @@ const _getOrderStatus = (order, showLogistics) => { |
|
|
} else {
|
|
|
|
|
|
/* 订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态) */
|
|
|
switch (parseInt(order.status, 10)) {
|
|
|
switch (order.status) {
|
|
|
case 0:
|
|
|
|
|
|
/* 备货中 */
|
...
|
...
|
@@ -133,7 +139,7 @@ const _getOrderStatus = (order, showLogistics) => { |
|
|
Object.assign(result, {
|
|
|
unreceived: true
|
|
|
});
|
|
|
_assignExpressInfo(showLogistics, order, result);
|
|
|
Object.assign(result, _assignExpressInfo(showLogistics, order));
|
|
|
break;
|
|
|
case 6:
|
|
|
|
...
|
...
|
@@ -141,7 +147,7 @@ const _getOrderStatus = (order, showLogistics) => { |
|
|
Object.assign(result, {
|
|
|
completed: true
|
|
|
});
|
|
|
_assignExpressInfo(showLogistics, order, result);
|
|
|
Object.assign(result, _assignExpressInfo(showLogistics, order));
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
...
|
...
|
@@ -163,11 +169,9 @@ const orderDetailData = (uid, orderCode) => { |
|
|
if (result && result.code === 200) {
|
|
|
let orderDetail = camelCase(result.data);
|
|
|
let goods = [];
|
|
|
|
|
|
let status = _getOrderStatus(orderDetail);
|
|
|
let status = _getOrderStatus(orderDetail, true);
|
|
|
|
|
|
orderDetail = _.assign(orderDetail, status);
|
|
|
orderDetail.useLimitCode = orderDetail.useLimitCode === 'Y';
|
|
|
|
|
|
if (orderDetail.virtualType && orderDetail.virtualType === 3) {
|
|
|
orderDetail = _.assign(orderDetail, {
|
...
|
...
|
@@ -251,13 +255,6 @@ const orderDetailData = (uid, orderCode) => { |
|
|
});
|
|
|
}
|
|
|
|
|
|
// 定金预售
|
|
|
if (orderDetail.attribute * 1 === 9) {
|
|
|
orderDetail = _.assign(orderDetail, {
|
|
|
isDepositAdvance: true
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 判断是否有关联订单
|
|
|
if (orderDetail.relateOrderCode === 'Y') {
|
|
|
orderDetail = _.assign(orderDetail, {
|
...
|
...
|
@@ -269,6 +266,13 @@ const orderDetailData = (uid, orderCode) => { |
|
|
});
|
|
|
}
|
|
|
|
|
|
// 定金预售
|
|
|
if (orderDetail.attribute * 1 === 9) {
|
|
|
orderDetail = _.assign(orderDetail, {
|
|
|
isDepositAdvance: true
|
|
|
});
|
|
|
}
|
|
|
|
|
|
orderDetail = _.assign(orderDetail, {
|
|
|
goodsAmount: orderDetail.paymentAmount,
|
|
|
url: '/home/addressModify?orderCode=' + orderCode + '&relation=' + orderDetail.relation
|
...
|
...
|
|