Authored by 李靖

限流提示

@@ -77,6 +77,7 @@ exports.ensure = (req, res, next) => { @@ -77,6 +77,7 @@ exports.ensure = (req, res, next) => {
77 paymentOption.activity_id = activityId = skillData.activityId; 77 paymentOption.activity_id = activityId = skillData.activityId;
78 78
79 let orderComputerData; 79 let orderComputerData;
  80 + let limitMessage;
80 81
81 if (orderInfo) { 82 if (orderInfo) {
82 orderComputerData = yield req.ctx(seckillModel).compute(_.assign(paymentOption, { 83 orderComputerData = yield req.ctx(seckillModel).compute(_.assign(paymentOption, {
@@ -85,6 +86,10 @@ exports.ensure = (req, res, next) => { @@ -85,6 +86,10 @@ exports.ensure = (req, res, next) => {
85 use_yoho_coin: orderInfo.yohoCoin || 0, 86 use_yoho_coin: orderInfo.yohoCoin || 0,
86 gift_card_code: orderInfo.gift_card_code || null 87 gift_card_code: orderInfo.gift_card_code || null
87 })); 88 }));
  89 +
  90 + if (orderComputerData.code === 9999992) {
  91 + limitMessage = '人太多啦,请稍后再试!';
  92 + }
88 } 93 }
89 94
90 let [userProfile, address, paymentInfo, validGiftCardCountData] = yield Promise.all([ 95 let [userProfile, address, paymentInfo, validGiftCardCountData] = yield Promise.all([
@@ -134,6 +139,7 @@ exports.ensure = (req, res, next) => { @@ -134,6 +139,7 @@ exports.ensure = (req, res, next) => {
134 } 139 }
135 140
136 res.locals.title = '确认订单'; 141 res.locals.title = '确认订单';
  142 + view.limitMessage = limitMessage;
137 res.render('order-ensure', Object.assign({ 143 res.render('order-ensure', Object.assign({
138 module: 'cart', 144 module: 'cart',
139 page: 'seckill', 145 page: 'seckill',
1 <div class="order-ensure-page yoho-page"> 1 <div class="order-ensure-page yoho-page">
2 - <input id="cart-token" type="hidden" name="token" value="{{cartToken}}">  
3 - {{# orderEnsure}}  
4 - {{#if addressInfo}}  
5 - <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}}">  
6 - <div class="info">  
7 - <span class="info-name">{{name}}</span>  
8 - <span class="info-phone">{{phoneNum}}</span>  
9 - <a href="/cart/index/new/selectAddress"><span class="info-address">{{addressInfo}}</span></a>  
10 - <i class="iconfont">&#xe637;</i> 2 + {{#if limitMessage}}
  3 + <div class="order-ensure-error">
  4 + {{limitMessage}}
11 </div> 5 </div>
12 - <a class="rest" href="/cart/index/new/selectAddress">其他地址<span class="iconfont">&#xe614;</span></a>  
13 - </div>  
14 {{else}} 6 {{else}}
15 - <div class="address block address-wrap not-address">  
16 - <i class="iconfont">&#xe637;</i>  
17 - <a class="choose" href="/cart/index/new/selectAddress">请选择收货地址<span class="iconfont">&#xe614;</span></a> 7 + <input id="cart-token" type="hidden" name="token" value="{{cartToken}}">
  8 + {{# orderEnsure}}
  9 + {{#if addressInfo}}
  10 + <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}}">
  11 + <div class="info">
  12 + <span class="info-name">{{name}}</span>
  13 + <span class="info-phone">{{phoneNum}}</span>
  14 + <a href="/cart/index/new/selectAddress"><span class="info-address">{{addressInfo}}</span></a>
  15 + <i class="iconfont">&#xe637;</i>
  16 + </div>
  17 + <a class="rest" href="/cart/index/new/selectAddress">其他地址<span class="iconfont">&#xe614;</span></a>
18 </div> 18 </div>
19 - {{/if}}  
20 - <section class="dispatch block">  
21 - <div class="sub-block payment-type">  
22 - <h3>  
23 - <p>支付方式</p>  
24 - {{#each paymentWay}}  
25 - {{#if recommend}}<span>{{name}}</span>{{/if}}  
26 - {{/each}}  
27 - <i class="iconfont down">&#xe616;</i>  
28 - <i class="iconfont hide up">&#xe615;</i>  
29 - </h3>  
30 - <ul>  
31 - {{#each paymentWay}}  
32 - {{#if isSupport}}  
33 - <li {{#if recommend}}class="chosed"{{/if}}>  
34 - <span {{#if isSupportMessage}}data-message="{{isSupportMessage}}"{{/if}}>{{name}}</span>  
35 - <i class="right iconfont {{#if recommend}}icon-cb-radio{{else}}icon-radio{{/if}}" data-id="{{id}}" data-payment-type="{{paymentType}}"></i>  
36 - </li>  
37 - {{^}}  
38 - <li class="no-support">  
39 - <span class="tip" title="{{isSupportMessage}}" data-message="{{isSupportMessage}}">{{name}}({{isSupportMessage}})</span>  
40 - <i class="right iconfont icon-radio"></i> 19 + {{else}}
  20 + <div class="address block address-wrap not-address">
  21 + <i class="iconfont">&#xe637;</i>
  22 + <a class="choose" href="/cart/index/new/selectAddress">请选择收货地址<span class="iconfont">&#xe614;</span></a>
  23 + </div>
  24 + {{/if}}
  25 + <section class="dispatch block">
  26 + <div class="sub-block payment-type">
  27 + <h3>
  28 + <p>支付方式</p>
  29 + {{#each paymentWay}}
  30 + {{#if recommend}}<span>{{name}}</span>{{/if}}
  31 + {{/each}}
  32 + <i class="iconfont down">&#xe616;</i>
  33 + <i class="iconfont hide up">&#xe615;</i>
  34 + </h3>
  35 + <ul>
  36 + {{#each paymentWay}}
  37 + {{#if isSupport}}
  38 + <li {{#if recommend}}class="chosed"{{/if}}>
  39 + <span {{#if isSupportMessage}}data-message="{{isSupportMessage}}"{{/if}}>{{name}}</span>
  40 + <i class="right iconfont {{#if recommend}}icon-cb-radio{{else}}icon-radio{{/if}}" data-id="{{id}}" data-payment-type="{{paymentType}}"></i>
  41 + </li>
  42 + {{^}}
  43 + <li class="no-support">
  44 + <span class="tip" title="{{isSupportMessage}}" data-message="{{isSupportMessage}}">{{name}}({{isSupportMessage}})</span>
  45 + <i class="right iconfont icon-radio"></i>
  46 + </li>
  47 + {{/if}}
  48 + {{/each}}
  49 + </ul>
  50 + </div>
  51 + <div class="sub-block delivery-id">
  52 + <h3>
  53 + <p>配送方式</p>
  54 + {{#each dispatchMode}}
  55 + {{#if isSelected}}<span>{{name}}:运费¥{{cost}}</span>{{/if}}
  56 + {{/each}}
  57 + <i class="iconfont down">&#xe616;</i>
  58 + <i class="iconfont hide up">&#xe615;</i>
  59 + </h3>
  60 + <ul class="dispatch-mode">
  61 + {{#each dispatchMode}}
  62 + <li class="{{#if isSelected}}chosed{{/if}}{{#if is_support_message}} no-support{{/if}}" data-id="{{id}}">
  63 + <span class="tip">{{name}}:运费¥{{cost}} {{#if is_support_message}}({{is_support_message}}){{/if}}</span>
  64 + <i class="right iconfont {{#if isSelected}}icon-cb-radio{{else}}icon-radio{{/if}}" data-id="{{id}}"></i>
41 </li> 65 </li>
42 - {{/if}}  
43 - {{/each}}  
44 - </ul>  
45 - </div>  
46 - <div class="sub-block delivery-id">  
47 - <h3>  
48 - <p>配送方式</p>  
49 - {{#each dispatchMode}}  
50 - {{#if isSelected}}<span>{{name}}:运费¥{{cost}}</span>{{/if}}  
51 - {{/each}}  
52 - <i class="iconfont down">&#xe616;</i>  
53 - <i class="iconfont hide up">&#xe615;</i>  
54 - </h3>  
55 - <ul class="dispatch-mode">  
56 - {{#each dispatchMode}}  
57 - <li class="{{#if isSelected}}chosed{{/if}}{{#if is_support_message}} no-support{{/if}}" data-id="{{id}}">  
58 - <span class="tip">{{name}}:运费¥{{cost}} {{#if is_support_message}}({{is_support_message}}){{/if}}</span>  
59 - <i class="right iconfont {{#if isSelected}}icon-cb-radio{{else}}icon-radio{{/if}}" data-id="{{id}}"></i> 66 + {{/each}}
  67 + </ul>
  68 + </div>
  69 + <div class="sub-block dispatch-time">
  70 + <h3>
  71 + <p>送货时间</p>
  72 + {{#each dispatchTime}}
  73 + {{#if isSelected}}<span>{{name}}</span>{{/if}}
  74 + {{/each}}
  75 + <i class="iconfont down">&#xe616;</i>
  76 + <i class="iconfont hide up">&#xe615;</i>
  77 + </h3>
  78 + <ul>
  79 + <li class="dispatch-time-info">快递公司会尽力按您选择的送货时间配送,如遇特殊情况(天气、环境等)无法按您要求时间配送,还请您谅解。</li>
  80 + {{#each dispatchTime}}
  81 + <li {{#if isSelected}}class="chosed"{{/if}} data-id="{{id}}">
  82 + <span>{{name}}</span>
  83 + <i class="right iconfont radio {{#if isSelected}}icon-cb-radio{{else}}icon-radio{{/if}}" ></i>
  84 + </li>
  85 + {{/each}}
  86 + </ul>
  87 + </div>
  88 + </section>
  89 +
  90 + {{#if isJit}}
  91 + {{> home/order/jit-more}}
  92 + {{/if}}
  93 + <section class="block goods-bottom">
  94 + {{#each goods}}
  95 + {{> home/order/good}}
  96 + {{/each}}
  97 + <div class="goods-num">{{num}}件商品 合计<span>{{goodsPrice}}</span></div>
  98 + </section>
  99 +
  100 + <section class="block">
  101 + <ul class="sale-invoice">
  102 + {{!-- 优惠券 --}}
  103 + {{#if isOrdinaryCart}}
  104 + <li class="coupon">
  105 + <a href="{{#if isLimit}}javascript:void(0);{{else}}/cart/index/new/selectCoupon{{/if}}">
  106 + <span class="title">优惠券</span>
  107 + {{# coupon}}
  108 + {{#if isLimit}}
  109 + <span class="coupon-info pull-right">
  110 + 该商品不可使用优惠券
  111 + <i class="iconfont">&#xe614;</i>
  112 + </span>
  113 + {{^}}
  114 + <span class="count">{{#if selectedAmount}}已选{{selectedAmount}}{{^}}{{count}}张可用{{/if}}</span>
  115 + <span class="coupon-info pull-right{{#isEqualOr info '无可用'}} no-can-use{{/isEqualOr}}">
  116 + {{info}}<i class="iconfont">&#xe614;</i>
  117 + </span>
  118 + {{/if}}
  119 + {{/coupon}}
  120 + </a>
60 </li> 121 </li>
61 - {{/each}}  
62 - </ul>  
63 - </div>  
64 - <div class="sub-block dispatch-time">  
65 - <h3>  
66 - <p>送货时间</p>  
67 - {{#each dispatchTime}}  
68 - {{#if isSelected}}<span>{{name}}</span>{{/if}}  
69 - {{/each}}  
70 - <i class="iconfont down">&#xe616;</i>  
71 - <i class="iconfont hide up">&#xe615;</i>  
72 - </h3>  
73 - <ul>  
74 - <li class="dispatch-time-info">快递公司会尽力按您选择的送货时间配送,如遇特殊情况(天气、环境等)无法按您要求时间配送,还请您谅解。</li>  
75 - {{#each dispatchTime}}  
76 - <li {{#if isSelected}}class="chosed"{{/if}} data-id="{{id}}">  
77 - <span>{{name}}</span>  
78 - <i class="right iconfont radio {{#if isSelected}}icon-cb-radio{{else}}icon-radio{{/if}}" ></i>  
79 - </li>  
80 - {{/each}}  
81 - </ul>  
82 - </div>  
83 - </section> 122 + {{/if}}
84 123
85 - {{#if isJit}}  
86 - {{> home/order/jit-more}}  
87 - {{/if}}  
88 - <section class="block goods-bottom">  
89 - {{#each goods}}  
90 - {{> home/order/good}}  
91 - {{/each}}  
92 - <div class="goods-num">{{num}}件商品 合计<span>{{goodsPrice}}</span></div>  
93 - </section> 124 + {{!-- 有货币 --}}
  125 + <li class="coin" data-yoho-coin="{{yohoCoinCompute.yohoCoin}}" data-yoho-coin-click={{yohoCoinCompute.yohoCoinClick}}>
  126 + <span class="title">有货币</span>
  127 + <span class="desc msg">{{yohoCoinCompute.yohoCoinMsg}}</span>
  128 + <span class="yoho-coin-help">?</span>
  129 + {{#if yohoCoinCompute.useYohoCoin}}
  130 + <span class="coin-check">
  131 + <i class="iconfont checkbox icon-cb-radio"></i>
  132 + </span>
  133 + {{else}}
  134 + <span class="coin-check">
  135 + <i class="iconfont checkbox icon-radio"></i>
  136 + </span>
  137 + {{/if}}
  138 + </li>
94 139
95 - <section class="block">  
96 - <ul class="sale-invoice">  
97 - {{!-- 优惠券 --}}  
98 - {{#if isOrdinaryCart}}  
99 - <li class="coupon">  
100 - <a href="{{#if isLimit}}javascript:void(0);{{else}}/cart/index/new/selectCoupon{{/if}}">  
101 - <span class="title">优惠券</span>  
102 - {{# coupon}}  
103 - {{#if isLimit}}  
104 - <span class="coupon-info pull-right">  
105 - 该商品不可使用优惠券  
106 - <i class="iconfont">&#xe614;</i>  
107 - </span>  
108 - {{^}}  
109 - <span class="count">{{#if selectedAmount}}已选{{selectedAmount}}{{^}}{{count}}张可用{{/if}}</span>  
110 - <span class="coupon-info pull-right{{#isEqualOr info '无可用'}} no-can-use{{/isEqualOr}}">  
111 - {{info}}<i class="iconfont">&#xe614;</i> 140 + {{!-- 礼品卡 --}}
  141 + {{#if giftCards}}
  142 + <li class="gift-card">
  143 + <a href="{{choseGiftCard}}">
  144 + <span class="title">礼品卡</span>
  145 + {{# giftCards}}
  146 + <span class="count">{{leftInfo}}</span>
  147 + <span class="gift-card-info pull-right">
  148 + <span id="giftCardRightInfo">{{rightInfo}}</span><i class="iconfont">&#xe614;</i>
112 </span> 149 </span>
113 - {{/if}}  
114 - {{/coupon}}  
115 - </a>  
116 - </li>  
117 - {{/if}} 150 + {{/giftCards}}
  151 + </a>
  152 + </li>
  153 + {{/if}}
118 154
119 - {{!-- 有货币 --}}  
120 - <li class="coin" data-yoho-coin="{{yohoCoinCompute.yohoCoin}}" data-yoho-coin-click={{yohoCoinCompute.yohoCoinClick}}>  
121 - <span class="title">有货币</span>  
122 - <span class="desc msg">{{yohoCoinCompute.yohoCoinMsg}}</span>  
123 - <span class="yoho-coin-help">?</span>  
124 - {{#if yohoCoinCompute.useYohoCoin}}  
125 - <span class="coin-check">  
126 - <i class="iconfont checkbox icon-cb-radio"></i>  
127 - </span>  
128 - {{else}}  
129 - <span class="coin-check">  
130 - <i class="iconfont checkbox icon-radio"></i>  
131 - </span> 155 + {{!-- 发票 --}}
  156 + {{#if invoice}}
  157 + <li class="invoice {{#if needInvoice}}focus{{/if}}">
  158 + <input type="hidden" class="user-mobile" value="{{@root.userMobile}}" />
  159 + <span class="title">发票</span>
  160 + <span class="iconfont checkbox {{#if needInvoice}}icon-cb-radio{{else}}icon-radio{{/if}}"></span>
  161 + <a id="invoice" class="invoice-info" href="/cart/index/new/invoiceInfo">
  162 + <span class="title">发票信息</span>
  163 + <span class="invoice-type">{{invoiceText}}<i class="iconfont">&#xe614;</i></span>
  164 + </a>
  165 + </li>
132 {{/if}} 166 {{/if}}
133 - </li> 167 + </ul>
134 168
135 - {{!-- 礼品卡 --}}  
136 - {{#if giftCards}}  
137 - <li class="gift-card">  
138 - <a href="{{choseGiftCard}}">  
139 - <span class="title">礼品卡</span>  
140 - {{# giftCards}}  
141 - <span class="count">{{leftInfo}}</span>  
142 - <span class="gift-card-info pull-right">  
143 - <span id="giftCardRightInfo">{{rightInfo}}</span><i class="iconfont">&#xe614;</i>  
144 - </span>  
145 - {{/giftCards}}  
146 - </a> 169 + <form id="msg" action="" method="post">
  170 + <input type="text" name="msg" value="{{msg}}" maxlength="40" placeholder="留言">
  171 + </form>
  172 + <ul class="sale-invoice">
  173 + <li class="no-print-price">
  174 + <span class="title">不打印价格</span>
  175 + <span class="desc">送朋友可不打印价格哦</span>
  176 + <span class="check">
  177 + <i class="iconfont checkbox{{#if isPrintPrice}} icon-radio{{else}} icon-cb-radio{{/if}}"></i>
  178 + </span>
147 </li> 179 </li>
148 - {{/if}} 180 + </ul>
  181 + </section>
  182 + <section class="price-cal block">
  183 + <ul class="total">
  184 + {{#cartPayData}}
  185 + <li>
  186 + <p>{{promotion}}</p>
  187 + <span>{{promotion_amount}}</span>
  188 + </li>
  189 + {{/cartPayData}}
  190 + </ul>
  191 + <div class="price-cost">
  192 + 实付金额
  193 + <span>¥{{round price 2}}</span>
  194 + </div>
149 195
150 - {{!-- 发票 --}}  
151 - {{#if invoice}}  
152 - <li class="invoice {{#if needInvoice}}focus{{/if}}">  
153 - <input type="hidden" class="user-mobile" value="{{@root.userMobile}}" />  
154 - <span class="title">发票</span>  
155 - <span class="iconfont checkbox {{#if needInvoice}}icon-cb-radio{{else}}icon-radio{{/if}}"></span>  
156 - <a id="invoice" class="invoice-info" href="/cart/index/new/invoiceInfo">  
157 - <span class="title">发票信息</span>  
158 - <span class="invoice-type">{{invoiceText}}<i class="iconfont">&#xe614;</i></span>  
159 - </a>  
160 - </li> 196 + {{#if returnYohoCoin}}
  197 + <div class="yoho-coin">
  198 + 共返有货币: {{yohoCoinNum}}
  199 + </div>
161 {{/if}} 200 {{/if}}
162 - </ul>  
163 201
164 - <form id="msg" action="" method="post">  
165 - <input type="text" name="msg" value="{{msg}}" maxlength="40" placeholder="留言">  
166 - </form>  
167 - <ul class="sale-invoice">  
168 - <li class="no-print-price">  
169 - <span class="title">不打印价格</span>  
170 - <span class="desc">送朋友可不打印价格哦</span>  
171 - <span class="check">  
172 - <i class="iconfont checkbox{{#if isPrintPrice}} icon-radio{{else}} icon-cb-radio{{/if}}"></i>  
173 - </span>  
174 - </li>  
175 - </ul>  
176 - </section>  
177 - <section class="price-cal block">  
178 - <ul class="total">  
179 - {{#cartPayData}}  
180 - <li>  
181 - <p>{{promotion}}</p>  
182 - <span>{{promotion_amount}}</span>  
183 - </li>  
184 - {{/cartPayData}}  
185 - </ul>  
186 - <div class="price-cost">  
187 - 实付金额  
188 - <span>¥{{round price 2}}</span>  
189 - </div>  
190 -  
191 - {{#if returnYohoCoin}}  
192 - <div class="yoho-coin">  
193 - 共返有货币: {{yohoCoinNum}} 202 + </section>
  203 + {{#if addressInfo}}
  204 + <div class="address-bottom">
  205 + <div class="back"></div>
  206 + <span>送至:{{addressInfo}}</span>
194 </div> 207 </div>
195 {{/if}} 208 {{/if}}
  209 + <div class="bill">
  210 + 您需要支付:<span>¥{{round price 2}}</span>
  211 + <a href="javascript:;">提交订单</a>
  212 + </div>
196 213
197 - </section>  
198 - {{#if addressInfo}}  
199 - <div class="address-bottom">  
200 - <div class="back"></div>  
201 - <span>送至:{{addressInfo}}</span>  
202 - </div>  
203 - {{/if}}  
204 - <div class="bill">  
205 - 您需要支付:<span>¥{{round price 2}}</span>  
206 - <a href="javascript:;">提交订单</a>  
207 - </div>  
208 -  
209 - <div class="yoho-coin-help-dialog-bg"></div>  
210 - <div class="yoho-coin-help-dialog">  
211 - <div class="yoho-coin-title">有货币使用条件:</div>  
212 - <div class="yoho-coin-content">  
213 - <p>1.订单金额大于20元(含)</p>  
214 - <p>2.有货币数量大于{{yohoCoinCompute.yoho_coin_pay_rule.num_limit}}个(含)</p>  
215 - <p>3.有货币支付不得超过每笔订单应付金额的{{yohoCoinCompute.yoho_coin_pay_rule.max_pay_rate_desc}}</p>  
216 - <p>备注:使用有货币数量为{{yohoCoinCompute.yoho_coin_pay_rule.num_limit}}的整数倍,100有货币抵1元。</p> 214 + <div class="yoho-coin-help-dialog-bg"></div>
  215 + <div class="yoho-coin-help-dialog">
  216 + <div class="yoho-coin-title">有货币使用条件:</div>
  217 + <div class="yoho-coin-content">
  218 + <p>1.订单金额大于20元(含)</p>
  219 + <p>2.有货币数量大于{{yohoCoinCompute.yoho_coin_pay_rule.num_limit}}个(含)</p>
  220 + <p>3.有货币支付不得超过每笔订单应付金额的{{yohoCoinCompute.yoho_coin_pay_rule.max_pay_rate_desc}}</p>
  221 + <p>备注:使用有货币数量为{{yohoCoinCompute.yoho_coin_pay_rule.num_limit}}的整数倍,100有货币抵1元。</p>
  222 + </div>
  223 + <div class="yoho-coin-footer">知道了</div>
217 </div> 224 </div>
218 - <div class="yoho-coin-footer">知道了</div>  
219 - </div>  
220 225
221 - <input type="hidden" id="product-sku" name="product-sku" value="{{sku}}">  
222 - {{#with seckill}}  
223 - <input type="hidden" id="activity-id" name="activity-id" value="{{activityId}}">  
224 - {{/with}}  
225 - {{else}}  
226 - <div class="order-ensure-error">  
227 - {{message}}  
228 - </div>  
229 - {{/ orderEnsure}} 226 + <input type="hidden" id="product-sku" name="product-sku" value="{{sku}}">
  227 + {{#with seckill}}
  228 + <input type="hidden" id="activity-id" name="activity-id" value="{{activityId}}">
  229 + {{/with}}
  230 + {{else}}
  231 + <div class="order-ensure-error">
  232 + {{message}}
  233 + </div>
  234 + {{/ orderEnsure}}
  235 + {{/if}}
230 </div> 236 </div>
231 {{> rich_tip}} 237 {{> rich_tip}}