Authored by ccbikai

删除地址

... ... @@ -15,13 +15,7 @@ var $nav = $('.category-nav'),
var $curContent = $contents.not('.hide');
<<<<<<< HEAD
// $curClickSubLevel;
var navHammer, ccHammer;
=======
var navHammer;
>>>>>>> master
//初始化container高度
(function() {
... ...
... ... @@ -15,7 +15,9 @@ var $action = $('.action'),
$addressListPage = $('.my-address-list-page'),
$area = $('.area'),
$footer = $('#yoho-footer'),
$confim = $('.confim-mask'),
isSubmiting,
deleteId,
newArea = [];
function editAddress(data) {
... ... @@ -32,9 +34,30 @@ function editAddress(data) {
// $addressForm.find('[name="consignee"]').focus();
}
function deleteAddress(data) {
}
$confim.on('touchend', '.cancel', function(){
deleteId = null;
$confim.hide();
}).on('touchend', '.confim', function(){
$.ajax({
method: 'POST',
url: '/home/deladdress',
data: {id: deleteId}
}).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() {
deleteId = null;
$confim.hide();
});
});
// 添加地址
$addAddress.on('touchend', function() {
... ... @@ -45,7 +68,8 @@ $addAddress.on('touchend', function() {
$action.on('touchend', '.edit', function() {
editAddress($(this).data());
}).on('touchend', '.del', function() {
deleteAddress();
deleteId = $(this).data('id');
$confim.show();
});
$submit.on('touchend', function() {
... ...
... ... @@ -21,7 +21,7 @@
你确定要删除地址吗?
</div>
<div class="action">
<span class="cencel">
<span class="cancel">
取消
</span>
<span class="confim">
... ...
... ... @@ -16,8 +16,8 @@
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/index-debug.js"></script>
{{/if}}
{{#if devEnv}}
<script src="http://172.16.6.204:8000/static/js/sea.js?nowrap"></script>
<script>seajs.config({base: 'http://172.16.6.204:8000/'});</script>
<script src="http://localhost:8000/static/js/sea.js?nowrap"></script>
<script>seajs.config({base: 'http://localhost:8000/'});</script>
{{/if}}
<script type="text/javascript">
(function(w,d,s,j,f){
... ...
... ... @@ -266,7 +266,7 @@ class HomeController extends AbstractAction
/**
* 删除地址
*/
public function addressDelAction()
public function delAddressAction()
{
$result = array();
... ...