list.js
2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import api from '../../common/api';
import formatDate from '../../common/formatDate';
export default {
formatData(data) {
let build = [];
let endDate = '';
data.forEach((val) => {
if (val.activityStartDate.split('/')[0] === val.activityEndDate.split('/')[0]) {
endDate = formatDate.slashToString(val.activityEndDate, 0);
if (val.activityStartDate.split('/')[1] === val.activityEndDate.split('/')[1]) {
endDate = formatDate.slashToString(val.activityEndDate, 1);
}
} else {
endDate = formatDate.slashToString(val.activityEndDate);
}
build.push({
activityName: val.activityName,
activityStartDate: formatDate.slashToString(val.activityStartDate),
activityEndDate: val.activityStartDate === val.activityEndDate ? '' : endDate,
activityDayStartTime: val.activityDayStartTime,
activityDayEndTime: val.activityDayEndTime,
free: val.isFree === 1,
price: val.price,
image: val.image.split(',')[0],
id: val.id,
needApo: val.isAppointment === 1,
apoStatus: val.appointStatus === 1,
trendClassTypeName: val.trendClassTypeName
});
});
return build;
},
newList(params) {
return api.get({
url: '/ActivityConfigController/getActivityNowList',
data: {
activityType: params.activityType,
isFront: params.isFront,
storeId: params.storeId || 0,
trendClassTypeId: params.trendClassTypeId
},
api: 'store',
code: 200
}).then((result) => {
let resu = {};
if (result && result.length > 0) {
resu.list = this.formatData(result);
}
return resu;
});
},
oldList(params) {
return api.get({
url: '/ActivityConfigController/getActivityEndList',
data: {
activityType: params.activityType,
isFront: params.isFront,
storeId: params.storeId || 0,
trendClassTypeId: params.trendClassTypeId
},
api: 'store',
code: 200
}).then((result) => {
let resu = {};
if (result && result.length > 0) {
resu.list = this.formatData(result);
}
return resu;
});
}
};