Commit b6dac06c28654229feb00e96eefaf1fac41efc3b

Authored by teemitop
1 parent d4eee384

菜系配置

@@ -22,6 +22,24 @@ class Seller extends Common @@ -22,6 +22,24 @@ class Seller extends Common
22 $array['data'][0]['data'][$key]['statusVal'] = "启用"; 22 $array['data'][0]['data'][$key]['statusVal'] = "启用";
23 else 23 else
24 $array['data'][0]['data'][$key]['statusVal'] = "停用"; 24 $array['data'][0]['data'][$key]['statusVal'] = "停用";
  25 +
  26 + $c_name = array();
  27 + $t_name = array();
  28 + //2019-03-05 增加菜系配置、商家类型配置
  29 + if(is_array($value['cuisine'])){
  30 + foreach ($value['cuisine'] as $k => $v) {
  31 + $c_name[] = $v['name'];
  32 + }
  33 + }
  34 + if(is_array($value['type'])){
  35 + foreach ($value['type'] as $k => $v) {
  36 + $t_name[] = $v['type_name'];
  37 + }
  38 + }
  39 + if(!empty($c_name))
  40 + $array['data'][0]['data'][$key]['cuisine'] = implode(',', $c_name);
  41 + if(!empty($t_name))
  42 + $array['data'][0]['data'][$key]['type'] = implode(',', $t_name);
25 } 43 }
26 return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'][0]['data'],'count'=>$array['data'][0]['total'],'rel'=>1]; 44 return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'][0]['data'],'count'=>$array['data'][0]['total'],'rel'=>1];
27 } 45 }
@@ -119,7 +137,7 @@ class Seller extends Common @@ -119,7 +137,7 @@ class Seller extends Common
119 137
120 $parame = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$sellername.'&stime='.@$stime.'&etime='.@$etime.'&type='.@$data['channel'].'&sid='.$sid.'&time_type='.@$data['time_type']; 138 $parame = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$sellername.'&stime='.@$stime.'&etime='.@$etime.'&type='.@$data['channel'].'&sid='.$sid.'&time_type='.@$data['time_type'];
121 //获取运营人员列表 139 //获取运营人员列表
122 - $list= file_get_contents(UNDER_LINE.'App.Report.GetReserveData'.$parame); 140 + $list= file_get_contents(ON_LINE.'App.Report.GetReserveData'.$parame);
123 141
124 $array = json_decode($list,TRUE); 142 $array = json_decode($list,TRUE);
125 $new_array = array(); 143 $new_array = array();
@@ -137,4 +155,60 @@ class Seller extends Common @@ -137,4 +155,60 @@ class Seller extends Common
137 $this->assign ( 'title','预定订单统计'); 155 $this->assign ( 'title','预定订单统计');
138 return $this->fetch(); 156 return $this->fetch();
139 } 157 }
  158 +
  159 + /**
  160 + * 商家菜系、类型配置
  161 + */
  162 + public function sellerconfig(){
  163 + $data = Request::except('file');
  164 + if(Request::isAjax()){
  165 + $cuisine = !empty($data['cuisine']) ? implode(',', array_keys($data['cuisine'])) : '';
  166 + $type = !empty($data['type']) ? implode(',', array_keys($data['type'])) : '';
  167 +
  168 + if($cuisine)
  169 + $res_cuisine= file_get_contents(ON_LINE.'App.Seller.SetSellerCuisine&sellerid='.$data['sellerid'].'&cid='.$cuisine);
  170 + //$res_cuisine = json_decode($res_cuisine,TRUE);
  171 + if($type)
  172 + $res_type= file_get_contents(ON_LINE.'App.Seller.SetSellerType&sellerid='.$data['sellerid'].'&typeid='.$type);
  173 + //$res_type = json_decode($res_type,TRUE);
  174 +
  175 + $result['code'] = 1;
  176 + $result['msg'] = "配置成功!";
  177 + return $result;
  178 + }
  179 +
  180 + //获取商家已有菜系
  181 + $cuisine_list= file_get_contents(ON_LINE.'App.Seller.getSellerCuisine&sellerid='.$data['id']);
  182 + $cuisine_list = json_decode($cuisine_list,TRUE);
  183 + //获取所有菜系
  184 + $list= file_get_contents(ON_LINE.'App.Reserve.GetCustomerConfig');
  185 + $array = json_decode($list,TRUE);
  186 + //组装数据
  187 + foreach ($cuisine_list['data'] as $key => $value) {
  188 + foreach ($array['data']['cate'] as $k => $v) {
  189 + if($value['cid']==$v['id']){
  190 + $array['data']['cate'][$k]['checked'] = 1;
  191 + }
  192 + }
  193 + }
  194 + $this->assign('list',$array['data']['cate']);//获取所有菜系
  195 +
  196 + //获取商家已有来源
  197 + $type_list= file_get_contents(ON_LINE.'App.Seller.GetSellerType&sellerid='.$data['id']);
  198 + $type_list = json_decode($type_list,TRUE);
  199 + //获取来源
  200 + $channel = array(array('id'=>1,'name'=>'合作'),array('id'=>2,'name'=>'推广'),array('id'=>3,'name'=>'测试'));
  201 + //组装数据
  202 + foreach ($type_list['data'] as $key => $value) {
  203 + foreach ($channel as $k => $v) {
  204 + if($value['type_id']==$v['id']){
  205 + $channel[$k]['checked'] = 1;
  206 + }
  207 + }
  208 + }
  209 + $this->assign('channel',$channel);//获取所有来源
  210 + $this->assign ('data',$data); //商户信息
  211 + $this->assign ( 'title','商户菜品配置' );
  212 + return $this->fetch();
  213 + }
