Showing
6 changed files
with
38 additions
and
22 deletions
@@ -55,7 +55,8 @@ const index = (req, res) => { | @@ -55,7 +55,8 @@ const index = (req, res) => { | ||
55 | data: result.list.coinList, | 55 | data: result.list.coinList, |
56 | paginationOpts: result.list.paginationOpts, | 56 | paginationOpts: result.list.paginationOpts, |
57 | num: result.num.data, | 57 | num: result.num.data, |
58 | - selects: result.list.selects | 58 | + selects: result.list.selects, |
59 | + total: result.list.total | ||
59 | } | 60 | } |
60 | }); | 61 | }); |
61 | }); | 62 | }); |
@@ -14,6 +14,11 @@ | @@ -14,6 +14,11 @@ | ||
14 | </tr> | 14 | </tr> |
15 | {{/each}} | 15 | {{/each}} |
16 | </table> | 16 | </table> |
17 | -{{#if paginationOpts}} | ||
18 | - {{{ pagination paginationOpts }}} | ||
19 | -{{/if}} | 17 | +<div class="currency-footer"> |
18 | + <div class="inline-block total">总共{{total}}条消息</div> | ||
19 | + <div class="inline-block coin-pagination"> | ||
20 | + {{#if paginationOpts}} | ||
21 | + {{{ pagination paginationOpts }}} | ||
22 | + {{/if}} | ||
23 | + </div> | ||
24 | +</div> |
public/img/me/coin.jpg
deleted
100644 → 0
3.79 KB
public/img/me/coin.png
0 → 100644
5.93 KB
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * @author: jiangmin | 3 | * @author: jiangmin |
4 | * @date: 2016/07/05 | 4 | * @date: 2016/07/05 |
5 | */ | 5 | */ |
6 | -// todo uid为假值;编辑时设置默认;省市区重置;手机号码逆向显示 | 6 | +// todo 编辑时设置默认;手机号码逆向显示 |
7 | 7 | ||
8 | var cascadingAddress = require('../plugins/cascading-address'); | 8 | var cascadingAddress = require('../plugins/cascading-address'); |
9 | var dialog = require('../plugins/dialog'); | 9 | var dialog = require('../plugins/dialog'); |
@@ -14,6 +14,7 @@ var $consignee = $('#consignee'); | @@ -14,6 +14,7 @@ var $consignee = $('#consignee'); | ||
14 | var $address = $('#addressDetail'); | 14 | var $address = $('#addressDetail'); |
15 | var $mobile = $('#mobile'); | 15 | var $mobile = $('#mobile'); |
16 | var $phone = $('#phone'); | 16 | var $phone = $('#phone'); |
17 | +var addressForm = $('.form-group1'); | ||
17 | 18 | ||
18 | // var $default = 'N'; | 19 | // var $default = 'N'; |
19 | var currentLength = $('.a-table').find('tr').length - 1;// 当前地址条数 | 20 | var currentLength = $('.a-table').find('tr').length - 1;// 当前地址条数 |
@@ -36,7 +37,7 @@ $('.input-radio').check({ | @@ -36,7 +37,7 @@ $('.input-radio').check({ | ||
36 | // } | 37 | // } |
37 | }); | 38 | }); |
38 | 39 | ||
39 | -$(function() { | 40 | +$(function () { |
40 | // 运行此demo | 41 | // 运行此demo |
41 | // 1. 安装 npm i -g json-server | 42 | // 1. 安装 npm i -g json-server |
42 | // 2. json-server --watch mock/address.json | 43 | // 2. json-server --watch mock/address.json |
@@ -75,14 +76,14 @@ $(function() { | @@ -75,14 +76,14 @@ $(function() { | ||
75 | // 校验 | 76 | // 校验 |
76 | check(info) { | 77 | check(info) { |
77 | let flag = true; | 78 | let flag = true; |
78 | - let addressForm = $('.form-group1'); | ||
79 | 79 | ||
80 | info.consignee === '' ? $consignee.next().show() : $consignee.next().hide(); | 80 | info.consignee === '' ? $consignee.next().show() : $consignee.next().hide(); |
81 | info.address === '' ? $address.next().show() : $address.next().hide(); | 81 | info.address === '' ? $address.next().show() : $address.next().hide(); |
82 | info.mobile === '' ? $mobile.next().show() : | 82 | info.mobile === '' ? $mobile.next().show() : |
83 | (!reg.test(info.mobile) ? $mobile.next().html('手机号码格式不对').show() : $mobile.next().hide()); | 83 | (!reg.test(info.mobile) ? $mobile.next().html('手机号码格式不对').show() : $mobile.next().hide()); |
84 | - typeof (info.area_code) === 'undefined' ? addressForm.find('.error-tips').show() : | ||
85 | - addressForm.find('.error-tips').hide(); | 84 | + typeof (info.area_code) === 'undefined' ? |
85 | + addressForm.css('margin-bottom', '20px').find('.error-tips').show() : | ||
86 | + addressForm.css('margin-bottom', '70px').find('.error-tips').hide(); | ||
86 | if (info.consignee === '' || info.address === '' || info.mobile === '' || !reg.test(info.mobile) || | 87 | if (info.consignee === '' || info.address === '' || info.mobile === '' || !reg.test(info.mobile) || |
87 | typeof (info.area_code) === 'undefined') { | 88 | typeof (info.area_code) === 'undefined') { |
88 | flag = false; | 89 | flag = false; |
@@ -126,7 +127,7 @@ $(function() { | @@ -126,7 +127,7 @@ $(function() { | ||
126 | 127 | ||
127 | 128 | ||
128 | // 保存收货地址 | 129 | // 保存收货地址 |
129 | - $(document).on('click', '#save-address', function() { | 130 | + $(document).on('click', '#save-address', function () { |
130 | if (currentLength === 20) { | 131 | if (currentLength === 20) { |
131 | new _alert('您最多添加20个收货地址,可删除不需要的地址后再添加新地址!').show(); | 132 | new _alert('您最多添加20个收货地址,可删除不需要的地址后再添加新地址!').show(); |
132 | Bll.clearInput(); | 133 | Bll.clearInput(); |
@@ -145,7 +146,7 @@ $(function() { | @@ -145,7 +146,7 @@ $(function() { | ||
145 | url: '/me/address/add', | 146 | url: '/me/address/add', |
146 | dataType: 'json', | 147 | dataType: 'json', |
147 | data: info, | 148 | data: info, |
148 | - success: function(data) { | 149 | + success: function (data) { |
149 | if (data.code === 200) { | 150 | if (data.code === 200) { |
150 | let html = Bll.getHtml(data.data); | 151 | let html = Bll.getHtml(data.data); |
151 | 152 | ||
@@ -165,7 +166,7 @@ $(function() { | @@ -165,7 +166,7 @@ $(function() { | ||
165 | url: '/me/address/update', | 166 | url: '/me/address/update', |
166 | dataType: 'json', | 167 | dataType: 'json', |
167 | data: info, | 168 | data: info, |
168 | - success: function(data) { | 169 | + success: function (data) { |
169 | if (data.code === 200) { | 170 | if (data.code === 200) { |
170 | info.mobile = info.mobile.substring(0, 3) + '****' + info.mobile.substring(7, 11); | 171 | info.mobile = info.mobile.substring(0, 3) + '****' + info.mobile.substring(7, 11); |
171 | info.address_id = info.id; | 172 | info.address_id = info.id; |
@@ -182,26 +183,27 @@ $(function() { | @@ -182,26 +183,27 @@ $(function() { | ||
182 | }); | 183 | }); |
183 | 184 | ||
184 | // 修改收货地址 | 185 | // 修改收货地址 |
185 | - $(document).on('click', '.update-address', function() { | 186 | + $(document).on('click', '.update-address', function () { |
186 | let id = $(this).data('id'); | 187 | let id = $(this).data('id'); |
187 | let tr = $(this).parents('.table-body'); | 188 | let tr = $(this).parents('.table-body'); |
188 | let td = tr.find('td'); | 189 | let td = tr.find('td'); |
189 | let areaCode = tr.find('input').eq(1).val(); | 190 | let areaCode = tr.find('input').eq(1).val(); |
190 | 191 | ||
191 | address.setAddress(areaCode); | 192 | address.setAddress(areaCode); |
193 | + addressForm.css('margin-bottom', '70px'); | ||
192 | $('.error-tips').hide(); | 194 | $('.error-tips').hide(); |
193 | $('.tip').html('修改地址 电话为选填项,其他均为必填项'); | 195 | $('.tip').html('修改地址 电话为选填项,其他均为必填项'); |
194 | Bll.setInfo(id, td); | 196 | Bll.setInfo(id, td); |
195 | }); | 197 | }); |
196 | 198 | ||
197 | // 删除收货地址 | 199 | // 删除收货地址 |
198 | - $(document).on('click', '.del-address', function() { | 200 | + $(document).on('click', '.del-address', function () { |
199 | let id = $(this).data('id'); | 201 | let id = $(this).data('id'); |
200 | var tr = $(this).parents('.table-body'); | 202 | var tr = $(this).parents('.table-body'); |
201 | 203 | ||
202 | var a = new _confirm({ | 204 | var a = new _confirm({ |
203 | content: '您确定要删除收货地址吗?', | 205 | content: '您确定要删除收货地址吗?', |
204 | - cb: function() { | 206 | + cb: function () { |
205 | $.ajax({ | 207 | $.ajax({ |
206 | type: 'POST', | 208 | type: 'POST', |
207 | url: '/me/address/del', | 209 | url: '/me/address/del', |
@@ -209,7 +211,7 @@ $(function() { | @@ -209,7 +211,7 @@ $(function() { | ||
209 | data: { | 211 | data: { |
210 | id: id | 212 | id: id |
211 | }, | 213 | }, |
212 | - success: function() { | 214 | + success: function () { |
213 | currentLength--; | 215 | currentLength--; |
214 | leftLength++; | 216 | leftLength++; |
215 | tr.remove(); | 217 | tr.remove(); |
@@ -224,7 +226,7 @@ $(function() { | @@ -224,7 +226,7 @@ $(function() { | ||
224 | }); | 226 | }); |
225 | 227 | ||
226 | // 设置默认收货地址 | 228 | // 设置默认收货地址 |
227 | - $(document).on('click', '.set-default', function() { | 229 | + $(document).on('click', '.set-default', function () { |
228 | var tr = $(this).parents('.table-body'); | 230 | var tr = $(this).parents('.table-body'); |
229 | var tbody = tr.parent(); | 231 | var tbody = tr.parent(); |
230 | let id = $(this).data('id'); | 232 | let id = $(this).data('id'); |
@@ -237,7 +239,7 @@ $(function() { | @@ -237,7 +239,7 @@ $(function() { | ||
237 | data: { | 239 | data: { |
238 | id: id | 240 | id: id |
239 | }, | 241 | }, |
240 | - success: function() { | 242 | + success: function () { |
241 | $('.current-default').removeClass('current-default').text('设为默认'); | 243 | $('.current-default').removeClass('current-default').text('设为默认'); |
242 | $(self).addClass('current-default').text('默认地址'); | 244 | $(self).addClass('current-default').text('默认地址'); |
243 | tbody.find('.table-body').eq(0).before('<tr class=\'table-body\'>' + tr.html() + '</tr>'); | 245 | tbody.find('.table-body').eq(0).before('<tr class=\'table-body\'>' + tr.html() + '</tr>'); |
@@ -8,13 +8,10 @@ | @@ -8,13 +8,10 @@ | ||
8 | .yohocoin-icon { | 8 | .yohocoin-icon { |
9 | width: 90px; | 9 | width: 90px; |
10 | height: 45px; | 10 | height: 45px; |
11 | - background-image: resolve('me/coin.jpg'); | 11 | + background-image: resolve('me/coin.png'); |
12 | background-repeat: no-repeat; | 12 | background-repeat: no-repeat; |
13 | background-position: center top; | 13 | background-position: center top; |
14 | } | 14 | } |
15 | - .total-yohocoin { | ||
16 | - margin-left: 20px; | ||
17 | - } | ||
18 | .current-yohocoin { | 15 | .current-yohocoin { |
19 | font-size: 18px; | 16 | font-size: 18px; |
20 | margin-bottom: 18px; | 17 | margin-bottom: 18px; |
@@ -63,3 +60,14 @@ | @@ -63,3 +60,14 @@ | ||
63 | width: 355px; | 60 | width: 355px; |
64 | } | 61 | } |
65 | } | 62 | } |
63 | + | ||
64 | +.currency-footer { | ||
65 | + margin-top: 20px; | ||
66 | + .total { | ||
67 | + font-size: 14px; | ||
68 | + } | ||
69 | + .coin-pagination { | ||
70 | + margin-left: 280px; | ||
71 | + } | ||
72 | +} | ||
73 | + |
-
Please register or login to post a comment