Authored by 郭成尧

order-ensure-handle

... ... @@ -101,6 +101,8 @@ exports.cartPay = (params) => {
paymentProcess.tranformPayment(pay.data, params.orderInfo, params.cartType, skuList, orderCompute),
{
coupon: paymentProcess.coupon(validCouponCount, params.orderInfo, orderCompute),
},
{
giftCards: paymentProcess.handleGiftCards({
validGiftCardCount: validGiftCardCount,
orderInfo: params.orderInfo,
... ...
... ... @@ -133,8 +133,8 @@
<a href="{{choseGiftCard}}">
<span class="title">礼品卡</span>
{{# giftCards}}
<span class="count">{{#if selectedAmount}}已选{{selectedAmount}}{{^}}{{count}}张可用{{/if}}</span>
<span class="coupon-info pull-right{{#isEqualOr info '无可用'}} no-can-use{{/isEqualOr}}">
<span class="count">{{#if selectCount}}已选{{selectCount}}{{^}}{{count}}张可用{{/if}}</span>
<span class="coupon-info pull-right{{#isEqualOr info '未使用'}} no-can-use{{/isEqualOr}}">
{{info}}<i class="iconfont">&#xe614;</i>
</span>
{{/giftCards}}
... ...
... ... @@ -23,7 +23,7 @@
</div>
<div class="content-li clearfix">
<div class="left-label pull-left">有效期</div>
<div class="pull-left">{{dateStr}}{{#if willExpireDesc}} <span class="tip">(即将过期)</span>{{/if}}</div>
<div class="pull-left">{{dateStr}}{{#if willExpire}} <span class="tip">(即将过期)</span>{{/if}}</div>
</div>
</div>
<div class="checkbox pull-right">
... ...
... ... @@ -375,7 +375,19 @@ function coupon(count, orderInfo, orderComputeData) {
* 处理礼品卡数据
*/
function handleGiftCards(params) {
return params;
let info = '未使用'; // TODO
let amount = _.get(params, 'orderCompute.gift_card.amount', 0);
if (amount) {
info = `可以抵用¥${amount.toFixed(2)}`;
}
return {
count: params.validGiftCardCount,
amount: amount,
selectCount: _.get(params, 'orderCompute.gift_card.count', 0),
info: info
};
}
/**
... ...