me-gift-service.js
1.3 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
/**
* 我的礼品卡列表
* @author xiaoxiao <xiaoxiao.hao@yoho.cn>
* @date: 2017/9/1
*/
'use strict';
const Promise = require('bluebird');
const helpers = global.yoho.helpers;
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
headTab(params) {
let type = params.type > -1 && params.type < 4 ? params.type : 0;
let tabs = [{
name: '使用中',
url: helpers.urlFormat('/home/megift'),
active: false
}, {
name: '已过期',
url: helpers.urlFormat('/home/megift', {type: 1}),
active: false
}, {
name: '已用完',
url: helpers.urlFormat('/home/megift', {type: 2}),
active: false
}, {
name: '已冻结',
url: helpers.urlFormat('/home/megift', {type: 3}),
active: false
}, {
name: '添加礼品卡',
class: 'add-gift',
active: false
}];
tabs[type].active = true;
return tabs;
}
// 礼品卡列表
getList(params) {
return Promise.resolve({tabs: this.headTab(params)});
}
// 礼品卡列表
detailList(params) {
return Promise.resolve({tabs: this.headTab(params)});
}
};