Commit b6dac06c28654229feb00e96eefaf1fac41efc3b

Authored by teemitop
1 parent d4eee384

菜系配置

... ... @@ -22,6 +22,24 @@ class Seller extends Common
$array['data'][0]['data'][$key]['statusVal'] = "启用";
else
$array['data'][0]['data'][$key]['statusVal'] = "停用";
$c_name = array();
$t_name = array();
//2019-03-05 增加菜系配置、商家类型配置
if(is_array($value['cuisine'])){
foreach ($value['cuisine'] as $k => $v) {
$c_name[] = $v['name'];
}
}
if(is_array($value['type'])){
foreach ($value['type'] as $k => $v) {
$t_name[] = $v['type_name'];
}
}
if(!empty($c_name))
$array['data'][0]['data'][$key]['cuisine'] = implode(',', $c_name);
if(!empty($t_name))
$array['data'][0]['data'][$key]['type'] = implode(',', $t_name);
}
return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'][0]['data'],'count'=>$array['data'][0]['total'],'rel'=>1];
}
... ... @@ -119,7 +137,7 @@ class Seller extends Common
$parame = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$sellername.'&stime='.@$stime.'&etime='.@$etime.'&type='.@$data['channel'].'&sid='.$sid.'&time_type='.@$data['time_type'];
//获取运营人员列表
$list= file_get_contents(UNDER_LINE.'App.Report.GetReserveData'.$parame);
$list= file_get_contents(ON_LINE.'App.Report.GetReserveData'.$parame);
$array = json_decode($list,TRUE);
$new_array = array();
... ... @@ -137,4 +155,60 @@ class Seller extends Common
$this->assign ( 'title','预定订单统计');
return $this->fetch();
}
/**
* 商家菜系、类型配置
*/
public function sellerconfig(){
$data = Request::except('file');
if(Request::isAjax()){
$cuisine = !empty($data['cuisine']) ? implode(',', array_keys($data['cuisine'])) : '';
$type = !empty($data['type']) ? implode(',', array_keys($data['type'])) : '';
if($cuisine)
$res_cuisine= file_get_contents(ON_LINE.'App.Seller.SetSellerCuisine&sellerid='.$data['sellerid'].'&cid='.$cuisine);
//$res_cuisine = json_decode($res_cuisine,TRUE);
if($type)
$res_type= file_get_contents(ON_LINE.'App.Seller.SetSellerType&sellerid='.$data['sellerid'].'&typeid='.$type);
//$res_type = json_decode($res_type,TRUE);
$result['code'] = 1;
$result['msg'] = "配置成功!";
return $result;
}
//获取商家已有菜系
$cuisine_list= file_get_contents(ON_LINE.'App.Seller.getSellerCuisine&sellerid='.$data['id']);
$cuisine_list = json_decode($cuisine_list,TRUE);
//获取所有菜系
$list= file_get_contents(ON_LINE.'App.Reserve.GetCustomerConfig');
$array = json_decode($list,TRUE);
//组装数据
foreach ($cuisine_list['data'] as $key => $value) {
foreach ($array['data']['cate'] as $k => $v) {
if($value['cid']==$v['id']){
$array['data']['cate'][$k]['checked'] = 1;
}
}
}
$this->assign('list',$array['data']['cate']);//获取所有菜系
//获取商家已有来源
$type_list= file_get_contents(ON_LINE.'App.Seller.GetSellerType&sellerid='.$data['id']);
$type_list = json_decode($type_list,TRUE);
//获取来源
$channel = array(array('id'=>1,'name'=>'合作'),array('id'=>2,'name'=>'推广'),array('id'=>3,'name'=>'测试'));
//组装数据
foreach ($type_list['data'] as $key => $value) {
foreach ($channel as $k => $v) {
if($value['type_id']==$v['id']){
$channel[$k]['checked'] = 1;
}
}
}
$this->assign('channel',$channel);//获取所有来源
$this->assign ('data',$data); //商户信息
$this->assign ( 'title','商户菜品配置' );
return $this->fetch();
}
}
... ...
... ... @@ -27,8 +27,9 @@
{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('Template/configMer')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">配置菜品</a>
<a href="{:url('Basicinfo/smsRecharge')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">线下短信充值</a>
<a href="{:url('Seller/sellerconfig')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">配置菜系/类型</a>
<!--<a href="{:url('Template/configMer')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">配置菜品</a>-->
<!--<a href="{:url('Basicinfo/smsRecharge')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">线下短信充值</a>-->
</script>
<script>
layui.use(['table','form'], function() {
... ... @@ -40,20 +41,21 @@
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: 'last_num', align: 'center',title: '短信余量', width: 120},
{field: 'dz_version', align: 'center',title: 'APP版本号', width: 120},
{field: 'statusVal', align: 'center',title: '状态', width: 120},
{field: 'user_name', align: 'center',title: '创建人', width: 120},
{field: 'cdate', align: 'center',title: '创建日期', width: 180},
{width: 230, align: 'center',title: '操作', toolbar: '#action'}
{field: 'name', title: '版本'},
{field: 'sellername', title: '商家名称'},
{field: 'phone', title: '商家电话'},
{field: 'map_address', title: '商家地址'},
{field: 'last_num', align: 'center',title: '短信余量'},
{field: 'dz_version', align: 'center',title: 'APP版本号'},
{field: 'statusVal', align: 'center',title: '状态'},
{field: 'user_name', align: 'center',title: '创建人'},
{field: 'cdate', align: 'center',title: '创建日期'},
{field: 'cuisine', align: 'center',title: '现有菜系'},
{field: 'type', align: 'center',title: '现有类型'},
{align: 'center',title: '操作', toolbar: '#action'}
]]
,id: 'testReload'
,page: true
,height: 471
});
//搜索
... ...
{include file="common/head"/}
<div class="admin-main layui-anim layui-anim-upbit">
<fieldset class="layui-elem-field layui-field-title">
<legend>{$title}</legend>
</fieldset>
<form class="layui-form layui-form-pane">
<div class="layui-form-item">
<label class="layui-form-label">商家名字</label>
<div class="layui-input-4">
<input type="text" value="{:$data['name']}" disabled class="layui-input">
<input type="hidden" name="sellerid" value="{:$data['id']}" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">请选择菜系</label>
<div class="layui-input-block">
<div class="layui-input-4">
{foreach $list as $vo}
<input type="checkbox" name="cuisine[{$vo.id}]" lay-skin="primary" title="{$vo.name}" {if $vo.checked==1} checked{/if}>
{/foreach}
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">商家来源</label>
<div class="layui-input-block">
<div class="layui-input-4">
{foreach $channel as $vo}
<input type="checkbox" name="type[{$vo.id}]" lay-skin="primary" title="{$vo.name}" {if $vo.checked==1} checked{/if}>
{/foreach}
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('submit')}</button>
<a href="{:url('sellerList')}" class="layui-btn layui-btn-primary">{:lang('back')}</a>
</div>
</div>
</form>
</div>
{include file="common/foot"/}
<script>
layui.use('form', function () {
var form = layui.form, $ = layui.jquery;
//根据菜品ID 修改对应菜品的GIF、视频url
form.on('submit(submit)', function (data) {
var loading = layer.load(1, {shade: [0.1, '#fff']});
$.post("{:url('sellerconfig')}", data.field, function (res) {
layer.close(loading);
if (res.code == 1) {
layer.msg(res.msg, {time: 1000, icon: 1}, function () {
location.href = "{:url('sellerList')}";
});
} else {
layer.msg(res.msg, {time: 1000, icon: 2});
}
});
})
});
</script>
\ No newline at end of file
... ...