Showing
2 changed files
with
137 additions
and
49 deletions
| @@ -11,45 +11,129 @@ class Seller extends Common | @@ -11,45 +11,129 @@ class Seller extends Common | ||
| 11 | public function sellerList(){ | 11 | public function sellerList(){ |
| 12 | if(Request::isAjax()){ | 12 | if(Request::isAjax()){ |
| 13 | $data = Request::except('file'); | 13 | $data = Request::except('file'); |
| 14 | - $key= input('post.key') ? input('post.key') : ""; | ||
| 15 | - $channel = @$key['channel'] ? @$key['channel'] : 1; | ||
| 16 | 14 | ||
| 17 | - $address = @$key['address'] ? @$key['address'] : ''; | ||
| 18 | - $prov = @$key['prov'] ? @$key['prov'] : ''; | ||
| 19 | - $city = @$key['city'] ? @$key['city'] : ''; | ||
| 20 | - $area = @$key['area'] ? @$key['area'] : ''; | 15 | + /*$prov = $data['prov'] ? $data['prov'] : ''; |
| 16 | + $city = $data['city'] ? $data['city'] : ''; | ||
| 17 | + $area = $data['area'] ? $data['area'] : '';*/ | ||
| 21 | 18 | ||
| 22 | - $limit = '&x='.$data["page"].'&y='.$data["limit"].'&keywords='.@$key['id'].'&channel='.$channel.'&address='.$address.'&prov='.$prov.'&city='.$city.'&area='.$area; | 19 | + //$limit = '&x='.$data["page"].'&y='.$data["limit"].'&keywords='.@$key['id'].'&channel='.$channel.'&address='.$address.'&prov='.$prov.'&city='.$city.'&area='.$area; |
| 23 | 20 | ||
| 24 | - //获取运营人员列表 | ||
| 25 | - $list= file_get_contents(ON_LINE.'App.Seller.GetSellerList'.$limit); | ||
| 26 | - $array = json_decode($list,TRUE); | ||
| 27 | - foreach ($array['data'][0]['data'] as $key => $value) { | ||
| 28 | - $array['data'][0]['data'][$key]['cdate'] = date("Y-m-d H:i:s",$value['cdate']); | 21 | + $where = ''; |
| 22 | + $channel = $data['channel'] ? $data['channel'] : 1; | ||
| 23 | + $online = $data['online'] ? $data['channel'] : ''; | ||
| 24 | + | ||
| 25 | + $where .= ($channel && $channel==4) ? ' re.type_id in (1,2,3)' : " re.type_id in ($channel)"; | ||
| 26 | + $where .= $data['address'] ? ' and s.map_address like "%'.$data['address'].'%"' : ""; | ||
| 27 | + $where .= $data['key'] ? ' and s.sellername like "%'.$data['key'].'%"' : ""; | ||
| 28 | + $where .= $data['area'] ? ' and a.key = 1 and a.district like "%'.$data['area'].'%"' : ""; | ||
| 29 | + switch ($data['online']) { | ||
| 30 | + case '1': | ||
| 31 | + $where .= ' and s.is_online_reserve = 1'; | ||
| 32 | + break; | ||
| 33 | + case '2': | ||
| 34 | + $where .= ' and s.is_online_reserve = 0'; | ||
| 35 | + break; | ||
| 36 | + default: | ||
| 37 | + $where .= ""; | ||
| 38 | + break; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + $offset = ($data["page"] - 1) * $data["limit"]; | ||
| 42 | + $limit = " LIMIT $offset,".$data['limit']; | ||
| 43 | + | ||
| 44 | + //商家基本数据 | ||
| 45 | + $rs = Db::query("SELECT | ||
| 46 | + s.id, | ||
| 47 | + s.sellername, | ||
| 48 | + s.selleralias, | ||
| 49 | + s.address, | ||
| 50 | + s.phone, | ||
| 51 | + s.map_address, | ||
| 52 | + s.slogan, | ||
| 53 | + s.is_online_reserve, | ||
| 54 | + s.cdate, | ||
| 55 | + u.user_name, | ||
| 56 | + s.status, | ||
| 57 | + s.last_num, | ||
| 58 | + s.average, | ||
| 59 | + s.score, | ||
| 60 | + s.is_parking, | ||
| 61 | + s.is_meal_fee, | ||
| 62 | + s.is_unsubscribe, | ||
| 63 | + s.is_minimum_consumption, | ||
| 64 | + s.is_belt_wine, | ||
| 65 | + s.scale, | ||
| 66 | + s.is_auth, | ||
| 67 | + scf.dz_version | ||
| 68 | + FROM | ||
| 69 | + `xt-member-two-LINE`.xt_seller AS s | ||
| 70 | + LEFT JOIN `xt-member-two-LINE`.xt_auth_user AS u ON u.sellerid = s.id | ||
| 71 | + LEFT JOIN `xt-member-two-LINE`.xt_dc_dz_seller_config AS scf ON s.id = scf.sid | ||
| 72 | + LEFT JOIN `xt-member-two-LINE`.xt_dc_dz_seller_type_rel AS re ON re.sid = s.id | ||
| 73 | + LEFT JOIN `xt-member-two-LINE`.xt_dc_dz_address AS a ON a.sid = s.id | ||
| 74 | + WHERE | ||
| 75 | + s.isopen_dc = 1 | ||
| 76 | + AND ".$where." GROUP BY s.id order by s.scale".$limit); | ||
| 77 | + //菜系 商家类型 | ||
| 78 | + foreach ($rs as $key => $value) { | ||
| 79 | + $rs[$key]['cuisine'] = Db::query("SELECT | ||
| 80 | + a.cid, | ||
| 81 | + b.NAME | ||
| 82 | + FROM | ||
| 83 | + `xt-member-two-LINE`.`xt_dc_dz_seller_cuisine_rel` AS a | ||
| 84 | + RIGHT JOIN `xt-member-two-LINE`.xt_dc_dz_seller_cuisine AS b ON a.cid = b.id | ||
| 85 | + WHERE | ||
| 86 | + sid =".$value['id']); | ||
| 87 | + $rs[$key]['type'] = Db::query("SELECT | ||
| 88 | + a.type_id, | ||
| 89 | + b.type_name | ||
| 90 | + FROM | ||
| 91 | + `xt-member-two-LINE`.`xt_dc_dz_seller_type_rel` AS a | ||
| 92 | + LEFT JOIN `xt-member-two-LINE`.xt_dc_dz_seller_type AS b ON a.type_id = b.id | ||
| 93 | + WHERE | ||
| 94 | + sid =".$value['id']); | ||
| 95 | + } | ||
| 96 | + //格式化数据 | ||
| 97 | + foreach ($rs as $key => $value) { | ||
| 98 | + $rs[$key]['cdate'] = date("Y-m-d H:i:s",$value['cdate']); | ||
| 29 | if($value['status']==1) | 99 | if($value['status']==1) |
| 30 | - $array['data'][0]['data'][$key]['statusVal'] = "启用"; | 100 | + $rs[$key]['statusVal'] = "启用"; |
| 31 | else | 101 | else |
| 32 | - $array['data'][0]['data'][$key]['statusVal'] = "停用"; | 102 | + $rs[$key]['statusVal'] = "停用"; |
| 33 | 103 | ||
| 34 | $c_name = array(); | 104 | $c_name = array(); |
| 35 | $t_name = array(); | 105 | $t_name = array(); |
| 36 | //2019-03-05 增加菜系配置、商家类型配置 | 106 | //2019-03-05 增加菜系配置、商家类型配置 |
| 37 | - if(is_array($value['cuisine'])){ | 107 | + if(is_array($value['cuisine']) && $value['cuisine']){ |
| 38 | foreach ($value['cuisine'] as $k => $v) { | 108 | foreach ($value['cuisine'] as $k => $v) { |
| 39 | $c_name[] = $v['name']; | 109 | $c_name[] = $v['name']; |
| 40 | } | 110 | } |
| 41 | } | 111 | } |
| 42 | - if(is_array($value['type'])){ | 112 | + if(is_array($value['type']) && $value['type']){ |
| 43 | foreach ($value['type'] as $k => $v) { | 113 | foreach ($value['type'] as $k => $v) { |
| 44 | $t_name[] = $v['type_name']; | 114 | $t_name[] = $v['type_name']; |
| 45 | } | 115 | } |
| 46 | } | 116 | } |
| 47 | if(!empty($c_name)) | 117 | if(!empty($c_name)) |
| 48 | - $array['data'][0]['data'][$key]['cuisine'] = implode(',', $c_name); | 118 | + $rs[$key]['cuisine'] = implode(',', $c_name); |
| 49 | if(!empty($t_name)) | 119 | if(!empty($t_name)) |
| 50 | - $array['data'][0]['data'][$key]['type'] = implode(',', $t_name); | 120 | + $rs[$key]['type'] = implode(',', $t_name); |
| 51 | } | 121 | } |
| 52 | - return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'][0]['data'],'count'=>$array['data'][0]['total'],'rel'=>1]; | 122 | + |
| 123 | + //获取总条数 | ||
| 124 | + $total = Db::query("SELECT | ||
| 125 | + s.id | ||
| 126 | + FROM | ||
| 127 | + `xt-member-two-LINE`.xt_seller AS s | ||
| 128 | + LEFT JOIN `xt-member-two-LINE`.xt_dc_dz_seller_config AS scf ON s.id = scf.sid | ||
| 129 | + LEFT JOIN `xt-member-two-LINE`.xt_dc_dz_seller_type_rel AS re ON re.sid = s.id | ||
| 130 | + LEFT JOIN `xt-member-two-LINE`.xt_dc_dz_address AS a ON a.sid = s.id | ||
| 131 | + WHERE | ||
| 132 | + s.isopen_dc = 1 | ||
| 133 | + AND ".$where." | ||
| 134 | + GROUP BY | ||
| 135 | + s.id"); | ||
| 136 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$rs,'count'=>count($total),'rel'=>1]; | ||
| 53 | } | 137 | } |
| 54 | $this->assign ( 'title','商户基本信息维护'); | 138 | $this->assign ( 'title','商户基本信息维护'); |
| 55 | return $this->fetch(); | 139 | return $this->fetch(); |
| @@ -33,6 +33,16 @@ | @@ -33,6 +33,16 @@ | ||
| 33 | </select> | 33 | </select> |
| 34 | </div> | 34 | </div> |
| 35 | </div> | 35 | </div> |
| 36 | + 在线预定: | ||
| 37 | + <div class="layui-input-inline layui-form"> | ||
| 38 | + <div class="layui-input-8"> | ||
| 39 | + <select name="class" id="online" lay-filter="myselect"> | ||
| 40 | + <option value="4" selected>全部</option> | ||
| 41 | + <option value="1">已开通</option> | ||
| 42 | + <option value="2">未开通</option> | ||
| 43 | + </select> | ||
| 44 | + </div> | ||
| 45 | + </div> | ||
| 36 | <hr> | 46 | <hr> |
| 37 | 选择地区: | 47 | 选择地区: |
| 38 | <div class="layui-input-inline"> | 48 | <div class="layui-input-inline"> |
| @@ -83,19 +93,27 @@ | @@ -83,19 +93,27 @@ | ||
| 83 | <!--<a href="{:url('Template/configMer')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">配置菜品</a>--> | 93 | <!--<a href="{:url('Template/configMer')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">配置菜品</a>--> |
| 84 | <a href="{:url('Basicinfo/smsRecharge')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">短信充值</a> | 94 | <a href="{:url('Basicinfo/smsRecharge')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">短信充值</a> |
| 85 | </script> | 95 | </script> |
| 96 | + | ||
| 97 | +<script type="text/html" id="sTpl"> | ||
| 98 | + {{# if(d.is_online_reserve == 1){ }} | ||
| 99 | + <span style="color: #0000C6;">{{ d.sellername }}</span> | ||
| 100 | + {{# } else { }} | ||
| 101 | + {{ d.sellername }} | ||
| 102 | + {{# } }} | ||
| 103 | +</script> | ||
| 104 | + | ||
| 86 | <script> | 105 | <script> |
| 87 | layui.use(['table','form'], function() { | 106 | layui.use(['table','form'], function() { |
| 88 | - var table = layui.table,$ = layui.jquery; | 107 | + var table = layui.table,laydate = layui.laydate,form = layui.form,$ = layui.jquery,layer = layui.layer; |
| 89 | var tableIn = table.render({ | 108 | var tableIn = table.render({ |
| 90 | elem: '#list', | 109 | elem: '#list', |
| 91 | url: '{:url("sellerList")}', | 110 | url: '{:url("sellerList")}', |
| 92 | method: 'post', | 111 | method: 'post', |
| 93 | title: '商家列表', | 112 | title: '商家列表', |
| 94 | toolbar: '#toolbarDemo', | 113 | toolbar: '#toolbarDemo', |
| 95 | - page:true, | ||
| 96 | cols: [[ | 114 | cols: [[ |
| 97 | {field: 'id', title: '{:lang("id")}', width:60, fixed: true}, | 115 | {field: 'id', title: '{:lang("id")}', width:60, fixed: true}, |
| 98 | - {field: 'sellername', edit: 'text', title: '商家名称'}, | 116 | + {field: 'sellername', edit: 'text', title: '商家名称', templet: '#sTpl'}, |
| 99 | {field: 'selleralias', edit: 'text', title: '短店名+地址'}, | 117 | {field: 'selleralias', edit: 'text', title: '短店名+地址'}, |
| 100 | {field: 'address', edit: 'text', align: 'center',title: '温馨提示'}, | 118 | {field: 'address', edit: 'text', align: 'center',title: '温馨提示'}, |
| 101 | {field: 'average', align: 'center', edit: 'text', title: '人均消费'}, | 119 | {field: 'average', align: 'center', edit: 'text', title: '人均消费'}, |
| @@ -208,32 +226,22 @@ | @@ -208,32 +226,22 @@ | ||
| 208 | 226 | ||
| 209 | //搜索 | 227 | //搜索 |
| 210 | $('#search').on('click', function() { | 228 | $('#search').on('click', function() { |
| 229 | + //关键字 | ||
| 211 | var key = $('#key').val(); | 230 | var key = $('#key').val(); |
| 212 | - /*if($.trim(key)==='') { | ||
| 213 | - layer.msg('{:lang("pleaseEnter")}店铺名称!',{icon:0}); | ||
| 214 | - return; | ||
| 215 | - }*/ | ||
| 216 | - tableIn.reload({ | ||
| 217 | - page:{page: 1}, | ||
| 218 | - where:{ | ||
| 219 | - key: key, | ||
| 220 | - address: $('#address').val(), | ||
| 221 | - channel: $('#channel').val(), | ||
| 222 | - prov: $("#provid").find("option:selected").text(), | ||
| 223 | - city: $("#cityid").find("option:selected").text(), | ||
| 224 | - area: $("#areaid").find("option:selected").text() | ||
| 225 | - } | ||
| 226 | - }); | 231 | + var address = $('#address').val(); |
| 232 | + var channel = $('#channel').val(); | ||
| 233 | + var online = $('#online').val(); | ||
| 234 | + var prov = $("#provid").find("option:selected").text(); | ||
| 235 | + var city = $("#cityid").find("option:selected").text(); | ||
| 236 | + var area = $("#areaid").find("option:selected").text(); | ||
| 237 | + //传参 | ||
| 238 | + tableIn.reload({ page: {page: 1},where: {key: key,address: address,channel: channel,online: online,prov:prov,city: city,area: area}}); | ||
| 227 | }); | 239 | }); |
| 228 | 240 | ||
| 229 | var $ = layui.$, active = { | 241 | var $ = layui.$, active = { |
| 230 | reload: function(){ | 242 | reload: function(){ |
| 231 | - var key = $('#key'); | ||
| 232 | - var channel = $('#channel'); | ||
| 233 | var address = $('#address'); | 243 | var address = $('#address'); |
| 234 | - var prov = $("#provid").find("option:selected").text(); | ||
| 235 | - var city = $("#cityid").find("option:selected").text(); | ||
| 236 | - var area = $("#areaid").find("option:selected").text() | 244 | + var key = $('#key'); |
| 237 | //执行重载 | 245 | //执行重载 |
| 238 | table.reload('testReload', { | 246 | table.reload('testReload', { |
| 239 | page: { | 247 | page: { |
| @@ -242,21 +250,17 @@ | @@ -242,21 +250,17 @@ | ||
| 242 | ,where: { | 250 | ,where: { |
| 243 | key: { | 251 | key: { |
| 244 | id: key.val(), | 252 | id: key.val(), |
| 245 | - channel: channel.val(), | ||
| 246 | - address: address.val(), | ||
| 247 | - prov: prov, | ||
| 248 | - city: city, | ||
| 249 | - area: area | 253 | + address: address.val() |
| 250 | } | 254 | } |
| 251 | } | 255 | } |
| 252 | }); | 256 | }); |
| 253 | } | 257 | } |
| 254 | }; | 258 | }; |
| 255 | 259 | ||
| 256 | - $('.demoTable .layui-btn').on('click', function(){ | 260 | + /*$('.demoTable .layui-btn').on('click', function(){ |
| 257 | var type = $(this).data('type'); | 261 | var type = $(this).data('type'); |
| 258 | active[type] ? active[type].call(this) : ''; | 262 | active[type] ? active[type].call(this) : ''; |
| 259 | - }); | 263 | + });*/ |
| 260 | 264 | ||
| 261 | //启用、停用 | 265 | //启用、停用 |
| 262 | table.on('tool(list)', function(obj){ | 266 | table.on('tool(list)', function(obj){ |
-
Please register or login to post a comment