Commit f51e3c65 authored by hujun's avatar hujun

删除商圈

parent 89c4f98d
......@@ -60,7 +60,16 @@ class BusinessDistrict extends Basic
}
public function del() {
$result['code'] = 200;
$result['msg'] = '';
$id = $this->request->param('id');
$business = new GBusinessDistrict();
$num = $business->save(['is_del' => 1],['id'=>$id]);
if ($num != 1) {
$result['code'] = 101;
}
return $this->response( $result['code'], '');
}
/**
......
......@@ -139,8 +139,7 @@
</h4>
</div>
<div class="modal-body">
<div class="modal-body">
<input type="hidden" value="" id="delete_id"/>
<div class="modal-body" id="del_msg">
确认删除吗?
</div>
</div>
......
......@@ -78,7 +78,7 @@ Route::group('index', [
'accessUser' => ['index/auth/accessUser', ['method' => 'get']], //成员授权
'BusinessDistrict' => ['index/BusinessDistrict/index', ['method' => 'get']], //商圈列表
'editBusinessDistrict' => ['index/BusinessDistrict/edit', ['method' => 'get | post']], //编辑商圈
'delBusinessDistrict' => ['index/BusinessDistrict/index', ['method' => 'post']], //删除商圈列表
'delBusinessDistrict' => ['index/BusinessDistrict/del', ['method' => 'post']], //删除商圈列表
'BusinessList' => ['index/BusinessDistrict/getBusiness', ['method' => 'get']], //获取商铺列表数据
'houseList' => ['index/Houses/index', ['method' => 'get']], //商铺列表
'houseEdit' => ['index/Houses/edit', ['method' => 'get']], //编辑商铺
......
......@@ -20,7 +20,7 @@ define (['doT', 'text!temp/business_district_template_tpl.html', 'css!style/home
$("#modal_add").click(function () {
$("#title").html('新增商圈');
business.getRegionsProvince(310000, 310100, 310101);
business.getRegionsProvince(310000, 310100, 310101); //默认上海,上海,黄浦
});
$("#province").change(function () {
......@@ -83,7 +83,13 @@ define (['doT', 'text!temp/business_district_template_tpl.html', 'css!style/home
});
});
$ (document).delegate (".del_modal", "click", function () {
business.id = $ (this).attr ("data-id");
});
$ (document).delegate ("#confirm_delete", "click", function () {
business.delBusiness();
});
},
getList: function (pageNo) {
business.pageNo = pageNo;
......@@ -199,20 +205,20 @@ define (['doT', 'text!temp/business_district_template_tpl.html', 'css!style/home
}
});
},
delete_user : function(params) {
$.ajax ({
url: '/index/del_user',
type: 'POST',
delBusiness : function () {
$.ajax({
url : '/index/delBusinessDistrict.html',
type : 'POST',
async: true,
data: params,
data: {"id":business.id},
dataType: 'json',
success: function (data) {
$ ("#modal-delete").modal ('hide');
if (data.code == "101") {
alert (data.msg);
return false;
success : function (data) {
if (data.code == 200) {
business.getList(1);
$("#modal-delete").modal ('hide');
} else {
$("#del_msg").html('<span style="color: red">删除失败!</span>');
}
user.getList (user.pageNo);
}
});
}
......
......@@ -18,7 +18,7 @@
<td>
<a title="编辑" class="btn btn-success btn-xs edit_modal" href="#modal_business" data-toggle="modal" class="btn btn-default" data-id="[%= it[item]['id']%]" style="margin-right:6px;">编辑</a>
<a title="权限分配" class="btn btn-info btn-xs" href="#modal-do" style="margin-right:6px;">是否显示</a>
<a title="成员授权" class="btn btn-danger btn-xs" href="#modal-delete" onclick="delete_user(this)" data-id='[%= it[item]["id"] %]' style="margin-right:6px;">删除</a>
<a title="成员授权" class="btn btn-danger btn-xs del_modal" href="#modal-delete" data-toggle="modal" class="btn btn-default" data-id='[%= it[item]["id"] %]' style="margin-right:6px;">删除</a>
</td>
</tr>
[% } %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment