...
|
...
|
@@ -11,12 +11,40 @@ const helpers = global.yoho.helpers; |
|
|
const _ = require('lodash');
|
|
|
const service = global.yoho.ServiceAPI;
|
|
|
|
|
|
const activity = () => {
|
|
|
return service.get('/operations/api/v5/resource/home', {
|
|
|
content_code: '8512bf0755cc549ac323f852c9fd945d',
|
|
|
gender: 1,
|
|
|
limit: 1000,
|
|
|
page: 1
|
|
|
const _activity = () => {
|
|
|
return service.get('/activity/lottery/getLotteryInfo', {
|
|
|
lotteryId: 20
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const _user = (params) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.passport.profile',
|
|
|
uid: params.uid
|
|
|
}, {
|
|
|
code: 200
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const activity = (params) => {
|
|
|
return Promise.all([_activity(params), _user(params)]).then((result) => {
|
|
|
|
|
|
let resu = '';
|
|
|
|
|
|
let mobile = '';
|
|
|
|
|
|
if (result && result[0] && result[1] && result[1].data) {
|
|
|
|
|
|
resu = result[0].data;
|
|
|
|
|
|
mobile = result[1].data.mobile;
|
|
|
|
|
|
Object.assign(resu, {
|
|
|
mobile: mobile.substr(0,3) + '****' + mobile.substr(7)
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return resu;
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
@@ -43,7 +71,7 @@ const _formatOrderGoods = (orderGoods, count, haveLink, tickets) => { |
|
|
color: value.color_name,
|
|
|
size: value.size_name,
|
|
|
price: value.goods_price,
|
|
|
count: value.buy_number
|
|
|
count: value.buy_num
|
|
|
};
|
|
|
|
|
|
/* gift=>是否赠品,advanceBuy=>是否加价购 */
|
...
|
...
|
@@ -117,13 +145,9 @@ const _assignExpressInfo = (showLogistics, order) => { |
|
|
* @param params
|
|
|
*/
|
|
|
const _getOrderData = (params) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.SpaceOrders.get',
|
|
|
type: params.type,
|
|
|
return service.get('/activity/lottery/getValidOrderList', {
|
|
|
page: params.page,
|
|
|
limit: params.limit,
|
|
|
gender: params.gender,
|
|
|
yh_channel: params.yh_channel,
|
|
|
limit: 100,
|
|
|
uid: params.uid
|
|
|
}, {code: 200});
|
|
|
};
|
...
|
...
|
@@ -319,19 +343,26 @@ const getOrders = (params) => { |
|
|
count = 0;
|
|
|
|
|
|
let perOrder = _getOrderStatus(value);
|
|
|
|
|
|
/* 是否是虚拟商品 */
|
|
|
let isTickets = order.virtual_type && parseInt(order.virtual_type, 10) === 3;
|
|
|
|
|
|
Object.assign(perOrder, {
|
|
|
orderNum: value.order_code,
|
|
|
orderStatus: value.status_str,
|
|
|
sumCost: value.amount,
|
|
|
goods: _formatOrderGoods(value.order_goods, count, false, isTickets),
|
|
|
detailUrl: helpers.urlFormat('/home/orderdetail', {order_code: value.order_code}),
|
|
|
count: value.buy_total,
|
|
|
// count: value.buy_total,
|
|
|
isVirtual: isTickets,
|
|
|
isDepositAdvance: value.attribute * 1 === 9// 定金预售
|
|
|
isDepositAdvance: value.attribute * 1 === 9, // 定金预售
|
|
|
status: value.status === 0 ? true : false,
|
|
|
uid: value.uid,
|
|
|
order_code: value.order_code
|
|
|
});
|
|
|
|
|
|
_.forEach(value.order_goods, item => {
|
|
|
Object.assign(perOrder, {
|
|
|
count: item.buy_num
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/* 如果运费大于0,会显示运费 */
|
...
|
...
|
@@ -355,9 +386,38 @@ const getOrders = (params) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 抽奖
|
|
|
* @returns {*}
|
|
|
* @private
|
|
|
* @param params
|
|
|
*/
|
|
|
const lucky = (params) => {
|
|
|
return service.post('/activity/lottery/lucky', {
|
|
|
lotteryId: params.lotteryId,
|
|
|
userId: params.userId,
|
|
|
orderCode: params.orderCode
|
|
|
}, {code: 200});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 送有货币
|
|
|
* @returns {*}
|
|
|
* @private
|
|
|
* @param params
|
|
|
*/
|
|
|
const bind = (params) => {
|
|
|
return service.get('/activity/lottery/giveBindPrize', {
|
|
|
userId: params.userId
|
|
|
}, {code: 200});
|
|
|
};
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
order,
|
|
|
getOrders,
|
|
|
activity
|
|
|
activity,
|
|
|
lucky,
|
|
|
bind
|
|
|
};
|
|
|
|
...
|
...
|
|