Authored by 毕凯

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

... ... @@ -2,12 +2,12 @@
* @Author: Targaryen
* @Date: 2017-06-21 10:15:38
* @Last Modified by: Targaryen
* @Last Modified time: 2017-06-23 17:53:27
* @Last Modified time: 2017-06-26 16:21:29
*/
const _ = require('lodash');
const co = require('bluebird').coroutine;
const headerModel = require('../../../doraemon/models/header');
const BuyNowModel = require('../models/BuyNowModel');
const BuyNowModel = require('../models/buy-now-model');
const addressModel = require('../models/address');
const userModel = require('../models/user');
const orderModel = require('../models/order');
... ... @@ -41,8 +41,9 @@ class BuyNowController {
}
let product_sku = req.query.product_sku;
let buy_number = req.query.buy_number;
if (!product_sku) {
if (!product_sku || !buy_number) {
return next();
}
... ... @@ -51,20 +52,20 @@ class BuyNowController {
uid: req.user.uid,
product_sku: product_sku,
sku_type: req.query.sku_type,
buy_number: req.query.buy_number,
buy_number: buy_number,
});
let computeData = yield req.ctx(BuyNowModel).compute({
uid: req.user.uid,
product_sku: product_sku,
sku_type: req.query.sku_type,
buy_number: req.query.buy_number,
buy_number: buy_number,
use_yoho_coin: parseInt(orderInfo.use_yoho_coin, 10)
});
let validCouponCount = yield req.ctx(BuyNowModel).countUsableCoupon({
uid: req.user.uid,
product_sku: req.query.product_sku,
sku_type: req.query.sku_type,
buy_number: req.query.buy_number
buy_number: buy_number
});
let headerData = headerModel.setNav({
navTitle: '确认订单',
... ... @@ -77,11 +78,17 @@ class BuyNowController {
page: 'order-ensure',
title: '确认订单',
width750: true,
localCss: true,
product_sku: product_sku,
orderEnsure: _.assign(
paymentProcess.tranformPayment(result.data, orderInfo, null, null, computeData.data),
{
coupon: paymentProcess.coupon(_.get(validCouponCount, 'data.count', 0), orderInfo, computeData)
coupon: paymentProcess.coupon(_.get(validCouponCount, 'data.count', 0), orderInfo, computeData),
selectAddressUrl: helpers.urlFormat('/cart/index/buynow/selectAddress', {
product_sku: product_sku,
buy_number: buy_number
}),
isOrdinaryCart: true
}
)
});
... ... @@ -170,10 +177,14 @@ class BuyNowController {
selectAddress(req, res, next) {
let uid = req.user.uid;
let product_sku = req.query.product_sku;
let buy_number = req.query.buy_number;
co(function * () {
let address = yield addressModel.addressData(uid);
let moreUrl = helpers.urlFormat('/cart/index/buynow/orderEnsure', {product_sku: product_sku});
let moreUrl = helpers.urlFormat('/cart/index/buynow/orderensure', {
product_sku: product_sku,
buy_number: buy_number
});
address = address.data;
... ... @@ -203,6 +214,7 @@ class BuyNowController {
*/
selectInvoice(req, res, next) {
let product_sku = req.query.product_sku;
let buy_number = req.query.buy_number;
let uid = req.user.uid;
let orderInfo;
... ... @@ -228,7 +240,10 @@ class BuyNowController {
module: 'buynow',
page: 'select-invoice',
localCss: true,
addressMore: helpers.urlFormat('/cart/index/buynow/orderEnsure', {product_sku: product_sku})
addressMore: helpers.urlFormat('/cart/index/buynow/orderensure', {
product_sku: product_sku,
buy_number: buy_number
})
}));
})().catch(next);
}
... ...
... ... @@ -127,6 +127,7 @@ exports.orderEnsure = (req, res, next) => {
module: 'cart',
page: 'order-ensure',
width750: true,
localCss: true,
title: '确认订单'
};
... ...
... ... @@ -59,6 +59,8 @@ exports.ensure = (req, res, next) => {
return res.render('order-ensure', Object.assign({
module: 'cart',
page: 'seckill',
width750: true,
localCss: true,
pageHeader: headerModel.setNav({
navTitle: '确认订单',
backUrl: '/product/' + skn + '.html' // 商品url改版
... ... @@ -108,6 +110,8 @@ exports.ensure = (req, res, next) => {
navTitle: '确认订单',
backUrl: '/product/' + skn + '.html' // 商品url改版
}),
width750: true,
localCss: true,
cartToken: crypto.encryption(SLAT, [sku, activityId].join(''))
}, view));
})().catch(next);
... ...
... ... @@ -16,7 +16,7 @@ const countController = require(`${cRoot}/count`);
const payController = require(`${cRoot}/pay`);
const indexController = require(`${cRoot}/index`);
const ticketsConfirmController = require(`${cRoot}/ticketsConfirm`);
const BuyNowController = require(`${cRoot}/BuyNowController`);
const BuyNowController = require(`${cRoot}/buy-now-controller`);
// Your controller here
router.all('/index/seckill/', authMW);
... ...
... ... @@ -6,15 +6,15 @@
<div class="info">
<span class="info-name">{{name}}</span>
<span class="info-phone">{{phoneNum}}</span>
<a href="/cart/index/buynow/selectAddress?product_sku={{@root.product_sku}}"><span class="info-address">{{addressInfo}}</span></a>
<a href="{{selectAddressUrl}}"><span class="info-address">{{addressInfo}}</span></a>
<i class="iconfont">&#xe637;</i>
</div>
<a class="rest" href="/cart/index/buynow/selectAddress?product_sku={{@root.product_sku}}">其他地址<span class="iconfont">&#xe614;</span></a>
<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="/cart/index/buynow/selectAddress?product_sku={{@root.product_sku}}">请选择收货地址<span class="iconfont">&#xe614;</span></a>
<a class="choose" href="{{selectAddressUrl}}">请选择收货地址<span class="iconfont">&#xe614;</span></a>
</div>
{{/if}}
<section class="dispatch block">
... ...
... ... @@ -108,10 +108,6 @@
<span>发票抬头</span>
<span class="invoice-fr invoice-title">{{title}}</span>
</li>
<li>
<span>发票内容</span>
<span class="invoice-fr">{{contentValue}}</span>
</li>
{{#if pdfUrl}}
<li>
<a href="{{pdfUrl}}"><span class="invoice-fr invoice-see">点击下载PDF发票</span></a>
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-06-21 10:30:21
* @Last Modified by: Targaryen
* @Last Modified time: 2017-06-23 17:12:13
* @Last Modified time: 2017-06-23 18:04:49
*/
require('buynow/order-ensure.page.css');
const $ = require('yoho-jquery');
... ... @@ -341,7 +341,7 @@ if (!orderInfo('address_id')) {
}
$('.delivery-id').on('touchend', 'li', function() {
orderInfo('deliveryId', $(this).data('id'));
orderInfo('delivery_way', $(this).data('id'));
// 实付金额发生变化,使用有货币为0
orderInfo('use_yoho_coin', 0);
... ... @@ -491,7 +491,7 @@ function phoneHidden(phone) {
$('.info-phone').html(phoneHidden($('.info-phone').html()));
if (orderInfo('address') && orderInfo('address').is_support === 'N') {
orderInfo('deliveryId', $('.delivery-id .icon-cb-radio').data('id'));
orderInfo('delivery_way', $('.delivery-id .icon-cb-radio').data('id'));
orderCompute();
}
... ...
'use strict';
require('./seckill/order-ensure');
... ...
... ... @@ -4,7 +4,7 @@
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/11/12
*/
require('cart/order-ensure.page.css');
require('common.js');
let lazyLoad = require('yoho-jquery-lazyload'),
... ...
... ... @@ -52,7 +52,9 @@ $selectBtn.on('touchend', function() {
chosePanel.show({
data,
disableNum: true,
buttonText: '确认'
buttonText: {
text: '确认'
}
}).then(result => {
if (result && result.sku) {
let product = $('#gskn-' + self.data('skn'));
... ... @@ -109,6 +111,7 @@ $('.bundle-tabs').on('click', '.swiper-slide', (e) => {
/**
* 立即购买
* 大概 4 月份改成了加入购物车
*/
$buyNowBtn.on('touchstart', function() {
let bundleGoods = [],
... ...
... ... @@ -74,6 +74,8 @@
height: 80px;
font-size: 28px;
width: 440px;
background-color: #fff;
border: none;
}
.tel-area {
... ...