Authored by liangxs

地址修改需求完善

... ... @@ -25,7 +25,7 @@ $('.address-item').on('touchend', function() {
orderInfo('addressId', addressId);
orderInfo('address', address);
console.log($this.data('href') + (orderInfo('limitUrlSufix') || ''));
window.location.href = $this.data('href') + (orderInfo('limitUrlSufix') || '');
}).on('touchend', '.edit', function() {
window.location.href = $(this).data('href');
... ...
... ... @@ -9,26 +9,51 @@ var $ = require('jquery'),
var $confimMod = $('.confim-modify-mask'),
$modifyAdd = $('.modifyAdd'),
deleteId;
orderCode = $modifyAdd.data('orderCode'),
selectId;
require('../common');
$('.address-item').on('touchend', function() {
if ($(this).data('transfer') === 'true') {
if ($modifyAdd.data('rel') === 'true') {
$confimMod.find('.content').text('关联订单的收货地址将会一起修改且不可修改第二次,请确认是否修改?');
$confimMod.fadeIn();
} else {
$confimMod.find('.content').text('收货地址仅且只能修改一次,请确认是否修改?');
$confimMod.fadeIn();
}
selectId = $(this).data('addressId');
if ($modifyAdd.data('rel') === 'true') {
$confimMod.find('.content').text('关联订单的收货地址将会一起修改且不可修改第二次,请确认是否修改?');
$confimMod.fadeIn();
} else {
tip.show('由于运送方式不支持,不能修改地址!');
$confimMod.find('.content').text('收货地址仅且只能修改一次,请确认是否修改?');
$confimMod.fadeIn();
}
}).on('touchend', '.edit', function() {
window.location.href = $(this).data('href');
return false;
}).on('touchstart', '.del', function() {
deleteId = $(this).data('id');
});
$confimMod.on('touchend', '.cancel', function(e) {
selectId = null;
$confimMod.fadeOut();
return false;
}).on('touchend', '.confim', function() {
$.ajax({
method: 'POST',
url: '',
data: {
id: selectId,
orderCode: orderCode
}
}).then(function(res) {
if ($.type(res) !== 'object') {
res = {};
}
if (res.code !== 200) {
tip.show(res.message || '网络出了点问题~');
} else {
window.location.reload();
}
}).fail(function() {
tip.show('网络出了点问题~');
}).always(function() {
selectId = null;
});
return false;
});
... ...
{{> layout/header}}
<div class="my-address-page modify-address-page select-address-page yoho-page">
<div class="page-wrap clearfix modifyAdd" data-rel="{{hasRelations}}">
<div class="page-wrap clearfix modifyAdd" data-rel="{{hasRelations}}" data-order-code="{{orderCode}}">
{{# address}}
<div class="address-item" data-address-id="{{address_id}}" data-is-support="{{is_support}}" data-href="/home/orderdetail" data-transfer="{{transfer}}">
<div class="address-item" data-address-id="{{address_id}}" >
<span class="name">{{consignee}}</span>
<span class="tel">{{mobile}}</span>
<p class="address-info">{{area}} {{address}}</p>
... ...