Commit d4d3e3d8f2329ca2b9138d86e4d5b077ae7ed305

Authored by teemitop
1 parent d91ec243

PC维护商家基本数据

  1 +<?php
  2 +namespace app\admin\controller;
  3 +use think\Db;
  4 +use think\facade\Request;
  5 +class Operational extends Common
  6 +{
  7 + /********************************可发送消息列表*******************************/
  8 + //打印机型号列表
  9 + public function messagelist($sys_id=1){
  10 + if(Request::isAjax()) {
  11 + $list= file_get_contents(ON_LINE.'App.Prints.QueryPrintsList');
  12 + $array = json_decode($list,TRUE);
  13 + foreach ($array['data'] as $key => $value) {
  14 + if($value['type']==1)
  15 + $array['data'][$key]['type'] = '50';
  16 + elseif($value['type']==2)
  17 + $array['data'][$key]['type'] = '80';
  18 + $array['data'][$key]['cdate'] = date('Y-m-d H:i:s',$value['cdate']);
  19 + }
  20 + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'],'rel'=>1];
  21 + }
  22 + $this->assign('title','打印机型号列表');
  23 + return $this->fetch();
  24 + }
  25 +}
@@ -211,4 +211,25 @@ class Seller extends Common @@ -211,4 +211,25 @@ class Seller extends Common
211 $this->assign ( 'title','商户菜品配置' ); 211 $this->assign ( 'title','商户菜品配置' );
212 return $this->fetch(); 212 return $this->fetch();
213 } 213 }
  214 +
  215 + /**
  216 + * 停用商家
  217 + */
  218 + public function setsellerconfig(){
  219 + if(Request::isAjax()){
  220 + $data = Request::except('file');
  221 + $data['status'] = $data['status'] ? 0 : 1;
  222 + $list= file_get_contents(ON_LINE.'App.Seller.SetSellerConfigByPC&sid='.$data['sellerid'].'&field='.$data['field'].'&value='.$data['value']);
  223 + $array = json_decode($list,TRUE);
  224 + if($array['ret']==200){
  225 + $result['code'] = 1;
  226 + $result['msg'] = 'SUCCESS!';
  227 + }else{
  228 + $result['code'] = 0;
  229 + $result['msg'] = '请求错误!';
  230 + }
  231 + return $result;
  232 + }
  233 + return view();
  234 + }
214 } 235 }
  1 +{include file="common/head"/}
  2 +<form class="layui-form layui-form-pane">
  3 +<div class="admin-main layui-anim layui-anim-upbit">
  4 + <fieldset class="layui-elem-field layui-field-title">
  5 + <legend>{:$title}</legend>
  6 + </fieldset>
  7 + <div class="demoTable">
  8 + 商家:
  9 + <div class="layui-input-inline">
  10 + <input class="layui-input" name="key" id="key" placeholder="{:lang('pleaseEnter')}店铺名称" autocomplete="off">
  11 + </div>
  12 + 给谁发:
  13 + <div class="layui-input-inline" >
  14 + <input type="checkbox" name="role[write]" lay-skin="primary" title="客户经理">
  15 + <input type="checkbox" name="role[read]" lay-skin="primary" title="老板">
  16 + <input type="checkbox" name="role[game]" lay-skin="primary" title="前台">
  17 + </div>
  18 + 商家来源:
  19 + <div class="layui-input-inline layui-form">
  20 + <div class="layui-input-8">
  21 + <select name="class" id="channel" lay-filter="myselect">
  22 + <option value="1">合作</option>
  23 + <option value="2">推广</option>
  24 + <option value="3">测试</option>
  25 + </select>
  26 + </div>
  27 + </div>
  28 + <button class="layui-btn" id="search" data-type="reload">查询统计</button>
  29 + </div>
  30 + <table class="layui-table" id="list" lay-filter="list">
  31 + </table>
  32 +</div>
  33 +</form>
  34 +{include file="common/foot"/}
  35 +<script>
  36 + layui.use(['table','form','laydate'], function() {
  37 + var table = layui.table,laydate = layui.laydate,$ = layui.jquery;
  38 + console.log(layui);
  39 + var tableIn = table.render({
  40 + elem: '#list',
  41 + url: '{:url("messagelist")}',
  42 + method: 'post',
  43 + title: '预定订单统计',
  44 + page:true,
  45 + cols: [[
  46 + {checkbox:true,fixed: true},
  47 + {field: 'sellername', title: 'FORMID'},
  48 + {field: 'reserve_count_sort', title: 'OPENID'},
  49 + {field: 'reserve_count', title: '失效时间'},
  50 + {field: 'sms_send_count_sort',title: '可发送总数'},
  51 + {field: 'sms_send_count',title: 'ID-商家'},
  52 + {field: 'inviting',title: '角色'},
  53 + {field: 'inviting',title: '昵称'},
  54 + {field: 'inviting',title: '最后预定时间(小程序/电话机)'},
  55 + ]],
  56 + done: function(res, curr, count){
  57 + }
  58 + ,id: 'testReload'
  59 + ,page: true
  60 + ,limit:20
  61 + });
  62 +
  63 + //日期时间范围
  64 + laydate.render({
  65 + elem: '#time'
  66 + ,type: 'datetime'
  67 + ,range: true
  68 + });
  69 +
  70 + //搜索
  71 + $('#search').on('click', function() {
  72 + //关键字
  73 + var key = $('#key').val();
  74 + //选中的商家ID
  75 + var checkStatus = table.checkStatus('testReload'); //test即为参数id设定的值
  76 + var a = [];
  77 + $(checkStatus.data).each(function(i,o){
  78 + a.push(o.id);
  79 + });
  80 + console.log(a);
  81 +
  82 + var time = $('#time').val();
  83 + console.log(time);
  84 + //商家来源
  85 + var channel = $('#channel').val();
  86 + console.log(channel);
  87 + //筛选条件
  88 + var time_type = $('#time_type').val();
  89 + console.log(time_type);
  90 + //传参
  91 + tableIn.reload({ page: {page: 1},where: {key: key,sid: a,time_type: time_type,time: time,channel: channel}});
  92 + });
  93 +
  94 + var $ = layui.$, active = {
  95 + reload: function(){
  96 + var key = $('#key');
  97 + //执行重载
  98 + table.reload('testReload', {
  99 + page: {
  100 + curr: 1 //重新从第 1 页开始
  101 + }
  102 + ,where: {
  103 + key: {
  104 + id: key.val()
  105 + }
  106 + }
  107 + });
  108 + }
  109 + };
  110 + })
  111 +</script>
