Showing
16 changed files
with
496 additions
and
104 deletions
@@ -9,8 +9,16 @@ const installmentModel = require('../models/installment'); | @@ -9,8 +9,16 @@ const installmentModel = require('../models/installment'); | ||
9 | const _ = require('lodash'); | 9 | const _ = require('lodash'); |
10 | const helpers = global.yoho.helpers; | 10 | const helpers = global.yoho.helpers; |
11 | 11 | ||
12 | +// 服务器报错页面 | ||
13 | +const _serverCrash = (res, url) => { | ||
14 | + | ||
15 | + res.render('installment/server-crash', { | ||
16 | + url: url | ||
17 | + }); | ||
18 | +}; | ||
19 | + | ||
12 | // 判断是否已经获取到了开通的状态值 | 20 | // 判断是否已经获取到了开通的状态值 |
13 | -const _reviewStatus = (uid, status, next) => { | 21 | +const _reviewStatus = (res, req, uid, status) => { |
14 | let jumpUrl = helpers.appUrlFormat('/product/new', 'go.new'); | 22 | let jumpUrl = helpers.appUrlFormat('/product/new', 'go.new'); |
15 | 23 | ||
16 | if (status === '1') { | 24 | if (status === '1') { |
@@ -33,7 +41,9 @@ const _reviewStatus = (uid, status, next) => { | @@ -33,7 +41,9 @@ const _reviewStatus = (uid, status, next) => { | ||
33 | url: jumpUrl | 41 | url: jumpUrl |
34 | } | 42 | } |
35 | }; | 43 | }; |
36 | - }).catch(next); | 44 | + }).catch(() => { |
45 | + _serverCrash(res, req.originalUrl); | ||
46 | + }); | ||
37 | 47 | ||
38 | } else if (status === '3') { | 48 | } else if (status === '3') { |
39 | return { | 49 | return { |
@@ -41,11 +51,17 @@ const _reviewStatus = (uid, status, next) => { | @@ -41,11 +51,17 @@ const _reviewStatus = (uid, status, next) => { | ||
41 | url: jumpUrl | 51 | url: jumpUrl |
42 | } | 52 | } |
43 | }; | 53 | }; |
54 | + } else if (status === '4') { | ||
55 | + return { | ||
56 | + cancel: { | ||
57 | + url: jumpUrl | ||
58 | + } | ||
59 | + }; | ||
44 | } | 60 | } |
45 | }; | 61 | }; |
46 | 62 | ||
47 | // 还款列表公共处理块 | 63 | // 还款列表公共处理块 |
48 | -const _repaymentList = (req, res, next, title, params) => { | 64 | +const _repaymentList = (req, res, title, params) => { |
49 | params = _.assign({ | 65 | params = _.assign({ |
50 | uid: req.cookies.installmentUid || 1 | 66 | uid: req.cookies.installmentUid || 1 |
51 | }, params); | 67 | }, params); |
@@ -58,11 +74,13 @@ const _repaymentList = (req, res, next, title, params) => { | @@ -58,11 +74,13 @@ const _repaymentList = (req, res, next, title, params) => { | ||
58 | title: title, | 74 | title: title, |
59 | data: result | 75 | data: result |
60 | }); | 76 | }); |
61 | - }).catch(next); | 77 | + }).catch(() => { |
78 | + _serverCrash(res, req.originalUrl); | ||
79 | + }); | ||
62 | }; | 80 | }; |
63 | 81 | ||
64 | // 开通分期首页 | 82 | // 开通分期首页 |
65 | -const index = (req, res, next) => { | 83 | +const index = (req, res) => { |
66 | let uid = req.query.uid; | 84 | let uid = req.query.uid; |
67 | 85 | ||
68 | Promise.all([installmentModel.getStauts(uid), installmentModel.getSearchIntallment({ | 86 | Promise.all([installmentModel.getStauts(uid), installmentModel.getSearchIntallment({ |
@@ -105,7 +123,7 @@ const index = (req, res, next) => { | @@ -105,7 +123,7 @@ const index = (req, res, next) => { | ||
105 | 123 | ||
106 | return params; | 124 | return params; |
107 | }); | 125 | }); |
108 | - } else if (openStatus === 1 || openStatus === 3) { | 126 | + } else if (openStatus === '1' || openStatus === '3' || openStatus === '4') { |
109 | res.redirect('/home/installment/review?status=' + openStatus); | 127 | res.redirect('/home/installment/review?status=' + openStatus); |
110 | } | 128 | } |
111 | }).then((result) => { | 129 | }).then((result) => { |
@@ -115,11 +133,13 @@ const index = (req, res, next) => { | @@ -115,11 +133,13 @@ const index = (req, res, next) => { | ||
115 | isInstallmentPage: true, | 133 | isInstallmentPage: true, |
116 | title: '有货分期' | 134 | title: '有货分期' |
117 | }, result)); | 135 | }, result)); |
118 | - }).catch(next); | 136 | + }).catch(() => { |
137 | + _serverCrash(res, req.originalUrl); | ||
138 | + }); | ||
119 | }; | 139 | }; |
120 | 140 | ||
121 | // ajax 请求分期专享商品 | 141 | // ajax 请求分期专享商品 |
122 | -const getInstallmentGoods = (req, res, next) => { | 142 | +const getInstallmentGoods = (req, res) => { |
123 | let params = req.query || {}; | 143 | let params = req.query || {}; |
124 | 144 | ||
125 | installmentModel.getSearchIntallment(params).then((result) => { | 145 | installmentModel.getSearchIntallment(params).then((result) => { |
@@ -131,11 +151,13 @@ const getInstallmentGoods = (req, res, next) => { | @@ -131,11 +151,13 @@ const getInstallmentGoods = (req, res, next) => { | ||
131 | } else { | 151 | } else { |
132 | res.json(); | 152 | res.json(); |
133 | } | 153 | } |
134 | - }).catch(next); | 154 | + }).catch(() => { |
155 | + _serverCrash(res, req.originalUrl); | ||
156 | + }); | ||
135 | }; | 157 | }; |
136 | 158 | ||
137 | // 开通结果显示 | 159 | // 开通结果显示 |
138 | -const review = (req, res, next) => { | 160 | +const review = (req, res) => { |
139 | let openStatus = req.query.status || false; | 161 | let openStatus = req.query.status || false; |
140 | let uid = req.query.uid; | 162 | let uid = req.query.uid; |
141 | let data = { | 163 | let data = { |
@@ -145,38 +167,38 @@ const review = (req, res, next) => { | @@ -145,38 +167,38 @@ const review = (req, res, next) => { | ||
145 | }; | 167 | }; |
146 | 168 | ||
147 | if (openStatus !== '2') { | 169 | if (openStatus !== '2') { |
148 | - res.render('installment/open-result', _.assign(data, _reviewStatus(uid, openStatus))); | 170 | + res.render('installment/open-result', _.assign(data, _reviewStatus(res, req, uid, openStatus))); |
149 | } else { | 171 | } else { |
150 | - _reviewStatus(uid, openStatus, next).then((params) => { | 172 | + _reviewStatus(res, req, uid, openStatus).then((params) => { |
151 | res.render('installment/open-result', _.assign(data, params)); | 173 | res.render('installment/open-result', _.assign(data, params)); |
152 | }); | 174 | }); |
153 | } | 175 | } |
154 | }; | 176 | }; |
155 | 177 | ||
156 | // 逾期未还款列表 | 178 | // 逾期未还款列表 |
157 | -const overdueList = (req, res, next) => { | ||
158 | - _repaymentList(req, res, next, '逾期未还金额', { | 179 | +const overdueList = (req, res) => { |
180 | + _repaymentList(req, res, '逾期未还金额', { | ||
159 | queryDays: -1 | 181 | queryDays: -1 |
160 | }); | 182 | }); |
161 | }; | 183 | }; |
162 | 184 | ||
163 | // 7日待还款列表 | 185 | // 7日待还款列表 |
164 | -const sevenDayList = (req, res, next) => { | ||
165 | - _repaymentList(req, res, next, '近7日待还款', { | 186 | +const sevenDayList = (req, res) => { |
187 | + _repaymentList(req, res, '近7日待还款', { | ||
166 | queryDays: 7 | 188 | queryDays: 7 |
167 | }); | 189 | }); |
168 | }; | 190 | }; |
169 | 191 | ||
170 | // 本月待还款列表 | 192 | // 本月待还款列表 |
171 | -const monthRepayList = (req, res, next) => { | ||
172 | - _repaymentList(req, res, next, '本月待还金额', { | 193 | +const monthRepayList = (req, res) => { |
194 | + _repaymentList(req, res, '本月待还金额', { | ||
173 | queryDays: 30 | 195 | queryDays: 30 |
174 | }); | 196 | }); |
175 | }; | 197 | }; |
176 | 198 | ||
177 | // 待还总金额列表 | 199 | // 待还总金额列表 |
178 | -const totalRepayList = (req, res, next) => { | ||
179 | - _repaymentList(req, res, next, '待还总金额', { | 200 | +const totalRepayList = (req, res) => { |
201 | + _repaymentList(req, res, '待还总金额', { | ||
180 | queryDays: 0 | 202 | queryDays: 0 |
181 | }); | 203 | }); |
182 | }; | 204 | }; |
@@ -192,7 +214,7 @@ const repayRecordPage = (req, res) => { | @@ -192,7 +214,7 @@ const repayRecordPage = (req, res) => { | ||
192 | }; | 214 | }; |
193 | 215 | ||
194 | // ajax 请求还款记录 | 216 | // ajax 请求还款记录 |
195 | -const getRepayRecord = (req, res, next) => { | 217 | +const getRepayRecord = (req, res) => { |
196 | let params = _.assign({ | 218 | let params = _.assign({ |
197 | uid: req.cookies.installmentUid || 1, | 219 | uid: req.cookies.installmentUid || 1, |
198 | pageNo: req.query.page || 1 | 220 | pageNo: req.query.page || 1 |
@@ -207,21 +229,43 @@ const getRepayRecord = (req, res, next) => { | @@ -207,21 +229,43 @@ const getRepayRecord = (req, res, next) => { | ||
207 | } else { | 229 | } else { |
208 | res.json(); | 230 | res.json(); |
209 | } | 231 | } |
210 | - }).catch(next); | 232 | + }).catch(() => { |
233 | + _serverCrash(res, req.originalUrl); | ||
234 | + }); | ||
211 | }; | 235 | }; |
212 | 236 | ||
213 | // 账号管理 | 237 | // 账号管理 |
214 | -const account = (req, res, next) => { | ||
215 | - let uid = req.cookies.installmentUid || 512579468; | 238 | +const account = (req, res) => { |
239 | + res.render('installment/account', { | ||
240 | + title: '账号管理', | ||
241 | + isInstallmentPage: true | ||
242 | + }); | ||
243 | +}; | ||
216 | 244 | ||
217 | - installmentModel.getBankCards(uid).then((result) => { | ||
218 | - res.render('installment/account', { | ||
219 | - accountList: result, | ||
220 | - title: '账号管理', | ||
221 | - isInstallmentPage: true, | ||
222 | - repaymentList: result | ||
223 | - }); | ||
224 | - }).catch(next); | 245 | +// 添加新银行卡 |
246 | +const bindCard = (req, res) => { | ||
247 | + res.render('installment/bind-card', { | ||
248 | + module: 'home', | ||
249 | + page: 'bind-card', | ||
250 | + title: '使用新卡还款', | ||
251 | + bindCard: { | ||
252 | + userName: req.query.name | ||
253 | + }, | ||
254 | + isInstallmentPage: true | ||
255 | + }); | ||
256 | +}; | ||
257 | + | ||
258 | +// 添加新银行卡请求 | ||
259 | +const postAccount = (req, res) => { | ||
260 | + var params = _.assign({ | ||
261 | + uid: req.cookies.installmentUid | ||
262 | + }, req.query); | ||
263 | + | ||
264 | + installmentModel.postAccount(params).then((result) => { | ||
265 | + res.json(result); | ||
266 | + }).catch(() => { | ||
267 | + _serverCrash(res, req.originalUrl); | ||
268 | + }); | ||
225 | }; | 269 | }; |
226 | 270 | ||
227 | const startingService = (req, res) => { | 271 | const startingService = (req, res) => { |
@@ -247,7 +291,7 @@ function getRealIP(req) { | @@ -247,7 +291,7 @@ function getRealIP(req) { | ||
247 | return realIP || forwardedFor.split(',')[0] || req.connection.remoteAddress; | 291 | return realIP || forwardedFor.split(',')[0] || req.connection.remoteAddress; |
248 | } | 292 | } |
249 | 293 | ||
250 | -const activateService = (req, res, next) => { | 294 | +const activateService = (req, res) => { |
251 | 295 | ||
252 | installmentModel.activateService({ | 296 | installmentModel.activateService({ |
253 | uid: req.cookies.installmentUid || 532892, | 297 | uid: req.cookies.installmentUid || 532892, |
@@ -263,22 +307,28 @@ const activateService = (req, res, next) => { | @@ -263,22 +307,28 @@ const activateService = (req, res, next) => { | ||
263 | ip: getRealIP(req) | 307 | ip: getRealIP(req) |
264 | }).then((result)=> { | 308 | }).then((result)=> { |
265 | res.json(result); | 309 | res.json(result); |
266 | - }).catch(next); | 310 | + }).catch(() => { |
311 | + _serverCrash(res, req.originalUrl); | ||
312 | + }); | ||
267 | }; | 313 | }; |
268 | 314 | ||
269 | -const getBankInfo = (req, res, next) => { | 315 | +const getBankInfo = (req, res) => { |
270 | installmentModel.getBankInfo({ | 316 | installmentModel.getBankInfo({ |
271 | cardNo: req.query.cardNo, | 317 | cardNo: req.query.cardNo, |
272 | uid: req.cookies.installmentUid || 512579468 // TODO: fix uid | 318 | uid: req.cookies.installmentUid || 512579468 // TODO: fix uid |
273 | }).then((result)=> { | 319 | }).then((result)=> { |
274 | res.json(result); | 320 | res.json(result); |
275 | - }).catch(next); | 321 | + }).catch(() => { |
322 | + _serverCrash(res, req.originalUrl); | ||
323 | + }); | ||
276 | }; | 324 | }; |
277 | 325 | ||
278 | -const verifyCode = (req, res, next) => { | 326 | +const verifyCode = (req, res) => { |
279 | installmentModel.sendVerifyCode(req.cookies.installmentUid || 1, req.query.mobile).then((result)=> { | 327 | installmentModel.sendVerifyCode(req.cookies.installmentUid || 1, req.query.mobile).then((result)=> { |
280 | res.json(result); | 328 | res.json(result); |
281 | - }).catch(next); | 329 | + }).catch(() => { |
330 | + _serverCrash(res, req.originalUrl); | ||
331 | + }); | ||
282 | }; | 332 | }; |
283 | 333 | ||
284 | const orderIndex = (req, res) => { | 334 | const orderIndex = (req, res) => { |
@@ -291,7 +341,7 @@ const orderIndex = (req, res) => { | @@ -291,7 +341,7 @@ const orderIndex = (req, res) => { | ||
291 | }); | 341 | }); |
292 | }; | 342 | }; |
293 | 343 | ||
294 | -const orderList = (req, res, next) => { | 344 | +const orderList = (req, res) => { |
295 | const params = { | 345 | const params = { |
296 | uid: req.cookies.installmentUid || 8041876, // TODO: fix me | 346 | uid: req.cookies.installmentUid || 8041876, // TODO: fix me |
297 | type: req.query.type || 1, | 347 | type: req.query.type || 1, |
@@ -319,10 +369,12 @@ const orderList = (req, res, next) => { | @@ -319,10 +369,12 @@ const orderList = (req, res, next) => { | ||
319 | layout: false, | 369 | layout: false, |
320 | isInstallmentPage: true | 370 | isInstallmentPage: true |
321 | }); | 371 | }); |
322 | - }).catch(next); | 372 | + }).catch(() => { |
373 | + _serverCrash(res, req.originalUrl); | ||
374 | + }); | ||
323 | }; | 375 | }; |
324 | 376 | ||
325 | -const orderDetail = (req, res, next) => { | 377 | +const orderDetail = (req, res) => { |
326 | const params = { | 378 | const params = { |
327 | uid: req.cookies.installmentUid || 8041876, // TODO: fix me | 379 | uid: req.cookies.installmentUid || 8041876, // TODO: fix me |
328 | orderCode: req.params.id | 380 | orderCode: req.params.id |
@@ -368,6 +420,12 @@ const orderDetail = (req, res, next) => { | @@ -368,6 +420,12 @@ const orderDetail = (req, res, next) => { | ||
368 | 420 | ||
369 | return options.inverse(this); | 421 | return options.inverse(this); |
370 | }, | 422 | }, |
423 | + isRepaymentAllCompleted: function(status, options) { | ||
424 | + if (status === 2) { // 已结清/已取消 | ||
425 | + return options.fn(this); | ||
426 | + } | ||
427 | + return options.inverse(this); | ||
428 | + }, | ||
371 | greaterThanZero: function(value, options) { | 429 | greaterThanZero: function(value, options) { |
372 | if (value && parseFloat(value) > 0) { | 430 | if (value && parseFloat(value) > 0) { |
373 | return options.fn(this); | 431 | return options.fn(this); |
@@ -377,11 +435,13 @@ const orderDetail = (req, res, next) => { | @@ -377,11 +435,13 @@ const orderDetail = (req, res, next) => { | ||
377 | } | 435 | } |
378 | } | 436 | } |
379 | }); | 437 | }); |
380 | - }).catch(next); | 438 | + }).catch(() => { |
439 | + _serverCrash(res, req.originalUrl); | ||
440 | + }); | ||
381 | }; | 441 | }; |
382 | 442 | ||
383 | // 还款详情 | 443 | // 还款详情 |
384 | -const repayDetail = (req, res, next) => { | 444 | +const repayDetail = (req, res) => { |
385 | let params = { | 445 | let params = { |
386 | uid: req.cookies.installmentUid || 512579468, | 446 | uid: req.cookies.installmentUid || 512579468, |
387 | rePayNo: req.query.id || '', | 447 | rePayNo: req.query.id || '', |
@@ -394,7 +454,9 @@ const repayDetail = (req, res, next) => { | @@ -394,7 +454,9 @@ const repayDetail = (req, res, next) => { | ||
394 | isInstallmentPage: true, | 454 | isInstallmentPage: true, |
395 | isOne: true | 455 | isOne: true |
396 | }, result[0])); | 456 | }, result[0])); |
397 | - }).catch(next); | 457 | + }).catch(() => { |
458 | + _serverCrash(res, req.originalUrl); | ||
459 | + }); | ||
398 | }; | 460 | }; |
399 | 461 | ||
400 | // 帮助静态页面 | 462 | // 帮助静态页面 |
@@ -412,17 +474,41 @@ const agreement = (req, res) => { | @@ -412,17 +474,41 @@ const agreement = (req, res) => { | ||
412 | }; | 474 | }; |
413 | 475 | ||
414 | // 计算金额 | 476 | // 计算金额 |
415 | -const totalAmount = (req, res, next) => { | 477 | +const totalAmount = (req, res) => { |
416 | installmentModel.totalAmount(req.query.prices).then((result) => { | 478 | installmentModel.totalAmount(req.query.prices).then((result) => { |
417 | res.json(result); | 479 | res.json(result); |
418 | - }).catch(next); | 480 | + }).catch(() => { |
481 | + _serverCrash(res, req.originalUrl); | ||
482 | + }); | ||
419 | }; | 483 | }; |
420 | 484 | ||
421 | // 检查验证码 | 485 | // 检查验证码 |
422 | -const checkVerifyCode = (req, res, next) => { | 486 | +const checkVerifyCode = (req, res) => { |
423 | installmentModel.checkVerifyCode(req.cookies.installmentUid, req.query.mobile, req.query.code).then((result) => { | 487 | installmentModel.checkVerifyCode(req.cookies.installmentUid, req.query.mobile, req.query.code).then((result) => { |
424 | res.json(result); | 488 | res.json(result); |
425 | - }).catch(next); | 489 | + }).catch(() => { |
490 | + _serverCrash(res, req.originalUrl); | ||
491 | + }); | ||
492 | +}; | ||
493 | + | ||
494 | +// 服务器崩溃 | ||
495 | +const serverCrash = (req, res) => { | ||
496 | + res.render('installment/server-crash'); | ||
497 | +}; | ||
498 | + | ||
499 | +// 银行卡列表 | ||
500 | +const bankCard = (req, res) => { | ||
501 | + let uid = req.cookies.installmentUid || 512579468; | ||
502 | + | ||
503 | + installmentModel.getBankCards(uid).then((result) => { | ||
504 | + res.render('installment/bank-card', { | ||
505 | + title: '我的银行卡', | ||
506 | + isInstallmentPage: true, | ||
507 | + accountList: result | ||
508 | + }); | ||
509 | + }).catch(() => { | ||
510 | + _serverCrash(res, req.originalUrl); | ||
511 | + }); | ||
426 | }; | 512 | }; |
427 | 513 | ||
428 | module.exports = { | 514 | module.exports = { |
@@ -447,5 +533,9 @@ module.exports = { | @@ -447,5 +533,9 @@ module.exports = { | ||
447 | agreement, | 533 | agreement, |
448 | totalAmount, | 534 | totalAmount, |
449 | checkVerifyCode, | 535 | checkVerifyCode, |
450 | - getInstallmentGoods | 536 | + getInstallmentGoods, |
537 | + bindCard, | ||
538 | + serverCrash, | ||
539 | + bankCard, | ||
540 | + postAccount | ||
451 | }; | 541 | }; |
@@ -117,8 +117,12 @@ const _processRepayList = (list) => { | @@ -117,8 +117,12 @@ const _processRepayList = (list) => { | ||
117 | data.isThree = true; | 117 | data.isThree = true; |
118 | delete data.desc; | 118 | delete data.desc; |
119 | } else if (data.status === 2) { | 119 | } else if (data.status === 2) { |
120 | - data.repayStatus = '还款失败'; | ||
121 | - data.txt = `还款失败,${data.desc}`; | 120 | + data.txt = '还款失败'; |
121 | + | ||
122 | + if (data.desc || data.desc !== '') { | ||
123 | + data.txt += `,${data.desc}`; | ||
124 | + } | ||
125 | + | ||
122 | data.isTwo = true; | 126 | data.isTwo = true; |
123 | data.isThree = true; | 127 | data.isThree = true; |
124 | } else { | 128 | } else { |
@@ -320,7 +324,7 @@ const activateService = (params) => { | @@ -320,7 +324,7 @@ const activateService = (params) => { | ||
320 | method: 'user.instalment.activate', | 324 | method: 'user.instalment.activate', |
321 | debug: 'XYZ' // TODO: remove this | 325 | debug: 'XYZ' // TODO: remove this |
322 | }, params), { | 326 | }, params), { |
323 | - timeout: API_TIMEOUT | 327 | + timeout: 30000 |
324 | }); | 328 | }); |
325 | }; | 329 | }; |
326 | 330 |
@@ -29,6 +29,8 @@ router.get('/installment/repay/get-record', installment.getRepayRecord); // ajax | @@ -29,6 +29,8 @@ router.get('/installment/repay/get-record', installment.getRepayRecord); // ajax | ||
29 | router.get('/installment/repay/detail', installment.repayDetail); // 还款详情 | 29 | router.get('/installment/repay/detail', installment.repayDetail); // 还款详情 |
30 | 30 | ||
31 | router.get('/installment/account', installment.account); // 账户管理 | 31 | router.get('/installment/account', installment.account); // 账户管理 |
32 | +router.get('/installment/bind-card', installment.bindCard); // 添加新银行卡 | ||
33 | +router.get('/installment/post-account', installment.postAccount); // 添加新卡请求 | ||
32 | router.get('/installment/bank-info', installment.getBankInfo); | 34 | router.get('/installment/bank-info', installment.getBankInfo); |
33 | router.post('/installment/activate-service', installment.activateService); | 35 | router.post('/installment/activate-service', installment.activateService); |
34 | router.get('/installment/order', installment.orderIndex); | 36 | router.get('/installment/order', installment.orderIndex); |
@@ -39,4 +41,6 @@ router.get('/installment/total-amount.json', installment.totalAmount); | @@ -39,4 +41,6 @@ router.get('/installment/total-amount.json', installment.totalAmount); | ||
39 | router.get('/installment/help', installment.help);// 帮助静态页面 | 41 | router.get('/installment/help', installment.help);// 帮助静态页面 |
40 | router.get('/installment/agreement', installment.agreement);// 服务协议\服务条款静态页面 | 42 | router.get('/installment/agreement', installment.agreement);// 服务协议\服务条款静态页面 |
41 | 43 | ||
44 | +router.get('/installment/server-crash', installment.serverCrash); // 服务器崩溃 | ||
45 | +router.get('/installment/bank-card', installment.bankCard); // 银行卡列表 | ||
42 | module.exports = router; | 46 | module.exports = router; |
1 | <div class="account-page"> | 1 | <div class="account-page"> |
2 | <ul class="account-list"> | 2 | <ul class="account-list"> |
3 | - {{#accountList}} | ||
4 | - <li>我的银行卡:<div class="list-right">{{cardNo}}</div></li> | ||
5 | - {{/accountList}} | 3 | + <li><a href="/home/installment/bank-card">我的银行卡:<div class="list-right"><span class="iconfont"></span></div></a></li> |
6 | </ul> | 4 | </ul> |
7 | -</div> | ||
5 | +</div> |
@@ -26,4 +26,13 @@ | @@ -26,4 +26,13 @@ | ||
26 | <a href="{{url}}" class="open-btn">去逛逛</a> | 26 | <a href="{{url}}" class="open-btn">去逛逛</a> |
27 | </div> | 27 | </div> |
28 | {{/ error}} | 28 | {{/ error}} |
29 | + {{#cancel}} | ||
30 | + <div class="cancel"> | ||
31 | + <i class="cancel-icon"></i> | ||
32 | + <p class="cancel-txt1">账户已注销</p> | ||
33 | + <p class="cancel-txt2">您的有货分期账户经本人确认已注销,<br>如有疑问,请联系客服。<br>提示:已注销用户不可再开通</p> | ||
34 | + <p></p> | ||
35 | + <a href="{{url}}" class="open-btn">先去逛逛</a> | ||
36 | + </div> | ||
37 | + {{/cancel}} | ||
29 | </div> | 38 | </div> |
@@ -23,6 +23,7 @@ | @@ -23,6 +23,7 @@ | ||
23 | <label for="name">卡号:</label> | 23 | <label for="name">卡号:</label> |
24 | 24 | ||
25 | <input id="cardNo" name="cardNo" type="tel" placeholder="银行卡号" size="26" maxlength="23"/> | 25 | <input id="cardNo" name="cardNo" type="tel" placeholder="银行卡号" size="26" maxlength="23"/> |
26 | + <span class="iconfont notice"></span> | ||
26 | <div class="clearfix"></div> | 27 | <div class="clearfix"></div> |
27 | </div> | 28 | </div> |
28 | 29 | ||
@@ -72,4 +73,16 @@ | @@ -72,4 +73,16 @@ | ||
72 | </div> | 73 | </div> |
73 | </div> | 74 | </div> |
74 | </form> | 75 | </form> |
76 | + <div class="installment-overdue-notice"> | ||
77 | + <div class="mask-bg"></div> | ||
78 | + <div class="notice-area"> | ||
79 | + <div class="notice-cont"> | ||
80 | + <h2>支持银行</h2> | ||
81 | + <p>农业银行、中国银行、工商银行、建设银行、</p> | ||
82 | + <p>光大银行、兴业银行、邮储银行、民生银行、</p> | ||
83 | + <p>平安银行、中信银行、广发银行</p> | ||
84 | + </div> | ||
85 | + <div class="think-ok">我知道了</div> | ||
86 | + </div> | ||
87 | + </div> | ||
75 | </div> | 88 | </div> |
public/js/home/bind-card-check.js
0 → 100644
1 | +/** | ||
2 | + * 银行卡校验 | ||
3 | + * @author: wsl<shuiling.wang@yoho.cn> | ||
4 | + * @date: 2016/08/25 | ||
5 | + */ | ||
6 | +var $ = require('yoho-jquery'); | ||
7 | +var tip = require('../plugin/tip'); | ||
8 | +var debounce = require('lodash/debounce'); | ||
9 | + | ||
10 | +var debounceFn = debounce(function(cardNo, formModel) { | ||
11 | + formModel.bankCode = ''; | ||
12 | + formModel.bankName = ''; | ||
13 | + | ||
14 | + // 获取银行信息 | ||
15 | + $.get('/home/installment/bank-info', {cardNo: cardNo}).then(function(result) { | ||
16 | + if (result.code === 200) { | ||
17 | + if (result.data.bankCode) { | ||
18 | + formModel.bankCode = result.data.bankCode; | ||
19 | + formModel.bankName = result.data.bankName; | ||
20 | + | ||
21 | + // 设置银行名称 | ||
22 | + $('#bank-name').text(result.data.bankName); | ||
23 | + | ||
24 | + // 设置银行图标 | ||
25 | + $('#bank-icon').show().attr('src', | ||
26 | + window.STATIC_RESOURCE_PATH + | ||
27 | + '/img/home/bank-icons/' + result.data.bankCode + '.png'); | ||
28 | + $('#bank-desc').show(); | ||
29 | + } | ||
30 | + | ||
31 | + // 返回1不支持, 孟令阶 | ||
32 | + if (result && result.data && result.data.businessSupport === '1') { | ||
33 | + $('#bank-name').text('暂不支持此银行卡'); | ||
34 | + $('#bank-desc').show(); | ||
35 | + $('#bank-icon').hide(); | ||
36 | + } | ||
37 | + } else { | ||
38 | + tip.show(result.message); | ||
39 | + $('#bank-desc').hide(); | ||
40 | + } | ||
41 | + }); | ||
42 | +}, 1000); | ||
43 | + | ||
44 | +var checkCard = function(formModel) { | ||
45 | + // 银行卡格式化 | ||
46 | + $('#cardNo').keyup(function() { | ||
47 | + var value = $(this).val(); | ||
48 | + | ||
49 | + $(this).val(value.replace(/[^\d]/g, '').replace(/(\d{4})(?=\d)/g, '$1 ')).trigger('change'); | ||
50 | + | ||
51 | + }).change(function() { | ||
52 | + var cardNo = $(this).val().replace(/\s/g, ''); | ||
53 | + | ||
54 | + if (cardNo && cardNo.length >= 16) { | ||
55 | + debounceFn(cardNo, formModel); | ||
56 | + } else { | ||
57 | + $('#bank-desc').hide(); | ||
58 | + } | ||
59 | + }); | ||
60 | +}; | ||
61 | + | ||
62 | +module.exports = checkCard; |
public/js/home/bind-card.page.js
0 → 100644
1 | +/** | ||
2 | + * 新增银行卡 | ||
3 | + * @author: wsl<shuiling.wang@yoho.cn> | ||
4 | + * @date: 2016/08/25 | ||
5 | + */ | ||
6 | + | ||
7 | +var $ = require('yoho-jquery'); | ||
8 | +var tip = require('../plugin/tip'); | ||
9 | +var checkCard = require('./bind-card-check'); | ||
10 | +var applyButton = $('.open-btn'); | ||
11 | +var flag = true; | ||
12 | +var formData = { | ||
13 | + cardNo: '', | ||
14 | + mobile: '', | ||
15 | + bankName: '', | ||
16 | + bankCode: '' | ||
17 | +}; | ||
18 | + | ||
19 | +var validateForm = function() { | ||
20 | + var ret = false; | ||
21 | + | ||
22 | + if (formData.cardNo && | ||
23 | + formData.mobile && | ||
24 | + formData.bankName && | ||
25 | + formData.bankCode) { | ||
26 | + applyButton.removeClass('disabled'); | ||
27 | + ret = true; | ||
28 | + } else { | ||
29 | + applyButton.addClass('disabled'); | ||
30 | + ret = false; | ||
31 | + } | ||
32 | + | ||
33 | + return ret; | ||
34 | +}; | ||
35 | + | ||
36 | +checkCard(formData); | ||
37 | + | ||
38 | +// 输入框改变时同时更新模型 | ||
39 | +$('input').on('change', function() { | ||
40 | + var name = $(this).attr('name'); | ||
41 | + | ||
42 | + formData[name] = $(this).val(); | ||
43 | + | ||
44 | + validateForm(); | ||
45 | +}); | ||
46 | + | ||
47 | +applyButton.on('click', function() { | ||
48 | + var self = this; | ||
49 | + | ||
50 | + if (!flag || $(this).hasClass('disabled') || !validateForm()) { | ||
51 | + return false; | ||
52 | + } | ||
53 | + | ||
54 | + if (!/^1[3|4|5|8|7][0-9]{9}$/.test(formData.mobile)) { | ||
55 | + tip.show('手机号输入不正确!'); | ||
56 | + return false; | ||
57 | + } | ||
58 | + | ||
59 | + flag = false; | ||
60 | + | ||
61 | + $.ajax({ | ||
62 | + type: 'GET', | ||
63 | + url: '/home/installment/post-account', | ||
64 | + data: formData, | ||
65 | + async: false, | ||
66 | + success: function(data) { | ||
67 | + var params = { | ||
68 | + action: 'go.bindCardResult', | ||
69 | + params: { | ||
70 | + status: 0 | ||
71 | + } | ||
72 | + }; | ||
73 | + var url = location.href + '&openby:yohobuy='; | ||
74 | + | ||
75 | + if (data.code === 200) { | ||
76 | + params.params.status = 1; | ||
77 | + } | ||
78 | + | ||
79 | + url += encodeURIComponent(JSON.stringify(params)); | ||
80 | + | ||
81 | + $(self).attr('href', url); | ||
82 | + return true; | ||
83 | + }, | ||
84 | + error: function() { | ||
85 | + tip.show('网络断开连接了~'); | ||
86 | + flag = true; | ||
87 | + return false; | ||
88 | + } | ||
89 | + }); | ||
90 | +}); | ||
91 | + |
1 | var $ = require('yoho-jquery'); | 1 | var $ = require('yoho-jquery'); |
2 | var tip = require('../plugin/tip'); | 2 | var tip = require('../plugin/tip'); |
3 | -var debounce = require('lodash/debounce'); | ||
4 | 3 | ||
5 | var Timer = function() { | 4 | var Timer = function() { |
6 | this.counter = 0; | 5 | this.counter = 0; |
@@ -46,44 +45,48 @@ var validateForm = function() { | @@ -46,44 +45,48 @@ var validateForm = function() { | ||
46 | return ret; | 45 | return ret; |
47 | }; | 46 | }; |
48 | 47 | ||
48 | +var checkCard = require('./bind-card-check'); | ||
49 | + | ||
49 | const clearVerifyCode = function() { | 50 | const clearVerifyCode = function() { |
50 | formModel.snsCheckCode = ''; | 51 | formModel.snsCheckCode = ''; |
51 | $('#sns-check-code').val(''); | 52 | $('#sns-check-code').val(''); |
52 | }; | 53 | }; |
53 | 54 | ||
54 | -var debounceFn = debounce(function(cardNo) { | ||
55 | - formModel.bankCode = ''; | ||
56 | - formModel.bankName = ''; | ||
57 | - | ||
58 | - // 获取银行信息 | ||
59 | - $.get('/home/installment/bank-info', {cardNo: cardNo}).then(function(result) { | ||
60 | - if (result.code === 200) { | ||
61 | - if (result.data.bankCode) { | ||
62 | - formModel.bankCode = result.data.bankCode; | ||
63 | - formModel.bankName = result.data.bankName; | ||
64 | - | ||
65 | - // 设置银行名称 | ||
66 | - $('#bank-name').text(result.data.bankName); | ||
67 | - | ||
68 | - // 设置银行图标 | ||
69 | - $('#bank-icon').show().attr('src', | ||
70 | - window.STATIC_RESOURCE_PATH + | ||
71 | - '/img/home/bank-icons/' + result.data.bankCode + '.png'); | ||
72 | - $('#bank-desc').show(); | ||
73 | - } | ||
74 | - | ||
75 | - // 返回1不支持, 孟令阶 | ||
76 | - if (result && result.data && result.data.businessSupport === '1') { | ||
77 | - $('#bank-name').text('暂不支持此银行卡'); | ||
78 | - $('#bank-desc').show(); | ||
79 | - $('#bank-icon').hide(); | ||
80 | - } | ||
81 | - } else { | ||
82 | - tip.show(result.message); | ||
83 | - $('#bank-desc').hide(); | ||
84 | - } | ||
85 | - }); | ||
86 | -}, 1000); | 55 | +checkCard(formModel); |
56 | + | ||
57 | +// var debounceFn = debounce(function(cardNo) { | ||
58 | +// formModel.bankCode = ''; | ||
59 | +// formModel.bankName = ''; | ||
60 | +// | ||
61 | +// // 获取银行信息 | ||
62 | +// $.get('/home/installment/bank-info', {cardNo: cardNo}).then(function(result) { | ||
63 | +// if (result.code === 200) { | ||
64 | +// if (result.data.bankCode) { | ||
65 | +// formModel.bankCode = result.data.bankCode; | ||
66 | +// formModel.bankName = result.data.bankName; | ||
67 | +// | ||
68 | +// // 设置银行名称 | ||
69 | +// $('#bank-name').text(result.data.bankName); | ||
70 | +// | ||
71 | +// // 设置银行图标 | ||
72 | +// $('#bank-icon').show().attr('src', | ||
73 | +// window.STATIC_RESOURCE_PATH + | ||
74 | +// '/img/home/bank-icons/' + result.data.bankCode + '.png'); | ||
75 | +// $('#bank-desc').show(); | ||
76 | +// } | ||
77 | +// | ||
78 | +// // 返回1不支持, 孟令阶 | ||
79 | +// if (result && result.data && result.data.businessSupport === '1') { | ||
80 | +// $('#bank-name').text('暂不支持此银行卡'); | ||
81 | +// $('#bank-desc').show(); | ||
82 | +// $('#bank-icon').hide(); | ||
83 | +// } | ||
84 | +// } else { | ||
85 | +// tip.show(result.message); | ||
86 | +// $('#bank-desc').hide(); | ||
87 | +// } | ||
88 | +// }); | ||
89 | +// }, 1000); | ||
87 | 90 | ||
88 | /** | 91 | /** |
89 | * 倒计时 | 92 | * 倒计时 |
@@ -181,18 +184,20 @@ $('#send-sms').click(function() { | @@ -181,18 +184,20 @@ $('#send-sms').click(function() { | ||
181 | /** | 184 | /** |
182 | * 银行卡格式化 | 185 | * 银行卡格式化 |
183 | */ | 186 | */ |
184 | -$('#cardNo').keyup(function() { | ||
185 | - var value = $(this).val(); | ||
186 | - var cardNo = $(this).val().replace(/\s/g, ''); | ||
187 | - | ||
188 | - $(this).val(value.replace(/[^\d]/g, '').replace(/(\d{4})(?=\d)/g, '$1 ')).trigger('change'); | ||
189 | - | ||
190 | - if (cardNo && cardNo.length >= 16) { | ||
191 | - debounceFn(cardNo); | ||
192 | - } else { | ||
193 | - $('#bank-desc').hide(); | ||
194 | - } | ||
195 | -}); | 187 | +// $('#cardNo').keyup(function() { |
188 | +// var value = $(this).val(); | ||
189 | +// | ||
190 | +// $(this).val(value.replace(/[^\d]/g, '').replace(/(\d{4})(?=\d)/g, '$1 ')).trigger('change'); | ||
191 | +// | ||
192 | +// }).change(function() { | ||
193 | +// var cardNo = $(this).val().replace(/\s/g, ''); | ||
194 | +// | ||
195 | +// if (cardNo && cardNo.length >= 16) { | ||
196 | +// debounceFn(cardNo); | ||
197 | +// } else { | ||
198 | +// $('#bank-desc').hide(); | ||
199 | +// } | ||
200 | +// }); | ||
196 | 201 | ||
197 | 202 | ||
198 | // 输入框改变时同时更新模型 | 203 | // 输入框改变时同时更新模型 |
@@ -321,3 +326,5 @@ $('#agreements').click(function() { | @@ -321,3 +326,5 @@ $('#agreements').click(function() { | ||
321 | 326 | ||
322 | $(this).attr('href', location.pathname + '?openby:yohobuy=' + encodeURIComponent(JSON.stringify(params))); | 327 | $(this).attr('href', location.pathname + '?openby:yohobuy=' + encodeURIComponent(JSON.stringify(params))); |
323 | }); | 328 | }); |
329 | + | ||
330 | +require('./overdue-notice'); |
@@ -9,3 +9,10 @@ $('.repay-list .notice').on('click', function() { | @@ -9,3 +9,10 @@ $('.repay-list .notice').on('click', function() { | ||
9 | $('.think-ok, .mask-bg').on('click', function() { | 9 | $('.think-ok, .mask-bg').on('click', function() { |
10 | $notice.hide(); | 10 | $notice.hide(); |
11 | }); | 11 | }); |
12 | + | ||
13 | + | ||
14 | +$('.installment-starting-service-page .notice').on('click', function() { | ||
15 | + $notice.show(); | ||
16 | + | ||
17 | + return false; | ||
18 | +}); |
public/scss/home/installment/_bank-card.css
0 → 100644
1 | +.bank-card-page { | ||
2 | + .bank-card-list { | ||
3 | + padding: 30px 30px 0; | ||
4 | + } | ||
5 | + | ||
6 | + li { | ||
7 | + width: 580px; | ||
8 | + height: 200px; | ||
9 | + margin-bottom: 30px; | ||
10 | + position: relative; | ||
11 | + background: #000; | ||
12 | + border-radius: 10px; | ||
13 | + background-size: contain; | ||
14 | + | ||
15 | + span { | ||
16 | + position: absolute; | ||
17 | + right: 30px; | ||
18 | + bottom: 30px; | ||
19 | + color: #fff; | ||
20 | + font-size: 40px; | ||
21 | + } | ||
22 | + } | ||
23 | +} |
@@ -40,7 +40,7 @@ | @@ -40,7 +40,7 @@ | ||
40 | .open-icon-2 { | 40 | .open-icon-2 { |
41 | background: url("/home/installment-icon2.png") no-repeat; | 41 | background: url("/home/installment-icon2.png") no-repeat; |
42 | width: 67px; | 42 | width: 67px; |
43 | - height: 72px; | 43 | + height: 67px; |
44 | display: block; | 44 | display: block; |
45 | margin: 0 auto 34px; | 45 | margin: 0 auto 34px; |
46 | } | 46 | } |
@@ -48,7 +48,7 @@ | @@ -48,7 +48,7 @@ | ||
48 | .open-icon-3 { | 48 | .open-icon-3 { |
49 | background: url("/home/installment-icon3.png") no-repeat; | 49 | background: url("/home/installment-icon3.png") no-repeat; |
50 | width: 67px; | 50 | width: 67px; |
51 | - height: 68px; | 51 | + height: 67px; |
52 | display: block; | 52 | display: block; |
53 | margin: 0 auto 34px; | 53 | margin: 0 auto 34px; |
54 | } | 54 | } |
@@ -101,6 +101,33 @@ | @@ -101,6 +101,33 @@ | ||
101 | margin: 94px auto 60px; | 101 | margin: 94px auto 60px; |
102 | } | 102 | } |
103 | 103 | ||
104 | + .success-icon { | ||
105 | + background: resolve("home/review-img-4.png") no-repeat; | ||
106 | + background-size: contain; | ||
107 | + width: 208px; | ||
108 | + height: 208px; | ||
109 | + display: block; | ||
110 | + margin: 94px auto 60px; | ||
111 | + } | ||
112 | + | ||
113 | + .cancel-icon { | ||
114 | + background: resolve("home/review-img-5.png") no-repeat; | ||
115 | + background-size: contain; | ||
116 | + width: 208px; | ||
117 | + height: 208px; | ||
118 | + display: block; | ||
119 | + margin: 196px auto 60px; | ||
120 | + } | ||
121 | + | ||
122 | + .refresh-icon { | ||
123 | + background: resolve("home/review-img-6.png") no-repeat; | ||
124 | + background-size: contain; | ||
125 | + width: 168px; | ||
126 | + height: 168px; | ||
127 | + display: block; | ||
128 | + margin: 225px auto 35px; | ||
129 | + } | ||
130 | + | ||
104 | .font-b { | 131 | .font-b { |
105 | font-size: 30px; | 132 | font-size: 30px; |
106 | text-align: center; | 133 | text-align: center; |
@@ -153,6 +180,33 @@ | @@ -153,6 +180,33 @@ | ||
153 | } | 180 | } |
154 | } | 181 | } |
155 | 182 | ||
183 | + .cancel { | ||
184 | + p { | ||
185 | + text-align: center; | ||
186 | + } | ||
187 | + | ||
188 | + .cancel-txt1 { | ||
189 | + font-size: 24px; | ||
190 | + color: #444; | ||
191 | + } | ||
192 | + | ||
193 | + .cancel-txt2 { | ||
194 | + color: #bbb; | ||
195 | + font-size: 22px; | ||
196 | + line-height: 40px; | ||
197 | + margin: 10px 0 65px; | ||
198 | + } | ||
199 | + } | ||
200 | + | ||
201 | + .server-crash { | ||
202 | + p { | ||
203 | + text-align: center; | ||
204 | + color: #444; | ||
205 | + font-size: 24px; | ||
206 | + margin-bottom: 100px; | ||
207 | + } | ||
208 | + } | ||
209 | + | ||
156 | .detail-tab { | 210 | .detail-tab { |
157 | background: #000; | 211 | background: #000; |
158 | height: 90px; | 212 | height: 90px; |
@@ -99,6 +99,7 @@ | @@ -99,6 +99,7 @@ | ||
99 | input[type=text], | 99 | input[type=text], |
100 | input[type=number], | 100 | input[type=number], |
101 | input[type=tel] { | 101 | input[type=tel] { |
102 | + width: 422px; | ||
102 | font-size: 27px; | 103 | font-size: 27px; |
103 | height: 40px; | 104 | height: 40px; |
104 | color: #444; | 105 | color: #444; |
@@ -121,6 +122,20 @@ | @@ -121,6 +122,20 @@ | ||
121 | text-align: center; | 122 | text-align: center; |
122 | margin-top: 30px; | 123 | margin-top: 30px; |
123 | } | 124 | } |
125 | + | ||
126 | + .notice { | ||
127 | + float: right; | ||
128 | + font-size: 28px; | ||
129 | + color: #444; | ||
130 | + padding: 2px 10px 10px; | ||
131 | + } | ||
132 | + | ||
133 | + .installment-overdue-notice { | ||
134 | + .notice-area { | ||
135 | + width: 560px; | ||
136 | + margin: -165px 0 0 -280px; | ||
137 | + } | ||
138 | + } | ||
124 | } | 139 | } |
125 | 140 | ||
126 | .installment-check-btn { | 141 | .installment-check-btn { |
-
Please register or login to post a comment