|
|
/**
|
|
|
* 商品基本信息
|
|
|
* 退换货
|
|
|
* @author: yyq<yanqing.yang@yoho.cn>
|
|
|
* @date: 2016/7/19
|
|
|
*/
|
|
|
'use strict';
|
|
|
|
|
|
const api = global.yoho.API;
|
|
|
const camelCase = global.yoho.camelCase;
|
|
|
|
|
|
const _ = require('lodash');
|
|
|
const mcHandler = require('./menu-crumb-handler');
|
|
|
const returnsAPI = require('./returns-api');
|
|
|
|
|
|
const helpers = global.yoho.helpers;
|
|
|
|
|
|
const pageSize = 10;
|
|
|
|
|
|
const getUserReturn = (uid, page) => {
|
|
|
|
|
|
return api.get('', {
|
|
|
method: 'app.refund.getList',
|
|
|
uid: uid,
|
|
|
page: page || 1,
|
|
|
limit: 10
|
|
|
}).then(result => {
|
|
|
const basicData = {
|
|
|
title: '我的退/换货'
|
|
|
};
|
|
|
|
|
|
const refundStr = {
|
|
|
1: '退货',
|
|
|
2: '换货'
|
|
|
};
|
|
|
|
|
|
const data = camelCase(result.data);
|
|
|
|
|
|
const paginationOpts = data.total > pageSize ? {
|
|
|
paginationOpts: {
|
|
|
total: data.total,
|
|
|
page: data.page,
|
|
|
limit: pageSize
|
|
|
}
|
|
|
} : false;
|
|
|
|
|
|
data.list.forEach(item => {
|
|
|
item.orderGoods = item.goods;
|
|
|
item.createTime = item.orderCreateTime;
|
|
|
item.hidePrice = true;
|
|
|
item.showStatus = true;
|
|
|
item.refundStr = refundStr[item.refundType];
|
|
|
|
|
|
item.orderGoods.forEach(it => {
|
|
|
it.hidePrice = true;
|
|
|
});
|
|
|
});
|
|
|
|
|
|
return {
|
|
|
returnsList: Object.assign(data, paginationOpts, basicData)
|
|
|
};
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const _setSideMenu = (type) => {
|
|
|
return {
|
|
|
nav: mcHandler.getMeCrumb(type),
|
...
|
...
|
@@ -84,6 +134,7 @@ const saveRefund = (orderCode, uid, goods, payment) => { |
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
getUserReturn,
|
|
|
getRefundGoodsData,
|
|
|
saveRefund
|
|
|
}; |
...
|
...
|
|