...
|
...
|
@@ -100,8 +100,47 @@ const isMobileOrder = { |
|
|
6: true
|
|
|
};
|
|
|
|
|
|
// 转换时间戳
|
|
|
const _convertUnixTime = src => {
|
|
|
return moment.unix(src).format('YYYY-MM-DD hh:mm:ss');
|
|
|
};
|
|
|
|
|
|
const _convertAddress = (addressList, createTime) => {
|
|
|
let addrList = [];
|
|
|
|
|
|
addressList.forEach(addr => {
|
|
|
let address = {
|
|
|
time: '',
|
|
|
city: '',
|
|
|
action: ''
|
|
|
};
|
|
|
|
|
|
address.time = addr.acceptTime;
|
|
|
addr = addr.acceptAddress.split(' ');
|
|
|
|
|
|
if (addr.length > 1 && /市/.test(addr[0])) {
|
|
|
address.city = addr[0].replace('市', '');
|
|
|
addr.splice(0, 1);
|
|
|
address.action = addr.join('');
|
|
|
} else {
|
|
|
address.action = addr.join('');
|
|
|
}
|
|
|
|
|
|
|
|
|
addrList.push(address);
|
|
|
});
|
|
|
|
|
|
// 增加一个默认初始状态
|
|
|
addrList.push({
|
|
|
time: createTime,
|
|
|
action: '您的订单已提交,等待付款'
|
|
|
});
|
|
|
|
|
|
return _.reverse(addrList);
|
|
|
};
|
|
|
|
|
|
// 根据订单状态获取当前步骤
|
|
|
const _getStepByOrderStatus = (st) => {
|
|
|
const _getStepByOrderStatus = st => {
|
|
|
let steps = [
|
|
|
{
|
|
|
stepStr: '1.提交订单'
|
...
|
...
|
@@ -128,50 +167,6 @@ const _getStepByOrderStatus = (st) => { |
|
|
return steps;
|
|
|
};
|
|
|
|
|
|
// 转换时间戳
|
|
|
const _convertUnixTime = (src) => {
|
|
|
return moment.unix(src).format('YYYY-MM-DD hh:mm:ss');
|
|
|
};
|
|
|
|
|
|
const deleteOrder = (uid, code) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.SpaceOrders.delOrderByCode',
|
|
|
uid: uid,
|
|
|
order_code: code
|
|
|
}, {
|
|
|
cache: true
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const cancelOrder = (uid, code) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.SpaceOrders.close',
|
|
|
uid: uid,
|
|
|
order_code: code
|
|
|
}, {
|
|
|
cache: true
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const getCancelOrderReason = () => {
|
|
|
return api.get('', {
|
|
|
method: 'app.SpaceOrders.closeReasons'
|
|
|
}, {
|
|
|
cache: true
|
|
|
});
|
|
|
};
|
|
|
|
|
|
|
|
|
const getExpressInfo = (uid, code) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.express.get',
|
|
|
uid: uid,
|
|
|
order_code: code
|
|
|
}, {
|
|
|
cache: true
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const _getDetail = (uid, code) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.SpaceOrders.detail',
|
...
|
...
|
@@ -244,38 +239,43 @@ const _getUserOrder = (uid, type, page) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
const _convertAddress = (addressList, createTime) => {
|
|
|
let addrList = [];
|
|
|
|
|
|
addressList.forEach(addr => {
|
|
|
let address = {
|
|
|
time: '',
|
|
|
city: '',
|
|
|
action: ''
|
|
|
};
|
|
|
|
|
|
address.time = addr.acceptTime;
|
|
|
addr = addr.acceptAddress.split(' ');
|
|
|
|
|
|
if (addr.length > 1 && /市/.test(addr[0])) {
|
|
|
address.city = addr[0].replace('市', '');
|
|
|
addr.splice(0, 1);
|
|
|
address.action = addr.join('');
|
|
|
} else {
|
|
|
address.action = addr.join('');
|
|
|
}
|
|
|
|
|
|
const deleteOrder = (uid, code) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.SpaceOrders.delOrderByCode',
|
|
|
uid: uid,
|
|
|
order_code: code
|
|
|
}, {
|
|
|
cache: true
|
|
|
});
|
|
|
};
|
|
|
|
|
|
addrList.push(address);
|
|
|
const cancelOrder = (uid, code) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.SpaceOrders.close',
|
|
|
uid: uid,
|
|
|
order_code: code
|
|
|
}, {
|
|
|
cache: true
|
|
|
});
|
|
|
};
|
|
|
|
|
|
// 增加一个默认初始状态
|
|
|
addrList.push({
|
|
|
time: createTime,
|
|
|
action: '您的订单已提交,等待付款'
|
|
|
const getCancelOrderReason = () => {
|
|
|
return api.get('', {
|
|
|
method: 'app.SpaceOrders.closeReasons'
|
|
|
}, {
|
|
|
cache: true
|
|
|
});
|
|
|
};
|
|
|
|
|
|
return _.reverse(addrList);
|
|
|
const getExpressInfo = (uid, code) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.express.get',
|
|
|
uid: uid,
|
|
|
order_code: code
|
|
|
}, {
|
|
|
cache: true
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const getOrderData = (uid, type, page) => {
|
...
|
...
|
@@ -362,11 +362,27 @@ const getOrderDetail = (uid, code) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
const editOrder = data => {
|
|
|
return api.get('', {
|
|
|
method: 'app.SpaceOrders.updateDeliveryAddress',
|
|
|
uid: data.uid,
|
|
|
order_code: data.orderCode,
|
|
|
user_name: data.userName,
|
|
|
area_code: data.areaCode,
|
|
|
address: data.address,
|
|
|
mobile: data.mobile,
|
|
|
phone: data.phone
|
|
|
}, {
|
|
|
cache: true
|
|
|
});
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
getOrderData: getOrderData,
|
|
|
getOrderDetail: getOrderDetail,
|
|
|
cancelOrder: cancelOrder,
|
|
|
getCancelOrderReason: getCancelOrderReason,
|
|
|
deleteOrder: deleteOrder,
|
|
|
editOrder: editOrder,
|
|
|
getExpressInfo: getExpressInfo
|
|
|
}; |
...
|
...
|
|