...
|
...
|
@@ -13,7 +13,7 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
*/
|
|
|
shareIndex(activityId, isApp, uid) {
|
|
|
|
|
|
return api.all([this._CouponInfo(activityId), this._redeatList(), this._banner(),
|
|
|
return api.all([this._CouponInfo(activityId, uid), this._redeatList(), this._banner(),
|
|
|
this._checkStudent(uid)]).then(result => {
|
|
|
|
|
|
const indexData = {
|
...
|
...
|
@@ -32,32 +32,24 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
|
|
|
if (val.sortNames) {
|
|
|
val.couponDescribe = '限' + val.sortNames + '使用';
|
|
|
val.detailDes = '限品类: ' + val.sortNames;
|
|
|
} else if (val.brandNames) {
|
|
|
val.couponDescribe = '限' + val.brandNames + '使用';
|
|
|
val.detailDes = '限品牌: ' + val.brandNames;
|
|
|
} else if (val.shareCoupon === '全场通用') {
|
|
|
val.couponDescribe = '任意商品使用';
|
|
|
val.detailDes = val.shareCoupon;
|
|
|
} else if (val.shopNames) {
|
|
|
val.couponDescribe = '限' + val.shopNames + '使用';
|
|
|
val.detailDes = val.shareCoupon;
|
|
|
}
|
|
|
|
|
|
val.detailUrl = helpers.urlFormat('/activity/share-buy/detail', {
|
|
|
counum: val.couponValue,
|
|
|
couponType: val.shareCouponType,
|
|
|
detailDes: val.detailDes,
|
|
|
couponId: val.couponId,
|
|
|
useCode: uid.toString()
|
|
|
couponCode: val.couponCode
|
|
|
});
|
|
|
|
|
|
if (isApp) {
|
|
|
val.detailUrl = val.detailUrl +
|
|
|
'&openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"http:' + val.detailUrl +
|
|
|
'","params":{"counum":"' + val.couponValue + '","couponType":"' + val.shareCouponType +
|
|
|
'","detailDes":"' + val.detailDes + '","couponId":"' + val.couponId + '","useCode":"' +
|
|
|
uid + '"}}}';
|
|
|
'","params":{"couponId":"' + val.couponId + '","couponCode":"' +
|
|
|
val.couponCode + '"}}}';
|
|
|
}
|
|
|
|
|
|
if (!indexData.isStudent) {
|
...
|
...
|
@@ -112,10 +104,11 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
/**
|
|
|
* 首页获取优惠券信息
|
|
|
*/
|
|
|
_CouponInfo(activityId) {
|
|
|
_CouponInfo(activityId, uid) {
|
|
|
return api.get('', {
|
|
|
method: 'app.activity.getActivityCouponInfo',
|
|
|
activity_id: activityId
|
|
|
activity_id: activityId,
|
|
|
uid: uid
|
|
|
}, {
|
|
|
code: 200
|
|
|
}).then((result) => {
|
...
|
...
|
@@ -146,32 +139,50 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
*/
|
|
|
shareDetail(param, isApp) {
|
|
|
return api.get('', {
|
|
|
method: 'app.activity.getActivityCouponCode',
|
|
|
uid: param.useCode,
|
|
|
method: 'app.activity.getActivityCouponDesc',
|
|
|
coupon_code: param.couponCode,
|
|
|
coupon_id: param.couponId
|
|
|
}, {
|
|
|
code: 200
|
|
|
}).then((result) => {
|
|
|
let moreUrl;
|
|
|
let moreUrl,
|
|
|
detailData;
|
|
|
|
|
|
if (result && result.code === 200 && result.data) {
|
|
|
result.data = _.assign(result.data, param);
|
|
|
detailData = _.assign(detailData, param);
|
|
|
|
|
|
moreUrl = helpers.urlFormat('', {
|
|
|
coupon_code: result.data.couponCode,
|
|
|
coupon_code: param.couponCode,
|
|
|
coupon_id: param.couponId,
|
|
|
title: '优惠活动商品'
|
|
|
}, 'list');
|
|
|
|
|
|
result.data.moreUrl = isApp ? moreUrl +
|
|
|
'&openbuy:yohobuy={"action":"go.list","params":{"coupon_code":"' + result.data.couponCode +
|
|
|
detailData.moreUrl = isApp ? moreUrl +
|
|
|
'&openbuy:yohobuy={"action":"go.list","params":{"coupon_code":"' + param.couponCode +
|
|
|
'","coupon_id":"' + param.couponId + '","title":"优惠活动商品","actiontype":"1"}}' : moreUrl;
|
|
|
|
|
|
result.data.isApp = isApp ? true : false;
|
|
|
detailData.isApp = isApp ? true : false;
|
|
|
|
|
|
result.data.finish = parseInt(result.data.expiredTime, 10) > 0 ? false : true;
|
|
|
detailData.finish = parseInt(result.data.expiredTime, 10) > 0 ? false : true;
|
|
|
|
|
|
return result.data;
|
|
|
if (result.data.userCouponBoList[0].sortNames) {
|
|
|
detailData.detailDes = '限品类: ' + result.data.userCouponBoList[0].sortNames;
|
|
|
} else if (result.data.userCouponBoList[0].brandNames) {
|
|
|
detailData.detailDes = '限品牌: ' + result.data.userCouponBoList[0].brandNames;
|
|
|
} else if (result.data.userCouponBoList[0].shareCoupon === '全场通用') {
|
|
|
detailData.detailDes = result.data.userCouponBoList[0].shareCoupon;
|
|
|
} else if (result.data.userCouponBoList[0].shopNames) {
|
|
|
detailData.detailDes = result.data.userCouponBoList[0].shopNames;
|
|
|
}
|
|
|
|
|
|
detailData = _.assign(detailData, {
|
|
|
counum: result.data.userCouponBoList[0].couponValue,
|
|
|
couponType: result.data.userCouponBoList[0].shareCouponType,
|
|
|
expiredTime: result.data.expiredTime,
|
|
|
couponValidity: result.data.couponValidity
|
|
|
});
|
|
|
|
|
|
return detailData;
|
|
|
} else {
|
|
|
return {};
|
|
|
}
|
...
|
...
|
|