Authored by 郭成尧

'cancelReason'

... ... @@ -15,7 +15,7 @@ exports.order = (req, res, next) => {
page: req.query.page || 1,
gender: req.query.gender || '1,3',
yh_channel: req.query.channel || 1,
uid: req.user.uid || 20000266
uid: req.user.uid || 8039759 // TODO 待删除
};
orderModel.order(params).then(result => {
... ... @@ -34,7 +34,7 @@ exports.getOrders = (req, res, next) => {
page: req.query.page || 1,
gender: req.query.gender || '1,3',
yh_channel: req.query.channel || 1,
uid: req.user.uid || 20000266
uid: req.user.uid || 8039759 // TODO 待删除
};
orderModel.order(params).then(result => {
... ...
'use strict';
const api = global.yoho.API;
const singleAPI = global.yoho.SingleAPI;
// const singleAPI = global.yoho.SingleAPI;
const helpers = global.yoho.helpers;
const camelCase = global.yoho.camelCase;
const _ = require('lodash');
... ... @@ -54,35 +55,37 @@ const processOrderData = (data) => {
return formartData;
};
const getNavs = (data) => {
// navType = ["全部", "待付款", "待发货", "待收货"];
// nav = [];
// _.forEach(navType, (obj) => {
// // obj.act = false;
// // if (obj.type == obj.key) {
// // obj.act = true;
// // }
// let newObj = {
// name : obj.value,
// typeId : obj.key,
// active : obj.act,
// //url : Helpers::url('/home/orders', array('type' => $key))
// }
// nav.push(newObj);
// }
const _getNavs = (type) => {
let navType = ['全部', '待付款', '待发货', '待收货'];
let nav = [];
_.forEach(navType, (obj, key) => {
nav.push({
name: obj,
typeId: key,
active: key === type,
url: helpers.urlFormat('/home/orders', {type: key})
});
});
// return nav;
return nav;
};
// type, page, limit, gender, yh_channel, uid
const order = (params) => {
let finalResult = {};
Object.assign(finalResult, {navs: _getNavs(params.type)});
return api.get('', _.assign({
method: 'app.SpaceOrders.get',
limit: 10,
}, params)).then((data) => {
if (data && data.code === 200) {
return processOrderData(data.data);
method: 'app.SpaceOrders.closeReasons'
}, params), {code: 200}).then((result) => {
if (result.data) {
Object.assign(finalResult, {cancelReason: result.data});
}
return finalResult;
});
};
... ...