Authored by 姜敏

收货地址--yoho币和收货地址 样式微调

... ... @@ -55,7 +55,8 @@ const index = (req, res) => {
data: result.list.coinList,
paginationOpts: result.list.paginationOpts,
num: result.num.data,
selects: result.list.selects
selects: result.list.selects,
total: result.list.total
}
});
});
... ...
... ... @@ -14,6 +14,11 @@
</tr>
{{/each}}
</table>
{{#if paginationOpts}}
{{{ pagination paginationOpts }}}
{{/if}}
<div class="currency-footer">
<div class="inline-block total">总共{{total}}条消息</div>
<div class="inline-block coin-pagination">
{{#if paginationOpts}}
{{{ pagination paginationOpts }}}
{{/if}}
</div>
</div>
... ...
... ... @@ -3,7 +3,7 @@
* @author: jiangmin
* @date: 2016/07/05
*/
// todo uid为假值;编辑时设置默认;省市区重置;手机号码逆向显示
// todo 编辑时设置默认;手机号码逆向显示
var cascadingAddress = require('../plugins/cascading-address');
var dialog = require('../plugins/dialog');
... ... @@ -14,6 +14,7 @@ var $consignee = $('#consignee');
var $address = $('#addressDetail');
var $mobile = $('#mobile');
var $phone = $('#phone');
var addressForm = $('.form-group1');
// var $default = 'N';
var currentLength = $('.a-table').find('tr').length - 1;// 当前地址条数
... ... @@ -36,7 +37,7 @@ $('.input-radio').check({
// }
});
$(function() {
$(function () {
// 运行此demo
// 1. 安装 npm i -g json-server
// 2. json-server --watch mock/address.json
... ... @@ -75,14 +76,14 @@ $(function() {
// 校验
check(info) {
let flag = true;
let addressForm = $('.form-group1');
info.consignee === '' ? $consignee.next().show() : $consignee.next().hide();
info.address === '' ? $address.next().show() : $address.next().hide();
info.mobile === '' ? $mobile.next().show() :
(!reg.test(info.mobile) ? $mobile.next().html('手机号码格式不对').show() : $mobile.next().hide());
typeof (info.area_code) === 'undefined' ? addressForm.find('.error-tips').show() :
addressForm.find('.error-tips').hide();
typeof (info.area_code) === 'undefined' ?
addressForm.css('margin-bottom', '20px').find('.error-tips').show() :
addressForm.css('margin-bottom', '70px').find('.error-tips').hide();
if (info.consignee === '' || info.address === '' || info.mobile === '' || !reg.test(info.mobile) ||
typeof (info.area_code) === 'undefined') {
flag = false;
... ... @@ -126,7 +127,7 @@ $(function() {
// 保存收货地址
$(document).on('click', '#save-address', function() {
$(document).on('click', '#save-address', function () {
if (currentLength === 20) {
new _alert('您最多添加20个收货地址,可删除不需要的地址后再添加新地址!').show();
Bll.clearInput();
... ... @@ -145,7 +146,7 @@ $(function() {
url: '/me/address/add',
dataType: 'json',
data: info,
success: function(data) {
success: function (data) {
if (data.code === 200) {
let html = Bll.getHtml(data.data);
... ... @@ -165,7 +166,7 @@ $(function() {
url: '/me/address/update',
dataType: 'json',
data: info,
success: function(data) {
success: function (data) {
if (data.code === 200) {
info.mobile = info.mobile.substring(0, 3) + '****' + info.mobile.substring(7, 11);
info.address_id = info.id;
... ... @@ -182,26 +183,27 @@ $(function() {
});
// 修改收货地址
$(document).on('click', '.update-address', function() {
$(document).on('click', '.update-address', function () {
let id = $(this).data('id');
let tr = $(this).parents('.table-body');
let td = tr.find('td');
let areaCode = tr.find('input').eq(1).val();
address.setAddress(areaCode);
addressForm.css('margin-bottom', '70px');
$('.error-tips').hide();
$('.tip').html('修改地址 电话为选填项,其他均为必填项');
Bll.setInfo(id, td);
});
// 删除收货地址
$(document).on('click', '.del-address', function() {
$(document).on('click', '.del-address', function () {
let id = $(this).data('id');
var tr = $(this).parents('.table-body');
var a = new _confirm({
content: '您确定要删除收货地址吗?',
cb: function() {
cb: function () {
$.ajax({
type: 'POST',
url: '/me/address/del',
... ... @@ -209,7 +211,7 @@ $(function() {
data: {
id: id
},
success: function() {
success: function () {
currentLength--;
leftLength++;
tr.remove();
... ... @@ -224,7 +226,7 @@ $(function() {
});
// 设置默认收货地址
$(document).on('click', '.set-default', function() {
$(document).on('click', '.set-default', function () {
var tr = $(this).parents('.table-body');
var tbody = tr.parent();
let id = $(this).data('id');
... ... @@ -237,7 +239,7 @@ $(function() {
data: {
id: id
},
success: function() {
success: function () {
$('.current-default').removeClass('current-default').text('设为默认');
$(self).addClass('current-default').text('默认地址');
tbody.find('.table-body').eq(0).before('<tr class=\'table-body\'>' + tr.html() + '</tr>');
... ...
... ... @@ -8,13 +8,10 @@
.yohocoin-icon {
width: 90px;
height: 45px;
background-image: resolve('me/coin.jpg');
background-image: resolve('me/coin.png');
background-repeat: no-repeat;
background-position: center top;
}
.total-yohocoin {
margin-left: 20px;
}
.current-yohocoin {
font-size: 18px;
margin-bottom: 18px;
... ... @@ -63,3 +60,14 @@
width: 355px;
}
}
.currency-footer {
margin-top: 20px;
.total {
font-size: 14px;
}
.coin-pagination {
margin-left: 280px;
}
}
... ...