diff --git a/app/portal/controller/BirdController.php b/app/portal/controller/BirdController.php index 4389a0e..7f5effb 100644 --- a/app/portal/controller/BirdController.php +++ b/app/portal/controller/BirdController.php @@ -36,7 +36,7 @@ class BirdController extends HomeBaseController * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ - public function createOrder($indent_id = 132) + public function createOrder($indent_id = null) { if(empty($indent_id)){ return "缺少必要参数"; @@ -58,12 +58,12 @@ class BirdController extends HomeBaseController $region = explode(' ',$address['region']); //请求url,接口正式地址:http://api.kdniao.com/api/OOrderService 测试环境地址:http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json - defined('ReqURL') or define('ReqURL', 'http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json'); + defined('ReqURL') or define('ReqURL', 'http://api.kdniao.com/api/EOrderService'); //构造在线下单提交信息 $eorder = []; - $eorder["ShipperCode"] = "SF"; + $eorder["ShipperCode"] = "$indent[logistic_name]"; $eorder["OrderCode"] = $indent['order_number']; $eorder["PayType"] = 1; $eorder["ExpType"] = 1; @@ -100,6 +100,7 @@ class BirdController extends HomeBaseController //解析在线下单返回结果 $result = json_decode($jsonResult, true); + cache('test',$result); if ($result["ResultCode"] == "100") { if(!empty($result['Order']['LogisticCode'])){ $indentModel->updateData(['id'=>$indent_id],['logistic_code'=>$result['Order']['LogisticCode']]); @@ -138,7 +139,7 @@ class BirdController extends HomeBaseController * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ - public function getOrder($indent_id = 112){ + public function getOrder($indent_id = null){ if(empty($indent_id)){ $this->error('缺少必要参数','','',''); } @@ -149,6 +150,9 @@ class BirdController extends HomeBaseController if(empty($indent)){ $this->error('未查询到该订单','','',''); } + if(!empty($indent['salesman_uid'])){ + $indent['order_number']= null; + } // if($indent['state'] != 5){ // $this->error('该订单不是已发货状态','','',''); // } @@ -169,7 +173,7 @@ class BirdController extends HomeBaseController * Json方式 查询订单物流轨迹 */ function getOrderTracesByJson($OrderCode,$LogisticCode,$LogisticName){ - $requestData= "{'OrderCode':$OrderCode,'ShipperCode':'$LogisticName','LogisticCode':$LogisticCode}"; + $requestData= "{'OrderCode':'$OrderCode','ShipperCode':'$LogisticName','LogisticCode':$LogisticCode}"; $datas = array( 'EBusinessID' => EBusinessID, diff --git a/app/portal/controller/OrderSalesmanController.php b/app/portal/controller/OrderSalesmanController.php index ba0b3cd..006c672 100644 --- a/app/portal/controller/OrderSalesmanController.php +++ b/app/portal/controller/OrderSalesmanController.php @@ -32,6 +32,8 @@ class OrderSalesmanController extends WeChatBaseController $param = $this->request->param(); if(!empty($param['is_courier'])){ $where['is_courier'] = ['eq',$param['is_courier']]; + }else{ + $where['is_courier'] = ['eq',1]; } $user_id = $this->user_id; $where['salesman_uid'] = ['eq',$user_id]; @@ -75,6 +77,11 @@ class OrderSalesmanController extends WeChatBaseController }else{ $where['state'] = ['neq',4]; } + if(!empty($param['is_courier'])){ + $where['is_courier'] = ['eq',$param['is_courier']]; + }else{ + $where['is_courier'] = ['eq',1]; + } $user_id = $this->user_id; $where['salesman_uid'] = ['eq',$user_id]; $where['indent_type'] = ['eq',2]; @@ -121,11 +128,11 @@ class OrderSalesmanController extends WeChatBaseController } $arr = []; if($param['is_courier'] == 1){ - $arr['logistic_name'] = $param['logistic_name']; - $arr['logistic_code'] = $param['logistic_code']; - }else if($param['is_courier'] == 2){ $arr['start_time'] = $param['start_time']; $arr['end_time'] = $param['end_time']; + }else if($param['is_courier'] == 2){ + $arr['logistic_name'] = $param['logistic_name']; + $arr['logistic_code'] = $param['logistic_code']; } $arr['state'] = 5; $result = $indentModel->updateData($where,$arr); diff --git a/app/portal/model/IndentModel.php b/app/portal/model/IndentModel.php index 5d0c423..fdfa956 100644 --- a/app/portal/model/IndentModel.php +++ b/app/portal/model/IndentModel.php @@ -32,7 +32,7 @@ class IndentModel extends Model * @throws \think\exception\DbException */ public function selectData($where){ - $data = $this->where($where)->order('create_time desc')->select()->toArray(); + $data = $this->where($where)->order('pay_time desc,create_time')->select()->toArray(); return $data; } diff --git a/public/themes/simpleboot3/portal/logistics/index.html b/public/themes/simpleboot3/portal/logistics/index.html index 94e647c..a19f0eb 100644 --- a/public/themes/simpleboot3/portal/logistics/index.html +++ b/public/themes/simpleboot3/portal/logistics/index.html @@ -24,7 +24,7 @@ </div> <div class="log_detailTxt"> <h1 class="one-txt-cut">{$indent.indent_goods.0.book_name}</h1> - <p>运单号:{$indent.order_number}</p> + <p>运单号:{$indent.logistic_code}</p> <p>信息来源:顺丰快递</p> </div> </div> @@ -39,8 +39,8 @@ <foreach name="$data.traces" item="vo"> <div class="log_Li"> <div class="log_LiTime"> - <p class="log_LiTime1">{:date('Y-m-d',strtotime($vo['AcceptTime']))}</p> - <p class="log_LiTime2">{:date('H:i:s',strtotime($vo['AcceptTime']))}</p> + <p class="log_LiTime1">{:date('m-d',strtotime($vo['AcceptTime']))}</p> + <p class="log_LiTime2">{:date('H:i',strtotime($vo['AcceptTime']))}</p> </div> <div class="log_Box"> <div class="log_Liround"></div> diff --git a/public/themes/simpleboot3/portal/order_salesman/get_all.html b/public/themes/simpleboot3/portal/order_salesman/get_all.html index c5c2b7c..fb841b6 100644 --- a/public/themes/simpleboot3/portal/order_salesman/get_all.html +++ b/public/themes/simpleboot3/portal/order_salesman/get_all.html @@ -47,8 +47,7 @@ <div class="tx_maskCon_tongyi"> <div class="three_model_school"> <div class="three_model_school_data" style="display: block;"> - <div class="three_model_school_name there_unActive">全部</div> - <div class="three_model_school_name" data-id="1">统一配送</div> + <div class="three_model_school_name there_unActive" data-id="1">统一配送</div> <div class="three_model_school_name" data-id="2">快递配送</div> </div> </div> @@ -63,12 +62,18 @@ </div> <div> <div class="three_model_school_data" style="display: block;"> - <div class="three_model_school_name">顺丰快递</div> - <div class="three_model_school_name">圆通快递</div> - <div class="three_model_school_name there_unActive">申通快递</div> - <div class="three_model_school_name">韵达快递</div> - <div class="three_model_school_name">天天快递</div> - <div class="three_model_school_name">百世汇通</div> + <div class="three_model_school_name" data-name="SF">顺丰快递</div> + <div class="three_model_school_name" data-name="YTO">圆通快递</div> + <div class="three_model_school_name" data-name="STO">中通快递</div> + <div class="three_model_school_name there_unActive" data-name="STO">申通快递</div> + <div class="three_model_school_name" data-name="YD">韵达快递</div> + <div class="three_model_school_name" data-name="HHTT">天天快递</div> + <div class="three_model_school_name" data-name="HTKY">百世快递</div> + <div class="three_model_school_name" data-name="YZPY">邮政快递包裹</div> + <div class="three_model_school_name" data-name="EMS">EMS</div> + <div class="three_model_school_name" data-name="DBL">德邦快递</div> + <div class="three_model_school_name" data-name="ZJS">宅急送</div> + <div class="three_model_school_name" data-name="TNT">TNT快递</div> </div> </div> </div> @@ -137,12 +142,13 @@ <!--<input type="text" id="logistic_name" placeholder="请输入快递公司"/>--> <!--</div>--> <!--</div>--> - <div class="log_three_model_one"> + <div class="log_three_model_one logistic"> <div class="log_three_model_left">选择快递</div> <div class="log_psong log_psong_select"> <div class="log_ps_title">请选择</div> <div class="log_ps_img"> <img src="__TMPL__/public/assets/images/29.png" /> + <input type="hidden" id="logistic_name" placeholder="请选择快递公司"/> </div> </div> </div> @@ -185,7 +191,7 @@ </div> <div class="log_three_select_one log_three_select_peisong log_three_select_tongyi"> <div class="log_three_select_title log_three_select_contant"> - 配送类型 + 统一配送 </div> <div class="log_three_select_img"> <img src="__TMPL__/public/assets/images/75.png" alt=""/> @@ -196,7 +202,7 @@ </div> <input type="hidden" id="school" value=""/> <input type="hidden" id="grade" value=""/> - <input type="hidden" id="is_courier" value=""/> + <input type="hidden" id="is_courier" value="1"/> </div> <!-- 列表内容 --> <div> @@ -204,12 +210,14 @@ <div class="log_three_list_contant" style="display: block;"> <foreach name="$data" item="vo"> <if condition="$vo.state eq 2"> - <div class="log_three_list"> + <div class="log_three_list order_{$vo.id}"> <div class="log_three_list_top"> <div class="log_three_list_top_left"> - <div class="log_three_list_top_lo"> - <img src="__TMPL__/public/assets/images/fangkuang.png" alt=""/> - </div> + <if condition="$vo.is_courier eq 1"> + <div class="log_three_list_top_lo"> + <img src="__TMPL__/public/assets/images/fangkuang.png" alt=""/> + </div> + </if> <div class="log_three_list_top_lt"> <div class="log_three_zhongbiao"> <img src="__TMPL__/public/assets/images/52.png" alt=""/> @@ -271,18 +279,20 @@ <div class="log_three_list_contant"> <foreach name="$data" item="vo"> <if condition="$vo.state eq 5"> - <div class="log_three_list"> + <div class="log_three_list order_{$vo.id}"> <div class="log_three_list_top"> <div class="log_three_list_top_left"> - <div class="log_three_list_top_lo"> - <img src="__TMPL__/public/assets/images/fangkuang.png" alt=""/> - </div> + <if condition="$vo.is_courier eq 1"> + <div class="log_three_list_top_lo"> + <img src="__TMPL__/public/assets/images/fangkuang.png" alt=""/> + </div> + </if> <div class="log_three_list_top_lt"> <div class="log_three_zhongbiao"> <img src="__TMPL__/public/assets/images/52.png" alt=""/> </div> <div class="log_three_shijian"> - {:date('Y-m-d H:i:s',$vo['create_time'])} + {$vo['pay_time']} </div> </div> </div> @@ -339,18 +349,20 @@ <div class="log_three_list_contant"> <foreach name="$data" item="vo"> <if condition="$vo.state eq 3"> - <div class="log_three_list"> + <div class="log_three_list order_{$vo.id}"> <div class="log_three_list_top"> <div class="log_three_list_top_left"> - <div class="log_three_list_top_lo"> - <img src="__TMPL__/public/assets/images/fangkuang.png" alt=""/> - </div> + <if condition="$vo.is_courier eq 1"> + <div class="log_three_list_top_lo"> + <img src="__TMPL__/public/assets/images/fangkuang.png" alt=""/> + </div> + </if> <div class="log_three_list_top_lt"> <div class="log_three_zhongbiao"> <img src="__TMPL__/public/assets/images/52.png" alt=""/> </div> <div class="log_three_shijian"> - {:date('Y-m-d H:i:s',$vo['create_time'])} + {$vo['pay_time']} </div> </div> </div> @@ -440,7 +452,8 @@ $(this).addClass("three_model_school_hover").addClass("word_color").addClass('aaa').siblings().removeClass("three_model_school_hover").removeClass("word_color").removeClass("aaa"); }); - $(".log_three_list_top_lo").click(function () { + $("body").on('click','.log_three_list_top_lo',function () { + console.log($(this).find("img").attr("src")); if ($(this).find("img").attr("src") == "__TMPL__/public/assets/images/fangkuang.png") { $(this).find("img").attr("src", "__TMPL__/public/assets/images/xuanzhong (1).png"); } else { @@ -498,27 +511,19 @@ }); $(".tx_mask_kuaidi .three_model_school_name").click(function() { var index = $(this).index(); - console.log($(this).text()); + $(this).addClass('there_unActive').siblings().removeClass('there_unActive'); $('.log_ps_title').text($(this).text()).css("color", "#333"); $(".tx_mask_kuaidi").hide(); + $('#logistic_name').val($(this).attr('data-name')) }); var index = $(".log_three_bottom").index(); - $(".log_three_bottom").click(function () { + $("body").on('click','.log_three_bottom',function () { console.log(index); $(".tx_maskone").css({ display: "block" }); }); - $(".tx_maskOk").click(function () { - $(".tx_maskone").css({ - display: "none" - }); - $(".tx_mask").css({ - display: "none" - }); - }); - //学校/弹窗 $(".log_three_select_school").click(function () { $(".tx_mask_school").css({ @@ -565,6 +570,7 @@ var school = $('#school').val(); var grade = $('#grade').val(); var state = $('.log_three_tab_top .aaa').attr('data-state'); + var is_courier = $('#is_courier').val(); console.log(state); // if (school == '') { // alert('请选择学校') @@ -576,7 +582,7 @@ $.ajax({ 'url': "{:url('order_salesman/getOrderSalesman')}", 'type': "GET", - 'data': {'school': school, 'grade': grade, 'state': state}, + 'data': {'school': school, 'grade': grade, 'state': state, 'is_courier':is_courier}, 'success': (function (data) { var index = $('.log_three_tab_top div').index($('.aaa')); if (data.code == 1) { @@ -628,29 +634,53 @@ " </div>\n" + " </div>"; } - html += "<div class=\"log_three_list\">\n" + - "\t\t\t\t\t\t\t<div class=\"log_three_list_top\">\n" + - "\t\t\t\t\t\t\t\t<div class=\"log_three_list_top_left\">\n" + - "\t\t\t\t\t\t\t\t\t<div class=\"log_three_list_top_lo\">\n" + - "\t\t\t\t\t\t\t\t\t\t<img src=\"__TMPL__/public/assets/images/fangkuang.png\" alt=\"\" />\n" + - "\t\t\t\t\t\t\t\t\t</div>\n" + - "\t\t\t\t\t\t\t\t\t<div class=\"log_three_list_top_lt\">\n" + - "\t\t\t\t\t\t\t\t\t\t<div class=\"log_three_zhongbiao\">\n" + - "\t\t\t\t\t\t\t\t\t\t\t<img src=\"__TMPL__/public/assets/images/52.png\" alt=\"\" />\n" + - "\t\t\t\t\t\t\t\t\t\t</div>\n" + - "\t\t\t\t\t\t\t\t\t\t<div class=\"log_three_shijian\">\n" + - "\t\t\t\t\t\t\t\t\t\t\t" + result[i].pay_time + "\n" + - "\t\t\t\t\t\t\t\t\t\t</div>\n" + - "\t\t\t\t\t\t\t\t\t</div>\n" + - "\t\t\t\t\t\t\t\t</div>\n" + - "\t\t\t\t\t\t\t\t<div class=\"log_three_list_top_right\">\n" + - "\t\t\t\t\t\t\t\t\t\t" + state + "\n" + - "\t\t\t\t\t\t\t\t</div>\n" + - "\t\t\t\t\t\t\t</div>\n" +indent_goods_html+ - "\t\t\t\t\t\t</div>"+html_bottom; + if(is_courier == 1){ + html += "<div class=\"log_three_list order_"+result[i].id+"\">\n" + + "\t\t\t\t\t\t\t<div class=\"log_three_list_top\">\n" + + "\t\t\t\t\t\t\t\t<div class=\"log_three_list_top_left\">\n" + + "\t\t\t\t\t\t\t\t\t<div class=\"log_three_list_top_lo\">\n" + + "\t\t\t\t\t\t\t\t\t\t<img src=\"__TMPL__/public/assets/images/fangkuang.png\" alt=\"\" />\n" + + "\t\t\t\t\t\t\t\t\t</div>\n" + + "\t\t\t\t\t\t\t\t\t<div class=\"log_three_list_top_lt\">\n" + + "\t\t\t\t\t\t\t\t\t\t<div class=\"log_three_zhongbiao\">\n" + + "\t\t\t\t\t\t\t\t\t\t\t<img src=\"__TMPL__/public/assets/images/52.png\" alt=\"\" />\n" + + "\t\t\t\t\t\t\t\t\t\t</div>\n" + + "\t\t\t\t\t\t\t\t\t\t<div class=\"log_three_shijian\">\n" + + "\t\t\t\t\t\t\t\t\t\t\t" + result[i].pay_time + "\n" + + "\t\t\t\t\t\t\t\t\t\t</div>\n" + + "\t\t\t\t\t\t\t\t\t</div>\n" + + "\t\t\t\t\t\t\t\t</div>\n" + + "\t\t\t\t\t\t\t\t<div class=\"log_three_list_top_right\">\n" + + "\t\t\t\t\t\t\t\t\t\t" + state + "\n" + + "\t\t\t\t\t\t\t\t</div>\n" + + "\t\t\t\t\t\t\t</div>\n" +indent_goods_html+ + "\t\t\t\t\t\t"+html_bottom+"</div>"; + }else if(is_courier == 2){ + html += "<div class=\"log_three_list order_"+result[i].id+"\">\n" + + "\t\t\t\t\t\t\t<div class=\"log_three_list_top\">\n" + + "\t\t\t\t\t\t\t\t<div class=\"log_three_list_top_left\">\n" + + // "\t\t\t\t\t\t\t\t\t<div class=\"log_three_list_top_lo\">\n" + + // "\t\t\t\t\t\t\t\t\t\t<img src=\"__TMPL__/public/assets/images/fangkuang.png\" alt=\"\" />\n" + + // "\t\t\t\t\t\t\t\t\t</div>\n" + + "\t\t\t\t\t\t\t\t\t<div class=\"log_three_list_top_lt\">\n" + + "\t\t\t\t\t\t\t\t\t\t<div class=\"log_three_zhongbiao\">\n" + + "\t\t\t\t\t\t\t\t\t\t\t<img src=\"__TMPL__/public/assets/images/52.png\" alt=\"\" />\n" + + "\t\t\t\t\t\t\t\t\t\t</div>\n" + + "\t\t\t\t\t\t\t\t\t\t<div class=\"log_three_shijian\">\n" + + "\t\t\t\t\t\t\t\t\t\t\t" + result[i].pay_time + "\n" + + "\t\t\t\t\t\t\t\t\t\t</div>\n" + + "\t\t\t\t\t\t\t\t\t</div>\n" + + "\t\t\t\t\t\t\t\t</div>\n" + + "\t\t\t\t\t\t\t\t<div class=\"log_three_list_top_right\">\n" + + "\t\t\t\t\t\t\t\t\t\t" + state + "\n" + + "\t\t\t\t\t\t\t\t</div>\n" + + "\t\t\t\t\t\t\t</div>\n" +indent_goods_html+ + "\t\t\t\t\t\t"+html_bottom+"</div>"; + } } $('.log_three_list_contant').eq(index).html(html); + update(); } else { alert('未知错误'); } @@ -707,7 +737,7 @@ } $('.confirm').attr('data-is_courier',is_courier); $('.confirm').attr('data-indent-id',indent_id); - $('.confirm').attr('data-is_courier',indent_id); + $('.confirm').attr('data-is_courier',is_courier); }) //点击确认 $("body").on('click','.confirm',function(){ @@ -720,19 +750,22 @@ if(is_courier == 1){ if(start_time == ''){ alert('请填写配送时间') - } - if(end_time == ''){ + return false; + }else if(end_time == ''){ alert('请填写配送时间') + return false; } }else if(is_courier == 2){ if(logistic_name == ''){ alert('请填写快递公司') - } - if(logistic_code == ''){ + return false; + }else if(logistic_code == ''){ alert('请填写快递单号') + return false; } }else if(is_courier == ''){ alert('未知错误') + return false; } $.ajax({ url:"{:url('order_salesman/send')}", @@ -740,6 +773,15 @@ data:{'start_time':start_time,'end_time':end_time,'logistic_name':logistic_name,'logistic_code':logistic_code,'is_courier':is_courier,'indent_id':indent_id}, success:function(res){ console.log(res); + if(res.code == 1){ + $('.order_'+indent_id).remove(); + $(".tx_maskone").css({ + display: "none" + }); + $(".tx_mask").css({ + display: "none" + }); + } alert(res.msg) }, error:function(res){ @@ -748,7 +790,18 @@ }) }); + update(); + }) + function update(){ + var is_courier = $('#is_courier').val(); + console.log(is_courier); + if(is_courier == 1){ + $('.log_three_list_fixed').show(); + }else if(is_courier == 2){ + $('.log_three_list_fixed').hide(); + } + } </script> </body>