...
|
...
|
@@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
|
const api = global.yoho.API;
|
|
|
const serviceApi = global.yoho.ServiceAPI;
|
|
|
|
|
|
const _ = require('lodash');
|
|
|
|
...
|
...
|
@@ -10,6 +11,8 @@ const helpers = global.yoho.helpers; |
|
|
const camelCase = global.yoho.camelCase;
|
|
|
const logger = global.yoho.logger;
|
|
|
|
|
|
const CODE_LOGISTIC_BANNER = '1fc9b2484fcd559049f2f7e0db313f20'; // 物流详情banner资源码
|
|
|
|
|
|
const closeReasons = () => {
|
|
|
return api.get('', {
|
|
|
method: 'app.SpaceOrders.closeReasons'
|
...
|
...
|
@@ -370,10 +373,84 @@ const cancelOrder = (orderCode, uid, reasonId, gender, channel, reason) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
/*
|
|
|
* 我的订单-查看物流
|
|
|
* @param int $orderCode 订单号
|
|
|
* @param int $uid 用户ID
|
|
|
* @return array
|
|
|
*/
|
|
|
const _logisticsData = (orderCode, uid) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.express.li',
|
|
|
order_code: orderCode,
|
|
|
uid: uid
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取物流详情页banner
|
|
|
*/
|
|
|
const _getLogisterBanner = () => {
|
|
|
return serviceApi.get('operations/api/v5/resource/get', {
|
|
|
content_code: CODE_LOGISTIC_BANNER
|
|
|
}, {code: 200});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 查看物流
|
|
|
*
|
|
|
* @param int orderCode 订单编号
|
|
|
* @param int uid 用户ID
|
|
|
* @return array
|
|
|
*/
|
|
|
const logistics = (orderCode, uid) => {
|
|
|
return Promise.all([
|
|
|
_getLogisterBanner(),
|
|
|
_logisticsData(orderCode, uid),
|
|
|
]).then(result => {
|
|
|
let finalResult = {
|
|
|
banner: []
|
|
|
};
|
|
|
let banners = result[0];
|
|
|
let logistic = result[1];
|
|
|
|
|
|
// 获取物流详情页banner
|
|
|
if (banners && banners.data) {
|
|
|
_.forEach(banners.data, value => {
|
|
|
_.forEach(value.data, subValue => {
|
|
|
finalResult.banner.push({
|
|
|
url: subValue.url,
|
|
|
img: subValue.src
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (logistic && logistic.data) {
|
|
|
finalResult.logisticUrl = _.get(logistic, 'data.url', '');
|
|
|
finalResult.logisticImg = _.get(logistic, 'data.logo', '');
|
|
|
finalResult.logisticCompany = _.get(logistic, 'data.caption', '');
|
|
|
finalResult.logisticNumber = _.get(logistic, 'data.express_number', '');
|
|
|
finalResult.logisticDetail = [];
|
|
|
|
|
|
_.forEach(_.get(logistic, 'data.express_detail', []), value => {
|
|
|
finalResult.logisticDetail.push({
|
|
|
status: value.accept_address,
|
|
|
date: value.acceptTime,
|
|
|
});
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
return finalResult;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
orderDetailData,
|
|
|
closeReasons,
|
|
|
delOrder,
|
|
|
readdData,
|
|
|
cancelOrder
|
|
|
cancelOrder,
|
|
|
logistics
|
|
|
}; |
...
|
...
|
|