Merge branch 'feature/installment' of git.yoho.cn:fe/yohobuywap-node into feature/installment
Showing
6 changed files
with
99 additions
and
64 deletions
@@ -32,46 +32,47 @@ | @@ -32,46 +32,47 @@ | ||
32 | </div> | 32 | </div> |
33 | </div> | 33 | </div> |
34 | </div> | 34 | </div> |
35 | + <div class="detail-list-container"> | ||
36 | + <ul class="installment-list repay-list"> | ||
37 | + {{#each packageList}} | ||
38 | + <li> | ||
39 | + {{#isPaymentIncomplete status}} | ||
40 | + <input id="sort-{{@index}}" type="checkbox" | ||
41 | + class="installment-check-btn installment-term" | ||
42 | + data-order-code="{{../orderCode}}" | ||
43 | + data-sort-id="{{sortId}}" | ||
44 | + data-fee="{{currFeeAmt}}" | ||
45 | + data-delay-fee="{{currDealyFeeAmt}}" | ||
46 | + data-amount="{{currPrincipalAmt}}"/> | ||
47 | + {{/isPaymentIncomplete}} | ||
48 | + <label for="sort-{{@index}}"> | ||
49 | + {{#isPaymentComplete status}} | ||
50 | + <span class="detail-index">{{sortId}}.</span> | ||
51 | + {{/isPaymentComplete}} | ||
35 | 52 | ||
36 | - <ul class="installment-list repay-list"> | ||
37 | - {{#each packageList}} | ||
38 | - <li> | ||
39 | - {{#isPaymentIncomplete status}} | ||
40 | - <input id="sort-{{@index}}" type="checkbox" | ||
41 | - class="installment-check-btn installment-term" | ||
42 | - data-order-code="{{../orderCode}}" | ||
43 | - data-sort-id="{{sortId}}" | ||
44 | - data-fee="{{currFeeAmt}}" | ||
45 | - data-delay-fee="{{currDealyFeeAmt}}" | ||
46 | - data-amount="{{currPrincipalAmt}}"/> | ||
47 | - {{/isPaymentIncomplete}} | ||
48 | - <label for="sort-{{@index}}"> | ||
49 | - {{#isPaymentComplete status}} | ||
50 | - <span class="detail-index">{{sortId}}.</span> | ||
51 | - {{/isPaymentComplete}} | 53 | + <span class="amount">¥{{currAmt}}</span> |
54 | + <div class="fee"> | ||
55 | + {{currDate}} | ||
56 | + 本金:¥{{currPrincipalAmt}} | ||
52 | 57 | ||
53 | - <span class="amount">¥{{currAmt}}</span> | ||
54 | - <div class="fee"> | ||
55 | - {{currDate}} | ||
56 | - 本金:¥{{currPrincipalAmt}} | 58 | + {{#if currFeeAmt}} |
59 | + 服务费:¥{{currFeeAmt}} | ||
60 | + {{/if}} | ||
57 | 61 | ||
58 | - {{#if currFeeAmt}} | ||
59 | - 服务费:¥{{currFeeAmt}} | ||
60 | - {{/if}} | ||
61 | - | ||
62 | - {{#if currDealyFeeAmt}} | ||
63 | - 逾期服务费:¥{{currDealyFeeAmt}} | ||
64 | - {{/if}} | ||
65 | - </div> | ||
66 | - <div class="status"> | ||
67 | - {{desc}} | ||
68 | - <span class="iconfont notice"></span> | ||
69 | - </div> | ||
70 | - <div class="clearfix"></div> | ||
71 | - </label> | ||
72 | - </li> | ||
73 | - {{/each}} | ||
74 | - </ul> | 62 | + {{#if currDealyFeeAmt}} |
63 | + 逾期服务费:¥{{currDealyFeeAmt}} | ||
64 | + {{/if}} | ||
65 | + </div> | ||
66 | + <div class="status"> | ||
67 | + {{desc}} | ||
68 | + <span class="iconfont notice"></span> | ||
69 | + </div> | ||
70 | + <div class="clearfix"></div> | ||
71 | + </label> | ||
72 | + </li> | ||
73 | + {{/each}} | ||
74 | + </ul> | ||
75 | + </div> | ||
75 | {{/order}} | 76 | {{/order}} |
76 | {{> installment/repayment-bottom}} | 77 | {{> installment/repayment-bottom}} |
77 | </div> | 78 | </div> |
1 | -<ul> | ||
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>{{productName}}</div> | ||
11 | - <div class="date-box">{{../createTime}}</div> | ||
12 | - </div> | ||
13 | - {{/orderGoods}} | ||
14 | - </a> | 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> | ||
15 | 14 | ||
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 | -</ul> | 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}} |
@@ -22,6 +22,9 @@ var repayment = new Repayment({ | @@ -22,6 +22,9 @@ var repayment = new Repayment({ | ||
22 | 22 | ||
23 | return ret; | 23 | return ret; |
24 | }, | 24 | }, |
25 | + onGetSelectableCount: function() { | ||
26 | + return $(CHECKBOX_SELECTOR).length; | ||
27 | + }, | ||
25 | onDeselectAll: function() { | 28 | onDeselectAll: function() { |
26 | $(CHECKBOX_SELECTOR + ':checked').prop('checked', false); | 29 | $(CHECKBOX_SELECTOR + ':checked').prop('checked', false); |
27 | return []; | 30 | return []; |
@@ -76,3 +79,7 @@ $(CHECKBOX_SELECTOR + ':checkbox').click(function() { | @@ -76,3 +79,7 @@ $(CHECKBOX_SELECTOR + ':checkbox').click(function() { | ||
76 | 79 | ||
77 | repayment.update(); | 80 | repayment.update(); |
78 | }); | 81 | }); |
82 | + | ||
83 | + | ||
84 | +// 默认选择第一个 | ||
85 | +$(CHECKBOX_SELECTOR + ':checkbox:first').click(); |
@@ -8,6 +8,15 @@ var Repayment = function(options) { | @@ -8,6 +8,15 @@ var Repayment = function(options) { | ||
8 | onDeselectAll: $.noop, | 8 | onDeselectAll: $.noop, |
9 | 9 | ||
10 | /** | 10 | /** |
11 | + * 返回可选择数目 | ||
12 | + * | ||
13 | + * @returns {number} | ||
14 | + */ | ||
15 | + onGetSelectableCount: function() { | ||
16 | + return 0; | ||
17 | + }, | ||
18 | + | ||
19 | + /** | ||
11 | * 获取选择 | 20 | * 获取选择 |
12 | * | 21 | * |
13 | * @returns {Array} | 22 | * @returns {Array} |
@@ -28,8 +37,10 @@ var Repayment = function(options) { | @@ -28,8 +37,10 @@ var Repayment = function(options) { | ||
28 | 37 | ||
29 | var params = { | 38 | var params = { |
30 | action: 'go.instalmentRepayment', | 39 | action: 'go.instalmentRepayment', |
31 | - list: self.setParams(), | ||
32 | - amount: self.total | 40 | + params: { |
41 | + list: self.setParams(), | ||
42 | + amount: self.total | ||
43 | + } | ||
33 | }; | 44 | }; |
34 | 45 | ||
35 | $(this).attr('href', path + '?openby:yohobuy=' + encodeURIComponent(JSON.stringify(params))); | 46 | $(this).attr('href', path + '?openby:yohobuy=' + encodeURIComponent(JSON.stringify(params))); |
@@ -114,11 +125,17 @@ Repayment.prototype.getSelection = function() { | @@ -114,11 +125,17 @@ Repayment.prototype.getSelection = function() { | ||
114 | return this.settings.onGetSelection(); | 125 | return this.settings.onGetSelection(); |
115 | }; | 126 | }; |
116 | 127 | ||
128 | +/** | ||
129 | + * 更新组件并计算金额 | ||
130 | + */ | ||
117 | Repayment.prototype.update = function() { | 131 | Repayment.prototype.update = function() { |
118 | var values = this.getSelection(); | 132 | var values = this.getSelection(); |
119 | var $repaymentBottom = $('.repayment-bottom'); | 133 | var $repaymentBottom = $('.repayment-bottom'); |
120 | var self = this; | 134 | var self = this; |
121 | 135 | ||
136 | + // 是否选择全部 | ||
137 | + var totalCheck = this.settings.onGetSelectableCount() === values.length; | ||
138 | + | ||
122 | this.total = 0; | 139 | this.total = 0; |
123 | this.fee = 0; | 140 | this.fee = 0; |
124 | 141 | ||
@@ -136,6 +153,8 @@ Repayment.prototype.update = function() { | @@ -136,6 +153,8 @@ Repayment.prototype.update = function() { | ||
136 | $repaymentBottom.slideDown(); | 153 | $repaymentBottom.slideDown(); |
137 | } | 154 | } |
138 | 155 | ||
156 | + $('#repayment-total').prop('checked', totalCheck).data('checked', totalCheck); | ||
157 | + | ||
139 | this.setTotal(this.total); | 158 | this.setTotal(this.total); |
140 | this.setFee(this.fee); | 159 | this.setFee(this.fee); |
141 | 160 |
@@ -14,6 +14,7 @@ | @@ -14,6 +14,7 @@ | ||
14 | background: #fff; | 14 | background: #fff; |
15 | position: fixed; | 15 | position: fixed; |
16 | width: 100%; | 16 | width: 100%; |
17 | + top: 0; | ||
17 | 18 | ||
18 | li { | 19 | li { |
19 | display: inline-block; | 20 | display: inline-block; |
@@ -33,9 +34,12 @@ | @@ -33,9 +34,12 @@ | ||
33 | } | 34 | } |
34 | } | 35 | } |
35 | 36 | ||
37 | + .order-list-container { | ||
38 | + margin-top: 3rem; | ||
39 | + } | ||
40 | + | ||
36 | .order-list { | 41 | .order-list { |
37 | border-top: 1px solid #e1e1e1; | 42 | border-top: 1px solid #e1e1e1; |
38 | - margin-top: 120px; | ||
39 | background: #fff; | 43 | background: #fff; |
40 | 44 | ||
41 | li { | 45 | li { |
@@ -126,8 +130,11 @@ | @@ -126,8 +130,11 @@ | ||
126 | height: 120px; | 130 | height: 120px; |
127 | } | 131 | } |
128 | 132 | ||
129 | - .installment-list { | 133 | + .detail-list-container { |
130 | padding-top: 330px; | 134 | padding-top: 330px; |
135 | + } | ||
136 | + | ||
137 | + .installment-list { | ||
131 | border-top: 1px solid #e0e0e0; | 138 | border-top: 1px solid #e0e0e0; |
132 | overflow: scroll; | 139 | overflow: scroll; |
133 | 140 |
-
Please register or login to post a comment