Authored by 郭成尧

Merge branch 'release/6.1' into feature/web-apm

... ... @@ -11,6 +11,7 @@ exports.photography = (req, res, next) => {
pageHeader: headerModel.setNav({
navTitle: '个人中心'
}),
title: '个人中心',
width750: true,
localCss: true,
};
... ... @@ -32,6 +33,7 @@ exports.coffee = (req, res, next) => {
pageHeader: headerModel.setNav({
navTitle: '个人中心'
}),
title: '个人中心',
width750: true,
localCss: true,
};
... ... @@ -53,6 +55,7 @@ exports.green = (req, res, next) => {
pageHeader: headerModel.setNav({
navTitle: '个人中心'
}),
title: '个人中心',
width750: true,
localCss: true,
};
... ... @@ -74,6 +77,7 @@ exports.history = (req, res, next) => {
pageHeader: headerModel.setNav({
navTitle: '消费明细'
}),
title: '消费明细',
width750: true,
localCss: true,
};
... ... @@ -107,6 +111,7 @@ exports.ewm = (req, res) => {
pageHeader: headerModel.setNav({
navTitle: '我的二维码'
}),
title: '我的二维码',
width750: true,
localCss: true,
};
... ... @@ -121,6 +126,7 @@ exports.coupon = (req, res, next) => {
pageHeader: headerModel.setNav({
navTitle: '我的优惠卷'
}),
title: '我的优惠卷',
width750: true,
localCss: true,
};
... ...
... ... @@ -71,7 +71,7 @@ module.exports = {
f.component[0].type === 'productGroup' && f.component[0].favourite_prds_enable === '1') {
f.component[0].searchCondition = Object.assign({
maybeLike: '1',
limit: '12'
limit: '60'
}, f.component[0].searchCondition || {});
}
... ...
... ... @@ -6,8 +6,6 @@
*/
'use strict';
const _ = require('lodash');
const PayModel = require('../models/pay');
const Alipay = require('./pay/alipay');
const Wechat = require('./pay/wechat');
... ... @@ -21,7 +19,6 @@ const payProcess = require(`${utils}/pay-process`);
class Payment extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
this.ctx = _.get(ctx, 'req.ctx');
}
/**
... ... @@ -59,7 +56,7 @@ class Payment extends global.yoho.BaseModel {
if (method === payProcess.PAYMENTS.WECHAT) {
result = yield Wechat.pay(user, order, reqParams.openId, reqParams.ip);
} else {
payInfo = yield self.ctx(PayModel).getPaymentInfo(method);
payInfo = yield self.ctx.req.ctx(PayModel).getPaymentInfo(method);
if (!payInfo.payParams) {
return result;
... ... @@ -90,8 +87,8 @@ class Payment extends global.yoho.BaseModel {
beforePay(user, order, method, bankCode) {
return Promise.all([
this.ctx(PayModel).updateOrderPayment(order.order_code, method, user.uid),
this.ctx(PayModel).getBankByOrder(order.order_code)
this.ctx.req.ctx(PayModel).updateOrderPayment(order.order_code, method, user.uid),
this.ctx.req.ctx(PayModel).getBankByOrder(order.order_code)
]).then(result => {
let paymentRecord = result[0];
let bankRecord = result[1];
... ... @@ -103,9 +100,9 @@ class Payment extends global.yoho.BaseModel {
}
if (bankRecord && bankRecord.bankCode) {
return this.ctx(PayModel).updateOrderPayBank(order.order_code, method, bankCode);
return this.ctx.req.ctx(PayModel).updateOrderPayBank(order.order_code, method, bankCode);
} else {
return this.ctx(PayModel).setOrderPayBank(order.order_code, method, bankCode);
return this.ctx.req.ctx(PayModel).setOrderPayBank(order.order_code, method, bankCode);
}
}).catch(e => {
... ... @@ -122,7 +119,7 @@ class Payment extends global.yoho.BaseModel {
let self = this;
return co(function*() {
let payInfo = yield self.ctx(PayModel).getPaymentInfo(payId);
let payInfo = yield self.ctx.req.ctx(PayModel).getPaymentInfo(payId);
let payResult = {};
let payData = {};
let payName = '';
... ... @@ -145,10 +142,10 @@ class Payment extends global.yoho.BaseModel {
if (payResult && payResult.payResult === 200) {
if (payResult.orderCode) {
logger.info('pay back confirm');
yield self.ctx(PayModel).sendPayConfirm(payResult.orderCode, payId, user.uid);
yield self.ctx.req.ctx(PayModel).sendPayConfirm(payResult.orderCode, payId, user.uid);
}
payData = yield self.ctx(PayModel).procOrderData(payResult, user.uid, sessionKey);
payData = yield self.ctx.req.ctx(PayModel).procOrderData(payResult, user.uid, sessionKey);
} else {
payData = {
code: 500,
... ...
... ... @@ -7,9 +7,9 @@ const shoppingModel = require('./shopping');
const logger = global.yoho.logger;
const payModel = require('../models/pay');
class cartModel {
class cartModel extends global.yoho.BaseModel {
constructor(ctx) {
this.ctx = _.get(ctx, 'req.ctx');
super(ctx);
}
/**
... ... @@ -36,7 +36,7 @@ class cartModel {
// cookie保存的数据
if (params.orderInfo && !_.isEmpty(params.orderInfo)) {
params.orderInfo.paymentType = params.orderInfo.paymentType ? params.orderInfo.paymentType : '';
orderComputeAPI = this.ctx(shoppingModel).orderComputeAPI({
orderComputeAPI = this.ctx.req.ctx(shoppingModel).orderComputeAPI({
uid: params.uid,
cart_type: params.cartType,
delivery_way: params.orderInfo.deliveryId,
... ... @@ -64,18 +64,18 @@ class cartModel {
};
if (params.activityInfo) {
cartPayAPI = this.ctx(shoppingModel).cartPayAPI(_.assign(cartPayAPIParams, {
cartPayAPI = this.ctx.req.ctx(shoppingModel).cartPayAPI(_.assign(cartPayAPIParams, {
activityInfo: params.activityInfo
}));
} else {
cartPayAPI = this.ctx(shoppingModel).cartPayAPI(cartPayAPIParams);
cartPayAPI = this.ctx.req.ctx(shoppingModel).cartPayAPI(cartPayAPIParams);
}
return Promise.all([
cartPayAPI, // 0. 订单数据
orderComputeAPI,
this.ctx(shoppingModel).getValidCouponCount(params.uid), // 2. 有效优惠券
this.ctx(shoppingModel).countUsableGiftCard(params.uid) // 3 可用礼品卡数量
this.ctx.req.ctx(shoppingModel).getValidCouponCount(params.uid), // 2. 有效优惠券
this.ctx.req.ctx(shoppingModel).countUsableGiftCard(params.uid) // 3 可用礼品卡数量
]).then(res => {
let pay = res[0];
let orderCompute = _.get(res[1], 'data', {});
... ... @@ -117,7 +117,7 @@ class cartModel {
* 购物车结算--支付方式和配送方式选择以及是否使用有货币接口返回的数据处理
*/
orderCompute(params) {
return this.ctx(shoppingModel).orderComputeAPI(params).then(result => {
return this.ctx.req.ctx(shoppingModel).orderComputeAPI(params).then(result => {
if (result && result.data) {
result.data.use_yoho_coin = paymentProcess.transPrice(result.data.use_yoho_coin);
result.data.yohoCoinCompute = paymentProcess.yohoCoinCompute(result.data);
... ... @@ -129,7 +129,7 @@ class cartModel {
}
ticketsOrderCompute(uid, productSku, buyNumber, yohoCoin, gift_card_code) {
return this.ctx(shoppingModel).checkTickets(uid, productSku, buyNumber,
return this.ctx.req.ctx(shoppingModel).checkTickets(uid, productSku, buyNumber,
yohoCoin, null, gift_card_code).then(result => {
if (result && result.data) {
let resu = {};
... ... @@ -184,7 +184,7 @@ class cartModel {
return Promise.resolve({code: 403, message: '请选择配送方式'});
}
return this.ctx(shoppingModel).orderSub(params).then(orderSubRes => {
return this.ctx.req.ctx(shoppingModel).orderSub(params).then(orderSubRes => {
let finalResult = {};
if (orderSubRes && orderSubRes.data && orderSubRes.data.is_hint === 'Y') {
... ... @@ -243,7 +243,7 @@ class cartModel {
notAvailableCoupons: [],
};
return this.ctx(shoppingModel).listCoupon({
return this.ctx.req.ctx(shoppingModel).listCoupon({
uid: params.uid,
delivery_way: params.delivery_way,
is_group_frees: params.is_group_frees
... ... @@ -284,7 +284,7 @@ class cartModel {
});
}
return this.ctx(shoppingModel).useCoupon(uid, couponCode)
return this.ctx.req.ctx(shoppingModel).useCoupon(uid, couponCode)
.catch(() => result);
}
... ... @@ -296,7 +296,7 @@ class cartModel {
// 订单详情页拆单
if (orderCode) {
return this.ctx(payModel).getOtherDetail({
return this.ctx.req.ctx(payModel).getOtherDetail({
uid: uid,
orderCode: orderCode,
sessionKey: sessionKey
... ... @@ -309,7 +309,7 @@ class cartModel {
if (deliveryId) {
// 购物车选择改变字段,重新运算订单数据
return this.ctx(shoppingModel).orderComputeAPI({
return this.ctx.req.ctx(shoppingModel).orderComputeAPI({
uid: uid,
cart_type: cartType,
delivery_way: deliveryId,
... ... @@ -321,7 +321,7 @@ class cartModel {
return paymentProcess.transformJit(_.get(result, 'data.package_list', []));
});
} else {
return this.ctx(shoppingModel).cartPayAPI({
return this.ctx.req.ctx(shoppingModel).cartPayAPI({
uid: uid,
cart_type: cartType,
product_sku_list: skuList
... ...
... ... @@ -20,7 +20,6 @@ const stringProcess = require(`${global.utils}/string-process`);
class payModel extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
this.ctx = _.get(ctx, 'req.ctx');
}
// 资源位
... ... @@ -101,7 +100,7 @@ class payModel extends global.yoho.BaseModel {
let self = this;
return co(function* () {
let result = yield self.ctx(payApiModel).getBankByOrder(id);
let result = yield self.ctx.req.ctx(payApiModel).getBankByOrder(id);
if (result && result.code === 200 && result.data) {
return result.data;
... ... @@ -120,7 +119,7 @@ class payModel extends global.yoho.BaseModel {
let self = this;
return co(function* () {
let data = yield self.ctx(payApiModel).setOrderPayBank(code, payment, bankCode);
let data = yield self.ctx.req.ctx(payApiModel).setOrderPayBank(code, payment, bankCode);
return data;
})();
... ... @@ -134,7 +133,7 @@ class payModel extends global.yoho.BaseModel {
let self = this;
return co(function* () {
let result = yield self.ctx(payApiModel).getPaymentInfo(id);
let result = yield self.ctx.req.ctx(payApiModel).getPaymentInfo(id);
if (result && result.code === 200 && result.data) {
return result.data;
... ... @@ -153,7 +152,7 @@ class payModel extends global.yoho.BaseModel {
let self = this;
return co(function* () {
let data = yield self.ctx(payApiModel).sendPayConfirm(code, payment, uid);
let data = yield self.ctx.req.ctx(payApiModel).sendPayConfirm(code, payment, uid);
return data;
})();
... ... @@ -185,7 +184,7 @@ class payModel extends global.yoho.BaseModel {
let self = this;
return co(function* () {
let data = yield self.ctx(payApiModel).updateOrderPayBank(code, payment, bankCode);
let data = yield self.ctx.req.ctx(payApiModel).updateOrderPayBank(code, payment, bankCode);
return data;
})();
... ... @@ -221,7 +220,8 @@ class payModel extends global.yoho.BaseModel {
if (order.is_cancel === 'Y') {
logger.warn('front pay success but order is cancel.', { payResult: payResult, order: order });
self.ctx(payApiModel).sendMessage(order.mobile, 'error_sms', '支付成功,但订单已取消,订单号为' + orderCode);
self.ctx.req.ctx(payApiModel).sendMessage(order.mobile,
'error_sms', '支付成功,但订单已取消,订单号为' + orderCode);
return { code: 417, message: '支付成功,但订单已取消,需联系客服!' };
}
... ...
... ... @@ -2,6 +2,7 @@
const _ = require('lodash');
const api = global.yoho.API;
const co = Promise.coroutine;
class newQrcode extends global.yoho.BaseModel {
constructor(ctx) {
... ... @@ -44,24 +45,26 @@ class newQrcode extends global.yoho.BaseModel {
}
index(params) {
return api.all([
this.userInfo(params),
this.getCode(params),
this.getToken(params)
]).then(result => {
let resu = {};
let self = this;
if (_.get(result, '[0]data')) {
resu = result[0].data;
}
if (_.get(result, '[1]data')) {
resu.trendWord = result[1].data.trendWord || result[1].data.inviteCode;
}
if (_.get(result, '[2]')) {
resu.token = result[2];
return co(function* () {
let userInfo = yield self.userInfo(params);
if (!_.get(userInfo, 'data') || userInfo.code !== 200) {
return {};
}
return resu;
});
let [getCodeData, getTokenData] = yield Promise.all([
self.getCode(params),
self.getToken(params)
]);
let getCode = _.get(getCodeData, 'data.trendWord') || _.get(getCodeData, 'data.inviteCode');
return Object.assign(userInfo.data, {
trendWord: getCode,
token: getTokenData
});
})();
}
}
... ...
... ... @@ -16,7 +16,8 @@ const cRoot = './controllers';
const installment = require(cRoot + '/installment');
const personalController = require(`${cRoot}/qrcode`);
const userQrcode = require(`${cRoot}/myqrcode`);
// const userQrcode = require(`${cRoot}/myqrcode`);
const homeController = require(`${cRoot}/index`);
const addressController = require(`${cRoot}/address`);
const favorite = require(`${cRoot}/favorite`);
... ... @@ -39,7 +40,9 @@ const newQrcode = require(`${cRoot}/newQrcode`);
// 查看二维码
router.get('/QRcode/:id', personalController.QRcode);
router.get('/user/qrcode', userQrcode.index);
// router.get('/user/qrcode', userQrcode.index);
router.get('/user/qrcode', auth, newQrcode.index);
/* 个人中心地址管理相关路由 */
router.get('/address', auth, addressController.address); // 地址管理页面
... ...
... ... @@ -15,7 +15,6 @@ const helpers = global.yoho.helpers;
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
this.ctx = _.get(ctx, 'req.ctx');
}
/**
... ... @@ -96,11 +95,11 @@ module.exports = class extends global.yoho.BaseModel {
let apiArray = [
this.queryShopsByBrandId(brandId, shopId), // 0 品牌信息
this.ctx(commentModel).getCommentInfo({
this.ctx.req.ctx(commentModel).getCommentInfo({
productId: productId
}), // 1 评论信息
this.ctx(commentModel).getCommonConsult(), // 2 默认咨询信息
this.ctx(commentModel).getConsults(productId, 1, 2), // 3 咨询列表
this.ctx.req.ctx(commentModel).getCommonConsult(), // 2 默认咨询信息
this.ctx.req.ctx(commentModel).getConsults(productId, 1, 2), // 3 咨询列表
this.queryPromotion(skn), // 4 促销活动
];
... ...
... ... @@ -31,6 +31,10 @@ module.exports = class extends global.yoho.BaseModel {
},
param: {cache: true}
}).then(result => {
if (!result) {
return '';
}
let goodsContainer = $.load(result)('#shop-goods-container');
let goodThumb = goodsContainer.find('.good-thumb');
... ...
... ... @@ -56,6 +56,41 @@
{{#useGiftCard}}
<a href="/service/qaDetail?keyword=%E7%A4%BC%E5%93%81%E5%8D%A1&id=286" class="iconfont nav-home">&#xe639;</a>
{{/useGiftCard}}
{{#navBtn}}
{{# @root.pageChannel}}
<div class="homebuttom hide{{#if @root.setChannel}} set-channel{{/if}} {{#if boys}} boys{{/if}}{{#if girls}} girls{{/if}}{{#if kids}} kids{{/if}}{{#if lifeStyle}} life-style{{/if}}{{#if lifestyle}} life-style{{/if}}">
{{^}}
<div class="homebuttom hide">
{{/ @root.pageChannel}}
<div class="ul-arr"></div>
<ul>
<li>
<a href="{{ indexUrl }}">
<i class="iconfont">&#xe62a;</i>
<span>首页</span>
</a>
</li>
<li>
<a href="{{ categoryUrl }}">
<i class="iconfont">&#xe62d;</i>
<span>分类</span>
</a>
</li>
<li>
<a href="{{ shoppingCartUrl }}">
<i class="iconfont">&#xe62c;</i>
<span>购物车</span>
</a>
</li>
<li>
<a href="{{ mineUrl }}">
<i class="iconfont">&#xe62b;</i>
<span>我的</span>
</a>
</li>
</ul>
</div>
{{/navBtn}}
</header>
{{#if saleNav.list}}
<div class="sale-nav-select">
... ... @@ -65,41 +100,6 @@
{{/each}}
</div>
{{/if}}
{{#navBtn}}
{{# @root.pageChannel}}
<div class="homebuttom hide{{#if @root.setChannel}} set-channel{{/if}} {{#if boys}} boys{{/if}}{{#if girls}} girls{{/if}}{{#if kids}} kids{{/if}}{{#if lifeStyle}} life-style{{/if}}{{#if lifestyle}} life-style{{/if}}">
{{^}}
<div class="homebuttom hide">
{{/ @root.pageChannel}}
<div class="ul-arr"></div>
<ul>
<li>
<a href="{{ indexUrl }}">
<i class="iconfont">&#xe62a;</i>
<span>首页</span>
</a>
</li>
<li>
<a href="{{ categoryUrl }}">
<i class="iconfont">&#xe62d;</i>
<span>分类</span>
</a>
</li>
<li>
<a href="{{ shoppingCartUrl }}">
<i class="iconfont">&#xe62c;</i>
<span>购物车</span>
</a>
</li>
<li>
<a href="{{ mineUrl }}">
<i class="iconfont">&#xe62b;</i>
<span>我的</span>
</a>
</li>
</ul>
</div>
{{/navBtn}}
<script type="text/javascript">
var isWechat = /micromessenger/i.test(navigator.userAgent || '');
... ...
... ... @@ -165,15 +165,15 @@ input::-webkit-calendar-picker-indicator {
.pic {
width: 100%;
height: 355px;
background-size: cover;
background-size: 100% 100%;
background-repeat: no-repeat;
background-position: center center;
.cover {
width: 100%;
height: 100%;
background-color: #000;
opacity: 0.6;
background-image: resolve("activity/store-home/s-bg.png");
background-repeat: repeat;
}
&.photography {
... ... @@ -244,25 +244,22 @@ input::-webkit-calendar-picker-indicator {
padding-top: 40px;
.logo {
width: 120px;
height: 120px;
margin: 0 auto;
background-repeat: no-repeat;
background-size: 100% 100%;
&.coffee {
width: 120px;
height: 120px;
background-image: url("/activity/store-home/coffee.png");
margin: 0 auto;
background-image: resolve("activity/store-home/coffee.png");
}
&.photography {
width: 120px;
height: 120px;
background-image: url("/activity/store-home/photography.png");
margin: 0 auto;
background-image: resolve("activity/store-home/photography.png");
}
&.green {
width: 120px;
height: 120px;
background-image: url("/activity/store-home/green.png");
margin: 0 auto;
background-image: resolve("activity/store-home/green.png");
}
}
... ...
... ... @@ -65,8 +65,7 @@
.yoho-header {
position: relative;
z-index: 1;
overflow: hidden;
z-index: 999;
width: 100%;
height: 90px;
background-color: #000;
... ...