Authored by 毕凯

Merge branch 'release/5.8.1' of git.yoho.cn:fe/yohobuywap-node into release/5.8.1

@@ -2,12 +2,12 @@ @@ -2,12 +2,12 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2017-06-21 10:15:38 3 * @Date: 2017-06-21 10:15:38
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2017-06-23 17:53:27 5 + * @Last Modified time: 2017-06-26 16:21:29
6 */ 6 */
7 const _ = require('lodash'); 7 const _ = require('lodash');
8 const co = require('bluebird').coroutine; 8 const co = require('bluebird').coroutine;
9 const headerModel = require('../../../doraemon/models/header'); 9 const headerModel = require('../../../doraemon/models/header');
10 -const BuyNowModel = require('../models/BuyNowModel'); 10 +const BuyNowModel = require('../models/buy-now-model');
11 const addressModel = require('../models/address'); 11 const addressModel = require('../models/address');
12 const userModel = require('../models/user'); 12 const userModel = require('../models/user');
13 const orderModel = require('../models/order'); 13 const orderModel = require('../models/order');
@@ -41,8 +41,9 @@ class BuyNowController { @@ -41,8 +41,9 @@ class BuyNowController {
41 } 41 }
42 42
43 let product_sku = req.query.product_sku; 43 let product_sku = req.query.product_sku;
  44 + let buy_number = req.query.buy_number;
