123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- <?php
- declare (strict_types=1);
- namespace app\Admin\controller;
- use app\BaseController;
- use think\facade\Db;
- use think\Request;
- class Confirm extends BaseController
- {
- /**
- * 显示资源列表
- *
- * @return \think\Response
- */
- public function list()
- {
- $post = $this->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)
- {
- //
- }
- }
|