Authored by 郭成尧

check-handle

... ... @@ -74,11 +74,13 @@ exports.cartPay = (params) => {
return Promise.all([
cartPayAPI, // 0. 订单数据
orderComputeAPI,
shoppingAPI.getValidCouponCount(params.uid) // 2. 有效优惠券
shoppingAPI.getValidCouponCount(params.uid), // 2 有效优惠券
shoppingAPI.countUsableGiftCard(params.uid) // 3 可用礼品卡数量
]).then(res => {
let pay = res[0];
let orderCompute = _.get(res[1], 'data', {});
let validCouponCount = _.get(res[2], 'data.count', 0);
let validGiftCardCount = _.get(res[3], 'data.count', 0);
let goodsList = _.get(pay, 'data.goods_list', []);
... ... @@ -97,9 +99,13 @@ exports.cartPay = (params) => {
result = Object.assign(
result,
paymentProcess.tranformPayment(pay.data, params.orderInfo, params.cartType, skuList, orderCompute),
{
coupon: paymentProcess.coupon(validCouponCount, params.orderInfo, orderCompute)
coupon: paymentProcess.coupon(validCouponCount, params.orderInfo, orderCompute),
giftCards: paymentProcess.handleGiftCards({
validGiftCardCount: validGiftCardCount,
orderInfo: params.orderInfo,
orderCompute: orderCompute
})
}
);
... ...
... ... @@ -132,12 +132,12 @@
<li class="gift-card">
<a href="{{choseGiftCard}}">
<span class="title">礼品卡</span>
{{# giftCard}}
{{# giftCards}}
<span class="count">{{#if selectedAmount}}已选{{selectedAmount}}{{^}}{{count}}张可用{{/if}}</span>
<span class="coupon-info pull-right{{#isEqualOr info '无可用'}} no-can-use{{/isEqualOr}}">
{{info}}<i class="iconfont">&#xe614;</i>
</span>
{{/giftCard}}
{{/giftCards}}
</a>
</li>
{{/if}}
... ...
... ... @@ -27,8 +27,8 @@
</div>
</div>
<div class="checkbox pull-right">
<i class="iconfont">&#xe647;</i>
<i class="iconfont hide">&#xe617;</i>
<i class="iconfont no-checked-icon">&#xe647;</i>
<i class="iconfont checked-icon">&#xe617;</i>
</div>
</div>
</div>
... ...
... ... @@ -9,9 +9,11 @@ class SelectGiftCard extends Page {
this.selector = {
rule: $('#rule'),
page: $('.select-giftcard-page')
page: $('.select-giftcard-page'),
giftcard: $('.giftcard')
};
this.init();
this.bindEvents();
}
init() {
... ... @@ -21,7 +23,20 @@ class SelectGiftCard extends Page {
}
bindEvents() {
console.log('bindEvents');
this.selector.giftcard.on('click', this.checkboxClickHandle.bind(this));
}
/**
* 选择礼品卡
*/
checkboxClickHandle(event) {
let theGiftCard = $(event.delegateTarget);
if (theGiftCard.hasClass('checked')) {
theGiftCard.removeClass('checked');
} else {
theGiftCard.addClass('checked');
}
}
}
... ...
... ... @@ -92,6 +92,18 @@ $title-font-color: #fff;
font-size: 40px;
color: #b0b0b0;
}
> .checkbox > .checked-icon {
display: none;
}
}
}
.checked > .card-body > .checkbox > .checked-icon {
display: block;
}
.checked > .card-body > .checkbox > .no-checked-icon {
display: none;
}
}
... ...
... ... @@ -372,6 +372,13 @@ function coupon(count, orderInfo, orderComputeData) {
}
/**
* 处理礼品卡数据
*/
function handleGiftCards(params) {
return params;
}
/**
* JIT 拆单数据处理
*/
function transformJit(packageList) {
... ... @@ -479,6 +486,7 @@ module.exports = {
tranformPayment,
yohoCoinCompute,
coupon,
handleGiftCards,
transformJit,
unionInfoHandle
};
... ...