...
|
...
|
@@ -44,12 +44,19 @@ const processTime = (time) => { |
|
|
*/
|
|
|
const processSpecial = (list) => {
|
|
|
const formatData = [];
|
|
|
let flag = true;
|
|
|
|
|
|
list = list || [];
|
|
|
list = camelCase(list);
|
|
|
|
|
|
if (list.length === 1) {
|
|
|
flag = false;
|
|
|
}
|
|
|
|
|
|
_.forEach(list, (data) => {
|
|
|
data.specialUrl = `/product/specialDetail?id=${data.id}`;
|
|
|
if (flag === true) {
|
|
|
data.specialUrl = `/product/specialDetail?id=${data.id}`;
|
|
|
}
|
|
|
|
|
|
_.merge(data, processTime(data.leftTime));
|
|
|
|
...
|
...
|
@@ -251,27 +258,6 @@ const processSearch = (list, options) => { |
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 折扣专场详情数据处理
|
|
|
*/
|
|
|
const processSpecialDetail = (data) => {
|
|
|
let activityData = {};
|
|
|
|
|
|
data[0] = data[0] || {};
|
|
|
data[0] = camelCase(data[0]);
|
|
|
|
|
|
_.merge(data[0], processTime(data[0].leftTime));
|
|
|
|
|
|
return activityData = {
|
|
|
title: data[0].title,
|
|
|
activity: {
|
|
|
coverUrl: data[0].coverUrl,
|
|
|
time: data[0].time,
|
|
|
leftTime: data[0].leftTime
|
|
|
}
|
|
|
};
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 断码区分类数据处理
|
|
|
*/
|
|
|
const processBreakingSort = (list) => {
|
...
|
...
|
@@ -311,6 +297,9 @@ exports.getSearchData = (params) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取资源位数据
|
|
|
*/
|
|
|
const getResources = (page) => {
|
|
|
const contentCode = {
|
|
|
sale: '7c2b77093421efa8ae9302c91460db73',
|
...
|
...
|
@@ -330,6 +319,9 @@ const getResources = (page) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取断码区分类数据
|
|
|
*/
|
|
|
const getBreakingSort = (yhChannel) => {
|
|
|
return api.get('', sign.apiSign({
|
|
|
method: 'app.sale.getBreakingSort',
|
...
|
...
|
@@ -344,6 +336,10 @@ const getBreakingSort = (yhChannel) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
const getSpecial = (params) => {
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取商品数据
|
|
|
*/
|
...
|
...
|
@@ -363,8 +359,6 @@ exports.getSearchData = (params) => { |
|
|
|
|
|
/**
|
|
|
* 获取sale首页数据
|
|
|
* @param {[object]} params
|
|
|
* @return {[object]}
|
|
|
*/
|
|
|
exports.getSaleData = () => {
|
|
|
return getResources('sale');
|
...
|
...
|
@@ -414,6 +408,8 @@ exports.getSpecialData = (params) => { |
|
|
* @return {[object]}
|
|
|
*/
|
|
|
exports.getSpecialDetailData = (id) => {
|
|
|
let res = {};
|
|
|
|
|
|
return api.get('', sign.apiSign({
|
|
|
method: 'app.activity.get',
|
|
|
sort: 2,
|
...
|
...
|
@@ -421,7 +417,15 @@ exports.getSpecialDetailData = (id) => { |
|
|
id: id
|
|
|
})).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return processSpecialDetail(result.data);
|
|
|
res = processSpecial(result.data);
|
|
|
return {
|
|
|
title: res[0].title,
|
|
|
activity: {
|
|
|
coverUrl: res[0].coverUrl,
|
|
|
time: res[0].time,
|
|
|
leftTime: res[0].leftTime
|
|
|
}
|
|
|
};
|
|
|
} else {
|
|
|
return Promise.reject('error');
|
|
|
}
|
...
|
...
|
|