request->post(); $token = isset($post['token']) ? trim($post['token']) : ""; if ($token == "") { return error_show(101, 'token不能为空'); } $effetc = VerifyTokens($token); if (!empty($effetc) && $effetc['code'] != 0) { return error_show($effetc['code'], $effetc['message']); } $guserinfo =GetUserInfo($token); if(isset($guserinfo['code']) && $guserinfo['code']!=0){ return error_show($guserinfo['code'],$guserinfo['message']); } $check = checkRole($guserinfo['data']['roleid'],53); $condition = []; if($check){ $condition[] =["sales_name", "=", $guserinfo['data']['nickname']]; } $no = isset($post['sequenceNo']) && $post['sequenceNo'] != "" ? trim($post['sequenceNo']) : ""; if ($no != "") { $condition[] = ["sequenceNo", "like", "%{$no}%"]; } $platform = isset($post['platform']) && $post['platform'] != "" ? trim($post['platform']) : ""; if ($platform != "") { $condition[] = ["depart", "like", "%{$platform}%"]; } $inv_status = isset($post['inv_status']) && $post['inv_status'] != "" ? trim($post['inv_status']) : ""; if ($inv_status != "") { $condition[] =$inv_status==4? ["inv_status", "in", [1,2]]:["inv_status", "=", "{$inv_status}"]; } $order_status = isset($post['pay_status']) && $post['pay_status'] != "" ? trim($post['pay_status']) : ""; if ($order_status != "") { $condition[] =$order_status==4?["pay_status", "in", [1,2]]:["pay_status", "=", "{$order_status}"]; } $company = isset($post['companyNo']) && $post['companyNo'] != "" ? trim($post['companyNo']) : ""; if ($company != "") { $condition[] = ["companyNo", "like", "%{$company}%"]; } $starttime = isset($post['starttime'])&&$post['starttime']!="" ? $post['starttime'] :""; if($starttime!=""){ $condition[] = ["createdTime",">=",$starttime]; } $endtime = isset($post['endtime'])&&$post['endtime']!="" ? $post['endtime']:""; if($endtime!=""){ $condition[] = ["createdTime","<=",$endtime]; } $total = isset($post['total_low'])&&$post['total_low']!="" ? $post['total_low']:""; if($total!=""){ $condition[] = ["total_fee",">=",$total]; } $total_up = isset($post['total_up'])&&$post['total_up']!="" ? $post['total_up']:""; if($total_up!=""){ $condition[] = ["total_fee","<=",$total_up]; } $inv_low = isset($post['inv_low'])&&$post['inv_low']!="" ? $post['inv_low']:""; if($inv_low!=""){ $condition[] = ["winv_fee",">=",$inv_low]; } $pay_up = isset($post['pay_up'])&&$post['pay_up']!="" ? $post['pay_up']:""; if($pay_up!=""){ $condition[] = ["wpay_fee","<=",$pay_up]; } $pay_low = isset($post['pay_low'])&&$post['pay_low']!="" ? $post['pay_low']:""; if($pay_low!=""){ $condition[] = ["wpay_fee",">=",$pay_low]; } $inv_up = isset($post['inv_up'])&&$post['inv_up']!="" ? $post['inv_up']:""; if($inv_up!=""){ $condition[] = ["winv_fee","<=",$inv_up]; } $page = isset($post['page']) && $post['page'] != "" ? intval($post['page']) : 1; $size = isset($post['size']) && $post['size'] != "" ? intval($post['size']) : 10; $count = Db::name("qrd")->where($condition)->count(); $total = ceil($count / $size) > 1 ? ceil($count / $size) : 1; $page = $page >= $total ? intval($total) : $page; $list = Db::name("qrd")->where($condition)->field("id,createdTime,companyNo,sequenceNo,sales_name,sales_depart,customer,total_fee,contactor,mobile,type,depart as platform,addr,apay_fee,wpay_fee,ainv_fee,winv_fee,pay_fee,inv_fee,pay_status,inv_status")->page (intval($page), $size)->order("createdTime desc")->select(); $data=[]; foreach ($list as $value){ $where=[["qrdNo","=",$value['sequenceNo']]]; if($order_status==4){ $where[]=['pay_status',"in",[1,2]]; } if($inv_status==4){ $where[]=['inv_status',"in",[1,2]]; } $good = Db::name("qrd_list")->where($where)->field("id,sequenceNo,goodname,goodNo,brand,unit,taxPoint,num,goldprice,weight,price,total_fee,touser,gys,kehu,apay_fee,wpay_fee,ainv_fee,winv_fee,paying_fee,inving_fee,pay_status,inv_status,inv_num") ->select()->toArray(); array_walk($good,function (&$val){ $val['goldprice'] =isset($val['goldprice']) ? sprintf("%.2f",$val['goldprice']):""; $val['price'] =isset($val['price']) ? sprintf("%.2f",$val['price']):""; $val['total_fee'] =isset($val['total_fee']) ? sprintf("%.2f",$val['total_fee']):""; $val['apay_fee'] = sprintf("%.2f",$val['apay_fee']); $val['wpay_fee'] = sprintf("%.2f",$val['wpay_fee']); $val['ainv_fee'] = sprintf("%.2f",$val['ainv_fee']); $val['winv_fee'] = sprintf("%.2f",$val['winv_fee']); $val['num'] = intval($val['num']); $val['inv_num'] = isset($val['inv_num']) ? sprintf("%d",$val['inv_num']):"0"; }); $value['good']=$good; $data[]=$value; } return app_show(0,"获取成功",['list'=>$data,"count"=>$count]); } /** * 显示创建资源表单页. * * @return \think\Response */ public function create() { } /** * 保存新建的资源 * * @param \think\Request $request * @return \think\Response */ public function save(Request $request) { // } /** * 显示指定的资源 * * @param int $id * @return \think\Response */ public function read($id) { // } /** * 显示编辑资源表单页. * * @param int $id * @return \think\Response */ public function edit($id) { // } /** * 保存更新的资源 * * @param \think\Request $request * @param int $id * @return \think\Response */ public function update(Request $request, $id) { // } /** * 删除指定资源 * * @param int $id * @return \think\Response */ public function delete($id) { // } }