Authored by 王水玲

Merge branch 'feature/installment' of git.yoho.cn:fe/yohobuywap-node into feature/installment

@@ -255,13 +255,14 @@ const orderIndex = (req, res) => { @@ -255,13 +255,14 @@ const orderIndex = (req, res) => {
255 module: 'home', 255 module: 'home',
256 page: 'installment.order', 256 page: 'installment.order',
257 title: '我的分期订单', 257 title: '我的分期订单',
258 - navBtn: false 258 + navBtn: false,
  259 + isInstallmentPage: true
259 }); 260 });
260 }; 261 };
261 262
262 -const orderList = (req, res) => { 263 +const orderList = (req, res, next) => {
263 const params = { 264 const params = {
264 - uid: req.user.uid || 8041876, // TODO: fix me 265 + uid: req.cookies.installmentUid || 8041876, // TODO: fix me
265 type: req.query.type || 1, 266 type: req.query.type || 1,
266 page: req.query.page || 1, 267 page: req.query.page || 1,
267 limit: req.query.limit || 10 268 limit: req.query.limit || 10
@@ -270,15 +271,16 @@ const orderList = (req, res) => { @@ -270,15 +271,16 @@ const orderList = (req, res) => {
270 installmentModel.getInstallmentOrders(params).then((result)=> { 271 installmentModel.getInstallmentOrders(params).then((result)=> {
271 res.render('installment/order-list', { 272 res.render('installment/order-list', {
272 title: '我的分期订单', 273 title: '我的分期订单',
273 - orders: result.data.orderList,  
274 - layout: false 274 + orders: result.data ? result.data.orderList : [],
  275 + layout: false,
  276 + isInstallmentPage: true
275 }); 277 });
276 - }); 278 + }).catch(next);
277 }; 279 };
278 280
279 -const orderDetail = (req, res) => { 281 +const orderDetail = (req, res, next) => {
280 const params = { 282 const params = {
281 - uid: req.user.id || 8041876, // TODO: fix me 283 + uid: req.cookies.installmentUid || 8041876, // TODO: fix me
282 orderCode: req.params.id 284 orderCode: req.params.id
283 }; 285 };
284 286
@@ -309,7 +311,7 @@ const orderDetail = (req, res) => { @@ -309,7 +311,7 @@ const orderDetail = (req, res) => {
309 } 311 }
310 } 312 }
311 }); 313 });
312 - }); 314 + }).catch(next);
313 }; 315 };
314 316
315 // 还款详情 317 // 还款详情
1 -{{#each orders}}  
2 - <li>  
3 - <a href="/home/installment/order/{{orderCode}}">  
4 - {{#orderGoods}}  
5 - <div class="image-box">  
6 - <img src="{{image goodsImage 90 120}}" alt="{{productName}}">  
7 - </div>  
8 - <div class="title-box">  
9 - <div>{{productName}}</div>  
10 - <div class="date-box">{{../createTime}}</div>  
11 - </div>  
12 - {{/orderGoods}}  
13 - </a> 1 +{{#if orders}}
  2 + {{#each orders}}
  3 + <li>
  4 + <a href="/home/installment/order/{{orderCode}}">
  5 + {{#orderGoods}}
  6 + <div class="image-box">
  7 + <img src="{{image goodsImage 90 120}}" alt="{{productName}}">
  8 + </div>
  9 + <div class="title-box">
  10 + <div class="product-name">{{productName}}</div>
  11 + <div class="date-box">{{../createTime}}</div>
  12 + </div>
  13 + {{/orderGoods}}
  14 + </a>
  15 +
  16 + <div class="right-box">
  17 + <div class="amount">¥{{amount}}</div>
  18 + <div class="status">{{installStatus}}</div>
  19 + </div>
  20 + <div class="clearfix"></div>
  21 + </li>
  22 + {{/each}}
  23 +{{/if}}
14 24
15 - <div class="right-box">  
16 - <div class="amount">¥{{amount}}</div>  
17 - <div class="status">{{installStatus}}</div>  
18 - </div>  
19 - <div class="clearfix"></div>  
20 - </li>  
21 -{{/each}}  
1 -<div class="installment-order-page"> 1 +<div class="repayment-list-page installment-order-page">
2 {{> resources/banner-top}} 2 {{> resources/banner-top}}
3 <ul class="header-tab"> 3 <ul class="header-tab">
4 <li class="active"> 4 <li class="active">
@@ -15,5 +15,10 @@ @@ -15,5 +15,10 @@
15 <div class="order-list-container"> 15 <div class="order-list-container">
16 <ul id="order-list" class="order-list"> 16 <ul id="order-list" class="order-list">
17 </ul> 17 </ul>
  18 + <div id="no-result" class="no-result" style="display: none;">
  19 + <i class="result-icon"></i>
  20 + <p class="txt" id="no-result-text">暂无订单</p>
  21 + <a href="/product/new" class="guang-btn">去逛逛</a>
  22 + </div>
18 </div> 23 </div>
19 </div> 24 </div>
@@ -35,13 +35,13 @@ @@ -35,13 +35,13 @@
35 35
36 <div class="field"> 36 <div class="field">
37 <label for="name">手机号:</label> 37 <label for="name">手机号:</label>
38 - <input id="name" name="mobile" type="text" placeholder="银行预留手机号码" maxlength="11"/> 38 + <input id="mobile" name="mobile" type="text" placeholder="银行预留手机号码" maxlength="11"/>
39 <div class="clearfix"></div> 39 <div class="clearfix"></div>
40 </div> 40 </div>
41 41
42 <div class="field"> 42 <div class="field">
43 <label for="name">验证码:</label> 43 <label for="name">验证码:</label>
44 - <input id="name" name="snsCheckCode" type="text" placeholder="请输入验证码" size="14" maxlength="6"/> 44 + <input id="sns-check-code" name="snsCheckCode" type="text" placeholder="请输入验证码" size="14" maxlength="6"/>
45 <button id="send-sms" class="count-down">获取验证码</button> 45 <button id="send-sms" class="count-down">获取验证码</button>
46 <div class="clearfix"></div> 46 <div class="clearfix"></div>
47 </div> 47 </div>
@@ -33,6 +33,14 @@ var loadOrderList = function(pageIndex, type) { @@ -33,6 +33,14 @@ var loadOrderList = function(pageIndex, type) {
33 $(this).addClass('faded'); 33 $(this).addClass('faded');
34 } 34 }
35 }); 35 });
  36 +
  37 + if ($('#order-list li').length === 0) {
  38 + $('#no-result').show();
  39 + $('#order-list').hide();
  40 + } else {
  41 + $('#order-list').show();
  42 + $('#no-result').hide();
  43 + }
36 }); 44 });
37 } 45 }
38 }; 46 };
@@ -43,6 +43,11 @@ var validateForm = function() { @@ -43,6 +43,11 @@ var validateForm = function() {
43 return ret; 43 return ret;
44 }; 44 };
45 45
  46 +const clearVerifyCode = function() {
  47 + formModel.snsCheckCode = '';
  48 + $('#sns-check-code').val('');
  49 +};
  50 +
