Commit 1e2684aad90c394a0d406b9a09ad12d37732c791

Authored by teemitop
1 parent aa0aaa27

PC配置商家接单人

@@ -257,15 +257,32 @@ class Seller extends Common @@ -257,15 +257,32 @@ class Seller extends Common
257 public function sellerconfig(){ 257 public function sellerconfig(){
258 $data = Request::except('file'); 258 $data = Request::except('file');
259 if(Request::isAjax()){ 259 if(Request::isAjax()){
260 - $cuisine = !empty($data['cuisine']) ? implode(',', array_keys($data['cuisine'])) : '';  
261 - $type = !empty($data['type']) ? implode(',', array_keys($data['type'])) : '';  
262 - $mode = !empty($data['mode']) ? implode(',', array_keys($data['mode'])) : '';  
263 - $sms_code = !empty($data['sms_code']) ? $data['sms_code'] : '';  
264 - $label = !empty($data['label']) ? implode(',', array_keys($data['label'])) : '';  
265 - $brand = !empty($data['brand']) ? implode(',', array_keys($data['brand'])) : '';  
266 - $label_1_ = !empty($data['label_1_']) ? implode(',', array_keys($data['label_1_'])) : '';  
267 - $label_2_ = !empty($data['label_2_']) ? implode(',', array_keys($data['label_2_'])) : '';  
268 - $label_3_ = !empty($data['label_3_']) ? implode(',', array_keys($data['label_3_'])) : ''; 260 + $cuisine = !empty($data['cuisine']) ? implode(',', array_keys($data['cuisine'])) : '';
  261 + $type = !empty($data['type']) ? implode(',', array_keys($data['type'])) : '';
  262 + $mode = !empty($data['mode']) ? implode(',', array_keys($data['mode'])) : '';
  263 + $sms_code = !empty($data['sms_code']) ? $data['sms_code'] : '';
  264 + $label = !empty($data['label']) ? implode(',', array_keys($data['label'])) : '';
  265 + $brand = !empty($data['brand']) ? implode(',', array_keys($data['brand'])) : '';
  266 + $label_1_ = !empty($data['label_1_']) ? implode(',', array_keys($data['label_1_'])) : '';
  267 + $label_2_ = !empty($data['label_2_']) ? implode(',', array_keys($data['label_2_'])) : '';
  268 + $label_3_ = !empty($data['label_3_']) ? implode(',', array_keys($data['label_3_'])) : '';
  269 + $is_checked_call = !empty($data['is_checked_call']) ? $data['is_checked_call'] : '';
  270 + $is_checked_lite = !empty($data['is_checked_lite']) ? $data['is_checked_lite'] : '';
  271 +
  272 + if(isset($data['reserve_mode'])) {
  273 + //需要修改 接单设备信息
  274 + if($data['reserve_mode']==1){
  275 + if($is_checked_lite)
  276 + $up=Db::query("UPDATE `xt-member-two-LINE`.xt_dc_dz_seller_config set is_checked_lite = 1 where sid = ".$data['sellerid']);
  277 + else
  278 + $up=Db::query("UPDATE `xt-member-two-LINE`.xt_dc_dz_seller_config set is_checked_lite = 0 where sid = ".$data['sellerid']);
  279 + if($is_checked_call)
  280 + $up=Db::query("UPDATE `xt-member-two-LINE`.xt_dc_dz_seller_config set is_checked_call = 1 where sid = ".$data['sellerid']);
  281 + else
  282 + $up=Db::query("UPDATE `xt-member-two-LINE`.xt_dc_dz_seller_config set is_checked_call = 0 where sid = ".$data['sellerid']);
  283 + }
  284 + $up=Db::query("UPDATE `xt-member-two-LINE`.xt_dc_dz_seller_config set reserve_mode = ".$data['reserve_mode']." where sid = ".$data['sellerid']);
  285 + }
269 286
270 if($sms_code) 287 if($sms_code)
271 $res_sms_code= file_get_contents(ON_LINE.'App.SendSMS.SetSellerSmsTemplate&sid='.$data['sellerid'].'&sms_id='.$sms_code); 288 $res_sms_code= file_get_contents(ON_LINE.'App.SendSMS.SetSellerSmsTemplate&sid='.$data['sellerid'].'&sms_id='.$sms_code);
@@ -453,6 +470,52 @@ class Seller extends Common @@ -453,6 +470,52 @@ class Seller extends Common
453 } 470 }
454 $this->assign('template_list',$template_list['data']);//获取短信模板列表 471 $this->assign('template_list',$template_list['data']);//获取短信模板列表
455 472
  473 + //获取商家接单方式
  474 + $seller_config_res = Db::query('SELECT * from `xt-member-two-LINE`.xt_dc_dz_seller_config where sid ='.$data['id'].' GROUP by sid');
  475 + if(@$seller_config_res[0])
  476 + $this->assign('seller_config_res',$seller_config_res[0]);
  477 +
  478 + $seller_user_openid_array = array();
  479 + //获取小程序是否可选择
  480 + $seller_user_openid_array = Db::query('SELECT
  481 + a.openid,
  482 + u.nick_name,
  483 + u.phone
  484 + FROM
  485 + `xt-member-two-LINE`.xt_dc_seller_user AS u
  486 + LEFT JOIN `xt-member-two-LINE`.xt_auth_user AS a ON u.auth_user_id = a.id
  487 + WHERE
  488 + u.is_on_call = 1
  489 + AND u.sellerid = '.$data['id']);
  490 + $seller_user_openid = $seller_user_openid_array ? $seller_user_openid_array[0]['openid'] : '';
  491 +
  492 + if($seller_user_openid_array['phone']=='NULL' || $seller_user_openid_array['phone'] ==''){
  493 + $seller_user_openid_array[0]['phone'] = '电话未填写';
  494 + $seller_user_openid_array[0]['phone_status'] = 1;
  495 + }
  496 + //检测是否关注公众号
  497 + if($seller_user_openid){
  498 + $seller_user_unionid = Db::query('SELECT
  499 + openid
  500 + FROM
  501 + `xt-member-two-LINE`.xt_wechat
  502 + WHERE
  503 + unionid = ( SELECT unionid FROM `xt-member-two-LINE`.xt_wechat WHERE openid = "'.$seller_user_openid.'" )
  504 + AND source = 0');
  505 + $seller_user_unionid = $seller_user_unionid ? $seller_user_unionid[0]['openid'] : '';
  506 + //未关注公众号则不能勾选小程序
  507 + if($seller_user_unionid==''){
  508 + $seller_user_openid_array[0]['is_openid_wechat'] = 0;
  509 + $seller_user_openid_array[0]['is_openid_wechat_str'] = '未关注公众号';
  510 + }else{
  511 + $seller_user_openid_array[0]['is_openid_wechat'] = 1;
  512 + $seller_user_openid_array[0]['is_openid_wechat_str'] = '已关注公众号';
  513 + }
  514 + }
  515 +
  516 + $this->assign('seller_user_openid_array',$seller_user_openid_array[0]);
  517 +
  518 +
456 //获取商家拥有哪些标签 519 //获取商家拥有哪些标签
457 $label_list= file_get_contents(ON_LINE.'App.Seller.GetSellerLabel&sid='.$data['id']); 520 $label_list= file_get_contents(ON_LINE.'App.Seller.GetSellerLabel&sid='.$data['id']);
458 $label_list = json_decode($label_list,TRUE); 521 $label_list = json_decode($label_list,TRUE);
@@ -106,22 +106,44 @@ @@ -106,22 +106,44 @@
106 </div> 106 </div>
107 </div> 107 </div>
108 108
  109 +
  110 +
109 <div class="layui-form-item"> 111 <div class="layui-form-item">
110 - <label class="layui-form-label">在线预定</label> 112 + <label class="layui-form-label">电话安装</label>
111 <div class="layui-input-block"> 113 <div class="layui-input-block">
112 <div class="layui-input-4"> 114 <div class="layui-input-4">
113 - <input type="radio" name="edition" value="1" title="开启" {if $is_online_reserve===1} checked{/if}>  
114 - <input type="radio" name="edition" value="0" title="关闭" {if $is_online_reserve===0} checked{/if}> 115 + <input type="radio" name="is_tele" value="0" title="未安装" {if $is_tele===0} checked{/if}>
  116 + <input type="radio" name="is_tele" value="1" title="已安装" {if $is_tele===1} checked{/if}>
115 </div> 117 </div>
116 </div> 118 </div>
117 </div> 119 </div>
118 120
119 <div class="layui-form-item"> 121 <div class="layui-form-item">
120 - <label class="layui-form-label">电话安装</label> 122 + <label class="layui-form-label">在线预定</label>
121 <div class="layui-input-block"> 123 <div class="layui-input-block">
122 <div class="layui-input-4"> 124 <div class="layui-input-4">
123 - <input type="radio" name="is_tele" value="0" title="未安装" {if $is_tele===0} checked{/if}>  
124 - <input type="radio" name="is_tele" value="1" title="已安装" {if $is_tele===1} checked{/if}> 125 + <input type="radio" name="edition" value="1" title="开启" {if $is_online_reserve===1} checked{/if} lay-filter="edition_filter">
  126 + <input type="radio" name="edition" value="0" title="关闭" {if $is_online_reserve===0} checked{/if} lay-filter="edition_filter">
  127 + </div>
  128 + </div>
  129 + </div>
  130 +
  131 + <div class="layui-form-item" {if $is_online_reserve!=1} style='display:none' {/if} id="reserve_mode_display">
  132 + <label class="layui-form-label">接单方式</label>
  133 + <div class="layui-input-block">
  134 + <div class="layui-input-4">
  135 + <input type="radio" name="reserve_mode" value="1" title="商家接单" lay-filter="reserve_mode_filter" {if $seller_config_res.reserve_mode==1} checked{/if}>
  136 + <input type="radio" name="reserve_mode" value="2" title="运营接单(小程序)" lay-filter="reserve_mode_filter"{if $seller_config_res.reserve_mode==2} checked{/if}>
  137 + </div>
  138 + </div>
  139 + <div class="layui-input-block" id="device_call_lite" {if $seller_config_res.reserve_mode==2} style='display:none'{/if}>
  140 + <div class="layui-input-4">
  141 + <input type="checkbox" class="device_check" lay-filter="device_check" name="is_checked_call" lay-skin="primary" title="电话机" {if $seller_config_res.is_checked_call==1} checked{/if}>
  142 + <input type="checkbox" class="device_check" lay-filter="device_check" name="is_checked_lite" lay-skin="primary"
  143 + {if $seller_user_openid_array } title="小程序({$seller_user_openid_array.nick_name}+{$seller_user_openid_array.phone}+{$seller_user_openid_array.is_openid_wechat_str})" {else} title="小程序" {/if}
  144 + {if $seller_config_res.is_checked_lite==1} checked{/if}
  145 + {if $seller_user_openid_array.is_openid_wechat!=1 || $seller_user_openid_array.phone_status==1 } disabled{/if}
  146 + >
125 </div> 147 </div>
126 </div> 148 </div>
127 </div> 149 </div>
@@ -198,8 +220,44 @@ @@ -198,8 +220,44 @@
198 } 220 }
199 }) 221 })
200 222
  223 + //单选按钮显示隐藏
  224 + form.on('select(sms_code)', function(data){
  225 + var dataval=$(data.elem).find("option:selected").attr("data-val");
  226 + $("#txt").show();
  227 + $("#txt").html(dataval);
  228 + });
  229 +
  230 + //接单方式显示/隐藏
  231 + form.on('radio(edition_filter)', function(data){
  232 +
  233 + var dataval=$(data.elem).attr("value");
  234 + if(dataval==1){
  235 + $("#reserve_mode_display").show();
  236 + }else{
  237 + $("#reserve_mode_display").hide();
  238 + }
  239 + });
  240 +
  241 + //接单设备显示/隐藏
  242 + form.on('radio(reserve_mode_filter)', function(data){
  243 + var dataval=$(data.elem).attr("value");
  244 + if(dataval==1){
  245 + $("#device_call_lite").show();
  246 + }else{
  247 + $("#device_call_lite").hide();
  248 + }
  249 + });
  250 +
