Commit ce28a964fc3fce6ce91d07353aecbd402bce1f01

Authored by u123231312
1 parent 850340a1

pc 停用商家

... ... @@ -280,6 +280,13 @@ class Template extends Common{
//获取运营人员列表
$list= file_get_contents(ON_LINE.'App.Seller.GetSellerList'.$limit);
$array = json_decode($list,TRUE);
foreach ($array['data'][0] as $key => $value) {
$array['data'][0][$key]['cdate'] = date("Y-m-d H:i:s",$value['cdate']);
if($value['status']==1)
$array['data'][0][$key]['statusVal'] = "启用";
else
$array['data'][0][$key]['statusVal'] = "停用";
}
if($array['ret']==200){
$result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'][0],'rel'=>1];
}
... ... @@ -289,6 +296,26 @@ class Template extends Common{
return $this->fetch();
}
/**
* 停用商家
*/
public function configStop(){
if(Request::isAjax()){
$data = Request::except('file');
$data['status'] = $data['status'] ? 0 : 1;
$list= file_get_contents(ON_LINE.'App.Seller.SetStopBySeller&sellerid='.$data['sellerid'].'&status='.$data['status']);
$array = json_decode($list,TRUE);
if($array['ret']==200){
$result['code'] = 1;
$result['msg'] = 'OK!';
}else{
$result['code'] = 0;
$result['msg'] = '请求错误!';
}
return $result;
}
return view();
}
/**
* 配置商家菜品信息
... ...
... ... @@ -15,6 +15,7 @@
</div>
{include file="common/foot"/}
<script type="text/html" id="action">
<a class="layui-btn {{ 0==d.status?'':'layui-btn-danger'}} layui-btn-xs" lay-event="stop">{{ 0==d.status?'启用':'停用'}}</a>
<a href="{:url('configMer')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">配置菜品</a>
</script>
<script>
... ... @@ -27,12 +28,33 @@
page:true,
cols: [[
{field: 'id', title: '{:lang("id")}', width:60, fixed: true},
{field: 'name', title: '版本', width: 150},
{field: 'sellername', title: '商家名称', width: 150},
{field: 'phone', title: '商家电话', width: 150},
{field: 'map_address', title: '商家地址', width: 300},
{field: 'cdate', align: 'center',title: '创建日期', width: 120},
{field: 'statusVal', align: 'center',title: '状态', width: 120},
{field: 'cdate', align: 'center',title: '创建日期', width: 180},
{width: 200, align: 'center',title: '操作', toolbar: '#action'}
]]
});
//启用、停用
table.on('tool(list)', function(obj){
var data = obj.data;
if(obj.event === 'stop'){
var statusVal = data.status==1 ? '停用' : '启用';
layer.confirm('请确定要 '+statusVal+" 该商家!", function(index){
$.post("{:url('configStop')}",{sellerid:data.id,status:data.status},function(res){
if(res.code==1){
layer.msg(res.msg,{time:1000,icon:1});
location.reload();
}else{
layer.msg(res.msg,{time:1000,icon:2});
}
});
layer.close(index);
});
}
});
})
</script>
\ No newline at end of file
... ...