Authored by yyq

生日券领取

@@ -22,6 +22,23 @@ @@ -22,6 +22,23 @@
22 <!-- 文本消息 --> 22 <!-- 文本消息 -->
23 <p>{{{content}}}</p> 23 <p>{{{content}}}</p>
24 {{/ text}} 24 {{/ text}}
  25 + {{# birthCoupon}}
  26 + <p class="birth-card">
  27 + {{#if @root.devEnv}}
  28 + <img src="//webstatic.dev.yohobuy.com/img/home/birth-card.png">
  29 + {{^}}
  30 + <img src="//cdn.yoho.cn/yohobuy/assets/img/home/birth-card.png">
  31 + {{/if}}
  32 + </p>
  33 + {{#if over}}
  34 + <div>{{text}}</div>
  35 + {{^}}
  36 + <div class="show-birth-coupon">点这里领取</div>
  37 + {{/if}}
  38 + {{/ birthCoupon}}
  39 + {{#if coupons}}
  40 + <div class="{{#if birthCoupon}}birth-coupon-wrap{{/if}}">
  41 + <p>您365天内有且仅有一次领劵生日礼券的机会,每次限领1张哦</p>
25 {{# coupons}} 42 {{# coupons}}
26 <!-- 优惠券消息 --> 43 <!-- 优惠券消息 -->
27 <div class="coupon-item"> 44 <div class="coupon-item">
@@ -34,7 +51,6 @@ @@ -34,7 +51,6 @@
34 <p>面值:{{price}}</p> 51 <p>面值:{{price}}</p>
35 <p>有效期:{{useTime}}</p> 52 <p>有效期:{{useTime}}</p>
36 {{^}} 53 {{^}}
37 - <p>使用时间:{{useTime}}</p>  
38 <p>领取时间:{{pickTime}}</p> 54 <p>领取时间:{{pickTime}}</p>
39 {{/if}} 55 {{/if}}
40 </div> 56 </div>
@@ -42,11 +58,19 @@ @@ -42,11 +58,19 @@
42 {{#if url}} 58 {{#if url}}
43 <a href="{{url}}" class="view-coupon-btn">立即查看</a> 59 <a href="{{url}}" class="view-coupon-btn">立即查看</a>
44 {{^}} 60 {{^}}
45 - <a{{#if canPick}} class="pick-coupon-btn" data-id="{{id}}"{{/if}}>立即领取</a> 61 + <a{{#if canPick}} class="pick-coupon-btn" data-id="{{id}}"{{/if}}>
  62 + {{#if btnText}}
  63 + {{btnText}}
  64 + {{^}}
  65 + 立即领取
  66 + {{/if}}
  67 + </a>
46 {{/if}} 68 {{/if}}
47 </div> 69 </div>
48 </div> 70 </div>
49 {{/ coupons}} 71 {{/ coupons}}
  72 + </div>
  73 + {{/if}}
50 {{# sale}} 74 {{# sale}}
51 <!-- 促销消息 --> 75 <!-- 促销消息 -->
52 <div class="sale-img"> 76 <div class="sale-img">
No preview for this file type
@@ -9,6 +9,13 @@ var $pickBtn = $('.pick-coupon-btn'); @@ -9,6 +9,13 @@ var $pickBtn = $('.pick-coupon-btn');
9 9
10 var pickBusy = false; 10 var pickBusy = false;
11 11
  12 +$('.show-birth-coupon').click(function() {
  13 + var $this = $(this);
  14 +
  15 + $this.siblings('.birth-coupon-wrap').show();
  16 + $this.hide().siblings('p').hide();
  17 +});
  18 +
12 $pickBtn.click(function() { 19 $pickBtn.click(function() {
13 var data = $(this).data(); 20 var data = $(this).data();
14 21
@@ -32,6 +32,14 @@ @@ -32,6 +32,14 @@
32 } 32 }
33 } 33 }
34 34
  35 + .birth-card > img {
  36 + width: 100%;
  37 + }
  38 +
  39 + .birth-coupon-wrap {
  40 + display: none;
  41 + }
  42 +
35 .coupon-item { 43 .coupon-item {
36 display: table-row; 44 display: table-row;
37 45
@@ -58,7 +58,7 @@ class MessageModel @@ -58,7 +58,7 @@ class MessageModel
58 * @param type $id 58 * @param type $id
59 * @return type array 59 * @return type array
60 */ 60 */
61 - public static function getContentData($uid, $page, $size, $id) 61 + public static function getContentData($uid, $page, $size, $id, $name)
62 { 62 {
63 $result = array(); 63 $result = array();
64 $inboxlist = MessageData::getInboxList($uid, $page, $size); 64 $inboxlist = MessageData::getInboxList($uid, $page, $size);
@@ -78,7 +78,28 @@ class MessageModel @@ -78,7 +78,28 @@ class MessageModel
78 switch ($contentval['type']) { 78 switch ($contentval['type']) {
79 case 'pullCoupon': 79 case 'pullCoupon':
80 //领取生日券消息 80 //领取生日券消息
  81 + $result['text'] = array(
  82 + 'content' => $name . '祝您生日快乐!有货为感谢您的支持,特赠送您生日专属礼,享受专属优惠哦!'
  83 + );
  84 + $result['birthCoupon'] = true;
  85 + if ($contentval['is_collar'] === 'Y') {
  86 + $result['birthCoupon'] = array(
  87 + 'over' => true,
  88 + 'text' => '已领取',
  89 + );
  90 + break;
  91 + }
  92 +
  93 + if ($contentval['is_over_time'] === 'Y') {
  94 + $result['birthCoupon'] = array(
  95 + 'over' => true,
  96 + 'text' => '生日券已过期'
  97 + );
  98 + break;
  99 + }
  100 +
81 $result['coupons'] = array(); 101 $result['coupons'] = array();
  102 +
82 $coupondata = MessageData::getCouponId($uid); //获取优惠券信息 103 $coupondata = MessageData::getCouponId($uid); //获取优惠券信息
83 if (!empty($coupondata['data'])) { 104 if (!empty($coupondata['data'])) {
84 foreach ($coupondata['data'] as $couponval) { 105 foreach ($coupondata['data'] as $couponval) {
@@ -52,10 +52,11 @@ class messageController extends WebAction @@ -52,10 +52,11 @@ class messageController extends WebAction
52 $id = $this->get('id', ''); 52 $id = $this->get('id', '');
53 $page = $this->get('page', 1); 53 $page = $this->get('page', 1);
54 $size = 10; 54 $size = 10;
55 - $content = MessageModel::getContentData($uid, $page, $size, $id); 55 + $userInfo = UserModel::getUserInfo($uid);
  56 + $content = MessageModel::getContentData($uid, $page, $size, $id, $userInfo['nickname']);
56 $data = array( 57 $data = array(
57 'path' => UserModel::getCenterCrumb('我的信息'), 58 'path' => UserModel::getCenterCrumb('我的信息'),
58 - 'userThumb' => UserModel::getUserHeadImg($uid), 59 + 'userThumb' => $userInfo['headIco'],
59 'homeNav' => UserModel::getCenterLeftNav('我的信息', $uid), 60 'homeNav' => UserModel::getCenterLeftNav('我的信息', $uid),
60 'message' => $content, 61 'message' => $content,
61 ); 62 );