Commit f51e3c65 authored by hujun's avatar hujun

删除商圈

parent 89c4f98d
...@@ -60,7 +60,16 @@ class BusinessDistrict extends Basic ...@@ -60,7 +60,16 @@ class BusinessDistrict extends Basic
} }
public function del() { 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 @@ ...@@ -139,8 +139,7 @@
</h4> </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="modal-body"> <div class="modal-body" id="del_msg">
<input type="hidden" value="" id="delete_id"/>
确认删除吗? 确认删除吗?
</div> </div>
</div> </div>
......
...@@ -78,7 +78,7 @@ Route::group('index', [ ...@@ -78,7 +78,7 @@ Route::group('index', [
'accessUser' => ['index/auth/accessUser', ['method' => 'get']], //成员授权 'accessUser' => ['index/auth/accessUser', ['method' => 'get']], //成员授权
'BusinessDistrict' => ['index/BusinessDistrict/index', ['method' => 'get']], //商圈列表 'BusinessDistrict' => ['index/BusinessDistrict/index', ['method' => 'get']], //商圈列表
'editBusinessDistrict' => ['index/BusinessDistrict/edit', ['method' => 'get | post']], //编辑商圈 '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']], //获取商铺列表数据 'BusinessList' => ['index/BusinessDistrict/getBusiness', ['method' => 'get']], //获取商铺列表数据
'houseList' => ['index/Houses/index', ['method' => 'get']], //商铺列表 'houseList' => ['index/Houses/index', ['method' => 'get']], //商铺列表
'houseEdit' => ['index/Houses/edit', ['method' => 'get']], //编辑商铺 'houseEdit' => ['index/Houses/edit', ['method' => 'get']], //编辑商铺
......
...@@ -20,7 +20,7 @@ define (['doT', 'text!temp/business_district_template_tpl.html', 'css!style/home ...@@ -20,7 +20,7 @@ define (['doT', 'text!temp/business_district_template_tpl.html', 'css!style/home
$("#modal_add").click(function () { $("#modal_add").click(function () {
$("#title").html('新增商圈'); $("#title").html('新增商圈');
business.getRegionsProvince(310000, 310100, 310101); business.getRegionsProvince(310000, 310100, 310101); //默认上海,上海,黄浦
}); });
$("#province").change(function () { $("#province").change(function () {
...@@ -83,7 +83,13 @@ define (['doT', 'text!temp/business_district_template_tpl.html', 'css!style/home ...@@ -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) { getList: function (pageNo) {
business.pageNo = pageNo; business.pageNo = pageNo;
...@@ -199,20 +205,20 @@ define (['doT', 'text!temp/business_district_template_tpl.html', 'css!style/home ...@@ -199,20 +205,20 @@ define (['doT', 'text!temp/business_district_template_tpl.html', 'css!style/home
} }
}); });
}, },
delete_user : function(params) { delBusiness : function () {
$.ajax ({ $.ajax({
url: '/index/del_user', url : '/index/delBusinessDistrict.html',
type: 'POST', type : 'POST',
async: true, async: true,
data: params, data: {"id":business.id},
dataType: 'json', dataType: 'json',
success: function (data) { success : function (data) {
$ ("#modal-delete").modal ('hide'); if (data.code == 200) {
if (data.code == "101") { business.getList(1);
alert (data.msg); $("#modal-delete").modal ('hide');
return false; } else {
$("#del_msg").html('<span style="color: red">删除失败!</span>');
} }
user.getList (user.pageNo);
} }
}); });
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<td> <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-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-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> </td>
</tr> </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