Authored by 郭成尧

Merge branch 'hotfix/invoice' into feature/giftcard

... ... @@ -176,10 +176,22 @@ class BuyNowController {
// 是否开发票
if (req.body.invoice && req.body.invoice === 'true') {
let invoicePayableType = _.parseInt(req.body.invoice_payable_type);
let invoicesTitlePersonal = req.body.invoices_title_personal ? req.body.invoices_title_personal : '个人';
params.invoice = true;
params.invoices_type = req.body.invoices_type; // 发票类型:纸质 1,电子 2
params.invoices_title = req.body.invoices_title || '个人'; // 发票抬头,个人前端不传此值
params.receiverMobile = req.body.receiverMobile; // 接收人电话
params.invoice_payable_type = req.body.invoice_payable_type; // 区分个人或企业发票
if (invoicePayableType === 1) {
// 开个人发票
params.invoices_title = invoicesTitlePersonal;
} else {
// 开公司发票
params.invoices_title = req.body.invoices_title;
params.buyerTaxNumber = req.body.buyerTaxNumber;
}
// 购买方纳税人识别号
if (req.body.buyerTaxNumber) {
... ...
... ... @@ -226,18 +226,24 @@ exports.orderSub = (req, res, next) => {
// 电子发票信息数组
let invoices = {};
// 是否有发票数据
if (orderInfo && orderInfo.invoice) {
let invoices_title_personal = orderInfo.invoices_title_personal ? orderInfo.invoices_title_personal : '个人';
let invoicePayableType = _.parseInt(orderInfo.invoice_payable_type);
let invoicesTitlePersonal = orderInfo.invoices_title_personal ? orderInfo.invoices_title_personal : '个人';
invoices = {
invoices_type_id: 12, // 发票类型写死【明细】
invoices_type: orderInfo.invoices_type, // 区分电子发票还是纸质发票
receiverMobile: orderInfo.receiverMobile, // 电话
invoices_title: orderInfo.invoices_title ? orderInfo.invoices_title : invoices_title_personal
invoice_payable_type: orderInfo.invoice_payable_type // 区分个人或企业发票
};
// 购买方纳税人识别号
if (orderInfo.buyerTaxNumber) {
if (invoicePayableType === 1) {
// 开个人发票
invoices.invoices_title = invoicesTitlePersonal;
} else {
// 开公司发票
invoices.invoices_title = orderInfo.invoices_title;
invoices.buyerTaxNumber = orderInfo.buyerTaxNumber;
}
}
... ...
... ... @@ -145,6 +145,11 @@ class BuyNowModel extends global.yoho.BaseModel {
finalParams.invoices_type = params.invoices_type;
}
// 发票类型:个人 1, 企业 2
if (params.invoice_payable_type) {
finalParams.invoice_payable_type = params.invoice_payable_type;
}
// 发票抬头
if (params.invoices_title) {
finalParams.invoices_title = params.invoices_title;
... ...
... ... @@ -182,6 +182,11 @@ exports.orderSub = (params) => {
finalParams.invoices_type = params.invoices.invoices_type;
}
// 发票类型:个人 1, 企业 2
if (invoices.invoice_payable_type) {
params.invoice_payable_type = invoices.invoice_payable_type;
}
// 收票人手机号码
if (params.invoices.receiverMobile) {
finalParams.receiverMobile = params.invoices.receiverMobile;
... ...
... ... @@ -54,13 +54,3 @@ _fxcmd.push(['trackOrder', {
unid : "{{uid}}"
}]);
</script>
{{!--<script type="text/javascript" src="//static.criteo.net/js/ld/ld.js" async="true"></script>
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{ event: "setAccount", account: [21397] },
{ event: "setHashedEmail", email: "" },
{ event: "setSiteType", type: "m" },
{ event: "trackTransaction" , id: "{{orderCode}}", currency: "CNY", item: ""}
);
</script>--}}
... ...
... ... @@ -39,6 +39,10 @@ let _channelPage = (req, res, data) => {
res.set('Cache-Control', 'no-cache');
}
if (result && result.content && result.content.length) {
result.content.length = 6;
}
// result.content = [{
// seckill: true,
// data: {
... ...
... ... @@ -151,20 +151,15 @@ class favoriteIndexModel extends global.yoho.BaseModel {
let obj = {
productList: []
};
let shopOrBrandLink;
// if (empty(val.productSkn)) {
// continue;
// }
if (val.brandOrShopType === 'brandOrShopType') {
obj = _.assign(obj, {
link: helpers.urlFormat('/product/index/brand', {
shop_id: val.shopId
})
if (val.brandOrShopType === 'brand') {
shopOrBrandLink = helpers.urlFormat('/product/shop', {
brand_id: val.brandId
});
} else {
obj = _.assign(obj, {
link: helpers.urlFormat('', {}, val.brandDomain)
shopOrBrandLink = helpers.urlFormat('/product/shop', {
shop_id: val.shopId
});
}
... ... @@ -175,9 +170,7 @@ class favoriteIndexModel extends global.yoho.BaseModel {
discount: val.productDiscountNum,
brandImg: val.brandIco,
update: val.newProductNum,
link: helpers.urlFormat('/product/shop', {
shop_id: val.shopId
})
link: shopOrBrandLink
});
_.forEach(val.newProduct, function(data, key) {
... ...
... ... @@ -23,13 +23,3 @@
unid: "{{uid}}"
}]);
</script>
<script type="text/javascript" src="//static.criteo.net/js/ld/ld.js" async="true"></script>
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{event: "setAccount", account: [21397]},
{event: "setHashedEmail", email: ""},
{event: "setSiteType", type: "m"},
{event: "trackTransaction", id: "{{orderCode}}", currency: "CNY", item: ""}
);
</script>
... ...
... ... @@ -342,7 +342,7 @@ const keyId = (req, res, next) => {
'total', 0)}${queryKey}、产品的详细参数,实时报价,价格行情,图片、评价、品牌等信息。买${queryKey},就上YOHO!BUY有货`,
pageFooter: true,
cononical: {
currentHref: helpers.urlFormat(req.originalUrl, null, 'www')
currentHref: `//www.yohobuy.com${req.originalUrl}`
}
});
}).catch(next);
... ...
... ... @@ -7,7 +7,9 @@ const commentModel = require('./consult-comment');
const bundle = require('./bundle');
const utils = '../../../utils';
const detailProcess = require(`${utils}/detail-process`);
const redis = require(`${utils}/redis`);
const api = global.yoho.API;
const helpers = global.yoho.helpers;
const newDetail = {
/**
... ... @@ -42,7 +44,35 @@ const newDetail = {
result.data.goods_id = data.goodsId;
result.data.shopId = _.get(result, 'data.shop_id', null);
return detailProcess.prodessDetailData(result.data);
let finalResult = detailProcess.prodessDetailData(result.data);
let smallSort = _.get(result, 'data.smallSortId');
if (!smallSort) {
return finalResult;
}
return this.getRecomdKeywords(smallSort).then(res => {
let recomdKeywords = [];
res = res ? JSON.parse(res) : [];
_.forEach(_.slice(_.shuffle(res), 0, 12), val => {
recomdKeywords.push({
url: helpers.urlFormat(`/chanpin/${val.id}.html`),
keyword: val.keyword
});
});
finalResult.recommendKeywords = recomdKeywords;
return finalResult;
});
});
},
getRecomdKeywords(smallSort) {
return redis.all([['get', `global:yoho:seo:keywords:sortId:${smallSort}:page:1`]]).then(res => {
return res[0];
});
},
... ...
... ... @@ -124,6 +124,14 @@
<input id="product-coupon-switch" type="hidden" value="{{showCoupon}}">
<input id="bundleType" type="hidden" value="{{bundleType}}">
{{#if recommendKeywords}}
<div class="rec-word clearfix">
{{# recommendKeywords}}
<a href="{{url}}">{{keyword}}</a>
{{/ recommendKeywords}}
</div>
{{/if}}
{{> common/suspend-home}}
</div>
{{/ result}}
... ...
{
"name": "m-yohobuy-node",
"version": "6.0.10",
"version": "6.0.13",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -173,9 +173,16 @@ function submitOrder() {
invoice: orderInfo('invoice'),
invoices_title: orderInfo('invoices_title'), // 发票抬头
invoices_type: orderInfo('invoices_type'), // 发票类型 1 纸质 2 电子
invoice_payable_type: orderInfo('invoice_payable_type'), // 发票类型 1 个人 2 企业
receiverMobile: orderInfo('receiverMobile'), // 接收人电话
buyerTaxNumber: orderInfo('buyerTaxNumber') // 购买方纳税人识别号,需要开具
});
if (orderInfo('invoices_title_personal')) {
Object.assign(postData, {
invoices_title_personal: orderInfo('invoices_title_personal')
});
}
}
$.ajax({
... ...
... ... @@ -127,10 +127,18 @@ function confirmAction() {
}
}, function() {
orderInfo('invoices_type', eInvoiceType);
orderInfo('invoices_title', title === '单位' ? company : '');
orderInfo('invoices_title_personal', title === '个人' ? company : '');
orderInfo('receiverMobile', tel);
orderInfo('buyerTaxNumber', title === '单位' ? buyerTaxNumber : '');
if (title === '单位') {
orderInfo('invoice_payable_type', 2);
orderInfo('invoices_title', company);
orderInfo('invoices_title_personal', null);
orderInfo('buyerTaxNumber', buyerTaxNumber);
} else {
orderInfo('invoice_payable_type', 1);
orderInfo('invoices_title', null);
orderInfo('invoices_title_personal', company);
}
if (isModifyTel && $copyTel !== tel) {
orderInfo('isModifyTel', true);
... ...
... ... @@ -2,7 +2,6 @@
* @Author: Targaryen
* @Date: 2017-06-22 13:51:16
* @Last Modified by: Targaryen
* @Last Modified time: 2017-06-26 17:47:49
*/
require('common');
let info = window.cookie('buynow_info');
... ...
... ... @@ -127,10 +127,18 @@ function confirmAction() {
}
}, function() {
orderInfo('invoices_type', eInvoiceType);
orderInfo('invoices_title', title === '单位' ? company : '');
orderInfo('invoices_title_personal', title === '个人' ? company : '');
orderInfo('receiverMobile', tel);
orderInfo('buyerTaxNumber', title === '单位' ? buyerTaxNumber : '');
if (title === '单位') {
orderInfo('invoice_payable_type', 2);
orderInfo('invoices_title', company);
orderInfo('invoices_title_personal', null);
orderInfo('buyerTaxNumber', buyerTaxNumber);
} else {
orderInfo('invoice_payable_type', 1);
orderInfo('invoices_title', null);
orderInfo('invoices_title_personal', company);
}
if (isModifyTel && $copyTel !== tel) {
orderInfo('isModifyTel', true);
... ...
... ... @@ -176,6 +176,10 @@ class RegisterNew {
}, true);
}
let _fxcmd = window._fxcmd || [];
_fxcmd.push(['trackEvent', 'event', 'reg', '注册', '1']);
setTimeout(function() {
location.href = res.href;
}, 1500);
... ...
... ... @@ -1225,6 +1225,24 @@ $basicBtnC: #eb0313;
}
}
.rec-word {
padding-top: 16px;
padding-left: 30px;
background-color: #fff;
border-top: 1px solid #e6e6e6;
border-bottom: 1px solid #e6e6e6;
> * {
display: inline-block;
font-size: 24px;
border: 1px solid #bbb;
border-radius: 10px;
padding: 6px 14px;
margin-right: 24px;
margin-bottom: 16px;
}
}
.recommend-for-you {
border-bottom: none;
padding-left: 15px;
... ...