Authored by yyq

生日券领取

... ... @@ -22,31 +22,55 @@
<!-- 文本消息 -->
<p>{{{content}}}</p>
{{/ text}}
{{# coupons}}
<!-- 优惠券消息 -->
<div class="coupon-item">
<div class="coupon-img">
<img src="//static.yohobuy.com/images/v2/activity/default_coupon.jpg">
</div>
<div class="coupon-info">
<p>{{remark}}</p>
{{#if url}}
<p>面值:{{price}}</p>
<p>有效期:{{useTime}}</p>
{{^}}
<p>使用时间:{{useTime}}</p>
<p>领取时间:{{pickTime}}</p>
{{/if}}
</div>
<div class="coupon-action">
{{#if url}}
<a href="{{url}}" class="view-coupon-btn">立即查看</a>
{{^}}
<a{{#if canPick}} class="pick-coupon-btn" data-id="{{id}}"{{/if}}>立即领取</a>
{{/if}}
{{# birthCoupon}}
<p class="birth-card">
{{#if @root.devEnv}}
<img src="//webstatic.dev.yohobuy.com/img/home/birth-card.png">
{{^}}
<img src="//cdn.yoho.cn/yohobuy/assets/img/home/birth-card.png">
{{/if}}
</p>
{{#if over}}
<div>{{text}}</div>
{{^}}
<div class="show-birth-coupon">点这里领取</div>
{{/if}}
{{/ birthCoupon}}
{{#if coupons}}
<div class="{{#if birthCoupon}}birth-coupon-wrap{{/if}}">
<p>您365天内有且仅有一次领劵生日礼券的机会,每次限领1张哦</p>
{{# coupons}}
<!-- 优惠券消息 -->
<div class="coupon-item">
<div class="coupon-img">
<img src="//static.yohobuy.com/images/v2/activity/default_coupon.jpg">
</div>
<div class="coupon-info">
<p>{{remark}}</p>
{{#if url}}
<p>面值:{{price}}</p>
<p>有效期:{{useTime}}</p>
{{^}}
<p>领取时间:{{pickTime}}</p>
{{/if}}
</div>
<div class="coupon-action">
{{#if url}}
<a href="{{url}}" class="view-coupon-btn">立即查看</a>
{{^}}
<a{{#if canPick}} class="pick-coupon-btn" data-id="{{id}}"{{/if}}>
{{#if btnText}}
{{btnText}}
{{^}}
立即领取
{{/if}}
</a>
{{/if}}
</div>
</div>
{{/ coupons}}
</div>
{{/ coupons}}
{{/if}}
{{# sale}}
<!-- 促销消息 -->
<div class="sale-img">
... ...
No preview for this file type
... ... @@ -9,6 +9,13 @@ var $pickBtn = $('.pick-coupon-btn');
var pickBusy = false;
$('.show-birth-coupon').click(function() {
var $this = $(this);
$this.siblings('.birth-coupon-wrap').show();
$this.hide().siblings('p').hide();
});
$pickBtn.click(function() {
var data = $(this).data();
... ...
... ... @@ -32,6 +32,14 @@
}
}
.birth-card > img {
width: 100%;
}
.birth-coupon-wrap {
display: none;
}
.coupon-item {
display: table-row;
... ...
... ... @@ -58,7 +58,7 @@ class MessageModel
* @param type $id
* @return type array
*/
public static function getContentData($uid, $page, $size, $id)
public static function getContentData($uid, $page, $size, $id, $name)
{
$result = array();
$inboxlist = MessageData::getInboxList($uid, $page, $size);
... ... @@ -78,7 +78,28 @@ class MessageModel
switch ($contentval['type']) {
case 'pullCoupon':
//领取生日券消息
$result['text'] = array(
'content' => $name . '祝您生日快乐!有货为感谢您的支持,特赠送您生日专属礼,享受专属优惠哦!'
);
$result['birthCoupon'] = true;
if ($contentval['is_collar'] === 'Y') {
$result['birthCoupon'] = array(
'over' => true,
'text' => '已领取',
);
break;
}
if ($contentval['is_over_time'] === 'Y') {
$result['birthCoupon'] = array(
'over' => true,
'text' => '生日券已过期'
);
break;
}
$result['coupons'] = array();
$coupondata = MessageData::getCouponId($uid); //获取优惠券信息
if (!empty($coupondata['data'])) {
foreach ($coupondata['data'] as $couponval) {
... ...
... ... @@ -52,10 +52,11 @@ class messageController extends WebAction
$id = $this->get('id', '');
$page = $this->get('page', 1);
$size = 10;
$content = MessageModel::getContentData($uid, $page, $size, $id);
$userInfo = UserModel::getUserInfo($uid);
$content = MessageModel::getContentData($uid, $page, $size, $id, $userInfo['nickname']);
$data = array(
'path' => UserModel::getCenterCrumb('我的信息'),
'userThumb' => UserModel::getUserHeadImg($uid),
'userThumb' => $userInfo['headIco'],
'homeNav' => UserModel::getCenterLeftNav('我的信息', $uid),
'message' => $content,
);
... ...