Commit a988d490120f23a46d0106dfb5aae2522d59c53d
Merge branch 'master' of http://123.56.79.57/najixian/xt_dc_admin
Showing
6 changed files
with
1546 additions
and
0 deletions
application/admin/controller/Area.php
0 → 100644
| 1 | +<?php | ||
| 2 | +namespace app\admin\controller; | ||
| 3 | +use think\Db; | ||
| 4 | +use think\facade\Request; | ||
| 5 | +class Area extends Common | ||
| 6 | +{ | ||
| 7 | + /** | ||
| 8 | + ***代理商管理 | ||
| 9 | + *** | ||
| 10 | + **/ | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + /** | ||
| 14 | + * 商家list | ||
| 15 | + */ | ||
| 16 | + public function Seller(){ | ||
| 17 | + if(Request::isAjax()){ | ||
| 18 | + $data = Request::except('file'); | ||
| 19 | + $key= input('post.key') ? input('post.key') : ""; | ||
| 20 | + $channel = @$key['channel'] ? @$key['channel'] : 1; | ||
| 21 | + | ||
| 22 | + $address = @$key['address'] ? @$key['address'] : ''; | ||
| 23 | + $prov = @$key['prov'] ? @$key['prov'] : ''; | ||
| 24 | + $city = @$key['city'] ? @$key['city'] : ''; | ||
| 25 | + $area = @$key['area'] ? @$key['area'] : ''; | ||
| 26 | + | ||
| 27 | + $limit = '&x='.$data["page"].'&y='.$data["limit"].'&areaid=61&channel=4&address='.$address.'&prov='.$prov.'&city='.$city.'&area='.$area; | ||
| 28 | + | ||
| 29 | + //获取运营人员列表 | ||
| 30 | + $list= file_get_contents(ON_LINE.'App.Agent.getSellerList'.$limit); | ||
| 31 | + $array = json_decode($list,TRUE); | ||
| 32 | + foreach ($array['data']['data'] as $key => $value) { | ||
| 33 | + $array['data']['data'][$key]['cdate'] = date("Y-m-d H:i:s",$value['cdate']); | ||
| 34 | + if($value['status']==1) | ||
| 35 | + $array['data']['data'][$key]['statusVal'] = "启用"; | ||
| 36 | + else | ||
| 37 | + $array['data']['data'][$key]['statusVal'] = "停用"; | ||
| 38 | + | ||
| 39 | + $c_name = array(); | ||
| 40 | + $t_name = array(); | ||
| 41 | + //2019-03-05 增加菜系配置、商家类型配置 | ||
| 42 | + if(is_array($value['cuisine'])){ | ||
| 43 | + foreach ($value['cuisine'] as $k => $v) { | ||
| 44 | + $c_name[] = $v['name']; | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + if(is_array($value['type'])){ | ||
| 48 | + foreach ($value['type'] as $k => $v) { | ||
| 49 | + $t_name[] = $v['type_name']; | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + if(!empty($c_name)) | ||
| 53 | + $array['data']['data'][$key]['cuisine'] = implode(',', $c_name); | ||
| 54 | + if(!empty($t_name)) | ||
| 55 | + $array['data']['data'][$key]['type'] = implode(',', $t_name); | ||
| 56 | + } | ||
| 57 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data']['data'],'count'=>$array['data']['total'],'rel'=>1]; | ||
| 58 | + } | ||
| 59 | + $this->assign ( 'title','区域内商户维护'); | ||
| 60 | + return $this->fetch(); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public function addagent(){ | ||
| 64 | + if(Request::isAjax()){ | ||
| 65 | + $data = Request::except('file'); | ||
| 66 | + //获取运营人员列表 | ||
| 67 | + $list= file_get_contents(ON_LINE.'App.Agent.addAgent&areaid='.$data['areaid'].'&agent_name='.$data['agent_name'].'&agent_phone='.$data['agent_phone']); | ||
| 68 | + $array = json_decode($list,TRUE); | ||
| 69 | + return $result = ['code'=>0,'msg'=>'添加成功!','data'=>$array['data'],'rel'=>1];#'count'=>$array['data'][0]['total'] | ||
| 70 | + } | ||
| 71 | + $this->assign ( 'title','代理商管理'); | ||
| 72 | + return $this->fetch(); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 商家list | ||
| 77 | + */ | ||
| 78 | + public function agent(){ | ||
| 79 | + if(Request::isAjax()){ | ||
| 80 | + $data = Request::except('file'); | ||
| 81 | + $key= input('post.key') ? input('post.key') : ""; | ||
| 82 | + $channel = @$key['channel'] ? @$key['channel'] : 1; | ||
| 83 | + | ||
| 84 | + $address = @$key['address'] ? @$key['address'] : ''; | ||
| 85 | + $prov = @$key['prov'] ? @$key['prov'] : ''; | ||
| 86 | + $city = @$key['city'] ? @$key['city'] : ''; | ||
| 87 | + $area = @$key['area'] ? @$key['area'] : ''; | ||
| 88 | + | ||
| 89 | + $limit = '';#'&x='.$data["page"].'&y='.$data["limit"]; | ||
| 90 | + | ||
| 91 | + //获取运营人员列表 | ||
| 92 | + $list= file_get_contents(ON_LINE.'App.Agent.getAgentList'.$limit); | ||
| 93 | + $array = json_decode($list,TRUE); | ||
| 94 | + /*foreach ($array['data'][0]['data'] as $key => $value) { | ||
| 95 | + $array['data'][0]['data'][$key]['cdate'] = date("Y-m-d H:i:s",$value['cdate']); | ||
| 96 | + | ||
| 97 | + }*/ | ||
| 98 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'],'rel'=>1];#'count'=>$array['data'][0]['total'] | ||
| 99 | + } | ||
| 100 | + $this->assign ( 'title','代理商管理'); | ||
| 101 | + return $this->fetch(); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + /** | ||
| 105 | + * 代理商运营list | ||
| 106 | + */ | ||
| 107 | + public function operate(){ | ||
| 108 | + if(Request::isAjax()){ | ||
| 109 | + $data = Request::except('file'); | ||
| 110 | + //获取运营人员列表 | ||
| 111 | + $list= file_get_contents(ON_LINE.'App.Agent.getAgentOperate&areaid=2'); | ||
| 112 | + $array = json_decode($list,TRUE); | ||
| 113 | + foreach ($array['data'] as $key => $value) { | ||
| 114 | + $array['data'][$key]['cdate'] = date("Y-m-d H:i:s",$value['cdate']); | ||
| 115 | + | ||
| 116 | + } | ||
| 117 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'],'rel'=>1];#'count'=>$array['data'][0]['total'] | ||
| 118 | + } | ||
| 119 | + $this->assign ( 'title','代理商管理'); | ||
| 120 | + return $this->fetch(); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + /** | ||
| 124 | + * 禁用运营 | ||
| 125 | + */ | ||
| 126 | + public function setAgentOperate(){ | ||
| 127 | + if(Request::isAjax()){ | ||
| 128 | + $data = Request::except('file'); | ||
| 129 | + $list= file_get_contents(ON_LINE.'App.Agent.getAgentOperate&id='.$data['id']); | ||
| 130 | + $array = json_decode($list,TRUE); | ||
| 131 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'],'rel'=>1];#'count'=>$array['data'][0]['total'] | ||
| 132 | + } | ||
| 133 | + $this->assign ( 'title','代理商管理'); | ||
| 134 | + return $this->fetch(); | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + //增加运营管理人员 | ||
| 138 | + public function operateAdd(){ | ||
| 139 | + //缓存60秒 不请求。 | ||
| 140 | + /*$arr = cache('qrcod_url'); | ||
| 141 | + if(!$arr){ | ||
| 142 | + $arr= file_get_contents("http://xt.colorcun.com/WechatApi/WechatApi/CreateOperateQrcode/"); | ||
| 143 | + $arr = json_decode($arr,TRUE); | ||
| 144 | + cache('qrcod_url',$arr, 50); | ||
| 145 | + }*/ | ||
| 146 | + | ||
| 147 | + $this->assign('qrcode_path','https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQGx8DwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyTHVYdVF0QmZlR2oxMDAwMDAwN2oAAgQ84vpdAwQAAAAA'); | ||
| 148 | + return view(); | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + /** | ||
| 152 | + * 停用商家 | ||
| 153 | + */ | ||
| 154 | + public function configStop(){ | ||
| 155 | + if(Request::isAjax()){ | ||
| 156 | + $data = Request::except('file'); | ||
| 157 | + $data['status'] = $data['status'] ? 0 : 1; | ||
| 158 | + $list= file_get_contents(ON_LINE.'App.Seller.SetStopBySeller&sellerid='.$data['sellerid'].'&status='.$data['status']); | ||
| 159 | + $array = json_decode($list,TRUE); | ||
| 160 | + if($array['ret']==200){ | ||
| 161 | + $result['code'] = 1; | ||
| 162 | + $result['msg'] = 'SUCCESS!'; | ||
| 163 | + }else{ | ||
| 164 | + $result['code'] = 0; | ||
| 165 | + $result['msg'] = '请求错误!'; | ||
| 166 | + } | ||
| 167 | + return $result; | ||
| 168 | + } | ||
| 169 | + return view(); | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + /** | ||
| 173 | + * 从商家维度统计:订单、短信等情况 | ||
| 174 | + */ | ||
| 175 | + public function getStatistics(){ | ||
| 176 | + if(Request::isAjax()){ | ||
| 177 | + $data = Request::except('file'); | ||
| 178 | + $key= input('post.key') ? input('post.key') : ""; | ||
| 179 | + | ||
| 180 | + $sid = $data['sid'] ? implode(',', $data['sid']) : ''; | ||
| 181 | + $sellername = $data['key'] ? $data['key'] : ''; | ||
| 182 | + | ||
| 183 | + $time = $data['time'] ? explode(' - ', $data['time']) : ''; | ||
| 184 | + | ||
| 185 | + $stime = $time ? strtotime(date($time[0],time())) : ''; | ||
| 186 | + $etime = $time ? strtotime(date($time[1],time())) : ''; | ||
| 187 | + | ||
| 188 | + $data['time_type'] = $data['time_type'] ? $data['time_type'] : 1; | ||
| 189 | + $data['channel'] = $data['channel'] ? $data['channel'] : 1; | ||
| 190 | + | ||
| 191 | + $parame = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$sellername.'&stime='.@$stime.'&etime='.@$etime.'&channel='.@$data['channel'].'&sid='.$sid.'&time_type='.@$data['time_type']; | ||
| 192 | + | ||
| 193 | + //获取运营人员列表 | ||
| 194 | + $list= file_get_contents(ON_LINE.'App.Report.GetReserveData'.$parame); | ||
| 195 | + | ||
| 196 | + $array = json_decode($list,TRUE); | ||
| 197 | + | ||
| 198 | + $new_array = array(); | ||
| 199 | + foreach ($array['data'] as $key => $value) { | ||
| 200 | + if(is_array($value)){ | ||
| 201 | + $new_array[$key]['id'] = $value['id']; | ||
| 202 | + $new_array[$key]['sellername'] = $value['sellername']; | ||
| 203 | + $new_array[$key]['contacts_total'] = $value['contacts_total']; | ||
| 204 | + $new_array[$key]['inviting'] = $value['inviting']; | ||
| 205 | + $new_array[$key]['reserve_count'] = $value['appReserveCount'] .'/'. $value['AndroidReserveCount'].'/'. $value['CReserveCount']; | ||
| 206 | + $new_array[$key]['reserve_count_sort'] = $value['appReserveCount'] + $value['AndroidReserveCount'] + $value['CReserveCount']; | ||
| 207 | + $new_array[$key]['sms_send_count'] = $value['appSmsCount'] .'/'. $value['AndroidSmsCount']; | ||
| 208 | + $new_array[$key]['sms_send_count_sort'] = $value['appSmsCount'] + $value['AndroidSmsCount']; | ||
| 209 | + $new_array[$key]['table_room_total'] = $value['table_total'] .'/'. $value['room_total']; | ||
| 210 | + $new_array[$key]['address_component'] = $value['address_component']['province'] && $value['address_component']['city'] ? $value['address_component']['province'] .'-'. $value['address_component']['city'] : '无法获取地区,请检查经纬度是否正确!'; | ||
| 211 | + } | ||
| 212 | + } | ||
| 213 | + return $result = [ | ||
| 214 | + 'code'=>0,'msg'=>'获取成功!', | ||
| 215 | + 'data'=>$new_array, | ||
| 216 | + 'count'=>$array['data']['total'], | ||
| 217 | + 'countReserve'=>$array['data']['appReserveCount']+$array['data']['AndroidReserveCount']+$array['data']['CReserveCount'], | ||
| 218 | + 'countSms'=>$array['data']['appSmsCount']+$array['data']['AndroidSmsCount'], | ||
| 219 | + 'inviteeCount'=>$array['data']['inviteeCount'], | ||
| 220 | + 'appReserveCount'=>$array['data']['appReserveCount'], | ||
| 221 | + 'AndroidReserveCount'=>$array['data']['AndroidReserveCount'], | ||
| 222 | + 'CReserveCount'=>$array['data']['CReserveCount'], | ||
| 223 | + 'appSmsCount'=>$array['data']['appSmsCount'], | ||
| 224 | + 'AndroidSmsCount'=>$array['data']['AndroidSmsCount'], | ||
| 225 | + 'Contacts'=>$array['data']['Contacts'], | ||
| 226 | + 'rel'=>1 | ||
| 227 | + ]; | ||
| 228 | + } | ||
| 229 | + $this->assign ( 'title','预定订单统计'); | ||
| 230 | + return $this->fetch(); | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + /** | ||
| 234 | + * 从设备(电话机)维度统计:订单、短信等情况 | ||
| 235 | + */ | ||
| 236 | + public function getEquipment(){ | ||
| 237 | + if(Request::isAjax()){ | ||
| 238 | + $data = Request::except('file'); | ||
| 239 | + $key= input('post.key') ? input('post.key') : ""; | ||
| 240 | + | ||
| 241 | + $sid = $data['sid'] ? implode(',', $data['sid']) : ''; | ||
| 242 | + $sellername = $data['key'] ? $data['key'] : ''; | ||
| 243 | + | ||
| 244 | + $time = $data['time'] ? explode(' - ', $data['time']) : ''; | ||
| 245 | + | ||
| 246 | + $stime = $time ? strtotime(date($time[0],time())) : ''; | ||
| 247 | + $etime = $time ? strtotime(date($time[1],time())) : ''; | ||
| 248 | + | ||
| 249 | + $data['time_type'] = $data['time_type'] ? $data['time_type'] : 1; | ||
| 250 | + $data['channel'] = $data['channel'] ? $data['channel'] : 1; | ||
| 251 | + | ||
| 252 | + $parame = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$sellername.'&stime='.@$stime.'&etime='.@$etime.'&channel='.@$data['channel'].'&sid='.$sid.'&time_type='.@$data['time_type']; | ||
| 253 | + | ||
| 254 | + //获取运营人员列表 | ||
| 255 | + $list= file_get_contents(ON_LINE.'App.Report.GetReserveDataBydev'.$parame); | ||
| 256 | + $array = json_decode($list,TRUE); | ||
| 257 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data']['list'],'count'=>$array['data']['total'],'rel'=>1]; | ||
| 258 | + } | ||
| 259 | + $this->assign ( 'title','设备维度统计预定订单'); | ||
| 260 | + return $this->fetch(); | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + /** | ||
| 264 | + * 商家菜系、类型配置 | ||
| 265 | + */ | ||
| 266 | + public function sellerconfig(){ | ||
| 267 | + $data = Request::except('file'); | ||
| 268 | + if(Request::isAjax()){ | ||
| 269 | + $cuisine = !empty($data['cuisine']) ? implode(',', array_keys($data['cuisine'])) : ''; | ||
| 270 | + $type = !empty($data['type']) ? implode(',', array_keys($data['type'])) : ''; | ||
| 271 | + $mode = !empty($data['mode']) ? implode(',', array_keys($data['mode'])) : ''; | ||
| 272 | + $sms_code = !empty($data['sms_code']) ? $data['sms_code'] : ''; | ||
| 273 | + $label = !empty($data['label']) ? implode(',', array_keys($data['label'])) : ''; | ||
| 274 | + $brand = !empty($data['brand']) ? implode(',', array_keys($data['brand'])) : ''; | ||
| 275 | + $label_1_ = !empty($data['label_1_']) ? implode(',', array_keys($data['label_1_'])) : ''; | ||
| 276 | + $label_2_ = !empty($data['label_2_']) ? implode(',', array_keys($data['label_2_'])) : ''; | ||
| 277 | + $label_3_ = !empty($data['label_3_']) ? implode(',', array_keys($data['label_3_'])) : ''; | ||
| 278 | + | ||
| 279 | + if($sms_code) | ||
| 280 | + $res_sms_code= file_get_contents(ON_LINE.'App.SendSMS.SetSellerSmsTemplate&sid='.$data['sellerid'].'&sms_id='.$sms_code); | ||
| 281 | + | ||
| 282 | + if($cuisine) | ||
| 283 | + $res_cuisine= file_get_contents(ON_LINE.'App.Seller.SetSellerCuisine&sellerid='.$data['sellerid'].'&cid='.$cuisine); | ||
| 284 | + //$res_cuisine = json_decode($res_cuisine,TRUE); | ||
| 285 | + if($type) | ||
| 286 | + $res_type= file_get_contents(ON_LINE.'App.Seller.SetSellerType&sellerid='.$data['sellerid'].'&typeid='.$type); | ||
| 287 | + //$res_type = json_decode($res_type,TRUE); | ||
| 288 | + | ||
| 289 | + if($mode) | ||
| 290 | + $res_mode= file_get_contents(ON_LINE.'App.Seller.setSellerMode&sellerid='.$data['sellerid'].'&modeid='.$mode); | ||
| 291 | + //$res_mode = json_decode($res_mode,TRUE); | ||
| 292 | + if($label) | ||
| 293 | + $res_label= file_get_contents(ON_LINE.'App.Seller.setSellerLabel&sid='.$data['sellerid'].'&field='.$label); | ||
| 294 | + | ||
| 295 | + if($brand){ | ||
| 296 | + $del=Db::query("DELETE FROM `xt-member-two-LINE`.xt_dc_dz_seller_brand_rel WHERE sid =".$data['sellerid']); | ||
| 297 | + $add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_brand_rel VALUES(".$data['sellerid'].",".$brand.")"); | ||
| 298 | + } | ||
| 299 | + | ||
| 300 | + if($label_1_){ | ||
| 301 | + $del=Db::query("DELETE FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel WHERE sid = ".$data['sellerid']." AND lcid in (SELECT id FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c WHERE pid = 1)"); | ||
| 302 | + $add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel VALUES(".$data['sellerid'].",".$label_1_.")"); | ||
| 303 | + } | ||
| 304 | + | ||
| 305 | + if($label_2_){ | ||
| 306 | + $del=Db::query("DELETE FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel WHERE sid = ".$data['sellerid']." AND lcid in (SELECT id FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c WHERE pid = 2)"); | ||
| 307 | + $add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel VALUES(".$data['sellerid'].",".$label_2_.")"); | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | + if($label_3_){ | ||
| 311 | + $del=Db::query("DELETE FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel WHERE sid = ".$data['sellerid']." AND lcid in (SELECT id FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c WHERE pid = 3)"); | ||
| 312 | + $add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel VALUES(".$data['sellerid'].",".$label_3_.")"); | ||
| 313 | + } | ||
| 314 | + | ||
| 315 | + if(isset($data['edition'])){ | ||
| 316 | + $up=Db::query("UPDATE `xt-member-two-LINE`.xt_seller set is_online_reserve = ".$data['edition']." where id = ".$data['sellerid']); | ||
| 317 | + } | ||
| 318 | + | ||
| 319 | + if(isset($data['is_tele'])){ | ||
| 320 | + $up=Db::query("UPDATE `xt-member-two-LINE`.xt_seller set is_tele = ".$data['is_tele']." where id = ".$data['sellerid']); | ||
| 321 | + } | ||
| 322 | + | ||
| 323 | + | ||
| 324 | + $result['code'] = 1; | ||
| 325 | + $result['msg'] = "配置成功!"; | ||
| 326 | + return $result; | ||
| 327 | + } | ||
| 328 | + | ||
| 329 | + //获取商家已有菜系 | ||
| 330 | + $cuisine_list= file_get_contents(ON_LINE.'App.Seller.getSellerCuisine&sellerid='.$data['id']); | ||
| 331 | + $cuisine_list = json_decode($cuisine_list,TRUE); | ||
| 332 | + //获取所有菜系 | ||
| 333 | + $list= file_get_contents(ON_LINE.'App.Reserve.GetCustomerConfig'); | ||
| 334 | + $array = json_decode($list,TRUE); | ||
| 335 | + //组装数据 | ||
| 336 | + foreach ($cuisine_list['data'] as $key => $value) { | ||
| 337 | + foreach ($array['data']['cate'] as $k => $v) { | ||
| 338 | + if($value['cid']==$v['id']){ | ||
| 339 | + $array['data']['cate'][$k]['checked'] = 1; | ||
| 340 | + } | ||
| 341 | + } | ||
| 342 | + } | ||
| 343 | + $this->assign('list',$array['data']['cate']);//获取所有菜系 | ||
| 344 | + | ||
| 345 | + //获取商家已有来源 | ||
| 346 | + $type_list= file_get_contents(ON_LINE.'App.Seller.GetSellerType&sellerid='.$data['id']); | ||
| 347 | + $type_list = json_decode($type_list,TRUE); | ||
| 348 | + //获取来源 | ||
| 349 | + $channel = array(array('id'=>1,'name'=>'合作'),array('id'=>2,'name'=>'推广'),array('id'=>3,'name'=>'测试')); | ||
| 350 | + //组装数据 | ||
| 351 | + foreach ($type_list['data'] as $key => $value) { | ||
| 352 | + foreach ($channel as $k => $v) { | ||
| 353 | + if($value['type_id']==$v['id']){ | ||
| 354 | + $channel[$k]['checked'] = 1; | ||
| 355 | + } | ||
| 356 | + } | ||
| 357 | + } | ||
| 358 | + $this->assign('channel',$channel);//获取所有来源 | ||
| 359 | + | ||
| 360 | + //获取商家已有地图显示方式 | ||
| 361 | + $mode_list= file_get_contents(ON_LINE.'App.Seller.getSellerMode&sellerid='.$data['id']); | ||
| 362 | + $mode_list = json_decode($mode_list,TRUE); | ||
| 363 | + | ||
| 364 | + //获取所有地图显示方式 | ||
| 365 | + $mode= array(array('id'=>1,'name'=>'地图上大图标'),array('id'=>2,'name'=>'地图上文字')); | ||
| 366 | + //组装数据 | ||
| 367 | + foreach ($mode_list['data'] as $key => $value) { | ||
| 368 | + foreach ($mode as $k => $v) { | ||
| 369 | + if($value['sm_id']==$v['id']){ | ||
| 370 | + $mode[$k]['checked'] = 1; | ||
| 371 | + } | ||
| 372 | + } | ||
| 373 | + } | ||
| 374 | + $this->assign('mode',$mode);//获取所有菜系 | ||
| 375 | + | ||
| 376 | + //获取商家已选短信模板 | ||
| 377 | + $template = file_get_contents(ON_LINE.'App.Reserve.SellerInfo&seller_id='.$data['id']); | ||
| 378 | + $template = json_decode($template,TRUE); | ||
| 379 | + //获取短信模板列表 | ||
| 380 | + $template_list = file_get_contents(ON_LINE.'App.SendSMS.GetSmsTemplate'); | ||
| 381 | + $template_list = json_decode($template_list,TRUE); | ||
| 382 | + | ||
| 383 | + //组装数据 | ||
| 384 | + foreach ($template_list['data'] as $key => $value) { | ||
| 385 | + if($value['template_code']==$template['data']['setting']['template_code']){ | ||
| 386 | + $template_list['data'][$key]['checked'] = 1; | ||
| 387 | + } | ||
| 388 | + switch ($value['template_code']) { | ||
| 389 | + case 'SMS_163050401': | ||
| 390 | + $vowels = array( | ||
| 391 | + '周到安排演示店' => '${seller_name}', | ||
| 392 | + '11月25日晚上18:00' => '${date}', | ||
| 393 | + '金台夕照、卢沟晓月' =>'${region_room_name}', | ||
| 394 | + '西电路447号南湖金地西门南100米' =>'${seller_addr}', | ||
| 395 | + '18792581193' =>'${seller_phone}', | ||
| 396 | + '毛毛' =>'${cusman}', | ||
| 397 | + ); | ||
| 398 | + break; | ||
| 399 | + case 'SMS_162733710': | ||
| 400 | + $vowels = array( | ||
| 401 | + '4月6日中午' => '${reserve_date}', | ||
| 402 | + '周到1店西电路447号金台夕照' => '${seller_name_addr_room}', | ||
| 403 | + '毛毛' =>'${cusman}', | ||
| 404 | + ); | ||
| 405 | + break; | ||
| 406 | + case 'SMS_154587043': | ||
| 407 | + $vowels = array( | ||
| 408 | + '侯先生' => '${guest}', | ||
| 409 | + '周到安排演示店' => '${seller_name}', | ||
| 410 | + '11月25日晚上18:00' =>'${date}', | ||
| 411 | + '包间(金台夕照)' =>'${region_room_name}', | ||
| 412 | + '西电路447号南湖金地西门南100米' =>'${seller_addr}', | ||
| 413 | + '18792581193' =>'${seller_phone}\n', | ||
| 414 | + '毛毛' =>'${cusman}', | ||
| 415 | + ); | ||
| 416 | + break; | ||
| 417 | + case 'SMS_164277855': | ||
| 418 | + $vowels = array( | ||
| 419 | + '周到1店西电路447号' => '${seller_name}', | ||
| 420 | + '11月7日晚上18:30' => '${date}', | ||
| 421 | + '包间(金台夕照)' =>'${region_room_name}', | ||
| 422 | + '1879258119' =>'${seller_phone}', | ||
| 423 | + ); | ||
| 424 | + break; | ||
| 425 | + case 'SMS_164268239': | ||
| 426 | + $vowels = array( | ||
| 427 | + '周到安排演示店' => '${seller_name}', | ||
| 428 | + '11月7日晚上18:30' => '${date}', | ||
| 429 | + '包间(金台夕照)' =>'${region_room_name}', | ||
| 430 | + '西电路447号南湖金地西门南100米' =>'${seller_addr}', | ||
| 431 | + '1879258119' =>'${seller_phone}', | ||
| 432 | + ); | ||
| 433 | + break; | ||
| 434 | + default: | ||
| 435 | + # code... | ||
| 436 | + break; | ||
| 437 | + } | ||
| 438 | + $template_list['data'][$key]['content'] = str_replace($vowels, array_keys($vowels),$value['content']); | ||
| 439 | + } | ||
| 440 | + $this->assign('template_list',$template_list['data']);//获取短信模板列表 | ||
| 441 | + | ||
| 442 | + //获取商家拥有哪些标签 | ||
| 443 | + $label_list= file_get_contents(ON_LINE.'App.Seller.GetSellerLabel&sid='.$data['id']); | ||
| 444 | + $label_list = json_decode($label_list,TRUE); | ||
| 445 | + $this->assign('label_list',$label_list['data']); | ||
| 446 | + | ||
| 447 | + //商家标签 | ||
| 448 | + //原生: | ||
| 449 | + //$label_c=Db::query("SELECT * from xt-member-two-LINE.xt_dc_dz_seller_label_c"); | ||
| 450 | + $label_c=Db::table("xt-member-two-LINE.xt_dc_dz_seller_label_c")->select(); | ||
| 451 | + $label_c_rel=Db::table("xt-member-two-LINE.xt_dc_dz_seller_label_c_rel")->where(array('sid'=>$data['id']))->select(); | ||
| 452 | + //组装数据 | ||
| 453 | + foreach ($label_c as $key => $value) { | ||
| 454 | + foreach ($label_c_rel as $k => $v) { | ||
| 455 | + if($value['id']==$v['lcid']){ | ||
| 456 | + $label_c[$key]['checked'] = 1; | ||
| 457 | + } | ||
| 458 | + } | ||
| 459 | + } | ||
| 460 | + $this->assign('label_c',$label_c); | ||
| 461 | + | ||
| 462 | + //商家品牌 | ||
| 463 | + $brand=Db::table("xt-member-two-LINE.xt_dc_dz_seller_brand")->select(); | ||
| 464 | + $brand_rel=Db::table("xt-member-two-LINE.xt_dc_dz_seller_brand_rel")->where(array('sid'=>$data['id']))->select(); | ||
| 465 | + //组装数据 | ||
| 466 | + foreach ($brand as $key => $value) { | ||
| 467 | + foreach ($brand_rel as $k => $v) { | ||
| 468 | + if($value['id']==$v['bid']){ | ||
| 469 | + $brand[$key]['checked'] = 1; | ||
| 470 | + } | ||
| 471 | + } | ||
| 472 | + } | ||
| 473 | + $this->assign('brand',$brand); | ||
| 474 | + | ||
| 475 | + | ||
| 476 | + $is_online_reserve=Db::table("xt-member-two-LINE.xt_seller")->where(array('id'=>$data['id']))->select(); | ||
| 477 | + | ||
| 478 | + //获取商家在线预定版本情况 | ||
| 479 | + $this->assign('is_online_reserve',$is_online_reserve[0]['is_online_reserve']); | ||
| 480 | + //是否安装电话机 | ||
| 481 | + $this->assign('is_tele',$is_online_reserve[0]['is_tele']); | ||
| 482 | + | ||
| 483 | + //商户信息 | ||
| 484 | + $this->assign ('data',$data); | ||
| 485 | + $this->assign ( 'title','商户信息配置' ); | ||
| 486 | + return $this->fetch(); | ||
| 487 | + } | ||
| 488 | + | ||
| 489 | + /** | ||
| 490 | + * 商家基础信息配置 | ||
| 491 | + */ | ||
| 492 | + public function setsellerconfig(){ | ||
| 493 | + if(Request::isAjax()){ | ||
| 494 | + $data = Request::except('file'); | ||
| 495 | + $data['status'] = $data['status'] ? 0 : 1; | ||
| 496 | + $list= file_get_contents(ON_LINE.'App.Seller.SetSellerConfigByPC&sid='.$data['sellerid'].'&field='.$data['field'].'&value='.$data['value']); | ||
| 497 | + $array = json_decode($list,TRUE); | ||
| 498 | + if($array['ret']==200){ | ||
| 499 | + $result['code'] = 1; | ||
| 500 | + $result['msg'] = 'SUCCESS!'; | ||
| 501 | + }else{ | ||
| 502 | + $result['code'] = 0; | ||
| 503 | + $result['msg'] = '请求错误!'; | ||
| 504 | + } | ||
| 505 | + return $result; | ||
| 506 | + } | ||
| 507 | + return view(); | ||
| 508 | + } | ||
| 509 | + | ||
| 510 | + /** | ||
| 511 | + * 商家详情 | ||
| 512 | + */ | ||
| 513 | + public function sellerdetail(){ | ||
| 514 | + //print_r(Request::except('file'));die; | ||
| 515 | + $data = Request::except('file'); | ||
| 516 | + //获取运营人员列表 | ||
| 517 | + $list= file_get_contents(ON_LINE.'App.Seller.GetSellerById&sellerid='.$data['sid']); | ||
| 518 | + $array = json_decode($list,TRUE); | ||
| 519 | + if($array['data']['data']){ | ||
| 520 | + $array['data']['data']['daily'] = json_decode($array['data']['data']['daily'],TRUE); | ||
| 521 | + $array['data']['data']['daily_time'] = json_decode($array['data']['data']['daily_time'],TRUE); | ||
| 522 | + $array['data']['data']['cdate'] = date("Y年m月d日 H时i分s秒",$array['data']['data']['cdate']); | ||
| 523 | + } | ||
| 524 | + //获取短信流水 | ||
| 525 | + $sms= file_get_contents(ON_LINE.'App.SendSMS.GetSellerSmsFlowing&sid='.$data['sid']); | ||
| 526 | + $sms_data = json_decode($sms,TRUE); | ||
| 527 | + $sms_data_list = $sms_data['data'] ? $sms_data['data'] : array(); | ||
| 528 | + $this->assign ( 'smslist',$sms_data_list); | ||
| 529 | + $this->assign ( 'data',$array['data']['data']); | ||
| 530 | + $this->assign ( 'title','商家详情页面'); | ||
| 531 | + return $this->fetch(); | ||
| 532 | + } | ||
| 533 | + | ||
| 534 | + //商家列表 用于配置商家活动 | ||
| 535 | + public function seller_activity_list(){ | ||
| 536 | + if(Request::isAjax()){ | ||
| 537 | + $data = Request::except('file'); | ||
| 538 | + $key= input('post.key') ? input('post.key') : ""; | ||
| 539 | + $channel = @$key['channel'] ? @$key['channel'] : 1; | ||
| 540 | + $limit = '&x='.$data["page"].'&y='.$data["limit"].'&keywords='.@$key['id'].'&channel='.$channel; | ||
| 541 | + | ||
| 542 | + //获取运营人员列表 | ||
| 543 | + $list= file_get_contents(ON_LINE.'App.Seller.GetSellerListByActivity'.$limit); | ||
| 544 | + $array = json_decode($list,TRUE); | ||
| 545 | + foreach($array['data'][0]['data'] as $key=>$value){ | ||
| 546 | + if(!empty($value['activity'])){ | ||
| 547 | + foreach ($value['activity'] as $k => $v) { | ||
| 548 | + $str[$key][] = ($k+1).'、'.$v['title']; | ||
| 549 | + } | ||
| 550 | + $array['data'][0]['data'][$key]['activity'] = implode('<br/>', $str[$key]); | ||
| 551 | + //$array['data'][0]['data'][$key]['activity'] = implode('<br/>', array_column($value['activity'], 'title')); | ||
| 552 | + } | ||
| 553 | + } | ||
| 554 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'][0]['data'],'count'=>$array['data'][0]['total'],'rel'=>1]; | ||
| 555 | + } | ||
| 556 | + $this->assign ( 'title','商家活动配置'); | ||
| 557 | + return $this->fetch(); | ||
| 558 | + } | ||
| 559 | + | ||
| 560 | + /** | ||
| 561 | + * 商家活动列表页 | ||
| 562 | + */ | ||
| 563 | + public function seller_activity(){ | ||
| 564 | + $data = Request::except('file'); | ||
| 565 | + //获取商家现有活动 | ||
| 566 | + $seller_activity= file_get_contents(ON_LINE.'App.Seller.GetSellerActivity&sid='.$data['id']); | ||
| 567 | + $seller_activity = json_decode($seller_activity,TRUE); | ||
| 568 | + //活动列表 | ||
| 569 | + $this->assign('sid',$data['id']); | ||
| 570 | + $this->assign ( 'seller_activity',$seller_activity['data']); | ||
| 571 | + $this->assign ( 'title','商家活动配置页面'); | ||
| 572 | + return $this->fetch(); | ||
| 573 | + } | ||
| 574 | + | ||
| 575 | + //添加活动 | ||
| 576 | + public function add_activity(){ | ||
| 577 | + $data = Request::except('file'); | ||
| 578 | + if(Request::isAjax()){ | ||
| 579 | + switch ($data['type']) { | ||
| 580 | + case '1': | ||
| 581 | + if($data['max_num']==0){ | ||
| 582 | + $data['title'] = '立减'.$data['min_num'];break; | ||
| 583 | + }else{ | ||
| 584 | + $data['title'] = '满'.$data['max_num'].'立减'.$data['min_num'];break; | ||
| 585 | + } | ||
| 586 | + case '2': | ||
| 587 | + $data['title'] = '满赠'; | ||
| 588 | + break; | ||
| 589 | + case '3': | ||
| 590 | + if($data['max_num']==0){ | ||
| 591 | + $data['title'] = $data['min_num'].'折';break; | ||
| 592 | + }else{ | ||
| 593 | + $data['title'] = '满'.$data['max_num'].'立享'.$data['min_num'].'折';break; | ||
| 594 | + } | ||
| 595 | + case '4': | ||
| 596 | + $data['title'] = $data['max_num'].'元代金券'; | ||
| 597 | + break; | ||
| 598 | + case '5': | ||
| 599 | + $data['title'] = '会员价'; | ||
| 600 | + break; | ||
| 601 | + default: | ||
| 602 | + # code... | ||
| 603 | + break; | ||
| 604 | + } | ||
| 605 | + //字段空值过滤 | ||
| 606 | + //添加活动 | ||
| 607 | + $res= file_get_contents(ON_LINE.'App.Seller.SetActivity&str='.serialize($data)); | ||
| 608 | + $res = json_decode($res,TRUE); | ||
| 609 | + if($data['aid']){ | ||
| 610 | + if($res['data']){ | ||
| 611 | + $result = ['code'=>1,'msg'=>'修改成功!','rel'=>1]; | ||
| 612 | + }else{ | ||
| 613 | + $result = ['code'=>0,'msg'=>'修改失败!','rel'=>1]; | ||
| 614 | + } | ||
| 615 | + }else{ | ||
| 616 | + if($res['data']){ | ||
| 617 | + $result = ['code'=>1,'msg'=>'添加成功!','rel'=>1]; | ||
| 618 | + }else{ | ||
| 619 | + $result = ['code'=>0,'msg'=>'添加失败!','rel'=>1]; | ||
| 620 | + } | ||
| 621 | + } | ||
| 622 | + return $result; | ||
| 623 | + } | ||
| 624 | + if($data['id']){ | ||
| 625 | + //修改---需要获取对应的数据 | ||
| 626 | + $activity= file_get_contents(ON_LINE.'App.Seller.GetSellerActivityById&id='.$data['id']); | ||
| 627 | + $activity = json_decode($activity,TRUE); | ||
| 628 | + $this->assign ('data',$activity['data']); | ||
| 629 | + $this->assign ( 'title','修改活动'); | ||
| 630 | + } | ||
| 631 | + $this->assign ( 'hid',$data['sid']); | ||
| 632 | + $this->assign ( 'title','添加活动'); | ||
| 633 | + return $this->fetch(); | ||
| 634 | + } | ||
| 635 | + | ||
| 636 | + //删除活动 | ||
| 637 | + public function del_activity(){ | ||
| 638 | + $data = Request::except('file'); | ||
| 639 | + $res= file_get_contents(ON_LINE.'App.Seller.DelSellerActivity&sid='.$data['sid'].'&aid='.$data['aid']); | ||
| 640 | + $res = json_decode($res,TRUE); | ||
| 641 | + $this->redirect('Seller/seller_activity', ['id' => $data['sid']]); | ||
| 642 | + //return $this->fetch('seller_activity',['id' => $data['sid']]); | ||
| 643 | + } | ||
| 644 | + | ||
| 645 | + //商家设备列表 | ||
| 646 | + public function device_list(){ | ||
| 647 | + //获取类型 | ||
| 648 | + $facturer = Db::query("SELECT * FROM `xt-member-two-LINE`.xt_dc_dz_facturer"); | ||
| 649 | + if(Request::isAjax()){ | ||
| 650 | + $data = Request::except('file'); | ||
| 651 | + $channel = @$data['channel'] ? @$data['channel'] : 1; | ||
| 652 | + $manufacturer = @$data['manufacturer'] ? @$data['manufacturer'] : 1; | ||
| 653 | + | ||
| 654 | + $limit = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$data['key'].'&channel='.$channel.'&type='.$manufacturer; | ||
| 655 | + | ||
| 656 | + //获取运营人员列表 | ||
| 657 | + $list= file_get_contents(ON_LINE.'App.Device.GetDeviceOnlineStatus'.$limit); //GetSellerDevice | ||
| 658 | + $array = json_decode($list,TRUE); | ||
| 659 | + foreach ($array['data']['list'] as $key => $value) { | ||
| 660 | + switch ($value['type']) { | ||
| 661 | + case '0': | ||
| 662 | + $array['data']['list'][$key]['type'] = $facturer[0]['facturer']; | ||
| 663 | + break; | ||
| 664 | + case '1': | ||
| 665 | + $array['data']['list'][$key]['type'] = $facturer[0]['facturer']; | ||
| 666 | + break; | ||
| 667 | + case '2': | ||
| 668 | + $array['data']['list'][$key]['type'] = $facturer[1]['facturer']; | ||
| 669 | + break; | ||
| 670 | + case '3': | ||
| 671 | + $array['data']['list'][$key]['type'] = $facturer[2]['facturer']; | ||
| 672 | + break; | ||
| 673 | + case '4': | ||
| 674 | + $array['data']['list'][$key]['type'] = $facturer[3]['facturer']; | ||
| 675 | + break; | ||
| 676 | + | ||
| 677 | + default: | ||
| 678 | + $array['data']['list'][$key]['type'] = 'error: '.$value['type']; | ||
| 679 | + break; | ||
| 680 | + } | ||
| 681 | + | ||
| 682 | + } | ||
| 683 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data']['list'],'count'=>$array['data']['total'],'rel'=>1]; | ||
| 684 | + } | ||
| 685 | + $this->assign ( 'facturer',$facturer); | ||
| 686 | + $this->assign ( 'title','商家设备列表'); | ||
| 687 | + return $this->fetch(); | ||
| 688 | + } | ||
| 689 | + | ||
| 690 | + //商家设备列表 | ||
| 691 | + public function add_gray_user(){ | ||
| 692 | + if(Request::isAjax()){ | ||
| 693 | + $data = Request::except('file'); | ||
| 694 | + $list= file_get_contents(ON_LINE.'App.Device.SetGrayUser&ids='.serialize($data['id'])); | ||
| 695 | + $array = json_decode($list,TRUE); | ||
| 696 | + if($array['ret']==200){ | ||
| 697 | + $result['code'] = 1; | ||
| 698 | + $result['msg'] = 'SUCCESS!'; | ||
| 699 | + }else{ | ||
| 700 | + $result['code'] = 0; | ||
| 701 | + $result['msg'] = '服务器错误,请勿重复将设备号添加到灰度用户!'; | ||
| 702 | + } | ||
| 703 | + return $result; | ||
| 704 | + } | ||
| 705 | + return view(); | ||
| 706 | + } | ||
| 707 | + | ||
| 708 | + //灰度用户列表 | ||
| 709 | + public function gray_user_list(){ | ||
| 710 | + //获取类型 | ||
| 711 | + $facturer = Db::query("SELECT * FROM `xt-member-two-LINE`.xt_dc_dz_facturer"); | ||
| 712 | + $this->assign ( 'facturer',$facturer); | ||
| 713 | + if(Request::isAjax()){ | ||
| 714 | + $data = Request::except('file'); | ||
| 715 | + $channel = @$data['channel'] ? @$data['channel'] : 1; | ||
| 716 | + $manufacturer = @$data['manufacturer'] ? @$data['manufacturer'] : 1; | ||
| 717 | + | ||
| 718 | + $limit = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$data['key'].'&channel='.$channel.'&type='.$manufacturer; | ||
| 719 | + | ||
| 720 | + $list= file_get_contents(ON_LINE.'App.Device.GetGrayUserList'.$limit); | ||
| 721 | + $array = json_decode($list,TRUE); | ||
| 722 | + foreach ($array['data']['list'] as $key => $value) { | ||
| 723 | + switch ($value['type']) { | ||
| 724 | + case '1': | ||
| 725 | + $array['data']['list'][$key]['type'] = $facturer[0]['facturer']; | ||
| 726 | + break; | ||
| 727 | + case '2': | ||
| 728 | + $array['data']['list'][$key]['type'] = $facturer[1]['facturer']; | ||
| 729 | + break; | ||
| 730 | + case '3': | ||
| 731 | + $array['data']['list'][$key]['type'] = $facturer[2]['facturer']; | ||
| 732 | + break; | ||
| 733 | + case '4': | ||
| 734 | + $array['data']['list'][$key]['type'] = $facturer[3]['facturer']; | ||
| 735 | + break; | ||
| 736 | + | ||
| 737 | + default: | ||
| 738 | + $array['data']['list'][$key]['type'] = 'error'; | ||
| 739 | + break; | ||
| 740 | + } | ||
| 741 | + } | ||
| 742 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data']['list'],'count'=>$array['data']['total'],'rel'=>1]; | ||
| 743 | + } | ||
| 744 | + //获取类型 | ||
| 745 | + $facturer = Db::query("SELECT * FROM `xt-member-two-LINE`.xt_dc_dz_facturer"); | ||
| 746 | + $this->assign ( 'facturer',$facturer); | ||
| 747 | + $this->assign ( 'title','灰度用户列表'); | ||
| 748 | + return $this->fetch(); | ||
| 749 | + } | ||
| 750 | + | ||
| 751 | + //删除灰度用户 | ||
| 752 | + public function del_gray_user(){ | ||
| 753 | + if(Request::isAjax()){ | ||
| 754 | + $data = Request::except('file'); | ||
| 755 | + $list= file_get_contents(ON_LINE.'App.Device.DelGrayUser&jsstr='.serialize($data['id'])); | ||
| 756 | + $array = json_decode($list,TRUE); | ||
| 757 | + | ||
| 758 | + if($array['ret']==200){ | ||
| 759 | + $result['code'] = 1; | ||
| 760 | + $result['msg'] = 'SUCCESS!'; | ||
| 761 | + }else{ | ||
| 762 | + $result['code'] = 0; | ||
| 763 | + $result['msg'] = '请刷新页面重新尝试!'; | ||
| 764 | + } | ||
| 765 | + return $result; | ||
| 766 | + } | ||
| 767 | + return view(); | ||
| 768 | + } | ||
| 769 | + | ||
| 770 | + //获取在线设备情况 | ||
| 771 | + public function get_device_online_status(){ | ||
| 772 | + //获取类型 | ||
| 773 | + $facturer = Db::query("SELECT * FROM `xt-member-two-LINE`.xt_dc_dz_facturer"); | ||
| 774 | + if(Request::isAjax()){ | ||
| 775 | + $data = Request::except('file'); | ||
| 776 | + $channel = @$data['channel'] ? @$data['channel'] : 1; | ||
| 777 | + $manufacturer = @$data['manufacturer'] ? @$data['manufacturer'] : 1; | ||
| 778 | + | ||
| 779 | + $limit = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$data['key'].'&channel='.$channel.'&type='.$manufacturer; | ||
| 780 | + | ||
| 781 | + $list= file_get_contents(ON_LINE.'App.Device.GetDeviceOnlineStatus'.$limit); | ||
| 782 | + $array = json_decode($list,TRUE); | ||
| 783 | + foreach ($array['data']['list'] as $key => $value) { | ||
| 784 | + switch ($value['type']) { | ||
| 785 | + case '0': | ||
| 786 | + $array['data']['list'][$key]['type'] = $facturer[0]['facturer']; | ||
| 787 | + break; | ||
| 788 | + case '1': | ||
| 789 | + $array['data']['list'][$key]['type'] = $facturer[0]['facturer']; | ||
| 790 | + break; | ||
| 791 | + case '2': | ||
| 792 | + $array['data']['list'][$key]['type'] = $facturer[1]['facturer']; | ||
| 793 | + break; | ||
| 794 | + case '3': | ||
| 795 | + $array['data']['list'][$key]['type'] = $facturer[2]['facturer']; | ||
| 796 | + break; | ||
| 797 | + case '4': | ||
| 798 | + $array['data']['list'][$key]['type'] = $facturer[3]['facturer']; | ||
| 799 | + break; | ||
| 800 | + | ||
| 801 | + default: | ||
| 802 | + $array['data']['list'][$key]['type'] = $value['type']; | ||
| 803 | + break; | ||
| 804 | + } | ||
| 805 | + } | ||
| 806 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data']['list'],'count'=>$array['data']['total'],'rel'=>1]; | ||
| 807 | + } | ||
| 808 | + $this->assign ( 'facturer',$facturer); | ||
| 809 | + $this->assign ( 'title','商家话机在线设备列表'); | ||
| 810 | + return $this->fetch(); | ||
| 811 | + } | ||
| 812 | + | ||
| 813 | + /** | ||
| 814 | + * 从商家维度统计:订单、短信等情况 | ||
| 815 | + */ | ||
| 816 | + public function GetReserveList(){ | ||
| 817 | + //获取类型 | ||
| 818 | + $facturer = Db::query("SELECT * FROM `xt-member-two-LINE`.xt_dc_dz_facturer"); | ||
| 819 | + if(Request::isAjax()){ | ||
| 820 | + $data = Request::except('file'); | ||
| 821 | + $key= input('post.key') ? input('post.key') : ""; | ||
| 822 | + $nokey= input('post.nokey') ? input('post.nokey') : ""; | ||
| 823 | + | ||
| 824 | + $sellername = $data['key'] ? $data['key'] : ''; //商家名称 | ||
| 825 | + $id = $data['nokey'] ? $data['nokey'] : ''; //订单ID | ||
| 826 | + | ||
| 827 | + $time = $data['time'] ? explode(' - ', $data['time']) : ''; | ||
| 828 | + | ||
| 829 | + $stime = $time ? strtotime(date($time[0],time())) : strtotime(date('Y-m-d 00:00:00',time())); | ||
| 830 | + $etime = $time ? strtotime(date($time[1],time())) : strtotime(date('Y-m-d 23:59:59',time())); | ||
| 831 | + | ||
| 832 | + $dtime = $data['dtime'] ? explode(' - ', $data['dtime']) : ''; | ||
| 833 | + | ||
| 834 | + $sdtime = $dtime ? strtotime(date($dtime[0],time())) : ''; | ||
| 835 | + $edtime = $dtime ? strtotime(date($dtime[1],time())) : ''; | ||
| 836 | + | ||
| 837 | + $data['status'] = $data['status'] ? $data['status'] : 2; | ||
| 838 | + $data['channel'] = $data['channel'] ? $data['channel'] : 1; | ||
| 839 | + | ||
| 840 | + $parame = '&offset='.$data["page"].'&limit='.$data["limit"].'&sellername='.@$sellername.'&stime='.@$stime.'&etime='.@$etime.'&channel='.@$data['channel'].'&id='.$id.'&status='.@$data['status'].'&sdtime='.$sdtime.'&edtime='.$edtime; | ||
| 841 | + | ||
| 842 | + //获取运营人员列表 | ||
| 843 | + $list= file_get_contents(ON_LINE.'App.Customer.GetReserveList'.$parame); | ||
| 844 | + $array = json_decode($list,TRUE); | ||
| 845 | + | ||
| 846 | + $new_array = array(); | ||
| 847 | + foreach ($array['data']['list'] as $key => $value) { | ||
| 848 | + //有无设备 | ||
| 849 | + if($value['is_tele']==1){ | ||
| 850 | + switch ($value['type']) { | ||
| 851 | + case '1': | ||
| 852 | + $array['data']['list'][$key]['dv'] = $facturer[0]['facturer']; | ||
| 853 | + break; | ||
| 854 | + case '2': | ||
| 855 | + $array['data']['list'][$key]['dv'] = $facturer[1]['facturer']; | ||
| 856 | + break; | ||
| 857 | + case '3': | ||
| 858 | + $array['data']['list'][$key]['dv'] = $facturer[2]['facturer']; | ||
| 859 | + break; | ||
| 860 | + case '4': | ||
| 861 | + $array['data']['list'][$key]['dv'] = $facturer[3]['facturer']; | ||
| 862 | + break; | ||
| 863 | + default: | ||
| 864 | + $array['data']['list'][$key]['dv'] = '无'; | ||
| 865 | + break; | ||
| 866 | + } | ||
| 867 | + }else{ | ||
| 868 | + $array['data']['list'][$key]['dv'] = '无'; | ||
| 869 | + } | ||
| 870 | + //订单接受时间段 | ||
| 871 | + switch ($value['ddate_solt']) { | ||
| 872 | + //'未设置/早市/午市/晚市/夜宵 0/1/2/3/4', | ||
| 873 | + case 0: | ||
| 874 | + $value['ddate_solt'] = '未设置'; | ||
| 875 | + break; | ||
| 876 | + case 1: | ||
| 877 | + $value['ddate_solt'] = '早市'; | ||
| 878 | + break; | ||
| 879 | + case 2: | ||
| 880 | + $value['ddate_solt'] = '午市'; | ||
| 881 | + break; | ||
| 882 | + case 3: | ||
| 883 | + $value['ddate_solt'] = '晚市'; | ||
| 884 | + break; | ||
| 885 | + case 4: | ||
| 886 | + $value['ddate_solt'] = '夜宵'; | ||
| 887 | + break; | ||
| 888 | + default: | ||
| 889 | + # code... | ||
| 890 | + break; | ||
| 891 | + } | ||
| 892 | + $array['data']['list'][$key]['ddate'] = date('Y-m-d H:i:s',$value['ddate']).'['.$value['ddate_solt'].']'; | ||
| 893 | + $array['data']['list'][$key]['cdate'] = date('Y-m-d H:i:s',$value['cdate']); | ||
| 894 | + $array['data']['list'][$key]['handle_time'] = $value['handle_time'] ? date('Y-m-d H:i:s',$value['handle_time']) : ''; | ||
| 895 | + $array['data']['list'][$key]['rec_date'] = $value['rec_date'] ? date('Y-m-d H:i:s',$value['rec_date']) : ''; | ||
| 896 | + switch ($value['status']) { | ||
| 897 | + case 0: | ||
| 898 | + $array['data']['list'][$key]['sta'] = '待确认'; | ||
| 899 | + break; | ||
| 900 | + case 1: | ||
| 901 | + $array['data']['list'][$key]['sta'] = '已定座'; | ||
| 902 | + break; | ||
| 903 | + case 2: | ||
| 904 | + $array['data']['list'][$key]['sta'] = '到店'; | ||
| 905 | + break; | ||
| 906 | + case 3: | ||
| 907 | + $array['data']['list'][$key]['sta'] = '离店'; | ||
| 908 | + break; | ||
| 909 | + case 4: | ||
| 910 | + $array['data']['list'][$key]['sta'] = '已取消'; | ||
| 911 | + break; | ||
| 912 | + case 5: | ||
| 913 | + $array['data']['list'][$key]['sta'] = '已分配'; | ||
| 914 | + break; | ||
| 915 | + case 6: | ||
| 916 | + $array['data']['list'][$key]['sta'] = '拒单'; | ||
| 917 | + break; | ||
| 918 | + default: | ||
| 919 | + # code... | ||
| 920 | + break; | ||
| 921 | + } | ||
| 922 | + switch ($value['sex']) { | ||
| 923 | + case 1: | ||
| 924 | + $array['data']['list'][$key]['rname'] = $value['rname'].'先生'.'('.$value['phone'].')'; | ||
| 925 | + break; | ||
| 926 | + case 2: | ||
| 927 | + $array['data']['list'][$key]['rname'] = $value['rname'].'女士'.'('.$value['phone'].')'; | ||
| 928 | + break; | ||
| 929 | + case 3: | ||
| 930 | + $array['data']['list'][$key]['rname'] = $value['rname'].'公司'.'('.$value['phone'].')'; | ||
| 931 | + break; | ||
| 932 | + default: | ||
| 933 | + # code... | ||
| 934 | + break; | ||
| 935 | + } | ||
| 936 | + | ||
| 937 | + if($value['room_demand']){ | ||
| 938 | + $array['data']['list'][$key]['room_demand'] = implode(',',array_column(json_decode($value['room_demand'],true), 'name')); | ||
| 939 | + } | ||
| 940 | + | ||
| 941 | + $array['data']['list'][$key]['sta'] = $value['is_tele']==1 ? $array['data']['list'][$key]['sta'] : $array['data']['list'][$key]['sta'].'无话机'; | ||
| 942 | + | ||
| 943 | + //根据操作人识别操作终端 | ||
| 944 | + if(isset($template['operator_openid'])){ | ||
| 945 | + if(strstr($template['operator_openid'],'_',-4)=='tele'){ //话机操作 | ||
| 946 | + $array['data']['list'][$key]['operator_openid'] = '电话机'; | ||
| 947 | + } | ||
| 948 | + | ||
| 949 | + if(strstr($template['operator_openid'],'_',-4)=='wind'){ //PC操作 | ||
| 950 | + $array['data']['list'][$key]['operator_openid'] = 'PC'; | ||
| 951 | + } | ||
| 952 | + | ||
| 953 | + if(strstr($template['operator_openid'],'_',-4)=='chat'){ //PC操作 | ||
| 954 | + $array['data']['list'][$key]['operator_openid'] = '小程序'; | ||
| 955 | + } | ||
| 956 | + } | ||
| 957 | + } | ||
| 958 | + //print_r($array['data']['list']);die; | ||
| 959 | + return $result = [ | ||
| 960 | + 'code'=>0,'msg'=>'获取成功!', | ||
| 961 | + 'data'=>$array['data']['list'], | ||
| 962 | + 'count'=>$array['data']['total'], | ||
| 963 | + 'rel'=>1 | ||
| 964 | + ]; | ||
| 965 | + } | ||
| 966 | + $this->assign ( 'title','C端预定订单管理'); | ||
| 967 | + return $this->fetch(); | ||
| 968 | + } | ||
| 969 | + | ||
| 970 | + /** | ||
| 971 | + * 状态设置 | ||
| 972 | + */ | ||
| 973 | + public function setReserveStatus(){ | ||
| 974 | + | ||
| 975 | + if(Request::isAjax()){ | ||
| 976 | + $data = Request::except('file'); | ||
| 977 | + | ||
| 978 | + $data['cause'] = json_encode(array('uid'=>-1,'uname'=>session('username'),'desc'=>$data['cause'])); | ||
| 979 | + | ||
| 980 | + $list= file_get_contents(ON_LINE.'App.Reserve.SetReserveStatus&rid='.$data['id'].'&status='.$data['status'].'&cause='.$data['cause']); | ||
| 981 | + | ||
| 982 | + $array = json_decode($list,TRUE); | ||
| 983 | + if($array['ret']==200){ | ||
| 984 | + $result['code'] = 1; | ||
| 985 | + $result['msg'] = 'SUCCESS!'; | ||
| 986 | + }else{ | ||
| 987 | + $result['code'] = 0; | ||
| 988 | + $result['msg'] = '请求错误!'; | ||
| 989 | + } | ||
| 990 | + return $result; | ||
| 991 | + } | ||
| 992 | + return view(); | ||
| 993 | + } | ||
| 994 | +} |
application/admin/view/area/addagent.html
0 → 100644
| 1 | +{include file="common/head"/} | ||
| 2 | +<div class="admin-main fadeInUp animated" ng-app="hd" ng-controller="ctrl"> | ||
| 3 | + <fieldset class="layui-elem-field layui-field-title"> | ||
| 4 | + <legend>绑定代理商</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" name="agent_name" ng-model="field.title" lay-verify="required" class="layui-input"> | ||
| 11 | + </div> | ||
| 12 | + </div> | ||
| 13 | + <div class="layui-form-item"> | ||
| 14 | + <label class="layui-form-label">代理商手机号</label> | ||
| 15 | + <div class="layui-input-4"> | ||
| 16 | + <input type="text" name="agent_phone" ng-model="field.title" lay-verify="required" class="layui-input"> | ||
| 17 | + </div> | ||
| 18 | + </div> | ||
| 19 | + <div class="layui-form-item"> | ||
| 20 | + <div class="layui-input-block"> | ||
| 21 | + <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('submit')}</button> | ||
| 22 | + <a href="{:url('addagent')}" class="layui-btn layui-btn-primary">{:lang('back')}</a> | ||
| 23 | + </div> | ||
| 24 | + </div> | ||
| 25 | + </form> | ||
| 26 | +</div> | ||
| 27 | +{include file="common/foot"/} | ||
| 28 | +<script src="/static/common/js/angular.min.js"></script> | ||
| 29 | +<script> | ||
| 30 | + var m = angular.module('hd',[]); | ||
| 31 | + m.controller('ctrl',['$scope',function($scope) { | ||
| 32 | + $scope.field = '{$info|raw}'!='null'?{$info|raw}:{title:''}; | ||
| 33 | + layui.use(['form', 'layer'], function () { | ||
| 34 | + var form = layui.form, layer = layui.layer,$= layui.jquery; | ||
| 35 | + form.on('submit(submit)', function (data) { | ||
| 36 | + loading = layer.load(1,{shade:[0.1,'#fff']}); | ||
| 37 | + // 提交到方法 默认为本身 | ||
| 38 | + data.field.group_id = $scope.field.group_id; | ||
| 39 | + $.post("", data.field, function (res) { | ||
| 40 | + layer.close(loading); | ||
| 41 | + if (res.code > 0) { | ||
| 42 | + layer.msg(res.msg, {time: 1800, icon: 1}, function () { | ||
| 43 | + location.href = res.url; | ||
| 44 | + }); | ||
| 45 | + } else { | ||
| 46 | + layer.msg(res.msg, {time: 1800, icon: 2}); | ||
| 47 | + } | ||
| 48 | + }); | ||
| 49 | + }) | ||
| 50 | + }); | ||
| 51 | + }]); | ||
| 52 | +</script> |
application/admin/view/area/agent.html
0 → 100644
| 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 | + | ||
| 7 | + <div class="demoTable"> | ||
| 8 | + 区域名称:<div class="layui-inline"> | ||
| 9 | + <input class="layui-input" name="key" id="key" placeholder="{:lang('pleaseEnter')}区域名称" autocomplete="off"> | ||
| 10 | + </div> | ||
| 11 | + | ||
| 12 | + <button class="layui-btn" id="search" data-type="reload">搜索</button> | ||
| 13 | + <!-- 备注: 人均消费(130)、店铺评分(4.9,最高5分)、停车场(0/1 无/有)开启单元格编辑 --> | ||
| 14 | + </div> | ||
| 15 | + | ||
| 16 | + <table class="layui-table" id="list" lay-filter="list"></table> | ||
| 17 | +</div> | ||
| 18 | +{include file="common/foot"/} | ||
| 19 | + | ||
| 20 | +<script src="/static/common/js/jquery.2.1.1.min.js"></script> | ||
| 21 | +<script type="text/javascript" src="/static/city/data.js"></script> | ||
| 22 | +<script type="text/javascript" src="/static/city/province.js"></script> | ||
| 23 | +<script type="text/javascript"> | ||
| 24 | + var defaults = { | ||
| 25 | + s1: 'provid', | ||
| 26 | + s2: 'cityid', | ||
| 27 | + s3: 'areaid', | ||
| 28 | + v1: null, | ||
| 29 | + v2: null, | ||
| 30 | + v3: null | ||
| 31 | + }; | ||
| 32 | +</script> | ||
| 33 | + | ||
| 34 | +<script type="text/html" id="action"> | ||
| 35 | + <a class="layui-btn {{ 0==d.status?'':'layui-btn-danger'}} layui-btn-xs" lay-event="stop">{{ 0==d.status?'启用':'停用'}}</a> | ||
| 36 | + {{#if(d.is_exist==0){}} | ||
| 37 | + <a href="{:url('Area/addagent')}?areaid={{d.areaid}}" class="layui-btn layui-btn-xs">添加代理商</a> | ||
| 38 | + {{#}}} | ||
| 39 | + <!--<a href="{:url('Template/configMer')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">配置菜品</a>--> | ||
| 40 | + <!--<a href="{:url('Basicinfo/smsRecharge')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">短信充值</a>--> | ||
| 41 | +</script> | ||
| 42 | +<script> | ||
| 43 | + layui.use(['table','form'], function() { | ||
| 44 | + var table = layui.table,$ = layui.jquery; | ||
| 45 | + var tableIn = table.render({ | ||
| 46 | + elem: '#list', | ||
| 47 | + url: '{:url("agent")}', | ||
| 48 | + method: 'post', | ||
| 49 | + title: '代理商区域列表', | ||
| 50 | + toolbar: '#toolbarDemo', | ||
| 51 | + page:true, | ||
| 52 | + cols: [[ | ||
| 53 | + {field: 'areaid', width:60, fixed: true}, | ||
| 54 | + {field: 'areaname', edit: 'text', title: '区域名称'}, | ||
| 55 | + {field: 'agent_name', edit: 'text', title: '代理商名称'}, | ||
| 56 | + {align: 'center', width:200,title: '操作', toolbar: '#action'} | ||
| 57 | + ]] | ||
| 58 | + ,id: 'testReload' | ||
| 59 | + ,page: true | ||
| 60 | + }); | ||
| 61 | + | ||
| 62 | + | ||
| 63 | + | ||
| 64 | + //监听行双击事件 | ||
| 65 | + table.on('rowDouble(list)', function(obj){ | ||
| 66 | + //table.on('row(list)', function(obj){ 双击事件 | ||
| 67 | + //console.log(obj.tr) //得到当前行元素对象 | ||
| 68 | + console.log(obj.data) //得到当前行数据 | ||
| 69 | + layer.open({ | ||
| 70 | + type: 2, | ||
| 71 | + title: obj.data.sellername, | ||
| 72 | + shadeClose: true, | ||
| 73 | + shade: 0.8, | ||
| 74 | + area: ['90%', '90%'], | ||
| 75 | + content: '{:url("sellerdetail")}?sid='+obj.data.id //iframe的url | ||
| 76 | + /*success:function(dom){ | ||
| 77 | + let $iframeDom=$(dom[0]).find("iframe").eq(0).contents(); | ||
| 78 | + $iframeDom.find("#test").html("我是从父级传来的值哟……") | ||
| 79 | + }*/ | ||
| 80 | + }); | ||
| 81 | + }); | ||
| 82 | + | ||
| 83 | + //搜索 | ||
| 84 | + $('#search').on('click', function() { | ||
| 85 | + var key = $('#key').val(); | ||
| 86 | + /*if($.trim(key)==='') { | ||
| 87 | + layer.msg('{:lang("pleaseEnter")}店铺名称!',{icon:0}); | ||
| 88 | + return; | ||
| 89 | + }*/ | ||
| 90 | + tableIn.reload({ | ||
| 91 | + page:{page: 1}, | ||
| 92 | + where:{ | ||
| 93 | + key: key, | ||
| 94 | + address: $('#address').val(), | ||
| 95 | + channel: $('#channel').val(), | ||
| 96 | + prov: $("#provid").find("option:selected").text(), | ||
| 97 | + city: $("#cityid").find("option:selected").text(), | ||
| 98 | + area: $("#areaid").find("option:selected").text() | ||
| 99 | + } | ||
| 100 | + }); | ||
| 101 | + }); | ||
| 102 | + | ||
| 103 | + var $ = layui.$, active = { | ||
| 104 | + reload: function(){ | ||
| 105 | + var key = $('#key'); | ||
| 106 | + var channel = $('#channel'); | ||
| 107 | + var address = $('#address'); | ||
| 108 | + var prov = $("#provid").find("option:selected").text(); | ||
| 109 | + var city = $("#cityid").find("option:selected").text(); | ||
| 110 | + var area = $("#areaid").find("option:selected").text() | ||
| 111 | + //执行重载 | ||
| 112 | + table.reload('testReload', { | ||
| 113 | + page: { | ||
| 114 | + curr: 1 //重新从第 1 页开始 | ||
| 115 | + } | ||
| 116 | + ,where: { | ||
| 117 | + key: { | ||
| 118 | + id: key.val(), | ||
| 119 | + channel: channel.val(), | ||
| 120 | + address: address.val(), | ||
| 121 | + prov: prov, | ||
| 122 | + city: city, | ||
| 123 | + area: area | ||
| 124 | + } | ||
| 125 | + } | ||
| 126 | + }); | ||
| 127 | + } | ||
| 128 | + }; | ||
| 129 | + | ||
| 130 | + $('.demoTable .layui-btn').on('click', function(){ | ||
| 131 | + var type = $(this).data('type'); | ||
| 132 | + active[type] ? active[type].call(this) : ''; | ||
| 133 | + }); | ||
| 134 | + | ||
| 135 | + //启用、停用 | ||
| 136 | + table.on('tool(list)', function(obj){ | ||
| 137 | + var data = obj.data; | ||
| 138 | + if(obj.event === 'stop'){ | ||
| 139 | + var statusVal = data.status==1 ? '停用' : '启用'; | ||
| 140 | + layer.confirm('请确定要 '+statusVal+" 该商家!", function(index){ | ||
| 141 | + $.post("{:url('configStop')}",{sellerid:data.id,status:data.status},function(res){ | ||
| 142 | + if(res.code==1){ | ||
| 143 | + layer.msg(res.msg,{time:1000,icon:1}); | ||
| 144 | + location.reload(); | ||
| 145 | + }else{ | ||
| 146 | + layer.msg(res.msg,{time:1000,icon:2}); | ||
| 147 | + } | ||
| 148 | + }); | ||
| 149 | + layer.close(index); | ||
| 150 | + }); | ||
| 151 | + } | ||
| 152 | + }); | ||
| 153 | + }) | ||
| 154 | +</script> |
application/admin/view/area/operate.html
0 → 100644
| 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>代理商运营人员列表</legend> | ||
| 5 | + </fieldset> | ||
| 6 | + <blockquote class="layui-elem-quote"> | ||
| 7 | + <a href="{:url('operateAdd')}" class="layui-btn layui-btn-sm">添加运营人员</a> | ||
| 8 | + </blockquote> | ||
| 9 | + <table class="layui-table" id="list" lay-filter="list"></table> | ||
| 10 | +</div> | ||
| 11 | + | ||
| 12 | +{include file="common/foot"/} | ||
| 13 | +<script type="text/html" id="barDemo"> | ||
| 14 | + <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">{:lang('del')}</a> | ||
| 15 | +</script> | ||
| 16 | + | ||
| 17 | +<script> | ||
| 18 | + layui.use(['table','form'], function() { | ||
| 19 | + var table = layui.table,form = layui.form,$ = layui.jquery; | ||
| 20 | + var tableIn = table.render({ | ||
| 21 | + elem: '#list', | ||
| 22 | + url: '{:url("operate")}', | ||
| 23 | + method:'post', | ||
| 24 | + cols: [[ | ||
| 25 | + ,{field:'sub_openid', title: '运营公众号ID', width:280,fixed: true} | ||
| 26 | + ,{field:'openid', title: '一键订商户ID', width:270} | ||
| 27 | + ,{field:'account', title: '运营账号', width:120} | ||
| 28 | + ,{field:'cdate', title: '加入时间',width:180} | ||
| 29 | + ,{width:160,title: '操作', align:'center', toolbar: '#barDemo'} | ||
| 30 | + ]] | ||
| 31 | + }); | ||
| 32 | + //删除运营人员 | ||
| 33 | + table.on('tool(list)', function(obj){ | ||
| 34 | + var data = obj.data; | ||
| 35 | + if(obj.event === 'del'){ | ||
| 36 | + layer.confirm('{:lang("确认禁用?")}', function(index){ | ||
| 37 | + $.post("{:url('setAgentOperate')}",{id:data.id},function(res){ | ||
| 38 | + if(res.code==1){ | ||
| 39 | + layer.msg(res.msg,{time:1000,icon:1}); | ||
| 40 | + obj.del(); | ||
| 41 | + }else{ | ||
| 42 | + layer.msg(res.msg,{time:1000,icon:2}); | ||
| 43 | + } | ||
| 44 | + }); | ||
| 45 | + layer.close(index); | ||
| 46 | + }); | ||
| 47 | + } | ||
| 48 | + }); | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + | ||
| 52 | + }); | ||
| 53 | +</script> | ||
| 54 | +</body> | ||
| 55 | +</html> |
application/admin/view/area/operate_add.html
0 → 100644
| 1 | +{include file="common/head"/} | ||
| 2 | +<div class="admin-main fadeInUp animated" ng-app="hd" ng-controller="ctrl"> | ||
| 3 | + <fieldset class="layui-elem-field layui-field-title"> | ||
| 4 | + <legend>请扫描二维码完成添加代理商运营人员操作</legend> | ||
| 5 | + </fieldset> | ||
| 6 | + <form class="layui-form layui-form-pane"> | ||
| 7 | + <div class="layui-form-item"> | ||
| 8 | + <label class="layui-form-label" style="height: 465px;width: 500px;"><img style="margin: 20px;height: 400px;width: 400px;" src="{$qrcode_path}"/></label> | ||
| 9 | + </div> | ||
| 10 | + <div class="layui-form-item"> | ||
| 11 | + <div class="layui-input-block"> | ||
| 12 | + <a href="{:url('operateList')}" style="margin-left: 95px" class="layui-btn">{:lang('back')}</a> | ||
| 13 | + </div> | ||
| 14 | + </div> | ||
| 15 | + </form> | ||
| 16 | +</div> | ||
| 17 | +{include file="common/foot"/} |
application/admin/view/area/seller.html
0 → 100644
| 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 | + <blockquote class="layui-elem-quote"> | ||
| 7 | + <a href="{:url('Seller/sellerList')}" class="layui-btn layui-btn-sm layui-btn-danger"> | ||
| 8 | + <i class="fa fa-file-image-o"></i> 商家信息列表 | ||
| 9 | + </a> | ||
| 10 | + <a href="{:url('Template/uploadFile')}" class="layui-btn layui-btn-sm"> | ||
| 11 | + <i class="fa fa-file-image-o"></i> GIF图片、短视频上传 | ||
| 12 | + </a> | ||
| 13 | + <a href="{:url('Template/Vegetable')}" class="layui-btn layui-btn-sm"> | ||
| 14 | + <i class="fa fa-file-image-o"></i> 菜品库管理 | ||
| 15 | + </a> | ||
| 16 | + </blockquote> | ||
| 17 | + | ||
| 18 | + <div class="demoTable"> | ||
| 19 | + 商家名称:<div class="layui-inline"> | ||
| 20 | + <input class="layui-input" name="key" id="key" placeholder="{:lang('pleaseEnter')}店铺名称" autocomplete="off"> | ||
| 21 | + </div> | ||
| 22 | + 商家地址:<div class="layui-inline"> | ||
| 23 | + <input class="layui-input" name="address" id="address" placeholder="{:lang('pleaseEnter')}店铺地址" autocomplete="off"> | ||
| 24 | + </div> | ||
| 25 | + 商家来源: | ||
| 26 | + <div class="layui-input-inline layui-form"> | ||
| 27 | + <div class="layui-input-8"> | ||
| 28 | + <select name="class" id="channel" lay-filter="myselect"> | ||
| 29 | + <option value="4">全部</option> | ||
| 30 | + <option value="1" selected>合作</option> | ||
| 31 | + <option value="2">推广</option> | ||
| 32 | + <option value="3">测试</option> | ||
| 33 | + </select> | ||
| 34 | + </div> | ||
| 35 | + </div> | ||
| 36 | + 选择地区: | ||
| 37 | + <div class="layui-input-inline"> | ||
| 38 | + <form class="layui-form"> | ||
| 39 | + <div class="layui-input-inline"> | ||
| 40 | + <select name="provid" id="provid" lay-filter="provid"> | ||
| 41 | + <option value="">请选择省</option> | ||
| 42 | + </select> | ||
| 43 | + </div> | ||
| 44 | + <div class="layui-input-inline"> | ||
| 45 | + <select name="cityid" id="cityid" lay-filter="cityid"> | ||
| 46 | + <option value="">请选择市</option> | ||
| 47 | + </select> | ||
| 48 | + </div> | ||
| 49 | + <div class="layui-input-inline"> | ||
| 50 | + <select name="areaid" id="areaid" lay-filter="areaid"> | ||
| 51 | + <option value="">请选择县/区</option> | ||
| 52 | + </select> | ||
| 53 | + </div> | ||
| 54 | + </form> | ||
| 55 | + </div> | ||
| 56 | + | ||
| 57 | + <button class="layui-btn" id="search" data-type="reload">搜索</button> | ||
| 58 | + <!-- 备注: 人均消费(130)、店铺评分(4.9,最高5分)、停车场(0/1 无/有)开启单元格编辑 --> | ||
| 59 | + </div> | ||
| 60 | + | ||
| 61 | + <table class="layui-table" id="list" lay-filter="list"></table> | ||
| 62 | +</div> | ||
| 63 | +{include file="common/foot"/} | ||
| 64 | + | ||
| 65 | +<script src="/static/common/js/jquery.2.1.1.min.js"></script> | ||
| 66 | +<script type="text/javascript" src="/static/city/data.js"></script> | ||
| 67 | +<script type="text/javascript" src="/static/city/province.js"></script> | ||
| 68 | +<script type="text/javascript"> | ||
| 69 | + var defaults = { | ||
| 70 | + s1: 'provid', | ||
| 71 | + s2: 'cityid', | ||
| 72 | + s3: 'areaid', | ||
| 73 | + v1: null, | ||
| 74 | + v2: null, | ||
| 75 | + v3: null | ||
| 76 | + }; | ||
| 77 | +</script> | ||
| 78 | + | ||
| 79 | +<script type="text/html" id="action"> | ||
| 80 | + <a class="layui-btn {{ 0==d.status?'':'layui-btn-danger'}} layui-btn-xs" lay-event="stop">{{ 0==d.status?'启用':'停用'}}</a> | ||
| 81 | + <a href="{:url('Seller/sellerconfig')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">配置</a> | ||
| 82 | + <!--<a href="{:url('Template/configMer')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">配置菜品</a>--> | ||
| 83 | + <a href="{:url('Basicinfo/smsRecharge')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">短信充值</a> | ||
| 84 | +</script> | ||
| 85 | +<script> | ||
| 86 | + layui.use(['table','form'], function() { | ||
| 87 | + var table = layui.table,$ = layui.jquery; | ||
| 88 | + var tableIn = table.render({ | ||
| 89 | + elem: '#list', | ||
| 90 | + url: '{:url("Seller")}', | ||
| 91 | + method: 'post', | ||
| 92 | + title: '商家列表', | ||
| 93 | + toolbar: '#toolbarDemo', | ||
| 94 | + page:true, | ||
| 95 | + cols: [[ | ||
| 96 | + {field: 'id', title: '{:lang("id")}', width:60, fixed: true}, | ||
| 97 | + {field: 'sellername', edit: 'text', title: '商家名称'}, | ||
| 98 | + {field: 'selleralias', edit: 'text', title: '短店名+地址'}, | ||
| 99 | + {field: 'last_num', align: 'center',title: '短信余量'}, | ||
| 100 | + {field: 'average', align: 'center', edit: 'text', title: '人均消费'}, | ||
| 101 | + {field: 'score', align: 'center', edit: 'text', title: '店铺评分'}, | ||
| 102 | + {field: 'is_parking', align: 'center', edit: 'text',title: '是否有停车场'}, | ||
| 103 | + {field: 'is_meal_fee', align: 'center', edit: 'text',title: '有无餐位费'}, | ||
| 104 | + {field: 'is_unsubscribe', align: 'center', edit: 'text',title: '是否可随时退'}, | ||
| 105 | + {field: 'is_minimum_consumption', align: 'center', edit: 'text',title: '有无最低消费'}, | ||
| 106 | + {field: 'is_belt_wine', align: 'center', edit: 'text',title: '是否可自带酒水'}, | ||
| 107 | + {field: 'slogan', align: 'center', edit: 'text',title: '商家短标语'}, | ||
| 108 | + {field: 'scale', align: 'center', edit: 'text', sort: true,title: '比例尺'}, | ||
| 109 | + {field: 'is_auth', align: 'center', edit: 'text', sort: true,title: '订座读写权限'}, | ||
| 110 | + {field: 'user_name', align: 'center',title: '创建人'}, | ||
| 111 | + //{field: 'dz_version', align: 'center',title: 'APP版本'}, | ||
| 112 | + {align: 'center', width:200,title: '操作', toolbar: '#action'} | ||
| 113 | + ]] | ||
| 114 | + ,id: 'testReload' | ||
| 115 | + ,page: true | ||
| 116 | + }); | ||
| 117 | + | ||
| 118 | + //监听单元格编辑 | ||
| 119 | + table.on('edit(list)', function(obj){ | ||
| 120 | + var value = obj.value, //得到修改后的值 | ||
| 121 | + data = obj.data, //得到所在行所有键值 | ||
| 122 | + field = obj.field; //得到字段 | ||
| 123 | + switch(field){ | ||
| 124 | + case 'average': | ||
| 125 | + var new_field = '人均消费'; | ||
| 126 | + break; | ||
| 127 | + case 'is_parking': | ||
| 128 | + var new_field = '停车场'; | ||
| 129 | + break; | ||
| 130 | + case 'score': | ||
| 131 | + var new_field = '店铺评分'; | ||
| 132 | + break; | ||
| 133 | + case 'slogan': | ||
| 134 | + var new_field = '标语'; | ||
| 135 | + break; | ||
| 136 | + case 'selleralias': | ||
| 137 | + var new_field = '短店名'; | ||
| 138 | + break; | ||
| 139 | + case 'is_meal_fee': | ||
| 140 | + var new_field = '有无餐位费'; | ||
| 141 | + break; | ||
| 142 | + case 'is_unsubscribe': | ||
| 143 | + var new_field = '是否可随时退'; | ||
| 144 | + break; | ||
| 145 | + case 'is_minimum_consumption': | ||
| 146 | + var new_field = '有无最低消费'; | ||
| 147 | + break; | ||
| 148 | + case 'is_belt_wine': | ||
| 149 | + var new_field = '是否自带酒水'; | ||
| 150 | + break; | ||
| 151 | + case 'scale': | ||
| 152 | + var new_field = '比例尺'; | ||
| 153 | + break; | ||
| 154 | + case 'sellername': | ||
| 155 | + var new_field = '商家名字'; | ||
| 156 | + case 'is_auth': | ||
| 157 | + var new_field = '是否开始订座读写权限'; | ||
| 158 | + } | ||
| 159 | + if(field=='slogan' && value.length>15){ | ||
| 160 | + layer.msg('标语不能超过15个字符!',{time:1500,icon:2});return; | ||
| 161 | + } | ||
| 162 | + if(field=='scale' && value>20){ | ||
| 163 | + layer.msg('比例尺最高可设置为20',{time:1500,icon:2});return; | ||
| 164 | + } | ||
| 165 | + if(field=='scale' && value<3){ | ||
| 166 | + layer.msg('比例尺最低可设置为3',{time:1500,icon:2});return; | ||
| 167 | + } | ||
| 168 | + if(field=='is_auth' && value>1 || value<0){ | ||
| 169 | + layer.msg('请输入正确的参数,0为只读,1为读写',{time:1500,icon:2});return; | ||
| 170 | + } | ||
| 171 | + //layer.msg('[ID: '+ data.id +'] ' + field + ' 字段更改为:'+ value); | ||
| 172 | + layer.confirm('请确认将 '+ data.sellername +'商家的 ' + new_field + ' 更改为:'+ value, function(index){ | ||
| 173 | + $.post("{:url('setsellerconfig')}",{sellerid:data.id,field:field,value:value},function(res){ | ||
| 174 | + if(res.code==1){ | ||
| 175 | + layer.msg(res.msg,{time:1500,icon:1}); | ||
| 176 | + }else{ | ||
| 177 | + layer.msg(res.msg,{time:1500,icon:2}); | ||
| 178 | + } | ||
| 179 | + }); | ||
| 180 | + layer.close(index); | ||
| 181 | + }); | ||
| 182 | + }); | ||
| 183 | + | ||
| 184 | + //监听行双击事件 | ||
| 185 | + table.on('rowDouble(list)', function(obj){ | ||
| 186 | + //table.on('row(list)', function(obj){ 双击事件 | ||
| 187 | + //console.log(obj.tr) //得到当前行元素对象 | ||
| 188 | + console.log(obj.data) //得到当前行数据 | ||
| 189 | + layer.open({ | ||
| 190 | + type: 2, | ||
| 191 | + title: obj.data.sellername, | ||
| 192 | + shadeClose: true, | ||
| 193 | + shade: 0.8, | ||
| 194 | + area: ['90%', '90%'], | ||
| 195 | + content: '{:url("sellerdetail")}?sid='+obj.data.id //iframe的url | ||
| 196 | + /*success:function(dom){ | ||
| 197 | + let $iframeDom=$(dom[0]).find("iframe").eq(0).contents(); | ||
| 198 | + $iframeDom.find("#test").html("我是从父级传来的值哟……") | ||
| 199 | + }*/ | ||
| 200 | + }); | ||
| 201 | + }); | ||
| 202 | + | ||
| 203 | + //搜索 | ||
| 204 | + $('#search').on('click', function() { | ||
| 205 | + var key = $('#key').val(); | ||
| 206 | + /*if($.trim(key)==='') { | ||
| 207 | + layer.msg('{:lang("pleaseEnter")}店铺名称!',{icon:0}); | ||
| 208 | + return; | ||
| 209 | + }*/ | ||
| 210 | + tableIn.reload({ | ||
| 211 | + page:{page: 1}, | ||
| 212 | + where:{ | ||
| 213 | + key: key, | ||
| 214 | + address: $('#address').val(), | ||
| 215 | + channel: $('#channel').val(), | ||
| 216 | + prov: $("#provid").find("option:selected").text(), | ||
| 217 | + city: $("#cityid").find("option:selected").text(), | ||
| 218 | + area: $("#areaid").find("option:selected").text() | ||
| 219 | + } | ||
| 220 | + }); | ||
| 221 | + }); | ||
| 222 | + | ||
| 223 | + var $ = layui.$, active = { | ||
| 224 | + reload: function(){ | ||
| 225 | + var key = $('#key'); | ||
| 226 | + var channel = $('#channel'); | ||
| 227 | + var address = $('#address'); | ||
| 228 | + var prov = $("#provid").find("option:selected").text(); | ||
| 229 | + var city = $("#cityid").find("option:selected").text(); | ||
| 230 | + var area = $("#areaid").find("option:selected").text() | ||
| 231 | + //执行重载 | ||
| 232 | + table.reload('testReload', { | ||
| 233 | + page: { | ||
| 234 | + curr: 1 //重新从第 1 页开始 | ||
| 235 | + } | ||
| 236 | + ,where: { | ||
| 237 | + key: { | ||
| 238 | + id: key.val(), | ||
| 239 | + channel: channel.val(), | ||
| 240 | + address: address.val(), | ||
| 241 | + prov: prov, | ||
| 242 | + city: city, | ||
| 243 | + area: area | ||
| 244 | + } | ||
| 245 | + } | ||
| 246 | + }); | ||
| 247 | + } | ||
| 248 | + }; | ||
| 249 | + | ||
| 250 | + $('.demoTable .layui-btn').on('click', function(){ | ||
| 251 | + var type = $(this).data('type'); | ||
| 252 | + active[type] ? active[type].call(this) : ''; | ||
| 253 | + }); | ||
| 254 | + | ||
| 255 | + //启用、停用 | ||
| 256 | + table.on('tool(list)', function(obj){ | ||
| 257 | + var data = obj.data; | ||
| 258 | + if(obj.event === 'stop'){ | ||
| 259 | + var statusVal = data.status==1 ? '停用' : '启用'; | ||
| 260 | + layer.confirm('请确定要 '+statusVal+" 该商家!", function(index){ | ||
| 261 | + $.post("{:url('configStop')}",{sellerid:data.id,status:data.status},function(res){ | ||
| 262 | + if(res.code==1){ | ||
| 263 | + layer.msg(res.msg,{time:1000,icon:1}); | ||
| 264 | + location.reload(); | ||
| 265 | + }else{ | ||
| 266 | + layer.msg(res.msg,{time:1000,icon:2}); | ||
| 267 | + } | ||
| 268 | + }); | ||
| 269 | + layer.close(index); | ||
| 270 | + }); | ||
| 271 | + } | ||
| 272 | + }); | ||
| 273 | + }) | ||
| 274 | +</script> |
-
Please register or login to post a comment