|
@@ -5,7 +5,7 @@ namespace app\admin\controller;
|
|
|
use app\admin\BaseController;
|
|
|
use think\App;
|
|
|
use think\facade\Db;
|
|
|
-class sale extends BaseController{
|
|
|
+class Sale extends BaseController{
|
|
|
public function __construct(App $app) {parent::__construct($app);}
|
|
|
/** 获取列表
|
|
|
* @return \think\response\Json|void
|
|
@@ -21,19 +21,19 @@ class sale extends BaseController{
|
|
|
$size = isset($post['size'])&&$post['size']!==''?intval($post['size']):15;
|
|
|
$start =isset($post['start'])&&$post['start']!==''?trim($post['start']):'';
|
|
|
if($start!=''){
|
|
|
- $condition[]=["addtime",">=",$start." 00:00:00"];
|
|
|
+ $condition[]=["createdTime",">=",$start." 00:00:00"];
|
|
|
}
|
|
|
$end =isset($post['end'])&&$post['end']!==''?trim($post['end']):'';
|
|
|
if($end!=''){
|
|
|
- $condition[]=["addtime","<=",$end." 23:59:59"];
|
|
|
+ $condition[]=["createdTime","<=",$end." 23:59:59"];
|
|
|
}
|
|
|
$total_min = isset($post['total_min'])&&$post['total_min']!==''?floor($post['total_min']):'';
|
|
|
if($total_min!==''){
|
|
|
- $condition[]=["total_fee",">=",$total_min];
|
|
|
+ $condition[]=["totalPrice",">=",$total_min];
|
|
|
}
|
|
|
$total_max = isset($post['total_max'])&&$post['total_max']!==''?floor($post['total_max']):'';
|
|
|
if($total_max!==''){
|
|
|
- $condition[]=["total_fee","<=",$total_max];
|
|
|
+ $condition[]=["totalPrice","<=",$total_max];
|
|
|
}
|
|
|
$inv_status = isset($post['inv_status'])&&$post['inv_status']!==''?intval($post['inv_status']):'';
|
|
|
if($inv_status!==''){
|
|
@@ -42,10 +42,19 @@ class sale extends BaseController{
|
|
|
$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","=",$qrdNo];
|
|
|
+ $condition[]=["sequenceNo","like","%$qrdNo%"];
|
|
|
}
|
|
|
$department = isset($post['department'])&&$post['department']!=''?trim($post['department']):'';
|
|
|
if($department!==''){
|
|
@@ -53,11 +62,11 @@ class sale extends BaseController{
|
|
|
}
|
|
|
$customerNo = isset($post['customerNo'])&&$post['customerNo']!=''?trim($post['customerNo']):'';
|
|
|
if($customerNo!==''){
|
|
|
- $condition[]=["customerNo","=",$customerNo];
|
|
|
+ $condition[]=["customerNo","like","%$customerNo%"];
|
|
|
}
|
|
|
$customer = isset($post['customer'])&&$post['customer']!=''?trim($post['customer']):'';
|
|
|
if($customer!=''){
|
|
|
- $condition[]=["customer","like","%$customer%"];
|
|
|
+ $condition[]=["customerName","like","%$customer%"];
|
|
|
}
|
|
|
$platName = isset($post['platName'])&&$post['platName']!=''?trim($post['platName']):'';
|
|
|
if($platName!=''){
|
|
@@ -67,7 +76,12 @@ class sale extends BaseController{
|
|
|
$total = ceil($count/$size);
|
|
|
$page = $page>$total ? intval($total) : $page;
|
|
|
$list =Db::name("qrd_info")->where($condition)->page($page,$size)->select();
|
|
|
- return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
|
|
|
+ $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 无需汇款操作
|
|
@@ -84,6 +98,9 @@ class sale extends BaseController{
|
|
|
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")
|