|
@@ -14,7 +14,9 @@ const index = (req, res) => { |
|
@@ -14,7 +14,9 @@ const index = (req, res) => { |
14
|
let query = req.query.query || '';
|
14
|
let query = req.query.query || '';
|
15
|
let uid = req.user.uid || 3236556;
|
15
|
let uid = req.user.uid || 3236556;
|
16
|
|
16
|
|
17
|
- installmentModel.getStauts(uid).then((openStatus) => {
|
17
|
+ Promise.all([installmentModel.getStauts(uid), installmentModel.getSearchIntallment()]).then((result) => {
|
|
|
18
|
+ let openStatus = result[0];
|
|
|
19
|
+
|
18
|
if (openStatus === 0) {
|
20
|
if (openStatus === 0) {
|
19
|
return {
|
21
|
return {
|
20
|
bannerTop: {
|
22
|
bannerTop: {
|
|
@@ -28,18 +30,24 @@ const index = (req, res) => { |
|
@@ -28,18 +30,24 @@ const index = (req, res) => { |
28
|
notOpen: true,
|
30
|
notOpen: true,
|
29
|
installmentOnly: {
|
31
|
installmentOnly: {
|
30
|
title: '分期专享',
|
32
|
title: '分期专享',
|
31
|
- goods: [
|
|
|
32
|
- {
|
|
|
33
|
-
|
|
|
34
|
- }
|
|
|
35
|
- ]
|
33
|
+ goods: result[1]
|
36
|
}
|
34
|
}
|
37
|
};
|
35
|
};
|
38
|
} else if (openStatus === 2) {
|
36
|
} else if (openStatus === 2) {
|
39
|
if (query === 'usable') {
|
37
|
if (query === 'usable') {
|
40
|
return installmentModel.getQueryCreditInfo(uid).then((data) => {
|
38
|
return installmentModel.getQueryCreditInfo(uid).then((data) => {
|
|
|
39
|
+ if (data.status === 2) {
|
|
|
40
|
+ data.replayStatus = '逾期';
|
|
|
41
|
+ } else if (data.status === 3) {
|
|
|
42
|
+ data.replayStatus = '不可用';
|
|
|
43
|
+ }
|
|
|
44
|
+
|
41
|
return _.assign({
|
45
|
return _.assign({
|
42
|
- isUnable: true
|
46
|
+ isUnable: true,
|
|
|
47
|
+ installmentOnly: {
|
|
|
48
|
+ title: '分期专享',
|
|
|
49
|
+ goods: result[1]
|
|
|
50
|
+ }
|
43
|
}, data);
|
51
|
}, data);
|
44
|
});
|
52
|
});
|
45
|
} else {
|
53
|
} else {
|
|
@@ -49,17 +57,19 @@ const index = (req, res) => { |
|
@@ -49,17 +57,19 @@ const index = (req, res) => { |
49
|
}, data);
|
57
|
}, data);
|
50
|
});
|
58
|
});
|
51
|
}
|
59
|
}
|
52
|
-
|
|
|
53
|
}
|
60
|
}
|
54
|
}).then((result) => {
|
61
|
}).then((result) => {
|
|
|
62
|
+ result.pageHeader = _.assign({
|
|
|
63
|
+ installmentPage: true
|
|
|
64
|
+ }, headerModel.setNav({
|
|
|
65
|
+ navTitle: '有货分期',
|
|
|
66
|
+ navBtn: false
|
|
|
67
|
+ }));
|
|
|
68
|
+
|
55
|
res.render('installment/open-index', _.assign({
|
69
|
res.render('installment/open-index', _.assign({
|
56
|
module: 'home',
|
70
|
module: 'home',
|
57
|
page: 'installment',
|
71
|
page: 'installment',
|
58
|
- title: '有货分期',
|
|
|
59
|
- pageHeader: headerModel.setNav({
|
|
|
60
|
- navTitle: '有货分期',
|
|
|
61
|
- navBtn: false
|
|
|
62
|
- })
|
72
|
+ title: '有货分期'
|
63
|
}, result));
|
73
|
}, result));
|
64
|
});
|
74
|
});
|
65
|
};
|
75
|
};
|
|
@@ -70,33 +80,32 @@ const review = (req, res) => { |
|
@@ -70,33 +80,32 @@ const review = (req, res) => { |
70
|
|
80
|
|
71
|
installmentModel.getStauts(uid).then((status) => {
|
81
|
installmentModel.getStauts(uid).then((status) => {
|
72
|
if (status === 1) {
|
82
|
if (status === 1) {
|
73
|
- params = {
|
83
|
+ return {
|
74
|
review: {
|
84
|
review: {
|
75
|
- url: helpers.urlFormat('/?go=1')
|
85
|
+ url: helpers.urlFormat('//m.yohobuy.com/product/new')
|
76
|
}
|
86
|
}
|
77
|
};
|
87
|
};
|
78
|
} else if (status === 2) {
|
88
|
} else if (status === 2) {
|
79
|
- params = {
|
89
|
+ return installmentModel.getSearchIntallment().then((goods) => {
|
|
|
90
|
+ return {
|
80
|
success: {
|
91
|
success: {
|
81
|
price: '5000',
|
92
|
price: '5000',
|
82
|
installmentOnly: {
|
93
|
installmentOnly: {
|
83
|
title: '分期专享',
|
94
|
title: '分期专享',
|
84
|
- goods: [
|
|
|
85
|
- {
|
|
|
86
|
-
|
|
|
87
|
- }
|
|
|
88
|
- ]
|
95
|
+ goods: goods
|
89
|
}
|
96
|
}
|
90
|
}
|
97
|
}
|
91
|
};
|
98
|
};
|
92
|
- } else {
|
|
|
93
|
- params = {
|
99
|
+ });
|
|
|
100
|
+
|
|
|
101
|
+ } else if (status === 3) {
|
|
|
102
|
+ return {
|
94
|
error: {
|
103
|
error: {
|
95
|
- url: helpers.urlFormat('/?go=1')
|
104
|
+ url: helpers.urlFormat('//m.yohobuy.com/product/new')
|
96
|
}
|
105
|
}
|
97
|
};
|
106
|
};
|
98
|
}
|
107
|
}
|
99
|
-
|
108
|
+ }).then((params) => {
|
100
|
res.render('installment/open-result', _.assign({
|
109
|
res.render('installment/open-result', _.assign({
|
101
|
module: 'home',
|
110
|
module: 'home',
|
102
|
page: 'installment',
|
111
|
page: 'installment',
|