Commit ce28a964fc3fce6ce91d07353aecbd402bce1f01

Authored by u123231312
1 parent 850340a1

pc 停用商家

@@ -280,6 +280,13 @@ class Template extends Common{ @@ -280,6 +280,13 @@ class Template extends Common{
280 //获取运营人员列表 280 //获取运营人员列表
281 $list= file_get_contents(ON_LINE.'App.Seller.GetSellerList'.$limit); 281 $list= file_get_contents(ON_LINE.'App.Seller.GetSellerList'.$limit);
282 $array = json_decode($list,TRUE); 282 $array = json_decode($list,TRUE);
  283 + foreach ($array['data'][0] as $key => $value) {
  284 + $array['data'][0][$key]['cdate'] = date("Y-m-d H:i:s",$value['cdate']);
  285 + if($value['status']==1)
  286 + $array['data'][0][$key]['statusVal'] = "启用";
  287 + else
  288 + $array['data'][0][$key]['statusVal'] = "停用";
  289 + }
283 if($array['ret']==200){ 290 if($array['ret']==200){
284 $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'][0],'rel'=>1]; 291 $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'][0],'rel'=>1];
285 } 292 }
@@ -289,6 +296,26 @@ class Template extends Common{ @@ -289,6 +296,26 @@ class Template extends Common{
289 return $this->fetch(); 296 return $this->fetch();
290 } 297 }
291 298
  299 + /**
  300 + * 停用商家
  301 + */
  302 + public function configStop(){
  303 + if(Request::isAjax()){
  304 + $data = Request::except('file');
  305 + $data['status'] = $data['status'] ? 0 : 1;
  306 + $list= file_get_contents(ON_LINE.'App.Seller.SetStopBySeller&sellerid='.$data['sellerid'].'&status='.$data['status']);
  307 + $array = json_decode($list,TRUE);
  308 + if($array['ret']==200){
  309 + $result['code'] = 1;
  310 + $result['msg'] = 'OK!';
  311 + }else{
  312 + $result['code'] = 0;
  313 + $result['msg'] = '请求错误!';
  314 + }
  315 + return $result;
  316 + }
  317 + return view();
  318 + }
292 319
293 /** 320 /**
294 * 配置商家菜品信息 321 * 配置商家菜品信息
@@ -15,6 +15,7 @@ @@ -15,6 +15,7 @@
15 </div> 15 </div>
16 {include file="common/foot"/} 16 {include file="common/foot"/}
17 <script type="text/html" id="action"> 17 <script type="text/html" id="action">
  18 + <a class="layui-btn {{ 0==d.status?'':'layui-btn-danger'}} layui-btn-xs" lay-event="stop">{{ 0==d.status?'启用':'停用'}}</a>
18 <a href="{:url('configMer')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">配置菜品</a> 19 <a href="{:url('configMer')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">配置菜品</a>
19 </script> 20 </script>
20 <script> 21 <script>
@@ -27,12 +28,33 @@ @@ -27,12 +28,33 @@
27 page:true, 28 page:true,
28 cols: [[ 29 cols: [[
29 {field: 'id', title: '{:lang("id")}', width:60, fixed: true}, 30 {field: 'id', title: '{:lang("id")}', width:60, fixed: true},
  31 + {field: 'name', title: '版本', width: 150},
30 {field: 'sellername', title: '商家名称', width: 150}, 32 {field: 'sellername', title: '商家名称', width: 150},
31 {field: 'phone', title: '商家电话', width: 150}, 33 {field: 'phone', title: '商家电话', width: 150},
32 {field: 'map_address', title: '商家地址', width: 300}, 34 {field: 'map_address', title: '商家地址', width: 300},
33 - {field: 'cdate', align: 'center',title: '创建日期', width: 120}, 35 + {field: 'statusVal', align: 'center',title: '状态', width: 120},
  36 + {field: 'cdate', align: 'center',title: '创建日期', width: 180},
34 {width: 200, align: 'center',title: '操作', toolbar: '#action'} 37 {width: 200, align: 'center',title: '操作', toolbar: '#action'}
35 ]] 38 ]]
36 }); 39 });
  40 +
  41 + //启用、停用
  42 + table.on('tool(list)', function(obj){
  43 + var data = obj.data;
  44 + if(obj.event === 'stop'){
  45 + var statusVal = data.status==1 ? '停用' : '启用';
  46 + layer.confirm('请确定要 '+statusVal+" 该商家!", function(index){
  47 + $.post("{:url('configStop')}",{sellerid:data.id,status:data.status},function(res){
  48 + if(res.code==1){
  49 + layer.msg(res.msg,{time:1000,icon:1});
  50 + location.reload();
  51 + }else{
  52 + layer.msg(res.msg,{time:1000,icon:2});
  53 + }
  54 + });
  55 + layer.close(index);
  56 + });
  57 + }
  58 + });
37 }) 59 })
38 </script> 60 </script>