|
|
'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);
|
|
|
// }
|
|
|
|
|
|
// return nav;
|
|
|
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;
|
|
|
};
|
|
|
|
|
|
// 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;
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
|