Authored by 周少峰

Merge branch 'hotfix/couponCenter' into 'release/5.6.1'

floor title

领券中心去除券楼层必须紧跟标题楼层限制

See merge request !118
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 */ 5 */
6 'use strict'; 6 'use strict';
7 7
  8 +const _ = require('lodash');
8 const Promise = require('bluebird'); 9 const Promise = require('bluebird');
9 const api = global.yoho.API; 10 const api = global.yoho.API;
10 const crypto = global.yoho.crypto; 11 const crypto = global.yoho.crypto;
@@ -55,15 +56,15 @@ exports.getCouponData = (channel, params) => { @@ -55,15 +56,15 @@ exports.getCouponData = (channel, params) => {
55 }); 56 });
56 } else if (val.template_name === 'getCoupon' && val.data.length) { 57 } else if (val.template_name === 'getCoupon' && val.data.length) {
57 // 优惠券楼层 58 // 优惠券楼层
58 - if (!coupon.data[index - 1].data || !coupon.data[index - 1].data.text) {  
59 - return;  
60 - }  
61 -  
62 const obj = { 59 const obj = {
63 - title: coupon.data[index - 1].data.text, // 楼层标题  
64 coupons: [] 60 coupons: []
65 }; 61 };
66 62
  63 + // 楼层标题
  64 + if (_.get(coupon, `data[${index - 1}].template_name`, '') === 'text') {
  65 + obj.title = _.get(coupon, `data[${index - 1}].data.text`, '');
  66 + }
  67 +
67 val.data.forEach(function(item) { 68 val.data.forEach(function(item) {
68 obj.coupons.push({ 69 obj.coupons.push({
69 id: crypto.encryption('yoho9646abcdefgh', item.couponID), // 加密优惠券号 70 id: crypto.encryption('yoho9646abcdefgh', item.couponID), // 加密优惠券号
@@ -2,33 +2,37 @@ @@ -2,33 +2,37 @@
2 {{> common/path-nav}} 2 {{> common/path-nav}}
3 {{> common/slide-banner}} 3 {{> common/slide-banner}}
4 {{# categories}} 4 {{# categories}}
5 - <div class="title clearfix">  
6 - <span>{{title}}</span>  
7 - </div>  
8 - {{# coupons}}  
9 - <div class="coupon">  
10 - <a href="{{url}}" target="_blank" href="javascript:void(0);" data-id="{{id}}">  
11 - <img src="{{image2 img}}">  
12 - {{#if empty}}  
13 - <div class="coupon-mask"></div>  
14 - {{/if}}  
15 - <div class="enable info" id="{{id}}">  
16 - <div class="normal">  
17 - <p>点击</p>  
18 - <p>领取</p>  
19 - </div>  
20 - <div class="got hidden">  
21 - <p>已领取</p>  
22 - <p class="guang">去使用</p>  
23 - </div>  
24 - <div class="empty hidden">  
25 - <p>已抢光</p>  
26 - <p class="guang">去逛逛</p>  
27 - </div>  
28 - </div>  
29 - </a> 5 + {{#if title}}
  6 + <div class="title clearfix">
  7 + <span>{{title}}</span>
30 </div> 8 </div>
31 - {{/ coupons}} 9 + {{/if}}
  10 + <div class="clearfix">
  11 + {{# coupons}}
  12 + <div class="coupon">
  13 + <a href="{{url}}" target="_blank" href="javascript:void(0);" data-id="{{id}}">
  14 + <img src="{{image2 img}}">
  15 + {{#if empty}}
  16 + <div class="coupon-mask"></div>
  17 + {{/if}}
  18 + <div class="enable info" id="{{id}}">
  19 + <div class="normal">
  20 + <p>点击</p>
  21 + <p>领取</p>
  22 + </div>
  23 + <div class="got hidden">
  24 + <p>已领取</p>
  25 + <p class="guang">去使用</p>
  26 + </div>
  27 + <div class="empty hidden">
  28 + <p>已抢光</p>
  29 + <p class="guang">去逛逛</p>
  30 + </div>
  31 + </div>
  32 + </a>
  33 + </div>
  34 + {{/ coupons}}
  35 + </div>
32 {{/ categories}} 36 {{/ categories}}
33 37
34 -</div>  
  38 +</div>