Authored by 毕凯

Merge remote-tracking branch 'origin/hotfix/jitdetail' into gray

@@ -7,6 +7,7 @@ const headerModel = require('../../../doraemon/models/header'); @@ -7,6 +7,7 @@ const headerModel = require('../../../doraemon/models/header');
7 const userModel = require('../models/user'); 7 const userModel = require('../models/user');
8 const addressModel = require('../models/address'); 8 const addressModel = require('../models/address');
9 const orderModel = require('../models/order'); 9 const orderModel = require('../models/order');
  10 +const buyNowModel = require('../models/buy-now-model');
10 const crypto = global.yoho.crypto; 11 const crypto = global.yoho.crypto;
11 const paymentProcess = require(global.utils + '/payment-process'); 12 const paymentProcess = require(global.utils + '/payment-process');
12 const logger = global.yoho.logger; 13 const logger = global.yoho.logger;
@@ -399,23 +400,40 @@ exports.invoiceInfo = (req, res, next) => { @@ -399,23 +400,40 @@ exports.invoiceInfo = (req, res, next) => {
399 * JIT 拆单配送信息页面 400 * JIT 拆单配送信息页面
400 */ 401 */
401 exports.jitDetail = (req, res, next) => { 402 exports.jitDetail = (req, res, next) => {
  403 + let uid = req.user.uid;
402 let cartType = req.query.cartType; 404 let cartType = req.query.cartType;
  405 + let deliveryId = req.query.deliveryId;
403 let headerData = headerModel.setNav({ 406 let headerData = headerModel.setNav({
404 navTitle: '配送信息', 407 navTitle: '配送信息',
405 navBtn: false 408 navBtn: false
406 }); 409 });
407 410
408 - cartModel.jitDetailData(  
409 - req.user.uid,  
410 - cartType,  
411 - req.query.skuList,  
412 - req.query.orderCode,  
413 - req.session.TOKEN,  
414 - req.query.deliveryId,  
415 - req.query.paymentType,  
416 - req.query.couponCode,  
417 - req.query.yohoCoin  
418 - ).then(result => { 411 + co(function* () {
  412 + let result = {};
  413 +
  414 + if (req.query.buynow === 'Y') {
  415 + let resultFromApi = yield req.ctx(buyNowModel).compute({
  416 + delivery_way: deliveryId,
  417 + uid: uid,
  418 + product_sku: req.query.product_sku,
  419 + buy_number: 1
  420 + });
  421 +
  422 + result = paymentProcess.transformJit(_.get(resultFromApi, 'data.package_list', []));
  423 + } else {
  424 + result = yield cartModel.jitDetailData(
  425 + uid,
  426 + cartType,
  427 + req.query.skuList,
  428 + req.query.orderCode,
  429 + req.session.TOKEN,
  430 + deliveryId,
  431 + req.query.paymentType,
  432 + req.query.couponCode,
  433 + req.query.yohoCoin
  434 + );
  435 + }
  436 +
419 if (cartType) { 437 if (cartType) {
420 _.assign(headerData, { 438 _.assign(headerData, {
421 backUrl: result.returnUrl 439 backUrl: result.returnUrl
@@ -427,6 +445,7 @@ exports.jitDetail = (req, res, next) => { @@ -427,6 +445,7 @@ exports.jitDetail = (req, res, next) => {
427 jitDetailPage: true, 445 jitDetailPage: true,
428 module: 'cart', 446 module: 'cart',
429 page: 'jit-detail', 447 page: 'jit-detail',
  448 + localCss: true
430 })); 449 }));
431 - }).catch(next); 450 + })().catch(next);
432 }; 451 };
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 * @author: zhaobiao<bill.zhao@yoho.cn> 3 * @author: zhaobiao<bill.zhao@yoho.cn>
4 * @date: 2016/04/26 4 * @date: 2016/04/26
5 */ 5 */
6 - 6 +require('cart/jit-detail.page.css');
7 let Swiper = require('yoho-swiper'), 7 let Swiper = require('yoho-swiper'),
8 $ = require('yoho-jquery'); 8 $ = require('yoho-jquery');
9 9
@@ -4,7 +4,6 @@ @@ -4,7 +4,6 @@
4 .top, 4 .top,
5 .middle, 5 .middle,
6 .bottom { 6 .bottom {
7 - display: none;  
8 background-color: #fff; 7 background-color: #fff;
9 } 8 }
10 9
1 -@import "good";  
2 -@import "chose-panel";  
3 -@import "gift-advance-good";  
4 -@import "order-ensure";  
5 -@import "invoice-info";  
6 -@import "select-coupon";  
7 -@import "select-address";  
8 -@import "jit-detail";  
9 -@import "pay-failure";  
10 -  
11 -.icon-checkbox:before {  
12 - content: "\e61c";  
13 -}  
14 -  
15 -.icon-cb-checked:before {  
16 - content: "\e61d";  
17 -}  
18 -  
19 -.icon-radio:before {  
20 - content: "\e647";  
21 -}  
22 -  
23 -.icon-cb-radio:before {  
24 - content: "\e646";  
25 -}  
26 -  
27 -.shopping-cart-page {  
28 - margin-bottom: 120px;  
29 - overflow-x: hidden;  
30 - background: #f0f0f0;  
31 - display: none;  
32 -  
33 - .yoho-tip {  
34 - z-index: 4;  
35 - }  
36 -  
37 - .cart-content > * {  
38 - background: #fff;  
39 -  
40 - &:first-child {  
41 - border-top: none;  
42 - margin-top: 0;  
43 - }  
44 - }  
45 -  
46 - .cart-nav {  
47 - color: #c6c6c6;  
48 - border-bottom: 1px solid #e0e0e0;  
49 - background: #fff;  
50 -  
51 - li {  
52 - float: left;  
53 - width: 50%;  
54 - padding: 30px 0;  
55 - height: 30px;  
56 - }  
57 -  
58 - li.active {  
59 - color: #000;  
60 - }  
61 -  
62 - span {  
63 - display: block;  
64 - box-sizing: border-box;  
65 - width: 100%;  
66 - height: 30px;  
67 - line-height: 30px;  
68 - font-size: 30px;  
69 - text-align: center;  
70 - }  
71 -  
72 - li:first-child span {  
73 - border-right: 1px solid #e0e0e0;  
74 - }  
75 -  
76 - li:last-child {  
77 - position: relative;  
78 - }  
79 -  
80 - .presell-tip {  
81 - position: absolute;  
82 - z-index: 1;  
83 - left: -2rem;  
84 - top: 1.75rem;  
85 - }  
86 -  
87 - .triangle {  
88 - width: 0;  
89 - height: 0;  
90 - border-left: 8PX solid transparent;  
91 - border-right: 8PX solid transparent;  
92 - border-bottom: 12PX solid #000;  
93 - margin-left: 6rem;  
94 - }  
95 -  
96 - .pt-content {  
97 - position: relative;  
98 - padding: 10px;  
99 - background: #000;  
100 - color: #fff;  
101 - font-size: 12px;  
102 - border-radius: 5PX;  
103 - text-align: center;  
104 - width: 7rem;  
105 - }  
106 - }  
107 -  
108 - .login-info {  
109 - height: 46px;  
110 - padding: 17px 20px;  
111 - color: #24acaa;  
112 - text-align: center;  
113 - font-size: 28px;  
114 -  
115 - .btn {  
116 - display: inline-block;  
117 - background: #ed0010;  
118 - color: #fff;  
119 - width: 80px;  
120 - height: 46px;  
121 - line-height: 46px;  
122 - }  
123 - }  
124 -  
125 - .presell-info {  
126 - height: 60px;  
127 - padding: 15px 30px;  
128 - font-size: 22px;  
129 - background: #f0f0f0;  
130 - color: #b7b7b7;  
131 -  
132 - > span {  
133 - display: block;  
134 - }  
135 -  
136 - .iconfont {  
137 - float: left;  
138 - font-size: 45px;  
139 - }  
140 -  
141 - .txt {  
142 - height: 30px;  
143 - line-height: 30px;  
144 - margin-left: 80px;  
145 - }  
146 - }  
147 -  
148 - .cart-goods {  
149 - border-bottom: 1px solid #e0e0e0;  
150 - margin-bottom: 0.75rem;  
151 -  
152 - .shopping-cart-good:last-child .info {  
153 - border-bottom: none;  
154 - }  
155 - }  
156 -  
157 - .invalid-goods {  
158 - border-top: 1px solid #e0e0e0;  
159 - border-bottom: 1px solid #e0e0e0;  
160 - margin: 0.75rem 0;  
161 - }  
162 -  
163 - .freebie-and-advance-buy {  
164 - font-size: 24px;  
165 - border-top: 1px solid #e0e0e0;  
166 - border-bottom: 1px solid #e0e0e0;  
167 - margin-bottom: 30px;  
168 -  
169 - > li {  
170 - box-sizing: border-box;  
171 - height: 80px;  
172 - line-height: 80px;  
173 - margin-bottom: 10px;  
174 - padding: 0 20px;  
175 -  
176 - &:last-child {  
177 - margin-bottom: 0;  
178 - }  
179 -  
180 - a {  
181 - float: right;  
182 - width: 100%;  
183 - }  
184 -  
185 - .under-line {  
186 - display: inline-block;  
187 - height: 1px;  
188 - width: 91%;  
189 - position: absolute;  
190 - left: 9%;  
191 - background-color: #f1f1f1;  
192 - }  
193 - }  
194 -  
195 - > li:first-child {  
196 - .under-line {  
197 - display: none;  
198 - }  
199 - }  
200 -  
201 - .count {  
202 - color: #7b7b7b;  
203 - float: right;  
204 - }  
205 -  
206 - .icon-right-arrow {  
207 - color: #8f8f8f;  
208 - float: right;  
209 - }  
210 - }  
211 -  
212 - .activity-title {  
213 - border-top: 1px solid #e0e0e0;  
214 - font-size: 32px;  
215 - padding: 20px 20px 0;  
216 - }  
217 -  
218 - .activity {  
219 - padding: 8px 20px 20px 32px;  
220 - font-size: 26px;  
221 -  
222 - li:before {  
223 - content: "";  
224 - display: inline-block;  
225 - margin-right: 10px;  
226 - width: 8px;  
227 - height: 8px;  
228 - background-color: #000;  
229 - border-radius: 50%;  
230 - position: relative;  
231 - left: 0;  
232 - top: -0.12rem;  
233 - }  
234 - }  
235 -  
236 - .price-compute {  
237 - padding: 20px;  
238 - border-top: 1px solid #e0e0e0;  
239 - font-size: 28px;  
240 - margin-bottom: 37px;  
241 -  
242 - .title {  
243 - display: inline-block;  
244 - width: 175px;  
245 - }  
246 -  
247 - .minus {  
248 - float: right;  
249 - }  
250 - }  
251 -  
252 - .balance {  
253 - position: fixed;  
254 - box-sizing: border-box;  
255 - bottom: 0;  
256 - width: 100%;  
257 - padding: 20px;  
258 - height: 120px;  
259 - border-top: 1px solid #e0e0e0;  
260 - background: #fff;  
261 -  
262 - .iconfont {  
263 - position: absolute;  
264 - top: 50%;  
265 - margin-top: -14px;  
266 - font-size: 28px;  
267 - }  
268 -  
269 - p {  
270 - float: right;  
271 - margin-right: 32px;  
272 - font-size: 26px;  
273 -  
274 - span {  
275 - display: block;  
276 - height: 40px;  
277 - line-height: 40px;  
278 - color: #d0253b;  
279 - font-weight: bold;  
280 - }  
281 -  
282 - .tip {  
283 - color: #666;  
284 - font-size: 22px;  
285 - text-align: right;  
286 - font-weight: normal;  
287 - }  
288 - }  
289 -  
290 - .btn-balance {  
291 - float: right;  
292 - width: 140px;  
293 - height: 80px;  
294 - line-height: 80px;  
295 - text-align: center;  
296 - background: #e01;  
297 - color: #fff;  
298 - border: none;  
299 - font-size: 28px;  
300 - }  
301 - }  
302 -  
303 - .cart-zero {  
304 - width: 100%;  
305 - height: auto;  
306 - padding-top: 2rem;  
307 - padding-bottom: 20%;  
308 -  
309 - i {  
310 - font-size: 6em;  
311 - display: block;  
312 - margin: 0 auto;  
313 - text-align: center;  
314 - color: #505050;  
315 - }  
316 -  
317 - p {  
318 - display: block;  
319 - text-align: center;  
320 - font-size: 1em;  
321 - color: #444;  
322 - padding: 0.6rem 0;  
323 - }  
324 -  
325 - a {  
326 - width: 27%;  
327 - height: 1.2rem;  
328 - overflow: hidden;  
329 - line-height: 1.2rem;  
330 - border: 1px solid #505050;  
331 - border-radius: 0.2rem;  
332 - display: block;  
333 - margin: 0 auto;  
334 - text-align: center;  
335 - color: #fff;  
336 - background: #444;  
337 - }  
338 - }  
339 -}  
@@ -295,7 +295,15 @@ function tranformPayment(data, orderInfo, cartType, skuList, orderComputeData) { @@ -295,7 +295,15 @@ function tranformPayment(data, orderInfo, cartType, skuList, orderComputeData) {
295 skuList: skuList 295 skuList: skuList
296 }, jitInfo); 296 }, jitInfo);
297 297
298 - result.jitDetailUrl = helpers.urlFormat('/cart/index/new/jitDetail', param); 298 + if (_.get(orderInfo, 'product_sku', '')) {
  299 + result.jitDetailUrl = helpers.urlFormat('/cart/index/new/jitDetail', {
  300 + buynow: 'Y',
  301 + product_sku: _.get(orderInfo, 'product_sku', '')
  302 + });
  303 + } else {
  304 + result.jitDetailUrl = helpers.urlFormat('/cart/index/new/jitDetail', param);
  305 + }
  306 +
299 result.packageTitle = cartData.package_title; 307 result.packageTitle = cartData.package_title;
300 } 308 }
301 309