140 } 214 }
@@ -27,8 +27,9 @@ @@ -27,8 +27,9 @@
27 {include file="common/foot"/} 27 {include file="common/foot"/}
28 <script type="text/html" id="action"> 28 <script type="text/html" id="action">
29 <a class="layui-btn {{ 0==d.status?'':'layui-btn-danger'}} layui-btn-xs" lay-event="stop">{{ 0==d.status?'启用':'停用'}}</a> 29 <a class="layui-btn {{ 0==d.status?'':'layui-btn-danger'}} layui-btn-xs" lay-event="stop">{{ 0==d.status?'启用':'停用'}}</a>
30 - <a href="{:url('Template/configMer')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">配置菜品</a>  
31 - <a href="{:url('Basicinfo/smsRecharge')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">线下短信充值</a> 30 + <a href="{:url('Seller/sellerconfig')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">配置菜系/类型</a>
  31 + <!--<a href="{:url('Template/configMer')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">配置菜品</a>-->
  32 + <!--<a href="{:url('Basicinfo/smsRecharge')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">线下短信充值</a>-->
32 </script> 33 </script>
33 <script> 34 <script>
34 layui.use(['table','form'], function() { 35 layui.use(['table','form'], function() {
@@ -40,20 +41,21 @@ @@ -40,20 +41,21 @@
40 page:true, 41 page:true,
41 cols: [[ 42 cols: [[
42 {field: 'id', title: '{:lang("id")}', width:60, fixed: true}, 43 {field: 'id', title: '{:lang("id")}', width:60, fixed: true},
43 - {field: 'name', title: '版本', width: 150},  
44 - {field: 'sellername', title: '商家名称', width: 150},  
45 - {field: 'phone', title: '商家电话', width: 150},  
46 - {field: 'map_address', title: '商家地址', width: 300},  
47 - {field: 'last_num', align: 'center',title: '短信余量', width: 120},  
48 - {field: 'dz_version', align: 'center',title: 'APP版本号', width: 120},  
49 - {field: 'statusVal', align: 'center',title: '状态', width: 120},  
50 - {field: 'user_name', align: 'center',title: '创建人', width: 120},  
51 - {field: 'cdate', align: 'center',title: '创建日期', width: 180},  
52 - {width: 230, align: 'center',title: '操作', toolbar: '#action'} 44 + {field: 'name', title: '版本'},
  45 + {field: 'sellername', title: '商家名称'},
  46 + {field: 'phone', title: '商家电话'},
  47 + {field: 'map_address', title: '商家地址'},
  48 + {field: 'last_num', align: 'center',title: '短信余量'},
  49 + {field: 'dz_version', align: 'center',title: 'APP版本号'},
  50 + {field: 'statusVal', align: 'center',title: '状态'},
  51 + {field: 'user_name', align: 'center',title: '创建人'},
  52 + {field: 'cdate', align: 'center',title: '创建日期'},
  53 + {field: 'cuisine', align: 'center',title: '现有菜系'},
  54 + {field: 'type', align: 'center',title: '现有类型'},
  55 + {align: 'center',title: '操作', toolbar: '#action'}
53 ]] 56 ]]
54 ,id: 'testReload' 57 ,id: 'testReload'
55 ,page: true 58 ,page: true
56 - ,height: 471  
57 }); 59 });
58 60
59 //搜索 61 //搜索
  1 +{include file="common/head"/}
  2 +<div class="admin-main layui-anim layui-anim-upbit">
  3 + <fieldset class="layui-elem-field layui-field-title">
  4 + <legend>{$title}</legend>
  5 + </fieldset>
  6 + <form class="layui-form layui-form-pane">
  7 + <div class="layui-form-item">
  8 + <label class="layui-form-label">商家名字</label>
  9 + <div class="layui-input-4">
  10 + <input type="text" value="{:$data['name']}" disabled class="layui-input">
  11 + <input type="hidden" name="sellerid" value="{:$data['id']}" class="layui-input">
  12 + </div>
  13 + </div>
  14 +
  15 + <div class="layui-form-item">
  16 + <label class="layui-form-label">请选择菜系</label>
  17 + <div class="layui-input-block">
  18 + <div class="layui-input-4">
  19 + {foreach $list as $vo}
  20 + <input type="checkbox" name="cuisine[{$vo.id}]" lay-skin="primary" title="{$vo.name}" {if $vo.checked==1} checked{/if}>
  21 + {/foreach}
  22 + </div>
  23 + </div>
  24 + </div>
  25 +
  26 + <div class="layui-form-item">
  27 + <label class="layui-form-label">商家来源</label>
  28 + <div class="layui-input-block">
  29 + <div class="layui-input-4">
  30 + {foreach $channel as $vo}
  31 + <input type="checkbox" name="type[{$vo.id}]" lay-skin="primary" title="{$vo.name}" {if $vo.checked==1} checked{/if}>
  32 + {/foreach}
  33 + </div>
  34 + </div>
  35 + </div>
  36 +
  37 + <div class="layui-form-item">
  38 + <div class="layui-input-block">
  39 + <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('submit')}</button>
  40 + <a href="{:url('sellerList')}" class="layui-btn layui-btn-primary">{:lang('back')}</a>
  41 + </div>
  42 + </div>
  43 + </form>
  44 +</div>
  45 +{include file="common/foot"/}
  46 +<script>
  47 + layui.use('form', function () {
  48 + var form = layui.form, $ = layui.jquery;
  49 + //根据菜品ID 修改对应菜品的GIF、视频url
  50 + form.on('submit(submit)', function (data) {
  51 + var loading = layer.load(1, {shade: [0.1, '#fff']});
  52 + $.post("{:url('sellerconfig')}", data.field, function (res) {
  53 + layer.close(loading);
  54 + if (res.code == 1) {
  55 + layer.msg(res.msg, {time: 1000, icon: 1}, function () {
  56 + location.href = "{:url('sellerList')}";
  57 + });
  58 + } else {
  59 + layer.msg(res.msg, {time: 1000, icon: 2});
  60 + }
  61 + });
  62 + })
  63 + });
  64 +</script>