detail.js
1.63 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
import api from '../../common/api';
import formatDate from '../../common/formatDate';
export default {
formatData(data) {
let resu = {};
let endDate = '';
if (data.startDay.split('/')[0] === data.endDay.split('/')[0]) {
endDate = formatDate.slashToString(data.endDay, 0);
if (data.startDay.split('/')[1] === data.endDay.split('/')[1]) {
endDate = formatDate.slashToString(data.endDay, 1);
}
} else {
endDate = formatDate.slashToString(data.endDay);
}
resu = {
name: data.activityName,
startDate: formatDate.slashToString(data.startDay),
endDate: data.startDay === data.endDay ? '' : endDate,
startTime: data.startTime,
endTime: data.endTime,
free: data.price === '免费',
price: data.price,
storeAddress: data.storeAddress,
tagName: data.trendClassTypeName
};
return resu;
},
getDetail(params) {
return api.get({
url: '/ActivityConfigController/getFrontDetailById',
data: {
activityId: params.id,
isFront: params.isFront
},
api: 'store',
code: 200
}).then(result => {
let resu = {
detail: '',
info: ''
};
if (result) {
resu.detail = result.detail;
resu.contentSection = result.contentSection;
resu.info = this.formatData(result);
}
return resu;
});
}
};