Merge branch 'master' into feature/passback
Showing
18 changed files
with
136 additions
and
49 deletions
@@ -176,10 +176,22 @@ class BuyNowController { | @@ -176,10 +176,22 @@ class BuyNowController { | ||
176 | 176 | ||
177 | // 是否开发票 | 177 | // 是否开发票 |
178 | if (req.body.invoice && req.body.invoice === 'true') { | 178 | if (req.body.invoice && req.body.invoice === 'true') { |
179 | + let invoicePayableType = _.parseInt(req.body.invoice_payable_type); | ||
180 | + let invoicesTitlePersonal = req.body.invoices_title_personal ? req.body.invoices_title_personal : '个人'; | ||
181 | + | ||
179 | params.invoice = true; | 182 | params.invoice = true; |
180 | params.invoices_type = req.body.invoices_type; // 发票类型:纸质 1,电子 2 | 183 | params.invoices_type = req.body.invoices_type; // 发票类型:纸质 1,电子 2 |
181 | - params.invoices_title = req.body.invoices_title || '个人'; // 发票抬头,个人前端不传此值 | ||
182 | params.receiverMobile = req.body.receiverMobile; // 接收人电话 | 184 | params.receiverMobile = req.body.receiverMobile; // 接收人电话 |
185 | + params.invoice_payable_type = req.body.invoice_payable_type; // 区分个人或企业发票 | ||
186 | + | ||
187 | + if (invoicePayableType === 1) { | ||
188 | + // 开个人发票 | ||
189 | + params.invoices_title = invoicesTitlePersonal; | ||
190 | + } else { | ||
191 | + // 开公司发票 | ||
192 | + params.invoices_title = req.body.invoices_title; | ||
193 | + params.buyerTaxNumber = req.body.buyerTaxNumber; | ||
194 | + } | ||
183 | 195 | ||
184 | // 购买方纳税人识别号 | 196 | // 购买方纳税人识别号 |
185 | if (req.body.buyerTaxNumber) { | 197 | if (req.body.buyerTaxNumber) { |
@@ -202,18 +202,24 @@ exports.orderSub = (req, res, next) => { | @@ -202,18 +202,24 @@ exports.orderSub = (req, res, next) => { | ||
202 | // 电子发票信息数组 | 202 | // 电子发票信息数组 |
203 | let invoices = {}; | 203 | let invoices = {}; |
204 | 204 | ||
205 | + // 是否有发票数据 | ||
205 | if (orderInfo && orderInfo.invoice) { | 206 | if (orderInfo && orderInfo.invoice) { |
206 | - let invoices_title_personal = orderInfo.invoices_title_personal ? orderInfo.invoices_title_personal : '个人'; | 207 | + let invoicePayableType = _.parseInt(orderInfo.invoice_payable_type); |
208 | + let invoicesTitlePersonal = orderInfo.invoices_title_personal ? orderInfo.invoices_title_personal : '个人'; | ||
207 | 209 | ||
208 | invoices = { | 210 | invoices = { |
209 | invoices_type_id: 12, // 发票类型写死【明细】 | 211 | invoices_type_id: 12, // 发票类型写死【明细】 |
210 | invoices_type: orderInfo.invoices_type, // 区分电子发票还是纸质发票 | 212 | invoices_type: orderInfo.invoices_type, // 区分电子发票还是纸质发票 |
211 | receiverMobile: orderInfo.receiverMobile, // 电话 | 213 | receiverMobile: orderInfo.receiverMobile, // 电话 |
212 | - invoices_title: orderInfo.invoices_title ? orderInfo.invoices_title : invoices_title_personal | 214 | + invoice_payable_type: orderInfo.invoice_payable_type // 区分个人或企业发票 |
213 | }; | 215 | }; |
214 | 216 | ||
215 | - // 购买方纳税人识别号 | ||
216 | - if (orderInfo.buyerTaxNumber) { | 217 | + if (invoicePayableType === 1) { |
218 | + // 开个人发票 | ||
219 | + invoices.invoices_title = invoicesTitlePersonal; | ||
220 | + } else { | ||
221 | + // 开公司发票 | ||
222 | + invoices.invoices_title = orderInfo.invoices_title; | ||
217 | invoices.buyerTaxNumber = orderInfo.buyerTaxNumber; | 223 | invoices.buyerTaxNumber = orderInfo.buyerTaxNumber; |
218 | } | 224 | } |
219 | } | 225 | } |
@@ -137,6 +137,11 @@ class BuyNowModel extends global.yoho.BaseModel { | @@ -137,6 +137,11 @@ class BuyNowModel extends global.yoho.BaseModel { | ||
137 | finalParams.invoices_type = params.invoices_type; | 137 | finalParams.invoices_type = params.invoices_type; |
138 | } | 138 | } |
139 | 139 | ||
140 | + // 发票类型:个人 1, 企业 2 | ||
141 | + if (params.invoice_payable_type) { | ||
142 | + finalParams.invoice_payable_type = params.invoice_payable_type; | ||
143 | + } | ||
144 | + | ||
140 | // 发票抬头 | 145 | // 发票抬头 |
141 | if (params.invoices_title) { | 146 | if (params.invoices_title) { |
142 | finalParams.invoices_title = params.invoices_title; | 147 | finalParams.invoices_title = params.invoices_title; |
@@ -185,6 +185,11 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime, | @@ -185,6 +185,11 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime, | ||
185 | params.invoices_type = invoices.invoices_type; | 185 | params.invoices_type = invoices.invoices_type; |
186 | } | 186 | } |
187 | 187 | ||
188 | + // 发票类型:个人 1, 企业 2 | ||
189 | + if (invoices.invoice_payable_type) { | ||
190 | + params.invoice_payable_type = invoices.invoice_payable_type; | ||
191 | + } | ||
192 | + | ||
188 | // 收票人手机号码 | 193 | // 收票人手机号码 |
189 | if (invoices.receiverMobile) { | 194 | if (invoices.receiverMobile) { |
190 | params.receiverMobile = invoices.receiverMobile; | 195 | params.receiverMobile = invoices.receiverMobile; |
@@ -54,13 +54,3 @@ _fxcmd.push(['trackOrder', { | @@ -54,13 +54,3 @@ _fxcmd.push(['trackOrder', { | ||
54 | unid : "{{uid}}" | 54 | unid : "{{uid}}" |
55 | }]); | 55 | }]); |
56 | </script> | 56 | </script> |
57 | -{{!--<script type="text/javascript" src="//static.criteo.net/js/ld/ld.js" async="true"></script> | ||
58 | -<script type="text/javascript"> | ||
59 | -window.criteo_q = window.criteo_q || []; | ||
60 | -window.criteo_q.push( | ||
61 | -{ event: "setAccount", account: [21397] }, | ||
62 | -{ event: "setHashedEmail", email: "" }, | ||
63 | -{ event: "setSiteType", type: "m" }, | ||
64 | -{ event: "trackTransaction" , id: "{{orderCode}}", currency: "CNY", item: ""} | ||
65 | -); | ||
66 | -</script>--}} |
@@ -39,6 +39,10 @@ let _channelPage = (req, res, data) => { | @@ -39,6 +39,10 @@ let _channelPage = (req, res, data) => { | ||
39 | res.set('Cache-Control', 'no-cache'); | 39 | res.set('Cache-Control', 'no-cache'); |
40 | } | 40 | } |
41 | 41 | ||
42 | + if (result && result.content && result.content.length) { | ||
43 | + result.content.length = 6; | ||
44 | + } | ||
45 | + | ||
42 | // result.content = [{ | 46 | // result.content = [{ |
43 | // seckill: true, | 47 | // seckill: true, |
44 | // data: { | 48 | // data: { |
@@ -151,20 +151,15 @@ class favoriteIndexModel extends global.yoho.BaseModel { | @@ -151,20 +151,15 @@ class favoriteIndexModel extends global.yoho.BaseModel { | ||
151 | let obj = { | 151 | let obj = { |
152 | productList: [] | 152 | productList: [] |
153 | }; | 153 | }; |
154 | + let shopOrBrandLink; | ||
154 | 155 | ||
155 | - // if (empty(val.productSkn)) { | ||
156 | - // continue; | ||
157 | - // } | ||
158 | - if (val.brandOrShopType === 'brandOrShopType') { | ||
159 | - obj = _.assign(obj, { | ||
160 | - link: helpers.urlFormat('/product/index/brand', { | ||
161 | - shop_id: val.shopId | ||
162 | - }) | 156 | + if (val.brandOrShopType === 'brand') { |
157 | + shopOrBrandLink = helpers.urlFormat('/product/shop', { | ||
158 | + brand_id: val.brandId | ||
163 | }); | 159 | }); |
164 | } else { | 160 | } else { |
165 | - obj = _.assign(obj, { | ||
166 | - link: helpers.urlFormat('', {}, val.brandDomain) | ||
167 | - | 161 | + shopOrBrandLink = helpers.urlFormat('/product/shop', { |
162 | + shop_id: val.shopId | ||
168 | }); | 163 | }); |
169 | } | 164 | } |
170 | 165 | ||
@@ -175,9 +170,7 @@ class favoriteIndexModel extends global.yoho.BaseModel { | @@ -175,9 +170,7 @@ class favoriteIndexModel extends global.yoho.BaseModel { | ||
175 | discount: val.productDiscountNum, | 170 | discount: val.productDiscountNum, |
176 | brandImg: val.brandIco, | 171 | brandImg: val.brandIco, |
177 | update: val.newProductNum, | 172 | update: val.newProductNum, |
178 | - link: helpers.urlFormat('/product/shop', { | ||
179 | - shop_id: val.shopId | ||
180 | - }) | 173 | + link: shopOrBrandLink |
181 | }); | 174 | }); |
182 | 175 | ||
183 | _.forEach(val.newProduct, function(data, key) { | 176 | _.forEach(val.newProduct, function(data, key) { |
@@ -23,13 +23,3 @@ | @@ -23,13 +23,3 @@ | ||
23 | unid: "{{uid}}" | 23 | unid: "{{uid}}" |
24 | }]); | 24 | }]); |
25 | </script> | 25 | </script> |
26 | -<script type="text/javascript" src="//static.criteo.net/js/ld/ld.js" async="true"></script> | ||
27 | -<script type="text/javascript"> | ||
28 | - window.criteo_q = window.criteo_q || []; | ||
29 | - window.criteo_q.push( | ||
30 | - {event: "setAccount", account: [21397]}, | ||
31 | - {event: "setHashedEmail", email: ""}, | ||
32 | - {event: "setSiteType", type: "m"}, | ||
33 | - {event: "trackTransaction", id: "{{orderCode}}", currency: "CNY", item: ""} | ||
34 | - ); | ||
35 | -</script> |
@@ -342,7 +342,7 @@ const keyId = (req, res, next) => { | @@ -342,7 +342,7 @@ const keyId = (req, res, next) => { | ||
342 | 'total', 0)}条${queryKey}、产品的详细参数,实时报价,价格行情,图片、评价、品牌等信息。买${queryKey},就上YOHO!BUY有货`, | 342 | 'total', 0)}条${queryKey}、产品的详细参数,实时报价,价格行情,图片、评价、品牌等信息。买${queryKey},就上YOHO!BUY有货`, |
343 | pageFooter: true, | 343 | pageFooter: true, |
344 | cononical: { | 344 | cononical: { |
345 | - currentHref: helpers.urlFormat(req.originalUrl, null, 'www') | 345 | + currentHref: `//www.yohobuy.com${req.originalUrl}` |
346 | } | 346 | } |
347 | }); | 347 | }); |
348 | }).catch(next); | 348 | }).catch(next); |
@@ -7,7 +7,9 @@ const commentModel = require('./consult-comment'); | @@ -7,7 +7,9 @@ const commentModel = require('./consult-comment'); | ||
7 | const bundle = require('./bundle'); | 7 | const bundle = require('./bundle'); |
8 | const utils = '../../../utils'; | 8 | const utils = '../../../utils'; |
9 | const detailProcess = require(`${utils}/detail-process`); | 9 | const detailProcess = require(`${utils}/detail-process`); |
10 | +const redis = require(`${utils}/redis`); | ||
10 | const api = global.yoho.API; | 11 | const api = global.yoho.API; |
12 | +const helpers = global.yoho.helpers; | ||
11 | 13 | ||
12 | const newDetail = { | 14 | const newDetail = { |
13 | /** | 15 | /** |
@@ -42,7 +44,35 @@ const newDetail = { | @@ -42,7 +44,35 @@ const newDetail = { | ||
42 | result.data.goods_id = data.goodsId; | 44 | result.data.goods_id = data.goodsId; |
43 | result.data.shopId = _.get(result, 'data.shop_id', null); | 45 | result.data.shopId = _.get(result, 'data.shop_id', null); |
44 | 46 | ||
45 | - return detailProcess.prodessDetailData(result.data); | 47 | + let finalResult = detailProcess.prodessDetailData(result.data); |
48 | + let smallSort = _.get(result, 'data.smallSortId'); | ||
49 | + | ||
50 | + if (!smallSort) { | ||
51 | + return finalResult; | ||
52 | + } | ||
53 | + | ||
54 | + return this.getRecomdKeywords(smallSort).then(res => { | ||
55 | + let recomdKeywords = []; | ||
56 | + | ||
57 | + res = res ? JSON.parse(res) : []; | ||
58 | + | ||
59 | + _.forEach(_.slice(_.shuffle(res), 0, 12), val => { | ||
60 | + recomdKeywords.push({ | ||
61 | + url: helpers.urlFormat(`/chanpin/${val.id}.html`), | ||
62 | + keyword: val.keyword | ||
63 | + }); | ||
64 | + }); | ||
65 | + | ||
66 | + finalResult.recommendKeywords = recomdKeywords; | ||
67 | + | ||
68 | + return finalResult; | ||
69 | + }); | ||
70 | + }); | ||
71 | + }, | ||
72 | + | ||
73 | + getRecomdKeywords(smallSort) { | ||
74 | + return redis.all([['get', `global:yoho:seo:keywords:sortId:${smallSort}:page:1`]]).then(res => { | ||
75 | + return res[0]; | ||
46 | }); | 76 | }); |
47 | }, | 77 | }, |
48 | 78 |
@@ -124,6 +124,14 @@ | @@ -124,6 +124,14 @@ | ||
124 | <input id="product-coupon-switch" type="hidden" value="{{showCoupon}}"> | 124 | <input id="product-coupon-switch" type="hidden" value="{{showCoupon}}"> |
125 | <input id="bundleType" type="hidden" value="{{bundleType}}"> | 125 | <input id="bundleType" type="hidden" value="{{bundleType}}"> |
126 | 126 | ||
127 | + {{#if recommendKeywords}} | ||
128 | + <div class="rec-word clearfix"> | ||
129 | + {{# recommendKeywords}} | ||
130 | + <a href="{{url}}">{{keyword}}</a> | ||
131 | + {{/ recommendKeywords}} | ||
132 | + </div> | ||
133 | + {{/if}} | ||
134 | + | ||
127 | {{> common/suspend-home}} | 135 | {{> common/suspend-home}} |
128 | </div> | 136 | </div> |
129 | {{/ result}} | 137 | {{/ result}} |
@@ -275,9 +275,16 @@ function submitOrder() { | @@ -275,9 +275,16 @@ function submitOrder() { | ||
275 | invoice: orderInfo('invoice'), | 275 | invoice: orderInfo('invoice'), |
276 | invoices_title: orderInfo('invoices_title'), // 发票抬头 | 276 | invoices_title: orderInfo('invoices_title'), // 发票抬头 |
277 | invoices_type: orderInfo('invoices_type'), // 发票类型 1 纸质 2 电子 | 277 | invoices_type: orderInfo('invoices_type'), // 发票类型 1 纸质 2 电子 |
278 | + invoice_payable_type: orderInfo('invoice_payable_type'), // 发票类型 1 个人 2 企业 | ||
278 | receiverMobile: orderInfo('receiverMobile'), // 接收人电话 | 279 | receiverMobile: orderInfo('receiverMobile'), // 接收人电话 |
279 | buyerTaxNumber: orderInfo('buyerTaxNumber') // 购买方纳税人识别号,需要开具 | 280 | buyerTaxNumber: orderInfo('buyerTaxNumber') // 购买方纳税人识别号,需要开具 |
280 | }); | 281 | }); |
282 | + | ||
283 | + if (orderInfo('invoices_title_personal')) { | ||
284 | + Object.assign(postData, { | ||
285 | + invoices_title_personal: orderInfo('invoices_title_personal') | ||
286 | + }); | ||
287 | + } | ||
281 | } | 288 | } |
282 | 289 | ||
283 | $.ajax({ | 290 | $.ajax({ |
@@ -127,10 +127,18 @@ function confirmAction() { | @@ -127,10 +127,18 @@ function confirmAction() { | ||
127 | } | 127 | } |
128 | }, function() { | 128 | }, function() { |
129 | orderInfo('invoices_type', eInvoiceType); | 129 | orderInfo('invoices_type', eInvoiceType); |
130 | - orderInfo('invoices_title', title === '单位' ? company : ''); | ||
131 | - orderInfo('invoices_title_personal', title === '个人' ? company : ''); | ||
132 | orderInfo('receiverMobile', tel); | 130 | orderInfo('receiverMobile', tel); |
133 | - orderInfo('buyerTaxNumber', title === '单位' ? buyerTaxNumber : ''); | 131 | + |
132 | + if (title === '单位') { | ||
133 | + orderInfo('invoice_payable_type', 2); | ||
134 | + orderInfo('invoices_title', company); | ||
135 | + orderInfo('invoices_title_personal', null); | ||
136 | + orderInfo('buyerTaxNumber', buyerTaxNumber); | ||
137 | + } else { | ||
138 | + orderInfo('invoice_payable_type', 1); | ||
139 | + orderInfo('invoices_title', null); | ||
140 | + orderInfo('invoices_title_personal', company); | ||
141 | + } | ||
134 | 142 | ||
135 | if (isModifyTel && $copyTel !== tel) { | 143 | if (isModifyTel && $copyTel !== tel) { |
136 | orderInfo('isModifyTel', true); | 144 | orderInfo('isModifyTel', true); |
@@ -2,7 +2,6 @@ | @@ -2,7 +2,6 @@ | ||
2 | * @Author: Targaryen | 2 | * @Author: Targaryen |
3 | * @Date: 2017-06-22 13:51:16 | 3 | * @Date: 2017-06-22 13:51:16 |
4 | * @Last Modified by: Targaryen | 4 | * @Last Modified by: Targaryen |
5 | - * @Last Modified time: 2017-06-26 17:47:49 | ||
6 | */ | 5 | */ |
7 | require('common'); | 6 | require('common'); |
8 | let info = window.cookie('buynow_info'); | 7 | let info = window.cookie('buynow_info'); |
@@ -127,10 +127,18 @@ function confirmAction() { | @@ -127,10 +127,18 @@ function confirmAction() { | ||
127 | } | 127 | } |
128 | }, function() { | 128 | }, function() { |
129 | orderInfo('invoices_type', eInvoiceType); | 129 | orderInfo('invoices_type', eInvoiceType); |
130 | - orderInfo('invoices_title', title === '单位' ? company : ''); | ||
131 | - orderInfo('invoices_title_personal', title === '个人' ? company : ''); | ||
132 | orderInfo('receiverMobile', tel); | 130 | orderInfo('receiverMobile', tel); |
133 | - orderInfo('buyerTaxNumber', title === '单位' ? buyerTaxNumber : ''); | 131 | + |
132 | + if (title === '单位') { | ||
133 | + orderInfo('invoice_payable_type', 2); | ||
134 | + orderInfo('invoices_title', company); | ||
135 | + orderInfo('invoices_title_personal', null); | ||
136 | + orderInfo('buyerTaxNumber', buyerTaxNumber); | ||
137 | + } else { | ||
138 | + orderInfo('invoice_payable_type', 1); | ||
139 | + orderInfo('invoices_title', null); | ||
140 | + orderInfo('invoices_title_personal', company); | ||
141 | + } | ||
134 | 142 | ||
135 | if (isModifyTel && $copyTel !== tel) { | 143 | if (isModifyTel && $copyTel !== tel) { |
136 | orderInfo('isModifyTel', true); | 144 | orderInfo('isModifyTel', true); |
@@ -179,6 +179,10 @@ class RegisterNew { | @@ -179,6 +179,10 @@ class RegisterNew { | ||
179 | }, true); | 179 | }, true); |
180 | } | 180 | } |
181 | 181 | ||
182 | + let _fxcmd = window._fxcmd || []; | ||
183 | + | ||
184 | + _fxcmd.push(['trackEvent', 'event', 'reg', '注册', '1']); | ||
185 | + | ||
182 | setTimeout(function() { | 186 | setTimeout(function() { |
183 | location.href = res.href; | 187 | location.href = res.href; |
184 | }, 1500); | 188 | }, 1500); |
@@ -1225,6 +1225,24 @@ $basicBtnC: #eb0313; | @@ -1225,6 +1225,24 @@ $basicBtnC: #eb0313; | ||
1225 | } | 1225 | } |
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | + .rec-word { | ||
1229 | + padding-top: 16px; | ||
1230 | + padding-left: 30px; | ||
1231 | + background-color: #fff; | ||
1232 | + border-top: 1px solid #e6e6e6; | ||
1233 | + border-bottom: 1px solid #e6e6e6; | ||
1234 | + | ||
1235 | + > * { | ||
1236 | + display: inline-block; | ||
1237 | + font-size: 24px; | ||
1238 | + border: 1px solid #bbb; | ||
1239 | + border-radius: 10px; | ||
1240 | + padding: 6px 14px; | ||
1241 | + margin-right: 24px; | ||
1242 | + margin-bottom: 16px; | ||
1243 | + } | ||
1244 | + } | ||
1245 | + | ||
1228 | .recommend-for-you { | 1246 | .recommend-for-you { |
1229 | border-bottom: none; | 1247 | border-bottom: none; |
1230 | padding-left: 15px; | 1248 | padding-left: 15px; |
-
Please register or login to post a comment