Authored by 毕凯

Merge branch 'feature/shareBuy' into 'release/5.7'

接口更改



See merge request !566
@@ -30,14 +30,10 @@ exports.index = (req, res, next) => { @@ -30,14 +30,10 @@ exports.index = (req, res, next) => {
30 30
31 exports.detail = (req, res, next) => { 31 exports.detail = (req, res, next) => {
32 let param = { 32 let param = {
33 - counum: req.query.counum,  
34 - couponType: req.query.couponType,  
35 - detailDes: req.query.detailDes,  
36 couponId: req.query.couponId, 33 couponId: req.query.couponId,
37 - useCode: req.query.useCode 34 + couponCode: req.query.couponCode
38 }, 35 },
39 - isApp = req.yoho.isApp,  
40 - registerUrl; 36 + isApp = req.yoho.isApp;
41 37
42 req.ctx(shareBuyModel).shareDetail(param, isApp).then(data => { 38 req.ctx(shareBuyModel).shareDetail(param, isApp).then(data => {
43 39
@@ -50,8 +46,7 @@ exports.detail = (req, res, next) => { @@ -50,8 +46,7 @@ exports.detail = (req, res, next) => {
50 width750: true, 46 width750: true,
51 title: '分享购', 47 title: '分享购',
52 page: 'share-detail', 48 page: 'share-detail',
53 - detailData: data,  
54 - registerUrl: registerUrl 49 + detailData: data
55 }); 50 });
56 }).catch(next); 51 }).catch(next);
57 }; 52 };
@@ -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 }
1 <div class="share-buy-page yoho-page"> 1 <div class="share-buy-page yoho-page">
  2 + {{#if banner}}
2 <div class="share-title"> 3 <div class="share-title">
3 <img src="{{image banner 750 366}}"><img> 4 <img src="{{image banner 750 366}}"><img>
4 </div> 5 </div>
  6 + {{/if}}
5 7
6 <div class="coupon-list" data-student="{{isStudent}}"> 8 <div class="coupon-list" data-student="{{isStudent}}">
7 {{# userCouponBoList}} 9 {{# userCouponBoList}}
1 <div class="share-detail-page" > 1 <div class="share-detail-page" >
2 {{# detailData}} 2 {{# detailData}}
3 - <div class="coupon-detail" data-app="{{isApp}}"> 3 + <div class="coupon-detail">
4 <div class="countdown"> 4 <div class="countdown">
5 <div class="title">距离活动时间还剩:</div> 5 <div class="title">距离活动时间还剩:</div>
6 {{#if finish}} 6 {{#if finish}}
@@ -38,9 +38,7 @@ require('common/share')(shareData); @@ -38,9 +38,7 @@ require('common/share')(shareData);
38 require('common'); 38 require('common');
39 39
40 if (yoho.isApp) { 40 if (yoho.isApp) {
41 - link = 'http://m.yohobuy.com/activity/share-buy/detail?counum=' + window.queryString.counum +  
42 - '&couponType=' + window.queryString.couponType + '&detailDes=' + window.queryString.detailDes +  
43 - '&couponId=' + window.queryString.couponId; 41 + link = 'http://m.yohobuy.com/activity/share-buy/detail?couponId=' + window.queryString.couponId + '&couponCode' + window.queryString.couponCode;
44 42
45 shareData.link = link; 43 shareData.link = link;
46 44
@@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
7 7
8 .share-title { 8 .share-title {
9 width: 100%; 9 width: 100%;
10 - height: 100%;  
11 background-size: 100%; 10 background-size: 100%;
12 margin: auto; 11 margin: auto;
13 } 12 }