Authored by yyq

Merge branch 'feature/giftCart' of git.yoho.cn:fe/yohobuy-node into feature/giftCart

... ... @@ -31,15 +31,19 @@ module.exports = class extends global.yoho.BaseModel {
* @param {[type]} limit [页大小]
* @return {[type]} [{}]
*/
consumeList(cardCode, uid, page, limit) {
consumeList(params, uid) {
let options = {
method: 'app.giftcard.consumelist',
cardCode: cardCode,
cardCode: params.cardCode,
uid: uid,
page: page,
limit: limit || 10
page: params.page,
limit: params.limit || 10
};
if (params.type) {
options.type = params.type;
}
return this.get({data: options});
}
... ...
... ... @@ -70,9 +70,7 @@ module.exports = class extends global.yoho.BaseModel {
count: _.get(rlist[0], 'data.total', 0),
curPage: params.page,
totalPages: _.get(rlist[0], 'data.pageSize', 0)
}, setPager(_.get(rlist[0], 'data.pageSize', 0), {
page: params.page
}));
}, setPager(_.get(rlist[0], 'data.pageSize', 0), params));
return {
giftData: giftData,
... ... @@ -84,9 +82,12 @@ module.exports = class extends global.yoho.BaseModel {
// 获取礼品卡消费记录
consumeList(params, uid) {
let types = ['类型', '消费', '退款'];
params.page = Number(params.page) || 1;
params.type = Number(params.type) || 0;
return this.meGiftAPi.consumeList(params.cardCode, uid, params.page, params.limit).then(rlist => {
return this.meGiftAPi.consumeList(params, uid).then(rlist => {
let giftData = {};
giftData.data = _.get(rlist, 'data', {});
... ... @@ -94,9 +95,8 @@ module.exports = class extends global.yoho.BaseModel {
count: _.get(rlist, 'data.total', 0),
curPage: params.page,
totalPages: _.get(rlist, 'data.pageSize', 0)
}, setPager(_.get(rlist, 'data.pageSize', 0), {
page: params.page
}));
}, setPager(_.get(rlist, 'data.pageSize', 0), params));
_.set(giftData, 'data.types', types[params.type] || types[0]);
return giftData;
});
... ... @@ -136,7 +136,7 @@ module.exports = class extends global.yoho.BaseModel {
return this.meGiftAPi.verifyEmail(params.code, uid);
}
// 发验证码
// 发验手机证码
smsBind(params) {
return this.meGiftAPi.checkIsCanBind(params.area, params.mobile).then(res => {
if (_.get(res, 'data.isCanBind') === 'N') {
... ...
{{# data}}
<table class="info-gift-header">
<table class="info-gift-header" data-card-code={{cardCode}}>
<tr>
<td class="text-left">卡号:{{cardCode}}</td>
<td>状态:{{statusStr}}</td>
... ... @@ -16,7 +16,7 @@
<div>订单编号</div>
<div>
<span class="gift-filter">
<em class="gift-type">类型</em>
<em class="gift-type">{{types}}</em>
<ul class="ul-list">
<li data-cc="1">消费</li>
<li data-cc="2">退款</li>
... ... @@ -28,15 +28,16 @@
{{#if giftCardConsumeInfoBOList}}
{{# giftCardConsumeInfoBOList}}
<div class="me-gift-tr">
<div>{{createTime}}</div>
<div>{{dateFormat 'YYYY-MM-DD HH:mm' createTime}}</div>
<div>{{orderCode}}</div>
{{#if type}}
{{#isEqual type 1}}
<div class="consume">消费</div>
<div class="consume">-{{changeAmount}}</div>
{{else if type}}
<div class="consume">-{{../changeAmount}}</div>
{{/isEqual}}
{{#isEqual type 2}}
<div class="refund">退款</div>
<div class="refund">+{{changeAmount}}</div>
{{/if}}
<div class="refund">+{{../changeAmount}}</div>
{{/isEqual}}
</div>
{{/giftCardConsumeInfoBOList}}
{{^}}
... ...
... ... @@ -24,8 +24,8 @@
<div>{{cardCode}}</div>
<div>{{amount}}</div>
<div>{{remainAmount}}</div>
<div>{{activateTime}}</div>
<div>{{endTime}}</div>
<div>{{dateFormat 'YYYY-MM-DD HH:mm' activateTime}}</div>
<div>{{dateFormat 'YYYY-MM-DD HH:mm' endTime}}</div>
<div class="info-list">消费明细</div>
</div>
{{/giftData.data}}
... ... @@ -65,18 +65,18 @@
<em>+86</em>
<i class="iconfont">&#xe60b;</i>
<ul class="ul-list mobile-area-list">
<li data-cc="+86">中国 +86</li>
<li data-cc="+853">中国澳门 +853</li>
<li data-cc="+886">中国台湾 +886</li>
<li data-cc="+852">中国香港 +852</li>
<li data-cc="+1">美国 +1</li>
<li data-cc="+61">澳大利亚 +61</li>
<li data-cc="+82">韩国 +82</li>
<li data-cc="+1">加拿大 +1</li>
<li data-cc="+60">马来西亚 +60</li>
<li data-cc="+1">美国 +1</li>
<li data-cc="+81">日本 +81</li>
<li data-cc="+65">新加坡 +65</li>
<li data-cc="+44">英国 +44</li>
<li data-cc="+86" selected="">中国 +86</li>
<li data-cc="+853">中国澳门 +853</li>
<li data-cc="+886">中国台湾 +886</li>
<li data-cc="+852">中国香港 +852</li>
</ul>
</span>
<input type="text" placeholder="请输入手机号" class="right mobile" />
... ...
... ... @@ -38,15 +38,10 @@ meGift = {
if (that.isBinMobile) {
that.activateGift();
} else {
that.getMobileCode();
that.verifyEmailCode();
}
});
// 消费明细
$('.me-gift-table').on('click', '.info-list', function() {
that.infoList($(this).closest('.me-gift-tr').data('card-code'));
});
// 显示手机区号或类型下拉列表
$('body').on('click', '.mobile-area,.gift-filter', function() {
$(this).find('.ul-list').toggle();
... ... @@ -59,11 +54,38 @@ meGift = {
$('.mobile-area').find('em').text($li.data('cc'));
});
// 选择类型筛选
// 消费明细
$('.me-gift-table').on('click', '.info-list', function() {
new dialog.Dialog({
content: that.detailGiftTpl({}),
className: 'me-page me-gift-page me-gift-confirm'
}).show();
that.infoList('?' + $.param({
cardCode: $(this).closest('.me-gift-tr').data('card-code')
}));
});
// 消费明细-选择类型筛选
$('body').on('click', '.gift-filter ul', function(event) {
var $li = $(event.target).closest('li');
$('.gift-filter').find('em').text($li.text());
that.infoList('?' + $.param({
cardCode: $('.info-gift-header').data('card-code'),
type: $li.data('cc')
}));
});
// 消费明细翻页
$('body').on('click', '.detail-gift-content .pager a', function() {
if ($(this).hasClass('cur')) {
return false;
}
that.infoList($(this).attr('href'));
return false;
});
},
... ... @@ -72,6 +94,8 @@ meGift = {
var that = this;
var x;
captcha && captcha.hideTip();
if (that.isFlag) {
return deferred.resolve({
code: 401,
... ... @@ -98,11 +122,9 @@ meGift = {
type: 'post',
data: data
}).then(function(res) {
captcha && captcha.hideTip();
if (res.code === 405) {
captcha && captcha.showTip(res.message);
} else {
} else if (res.code !== 200) {
that.meAlert(res.message, false);
}
... ... @@ -113,11 +135,6 @@ meGift = {
});
},
// 礼品卡详情列表
detailList: function() {
},
intTimer: function($dom) {
var intTime = 60;
var intval = setInterval(function() {
... ... @@ -142,7 +159,7 @@ meGift = {
this.postAjax('/home/megift/sendEmailCode', {
email: this.userEmail,
verifyCode: captcha.getResults()
}).then(function(res) {
}, {}, captcha).then(function(res) {
if (res.code === 200) {
that.intTimer($('.email-btn'));
}
... ... @@ -167,7 +184,7 @@ meGift = {
that.postAjax('/home/megift/verifyEmail', {
email: that.userEmail,
code: emailCode
}, verifyData, captcha).then(function(res) {
}, verifyData).then(function(res) {
if (res.code === 200) {
dg.close();
that.getMobileCode();
... ... @@ -214,8 +231,8 @@ meGift = {
that.postAjax('/home/megift/changeMobile', {
area: ($('.mobile-area').find('em').text() || '').replace(/^\+/, ''),
mobile: $('.mobile').val(),
code: $('.mobile-code').val()
mobile: $('input.mobile').val(),
code: $('input.mobile-code').val()
}, verifyData, captcha).then(function(res) {
if (res.code === 200) {
dg.close();
... ... @@ -240,7 +257,7 @@ meGift = {
smsBind: function(captcha) {
var that = this;
var area = ($('.mobile-area').find('em').text() || '').replace(/^\+/, '');
var mobile = $('.mobile').val();
var mobile = $('input.mobile').val();
var verifyData = {
area: '请选择手机区号',
mobile: '手机号不能为空'
... ... @@ -252,7 +269,7 @@ meGift = {
verifyCode: captcha.getResults()
}, verifyData, captcha).then(function(res) {
if (res.code === 200) {
that.intTimer($('.email-btn'));
that.intTimer($('.mobile-btn'));
}
});
},
... ... @@ -300,21 +317,12 @@ meGift = {
},
// 消费明细
infoList: function(cardCode) {
var that = this;
new dialog.Dialog({
content: that.detailGiftTpl({}),
className: 'me-page me-gift-page me-gift-confirm detail-gift-list'
}).show();
$.get('/home/megift/detail', {
cardCode: cardCode
}).then(function(res) {
infoList: function(url) {
url = url || '';
$.get('/home/megift/detail' + url).then(function(res) {
if (!res) {
return false;
}
$('.detail-gift-content').html(res);
});
},
... ...
... ... @@ -187,6 +187,7 @@
border: 1px solid #e6e6e6;
display: none;
cursor: pointer;
z-index: 1;
li {
border-bottom: 1px solid #e6e6e6;
... ... @@ -231,7 +232,7 @@
}
.validity-time {
width: 360px;
width: 330px;
}
}
... ... @@ -260,8 +261,14 @@
min-height: 500px;
.me-pager {
width: 758px;
width: 755px;
margin: 0 10px;
border: 1px solid #e6e6e6;
border-top: none;
}
}
}
.me-gift-confirm.me-page {
width: auto !important;
}
... ...