Authored by 梁志锋

merger 商品详情页

@@ -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
@@ -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,9 @@ exports.index = (req, res, next) => { @@ -34,6 +37,9 @@ 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 + }
37 res.render('detail/detail', { 43 res.render('detail/detail', {
38 pageHeader: headerData, 44 pageHeader: headerData,
39 result: result, 45 result: result,
@@ -71,8 +77,8 @@ exports.intro = (req, res, next) => { @@ -71,8 +77,8 @@ exports.intro = (req, res, next) => {
71 * @param {[type]} res [description] 77 * @param {[type]} res [description]
72 * @return {[type]} [description] 78 * @return {[type]} [description]
73 */ 79 */
74 -exports.preference = (req, res) => {  
75 - preference({ 80 +exports.preference = (req, res, next) => {
  81 + preferenceModel({
76 productskn: req.query.productSkn, 82 productskn: req.query.productSkn,
77 yhchannel: req.yoho.channel, 83 yhchannel: req.yoho.channel,
78 brandId: req.query.brandId 84 brandId: req.query.brandId
@@ -80,19 +86,24 @@ exports.preference = (req, res) => { @@ -80,19 +86,24 @@ exports.preference = (req, res) => {
80 res.render('detail/preference', Object.assign({ 86 res.render('detail/preference', Object.assign({
81 layout: false 87 layout: false
82 }, result)); 88 }, result));
83 - }); 89 + }).catch(next);
84 }; 90 };
85 91
86 /** 92 /**
87 * 购买评价页 93 * 购买评价页
88 */ 94 */
89 exports.comments = (req, res, next) => { 95 exports.comments = (req, res, next) => {
  96 + if (!req.query.product_id) {
  97 + return next();
  98 + }
  99 +
90 let headerData = headerModel.setNav({ 100 let headerData = headerModel.setNav({
91 navTitle: '购买评价' 101 navTitle: '购买评价'
92 }); 102 });
93 103
94 detailRelated.comments(req.query).then((result) => { 104 detailRelated.comments(req.query).then((result) => {
95 res.render('detail/comments', Object.assign({ 105 res.render('detail/comments', Object.assign({
  106 + title: '购买评价',
96 pageHeader: headerData, 107 pageHeader: headerData,
97 pageFooter: true 108 pageFooter: true
98 }, result)); 109 }, result));
@@ -103,12 +114,17 @@ exports.comments = (req, res, next) => { @@ -103,12 +114,17 @@ exports.comments = (req, res, next) => {
103 * 购买咨询 114 * 购买咨询
104 */ 115 */
105 exports.consults = (req, res, next) => { 116 exports.consults = (req, res, next) => {
  117 + if (!req.query.product_id) {
  118 + return next();
  119 + }
  120 +
106 let headerData = headerModel.setNav({ 121 let headerData = headerModel.setNav({
107 navTitle: '购买咨询' 122 navTitle: '购买咨询'
108 }); 123 });
109 124
110 detailRelated.consults(req.query).then((result) => { 125 detailRelated.consults(req.query).then((result) => {
111 res.render('detail/consults', Object.assign({ 126 res.render('detail/consults', Object.assign({
  127 + title: '购买咨询',
112 pageHeader: headerData, 128 pageHeader: headerData,
113 pageFooter: true 129 pageFooter: true
114 }, result)); 130 }, result));
@@ -116,17 +132,46 @@ exports.consults = (req, res, next) => { @@ -116,17 +132,46 @@ exports.consults = (req, res, next) => {
116 }; 132 };
117 133
118 /** 134 /**
  135 + * 咨询点赞
  136 + */
  137 +exports.consultUpvoteOrUseful = (req, res, next) => {
  138 + let uid = req.user.uid || 0;
  139 +
  140 + if (!uid) {
  141 + return res.json({
  142 + code: 401,
  143 + message: '用户id为空',
  144 + data: helpers.urlFormat('/signin.html', {
  145 + refer: helpers.urlFormat('/product/detail/consults', {
  146 + product_id: req.body.product_id,
  147 + total: req.body.total
  148 + })
  149 + })
  150 + });
  151 + }
  152 +
  153 + req.body.isUpvote = /upvote/.test(req.path);
  154 + req.body.uid = uid;
  155 +
  156 + detailRelated.upvoteConsult(req.body).then((result) => {
  157 + res.json(result);
  158 + }).catch(next);
  159 +};
  160 +
  161 +/**
119 * 咨询表单页 162 * 咨询表单页
120 */ 163 */
121 exports.consultform = (req, res, next) => { 164 exports.consultform = (req, res, next) => {
  165 + if (!req.query.product_id) {
  166 + return next();
  167 + }
  168 +
122 let headerData = headerModel.setNav({ 169 let headerData = headerModel.setNav({
123 navTitle: '我要咨询' 170 navTitle: '我要咨询'
124 }); 171 });
125 172
126 - if (!req.query.product_id) {  
127 - return next();  
128 - }  
129 res.render('detail/consult-form', { 173 res.render('detail/consult-form', {
  174 + title: '我要咨询',
130 pageHeader: headerData, 175 pageHeader: headerData,
131 productId: req.query.product_id, 176 productId: req.query.product_id,
132 formUrl: '/product/detail/consultsubmit', 177 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,34 +58,6 @@ const _formatConsultsList = (data) => { @@ -84,34 +58,6 @@ const _formatConsultsList = (data) => {
84 }; 58 };
85 59
86 /** 60 /**
87 - * 获取评价数据  
88 - * @id {[number]} 商品id  
89 - * @page {[number]} 页码  
90 - * @limit {[number]} 每页评价数量  
91 - * @return {[object]}  
92 - */  
93 -const _getComments = (id, page, limit) => {  
94 - let params = {  
95 - method: 'app.comment.li',  
96 - product_id: id,  
97 - page: page ? page : 1,  
98 - limit: limit ? limit : 300  
99 - };  
100 -  
101 - return api.get('', params, {  
102 - code: 200  
103 - }).then(result => {  
104 - let data = {};  
105 -  
106 - if (result.data) {  
107 - Object.assign(data, _formatCommentsList(result.data));  
108 - }  
109 -  
110 - return data;  
111 - });  
112 -};  
113 -  
114 -/**  
115 * 获取咨询数据 61 * 获取咨询数据
116 * @id {[number]} 商品id 62 * @id {[number]} 商品id
117 * @page {[number]} 页码 63 * @page {[number]} 页码
@@ -144,19 +90,62 @@ const _getConsults = (id, page, limit) => { @@ -144,19 +90,62 @@ const _getConsults = (id, page, limit) => {
144 }; 90 };
145 91
146 /** 92 /**
  93 + * 处理评论数据
  94 + */
  95 +let _processComment = (data) => {
  96 + let result = {
  97 + commentsNum: data.pageResponse.totalCount,
  98 + comments: []
  99 + };
  100 +
  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))
  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);
  126 + }
  127 +
  128 + return {};
  129 + });
  130 +};
  131 +
  132 +/**
147 * 购买评价列表 133 * 购买评价列表
148 * @param {[object]} 查询参数 134 * @param {[object]} 查询参数
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;
@@ -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,9 @@ let addConsult = (uid, productId, content) => { @@ -214,7 +213,9 @@ 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 // 咨询点赞
220 }; 221 };
@@ -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,23 +239,6 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { @@ -237,23 +239,6 @@ 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: [],
@@ -277,7 +262,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { @@ -277,7 +262,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
277 262
278 if (_.has(dest, 'feedbacks.consultsNum')) { 263 if (_.has(dest, 'feedbacks.consultsNum')) {
279 consultParams.total = dest.feedbacks.consultsNum; 264 consultParams.total = dest.feedbacks.consultsNum;
280 - dest.feedbacks.consultsUrl = helpers.urlFormat('/product/detail/consult', consultParams); 265 + dest.feedbacks.consultsUrl = helpers.urlFormat('/product/detail/consults', consultParams);
281 } else { 266 } else {
282 dest.feedbacks.consultsUrl = helpers.urlFormat('/product/detail/consultform', consultParams); 267 dest.feedbacks.consultsUrl = helpers.urlFormat('/product/detail/consultform', consultParams);
283 } 268 }
@@ -367,7 +352,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { @@ -367,7 +352,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
367 }; 352 };
368 353
369 allSizeList[sizeName] = (allSizeList[sizeName] === null || 354 allSizeList[sizeName] = (allSizeList[sizeName] === null ||
370 - typeof allSizeList[sizeName] === 'undefined') ? build : 355 + typeof allSizeList[sizeName] === 'undefined') ? build :
371 allSizeList[sizeName]; 356 allSizeList[sizeName];
372 357
373 colorStorageNum += parseInt(size.goodsSizeStorageNum, 10); 358 colorStorageNum += parseInt(size.goodsSizeStorageNum, 10);
@@ -399,10 +384,10 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { @@ -399,10 +384,10 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
399 sizeGroup[0] = { 384 sizeGroup[0] = {
400 size: [] 385 size: []
401 }; 386 };
402 - _.forEach(allSizeList, function(value) { 387 + _.forEach(allSizeList, function(value, key) {
403 // 默认尺码 388 // 默认尺码
404 sizeGroup[0].size.push({ 389 sizeGroup[0].size.push({
405 - name: sizeName, 390 + name: key,
406 sizeNum: _.toNumber(value.storage) > 0 ? true : false, 391 sizeNum: _.toNumber(value.storage) > 0 ? true : false,
407 id: value.id 392 id: value.id
408 }); 393 });
@@ -415,10 +400,10 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { @@ -415,10 +400,10 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
415 _.forEach(colorList, function(colorArr) { 400 _.forEach(colorList, function(colorArr) {
416 colorArr.colorNum = 0; 401 colorArr.colorNum = 0;
417 if (colorStorageGroup[colorArr.skcId] && 402 if (colorStorageGroup[colorArr.skcId] &&
418 - colorStorageGroup[colorArr.skcId][sizeName]) {  
419 - colorArr.colorNum = colorStorageGroup[colorArr.skcId][sizeName]; 403 + colorStorageGroup[colorArr.skcId][key]) {
  404 + colorArr.colorNum = colorStorageGroup[colorArr.skcId][key];
420 } 405 }
421 - colorGroup[i].color.push(colorArr); 406 + colorGroup[i].color.push(Object.assign({}, colorArr));
422 }); 407 });
423 colorGroup[i].id = value.id; 408 colorGroup[i].id = value.id;
424 409
@@ -443,6 +428,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { @@ -443,6 +428,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
443 ++i; 428 ++i;
444 }); 429 });
445 430
  431 +
446 // 商品图:多个 432 // 商品图:多个
447 if (goodsGroup.length > 1) { 433 if (goodsGroup.length > 1) {
448 let bannerList = []; 434 let bannerList = [];
@@ -492,7 +478,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { @@ -492,7 +478,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
492 if (origin.isLimitBuy === 'Y') { 478 if (origin.isLimitBuy === 'Y') {
493 // 是否开售 479 // 是否开售
494 let isBeginSale = (origin.saleStatus !== null && typeof origin.saleStatus !== 'undefined' && 480 let isBeginSale = (origin.saleStatus !== null && typeof origin.saleStatus !== 'undefined' &&
495 - origin.saleStatus === 1); 481 + origin.saleStatus === 1);
496 482
497 // 限购商品有关的展示状态 483 // 限购商品有关的展示状态
498 let showStatus = 1; 484 let showStatus = 1;
@@ -560,6 +546,28 @@ let _getPromotionInfo = (skn) => { @@ -560,6 +546,28 @@ let _getPromotionInfo = (skn) => {
560 }); 546 });
561 }; 547 };
562 548
  549 +
  550 +/**
  551 + * 获取默认咨询列表
  552 + */
  553 +const _getCommonConsult = () => {
  554 + let params = {
  555 + method: 'app.consult.common'
  556 + };
  557 +
  558 + return api.get('', params, {
  559 + code: 200
  560 + }).then(result => {
  561 + let data = {};
  562 +
  563 + if (result.data) {
  564 + data = result.data;
  565 + }
  566 +
  567 + return data;
  568 + });
  569 +};
  570 +
563 let getProductData = (data) => { 571 let getProductData = (data) => {
564 let finalResult; 572 let finalResult;
565 let params = { 573 let params = {
@@ -577,12 +585,32 @@ let getProductData = (data) => { @@ -577,12 +585,32 @@ let getProductData = (data) => {
577 return api.get('', params, { 585 return api.get('', params, {
578 cache: true 586 cache: true
579 }).then(result => { 587 }).then(result => {
580 - return Promise.all([_getShopsInfo(result.brandId), _getPromotionInfo(result.erpProductId)]).then((info) => { 588 + if (result.code === 500) {
  589 + return {};
  590 + }
  591 + return Promise.all([
  592 + _getShopsInfo(result.brandId),
  593 + _getPromotionInfo(result.erpProductId),
  594 + comment.getCommentInfo({
  595 + productId: result.id
  596 + }),
  597 + _getCommonConsult()
  598 + ]).then((info) => {
581 result.promotionBoList = info[1]; 599 result.promotionBoList = info[1];
582 600
583 finalResult = _detailDataPkg(result, data.uid, data.vipLevel, data.ua); 601 finalResult = _detailDataPkg(result, data.uid, data.vipLevel, data.ua);
584 finalResult.enterStore = info[0]; 602 finalResult.enterStore = info[0];
585 603
  604 + Object.assign(finalResult.feedbacks, info[2]);
  605 +
  606 + if (!_.isEmpty(info[3]) && !_.get(info[2], 'feedbacks.consultsNum', 0)) {
  607 + Object.assign(finalResult.feedbacks, {
  608 + commonConsults: true,
  609 + consultsNum: true,
  610 + consults: _.take(info[3], 2)
  611 + });
  612 + }
  613 +
586 return finalResult; 614 return finalResult;
587 }); 615 });
588 616
@@ -32,9 +32,12 @@ router.get('/detail/intro/:productskn', detail.intro); // 商品内嵌页 @@ -32,9 +32,12 @@ router.get('/detail/intro/:productskn', detail.intro); // 商品内嵌页
32 router.get('/detail/preference', detail.preference); // 为你优选 32 router.get('/detail/preference', detail.preference); // 为你优选
33 router.get('/detail/consults', detail.consults); // 商品咨询页 33 router.get('/detail/consults', detail.consults); // 商品咨询页
34 router.get('/detail/consultform', auth, detail.consultform); // 商品咨询表单页 34 router.get('/detail/consultform', auth, detail.consultform); // 商品咨询表单页
35 -router.get('/detail/comments', detail.comments); 35 +router.get('/detail/comments', detail.comments); // 商品评价
36 router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口 36 router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口
37 37
  38 +router.post('/detail/consultupvote', detail.consultUpvoteOrUseful); // 商品咨询提交接口
  39 +router.post('/detail/consultuseful', detail.consultUpvoteOrUseful); // 商品咨询提交接口
  40 +
38 router.get('/sale', sale.index); 41 router.get('/sale', sale.index);
39 router.get('/sale/discount', sale.discount); 42 router.get('/sale/discount', sale.discount);
40 router.get('/sale/discount/detail', sale.discountDetail); 43 router.get('/sale/discount/detail', sale.discountDetail);
@@ -9,8 +9,8 @@ @@ -9,8 +9,8 @@
9 </div> 9 </div>
10 {{/ comments}} 10 {{/ comments}}
11 </div> 11 </div>
12 - 12 +
13 {{#if loadmore}} 13 {{#if loadmore}}
14 <input id="loadMoreUrl" type="hidden" value="{{loadMoreUrl}}"> 14 <input id="loadMoreUrl" type="hidden" value="{{loadMoreUrl}}">
15 {{/if}} 15 {{/if}}
16 -</div>  
  16 +</div>
@@ -66,4 +66,4 @@ @@ -66,4 +66,4 @@
66 {{/ faq}} 66 {{/ faq}}
67 </div> 67 </div>
68 {{/if}} 68 {{/if}}
69 -</div>  
  69 +</div>
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 - <li class="consult-nav tap-hightlight">购买咨询(<span class="consults-num">{{consultsNum}}</span>)</li> 3 + {{#if commonConsults}}
  4 + <li class="consult-nav tap-hightlight">常见问题</li>
  5 + {{^}}
  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 ">

6.28 KB | W: | H:

4.79 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
@@ -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;
@@ -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 }
@@ -744,15 +746,14 @@ $basicBtnC: #eb0313; @@ -744,15 +746,14 @@ $basicBtnC: #eb0313;
744 top: 0; 746 top: 0;
745 left: 48px; 747 left: 48px;
746 display: block; 748 display: block;
747 - width: 72px;  
748 - height: 72px; 749 + width: 30px;
  750 + height: 30px;
749 border-radius: 50%; 751 border-radius: 50%;
750 background: $basicBtnC; 752 background: $basicBtnC;
751 color: #fff; 753 color: #fff;
752 text-align: center; 754 text-align: center;
753 - font-size: 40px;  
754 - line-height: 72px;  
755 - transform: scale(0.5); 755 + font-size: 20px;
  756 + line-height: 30px;
756 757
757 &.hide { 758 &.hide {
758 display: none; 759 display: none;
@@ -768,3 +769,7 @@ $basicBtnC: #eb0313; @@ -768,3 +769,7 @@ $basicBtnC: #eb0313;
768 top: 40%; 769 top: 40%;
769 } 770 }
770 } 771 }
  772 +
  773 +iframe {
  774 + display: none;
  775 +}
@@ -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