...
|
...
|
@@ -7,8 +7,6 @@ |
|
|
'use strict';
|
|
|
|
|
|
const api = global.yoho.API;
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const headerModel = require('../../../doraemon/models/header'); // 头部model
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
const _getCommonConsult = () => {
|
...
|
...
|
@@ -76,29 +74,21 @@ const _getConsults = (id, page, limit) => { |
|
|
};
|
|
|
|
|
|
let consults = (params) => {
|
|
|
let title = '购买咨询';
|
|
|
|
|
|
return api.all([
|
|
|
headerModel.setNav({
|
|
|
navTitle: title
|
|
|
}),
|
|
|
_getCommonConsult(),
|
|
|
_getConsults(params.product_id, 1, 10)
|
|
|
]).then(result => {
|
|
|
let data = {
|
|
|
pageHeader: result[0],
|
|
|
link: helpers.urlFormat('/product/detail/consultform', {
|
|
|
product_id: params.product_id
|
|
|
})
|
|
|
link: `/product/detail/consultform?product_id=${params.product_id}`
|
|
|
};
|
|
|
|
|
|
Object.assign(data, result[1]);
|
|
|
Object.assign(data, result[0]);
|
|
|
|
|
|
if (result[2].list && result[2].list.length) {
|
|
|
if (result[2].total) {
|
|
|
data.pageHeader.navTitle += `(${result[2].total})`;
|
|
|
if (result[1].list && result[1].list.length) {
|
|
|
if (result[1].total) {
|
|
|
_.set(data, 'pageHeader.navTitle', `购买咨询(${result[1].total})`);
|
|
|
}
|
|
|
data.consults = result[2].list;
|
|
|
data.consults = result[1].list;
|
|
|
}
|
|
|
|
|
|
return data;
|
...
|
...
|
|