...
|
...
|
@@ -7,7 +7,9 @@ |
|
|
'use strict';
|
|
|
|
|
|
const service = global.yoho.StoreAPI;
|
|
|
const api = global.yoho.API;
|
|
|
const moment = require('moment');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
|
|
|
// 格式年月日
|
|
|
const _formatDay = (day) => {
|
...
|
...
|
@@ -64,7 +66,7 @@ const info = (params) => { |
|
|
|
|
|
// 店铺信息
|
|
|
const storeInfo = (params) => {
|
|
|
return service.get('StoreController/getStoreInfoExtById', {
|
|
|
return service.get('InformationController/getStoreInfoExtById', {
|
|
|
storeId: params.storeId,
|
|
|
isFront: params.isFront
|
|
|
}, {
|
...
|
...
|
@@ -173,6 +175,7 @@ const useList = (params) => { |
|
|
return service.get('ActivityConfigController/getActivityNowList', {
|
|
|
storeId: params.storeId,
|
|
|
activityType: params.activityType,
|
|
|
trendClassTypeId: params.typeId || 0,
|
|
|
isFront: params.isFront
|
|
|
}, {
|
|
|
code: 200
|
...
|
...
|
@@ -186,6 +189,7 @@ const oldList = (params) => { |
|
|
return service.get('ActivityConfigController/getActivityEndList', {
|
|
|
storeId: params.storeId,
|
|
|
activityType: params.activityType,
|
|
|
trendClassTypeId: params.typeId || 0,
|
|
|
isFront: params.isFront
|
|
|
}, {
|
|
|
code: 200
|
...
|
...
|
@@ -201,16 +205,38 @@ const oldList = (params) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
// 课堂tab
|
|
|
const classTab = (params) => {
|
|
|
return service.get('ActivityConfigController/getAllTrendClassType', {
|
|
|
storeId: params.storeId,
|
|
|
isFront: params.isFront
|
|
|
}, {
|
|
|
code: 200
|
|
|
}).then(result => {
|
|
|
let resu = [];
|
|
|
|
|
|
if (result && result.data) {
|
|
|
resu = result.data;
|
|
|
}
|
|
|
return resu;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
// 潮流课堂,活动列表
|
|
|
const classActList = (params) => {
|
|
|
return Promise.all([
|
|
|
let listApi = [
|
|
|
useList(params),
|
|
|
oldList(params)
|
|
|
]).then(result => {
|
|
|
];
|
|
|
|
|
|
if (params.classType === true) {
|
|
|
listApi.push(classTab(params));
|
|
|
}
|
|
|
return Promise.all(listApi).then(result => {
|
|
|
let resu = {
|
|
|
list: [],
|
|
|
oldList: []
|
|
|
oldList: [],
|
|
|
typeList: []
|
|
|
};
|
|
|
|
|
|
if (result && result[0] && result[0].data) {
|
...
|
...
|
@@ -244,9 +270,9 @@ const classActList = (params) => { |
|
|
|
|
|
build.push({
|
|
|
name: val.activityName,
|
|
|
image: val.image ? val.image.split(',')[0] : '',
|
|
|
image: helpers.image(val.image ? val.image.split(',')[0] : '', 750, 750),
|
|
|
startDate: _formatDay(val.activityStartDate),
|
|
|
endDate: endDate,
|
|
|
endDate: val.activityStartDate === val.activityEndDate ? '' : endDate,
|
|
|
startTime: _HM2(val.activityDayStartTime),
|
|
|
endTime: _HM2(val.activityDayEndTime),
|
|
|
free: val.isFree === 1,
|
...
|
...
|
@@ -255,7 +281,8 @@ const classActList = (params) => { |
|
|
apoStatus: val.appointStatus === 1,
|
|
|
id: val.id,
|
|
|
status: status,
|
|
|
storeId: params.storeId
|
|
|
storeId: params.storeId,
|
|
|
tag: val.trendClassTypeName
|
|
|
});
|
|
|
});
|
|
|
|
...
|
...
|
@@ -283,9 +310,9 @@ const classActList = (params) => { |
|
|
|
|
|
build.push({
|
|
|
name: val.activityName,
|
|
|
image: val.image ? val.image.split(',')[0] : '',
|
|
|
image: helpers.image(val.image ? val.image.split(',')[0] : '', 750, 750),
|
|
|
startDate: _formatDay(val.activityStartDate),
|
|
|
endDate: endDate,
|
|
|
endDate: val.activityStartDate === val.activityEndDate ? '' : endDate,
|
|
|
startTime: _HM2(val.activityDayStartTime),
|
|
|
endTime: _HM2(val.activityDayEndTime),
|
|
|
end: true,
|
...
|
...
|
@@ -296,12 +323,37 @@ const classActList = (params) => { |
|
|
storeId: params.storeId,
|
|
|
free: val.isFree === 1,
|
|
|
price: val.price,
|
|
|
tag: val.trendClassTypeName
|
|
|
});
|
|
|
});
|
|
|
|
|
|
resu.oldList = build;
|
|
|
}
|
|
|
|
|
|
if (result && result[2]) {
|
|
|
let build = [];
|
|
|
|
|
|
result[2].forEach(val => {
|
|
|
build.push({
|
|
|
name: val.typeName,
|
|
|
id: val.typeId
|
|
|
});
|
|
|
});
|
|
|
resu.typeList = build;
|
|
|
}
|
|
|
|
|
|
return resu;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
// 二期,活动跟课堂功能分离
|
|
|
const classList = (params) => {
|
|
|
return Promise.all([
|
|
|
classActList(params)
|
|
|
]).then(newResult => {
|
|
|
let resu = {};
|
|
|
|
|
|
resu = newResult[0];
|
|
|
return resu;
|
|
|
});
|
|
|
};
|
...
|
...
|
@@ -330,6 +382,7 @@ const classActDetail = (params) => { |
|
|
storeId: params.storeId,
|
|
|
activityType: params.activityType,
|
|
|
id: params.activityId,
|
|
|
vip: result.data.userLevels
|
|
|
};
|
|
|
}
|
|
|
|
...
|
...
|
@@ -435,6 +488,7 @@ const travel = (params) => { |
|
|
resu.hairStylistId = result[0].hairStylistId;
|
|
|
resu.travelId = result[0].id;
|
|
|
resu.content = result[0].tourDetail;
|
|
|
resu.vip = result[0].userLevel;
|
|
|
|
|
|
let build = [];
|
|
|
|
...
|
...
|
@@ -501,7 +555,8 @@ const adviser = (params) => { |
|
|
summary: result[0].data.summary,
|
|
|
image: result[0].data.image,
|
|
|
isCanAppoint: result[0].data.isCanAppoint === 1,
|
|
|
storeId: params.storeId
|
|
|
storeId: params.storeId,
|
|
|
vip: result[0].data.userLevel
|
|
|
};
|
|
|
|
|
|
resu.content = result[0].data.detail;
|
...
|
...
|
@@ -625,11 +680,36 @@ const getTimeList = (params) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
// 所有风格
|
|
|
const allStyle = (params) => {
|
|
|
return Promise.all([
|
|
|
getStyle(params)
|
|
|
]).then(result => {
|
|
|
let resu = {
|
|
|
styleList: []
|
|
|
};
|
|
|
|
|
|
if (result[0] && result[0].data) {
|
|
|
let build = [];
|
|
|
|
|
|
result[0].data.forEach(val => {
|
|
|
build.push({
|
|
|
img: val.styleImage,
|
|
|
id: val.id,
|
|
|
name: val.styleName,
|
|
|
storeId: params.storeId
|
|
|
});
|
|
|
});
|
|
|
resu.styleList = build;
|
|
|
}
|
|
|
return resu;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
// 摄影
|
|
|
const photography = (params) => {
|
|
|
return Promise.all([
|
|
|
photographyDetail(params),
|
|
|
getStyle(params),
|
|
|
adviserList(params),
|
|
|
getStylePush(params),
|
|
|
]).then(result => {
|
...
|
...
|
@@ -640,39 +720,26 @@ const photography = (params) => { |
|
|
styleList: [],
|
|
|
packageList: [],
|
|
|
swiper: [],
|
|
|
storeId: params.storeId
|
|
|
storeId: params.storeId,
|
|
|
id: params.id
|
|
|
};
|
|
|
|
|
|
if (result) {
|
|
|
if (result[0] && result[0].data) {
|
|
|
if (result[0].data.pictureUrl) {
|
|
|
resu.detail = {
|
|
|
bigPic: result[0].data.pictureUrl.split(',')[0]
|
|
|
bigPic: result[0].data.pictureUrl.split(',')[0],
|
|
|
name: result[0].data.name
|
|
|
};
|
|
|
}
|
|
|
resu.content = result[0].data.detail;
|
|
|
}
|
|
|
if (result[1] && result[1].data) {
|
|
|
|
|
|
let build = [];
|
|
|
|
|
|
result[1].data.forEach(val => {
|
|
|
|
|
|
build.push({
|
|
|
img: val.styleImage,
|
|
|
id: val.id,
|
|
|
name: val.styleName
|
|
|
});
|
|
|
});
|
|
|
|
|
|
resu.styleList = build;
|
|
|
}
|
|
|
if (result[2] && result[2].data) {
|
|
|
let build = [];
|
|
|
|
|
|
result[2].data.forEach(val => {
|
|
|
|
|
|
build.push({
|
|
|
name: val.activityName,
|
|
|
free: val.isFree === 1,
|
|
|
price: val.price,
|
...
|
...
|
@@ -683,11 +750,11 @@ const photography = (params) => { |
|
|
|
|
|
resu.packageList = build;
|
|
|
}
|
|
|
if (result[3] && result[3].data) {
|
|
|
if (result[2] && result[2].data) {
|
|
|
|
|
|
let build = [];
|
|
|
|
|
|
result[3].data.forEach(val => {
|
|
|
result[2].data.forEach(val => {
|
|
|
|
|
|
build.push({
|
|
|
pic: val.pushImg,
|
...
|
...
|
@@ -1264,6 +1331,7 @@ const kidStyle = (params) => { |
|
|
if (result[2] && result[2].data) {
|
|
|
if (result[2].data.pictureUrl) {
|
|
|
resu.detail = {
|
|
|
name: result[2].data.name,
|
|
|
bigPic: result[2].data.pictureUrl.split(',')[0]
|
|
|
};
|
|
|
}
|
...
|
...
|
@@ -1413,6 +1481,15 @@ const getAbleTime = (params) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
const getVip = (params) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.passport.getUserBase',
|
|
|
uid: params.uid
|
|
|
}).then(result => {
|
|
|
return result;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
store,
|
|
|
articleDetail,
|
...
|
...
|
@@ -1439,5 +1516,8 @@ module.exports = { |
|
|
delOrder,
|
|
|
changeDate,
|
|
|
kids,
|
|
|
getAbleTime
|
|
|
getAbleTime,
|
|
|
allStyle,
|
|
|
classList,
|
|
|
getVip
|
|
|
}; |
...
|
...
|
|