...
|
...
|
@@ -7,7 +7,6 @@ |
|
|
'use strict';
|
|
|
|
|
|
const api = global.yoho.API;
|
|
|
const camelCase = global.yoho.camelCase;
|
|
|
const moment = require('moment');
|
|
|
|
|
|
const helpers = global.yoho.helpers;
|
...
|
...
|
@@ -240,31 +239,31 @@ const _getUserOrder = (uid, type, page) => { |
|
|
|
|
|
|
|
|
if (result && result.data) {
|
|
|
orderList = camelCase(result.data.order_list);
|
|
|
orderList = result.data.order_list;// camelCase(result.data.order_list);
|
|
|
total = result.data.total;
|
|
|
curPage = result.data.page;
|
|
|
}
|
|
|
|
|
|
orderList.forEach(item => {
|
|
|
const ot = parseInt(item.orderType, 10);
|
|
|
const ot = parseInt(item.order_type, 10);
|
|
|
const st = parseInt(item.status, 10);
|
|
|
let hasRefund = false;
|
|
|
let canRefund = false;
|
|
|
|
|
|
item.orderGoods.forEach(good => {
|
|
|
let cnAlphabet = good.cnAlphabet ? good.cnAlphabet : '';
|
|
|
item.order_goods.forEach(good => {
|
|
|
let cnAlphabet = good.cn_alphabet ? good.cn_alphabet : '';
|
|
|
|
|
|
good.goodUrl = helpers.urlFormat(`/product/pro_${good.productId}_${good.goodsId}/${cnAlphabet}.html`);
|
|
|
good.goodUrl = helpers.urlFormat(`/product/pro_${good.product_id}_${good.goods_id}/${cnAlphabet}.html`);
|
|
|
|
|
|
// 判断该订单是否有换货商品
|
|
|
if (good.refundNum) {
|
|
|
if (good.refund_num) {
|
|
|
hasRefund = true;
|
|
|
good.changed = true;
|
|
|
good.returnUrl = helpers.urlFormat('/me/return');
|
|
|
}
|
|
|
|
|
|
// 判断该订单是否可以退换货
|
|
|
if (parseInt(good.buyNumber, 10) !== parseInt(good.refundNum, 10)) {
|
|
|
if (parseInt(good.buy_number, 10) !== parseInt(good.refund_num, 10)) {
|
|
|
canRefund = true;
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -274,10 +273,10 @@ const _getUserOrder = (uid, type, page) => { |
|
|
item.hideChange = !canRefund;
|
|
|
|
|
|
// 转换订单创建时间
|
|
|
item.createTime = _convertUnixTime(item.createTime);
|
|
|
item.create_time = _convertUnixTime(item.create_time);
|
|
|
|
|
|
// 没有取消订单并且状态为0的时候显示付款按钮
|
|
|
if (item.isCancel === 'N' &&
|
|
|
if (item.is_cancel === 'N' &&
|
|
|
st === 0) {
|
|
|
item.showPayButton = true;
|
|
|
}
|
...
|
...
|
@@ -293,15 +292,15 @@ const _getUserOrder = (uid, type, page) => { |
|
|
item.showGetBtn = statusMap[st].showGetBtn;
|
|
|
|
|
|
// 在线支付和货到付款有按钮的差异
|
|
|
item.isOnlinePaid = parseInt(item.paymentType, 10) === 1;
|
|
|
item.isOnlinePaid = parseInt(item.payment_type, 10) === 1;
|
|
|
|
|
|
item.isRefundOrder = ot === 7;
|
|
|
|
|
|
if (parseInt(item.payLefttime, 10) !== 0) {
|
|
|
if (parseInt(item.pay_lefttime, 10) !== 0) {
|
|
|
item.showLeftTime = true;
|
|
|
}
|
|
|
|
|
|
if (item.isCancel === 'Y') {
|
|
|
if (item.is_cancel === 'Y') {
|
|
|
item.showBuyBtn = true;
|
|
|
item.statusStr = '已取消';
|
|
|
} else if (item.isOnlinePaid) {
|
...
|
...
|
@@ -309,17 +308,17 @@ const _getUserOrder = (uid, type, page) => { |
|
|
}
|
|
|
|
|
|
item.payUrl = helpers.urlFormat('/shopping/pay/online', {
|
|
|
code: item.orderCode
|
|
|
code: item.order_code
|
|
|
});
|
|
|
|
|
|
item.refundUrl = helpers.urlFormat('/me/return/refund/', {
|
|
|
orderCode: item.orderCode
|
|
|
orderCode: item.order_code
|
|
|
});
|
|
|
item.exchangeUrl = helpers.urlFormat('/me/return/exchange/', {
|
|
|
orderCode: item.orderCode
|
|
|
orderCode: item.order_code
|
|
|
});
|
|
|
item.detailUrl = helpers.urlFormat('/me/order/detail/', {
|
|
|
orderCode: item.orderCode
|
|
|
orderCode: item.order_code
|
|
|
});
|
|
|
});
|
|
|
|
...
|
...
|
@@ -485,8 +484,8 @@ const getOrderData = (uid, type, page) => { |
|
|
*/
|
|
|
const getOrderDetail = (uid, code) => {
|
|
|
return api.all([_getDetail(uid, code), getExpressInfo(uid, code)]).then(result => {
|
|
|
const detail = result[0] && camelCase(result[0].data);
|
|
|
const express = result[1] && camelCase(result[1].data);
|
|
|
const detail = result[0] && result[0].data;// camelCase(result[0].data);
|
|
|
const express = result[1] && result[1].data;// camelCase(result[1].data);
|
|
|
|
|
|
const st = parseInt(detail.status, 10);
|
|
|
|
...
|
...
|
@@ -496,25 +495,25 @@ const getOrderDetail = (uid, code) => { |
|
|
|
|
|
let btns = [];
|
|
|
|
|
|
detail.orderGoods.forEach(good => {
|
|
|
let cnAlphabet = good.cnAlphabet ? good.cnAlphabet : '';
|
|
|
detail.order_goods.forEach(good => {
|
|
|
let cnAlphabet = good.cn_alphabet ? good.cn_alphabet : '';
|
|
|
|
|
|
good.goodUrl = helpers.urlFormat(`/product/pro_${good.productId}_${good.goodsId}/${cnAlphabet}.html`);
|
|
|
good.goodUrl = helpers.urlFormat(`/product/pro_${good.product_id}_${good.goods_id}/${cnAlphabet}.html`);
|
|
|
});
|
|
|
|
|
|
detail.createTime = _convertUnixTime(detail.createTime);
|
|
|
detail.create_time = _convertUnixTime(detail.create_time);
|
|
|
|
|
|
if (detail.isCancel === 'N' &&
|
|
|
if (detail.is_cancel === 'N' &&
|
|
|
st === 0 &&
|
|
|
parseInt(detail.payLefttime, 10) !== 0) {
|
|
|
parseInt(detail.pay_lefttime, 10) !== 0) {
|
|
|
detail.showLeftTime = true;
|
|
|
}
|
|
|
|
|
|
if (st !== 0 && detail.isCancel !== 'Y') {
|
|
|
if (st !== 0 && detail.is_cancel !== 'Y') {
|
|
|
detail.showPaid = true;
|
|
|
}
|
|
|
|
|
|
if (detail.isCancel !== 'Y') {
|
|
|
if (detail.is_cancel !== 'Y') {
|
|
|
detail.steps = _getStepByOrderStatus(st);
|
|
|
|
|
|
statusMap[st].btns.forEach(function(btn) {
|
...
|
...
|
@@ -531,15 +530,15 @@ const getOrderDetail = (uid, code) => { |
|
|
}
|
|
|
});
|
|
|
|
|
|
if (detail.canUpdateDeliveryAddress === 'N') {
|
|
|
if (detail.can_update_delivery_address === 'N') {
|
|
|
_.remove(detail.btns, btn => {
|
|
|
return btn.isEditBtn;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (parseInt(detail.paymentType, 10) === 2 &&
|
|
|
if (parseInt(detail.payment_type, 10) === 2 &&
|
|
|
(statusMap[st].valueStr === '备货中' ||
|
|
|
detail.statusStr === '备货中')) {
|
|
|
detail.status_str === '备货中')) {
|
|
|
detail.btns = btnMap.special;
|
|
|
} else {
|
|
|
detail.statusStr = statusMap[st].valueStr;
|
...
|
...
|
@@ -553,12 +552,12 @@ const getOrderDetail = (uid, code) => { |
|
|
detail.invoice = false;
|
|
|
}
|
|
|
|
|
|
detail.paymentTypeStr = paymentTypeStr[detail.paymentType];
|
|
|
detail.paymentTypeStr = paymentTypeStr[detail.payment_type];
|
|
|
|
|
|
detail.allAddress = detail.area + detail.address;
|
|
|
|
|
|
detail.expressInfo = express;
|
|
|
detail.expressInfo.addressList = _convertAddress(express.expressDetail, detail.createTime);
|
|
|
detail.expressInfo.addressList = _convertAddress(express.express_detail, detail.create_time);
|
|
|
|
|
|
return {
|
|
|
orderDetail: Object.assign(basicData, detail)
|
...
|
...
|
|