Commit 198298515b61ed76e57d557c541f6d5157c55d6f

Authored by teemitop
1 parent bce6baf7

商家配置调整

@@ -726,6 +726,63 @@ class Seller extends Common @@ -726,6 +726,63 @@ class Seller extends Common
726 return $res; 726 return $res;
727 } 727 }
728 728
  729 + //获取商家接单时的选中项
  730 + public function get_seller_config_mode(){
  731 + $data = Request::except('file');
  732 + $seller_config_res = Db::query('SELECT * from `xt-member-two-LINE`.xt_dc_dz_seller_config where sid ='.$data['sid'].' GROUP by sid');
  733 + if(!empty($seller_config_res[0])) {
  734 + $seller_user_openid_array = array();
  735 + //获取小程序是否可选择
  736 + $seller_user_openid_array = Db::query('SELECT
  737 + a.openid,
  738 + u.nick_name,
  739 + u.phone
  740 + FROM
  741 + `xt-member-two-LINE`.xt_dc_seller_user AS u
  742 + LEFT JOIN `xt-member-two-LINE`.xt_auth_user AS a ON u.auth_user_id = a.id
  743 + WHERE
  744 + u.is_on_call = 1
  745 + AND u.sellerid = '.$data['sid']);
  746 + $seller_user_openid = $seller_user_openid_array ? $seller_user_openid_array[0]['openid'] : '';
  747 +
  748 + if($seller_user_openid_array[0]['phone']==NULL || $seller_user_openid_array[0]['phone'] ==''){
  749 + $seller_user_openid_array[0]['phone'] = '电话未填写';
  750 + $seller_user_openid_array[0]['phone_status'] = 1;
  751 + }
  752 + //检测是否关注公众号
  753 + if($seller_user_openid){
  754 + $seller_user_unionid = Db::query('SELECT
  755 + openid
  756 + FROM
  757 + `xt-member-two-LINE`.xt_wechat
  758 + WHERE
  759 + unionid = ( SELECT unionid FROM `xt-member-two-LINE`.xt_wechat WHERE openid = "'.$seller_user_openid.'" )
  760 + AND source = 0');
  761 + $seller_user_unionid = $seller_user_unionid ? $seller_user_unionid[0]['openid'] : '';
  762 + //未关注公众号则不能勾选小程序
  763 + if($seller_user_unionid==''){
  764 + $seller_user_openid_array[0]['is_openid_wechat'] = 0;
  765 + $seller_user_openid_array[0]['is_openid_wechat_str'] = '未关注公众号';
  766 + }else{
  767 + $seller_user_openid_array[0]['is_openid_wechat'] = 1;
  768 + $seller_user_openid_array[0]['is_openid_wechat_str'] = '已关注公众号';
  769 + }
  770 + }
  771 + $seller_config_res[0]['user_info'] = [];
  772 + array_push($seller_config_res[0]['user_info'], $seller_user_openid_array[0]);
  773 + $seller_config_res[0]['user_info'] = $seller_config_res[0]['user_info'][0];
  774 +
  775 + $res['code'] = 1;
  776 + $res['list'] = $seller_config_res[0];
  777 + $res['msgs'] = 'SUCCESS';
  778 + }else{
  779 + $res['code'] = 0;
  780 + $res['list'] = array();
  781 + $res['msgs'] = '请联系管理员处理!';
  782 + }
  783 + return $res;
  784 + }
  785 +
729 //获取短信模板内容 786 //获取短信模板内容
730 public function get_sms_detail_seller($code){ 787 public function get_sms_detail_seller($code){
731 //根据code获取模板内容 788 //根据code获取模板内容
@@ -10,8 +10,14 @@ @@ -10,8 +10,14 @@
10 10
11 <!-- 元素循环 --> 11 <!-- 元素循环 -->
12 <div id="list"> 12 <div id="list">
  13 +
  14 +
13 </div> 15 </div>
14 - 16 + <div id="device_call_lite" style='display:none'>
  17 + <div class="layui-input-8">
  18 +
  19 + </div>
  20 + </div>
15 <div style="margin-top:0.5cm;"> 21 <div style="margin-top:0.5cm;">
16 <input type="hidden" value="{$sid}" id="sid"> 22 <input type="hidden" value="{$sid}" id="sid">
17 <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('submit')}</button> 23 <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('submit')}</button>
@@ -101,12 +107,44 @@ @@ -101,12 +107,44 @@
101 107
102 //部分复选框只能选一个 108 //部分复选框只能选一个
103 $('#list').on('click', $('input[name]'), function(event) { 109 $('#list').on('click', $('input[name]'), function(event) {
104 - var i = $(this).find('input').attr('data-index'); 110 + var i = $(this).find('input').attr('data-index');
105 var flag = $(this).find('input').attr('name'); 111 var flag = $(this).find('input').attr('name');
  112 + var sid = $("#sid").val();
106 //单选按钮显示隐藏 113 //单选按钮显示隐藏
107 if(i==14){ 114 if(i==14){
108 var id = $(this).find('input:checked').attr('id'); 115 var id = $(this).find('input:checked').attr('id');
109 if(id==1){ 116 if(id==1){
  117 + //请求数据
  118 + $.ajax({
  119 + url: "{:url('get_seller_config_mode')}",
  120 + type: 'post',
  121 + cache: false,
  122 + data:{index:i,sid:sid},
  123 + success: function (res) {
  124 + if (res.code==1) {
  125 + $("#device_call_lite").show();
  126 + var html = '';
  127 + var is_checked_call = res.list.is_checked_call==1 ? 'checked' : '';
  128 + if(res.list.user_info){
  129 + var title = 'title = 公众号+小程序+语音电话('+res.list.user_info.nick_name+'+'+res.list.user_info.phone+'+'+res.list.user_info.is_openid_wechat_str+')';
  130 + var is_openid_wechat = (res.list.user_info.is_openid_wechat !=1 || res.list.user_info.phone_status==1) ? 'disabled' : '';
  131 + }else{
  132 + var title = 'title = 公众号+小程序+语音电话';
  133 + }
  134 +
  135 + var is_checked_lite = res.list.is_checked_lite==1 ? 'checked' : '';
  136 + html +='<input type="checkbox" class="device_check" lay-filter="device_check" name="is_checked_call" lay-skin="primary" title="电话机+APP" '+is_checked_call+'> <input type="checkbox" class="device_check" lay-filter="device_check" name="is_checked_lite" lay-skin="primary" '+title+' '+is_checked_lite+' '+is_openid_wechat+'>';
  137 + $("#device_call_lite").html(html);
  138 + $("#device_call_lite").show();
  139 + }else{
  140 + layer.msg(res.msgs,{icon:5});
  141 + return false;
  142 + }
  143 + form.render();
  144 + },
  145 + error: function (result) {
  146 + }
  147 + });
110 $("#device_call_lite").show(); 148 $("#device_call_lite").show();
111 }else{ 149 }else{
112 $("#device_call_lite").hide(); 150 $("#device_call_lite").hide();