|
@@ -13,7 +13,7 @@ module.exports = class extends global.yoho.BaseModel { |
|
@@ -13,7 +13,7 @@ module.exports = class extends global.yoho.BaseModel { |
13
|
*/
|
13
|
*/
|
14
|
shareIndex(activityId, isApp, uid) {
|
14
|
shareIndex(activityId, isApp, uid) {
|
15
|
|
15
|
|
16
|
- return api.all([this._CouponInfo(activityId), this._redeatList(), this._banner(),
|
16
|
+ return api.all([this._CouponInfo(activityId, uid), this._redeatList(), this._banner(),
|
17
|
this._checkStudent(uid)]).then(result => {
|
17
|
this._checkStudent(uid)]).then(result => {
|
18
|
|
18
|
|
19
|
const indexData = {
|
19
|
const indexData = {
|
|
@@ -32,32 +32,24 @@ module.exports = class extends global.yoho.BaseModel { |
|
@@ -32,32 +32,24 @@ module.exports = class extends global.yoho.BaseModel { |
32
|
|
32
|
|
33
|
if (val.sortNames) {
|
33
|
if (val.sortNames) {
|
34
|
val.couponDescribe = '限' + val.sortNames + '使用';
|
34
|
val.couponDescribe = '限' + val.sortNames + '使用';
|
35
|
- val.detailDes = '限品类: ' + val.sortNames;
|
|
|
36
|
} else if (val.brandNames) {
|
35
|
} else if (val.brandNames) {
|
37
|
val.couponDescribe = '限' + val.brandNames + '使用';
|
36
|
val.couponDescribe = '限' + val.brandNames + '使用';
|
38
|
- val.detailDes = '限品牌: ' + val.brandNames;
|
|
|
39
|
} else if (val.shareCoupon === '全场通用') {
|
37
|
} else if (val.shareCoupon === '全场通用') {
|
40
|
val.couponDescribe = '任意商品使用';
|
38
|
val.couponDescribe = '任意商品使用';
|
41
|
- val.detailDes = val.shareCoupon;
|
|
|
42
|
} else if (val.shopNames) {
|
39
|
} else if (val.shopNames) {
|
43
|
val.couponDescribe = '限' + val.shopNames + '使用';
|
40
|
val.couponDescribe = '限' + val.shopNames + '使用';
|
44
|
- val.detailDes = val.shareCoupon;
|
|
|
45
|
}
|
41
|
}
|
46
|
|
42
|
|
47
|
val.detailUrl = helpers.urlFormat('/activity/share-buy/detail', {
|
43
|
val.detailUrl = helpers.urlFormat('/activity/share-buy/detail', {
|
48
|
- counum: val.couponValue,
|
|
|
49
|
- couponType: val.shareCouponType,
|
|
|
50
|
- detailDes: val.detailDes,
|
|
|
51
|
couponId: val.couponId,
|
44
|
couponId: val.couponId,
|
52
|
- useCode: uid.toString()
|
45
|
+ couponCode: val.couponCode
|
53
|
});
|
46
|
});
|
54
|
|
47
|
|
55
|
if (isApp) {
|
48
|
if (isApp) {
|
56
|
val.detailUrl = val.detailUrl +
|
49
|
val.detailUrl = val.detailUrl +
|
57
|
'&openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"http:' + val.detailUrl +
|
50
|
'&openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"http:' + val.detailUrl +
|
58
|
- '","params":{"counum":"' + val.couponValue + '","couponType":"' + val.shareCouponType +
|
|
|
59
|
- '","detailDes":"' + val.detailDes + '","couponId":"' + val.couponId + '","useCode":"' +
|
|
|
60
|
- uid + '"}}}';
|
51
|
+ '","params":{"couponId":"' + val.couponId + '","couponCode":"' +
|
|
|
52
|
+ val.couponCode + '"}}}';
|
61
|
}
|
53
|
}
|
62
|
|
54
|
|
63
|
if (!indexData.isStudent) {
|
55
|
if (!indexData.isStudent) {
|
|
@@ -112,10 +104,11 @@ module.exports = class extends global.yoho.BaseModel { |
|
@@ -112,10 +104,11 @@ module.exports = class extends global.yoho.BaseModel { |
112
|
/**
|
104
|
/**
|
113
|
* 首页获取优惠券信息
|
105
|
* 首页获取优惠券信息
|
114
|
*/
|
106
|
*/
|
115
|
- _CouponInfo(activityId) {
|
107
|
+ _CouponInfo(activityId, uid) {
|
116
|
return api.get('', {
|
108
|
return api.get('', {
|
117
|
method: 'app.activity.getActivityCouponInfo',
|
109
|
method: 'app.activity.getActivityCouponInfo',
|
118
|
- activity_id: activityId
|
110
|
+ activity_id: activityId,
|
|
|
111
|
+ uid: uid
|
119
|
}, {
|
112
|
}, {
|
120
|
code: 200
|
113
|
code: 200
|
121
|
}).then((result) => {
|
114
|
}).then((result) => {
|
|
@@ -146,32 +139,50 @@ module.exports = class extends global.yoho.BaseModel { |
|
@@ -146,32 +139,50 @@ module.exports = class extends global.yoho.BaseModel { |
146
|
*/
|
139
|
*/
|
147
|
shareDetail(param, isApp) {
|
140
|
shareDetail(param, isApp) {
|
148
|
return api.get('', {
|
141
|
return api.get('', {
|
149
|
- method: 'app.activity.getActivityCouponCode',
|
|
|
150
|
- uid: param.useCode,
|
142
|
+ method: 'app.activity.getActivityCouponDesc',
|
|
|
143
|
+ coupon_code: param.couponCode,
|
151
|
coupon_id: param.couponId
|
144
|
coupon_id: param.couponId
|
152
|
}, {
|
145
|
}, {
|
153
|
code: 200
|
146
|
code: 200
|
154
|
}).then((result) => {
|
147
|
}).then((result) => {
|
155
|
- let moreUrl;
|
148
|
+ let moreUrl,
|
|
|
149
|
+ detailData;
|
156
|
|
150
|
|
157
|
if (result && result.code === 200 && result.data) {
|
151
|
if (result && result.code === 200 && result.data) {
|
158
|
- result.data = _.assign(result.data, param);
|
152
|
+ detailData = _.assign(detailData, param);
|
159
|
|
153
|
|
160
|
moreUrl = helpers.urlFormat('', {
|
154
|
moreUrl = helpers.urlFormat('', {
|
161
|
- coupon_code: result.data.couponCode,
|
155
|
+ coupon_code: param.couponCode,
|
162
|
coupon_id: param.couponId,
|
156
|
coupon_id: param.couponId,
|
163
|
title: '优惠活动商品'
|
157
|
title: '优惠活动商品'
|
164
|
}, 'list');
|
158
|
}, 'list');
|
165
|
|
159
|
|
166
|
- result.data.moreUrl = isApp ? moreUrl +
|
|
|
167
|
- '&openbuy:yohobuy={"action":"go.list","params":{"coupon_code":"' + result.data.couponCode +
|
160
|
+ detailData.moreUrl = isApp ? moreUrl +
|
|
|
161
|
+ '&openbuy:yohobuy={"action":"go.list","params":{"coupon_code":"' + param.couponCode +
|
168
|
'","coupon_id":"' + param.couponId + '","title":"优惠活动商品","actiontype":"1"}}' : moreUrl;
|
162
|
'","coupon_id":"' + param.couponId + '","title":"优惠活动商品","actiontype":"1"}}' : moreUrl;
|
169
|
|
163
|
|
170
|
- result.data.isApp = isApp ? true : false;
|
164
|
+ detailData.isApp = isApp ? true : false;
|
171
|
|
165
|
|
172
|
- result.data.finish = parseInt(result.data.expiredTime, 10) > 0 ? false : true;
|
166
|
+ detailData.finish = parseInt(result.data.expiredTime, 10) > 0 ? false : true;
|
173
|
|
167
|
|
174
|
- return result.data;
|
168
|
+ if (result.data.userCouponBoList[0].sortNames) {
|
|
|
169
|
+ detailData.detailDes = '限品类: ' + result.data.userCouponBoList[0].sortNames;
|
|
|
170
|
+ } else if (result.data.userCouponBoList[0].brandNames) {
|
|
|
171
|
+ detailData.detailDes = '限品牌: ' + result.data.userCouponBoList[0].brandNames;
|
|
|
172
|
+ } else if (result.data.userCouponBoList[0].shareCoupon === '全场通用') {
|
|
|
173
|
+ detailData.detailDes = result.data.userCouponBoList[0].shareCoupon;
|
|
|
174
|
+ } else if (result.data.userCouponBoList[0].shopNames) {
|
|
|
175
|
+ detailData.detailDes = result.data.userCouponBoList[0].shopNames;
|
|
|
176
|
+ }
|
|
|
177
|
+
|
|
|
178
|
+ detailData = _.assign(detailData, {
|
|
|
179
|
+ counum: result.data.userCouponBoList[0].couponValue,
|
|
|
180
|
+ couponType: result.data.userCouponBoList[0].shareCouponType,
|
|
|
181
|
+ expiredTime: result.data.expiredTime,
|
|
|
182
|
+ couponValidity: result.data.couponValidity
|
|
|
183
|
+ });
|
|
|
184
|
+
|
|
|
185
|
+ return detailData;
|
175
|
} else {
|
186
|
} else {
|
176
|
return {};
|
187
|
return {};
|
177
|
}
|
188
|
}
|