44 45
45 - if (!product_sku) { 46 + if (!product_sku || !buy_number) {
46 return next(); 47 return next();
47 } 48 }
48 49
@@ -51,20 +52,20 @@ class BuyNowController { @@ -51,20 +52,20 @@ class BuyNowController {
51 uid: req.user.uid, 52 uid: req.user.uid,
52 product_sku: product_sku, 53 product_sku: product_sku,
53 sku_type: req.query.sku_type, 54 sku_type: req.query.sku_type,
54 - buy_number: req.query.buy_number, 55 + buy_number: buy_number,
55 }); 56 });
56 let computeData = yield req.ctx(BuyNowModel).compute({ 57 let computeData = yield req.ctx(BuyNowModel).compute({
57 uid: req.user.uid, 58 uid: req.user.uid,
58 product_sku: product_sku, 59 product_sku: product_sku,
59 sku_type: req.query.sku_type, 60 sku_type: req.query.sku_type,
60 - buy_number: req.query.buy_number, 61 + buy_number: buy_number,
61 use_yoho_coin: parseInt(orderInfo.use_yoho_coin, 10) 62 use_yoho_coin: parseInt(orderInfo.use_yoho_coin, 10)
62 }); 63 });
63 let validCouponCount = yield req.ctx(BuyNowModel).countUsableCoupon({ 64 let validCouponCount = yield req.ctx(BuyNowModel).countUsableCoupon({
64 uid: req.user.uid, 65 uid: req.user.uid,
65 product_sku: req.query.product_sku, 66 product_sku: req.query.product_sku,
66 sku_type: req.query.sku_type, 67 sku_type: req.query.sku_type,
67 - buy_number: req.query.buy_number 68 + buy_number: buy_number
68 }); 69 });
69 let headerData = headerModel.setNav({ 70 let headerData = headerModel.setNav({
70 navTitle: '确认订单', 71 navTitle: '确认订单',
@@ -77,11 +78,17 @@ class BuyNowController { @@ -77,11 +78,17 @@ class BuyNowController {
77 page: 'order-ensure', 78 page: 'order-ensure',
78 title: '确认订单', 79 title: '确认订单',
79 width750: true, 80 width750: true,
  81 + localCss: true,
80 product_sku: product_sku, 82 product_sku: product_sku,
81 orderEnsure: _.assign( 83 orderEnsure: _.assign(
82 paymentProcess.tranformPayment(result.data, orderInfo, null, null, computeData.data), 84 paymentProcess.tranformPayment(result.data, orderInfo, null, null, computeData.data),
83 { 85 {
84 - coupon: paymentProcess.coupon(_.get(validCouponCount, 'data.count', 0), orderInfo, computeData) 86 + coupon: paymentProcess.coupon(_.get(validCouponCount, 'data.count', 0), orderInfo, computeData),
  87 + selectAddressUrl: helpers.urlFormat('/cart/index/buynow/selectAddress', {
  88 + product_sku: product_sku,
  89 + buy_number: buy_number
  90 + }),
  91 + isOrdinaryCart: true
85 } 92 }
86 ) 93 )
87 }); 94 });
@@ -170,10 +177,14 @@ class BuyNowController { @@ -170,10 +177,14 @@ class BuyNowController {
170 selectAddress(req, res, next) { 177 selectAddress(req, res, next) {
171 let uid = req.user.uid; 178 let uid = req.user.uid;
172 let product_sku = req.query.product_sku; 179 let product_sku = req.query.product_sku;
  180 + let buy_number = req.query.buy_number;
173 181
174 co(function * () { 182 co(function * () {
175 let address = yield addressModel.addressData(uid); 183 let address = yield addressModel.addressData(uid);
176 - let moreUrl = helpers.urlFormat('/cart/index/buynow/orderEnsure', {product_sku: product_sku}); 184 + let moreUrl = helpers.urlFormat('/cart/index/buynow/orderensure', {
  185 + product_sku: product_sku,
  186 + buy_number: buy_number
  187 + });
177 188
178 address = address.data; 189 address = address.data;
179 190
@@ -203,6 +214,7 @@ class BuyNowController { @@ -203,6 +214,7 @@ class BuyNowController {
203 */ 214 */
204 selectInvoice(req, res, next) { 215 selectInvoice(req, res, next) {
205 let product_sku = req.query.product_sku; 216 let product_sku = req.query.product_sku;
  217 + let buy_number = req.query.buy_number;
206 let uid = req.user.uid; 218 let uid = req.user.uid;
207 let orderInfo; 219 let orderInfo;
208 220
@@ -228,7 +240,10 @@ class BuyNowController { @@ -228,7 +240,10 @@ class BuyNowController {
228 module: 'buynow', 240 module: 'buynow',
229 page: 'select-invoice', 241 page: 'select-invoice',
230 localCss: true, 242 localCss: true,
231 - addressMore: helpers.urlFormat('/cart/index/buynow/orderEnsure', {product_sku: product_sku}) 243 + addressMore: helpers.urlFormat('/cart/index/buynow/orderensure', {
  244 + product_sku: product_sku,
  245 + buy_number: buy_number
  246 + })
232 })); 247 }));
233 })().catch(next); 248 })().catch(next);
234 } 249 }
@@ -127,6 +127,7 @@ exports.orderEnsure = (req, res, next) => { @@ -127,6 +127,7 @@ exports.orderEnsure = (req, res, next) => {
127 module: 'cart', 127 module: 'cart',
128 page: 'order-ensure', 128 page: 'order-ensure',
129 width750: true, 129 width750: true,
  130 + localCss: true,
130 title: '确认订单' 131 title: '确认订单'
131 }; 132 };
132 133
@@ -59,6 +59,8 @@ exports.ensure = (req, res, next) => { @@ -59,6 +59,8 @@ exports.ensure = (req, res, next) => {
59 return res.render('order-ensure', Object.assign({ 59 return res.render('order-ensure', Object.assign({
60 module: 'cart', 60 module: 'cart',
61 page: 'seckill', 61 page: 'seckill',
  62 + width750: true,
  63 + localCss: true,
62 pageHeader: headerModel.setNav({ 64 pageHeader: headerModel.setNav({
63 navTitle: '确认订单', 65 navTitle: '确认订单',
64 backUrl: '/product/' + skn + '.html' // 商品url改版 66 backUrl: '/product/' + skn + '.html' // 商品url改版
@@ -108,6 +110,8 @@ exports.ensure = (req, res, next) => { @@ -108,6 +110,8 @@ exports.ensure = (req, res, next) => {
108 navTitle: '确认订单', 110 navTitle: '确认订单',
109 backUrl: '/product/' + skn + '.html' // 商品url改版 111 backUrl: '/product/' + skn + '.html' // 商品url改版
110 }), 112 }),
  113 + width750: true,
  114 + localCss: true,
111 cartToken: crypto.encryption(SLAT, [sku, activityId].join('')) 115 cartToken: crypto.encryption(SLAT, [sku, activityId].join(''))
112 }, view)); 116 }, view));
113 })().catch(next); 117 })().catch(next);
@@ -16,7 +16,7 @@ const countController = require(`${cRoot}/count`); @@ -16,7 +16,7 @@ const countController = require(`${cRoot}/count`);
16 const payController = require(`${cRoot}/pay`); 16 const payController = require(`${cRoot}/pay`);
17 const indexController = require(`${cRoot}/index`); 17 const indexController = require(`${cRoot}/index`);
18 const ticketsConfirmController = require(`${cRoot}/ticketsConfirm`); 18 const ticketsConfirmController = require(`${cRoot}/ticketsConfirm`);
19 -const BuyNowController = require(`${cRoot}/BuyNowController`); 19 +const BuyNowController = require(`${cRoot}/buy-now-controller`);
20 20
21 // Your controller here 21 // Your controller here
22 router.all('/index/seckill/', authMW); 22 router.all('/index/seckill/', authMW);
@@ -6,15 +6,15 @@ @@ -6,15 +6,15 @@
6 <div class="info"> 6 <div class="info">
7 <span class="info-name">{{name}}</span> 7 <span class="info-name">{{name}}</span>
8 <span class="info-phone">{{phoneNum}}</span> 8 <span class="info-phone">{{phoneNum}}</span>
9 - <a href="/cart/index/buynow/selectAddress?product_sku={{@root.product_sku}}"><span class="info-address">{{addressInfo}}</span></a> 9 + <a href="{{selectAddressUrl}}"><span class="info-address">{{addressInfo}}</span></a>
10 <i class="iconfont">&#xe637;</i> 10 <i class="iconfont">&#xe637;</i>
11 </div> 11 </div>
12 - <a class="rest" href="/cart/index/buynow/selectAddress?product_sku={{@root.product_sku}}">其他地址<span class="iconfont">&#xe614;</span></a> 12 + <a class="rest" href="{{selectAddressUrl}}">其他地址<span class="iconfont">&#xe614;</span></a>
13 </div> 13 </div>
14 {{else}} 14 {{else}}
15 <div class="address block address-wrap not-address"> 15 <div class="address block address-wrap not-address">
16 <i class="iconfont">&#xe637;</i> 16 <i class="iconfont">&#xe637;</i>
17 - <a class="choose" href="/cart/index/buynow/selectAddress?product_sku={{@root.product_sku}}">请选择收货地址<span class="iconfont">&#xe614;</span></a> 17 + <a class="choose" href="{{selectAddressUrl}}">请选择收货地址<span class="iconfont">&#xe614;</span></a>
18 </div> 18 </div>
19 {{/if}} 19 {{/if}}
20 <section class="dispatch block"> 20 <section class="dispatch block">
@@ -108,10 +108,6 @@ @@ -108,10 +108,6 @@
108 <span>发票抬头</span> 108 <span>发票抬头</span>
109 <span class="invoice-fr invoice-title">{{title}}</span> 109 <span class="invoice-fr invoice-title">{{title}}</span>
110 </li> 110 </li>
111 - <li>  
112 - <span>发票内容</span>  
113 - <span class="invoice-fr">{{contentValue}}</span>  
114 - </li>  
115 {{#if pdfUrl}} 111 {{#if pdfUrl}}
116 <li> 112 <li>
117 <a href="{{pdfUrl}}"><span class="invoice-fr invoice-see">点击下载PDF发票</span></a> 113 <a href="{{pdfUrl}}"><span class="invoice-fr invoice-see">点击下载PDF发票</span></a>
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2017-06-21 10:30:21 3 * @Date: 2017-06-21 10:30:21
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2017-06-23 17:12:13 5 + * @Last Modified time: 2017-06-23 18:04:49
6 */ 6 */
7 require('buynow/order-ensure.page.css'); 7 require('buynow/order-ensure.page.css');
8 const $ = require('yoho-jquery'); 8 const $ = require('yoho-jquery');
@@ -341,7 +341,7 @@ if (!orderInfo('address_id')) { @@ -341,7 +341,7 @@ if (!orderInfo('address_id')) {
341 } 341 }
342 342
343 $('.delivery-id').on('touchend', 'li', function() { 343 $('.delivery-id').on('touchend', 'li', function() {
344 - orderInfo('deliveryId', $(this).data('id')); 344 + orderInfo('delivery_way', $(this).data('id'));
345 345
346 // 实付金额发生变化,使用有货币为0 346 // 实付金额发生变化,使用有货币为0
347 orderInfo('use_yoho_coin', 0); 347 orderInfo('use_yoho_coin', 0);
@@ -491,7 +491,7 @@ function phoneHidden(phone) { @@ -491,7 +491,7 @@ function phoneHidden(phone) {
491 $('.info-phone').html(phoneHidden($('.info-phone').html())); 491 $('.info-phone').html(phoneHidden($('.info-phone').html()));
492 492
493 if (orderInfo('address') && orderInfo('address').is_support === 'N') { 493 if (orderInfo('address') && orderInfo('address').is_support === 'N') {
494 - orderInfo('deliveryId', $('.delivery-id .icon-cb-radio').data('id')); 494 + orderInfo('delivery_way', $('.delivery-id .icon-cb-radio').data('id'));
495 orderCompute(); 495 orderCompute();
496 } 496 }
497 497
1 -'use strict';  
2 -  
3 require('./seckill/order-ensure'); 1 require('./seckill/order-ensure');
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 * @author: xuqi<qi.xu@yoho.cn> 4 * @author: xuqi<qi.xu@yoho.cn>
5 * @date: 2015/11/12 5 * @date: 2015/11/12
6 */ 6 */
7 - 7 +require('cart/order-ensure.page.css');
8 require('common.js'); 8 require('common.js');
9 9
10 let lazyLoad = require('yoho-jquery-lazyload'), 10 let lazyLoad = require('yoho-jquery-lazyload'),
@@ -52,7 +52,9 @@ $selectBtn.on('touchend', function() { @@ -52,7 +52,9 @@ $selectBtn.on('touchend', function() {
52 chosePanel.show({ 52 chosePanel.show({
53 data, 53 data,
54 disableNum: true, 54 disableNum: true,
55 - buttonText: '确认' 55 + buttonText: {
  56 + text: '确认'
  57 + }
56 }).then(result => { 58 }).then(result => {
57 if (result && result.sku) { 59 if (result && result.sku) {
58 let product = $('#gskn-' + self.data('skn')); 60 let product = $('#gskn-' + self.data('skn'));
@@ -109,6 +111,7 @@ $('.bundle-tabs').on('click', '.swiper-slide', (e) => { @@ -109,6 +111,7 @@ $('.bundle-tabs').on('click', '.swiper-slide', (e) => {
109 111
110 /** 112 /**
111 * 立即购买 113 * 立即购买
  114 + * 大概 4 月份改成了加入购物车
112 */ 115 */
113 $buyNowBtn.on('touchstart', function() { 116 $buyNowBtn.on('touchstart', function() {
114 let bundleGoods = [], 117 let bundleGoods = [],
@@ -74,6 +74,8 @@ @@ -74,6 +74,8 @@
74 height: 80px; 74 height: 80px;
75 font-size: 28px; 75 font-size: 28px;
76 width: 440px; 76 width: 440px;
  77 + background-color: #fff;
  78 + border: none;
77 } 79 }
78 80
79 .tel-area { 81 .tel-area {