Showing
16 changed files
with
327 additions
and
193 deletions
@@ -100,7 +100,6 @@ try { | @@ -100,7 +100,6 @@ try { | ||
100 | // YOHO 后置中间件 | 100 | // YOHO 后置中间件 |
101 | app.use(errorHanlder.serverError()); | 101 | app.use(errorHanlder.serverError()); |
102 | } catch (err) { | 102 | } catch (err) { |
103 | - console.error(err); | ||
104 | logger.error(err); | 103 | logger.error(err); |
105 | } | 104 | } |
106 | 105 |
@@ -136,7 +136,7 @@ const _getChannelResource = (params) => { | @@ -136,7 +136,7 @@ const _getChannelResource = (params) => { | ||
136 | if (result && result.code === 200) { | 136 | if (result && result.code === 200) { |
137 | return resourcesProcess(result.data.list); | 137 | return resourcesProcess(result.data.list); |
138 | } else { | 138 | } else { |
139 | - logger.error('首页资源位接口返回状态码 不是 200'); | 139 | + logger.error('api index content resource code no 200'); |
140 | return result; | 140 | return result; |
141 | } | 141 | } |
142 | }); | 142 | }); |
@@ -156,7 +156,7 @@ const _getLeftNav = (choosed) => { | @@ -156,7 +156,7 @@ const _getLeftNav = (choosed) => { | ||
156 | if (result && result.code === 200) { | 156 | if (result && result.code === 200) { |
157 | return _processSideBar(result.data, choosed); | 157 | return _processSideBar(result.data, choosed); |
158 | } else { | 158 | } else { |
159 | - logger.error('侧边栏数据接口返回状态码 不是 200'); | 159 | + logger.error('api left nav code no 200'); |
160 | return result; | 160 | return result; |
161 | } | 161 | } |
162 | }); | 162 | }); |
@@ -191,7 +191,7 @@ const _getChannelList = () => { | @@ -191,7 +191,7 @@ const _getChannelList = () => { | ||
191 | }); | 191 | }); |
192 | return Object.keys(list).length ? list : channelList; | 192 | return Object.keys(list).length ? list : channelList; |
193 | } else { | 193 | } else { |
194 | - logger.error('频道选择接口返回状态码 不是 200'); | 194 | + logger.error('api channel select data code no 200'); |
195 | return channelList; | 195 | return channelList; |
196 | } | 196 | } |
197 | }); | 197 | }); |
@@ -210,7 +210,7 @@ const _getChannelBg = () => { | @@ -210,7 +210,7 @@ const _getChannelBg = () => { | ||
210 | if (result && result.code === 200) { | 210 | if (result && result.code === 200) { |
211 | return result.data.length && result.data[0] && result.data[0].data && result.data[0].data.list[0]; | 211 | return result.data.length && result.data[0] && result.data[0].data && result.data[0].data.list[0]; |
212 | } else { | 212 | } else { |
213 | - logger.error('频道选择页背景图接口返回状态码 不是 200'); | 213 | + logger.error('api background img of channel select page code no 200'); |
214 | return { | 214 | return { |
215 | src: '' | 215 | src: '' |
216 | }; | 216 | }; |
@@ -29,7 +29,7 @@ const _getResources = (page) => { | @@ -29,7 +29,7 @@ const _getResources = (page) => { | ||
29 | if (result && result.code === 200) { | 29 | if (result && result.code === 200) { |
30 | return resourcesProcess(result.data); | 30 | return resourcesProcess(result.data); |
31 | } else { | 31 | } else { |
32 | - logger.error('星潮教室页面资源位返回 code 不是 200'); | 32 | + logger.error('star class content resource return code no 200'); |
33 | return []; | 33 | return []; |
34 | } | 34 | } |
35 | }); | 35 | }); |
@@ -158,7 +158,7 @@ const getIndexData = () => { | @@ -158,7 +158,7 @@ const getIndexData = () => { | ||
158 | if (result && result.code === 200) { | 158 | if (result && result.code === 200) { |
159 | return _processIndexData(result); | 159 | return _processIndexData(result); |
160 | } else { | 160 | } else { |
161 | - logger.error('星潮教室首页数据返回 code 不是 200'); | 161 | + logger.error('star class content resource return code no 200'); |
162 | return {}; | 162 | return {}; |
163 | } | 163 | } |
164 | }); | 164 | }); |
@@ -183,7 +183,7 @@ const getDetailData = (params, uid) => { | @@ -183,7 +183,7 @@ const getDetailData = (params, uid) => { | ||
183 | return _processGuangData(result.data.list, true); | 183 | return _processGuangData(result.data.list, true); |
184 | } | 184 | } |
185 | } else { | 185 | } else { |
186 | - logger.error('明星专题文章数据返回 code 不是 200'); | 186 | + logger.error('api app.starClass.lastTagArticle code no 200'); |
187 | return []; | 187 | return []; |
188 | } | 188 | } |
189 | }); | 189 | }); |
@@ -227,7 +227,7 @@ const getCollocationListData = (params, uid) => { | @@ -227,7 +227,7 @@ const getCollocationListData = (params, uid) => { | ||
227 | if (result && result.code === 200) { | 227 | if (result && result.code === 200) { |
228 | return _processGuangData(result.data.list.artList); | 228 | return _processGuangData(result.data.list.artList); |
229 | } else { | 229 | } else { |
230 | - logger.error('获取星搭配文章列表返回 code 不是 200'); | 230 | + logger.error('getStarClassroomArticleList code no 200'); |
231 | return []; | 231 | return []; |
232 | } | 232 | } |
233 | }); | 233 | }); |
@@ -10,8 +10,11 @@ const mRoot = '../models'; | @@ -10,8 +10,11 @@ const mRoot = '../models'; | ||
10 | const headerModel = require('../../../doraemon/models/header'); // 头部model | 10 | const headerModel = require('../../../doraemon/models/header'); // 头部model |
11 | const detailModel = require(`${mRoot}/detail`); // 商品详情 model | 11 | const detailModel = require(`${mRoot}/detail`); // 商品详情 model |
12 | const introModel = require(`${mRoot}/intro`); // 商品尺码信息 model | 12 | const introModel = require(`${mRoot}/intro`); // 商品尺码信息 model |
13 | -const preference = require(`${mRoot}/preference`); // 商品偏好 model | 13 | +const preferenceModel = require(`${mRoot}/preference`); // 商品偏好 model |
14 | const detailRelated = require(`${mRoot}/consult-comment`); // 商品评论咨询 model | 14 | const detailRelated = require(`${mRoot}/consult-comment`); // 商品评论咨询 model |
15 | +const _ = require('lodash'); | ||
16 | + | ||
17 | +const helpers = global.yoho.helpers; | ||
15 | 18 | ||
16 | /** | 19 | /** |
17 | * 商品基本信息 | 20 | * 商品基本信息 |
@@ -34,6 +37,42 @@ exports.index = (req, res, next) => { | @@ -34,6 +37,42 @@ exports.index = (req, res, next) => { | ||
34 | uid: uid, | 37 | uid: uid, |
35 | ua: req.get('user-agent') || '' | 38 | ua: req.get('user-agent') || '' |
36 | }).then((result) => { | 39 | }).then((result) => { |
40 | + if (_.isEmpty(result)) { | ||
41 | + return next(); | ||
42 | + } | ||
43 | + res.render('detail/detail', { | ||
44 | + pageHeader: headerData, | ||
45 | + result: result, | ||
46 | + page: 'detail', | ||
47 | + title: result.goodsName, | ||
48 | + pageFooter: true | ||
49 | + }); | ||
50 | + }).catch(next); | ||
51 | +}; | ||
52 | + | ||
53 | +/** | ||
54 | + * 商品基本信息 SKN 进入 | ||
55 | + * @param {[type]} req [description] | ||
56 | + * @param {[type]} res [description] | ||
57 | + * @return {[type]} [description] | ||
58 | + */ | ||
59 | +exports.indexSkn = (req, res, next) => { | ||
60 | + if (!req.params[0]) { | ||
61 | + return next(); | ||
62 | + } | ||
63 | + let uid = req.user.uid || 0; | ||
64 | + let headerData = headerModel.setNav({ | ||
65 | + navTitle: '商品详情' | ||
66 | + }); | ||
67 | + | ||
68 | + detailModel.getProductData({ | ||
69 | + productSkn: req.params[0], | ||
70 | + uid: uid, | ||
71 | + ua: req.get('user-agent') || '' | ||
72 | + }).then((result) => { | ||
73 | + if (_.isEmpty(result)) { | ||
74 | + return next(); | ||
75 | + } | ||
37 | res.render('detail/detail', { | 76 | res.render('detail/detail', { |
38 | pageHeader: headerData, | 77 | pageHeader: headerData, |
39 | result: result, | 78 | result: result, |
@@ -71,8 +110,8 @@ exports.intro = (req, res, next) => { | @@ -71,8 +110,8 @@ exports.intro = (req, res, next) => { | ||
71 | * @param {[type]} res [description] | 110 | * @param {[type]} res [description] |
72 | * @return {[type]} [description] | 111 | * @return {[type]} [description] |
73 | */ | 112 | */ |
74 | -exports.preference = (req, res) => { | ||
75 | - preference({ | 113 | +exports.preference = (req, res, next) => { |
114 | + preferenceModel({ | ||
76 | productskn: req.query.productSkn, | 115 | productskn: req.query.productSkn, |
77 | yhchannel: req.yoho.channel, | 116 | yhchannel: req.yoho.channel, |
78 | brandId: req.query.brandId | 117 | brandId: req.query.brandId |
@@ -80,19 +119,24 @@ exports.preference = (req, res) => { | @@ -80,19 +119,24 @@ exports.preference = (req, res) => { | ||
80 | res.render('detail/preference', Object.assign({ | 119 | res.render('detail/preference', Object.assign({ |
81 | layout: false | 120 | layout: false |
82 | }, result)); | 121 | }, result)); |
83 | - }); | 122 | + }).catch(next); |
84 | }; | 123 | }; |
85 | 124 | ||
86 | /** | 125 | /** |
87 | * 购买评价页 | 126 | * 购买评价页 |
88 | */ | 127 | */ |
89 | exports.comments = (req, res, next) => { | 128 | exports.comments = (req, res, next) => { |
129 | + if (!req.query.product_id) { | ||
130 | + return next(); | ||
131 | + } | ||
132 | + | ||
90 | let headerData = headerModel.setNav({ | 133 | let headerData = headerModel.setNav({ |
91 | navTitle: '购买评价' | 134 | navTitle: '购买评价' |
92 | }); | 135 | }); |
93 | 136 | ||
94 | detailRelated.comments(req.query).then((result) => { | 137 | detailRelated.comments(req.query).then((result) => { |
95 | res.render('detail/comments', Object.assign({ | 138 | res.render('detail/comments', Object.assign({ |
139 | + title: '购买评价', | ||
96 | pageHeader: headerData, | 140 | pageHeader: headerData, |
97 | pageFooter: true | 141 | pageFooter: true |
98 | }, result)); | 142 | }, result)); |
@@ -103,12 +147,17 @@ exports.comments = (req, res, next) => { | @@ -103,12 +147,17 @@ exports.comments = (req, res, next) => { | ||
103 | * 购买咨询 | 147 | * 购买咨询 |
104 | */ | 148 | */ |
105 | exports.consults = (req, res, next) => { | 149 | exports.consults = (req, res, next) => { |
150 | + if (!req.query.product_id) { | ||
151 | + return next(); | ||
152 | + } | ||
153 | + | ||
106 | let headerData = headerModel.setNav({ | 154 | let headerData = headerModel.setNav({ |
107 | navTitle: '购买咨询' | 155 | navTitle: '购买咨询' |
108 | }); | 156 | }); |
109 | 157 | ||
110 | detailRelated.consults(req.query).then((result) => { | 158 | detailRelated.consults(req.query).then((result) => { |
111 | res.render('detail/consults', Object.assign({ | 159 | res.render('detail/consults', Object.assign({ |
160 | + title: '购买咨询', | ||
112 | pageHeader: headerData, | 161 | pageHeader: headerData, |
113 | pageFooter: true | 162 | pageFooter: true |
114 | }, result)); | 163 | }, result)); |
@@ -116,17 +165,46 @@ exports.consults = (req, res, next) => { | @@ -116,17 +165,46 @@ exports.consults = (req, res, next) => { | ||
116 | }; | 165 | }; |
117 | 166 | ||
118 | /** | 167 | /** |
168 | + * 咨询点赞 | ||
169 | + */ | ||
170 | +exports.consultUpvoteOrUseful = (req, res, next) => { | ||
171 | + let uid = req.user.uid || 0; | ||
172 | + | ||
173 | + if (!uid) { | ||
174 | + return res.json({ | ||
175 | + code: 401, | ||
176 | + message: '用户id为空', | ||
177 | + data: helpers.urlFormat('/signin.html', { | ||
178 | + refer: helpers.urlFormat('/product/detail/consults', { | ||
179 | + product_id: req.body.product_id, | ||
180 | + total: req.body.total | ||
181 | + }) | ||
182 | + }) | ||
183 | + }); | ||
184 | + } | ||
185 | + | ||
186 | + req.body.isUpvote = /upvote/.test(req.path); | ||
187 | + req.body.uid = uid; | ||
188 | + | ||
189 | + detailRelated.upvoteConsult(req.body).then((result) => { | ||
190 | + res.json(result); | ||
191 | + }).catch(next); | ||
192 | +}; | ||
193 | + | ||
194 | +/** | ||
119 | * 咨询表单页 | 195 | * 咨询表单页 |
120 | */ | 196 | */ |
121 | exports.consultform = (req, res, next) => { | 197 | exports.consultform = (req, res, next) => { |
198 | + if (!req.query.product_id) { | ||
199 | + return next(); | ||
200 | + } | ||
201 | + | ||
122 | let headerData = headerModel.setNav({ | 202 | let headerData = headerModel.setNav({ |
123 | navTitle: '我要咨询' | 203 | navTitle: '我要咨询' |
124 | }); | 204 | }); |
125 | 205 | ||
126 | - if (!req.query.product_id) { | ||
127 | - return next(); | ||
128 | - } | ||
129 | res.render('detail/consult-form', { | 206 | res.render('detail/consult-form', { |
207 | + title: '我要咨询', | ||
130 | pageHeader: headerData, | 208 | pageHeader: headerData, |
131 | productId: req.query.product_id, | 209 | productId: req.query.product_id, |
132 | formUrl: '/product/detail/consultsubmit', | 210 | formUrl: '/product/detail/consultsubmit', |
@@ -6,8 +6,9 @@ | @@ -6,8 +6,9 @@ | ||
6 | 6 | ||
7 | 'use strict'; | 7 | 'use strict'; |
8 | 8 | ||
9 | -const api = global.yoho.API; | ||
10 | const _ = require('lodash'); | 9 | const _ = require('lodash'); |
10 | +const api = global.yoho.API; | ||
11 | +const helpers = global.yoho.helpers; | ||
11 | 12 | ||
12 | /** | 13 | /** |
13 | * 获取默认咨询列表 | 14 | * 获取默认咨询列表 |
@@ -31,33 +32,6 @@ const _getCommonConsult = () => { | @@ -31,33 +32,6 @@ const _getCommonConsult = () => { | ||
31 | }; | 32 | }; |
32 | 33 | ||
33 | /** | 34 | /** |
34 | - * 处理评价列表数据 | ||
35 | - * @data {[object]} 评价列表原始数据 | ||
36 | - * @return {[object]} | ||
37 | - */ | ||
38 | -const _formatCommentsList = (data) => { | ||
39 | - let comment = { | ||
40 | - list: [], | ||
41 | - total: 0 | ||
42 | - }; | ||
43 | - | ||
44 | - if (data.length) { | ||
45 | - _.forEach(data, (value) => { | ||
46 | - comment.list.push({ | ||
47 | - userName: value.nickname, | ||
48 | - desc: `${value.color_name}/${value.size_name}`, | ||
49 | - content: value.content, | ||
50 | - time: value.create_time | ||
51 | - }); | ||
52 | - | ||
53 | - comment.total = value.total; | ||
54 | - }); | ||
55 | - } | ||
56 | - | ||
57 | - return comment; | ||
58 | -}; | ||
59 | - | ||
60 | -/** | ||
61 | * 处理咨询列表数据 | 35 | * 处理咨询列表数据 |
62 | * @data {[object]} 咨询列表原始数据 | 36 | * @data {[object]} 咨询列表原始数据 |
63 | * @return {[object]} | 37 | * @return {[object]} |
@@ -84,15 +58,15 @@ const _formatConsultsList = (data) => { | @@ -84,15 +58,15 @@ const _formatConsultsList = (data) => { | ||
84 | }; | 58 | }; |
85 | 59 | ||
86 | /** | 60 | /** |
87 | - * 获取评价数据 | 61 | + * 获取咨询数据 |
88 | * @id {[number]} 商品id | 62 | * @id {[number]} 商品id |
89 | * @page {[number]} 页码 | 63 | * @page {[number]} 页码 |
90 | - * @limit {[number]} 每页评价数量 | 64 | + * @limit {[number]} 每页咨询数量 |
91 | * @return {[object]} | 65 | * @return {[object]} |
92 | */ | 66 | */ |
93 | -const _getComments = (id, page, limit) => { | 67 | +const getConsults = (id, page, limit) => { |
94 | let params = { | 68 | let params = { |
95 | - method: 'app.comment.li', | 69 | + method: 'app.consult.li', |
96 | product_id: id, | 70 | product_id: id, |
97 | page: page ? page : 1, | 71 | page: page ? page : 1, |
98 | limit: limit ? limit : 300 | 72 | limit: limit ? limit : 300 |
@@ -103,8 +77,12 @@ const _getComments = (id, page, limit) => { | @@ -103,8 +77,12 @@ const _getComments = (id, page, limit) => { | ||
103 | }).then(result => { | 77 | }).then(result => { |
104 | let data = {}; | 78 | let data = {}; |
105 | 79 | ||
106 | - if (result.data) { | ||
107 | - Object.assign(data, _formatCommentsList(result.data)); | 80 | + if (result.data && result.data.list) { |
81 | + Object.assign(data, { | ||
82 | + list: _formatConsultsList(result.data.list), | ||
83 | + pageTotal: result.data.page_total, | ||
84 | + total: result.data.total | ||
85 | + }); | ||
108 | } | 86 | } |
109 | 87 | ||
110 | return data; | 88 | return data; |
@@ -112,34 +90,42 @@ const _getComments = (id, page, limit) => { | @@ -112,34 +90,42 @@ const _getComments = (id, page, limit) => { | ||
112 | }; | 90 | }; |
113 | 91 | ||
114 | /** | 92 | /** |
115 | - * 获取咨询数据 | ||
116 | - * @id {[number]} 商品id | ||
117 | - * @page {[number]} 页码 | ||
118 | - * @limit {[number]} 每页咨询数量 | ||
119 | - * @return {[object]} | 93 | + * 处理评论数据 |
120 | */ | 94 | */ |
121 | -const _getConsults = (id, page, limit) => { | ||
122 | - let params = { | ||
123 | - method: 'app.consult.li', | ||
124 | - product_id: id, | ||
125 | - page: page ? page : 1, | ||
126 | - limit: limit ? limit : 300 | 95 | +let _processComment = (data) => { |
96 | + let result = { | ||
97 | + commentsNum: data.pageResponse.totalCount, | ||
98 | + comments: [] | ||
127 | }; | 99 | }; |
128 | 100 | ||
129 | - return api.get('', params, { | ||
130 | - code: 200 | ||
131 | - }).then(result => { | ||
132 | - let data = {}; | ||
133 | - | ||
134 | - if (result.data && result.data.list) { | ||
135 | - Object.assign(data, { | ||
136 | - list: _formatConsultsList(result.data.list), | ||
137 | - pageTotal: result.data.page_total, | ||
138 | - total: result.data.total | 101 | + _.forEach(data.pageResponse.list, (item) => { |
102 | + result.comments.push({ | ||
103 | + userName: item.userInfo.nickName, | ||
104 | + desc: `${item.goods.color_name}/${item.goods.size_name}`, | ||
105 | + content: item.content, | ||
106 | + time: helpers.dateFormat('YYYY-MM-DD HH:mm:ss', new Date(item.createTime * 1000)) | ||
139 | }); | 107 | }); |
108 | + }); | ||
109 | + return result; | ||
110 | +}; | ||
111 | + | ||
112 | +/** | ||
113 | + * 获取评论信息 | ||
114 | + */ | ||
115 | +let getCommentInfo = (params) => { | ||
116 | + return api.get('', Object.assign({ | ||
117 | + method: 'show.productShareOrderList', | ||
118 | + limit: '1', | ||
119 | + page: '1', | ||
120 | + filterId: '7' | ||
121 | + }, params), { | ||
122 | + cache: true | ||
123 | + }).then((result) => { | ||
124 | + if (result.code === 200) { | ||
125 | + return _processComment(result.data); | ||
140 | } | 126 | } |
141 | 127 | ||
142 | - return data; | 128 | + return {}; |
143 | }); | 129 | }); |
144 | }; | 130 | }; |
145 | 131 | ||
@@ -149,14 +135,17 @@ const _getConsults = (id, page, limit) => { | @@ -149,14 +135,17 @@ const _getConsults = (id, page, limit) => { | ||
149 | * @return {[object]} | 135 | * @return {[object]} |
150 | */ | 136 | */ |
151 | let comments = (params) => { | 137 | let comments = (params) => { |
152 | - return _getComments(params.product_id, 1, 60).then(result => { | 138 | + return getCommentInfo({ |
139 | + productId: params.product_id, | ||
140 | + limit: '60' | ||
141 | + }).then(result => { | ||
153 | let data = {}; | 142 | let data = {}; |
154 | 143 | ||
155 | - if (result.list && result.list.length) { | ||
156 | - if (result.total) { | ||
157 | - _.set(data, 'pageHeader.navTitle', `购买评价(${result.total})`); | 144 | + if (result.comments && result.comments.length) { |
145 | + if (result.commentsNum) { | ||
146 | + _.set(data, 'pageHeader.navTitle', `购买评价(${result.commentsNum})`); | ||
158 | } | 147 | } |
159 | - data.comments = result.list; | 148 | + data.comments = result.comments; |
160 | } | 149 | } |
161 | 150 | ||
162 | return data; | 151 | return data; |
@@ -171,7 +160,7 @@ let comments = (params) => { | @@ -171,7 +160,7 @@ let comments = (params) => { | ||
171 | let consults = (params) => { | 160 | let consults = (params) => { |
172 | return api.all([ | 161 | return api.all([ |
173 | _getCommonConsult(), | 162 | _getCommonConsult(), |
174 | - _getConsults(params.product_id, 1, 60) | 163 | + getConsults(params.product_id, 1, 60) |
175 | ]).then(result => { | 164 | ]).then(result => { |
176 | let data = { | 165 | let data = { |
177 | link: `/product/detail/consultform?product_id=${params.product_id}` | 166 | link: `/product/detail/consultform?product_id=${params.product_id}` |
@@ -186,10 +175,20 @@ let consults = (params) => { | @@ -186,10 +175,20 @@ let consults = (params) => { | ||
186 | data.consults = result[1].list; | 175 | data.consults = result[1].list; |
187 | } | 176 | } |
188 | 177 | ||
178 | + data.showReadMore = result[1].list.length > 2; | ||
179 | + | ||
189 | return data; | 180 | return data; |
190 | }); | 181 | }); |
191 | }; | 182 | }; |
192 | 183 | ||
184 | +let upvoteConsult = (params) => { | ||
185 | + return api.get('', { | ||
186 | + method: params.isUpvote ? 'app.consult.like' : 'app.consult.useful', | ||
187 | + id: params.id, | ||
188 | + uid: params.uid | ||
189 | + }); | ||
190 | +}; | ||
191 | + | ||
193 | /** | 192 | /** |
194 | * 购买咨询列表 | 193 | * 购买咨询列表 |
195 | * @uid {[number]} 用户id | 194 | * @uid {[number]} 用户id |
@@ -214,7 +213,10 @@ let addConsult = (uid, productId, content) => { | @@ -214,7 +213,10 @@ let addConsult = (uid, productId, content) => { | ||
214 | }; | 213 | }; |
215 | 214 | ||
216 | module.exports = { | 215 | module.exports = { |
216 | + getCommentInfo, // 商品详情相关,获取评价,来自晒单 | ||
217 | comments, // 商品详情相关-购买评价 | 217 | comments, // 商品详情相关-购买评价 |
218 | consults, // 商品详情相关-购买咨询 | 218 | consults, // 商品详情相关-购买咨询 |
219 | - addConsult // 商品详情相关-添加咨询 | 219 | + addConsult, // 商品详情相关-添加咨询 |
220 | + upvoteConsult, // 咨询点赞 | ||
221 | + getConsults // 获取咨询 | ||
220 | }; | 222 | }; |
@@ -6,8 +6,10 @@ | @@ -6,8 +6,10 @@ | ||
6 | 6 | ||
7 | 'use strict'; | 7 | 'use strict'; |
8 | 8 | ||
9 | -const api = global.yoho.API; | ||
10 | const _ = require('lodash'); | 9 | const _ = require('lodash'); |
10 | +const comment = require('./consult-comment'); | ||
11 | + | ||
12 | +const api = global.yoho.API; | ||
11 | const helpers = global.yoho.helpers; | 13 | const helpers = global.yoho.helpers; |
12 | 14 | ||
13 | /** | 15 | /** |
@@ -237,47 +239,19 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -237,47 +239,19 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
237 | dest.periodOfMarket = `${origin.expectArrivalTime}月`; | 239 | dest.periodOfMarket = `${origin.expectArrivalTime}月`; |
238 | } | 240 | } |
239 | 241 | ||
240 | - // 促销信息 TODO: 换新接口 | ||
241 | - if (origin.promotionBoList) { | ||
242 | - let discountList = []; | ||
243 | - | ||
244 | - _.forEach(origin.promotionBoList, function(value) { | ||
245 | - discountList.push({ | ||
246 | - text: `【${value.promotionType}】${value.promotionTitle}` | ||
247 | - }); | ||
248 | - }); | ||
249 | - | ||
250 | - if (discountList.length) { | ||
251 | - dest.goodsDiscount = { | ||
252 | - list: discountList | ||
253 | - }; | ||
254 | - } | ||
255 | - } | ||
256 | - | ||
257 | // 商品咨询 | 242 | // 商品咨询 |
258 | dest.feedbacks = { | 243 | dest.feedbacks = { |
259 | consults: [], | 244 | consults: [], |
260 | consultsNum: 0 | 245 | consultsNum: 0 |
261 | }; | 246 | }; |
262 | 247 | ||
263 | - if (origin.consultBoWrapper) { | ||
264 | - dest.feedbacks.consultsNum = origin.consultBoWrapper.consultTotal; | ||
265 | - _.forEach(origin.consultBoWrapper.consultBoList, function(value) { | ||
266 | - dest.feedbacks.consults.push({ | ||
267 | - question: value.ask, | ||
268 | - time: value.askTime, | ||
269 | - answer: value.answer | ||
270 | - }); | ||
271 | - }); | ||
272 | - } | ||
273 | - | ||
274 | let consultParams = { | 248 | let consultParams = { |
275 | product_id: origin.id | 249 | product_id: origin.id |
276 | }; | 250 | }; |
277 | 251 | ||
278 | if (_.has(dest, 'feedbacks.consultsNum')) { | 252 | if (_.has(dest, 'feedbacks.consultsNum')) { |
279 | consultParams.total = dest.feedbacks.consultsNum; | 253 | consultParams.total = dest.feedbacks.consultsNum; |
280 | - dest.feedbacks.consultsUrl = helpers.urlFormat('/product/detail/consult', consultParams); | 254 | + dest.feedbacks.consultsUrl = helpers.urlFormat('/product/detail/consults', consultParams); |
281 | } else { | 255 | } else { |
282 | dest.feedbacks.consultsUrl = helpers.urlFormat('/product/detail/consultform', consultParams); | 256 | dest.feedbacks.consultsUrl = helpers.urlFormat('/product/detail/consultform', consultParams); |
283 | } | 257 | } |
@@ -320,13 +294,13 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -320,13 +294,13 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
320 | if (origin.goodsList) { | 294 | if (origin.goodsList) { |
321 | let goodsGroup = [], | 295 | let goodsGroup = [], |
322 | sizeName = '', | 296 | sizeName = '', |
323 | - colorList = {}, | 297 | + colorList = [], |
324 | sizeList = {}, | 298 | sizeList = {}, |
325 | allSizeList = {}, | 299 | allSizeList = {}, |
326 | colorStorageGroup = {}, | 300 | colorStorageGroup = {}, |
327 | colorStorageNum = 0; | 301 | colorStorageNum = 0; |
328 | 302 | ||
329 | - _.forEach(origin.goodsList, function(value, key) { | 303 | + _.forEach(origin.goodsList, function(value) { |
330 | if (value.status === 0) { | 304 | if (value.status === 0) { |
331 | return; | 305 | return; |
332 | } | 306 | } |
@@ -375,13 +349,13 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -375,13 +349,13 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
375 | }); | 349 | }); |
376 | 350 | ||
377 | // 颜色分组 | 351 | // 颜色分组 |
378 | - colorList[key] = { | 352 | + colorList.push({ |
379 | id: value.colorId, | 353 | id: value.colorId, |
380 | skcId: value.productSkc, | 354 | skcId: value.productSkc, |
381 | name: value.colorName, | 355 | name: value.colorName, |
382 | goodsName: value.goodsName, | 356 | goodsName: value.goodsName, |
383 | colorNum: colorStorageNum | 357 | colorNum: colorStorageNum |
384 | - }; | 358 | + }); |
385 | } | 359 | } |
386 | 360 | ||
387 | // 缩略图 | 361 | // 缩略图 |
@@ -399,10 +373,12 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -399,10 +373,12 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
399 | sizeGroup[0] = { | 373 | sizeGroup[0] = { |
400 | size: [] | 374 | size: [] |
401 | }; | 375 | }; |
402 | - _.forEach(allSizeList, function(value) { | 376 | + |
377 | + _.forEach(allSizeList, (value, key) => { | ||
378 | + | ||
403 | // 默认尺码 | 379 | // 默认尺码 |
404 | sizeGroup[0].size.push({ | 380 | sizeGroup[0].size.push({ |
405 | - name: sizeName, | 381 | + name: key, |
406 | sizeNum: _.toNumber(value.storage) > 0 ? true : false, | 382 | sizeNum: _.toNumber(value.storage) > 0 ? true : false, |
407 | id: value.id | 383 | id: value.id |
408 | }); | 384 | }); |
@@ -412,13 +388,16 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -412,13 +388,16 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
412 | }; | 388 | }; |
413 | 389 | ||
414 | // 各个颜色的尺码, 每行显示一个尺码对应的颜色 | 390 | // 各个颜色的尺码, 每行显示一个尺码对应的颜色 |
415 | - _.forEach(colorList, function(colorArr) { | ||
416 | - colorArr.colorNum = 0; | ||
417 | - if (colorStorageGroup[colorArr.skcId] && | ||
418 | - colorStorageGroup[colorArr.skcId][sizeName]) { | ||
419 | - colorArr.colorNum = colorStorageGroup[colorArr.skcId][sizeName]; | 391 | + _.forEach(colorList, (colorArr) => { |
392 | + let tempColorArr = _.cloneDeep(colorArr); | ||
393 | + | ||
394 | + if (colorStorageGroup[tempColorArr.skcId] && | ||
395 | + colorStorageGroup[tempColorArr.skcId][key]) { | ||
396 | + tempColorArr.colorNum = colorStorageGroup[tempColorArr.skcId][key]; | ||
397 | + } else { | ||
398 | + tempColorArr.colorNum = 0; | ||
420 | } | 399 | } |
421 | - colorGroup[i].color.push(colorArr); | 400 | + colorGroup[i].color.push(Object.assign({}, tempColorArr)); |
422 | }); | 401 | }); |
423 | colorGroup[i].id = value.id; | 402 | colorGroup[i].id = value.id; |
424 | 403 | ||
@@ -443,6 +422,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -443,6 +422,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
443 | ++i; | 422 | ++i; |
444 | }); | 423 | }); |
445 | 424 | ||
425 | + | ||
446 | // 商品图:多个 | 426 | // 商品图:多个 |
447 | if (goodsGroup.length > 1) { | 427 | if (goodsGroup.length > 1) { |
448 | let bannerList = []; | 428 | let bannerList = []; |
@@ -560,13 +540,44 @@ let _getPromotionInfo = (skn) => { | @@ -560,13 +540,44 @@ let _getPromotionInfo = (skn) => { | ||
560 | }); | 540 | }); |
561 | }; | 541 | }; |
562 | 542 | ||
543 | + | ||
544 | +/** | ||
545 | + * 获取默认咨询列表 | ||
546 | + */ | ||
547 | +const _getCommonConsult = () => { | ||
548 | + let params = { | ||
549 | + method: 'app.consult.common' | ||
550 | + }; | ||
551 | + | ||
552 | + return api.get('', params, { | ||
553 | + code: 200 | ||
554 | + }).then(result => { | ||
555 | + let data = {}; | ||
556 | + | ||
557 | + if (result.data) { | ||
558 | + data = result.data; | ||
559 | + } | ||
560 | + | ||
561 | + return data; | ||
562 | + }); | ||
563 | +}; | ||
564 | + | ||
563 | let getProductData = (data) => { | 565 | let getProductData = (data) => { |
564 | let finalResult; | 566 | let finalResult; |
565 | let params = { | 567 | let params = { |
566 | - productId: _.toString(data.id), | ||
567 | method: 'h5.product.data' | 568 | method: 'h5.product.data' |
568 | }; | 569 | }; |
569 | 570 | ||
571 | + if (data.id) { // 通过 productId 获取商品详情 | ||
572 | + Object.assign(params, { | ||
573 | + productId: _.toString(data.id) | ||
574 | + }); | ||
575 | + } else if (data.productSkn) { // 通过 productSkn 获取商品详情 | ||
576 | + Object.assign(params, { | ||
577 | + product_skn: _.toString(data.productSkn) | ||
578 | + }); | ||
579 | + } | ||
580 | + | ||
570 | if (!_.isEmpty(data.uid)) { | 581 | if (!_.isEmpty(data.uid)) { |
571 | params.uid = data.uid; | 582 | params.uid = data.uid; |
572 | } | 583 | } |
@@ -577,12 +588,43 @@ let getProductData = (data) => { | @@ -577,12 +588,43 @@ let getProductData = (data) => { | ||
577 | return api.get('', params, { | 588 | return api.get('', params, { |
578 | cache: true | 589 | cache: true |
579 | }).then(result => { | 590 | }).then(result => { |
580 | - return Promise.all([_getShopsInfo(result.brandId), _getPromotionInfo(result.erpProductId)]).then((info) => { | 591 | + if (result.code === 500) { |
592 | + return {}; | ||
593 | + } | ||
594 | + return Promise.all([ | ||
595 | + _getShopsInfo(result.brandId), | ||
596 | + _getPromotionInfo(result.erpProductId), | ||
597 | + comment.getCommentInfo({ | ||
598 | + productId: result.id | ||
599 | + }), | ||
600 | + _getCommonConsult(), | ||
601 | + comment.getConsults(result.id, 1, 2) | ||
602 | + ]).then((info) => { | ||
581 | result.promotionBoList = info[1]; | 603 | result.promotionBoList = info[1]; |
582 | 604 | ||
583 | finalResult = _detailDataPkg(result, data.uid, data.vipLevel, data.ua); | 605 | finalResult = _detailDataPkg(result, data.uid, data.vipLevel, data.ua); |
584 | finalResult.enterStore = info[0]; | 606 | finalResult.enterStore = info[0]; |
585 | 607 | ||
608 | + Object.assign(finalResult.feedbacks, info[2]); | ||
609 | + | ||
610 | + if (!info[4].total && !_.isEmpty(info[3]) && !_.get(info[2], 'feedbacks.consultsNum', 0)) { | ||
611 | + Object.assign(finalResult.feedbacks, { | ||
612 | + commonConsults: true, | ||
613 | + consultsNum: true, | ||
614 | + consults: _.take(info[3], 2) | ||
615 | + }); | ||
616 | + } | ||
617 | + | ||
618 | + if (info[4]) { | ||
619 | + finalResult.feedbacks.consultsNum = parseInt(info[4].total, 10); | ||
620 | + | ||
621 | + Object.assign(finalResult.feedbacks, { | ||
622 | + commonConsults: false, | ||
623 | + consultsNum: parseInt(info[4].total, 10), | ||
624 | + consults: _.take(info[4].list, 2) | ||
625 | + }); | ||
626 | + } | ||
627 | + | ||
586 | return finalResult; | 628 | return finalResult; |
587 | }); | 629 | }); |
588 | 630 |
@@ -75,9 +75,9 @@ const getSizeInfo = (sizeInfo) => { | @@ -75,9 +75,9 @@ const getSizeInfo = (sizeInfo) => { | ||
75 | dest.sizeInfo.detail.list = []; | 75 | dest.sizeInfo.detail.list = []; |
76 | 76 | ||
77 | // 参考尺码 | 77 | // 参考尺码 |
78 | - let boyReference = !_.isEmpty(sizeInfo.productExtra.boyReference); | ||
79 | - let girlReference = !_.isEmpty(sizeInfo.productExtra.girlReference); | ||
80 | - let gender = !_.isEmpty(sizeInfo.productDescBo.gender) ? sizeInfo.productDescBo.gender : 3; | 78 | + let boyReference = sizeInfo.productExtra.boyReference; |
79 | + let girlReference = sizeInfo.productExtra.girlReference; | ||
80 | + let gender = sizeInfo.productDescBo.gender ? sizeInfo.productDescBo.gender : 3; | ||
81 | let referenceName = '参考尺码'; | 81 | let referenceName = '参考尺码'; |
82 | 82 | ||
83 | if ((gender === 1 && boyReference) || (gender === 2 && girlReference)) { | 83 | if ((gender === 1 && boyReference) || (gender === 2 && girlReference)) { |
@@ -102,12 +102,14 @@ const getSizeInfo = (sizeInfo) => { | @@ -102,12 +102,14 @@ const getSizeInfo = (sizeInfo) => { | ||
102 | 102 | ||
103 | if (!_.isEmpty(sizeInfo.sizeInfoBo.sizeAttributeBos)) { | 103 | if (!_.isEmpty(sizeInfo.sizeInfoBo.sizeAttributeBos)) { |
104 | 104 | ||
105 | + // [{param: attrName}] th | ||
105 | let sizeNameList = []; | 106 | let sizeNameList = []; |
106 | 107 | ||
107 | temp = {}; | 108 | temp = {}; |
108 | temp.param = '吊牌尺码'; | 109 | temp.param = '吊牌尺码'; |
109 | sizeNameList.push(temp); | 110 | sizeNameList.push(temp); |
110 | 111 | ||
112 | + // {id: [{param: str},......]} sizeBoGroup[id][0] 属性名, sizeBoGroup[id][index] 属性值 | ||
111 | let sizeBoGroup = {}; | 113 | let sizeBoGroup = {}; |
112 | 114 | ||
113 | _.forEach(sizeInfo.sizeInfoBo.sizeAttributeBos, function(attr) { | 115 | _.forEach(sizeInfo.sizeInfoBo.sizeAttributeBos, function(attr) { |
@@ -126,13 +128,11 @@ const getSizeInfo = (sizeInfo) => { | @@ -126,13 +128,11 @@ const getSizeInfo = (sizeInfo) => { | ||
126 | 128 | ||
127 | if (boyReference && (gender === 1 || gender === 3)) { | 129 | if (boyReference && (gender === 1 || gender === 3)) { |
128 | temp = {}; | 130 | temp = {}; |
129 | - temp.param = _.isEmpty(value.boyReferSize.referenceName) ? | ||
130 | - ' ' : value.boyReferSize.referenceName; | 131 | + temp.param = value.boyReferSize.referenceName || ''; |
131 | referenceList.push(temp); | 132 | referenceList.push(temp); |
132 | } else if (girlReference && (gender === 2 || gender === 3)) { | 133 | } else if (girlReference && (gender === 2 || gender === 3)) { |
133 | temp = {}; | 134 | temp = {}; |
134 | - temp.param = _.isEmpty(value.girlReferSize.referenceName) ? | ||
135 | - ' ' : value.girlReferSize.referenceName; | 135 | + temp.param = value.girlReferSize.referenceName || ''; |
136 | referenceList.push(temp); | 136 | referenceList.push(temp); |
137 | } else { | 137 | } else { |
138 | showReference = false; | 138 | showReference = false; |
@@ -140,7 +140,7 @@ const getSizeInfo = (sizeInfo) => { | @@ -140,7 +140,7 @@ const getSizeInfo = (sizeInfo) => { | ||
140 | 140 | ||
141 | _.forEach(value.sortAttributes, function(attr) { | 141 | _.forEach(value.sortAttributes, function(attr) { |
142 | temp = {}; | 142 | temp = {}; |
143 | - temp.param = _.isEmpty(attr.sizeValue) ? ' ' : attr.sizeValue; | 143 | + temp.param = attr.sizeValue || ' '; |
144 | sizeBoGroup[attr.id].push(temp); | 144 | sizeBoGroup[attr.id].push(temp); |
145 | }); | 145 | }); |
146 | }); | 146 | }); |
@@ -149,6 +149,7 @@ const getSizeInfo = (sizeInfo) => { | @@ -149,6 +149,7 @@ const getSizeInfo = (sizeInfo) => { | ||
149 | dest.sizeInfo.detail.list[0] = {}; | 149 | dest.sizeInfo.detail.list[0] = {}; |
150 | dest.sizeInfo.detail.list[0].params = sizeNameList; | 150 | dest.sizeInfo.detail.list[0].params = sizeNameList; |
151 | if (showReference) { | 151 | if (showReference) { |
152 | + dest.sizeInfo.detail.list[1] = {}; | ||
152 | dest.sizeInfo.detail.list[1].params = referenceList; | 153 | dest.sizeInfo.detail.list[1].params = referenceList; |
153 | } | 154 | } |
154 | _.forEach(sizeBoGroup, function(value) { | 155 | _.forEach(sizeBoGroup, function(value) { |
@@ -229,7 +229,7 @@ const _getResources = (page, channel) => { | @@ -229,7 +229,7 @@ const _getResources = (page, channel) => { | ||
229 | if (result && result.code === 200) { | 229 | if (result && result.code === 200) { |
230 | return resourcesProcess(result.data); | 230 | return resourcesProcess(result.data); |
231 | } else { | 231 | } else { |
232 | - logger.error('SALE 页面资源位返回 code 不是 200'); | 232 | + logger.error('SALE content resource code no 200'); |
233 | return []; | 233 | return []; |
234 | } | 234 | } |
235 | }); | 235 | }); |
@@ -250,7 +250,7 @@ const _getBreakingSort = (yhChannel) => { | @@ -250,7 +250,7 @@ const _getBreakingSort = (yhChannel) => { | ||
250 | if (result && result.code === 200) { | 250 | if (result && result.code === 200) { |
251 | return _processBreakingSort(result.data); | 251 | return _processBreakingSort(result.data); |
252 | } else { | 252 | } else { |
253 | - logger.error('断码区分类接口返回 code 不是 200'); | 253 | + logger.error('api app.sale.getBreakingSort code no 200'); |
254 | return {}; | 254 | return {}; |
255 | } | 255 | } |
256 | }); | 256 | }); |
@@ -268,7 +268,7 @@ const getSearchData = (params, uid) => { | @@ -268,7 +268,7 @@ const getSearchData = (params, uid) => { | ||
268 | showSale: false | 268 | showSale: false |
269 | }); | 269 | }); |
270 | } else { | 270 | } else { |
271 | - logger.error('SALE 商品搜索返回 code 不是 200'); | 271 | + logger.error('api SALE product search code no 200'); |
272 | return []; | 272 | return []; |
273 | } | 273 | } |
274 | }), | 274 | }), |
@@ -276,7 +276,7 @@ const getSearchData = (params, uid) => { | @@ -276,7 +276,7 @@ const getSearchData = (params, uid) => { | ||
276 | if (result && result.code === 200) { | 276 | if (result && result.code === 200) { |
277 | return result.data.vip_info ? camelCase(result.data.vip_info) : {}; | 277 | return result.data.vip_info ? camelCase(result.data.vip_info) : {}; |
278 | } else { | 278 | } else { |
279 | - logger.error('获取用户信息返回 code 不是 200'); | 279 | + logger.error('api get user info code no 200'); |
280 | return {}; | 280 | return {}; |
281 | } | 281 | } |
282 | }) | 282 | }) |
@@ -296,7 +296,7 @@ const getFilterData = (params) => { | @@ -296,7 +296,7 @@ const getFilterData = (params) => { | ||
296 | hideSort: params.saleType === '1' | 296 | hideSort: params.saleType === '1' |
297 | }); | 297 | }); |
298 | } else { | 298 | } else { |
299 | - logger.error('SALE 商品搜索返回 code 不是 200'); | 299 | + logger.error('SALE search product code no 200'); |
300 | return []; | 300 | return []; |
301 | } | 301 | } |
302 | }); | 302 | }); |
@@ -350,7 +350,7 @@ const getDiscountData = (yhChannel) => { | @@ -350,7 +350,7 @@ const getDiscountData = (yhChannel) => { | ||
350 | list: _processDiscount(result.data) | 350 | list: _processDiscount(result.data) |
351 | }; | 351 | }; |
352 | } else { | 352 | } else { |
353 | - logger.error('折扣专场专题列表返回 code 不是 200'); | 353 | + logger.error('api discount list code no 200'); |
354 | return {}; | 354 | return {}; |
355 | } | 355 | } |
356 | }); | 356 | }); |
@@ -383,7 +383,7 @@ const getDiscountDetailData = (id, yhChannel) => { | @@ -383,7 +383,7 @@ const getDiscountDetailData = (id, yhChannel) => { | ||
383 | } | 383 | } |
384 | }; | 384 | }; |
385 | } else { | 385 | } else { |
386 | - logger.error('折扣专场专题详情返回 code 不是 200'); | 386 | + logger.error('discount detail code no 200'); |
387 | return {}; | 387 | return {}; |
388 | } | 388 | } |
389 | }); | 389 | }); |
@@ -28,13 +28,18 @@ const recommendForYou = require(`${cRoot}/recommend-for-you`); | @@ -28,13 +28,18 @@ const recommendForYou = require(`${cRoot}/recommend-for-you`); | ||
28 | 28 | ||
29 | // /pro_136349_455445/HEARTSOFARMianMaShuJiaoXiuXianKuPS1684.html | 29 | // /pro_136349_455445/HEARTSOFARMianMaShuJiaoXiuXianKuPS1684.html |
30 | router.get(/\/pro_([\d]+)_([\d]+)\/(.*)/, detail.index); // 商品详情页 | 30 | router.get(/\/pro_([\d]+)_([\d]+)\/(.*)/, detail.index); // 商品详情页 |
31 | +// /show_51047967.html | ||
32 | +router.get(/\/show_([\d]+)/, detail.indexSkn); // 商品详情页 SKN 进入 | ||
31 | router.get('/detail/intro/:productskn', detail.intro); // 商品内嵌页 | 33 | router.get('/detail/intro/:productskn', detail.intro); // 商品内嵌页 |
32 | router.get('/detail/preference', detail.preference); // 为你优选 | 34 | router.get('/detail/preference', detail.preference); // 为你优选 |
33 | router.get('/detail/consults', detail.consults); // 商品咨询页 | 35 | router.get('/detail/consults', detail.consults); // 商品咨询页 |
34 | router.get('/detail/consultform', auth, detail.consultform); // 商品咨询表单页 | 36 | router.get('/detail/consultform', auth, detail.consultform); // 商品咨询表单页 |
35 | -router.get('/detail/comments', detail.comments); | 37 | +router.get('/detail/comments', detail.comments); // 商品评价 |
36 | router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口 | 38 | router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口 |
37 | 39 | ||
40 | +router.post('/detail/consultupvote', detail.consultUpvoteOrUseful); // 商品咨询提交接口 | ||
41 | +router.post('/detail/consultuseful', detail.consultUpvoteOrUseful); // 商品咨询提交接口 | ||
42 | + | ||
38 | router.get('/sale', sale.index); | 43 | router.get('/sale', sale.index); |
39 | router.get('/sale/discount', sale.discount); | 44 | router.get('/sale/discount', sale.discount); |
40 | router.get('/sale/discount/detail', sale.discountDetail); | 45 | router.get('/sale/discount/detail', sale.discountDetail); |
1 | <ul id="nav-tab" class="nav-tab clearfix"> | 1 | <ul id="nav-tab" class="nav-tab clearfix"> |
2 | <li class="comment-nav tap-hightlight">商品评价(<span class="comments-num">{{commentsNum}}</span>)</li> | 2 | <li class="comment-nav tap-hightlight">商品评价(<span class="comments-num">{{commentsNum}}</span>)</li> |
3 | + {{#if commonConsults}} | ||
4 | + <li class="consult-nav tap-hightlight">常见问题</li> | ||
5 | + {{^}} | ||
3 | <li class="consult-nav tap-hightlight">购买咨询(<span class="consults-num">{{consultsNum}}</span>)</li> | 6 | <li class="consult-nav tap-hightlight">购买咨询(<span class="consults-num">{{consultsNum}}</span>)</li> |
7 | + {{/if}} | ||
4 | </ul> | 8 | </ul> |
5 | <div id="feedback-content" > | 9 | <div id="feedback-content" > |
6 | <div class="comment-content content "> | 10 | <div class="comment-content content "> |
@@ -34,9 +34,9 @@ module.exports = { | @@ -34,9 +34,9 @@ module.exports = { | ||
34 | useOneapm: false, | 34 | useOneapm: false, |
35 | useCache: false, | 35 | useCache: false, |
36 | memcache: { | 36 | memcache: { |
37 | - master: ['192.168.102.222:12111'], | ||
38 | - slave: ['192.168.102.222:12111'], | ||
39 | - session: ['192.168.102.222:12111'], | 37 | + master: ['192.168.102.205:12111'], |
38 | + slave: ['192.168.102.205:12111'], | ||
39 | + session: ['192.168.102.205:12111'], | ||
40 | timeout: 1000, | 40 | timeout: 1000, |
41 | retries: 0 | 41 | retries: 0 |
42 | }, | 42 | }, |
@@ -53,7 +53,6 @@ module.exports = { | @@ -53,7 +53,6 @@ module.exports = { | ||
53 | handleExceptions: true | 53 | handleExceptions: true |
54 | }, | 54 | }, |
55 | udp: { // send by udp | 55 | udp: { // send by udp |
56 | - measurement: 'yohobuywap_node_log', | ||
57 | level: 'debug', // logger level | 56 | level: 'debug', // logger level |
58 | host: '192.168.102.162', // influxdb host | 57 | host: '192.168.102.162', // influxdb host |
59 | port: '4444' // influxdb port | 58 | port: '4444' // influxdb port |
@@ -80,9 +79,9 @@ if (isProduction) { | @@ -80,9 +79,9 @@ if (isProduction) { | ||
80 | service: 'http://service.yoho.yohoops.org/' | 79 | service: 'http://service.yoho.yohoops.org/' |
81 | }, | 80 | }, |
82 | memcache: { | 81 | memcache: { |
83 | - master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111'], | ||
84 | - slave: ['memcache1.yohoops.org:12112', 'memcache2.yohoops.org:12112'], | ||
85 | - session: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111'], | 82 | + master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'], |
83 | + slave: ['memcache1.yohoops.org:12112', 'memcache2.yohoops.org:12112', 'memcache3.yohoops.org:12112'], | ||
84 | + session: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'], | ||
86 | timeout: 1000, | 85 | timeout: 1000, |
87 | retries: 0 | 86 | retries: 0 |
88 | }, | 87 | }, |
@@ -56,7 +56,7 @@ | @@ -56,7 +56,7 @@ | ||
56 | "uuid": "^2.0.2", | 56 | "uuid": "^2.0.2", |
57 | "winston": "^2.2.0", | 57 | "winston": "^2.2.0", |
58 | "winston-daily-rotate-file": "^1.1.4", | 58 | "winston-daily-rotate-file": "^1.1.4", |
59 | - "yoho-node-lib": "0.0.31" | 59 | + "yoho-node-lib": "0.0.32" |
60 | }, | 60 | }, |
61 | "devDependencies": { | 61 | "devDependencies": { |
62 | "autoprefixer": "^6.3.7", | 62 | "autoprefixer": "^6.3.7", |
@@ -100,7 +100,7 @@ | @@ -100,7 +100,7 @@ | ||
100 | "yoho-jquery": "^2.2.4", | 100 | "yoho-jquery": "^2.2.4", |
101 | "yoho-jquery-lazyload": "^1.9.7", | 101 | "yoho-jquery-lazyload": "^1.9.7", |
102 | "yoho-mlellipsis": "0.0.3", | 102 | "yoho-mlellipsis": "0.0.3", |
103 | - "yoho-node-lib": "0.0.31", | 103 | + "yoho-node-lib": "0.0.32", |
104 | "yoho-swiper": "^3.3.1" | 104 | "yoho-swiper": "^3.3.1" |
105 | } | 105 | } |
106 | } | 106 | } |
@@ -41,6 +41,7 @@ var navtabEle = document.getElementById('nav-tab'), | @@ -41,6 +41,7 @@ var navtabEle = document.getElementById('nav-tab'), | ||
41 | $('#feedback-content .consult-content').removeClass('hide'); | 41 | $('#feedback-content .consult-content').removeClass('hide'); |
42 | } | 42 | } |
43 | 43 | ||
44 | + $('.goods-consults .consult-item:lt(2)').removeClass('hide'); | ||
44 | }()); | 45 | }()); |
45 | 46 | ||
46 | if (navtabHammer) { | 47 | if (navtabHammer) { |
@@ -91,8 +92,7 @@ if ($('.goods-consults-page').length > 0) { | @@ -91,8 +92,7 @@ if ($('.goods-consults-page').length > 0) { | ||
91 | if (readmoreHammer) { | 92 | if (readmoreHammer) { |
92 | readmoreHammer.on('tap', function() { | 93 | readmoreHammer.on('tap', function() { |
93 | $('.readmore').hide(); | 94 | $('.readmore').hide(); |
94 | - $('.goods-consults.customer-consults').removeClass('customer-consults'); | ||
95 | - | 95 | + $('.goods-consults').find('.consult-item').removeClass('hide'); |
96 | return false; | 96 | return false; |
97 | }); | 97 | }); |
98 | } | 98 | } |
@@ -47,28 +47,27 @@ function hiddenTips($ele) { | @@ -47,28 +47,27 @@ function hiddenTips($ele) { | ||
47 | // } | 47 | // } |
48 | // } | 48 | // } |
49 | 49 | ||
50 | -function wrapElements(selector, count) { | ||
51 | - var elArr = null; | 50 | +// function wrapElements(selector, count) { |
51 | +// var elArr = null; | ||
52 | 52 | ||
53 | - $(selector).each(function(idx) { | ||
54 | - elArr = $(selector).slice(idx, idx + count); | 53 | +// $(selector).each(function(idx) { |
54 | +// elArr = $(selector).slice(idx, idx + count); | ||
55 | 55 | ||
56 | - if (elArr.length === count && idx % count === 0) { | ||
57 | - $(elArr).wrapAll($('<div class="js-wraper"></div>')); | ||
58 | - } | ||
59 | - }); | ||
60 | -} | 56 | +// if (elArr.length === count && idx % count === 0) { |
57 | +// $(elArr).wrapAll($('<div class="js-wraper"></div>')); | ||
58 | +// } | ||
59 | +// }); | ||
60 | +// } | ||
61 | 61 | ||
62 | 62 | ||
63 | 63 | ||
64 | function search() { | 64 | function search() { |
65 | - if (searching || end) { | 65 | + if (searching || end || !introUrl) { |
66 | return; | 66 | return; |
67 | } | 67 | } |
68 | searching = true; | 68 | searching = true; |
69 | 69 | ||
70 | // alert($('#reference-swiper-container .swiper-wrapper').width()); | 70 | // alert($('#reference-swiper-container .swiper-wrapper').width()); |
71 | - | ||
72 | loading.showLoadingMask(); | 71 | loading.showLoadingMask(); |
73 | 72 | ||
74 | $.ajax({ | 73 | $.ajax({ |
@@ -98,7 +97,7 @@ function search() { | @@ -98,7 +97,7 @@ function search() { | ||
98 | // if (!isFlexSupport()) { | 97 | // if (!isFlexSupport()) { |
99 | // $('.detail .column').removeClass('column').addClass('oldbox'); | 98 | // $('.detail .column').removeClass('column').addClass('oldbox'); |
100 | // } | 99 | // } |
101 | - wrapElements('.detail .column', 2); | 100 | + // wrapElements('.detail .column', 2); |
102 | searching = false; | 101 | searching = false; |
103 | end = true; | 102 | end = true; |
104 | loading.hideLoadingMask(); | 103 | loading.hideLoadingMask(); |
@@ -56,26 +56,28 @@ $basicBtnC: #eb0313; | @@ -56,26 +56,28 @@ $basicBtnC: #eb0313; | ||
56 | 56 | ||
57 | &.table { | 57 | &.table { |
58 | width: 100%; | 58 | width: 100%; |
59 | - | ||
60 | - .js-wraper { | ||
61 | - display: flex; | ||
62 | - flex-wrap: wrap; | ||
63 | - justify-content: flex-start; | ||
64 | - } | 59 | + overflow: hidden; |
65 | 60 | ||
66 | .column { | 61 | .column { |
67 | - display: flex; | ||
68 | - flex-basis: 49.9%; | ||
69 | - align-items: center; | ||
70 | box-sizing: border-box; | 62 | box-sizing: border-box; |
71 | padding: 6px 3%; | 63 | padding: 6px 3%; |
72 | width: 49.9%; | 64 | width: 49.9%; |
73 | border: 1px solid #fff; | 65 | border: 1px solid #fff; |
74 | background-color: $tableCellC; | 66 | background-color: $tableCellC; |
75 | - word-wrap: break-word; | 67 | + text-overflow: ellipsis; |
68 | + overflow: hidden; | ||
69 | + white-space: nowrap; | ||
76 | font-size: 24px; | 70 | font-size: 24px; |
77 | } | 71 | } |
78 | 72 | ||
73 | + .column:nth-child(2n+1) { | ||
74 | + float: left; | ||
75 | + } | ||
76 | + | ||
77 | + .column:nth-child(2n+2) { | ||
78 | + float: right; | ||
79 | + } | ||
80 | + | ||
79 | .oldbox { | 81 | .oldbox { |
80 | float: left; | 82 | float: left; |
81 | overflow: hidden; | 83 | overflow: hidden; |
@@ -284,7 +286,7 @@ $basicBtnC: #eb0313; | @@ -284,7 +286,7 @@ $basicBtnC: #eb0313; | ||
284 | .limit-sale { | 286 | .limit-sale { |
285 | position: absolute; | 287 | position: absolute; |
286 | top: 50%; | 288 | top: 50%; |
287 | - right: 84px; | 289 | + right: 24px; |
288 | margin-top: -24px; | 290 | margin-top: -24px; |
289 | padding: 4px 20px; | 291 | padding: 4px 20px; |
290 | height: 48px; | 292 | height: 48px; |
@@ -384,13 +386,13 @@ $basicBtnC: #eb0313; | @@ -384,13 +386,13 @@ $basicBtnC: #eb0313; | ||
384 | text-align: left; | 386 | text-align: left; |
385 | 387 | ||
386 | .vip-img { | 388 | .vip-img { |
387 | - background: resolve('product/silver.png') no-repeat; | 389 | + background: resolve("product/silver.png") no-repeat; |
388 | } | 390 | } |
389 | } | 391 | } |
390 | 392 | ||
391 | &:nth-child(2) { | 393 | &:nth-child(2) { |
392 | .vip-img { | 394 | .vip-img { |
393 | - background: resolve('product/golden.png') no-repeat; | 395 | + background: resolve("product/golden.png") no-repeat; |
394 | } | 396 | } |
395 | } | 397 | } |
396 | 398 | ||
@@ -398,7 +400,7 @@ $basicBtnC: #eb0313; | @@ -398,7 +400,7 @@ $basicBtnC: #eb0313; | ||
398 | text-align: right; | 400 | text-align: right; |
399 | 401 | ||
400 | .vip-img { | 402 | .vip-img { |
401 | - background: resolve('product/platinum.png') no-repeat; | 403 | + background: resolve("product/platinum.png") no-repeat; |
402 | } | 404 | } |
403 | } | 405 | } |
404 | } | 406 | } |
@@ -707,23 +709,26 @@ $basicBtnC: #eb0313; | @@ -707,23 +709,26 @@ $basicBtnC: #eb0313; | ||
707 | 709 | ||
708 | a { | 710 | a { |
709 | display: inline-block; | 711 | display: inline-block; |
712 | + } | ||
710 | 713 | ||
711 | - &.num-incart { | 714 | + .num-incart { |
715 | + position: relative; | ||
712 | color: #444; | 716 | color: #444; |
713 | font-size: 47px; | 717 | font-size: 47px; |
714 | } | 718 | } |
715 | 719 | ||
716 | - &.favorite { | 720 | + .favorite { |
717 | color: #ccc; | 721 | color: #ccc; |
718 | font-size: 34px; | 722 | font-size: 34px; |
723 | + background-color: transparent; | ||
719 | } | 724 | } |
720 | 725 | ||
721 | - &.favorite.liked { | 726 | + .favorite.liked { |
722 | color: $basicBtnC; | 727 | color: $basicBtnC; |
723 | } | 728 | } |
724 | 729 | ||
725 | - &.addto-cart, | ||
726 | - &.sold-out { | 730 | + .addto-cart, |
731 | + .sold-out { | ||
727 | margin: 0 100px 0 115px; | 732 | margin: 0 100px 0 115px; |
728 | width: 260px; | 733 | width: 260px; |
729 | height: 80px; | 734 | height: 80px; |
@@ -734,25 +739,23 @@ $basicBtnC: #eb0313; | @@ -734,25 +739,23 @@ $basicBtnC: #eb0313; | ||
734 | line-height: 80px; | 739 | line-height: 80px; |
735 | } | 740 | } |
736 | 741 | ||
737 | - &.sold-out { | ||
738 | - background-color: #f58189; | ||
739 | - } | 742 | + .sold-out { |
743 | + background-color: #ccc; | ||
740 | } | 744 | } |
741 | 745 | ||
742 | .num-tag { | 746 | .num-tag { |
743 | position: absolute; | 747 | position: absolute; |
744 | top: 0; | 748 | top: 0; |
745 | - left: 48px; | 749 | + right: -15px; |
746 | display: block; | 750 | display: block; |
747 | - width: 72px; | ||
748 | - height: 72px; | 751 | + width: 30px; |
752 | + height: 30px; | ||
749 | border-radius: 50%; | 753 | border-radius: 50%; |
750 | background: $basicBtnC; | 754 | background: $basicBtnC; |
751 | color: #fff; | 755 | color: #fff; |
752 | text-align: center; | 756 | text-align: center; |
753 | - font-size: 40px; | ||
754 | - line-height: 72px; | ||
755 | - transform: scale(0.5); | 757 | + font-size: 20px; |
758 | + line-height: 30px; | ||
756 | 759 | ||
757 | &.hide { | 760 | &.hide { |
758 | display: none; | 761 | display: none; |
@@ -768,3 +771,7 @@ $basicBtnC: #eb0313; | @@ -768,3 +771,7 @@ $basicBtnC: #eb0313; | ||
768 | top: 40%; | 771 | top: 40%; |
769 | } | 772 | } |
770 | } | 773 | } |
774 | + | ||
775 | +iframe { | ||
776 | + display: none; | ||
777 | +} |
@@ -4,10 +4,8 @@ | @@ -4,10 +4,8 @@ | ||
4 | padding-bottom: 20px; | 4 | padding-bottom: 20px; |
5 | 5 | ||
6 | .service { | 6 | .service { |
7 | - margin-left: 50px; | ||
8 | - width: 494px; | ||
9 | height: 28px; | 7 | height: 28px; |
10 | - background: resolve('product/service.png') no-repeat; | 8 | + background: resolve("product/service.png") no-repeat; |
11 | background-size: cover; | 9 | background-size: cover; |
12 | } | 10 | } |
13 | 11 |
-
Please register or login to post a comment