Authored by 郝肖肖

'立即购买错误提示'

... ... @@ -90,45 +90,50 @@ class BuyNowController {
let mobile = _.get(userProfile, 'data.mobile', '');
let orderAddress = _.get(result, 'address', []);
let addressList = _.get(address, 'data', []);
let orderEnsure = {};
orderAddress.length && _.forEach(addressList, address => { //eslint-disable-line
if (address.address_id === orderAddress.address_id) {
mobile = address.mobile;
return false;
}
});
// 兼容原有的数据格式
orderInfo.deliveryId = orderInfo.delivery_way;
orderInfo.deliveryTimeId = orderInfo.delivery_time;
orderInfo.couponCode = orderInfo.coupon_code;
orderInfo.yohoCoin = orderInfo.use_yoho_coin;
orderInfo.paymentType = orderInfo.payment_type;
let orderEnsure = _.assign(
paymentProcess.tranformPayment(_.get(result, 'data', {}), orderInfo, null, null, computeData.data),
{
coupon: paymentProcess.coupon(
_.get(validCouponCount, 'data.count', 0),
orderInfo,
computeData.data
),
selectAddressUrl: helpers.urlFormat('/cart/index/buynow/selectAddress', {
product_sku: product_sku,
buy_number: buy_number
}),
selectCouponUrl: helpers.urlFormat('/cart/index/buynow/selectCoupon', {
product_sku: product_sku,
buy_number: buy_number
}),
isOrdinaryCart: true,
choseGiftCard: helpers.urlFormat('/cart/index/buynow/selectGiftcard'),
giftCards: paymentProcess.handleGiftCards({
validGiftCardCount: _.get(validGiftCardCount, 'data.count', 0),
orderCompute: computeData.data
})
}
);
if (result.code !== 200 && result.message) {
orderEnsure = {message: result.message};
} else {
orderAddress.length && _.forEach(addressList, address => { //eslint-disable-line
if (address.address_id === orderAddress.address_id) {
mobile = address.mobile;
return false;
}
});
// 兼容原有的数据格式
orderInfo.deliveryId = orderInfo.delivery_way;
orderInfo.deliveryTimeId = orderInfo.delivery_time;
orderInfo.couponCode = orderInfo.coupon_code;
orderInfo.yohoCoin = orderInfo.use_yoho_coin;
orderInfo.paymentType = orderInfo.payment_type;
orderEnsure = _.assign(
paymentProcess.tranformPayment(_.get(result, 'data', {}), orderInfo, null, null, computeData.data),
{
coupon: paymentProcess.coupon(
_.get(validCouponCount, 'data.count', 0),
orderInfo,
computeData.data
),
selectAddressUrl: helpers.urlFormat('/cart/index/buynow/selectAddress', {
product_sku: product_sku,
buy_number: buy_number
}),
selectCouponUrl: helpers.urlFormat('/cart/index/buynow/selectCoupon', {
product_sku: product_sku,
buy_number: buy_number
}),
isOrdinaryCart: true,
choseGiftCard: helpers.urlFormat('/cart/index/buynow/selectGiftcard'),
giftCards: paymentProcess.handleGiftCards({
validGiftCardCount: _.get(validGiftCardCount, 'data.count', 0),
orderCompute: computeData.data
})
}
);
}
return res.render('buynow/order-ensure', {
pageHeader: headerModel.setNav({
... ...
<div class="order-ensure-page yoho-page">
<input id="cart-token" type="hidden" name="token" value="{{cartToken}}">
{{# orderEnsure}}
{{#if addressInfo}}
<div class="address block address-wrap {{#if @root.pageChannel.boys}} boys{{/if}}{{#if @root.pageChannel.girls}} girls{{/if}}{{#if @root.pageChannel.kids}} kids{{/if}}{{#if @root.pageChannel.lifeStyle}} life-style{{/if}}" data-id ="{{addressId}}">
<div class="info">
<span class="info-name">{{name}}</span>
<span class="info-phone">{{phoneNum}}</span>
<a href="{{selectAddressUrl}}"><span class="info-address">{{addressInfo}}</span></a>
<i class="iconfont">&#xe637;</i>
<input id="cart-token" type="hidden" name="token" value="{{cartToken}}">
{{# orderEnsure}}
{{#if message}}
<div class="order-ensure-error">
{{message}}
</div>
<a class="rest" href="{{selectAddressUrl}}">其他地址<span class="iconfont">&#xe614;</span></a>
</div>
{{else}}
<div class="address block address-wrap not-address">
<i class="iconfont">&#xe637;</i>
<a class="choose" href="{{selectAddressUrl}}">请选择收货地址<span class="iconfont">&#xe614;</span></a>
{{#if addressInfo}}
<div class="address block address-wrap {{#if @root.pageChannel.boys}} boys{{/if}}{{#if @root.pageChannel.girls}} girls{{/if}}{{#if @root.pageChannel.kids}} kids{{/if}}{{#if @root.pageChannel.lifeStyle}} life-style{{/if}}" data-id ="{{addressId}}">
<div class="info">
<span class="info-name">{{name}}</span>
<span class="info-phone">{{phoneNum}}</span>
<a href="{{selectAddressUrl}}"><span class="info-address">{{addressInfo}}</span></a>
<i class="iconfont">&#xe637;</i>
</div>
<a class="rest" href="{{selectAddressUrl}}">其他地址<span class="iconfont">&#xe614;</span></a>
</div>
{{/if}}
<section class="dispatch block">
<div class="sub-block payment-type">
<h3>
<p>支付方式</p>
{{#each paymentWay}}
{{#if recommend}}<span>{{name}}</span>{{/if}}
{{/each}}
<i class="iconfont down">&#xe616;</i>
<i class="iconfont hide up">&#xe615;</i>
</h3>
<ul>
{{#each paymentWay}}
{{#if isSupport}}
<li {{#if recommend}}class="chosed"{{/if}}>
<span {{#if isSupportMessage}}data-message="{{isSupportMessage}}"{{/if}}>{{name}}</span>
<i class="right iconfont {{#if recommend}}icon-cb-radio{{else}}icon-radio{{/if}}" data-id="{{id}}" data-payment-type="{{paymentType}}"></i>
</li>
{{/if}}
{{/each}}
</ul>
</div>
<div class="sub-block delivery-id">
<h3>
<p>配送方式</p>
{{#each dispatchMode}}
{{#if isSelected}}<span>{{name}}:运费¥{{cost}}</span>{{/if}}
{{/each}}
<i class="iconfont down">&#xe616;</i>
<i class="iconfont hide up">&#xe615;</i>
</h3>
<ul class="dispatch-mode">
{{#each dispatchMode}}
<li class="{{#if isSelected}}chosed{{/if}}{{#if is_support_message}} no-support{{/if}}" data-id="{{id}}">
<span>{{name}}:运费¥{{cost}} {{#if is_support_message}}({{is_support_message}}){{/if}}</span>
<i class="right iconfont {{#if isSelected}}icon-cb-radio{{else}}icon-radio{{/if}}" data-id="{{id}}"></i>
</li>
{{/each}}
</ul>
</div>
<div class="sub-block dispatch-time">
<h3>
<p>送货时间</p>
{{#each dispatchTime}}
{{#if isSelected}}<span>{{name}}</span>{{/if}}
{{/each}}
<i class="iconfont down">&#xe616;</i>
<i class="iconfont hide up">&#xe615;</i>
</h3>
<ul>
<li class="dispatch-time-info">快递公司会尽力按您选择的送货时间配送,如遇特殊情况(天气、环境等)无法按您要求时间配送,还请您谅解。</li>
{{#each dispatchTime}}
<li {{#if isSelected}}class="chosed"{{/if}} data-id="{{id}}">
<span>{{name}}</span>
<i class="right iconfont radio {{#if isSelected}}icon-cb-radio{{else}}icon-radio{{/if}}" ></i>
{{else}}
<div class="address block address-wrap not-address">
<i class="iconfont">&#xe637;</i>
<a class="choose" href="{{selectAddressUrl}}">请选择收货地址<span class="iconfont">&#xe614;</span></a>
</div>
{{/if}}
<section class="dispatch block">
<div class="sub-block payment-type">
<h3>
<p>支付方式</p>
{{#each paymentWay}}
{{#if recommend}}<span>{{name}}</span>{{/if}}
{{/each}}
<i class="iconfont down">&#xe616;</i>
<i class="iconfont hide up">&#xe615;</i>
</h3>
<ul>
{{#each paymentWay}}
{{#if isSupport}}
<li {{#if recommend}}class="chosed"{{/if}}>
<span {{#if isSupportMessage}}data-message="{{isSupportMessage}}"{{/if}}>{{name}}</span>
<i class="right iconfont {{#if recommend}}icon-cb-radio{{else}}icon-radio{{/if}}" data-id="{{id}}" data-payment-type="{{paymentType}}"></i>
</li>
{{/if}}
{{/each}}
</ul>
</div>
<div class="sub-block delivery-id">
<h3>
<p>配送方式</p>
{{#each dispatchMode}}
{{#if isSelected}}<span>{{name}}:运费¥{{cost}}</span>{{/if}}
{{/each}}
<i class="iconfont down">&#xe616;</i>
<i class="iconfont hide up">&#xe615;</i>
</h3>
<ul class="dispatch-mode">
{{#each dispatchMode}}
<li class="{{#if isSelected}}chosed{{/if}}{{#if is_support_message}} no-support{{/if}}" data-id="{{id}}">
<span>{{name}}:运费¥{{cost}} {{#if is_support_message}}({{is_support_message}}){{/if}}</span>
<i class="right iconfont {{#if isSelected}}icon-cb-radio{{else}}icon-radio{{/if}}" data-id="{{id}}"></i>
</li>
{{/each}}
</ul>
</div>
</section>
{{/each}}
</ul>
</div>
<div class="sub-block dispatch-time">
<h3>
<p>送货时间</p>
{{#each dispatchTime}}
{{#if isSelected}}<span>{{name}}</span>{{/if}}
{{/each}}
<i class="iconfont down">&#xe616;</i>
<i class="iconfont hide up">&#xe615;</i>
</h3>
<ul>
<li class="dispatch-time-info">快递公司会尽力按您选择的送货时间配送,如遇特殊情况(天气、环境等)无法按您要求时间配送,还请您谅解。</li>
{{#each dispatchTime}}
<li {{#if isSelected}}class="chosed"{{/if}} data-id="{{id}}">
<span>{{name}}</span>
<i class="right iconfont radio {{#if isSelected}}icon-cb-radio{{else}}icon-radio{{/if}}" ></i>
</li>
{{/each}}
</ul>
</div>
</section>
{{#if isJit}}
{{> home/order/jit-more}}
{{/if}}
<section class="block goods-bottom">
{{#each goods}}
{{> home/order/good}}
{{/each}}
<div class="goods-num">{{num}}件商品 合计<span>{{goodsPrice}}</span></div>
</section>
{{#if isJit}}
{{> home/order/jit-more}}
{{/if}}
<section class="block goods-bottom">
{{#each goods}}
{{> home/order/good}}
{{/each}}
<div class="goods-num">{{num}}件商品 合计<span>{{goodsPrice}}</span></div>
</section>
<section class="block">
<ul class="sale-invoice">
{{!-- 优惠券 --}}
{{#if isOrdinaryCart}}
<li class="coupon">
<a href="{{selectCouponUrl}}">
<span class="title">优惠券/优惠券码</span>
{{# coupon}}
{{#if isLimit}}
<span class="coupon-info pull-right">
该商品不可使用优惠券
<i class="iconfont">&#xe614;</i>
</span>
{{^}}
<span class="count">{{#if selectedAmount}}已选{{selectedAmount}}{{^}}{{count}}张可用{{/if}}</span>
<span class="coupon-info pull-right">
{{info}}<i class="iconfont">&#xe614;</i>
</span>
{{/if}}
{{/coupon}}
</a>
</li>
{{/if}}
<section class="block">
<ul class="sale-invoice">
{{!-- 优惠券 --}}
{{#if isOrdinaryCart}}
<li class="coupon">
<a href="{{selectCouponUrl}}">
<span class="title">优惠券/优惠券码</span>
{{# coupon}}
{{#if isLimit}}
<span class="coupon-info pull-right">
该商品不可使用优惠券
<i class="iconfont">&#xe614;</i>
</span>
{{^}}
<span class="count">{{#if selectedAmount}}已选{{selectedAmount}}{{^}}{{count}}张可用{{/if}}</span>
<span class="coupon-info pull-right">
{{info}}<i class="iconfont">&#xe614;</i>
</span>
{{/if}}
{{/coupon}}
</a>
</li>
{{/if}}
{{!-- 有货币 --}}
<li class="coin" data-yoho-coin="{{yohoCoinCompute.yohoCoin}}" data-yoho-coin-click={{yohoCoinCompute.yohoCoinClick}}>
<span class="title">有货币</span>
<span class="desc msg">{{yohoCoinCompute.yohoCoinMsg}}</span>
<span class="yoho-coin-help">?</span>
{{#if yohoCoinCompute.useYohoCoin}}
<span class="coin-check">
<i class="iconfont checkbox icon-cb-radio"></i>
</span>
{{else}}
<span class="coin-check">
<i class="iconfont checkbox icon-radio"></i>
</span>
{{!-- 有货币 --}}
<li class="coin" data-yoho-coin="{{yohoCoinCompute.yohoCoin}}" data-yoho-coin-click={{yohoCoinCompute.yohoCoinClick}}>
<span class="title">有货币</span>
<span class="desc msg">{{yohoCoinCompute.yohoCoinMsg}}</span>
<span class="yoho-coin-help">?</span>
{{#if yohoCoinCompute.useYohoCoin}}
<span class="coin-check">
<i class="iconfont checkbox icon-cb-radio"></i>
</span>
{{else}}
<span class="coin-check">
<i class="iconfont checkbox icon-radio"></i>
</span>
{{/if}}
</li>
{{!-- 礼品卡 --}}
{{#if giftCards}}
<li class="gift-card">
<a href="{{choseGiftCard}}">
<span class="title">礼品卡</span>
{{# giftCards}}
<span class="count">{{leftInfo}}</span>
<span class="gift-card-info pull-right">
<span id="giftCardRightInfo">{{rightInfo}}</span><i class="iconfont">&#xe614;</i>
</span>
{{/giftCards}}
</a>
</li>
{{/if}}
</li>
{{!-- 礼品卡 --}}
{{#if giftCards}}
<li class="gift-card">
<a href="{{choseGiftCard}}">
<span class="title">礼品卡</span>
{{# giftCards}}
<span class="count">{{leftInfo}}</span>
<span class="gift-card-info pull-right">
<span id="giftCardRightInfo">{{rightInfo}}</span><i class="iconfont">&#xe614;</i>
</span>
{{/giftCards}}
{{!-- 发票 --}}
{{#if invoice}}
<li class="invoice {{#if needInvoice}}focus{{/if}}">
<input type="hidden" class="user-mobile" value="{{@root.userMobile}}" />
<span class="title">发票</span>
<span class="iconfont checkbox {{#if needInvoice}}icon-cb-radio{{else}}icon-radio{{/if}}"></span>
<a id="invoice" class="invoice-info" href="/cart/index/buynow/selectInvoice?product_sku={{@root.product_sku}}">
<span class="title">发票信息</span>
<span class="invoice-type">{{invoiceText}}<i class="iconfont">&#xe614;</i></span>
</a>
</li>
{{/if}}
{{/if}}
</ul>
{{!-- 发票 --}}
{{#if invoice}}
<li class="invoice {{#if needInvoice}}focus{{/if}}">
<input type="hidden" class="user-mobile" value="{{@root.userMobile}}" />
<span class="title">发票</span>
<span class="iconfont checkbox {{#if needInvoice}}icon-cb-radio{{else}}icon-radio{{/if}}"></span>
<a id="invoice" class="invoice-info" href="/cart/index/buynow/selectInvoice?product_sku={{@root.product_sku}}">
<span class="title">发票信息</span>
<span class="invoice-type">{{invoiceText}}<i class="iconfont">&#xe614;</i></span>
</a>
</li>
<form id="msg" action="" method="post">
<input type="text" name="msg" value="{{msg}}" maxlength="40" placeholder="留言">
</form>
<ul class="sale-invoice">
<li class="no-print-price">
<span class="title">不打印价格</span>
<span class="desc">送朋友可不打印价格哦</span>
<span class="check">
<i class="iconfont checkbox{{#if isPrintPrice}} icon-radio{{else}} icon-cb-radio{{/if}}"></i>
</span>
</li>
</ul>
</section>
<section class="price-cal block">
<ul class="total">
{{#cartPayData}}
<li>
<p>{{promotion}}</p>
<span>{{promotion_amount}}</span>
</li>
{{/cartPayData}}
</ul>
<div class="price-cost">
实付金额
<span>¥{{round price 2}}</span>
</div>
{{#if returnYohoCoin}}
<div class="yoho-coin">
共返有货币: {{yohoCoinNum}}
</div>
{{/if}}
</ul>
<form id="msg" action="" method="post">
<input type="text" name="msg" value="{{msg}}" maxlength="40" placeholder="留言">
</form>
<ul class="sale-invoice">
<li class="no-print-price">
<span class="title">不打印价格</span>
<span class="desc">送朋友可不打印价格哦</span>
<span class="check">
<i class="iconfont checkbox{{#if isPrintPrice}} icon-radio{{else}} icon-cb-radio{{/if}}"></i>
</span>
</li>
</ul>
</section>
<section class="price-cal block">
<ul class="total">
{{#cartPayData}}
<li>
<p>{{promotion}}</p>
<span>{{promotion_amount}}</span>
</li>
{{/cartPayData}}
</ul>
<div class="price-cost">
实付金额
<span>¥{{round price 2}}</span>
</section>
{{#if addressInfo}}
<div class="address-bottom">
<div class="back"></div>
<span>送至:{{addressInfo}}</span>
</div>
{{/if}}
<div class="bill">
您需要支付:<span>¥{{round price 2}}</span>
<a href="javascript:;">提交订单</a>
</div>
{{#if returnYohoCoin}}
<div class="yoho-coin">
共返有货币: {{yohoCoinNum}}
<div class="yoho-coin-help-dialog-bg"></div>
<div class="yoho-coin-help-dialog">
<div class="yoho-coin-title">有货币使用条件:</div>
<div class="yoho-coin-content">
<p>1.订单金额大于20元(含)</p>
<p>2.有货币数量大于{{yohoCoinCompute.yoho_coin_pay_rule.num_limit}}个(含)</p>
<p>3.有货币支付不得超过每笔订单应付金额的{{yohoCoinCompute.yoho_coin_pay_rule.max_pay_rate_desc}}</p>
<p>备注:使用有货币数量为{{yohoCoinCompute.yoho_coin_pay_rule.num_limit}}的整数倍,100有货币抵1元。</p>
</div>
<div class="yoho-coin-footer">知道了</div>
</div>
{{#if errorMsg}}
<div class="yoho-coin-help-dialog-bg"></div>
<div class="yoho-coin-help-dialog">
<div class="yoho-coin-content">{{errorMsg}}</div>
<div class="yoho-coin-footer">返回</div>
</div>
{{/if}}
</section>
{{#if addressInfo}}
<div class="address-bottom">
<div class="back"></div>
<span>送至:{{addressInfo}}</span>
</div>
<input type="hidden" id="product-sku" name="product-sku" value="{{sku}}">
{{#with seckill}}
<input type="hidden" id="activity-id" name="activity-id" value="{{activityId}}">
{{/with}}
{{/if}}
<div class="bill">
您需要支付:<span>¥{{round price 2}}</span>
<a href="javascript:;">提交订单</a>
</div>
<div class="yoho-coin-help-dialog-bg"></div>
<div class="yoho-coin-help-dialog">
<div class="yoho-coin-title">有货币使用条件:</div>
<div class="yoho-coin-content">
<p>1.订单金额大于20元(含)</p>
<p>2.有货币数量大于{{yohoCoinCompute.yoho_coin_pay_rule.num_limit}}个(含)</p>
<p>3.有货币支付不得超过每笔订单应付金额的{{yohoCoinCompute.yoho_coin_pay_rule.max_pay_rate_desc}}</p>
<p>备注:使用有货币数量为{{yohoCoinCompute.yoho_coin_pay_rule.num_limit}}的整数倍,100有货币抵1元。</p>
</div>
<div class="yoho-coin-footer">知道了</div>
</div>
<input type="hidden" id="product-sku" name="product-sku" value="{{sku}}">
{{#with seckill}}
<input type="hidden" id="activity-id" name="activity-id" value="{{activityId}}">
{{/with}}
{{else}}
<div class="order-ensure-error">
{{message}}
</div>
{{/ orderEnsure}}
{{/ orderEnsure}}
</div>
{{> rich_tip}}
... ...
... ... @@ -768,7 +768,7 @@
width: 100%;
height: 100%;
position: fixed;
z-index: 1;
z-index: 3;
left: 0;
top: 0;
opacity: 0.3;
... ... @@ -780,7 +780,7 @@
width: 540px;
height: 510px;
background-color: #fff;
z-index: 2;
z-index: 4;
border-radius: 10px;
left: 50%;
margin-left: -270px;
... ...