...
|
...
|
@@ -55,9 +55,35 @@ const _getBirthCouponById = (uid) => { |
|
|
uid: uid,
|
|
|
couponType: 4,
|
|
|
}).then(result => {
|
|
|
|
|
|
if (result && result.data) {
|
|
|
return result.data;
|
|
|
let final = {
|
|
|
ticket: []
|
|
|
};
|
|
|
|
|
|
final.birthType = true;
|
|
|
if (result.data.list && result.data.list[0].body.is_collar === 'Y') {
|
|
|
final = {
|
|
|
isCollar: true
|
|
|
};
|
|
|
} else {
|
|
|
if (result.data && !result.data[0].err) {
|
|
|
for (let coupon of result.data) {
|
|
|
final.ticket.push({
|
|
|
id: coupon.id ? coupon.id : '',
|
|
|
couponAmount: coupon.couponAmount,
|
|
|
couponName: coupon.couponName.split('-')[0],
|
|
|
startTime: _formatDay(coupon.startTime),
|
|
|
endTime: _formatDay(coupon.endTime),
|
|
|
useLimit: coupon.useLimit
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
final = {
|
|
|
err: result.data[0].err
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
return final;
|
|
|
} else {
|
|
|
if (result.code === 410) {
|
|
|
return [{err: result.message}];
|
...
|
...
|
@@ -71,7 +97,7 @@ const _getBirthCouponById = (uid) => { |
|
|
};
|
|
|
|
|
|
// 获取详情页
|
|
|
const _detail = (result, id, couponData) => {
|
|
|
const _detail = (result, id) => {
|
|
|
let final = {};
|
|
|
|
|
|
if (result.data && result.data.list) {
|
...
|
...
|
@@ -83,49 +109,6 @@ const _detail = (result, id, couponData) => { |
|
|
|
|
|
// 判断消息类型
|
|
|
switch (item.type) {
|
|
|
case 'pullCoupon':
|
|
|
final = {
|
|
|
ticket: []
|
|
|
};
|
|
|
final.birthType = true;
|
|
|
|
|
|
if (result.data.list[0].body.is_collar === 'Y') {
|
|
|
|
|
|
final = {
|
|
|
isCollar: true
|
|
|
};
|
|
|
|
|
|
} else {
|
|
|
if (couponData && !couponData[0].err) {
|
|
|
for (let coupon of couponData) {
|
|
|
final.ticket.push({
|
|
|
id: coupon.id ? coupon.id : '',
|
|
|
couponAmount: coupon.couponAmount,
|
|
|
couponName: coupon.couponName.split('-')[0],
|
|
|
startTime: _formatDay(coupon.startTime),
|
|
|
endTime: _formatDay(coupon.endTime),
|
|
|
useLimit: coupon.useLimit
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
final = {
|
|
|
err: couponData[0].err
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 领取生日券消息
|
|
|
// final.coupons = [];
|
|
|
// for (let coupon of couponData) {
|
|
|
// final.coupons.push({
|
|
|
// id: coupon.id ? coupon.id : '',
|
|
|
// remark: coupon.couponName ? coupon.couponName : '',
|
|
|
// useTime: item.body.use_time ? item.body.use_time : '',
|
|
|
// pickTime: item.body.collar_time ? item.body.collar_time : '',
|
|
|
// canPick: true
|
|
|
// });
|
|
|
// }
|
|
|
break;
|
|
|
case 'button':
|
|
|
// 促销活动
|
|
|
if (item.body) {
|
...
|
...
|
@@ -175,9 +158,7 @@ const getList = (params) => { |
|
|
}).then(result => {
|
|
|
if (params.msgid) {
|
|
|
// 绕的一比
|
|
|
return _getBirthCouponById(params.uid).then(couponData => {
|
|
|
return _detail(result, params.msgid, couponData);
|
|
|
});
|
|
|
return _detail(result, params.msgid);
|
|
|
} else {
|
|
|
return _list(result);
|
|
|
}
|
...
|
...
|
@@ -228,4 +209,5 @@ module.exports = { |
|
|
getList,
|
|
|
delMsg,
|
|
|
pickCoupon,
|
|
|
_getBirthCouponById
|
|
|
}; |
...
|
...
|
|