46 var debounceFn = debounce(function(cardNo) { 51 var debounceFn = debounce(function(cardNo) {
47 // 获取银行信息 52 // 获取银行信息
48 $.get('/home/installment/bank-info', {cardNo: cardNo}).then(function(result) { 53 $.get('/home/installment/bank-info', {cardNo: cardNo}).then(function(result) {
@@ -183,6 +188,7 @@ setInterval(function() { @@ -183,6 +188,7 @@ setInterval(function() {
183 validateForm(); 188 validateForm();
184 }, 500); 189 }, 500);
185 190
  191 +
186 /** 192 /**
187 * 表单提交 193 * 表单提交
188 */ 194 */
@@ -208,9 +214,13 @@ $('#apply-button').click(function() { @@ -208,9 +214,13 @@ $('#apply-button').click(function() {
208 if (result.data.resultMsgType === '1') { 214 if (result.data.resultMsgType === '1') {
209 tip.show(result.data.resultMsg); 215 tip.show(result.data.resultMsg);
210 } 216 }
  217 +
  218 + clearVerifyCode();
211 } 219 }
  220 +
212 } else { 221 } else {
213 tip.show(result.message); 222 tip.show(result.message);
  223 + clearVerifyCode();
214 } 224 }
215 }); 225 });
216 226
@@ -2,3 +2,31 @@ @@ -2,3 +2,31 @@
2 @import "starting-service"; 2 @import "starting-service";
3 @import "repayment-list"; 3 @import "repayment-list";
4 @import "order"; 4 @import "order";
  5 +
  6 +.no-result {
  7 + .result-icon {
  8 + width: 153px;
  9 + height: 197px;
  10 + background: resolve("home/review-img-3.png") no-repeat;
  11 + background-size: contain;
  12 + margin: 198px auto 36px;
  13 + display: block;
  14 + }
  15 +
  16 + .txt {
  17 + text-align: center;
  18 + color: #444;
  19 + }
  20 +
  21 + .guang-btn {
  22 + width: 472px;
  23 + height: 88px;
  24 + background: #444;
  25 + color: #fff;
  26 + text-align: center;
  27 + line-height: 88px;
  28 + border-radius: 6px;
  29 + margin: 110px auto 0;
  30 + display: block;
  31 + }
  32 +}
@@ -57,8 +57,14 @@ @@ -57,8 +57,14 @@
57 57
58 .title-box { 58 .title-box {
59 margin-left: 22px; 59 margin-left: 22px;
60 - width: 240px;  
61 - overflow: hidden; 60 + width: 320px;
  61 +
  62 + .product-name {
  63 + overflow: hidden;
  64 + display: -webkit-box;
  65 + -webkit-line-clamp: 2;
  66 + -webkit-box-orient: vertical;
  67 + }
62 } 68 }
63 69
64 .date-box { 70 .date-box {
@@ -124,34 +124,6 @@ @@ -124,34 +124,6 @@
124 } 124 }
125 } 125 }
126 126
127 - .no-result {  
128 - .result-icon {  
129 - width: 153px;  
130 - height: 197px;  
131 - background: resolve("home/review-img-3.png") no-repeat;  
132 - background-size: contain;  
133 - margin: 198px auto 36px;  
134 - display: block;  
135 - }  
136 -  
137 - .txt {  
138 - text-align: center;  
139 - color: #444;  
140 - }  
141 -  
142 - .guang-btn {  
143 - width: 472px;  
144 - height: 88px;  
145 - background: #444;  
146 - color: #fff;  
147 - text-align: center;  
148 - line-height: 88px;  
149 - border-radius: 6px;  
150 - margin: 110px auto 0;  
151 - display: block;  
152 - }  
153 - }  
154 -  
155 .repay-now { 127 .repay-now {
156 width: 100%; 128 width: 100%;
157 background: #fff; 129 background: #fff;