request->param(); $condition = [['is_del',"=",0]]; $page = isset($post['page'])&&$post['page']!==''?intval($post['page']):1; $size = isset($post['size'])&&$post['size']!==''?intval($post['size']):15; $start =isset($post['start'])&&$post['start']!==''?trim($post['start']):''; if($start!=''){ $condition[]=["createdTime",">=",$start." 00:00:00"]; } $end =isset($post['end'])&&$post['end']!==''?trim($post['end']):''; if($end!=''){ $condition[]=["createdTime","<=",$end." 23:59:59"]; } $total_min = isset($post['total_min'])&&$post['total_min']!==''?floor($post['total_min']):''; if($total_min!==''){ $condition[]=["totalPrice",">=",$total_min]; } $total_max = isset($post['total_max'])&&$post['total_max']!==''?floor($post['total_max']):''; if($total_max!==''){ $condition[]=["totalPrice","<=",$total_max]; } $inv_status = isset($post['inv_status'])&&$post['inv_status']!==''?intval($post['inv_status']):''; if($inv_status!==''){ $condition[]=["inv_status","=",$inv_status]; } $pay_status = isset($post['pay_status'])&&$post['pay_status']!==''?intval($post['pay_status']):''; if($pay_status!==''){ $condition[]=["pay_status","=",$pay_status]; } $status = isset($post['status'])&&$post['status']!==''?intval($post['status']):''; if($status!==''){ if($status==3){ $condition[]=["status","<>",2]; }else{ $condition[]=["status","=",$status]; } } $qrdNo = isset($post['sequenceNo'])&&$post['sequenceNo']!=''?trim($post['sequenceNo']):''; if($qrdNo!==''){ $condition[]=["sequenceNo","like","%$qrdNo%"]; } $department = isset($post['department'])&&$post['department']!=''?trim($post['department']):''; if($department!==''){ $condition[]=["department","like","%$department%"]; } $customerNo = isset($post['customerNo'])&&$post['customerNo']!=''?trim($post['customerNo']):''; if($customerNo!==''){ $condition[]=["customerNo","like","%$customerNo%"]; } $customer = isset($post['customer'])&&$post['customer']!=''?trim($post['customer']):''; if($customer!=''){ $condition[]=["customerName","like","%$customer%"]; } $platName = isset($post['platName'])&&$post['platName']!=''?trim($post['platName']):''; if($platName!=''){ $condition[]=["platName","like","%$platName%"]; } $count =Db::name("qrd_info")->where($condition)->count(); $total = ceil($count/$size); $page = $page>$total ? intval($total) : $page; $list =Db::name("qrd_info")->where($condition)->page($page,$size)->select(); $data=[]; foreach ( $list as $ky=>$value){ $value['catInfo'] = json_decode($value['catInfo'],true); $data[]=$value; } return app_show(0,"获取成功",["list"=>$data,"count"=>$count]); } /** * 更改销售单状态 是否需要回款 0 未回款对账 1 回款对账 2 无需汇款操作 */ public function status(){ $post =$this->request->only(["sequenceNo"=>'',"status"=>0],"post","trim"); if($post['sequenceNo']==''){ return error_show(1004,"参数 sequenceNo 不能为空"); } if($post['status']===''){ return error_show(1004,"参数 status 不能为空"); } $qrdinfo =Db::name("qrd_info")->where("sequenceNo","=",$post['sequenceNo'])->findOrEmpty(); if(empty($qrdinfo)){ return error_show(1004,"未找到确认单信息"); } if ($qrdinfo['status']==1){ return error_show(1004,"确认单已参与对账"); } $update=[ "status"=>$post['status'], "updatetime"=>date("Y-m-d H:i:s") ]; $up =Db::name("qrd_info")->where($qrdinfo)->update($update); if($up){ return app_show(0,"更新成功"); }else{ return error_show(1003,"更新失败"); } } //确认单信息详情 public function saleinfo(){ $post=$this->post; $sequenceNo =isset($post['sequenceNo'])&&$post['sequenceNo']?trim($post['sequenceNo']):""; if($sequenceNo==''){ return error_show(1003,"参数 sequenceNo 不能为空"); } $qrdinfo =Db::name("qrd_info")->where("sequenceNo","=",$post['sequenceNo'])->findOrEmpty(); if(empty($qrdinfo)){ return error_show(1004,"未找到确认单信息"); } $qrdinfo['catInfo'] = json_decode($qrdinfo['catInfo'],true); return app_show(0,"获取成功",$qrdinfo); } }