Merge branch 'refs/heads/master' into feature/company-profile
Showing
11 changed files
with
111 additions
and
44 deletions
@@ -423,6 +423,8 @@ module.exports = class extends global.yoho.BaseModel { | @@ -423,6 +423,8 @@ module.exports = class extends global.yoho.BaseModel { | ||
423 | newGood.name = good.product_name; | 423 | newGood.name = good.product_name; |
424 | newGood.color = good.factory_color_name; | 424 | newGood.color = good.factory_color_name; |
425 | newGood.size = good.size_name; | 425 | newGood.size = good.size_name; |
426 | + newGood.colorAttr = _.get(good, 'sale_attr_desc.skc_attr'); | ||
427 | + newGood.sizeAttr = _.get(good, 'sale_attr_desc.sku_attr'); | ||
426 | newGood.skuTitle = good.sku_title || '尺码'; | 428 | newGood.skuTitle = good.sku_title || '尺码'; |
427 | newGood.price = that.transPrice(good.sales_price);// 默认显示销售价 | 429 | newGood.price = that.transPrice(good.sales_price);// 默认显示销售价 |
428 | newGood.isVipPrice = good.discount_tag === 'V'; | 430 | newGood.isVipPrice = good.discount_tag === 'V'; |
@@ -860,6 +862,8 @@ module.exports = class extends global.yoho.BaseModel { | @@ -860,6 +862,8 @@ module.exports = class extends global.yoho.BaseModel { | ||
860 | name: good.product_name, | 862 | name: good.product_name, |
861 | color: good.factory_color_name, | 863 | color: good.factory_color_name, |
862 | size: good.size_name, | 864 | size: good.size_name, |
865 | + colorAttr: _.get(good, 'sale_attr_desc.skc_attr'), | ||
866 | + sizeAttr: _.get(good, 'sale_attr_desc.sku_attr'), | ||
863 | skuTitle: good.sku_title || '尺码', | 867 | skuTitle: good.sku_title || '尺码', |
864 | price: that.transPrice(good.sales_price), // 默认显示销售价 | 868 | price: that.transPrice(good.sales_price), // 默认显示销售价 |
865 | isVipPrice: good.discount_tag === 'V', | 869 | isVipPrice: good.discount_tag === 'V', |
@@ -237,25 +237,16 @@ | @@ -237,25 +237,16 @@ | ||
237 | </a> | 237 | </a> |
238 | <p class="name-color-size"> | 238 | <p class="name-color-size"> |
239 | <a class="name" href="{{url}}" target="_blank">{{name}}</a> | 239 | <a class="name" href="{{url}}" target="_blank">{{name}}</a> |
240 | - {{#if ../virtualGood}} | ||
241 | - {{#if color}} | ||
242 | - 日期:{{color}} | ||
243 | - {{/if}} | ||
244 | - {{#if size}} | ||
245 | - 区域:{{size}} | ||
246 | - {{/if}} | ||
247 | - {{else}} | ||
248 | - {{#if color}} | ||
249 | - <b title="{{color}}">颜色:{{color}}</b> | ||
250 | - {{/if}} | 240 | + {{#if color}} |
241 | + <b title="{{color}}">{{#if colorAttr}}{{colorAttr}}{{else}}颜色:{{color}}{{/if}} </b> | ||
242 | + {{/if}} | ||
251 | 243 | ||
252 | - {{#if size}} | ||
253 | - {{skuTitle}}:{{size}} | ||
254 | - {{/if}} | 244 | + {{#if size}} |
245 | + {{#if sizeAttr}}{{sizeAttr}}{{else}}{{skuTitle}}:{{size}}{{/if}} | ||
246 | + {{/if}} | ||
255 | 247 | ||
256 | - {{#if date}} | 248 | + {{#if date}} |
257 | 日期:{{date}} | 249 | 日期:{{date}} |
258 | - {{/if}} | ||
259 | {{/if}} | 250 | {{/if}} |
260 | </p> | 251 | </p> |
261 | </td> | 252 | </td> |
@@ -37,25 +37,16 @@ | @@ -37,25 +37,16 @@ | ||
37 | {{/if}} | 37 | {{/if}} |
38 | <a class="name" href="{{href}}" target="_blank">{{name}}</a> | 38 | <a class="name" href="{{href}}" target="_blank">{{name}}</a> |
39 | <span class="color-size"> | 39 | <span class="color-size"> |
40 | - {{#if virtualGood}} | ||
41 | - {{#if color}} | ||
42 | - 日期:{{color}} | ||
43 | - {{/if}} | ||
44 | - {{#if size}} | ||
45 | - 区域:{{size}} | ||
46 | - {{/if}} | ||
47 | - {{else}} | ||
48 | - {{#if color}} | ||
49 | - <b title="{{color}}">颜色:{{color}} </b> | ||
50 | - {{/if}} | ||
51 | - | ||
52 | - {{#if size}} | ||
53 | - {{skuTitle}}:{{size}} | ||
54 | - {{/if}} | ||
55 | - | ||
56 | - {{#if arrivalDate}} | ||
57 | - <i class="arrival-date">上市期:{{arrivalDate}}</i> | ||
58 | - {{/if}} | 40 | + {{#if color}} |
41 | + <b title="{{color}}">{{#if colorAttr}}{{colorAttr}}{{else}}颜色:{{color}}{{/if}} </b> | ||
42 | + {{/if}} | ||
43 | + | ||
44 | + {{#if size}} | ||
45 | + {{#if sizeAttr}}{{sizeAttr}}{{else}}{{skuTitle}}:{{size}}{{/if}} | ||
46 | + {{/if}} | ||
47 | + | ||
48 | + {{#if arrivalDate}} | ||
49 | + <i class="arrival-date">上市期:{{arrivalDate}}</i> | ||
59 | {{/if}} | 50 | {{/if}} |
60 | </span> | 51 | </span> |
61 | </div> | 52 | </div> |
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | +const request = require('request-promise'); | ||
3 | const md5 = require('md5'); | 4 | const md5 = require('md5'); |
4 | const uuid = require('uuid'); | 5 | const uuid = require('uuid'); |
5 | const _ = require('lodash'); | 6 | const _ = require('lodash'); |
@@ -20,6 +21,34 @@ const UserService = require('./user-service'); | @@ -20,6 +21,34 @@ const UserService = require('./user-service'); | ||
20 | const LoginApi = require('./login-api'); | 21 | const LoginApi = require('./login-api'); |
21 | const logger = global.yoho.logger; | 22 | const logger = global.yoho.logger; |
22 | 23 | ||
24 | +class BaiduSDK { | ||
25 | + /* | ||
26 | + * @ description: 广告主回传转化数据接口, 上报百度 | ||
27 | + * @ author: huzhiming | ||
28 | + * @ date: 2019-11-19 17:21:29 | ||
29 | + * @ version: v1.0.0 | ||
30 | + * 详情见文档:[http://ocpc.baidu.com/developer/d/guide/?iurl=api%2Fapi-doc%2Fapi-interface%2F] | ||
31 | + */ | ||
32 | + static reportOcpcApi({ | ||
33 | + token = '7GULUkX90QLZU6cHO9OEqUsRKttGNqpN@O62eFfb91OUVhmkakV1bQHIxF8xURBvP', | ||
34 | + conversionTypes = [{ logidUrl: '', newType: null }] | ||
35 | + }) { | ||
36 | + request({ | ||
37 | + method: 'POST', | ||
38 | + uri: 'http://ocpc.baidu.com/ocpcapi/api/uploadConvertData', | ||
39 | + body: { | ||
40 | + token, | ||
41 | + conversionTypes | ||
42 | + }, | ||
43 | + json: true | ||
44 | + }).then((result) => { | ||
45 | + console.log(`[账号注册成功后上报 百度ocpc返回信息:${JSON.stringify(result)}`); | ||
46 | + }).catch((error) => { | ||
47 | + console.log(`[账号注册成功后上报 百度ocpc失败 错误信息:${error}`); | ||
48 | + }); | ||
49 | + } | ||
50 | +} | ||
51 | + | ||
23 | module.exports = class extends global.yoho.BaseModel { | 52 | module.exports = class extends global.yoho.BaseModel { |
24 | constructor(ctx) { | 53 | constructor(ctx) { |
25 | super(ctx); | 54 | super(ctx); |
@@ -125,6 +154,23 @@ module.exports = class extends global.yoho.BaseModel { | @@ -125,6 +154,23 @@ module.exports = class extends global.yoho.BaseModel { | ||
125 | domain: config.cookieDomain | 154 | domain: config.cookieDomain |
126 | }); | 155 | }); |
127 | 156 | ||
157 | + /* | ||
158 | + * @ description: feat(oCPC搜索推广): 推广链接转化数据发送给百度服务器,埋点:OCPC推广链接打开并完成注册进行数据上报 | ||
159 | + * @ author: huzhiming | ||
160 | + * @ date: 2019-11-19 19:09:39 | ||
161 | + * @ version: v1.0.0 | ||
162 | + * bd_vid_path存值见:public/js/common.js 文件 | ||
163 | + */ | ||
164 | + const logidUrl = req.cookies.bd_vid_path; | ||
165 | + | ||
166 | + if (logidUrl) { | ||
167 | + BaiduSDK.reportOcpcApi({ | ||
168 | + conversionTypes: { | ||
169 | + logidUrl, | ||
170 | + newType: 25 | ||
171 | + } | ||
172 | + }); | ||
173 | + } | ||
128 | 174 | ||
129 | req.session.TOKEN_ = publicToken; | 175 | req.session.TOKEN_ = publicToken; |
130 | req.session.LOGIN_UID_ = uid; | 176 | req.session.LOGIN_UID_ = uid; |
@@ -1050,7 +1050,10 @@ function _detailDataPkg(origin, uid, vipLevel, cookies) { | @@ -1050,7 +1050,10 @@ function _detailDataPkg(origin, uid, vipLevel, cookies) { | ||
1050 | result.shopId = propOrigin('shop_id', 0); | 1050 | result.shopId = propOrigin('shop_id', 0); |
1051 | result.brandId = propOrigin('brand_info.brand_id', ''); | 1051 | result.brandId = propOrigin('brand_info.brand_id', ''); |
1052 | result.brandName = propOrigin('brand_info.brand_name', ''); | 1052 | result.brandName = propOrigin('brand_info.brand_name', ''); |
1053 | + result.skcTitle = propOrigin('skcTitle', '颜色'); | ||
1054 | + result.skcTitleLength = result.skcTitle.length; | ||
1053 | result.skuTitle = propOrigin('skuTitle', '尺码'); | 1055 | result.skuTitle = propOrigin('skuTitle', '尺码'); |
1056 | + result.skuTitleLength = result.skuTitle.length; | ||
1054 | 1057 | ||
1055 | result.maxSortId = propOrigin('maxSortId', ''); | 1058 | result.maxSortId = propOrigin('maxSortId', ''); |
1056 | result.smallSortId = propOrigin('smallSortId', ''); | 1059 | result.smallSortId = propOrigin('smallSortId', ''); |
1 | <div class="chose-color row clearfix"> | 1 | <div class="chose-color row clearfix"> |
2 | - <span class="title pull-left">颜 色:</span> | 2 | + <span class="title pull-left"><i class="skc-label label-size-{{skcTitleLength}}">{{skcTitle}}</i>:</span> |
3 | <ul class="colors pull-left clearfix"> | 3 | <ul class="colors pull-left clearfix"> |
4 | {{#each colors}} | 4 | {{#each colors}} |
5 | <li class="{{#if focus}}focus{{/if}} {{#if disable}}disable{{/if}} pull-left" | 5 | <li class="{{#if focus}}focus{{/if}} {{#if disable}}disable{{/if}} pull-left" |
@@ -89,12 +89,8 @@ | @@ -89,12 +89,8 @@ | ||
89 | 89 | ||
90 | <div class="trade-content"> | 90 | <div class="trade-content"> |
91 | <div id="type-chose" class="type-chose"> | 91 | <div id="type-chose" class="type-chose"> |
92 | - {{#if virtualGoods}} | ||
93 | - {{> product/yohood-tick}} | ||
94 | - {{else}} | ||
95 | - {{> product/color-list}} | ||
96 | - {{> product/size-list}} | ||
97 | - {{/if}} | 92 | + {{> product/color-list}} |
93 | + {{> product/size-list}} | ||
98 | 94 | ||
99 | <div class="chose-count row clearfix"> | 95 | <div class="chose-count row clearfix"> |
100 | <span class="title pull-left">数 量:</span> | 96 | <span class="title pull-left">数 量:</span> |
1 | 1 | ||
2 | <div class="chose-size row clearfix"> | 2 | <div class="chose-size row clearfix"> |
3 | - <span class="title pull-left"><i class="sku-label">{{skuTitle}}</i>:</span> | 3 | + <span class="title pull-left"><i class="sku-label label-size-{{skuTitleLength}}">{{skuTitle}}</i>:</span> |
4 | 4 | ||
5 | <div id="sizes" class="size-wrapper pull-left"> | 5 | <div id="sizes" class="size-wrapper pull-left"> |
6 | {{#each colors}} | 6 | {{#each colors}} |
@@ -130,6 +130,17 @@ function getShoppingKey() { | @@ -130,6 +130,17 @@ function getShoppingKey() { | ||
130 | if (window._yas) { | 130 | if (window._yas) { |
131 | window._yas(1 * new Date(), window._yasVersion, 'yohobuy_web', uid, '', ''); | 131 | window._yas(1 * new Date(), window._yasVersion, 'yohobuy_web', uid, '', ''); |
132 | } | 132 | } |
133 | + | ||
134 | + /* 【加入ocpcApi代码】: 判断当前页面地址若百度sem推广链接,即将推广链接存到cookies,支付成功后将推广链接上报百度 ocpcapi | ||
135 | + * @ description: 收集百度sem推广链接 | ||
136 | + * @ author: huzhiming | ||
137 | + * @ date: 2019-11-18 16:55:17 | ||
138 | + * @ version: v1.0.0 | ||
139 | + * 详情见文档:[http://ocpc.baidu.com/developer/d/guide/?iurl=api%2Fapi-doc%2Fapi-interface%2F] | ||
140 | + */ | ||
141 | + if (location.href.includes('bd_vid=')) { | ||
142 | + setCookie('bd_vid_path', location.href, { path: '/', domain: '.yohobuy.com', expires: 90 }); | ||
143 | + } | ||
133 | }()); | 144 | }()); |
134 | 145 | ||
135 | // window.resize在width<1180时适配成990 | 146 | // window.resize在width<1180时适配成990 |
@@ -2668,6 +2668,23 @@ | @@ -2668,6 +2668,23 @@ | ||
2668 | margin-top: 14px; | 2668 | margin-top: 14px; |
2669 | } | 2669 | } |
2670 | 2670 | ||
2671 | + .skc-label { | ||
2672 | + letter-spacing: 22px; | ||
2673 | + width: 54px; | ||
2674 | + display: inline-block; | ||
2675 | + overflow: hidden; | ||
2676 | + white-space: nowrap; | ||
2677 | + vertical-align: middle; | ||
2678 | + } | ||
2679 | + | ||
2680 | + .label-size-3 { | ||
2681 | + letter-spacing: 5px; | ||
2682 | + } | ||
2683 | + | ||
2684 | + .label-size-4 { | ||
2685 | + letter-spacing: 0; | ||
2686 | + } | ||
2687 | + | ||
2671 | img { | 2688 | img { |
2672 | float: left; | 2689 | float: left; |
2673 | display: inline-block; | 2690 | display: inline-block; |
@@ -2718,6 +2735,14 @@ | @@ -2718,6 +2735,14 @@ | ||
2718 | vertical-align: middle; | 2735 | vertical-align: middle; |
2719 | } | 2736 | } |
2720 | 2737 | ||
2738 | + .label-size-3 { | ||
2739 | + letter-spacing: 5px; | ||
2740 | + } | ||
2741 | + | ||
2742 | + .label-size-4 { | ||
2743 | + letter-spacing: 0; | ||
2744 | + } | ||
2745 | + | ||
2721 | li { | 2746 | li { |
2722 | float: left; | 2747 | float: left; |
2723 | display: block; | 2748 | display: block; |
-
Please register or login to post a comment