@@ -41,23 +41,43 @@ @@ -41,23 +41,43 @@
41 page:true, 41 page:true,
42 cols: [[ 42 cols: [[
43 {field: 'id', title: '{:lang("id")}', width:60, fixed: true}, 43 {field: 'id', title: '{:lang("id")}', width:60, fixed: true},
44 - {field: 'name', title: '版本'},  
45 {field: 'sellername', title: '商家名称'}, 44 {field: 'sellername', title: '商家名称'},
46 {field: 'phone', title: '商家电话'}, 45 {field: 'phone', title: '商家电话'},
47 {field: 'map_address', title: '商家地址'}, 46 {field: 'map_address', title: '商家地址'},
  47 + {field: 'cuisine', align: 'center',title: '现有菜系'},
  48 + {field: 'type', align: 'center',title: '现有类型'},
48 {field: 'last_num', align: 'center',title: '短信余量'}, 49 {field: 'last_num', align: 'center',title: '短信余量'},
49 - {field: 'dz_version', align: 'center',title: 'APP版本号'}, 50 + {field: 'average', align: 'center', edit: 'text', title: '人均消费'},
  51 + {field: 'score', align: 'center', edit: 'text', title: '店铺评分'},
  52 + {field: 'is_parking', align: 'center', edit: 'text',title: '是否有停车场'},
50 {field: 'statusVal', align: 'center',title: '状态'}, 53 {field: 'statusVal', align: 'center',title: '状态'},
51 {field: 'user_name', align: 'center',title: '创建人'}, 54 {field: 'user_name', align: 'center',title: '创建人'},
52 {field: 'cdate', align: 'center',title: '创建日期'}, 55 {field: 'cdate', align: 'center',title: '创建日期'},
53 - {field: 'cuisine', align: 'center',title: '现有菜系'},  
54 - {field: 'type', align: 'center',title: '现有类型'},  
55 {align: 'center',title: '操作', toolbar: '#action'} 56 {align: 'center',title: '操作', toolbar: '#action'}
56 ]] 57 ]]
57 ,id: 'testReload' 58 ,id: 'testReload'
58 ,page: true 59 ,page: true
59 }); 60 });
60 61
  62 + //监听单元格编辑
  63 + table.on('edit(list)', function(obj){
  64 + var value = obj.value, //得到修改后的值
  65 + data = obj.data, //得到所在行所有键值
  66 + field = obj.field; //得到字段
  67 + var new_field = field=='average' ? "人均消费" : (field=='is_parking' ? "停车场" : (field=='score' ? "店铺评分" : '未知字段'));
  68 + //layer.msg('[ID: '+ data.id +'] ' + field + ' 字段更改为:'+ value);
  69 + layer.confirm('请确认将 '+ data.sellername +'商家的 ' + new_field + ' 更改为:'+ value, function(index){
  70 + $.post("{:url('setsellerconfig')}",{sellerid:data.id,field:field,value:value},function(res){
  71 + if(res.code==1){
  72 + layer.msg(res.msg,{time:1000,icon:1});
  73 + }else{
  74 + layer.msg(res.msg,{time:1000,icon:2});
  75 + }
  76 + });
  77 + layer.close(index);
  78 + });
  79 + });
  80 +
61 //搜索 81 //搜索
62 $('#search').on('click', function() { 82 $('#search').on('click', function() {
63 var key = $('#key').val(); 83 var key = $('#key').val();