Authored by 郝肖肖

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

... ... @@ -51,7 +51,7 @@ exports.orderEnsure = (req, res, next) => {
headerData.backUrl = returnUrl;
}
let orderPromise = cartModel.cartPay(uid, cartType, orderInfo, sku, skn, buyNumber);
let orderPromise;
let userProfilePromise = userModel.queryProfile(uid);
let addressPromise = addressModel.addressData(uid);
... ... @@ -59,6 +59,8 @@ exports.orderEnsure = (req, res, next) => {
let activityInfo = JSON.parse(req.cookies['activity-info']);
orderPromise = cartModel.cartPay(uid, cartType, orderInfo, sku, skn, buyNumber, activityInfo);
} else {
orderPromise = cartModel.cartPay(uid, cartType, orderInfo, sku, skn, buyNumber);
}
return Promise.all([orderPromise, userProfilePromise, addressPromise]).then(result => {
... ...
... ... @@ -70,9 +70,27 @@ const cancelOrder = (req, res, next) => {
}).catch(next);
};
/**
* 我的订单-查看物流信息
*/
const logistic = (req, res, next) => {
orderDetailModel.logistics(req.query.order_code, req.user.uid).then(result => {
res.render('logistic', _.assign(result, {
pageHeader: headerModel.setNav({
navTitle: '订单详情',
navBtn: false
}),
module: 'home',
page: 'logistic',
logisticInfoPage: true
}));
}).catch(next);
};
module.exports = {
orderDetailData,
delOrder,
readdData,
cancelOrder
cancelOrder,
logistic
};
... ...
... ... @@ -2,6 +2,7 @@
const api = global.yoho.API;
const serviceApi = global.yoho.ServiceAPI;
const _ = require('lodash');
... ... @@ -10,6 +11,8 @@ const helpers = global.yoho.helpers;
const camelCase = global.yoho.camelCase;
const logger = global.yoho.logger;
const CODE_LOGISTIC_BANNER = '1fc9b2484fcd559049f2f7e0db313f20'; // 物流详情banner资源码
const closeReasons = () => {
return api.get('', {
method: 'app.SpaceOrders.closeReasons'
... ... @@ -370,10 +373,84 @@ const cancelOrder = (orderCode, uid, reasonId, gender, channel, reason) => {
});
};
/*
* 我的订单-查看物流
* @param int $orderCode 订单号
* @param int $uid 用户ID
* @return array
*/
const _logisticsData = (orderCode, uid) => {
return api.get('', {
method: 'app.express.li',
order_code: orderCode,
uid: uid
});
};
/**
* 获取物流详情页banner
*/
const _getLogisterBanner = () => {
return serviceApi.get('operations/api/v5/resource/get', {
content_code: CODE_LOGISTIC_BANNER
}, {code: 200});
};
/**
* 查看物流
*
* @param int orderCode 订单编号
* @param int uid 用户ID
* @return array
*/
const logistics = (orderCode, uid) => {
return Promise.all([
_getLogisterBanner(),
_logisticsData(orderCode, uid),
]).then(result => {
let finalResult = {
banner: []
};
let banners = result[0];
let logistic = result[1];
// 获取物流详情页banner
if (banners && banners.data) {
_.forEach(banners.data, value => {
_.forEach(value.data, subValue => {
finalResult.banner.push({
url: subValue.url,
img: subValue.src
});
});
});
}
if (logistic && logistic.data) {
finalResult.logisticUrl = _.get(logistic, 'data.url', '');
finalResult.logisticImg = _.get(logistic, 'data.logo', '');
finalResult.logisticCompany = _.get(logistic, 'data.caption', '');
finalResult.logisticNumber = _.get(logistic, 'data.express_number', '');
finalResult.logisticDetail = [];
_.forEach(_.get(logistic, 'data.express_detail', []), value => {
finalResult.logisticDetail.push({
status: value.accept_address,
date: value.acceptTime,
});
});
}
return finalResult;
});
};
module.exports = {
orderDetailData,
closeReasons,
delOrder,
readdData,
cancelOrder
cancelOrder,
logistics
};
... ...
... ... @@ -134,4 +134,6 @@ router.get('/installment/setMasterCard', installment.setMasterCard); // 銝
router.get('/getaddress.json', addressController.newGetAddress); // TODO 模拟省数据
router.get('/logistic', auth, orderDetailController.logistic); // 查看物流页面
module.exports = router;
... ...
<div class="logistic-page yoho-page">
<div class="overview">
<div class="left" >
<a href="{{logisticUrl}}"><img class="icon" src="{{logisticImg}}" /></a>
</div>
<div class="right">
<div>
<span class='info'>物流公司:</span>
<span >{{logisticCompany}}</span>
</div>
<div>
<span class='info'>快递单号:</span>
<span>{{logisticNumber}}</span>
</div>
</div>
</div>
<div class="title">
<span>物流详情</span>
</div>
<div class="detail">
{{# logisticDetail}}
<div class="timeline-box ">
<span class="timeline-node"></span>
<div class="timeline-info">
<div class="timeline-info-row">
{{status}}
</div>
<div class="timeline-info-row">
{{date}}
</div>
</div>
</div>
{{/ logisticDetail}}
</div>
<div class="banner">
{{#banner}}
<a href="{{url}}">
<img src="{{image2 img w=640 h=200}}" alt="img">
</a>
{{/banner}}
</div>
{{#unless @root.wap.ucenter.removePrefer}}
{{> common/recommend-for-you}}
{{/unless}}
</div>
... ...
... ... @@ -6,6 +6,7 @@ const _ = require('lodash');
const detailModel = require('../models/detail');
const newDetailModel = require('../models/new-detail');
const listModel = require('../models/list');
const headerModel = require('../../../doraemon/models/header'); // 头部model
const newDetail = {
... ... @@ -115,6 +116,37 @@ const newDetail = {
result.studentPrice = req.__User__.isStudent && result && result.goodsPrice && result.goodsPrice.studentPrice ? result.goodsPrice.studentPrice : false;
return res.json(result);
}).catch(next);
},
/**
* 商品收藏/取消收藏
*/
favoriteProduct(req, res, next) {
let allowOrigin = _.get(req, 'headers.origin', null) ?
req.headers.origin : req.protocol + '://' + req.headers.host;
res.setHeader('Access-Control-Allow-Origin', allowOrigin);
res.setHeader('Access-Control-Allow-Credentials', 'true');
if (req.body.opt === 'ok') {
listModel.setFavorite(req.body.id, req.user.uid, 'product').then(result => {
return res.json(result);
}).catch(next);
} else {
listModel.setFavoriteCancel(req.body.id, req.user.uid, 'product').then(result => {
return res.json(result);
}).catch(next);
}
},
/**
* 限购商品说明页面
*/
limitHelp(req, res) {
res.render('detail/limit-help', {
module: 'product',
page: 'limit-help'
});
}
};
... ...
... ... @@ -176,4 +176,7 @@ router.get('/newsale/selectHotrank', newsale.selectHotrank); // 热销排行榜
router.get('/bundle/detail', bundle.detail); // 套装详情页
router.post('/opt/favoriteProduct', newDetail.favoriteProduct); // 商品收藏、取消收藏
router.get('/detail/limitHelp', newDetail.limitHelp);
module.exports = router;
... ...
<div class="limit-help-page yoho-page">
<h2>不同限定商品获取限购码方式不同,获取限购码目前有两种方式:</h2>
<span class="method">方式一</span>
<ul class="method-1">
<li>1.在限定发售详情页点击分享或者底部“获取限购码”图标。
<div class="intro-img"></div>
</li>
<li>2.从弹出的分享中选取需要分享的渠道。
<div class="intro-img"></div>
</li>
<li>3.分享成功后返回Yoho!Buy有货APP会提示已获得限购码。
<div class="intro-img"></div>
</li>
</ul>
<span class="method">方式二</span>
<ul class="method-2">
<li>1.在限定发售详情页点击参加排队赢取限购码图标。
<div class="intro-img"></div>
</li>
<li>2.进入限定发售排队页面,点击参加排队。
<div class="intro-img"></div>
</li>
<li>3.排队成功后凭排队序列号作为抽奖凭证,等待开奖时间。
<div class="intro-img"></div>
</li>
<li>4.开奖后,排队页面会公布中奖名单,限购码会直接发送至账户。
<div class="intro-img"></div>
</li>
</ul>
<h2>查看和使用限购码</h2>
<ul class="how">
<li>1.从个人中心进入我的限购码页面,可查看所获取的限购码。
<div class="intro-img"></div>
</li>
<li>2.商品开售后,可凭此限购码购买对应商品。
<div class="intro-img"></div>
</li>
</ul>
</div>
\ No newline at end of file
... ...
... ... @@ -5,7 +5,6 @@
*/
var $ = require('yoho-jquery'),
Hammer = require('yoho-hammer'),
ellipsis = require('yoho-mlellipsis'),
loading = require('../plugin/loading'),
tip = require('../plugin/tip'),
... ... @@ -83,9 +82,10 @@ $couponList.on('touchstart', '.employ-main', function() {
$('body').on('touchend', '.not-use', function() {
orderInfo('couponCode', null);
orderInfo('couponName', null);
//实付金额发生变化,使用有货币为0
// 实付金额发生变化,使用有货币为0
orderInfo('yohoCoin', 0);
location.href = '/cart/index/orderEnsure';
location.href = '/cart/index/new/orderEnsure';
});
... ... @@ -124,12 +124,8 @@ function getCouponHandle(allCoupons) {
// 渲染可用的优惠券
$couponList.append(conponTmpl({
coupons: coupons
})).find('.employ-main').each(function(i, elem) {
var employHammer = new Hammer(elem);
employHammer.on('tap', function(e) {
var $this = $(e.srcEvent.currentTarget);
var couponCode = $this.data('coupon-code');
})).find('.employ-main').on('touchstart', function() {
var couponCode = $(this).data('coupon-code');
$.ajax({
method: 'POST',
... ... @@ -140,12 +136,13 @@ function getCouponHandle(allCoupons) {
}).then(function(res) {
if (res.code === 200) {
//tip.show('优惠券可用');
// tip.show('优惠券可用');
orderInfo('couponCode', res.data.coupon_code);
orderInfo('couponName', res.data.coupon_title);
//实付金额发生变化,使用有货币为0
// 实付金额发生变化,使用有货币为0
orderInfo('yohoCoin', 0);
window.location.href = '/cart/index/orderEnsure';
window.location.href = '/cart/index/new/orderEnsure';
} else if (res.message) {
tip.show(res.message);
}
... ... @@ -153,7 +150,6 @@ function getCouponHandle(allCoupons) {
tip.show('网络错误');
});
});
});
if (notAvailableCoupons.length) {
$('.not-avaliable-coupon-line').show();
... ...
/**
* 物流信息页面
* @author: 赵彪<bill.zhao@yoho.cn>
* @date: 2015/12/02
*/
var $ = require('yoho-jquery');
var $footer = $('#yoho-footer'),
winH = window.outerHeight,
bodyH = document.body.offsetHeight,
footH = $footer.height();
require('../common');
function addFooterTopBorder() {
if (footH + bodyH > winH) {
window.rePosFooter();
} else {
$footer.css('border-top', '1px solid #f1f1f1');
}
}
$(document).ready(addFooterTopBorder);
require('./recommend-for-you-user-center');
// 提前触发lazyload
$(window).scrollTop(1).scrollTop(0);
... ...
require('../common');
... ...
... ... @@ -65,7 +65,7 @@
}
.kind-list {
padding-top: 15px;
padding-top: 40px;
li {
font-size: 22px;
... ...
... ... @@ -87,7 +87,7 @@
height: auto;
overflow: hidden;
padding-left: 10%;
padding-bottom: 12px;
padding-bottom: 32px;
position: relative;
span {
... ...
... ... @@ -7,3 +7,4 @@
@import "new/new-arrival";
@import "newsale/hot-rank";
@import "bundle/index";
@import "detail/limit-help";
... ...
.limit-help-page {
padding: 28px;
color: #444;
h2 {
font-size: 30px;
font-weight: bold;
}
.method {
display: block;
width: 80px;
height: 35px;
line-height: 35px;
background-color: #444;
color: #fff;
border-radius: 20px;
text-align: center;
margin: 20px 0;
}
li {
font-size: 24px;
}
.intro-img {
width: 100%;
height: 220px;
background-size: 100%;
background-repeat: no-repeat;
margin: 20px 0;
}
.method-1 {
li:nth-child(1) .intro-img{
background-image: resolve(product/help/1.png);
}
li:nth-child(2) .intro-img{
background-image: resolve(product/help/2.png);
}
li:nth-child(3) .intro-img{
background-image: resolve(product/help/3.png);
}
}
.method-2 {
li:nth-child(1) .intro-img{
background-image: resolve(product/help/4.png);
}
li:nth-child(2) .intro-img{
background-image: resolve(product/help/5.png);
}
li:nth-child(3) .intro-img{
background-image: resolve(product/help/6.png);
}
li:nth-child(4) .intro-img{
background-image: resolve(product/help/7.png);
}
}
.how {
li:nth-child(1) .intro-img{
background-image: resolve(product/help/8.png);
}
li:nth-child(2) .intro-img{
background-image: resolve(product/help/9.png);
margin-bottom: 0;
}
}
}
... ...
... ... @@ -308,22 +308,14 @@ const procCartData = (data, onlyGift, onlyAdvanceBuy, isAdvanceCart) => {
result.freebieOrAdvanceBuy = true;
// 赠品
result.freebie = data.g_gift_list.filter(freebie => {
return freebie.status !== 30 && freebie.status !== 0;
});
result.freebie = data.g_gift_list.filter(freebie => freebie.status !== 30 && freebie.status !== 0);
result.giftCount = result.freebie.length;
result.giftHasStorage = _.some(result.freebie, freebie => {
return freebie.status === 10;
});
result.giftHasStorage = _.some(result.freebie, freebie => freebie.status === 10);
// 加价购
result.advanceBuy = data.g_price_gift_list.filter(advanceBuy => {
return advanceBuy.status !== 30 && advanceBuy.status !== 0;
});
result.advanceBuy = data.g_price_gift_list.filter(advanceBuy => advanceBuy.status !== 30 && advanceBuy.status !== 0);
result.advanceBuyCount = result.advanceBuy.length;
result.advanceHasStorage = _.some(result.advanceBuy, advanceBuy => {
return advanceBuy.status === 10;
});
result.advanceHasStorage = _.some(result.advanceBuy, advanceBuy => advanceBuy.status === 10);
}
// 已参加的活动
... ...