201 //根据菜品ID 修改对应菜品的GIF、视频url 251 //根据菜品ID 修改对应菜品的GIF、视频url
202 form.on('submit(submit)', function (data) { 252 form.on('submit(submit)', function (data) {
  253 + //校验
  254 + if(data.field.edition==1 && data.field.reserve_mode==1){
  255 + var len=$(".device_check:checked").length;
  256 + if(len==0){
  257 + layer.msg('请至少选择一项接单方式!',{icon:3});
  258 + return false;
  259 + }
  260 + }
203 var loading = layer.load(1, {shade: [0.1, '#fff']}); 261 var loading = layer.load(1, {shade: [0.1, '#fff']});
204 $.post("{:url('sellerconfig')}", data.field, function (res) { 262 $.post("{:url('sellerconfig')}", data.field, function (res) {
205 layer.close(loading); 263 layer.close(loading);
@@ -212,12 +270,5 @@ @@ -212,12 +270,5 @@
212 } 270 }
213 }); 271 });
214 }) 272 })
215 -  
216 - //单选按钮显示隐藏  
217 - form.on('select(sms_code)', function(data){  
218 - var dataval=$(data.elem).find("option:selected").attr("data-val");  
219 - $("#txt").show();  
220 - $("#txt").html(dataval);  
221 - });  
222 }); 273 });
223 </script> 274 </script>