|
@@ -549,10 +549,24 @@ class ConstructionService extends Service
|
|
public function constructionList($data,$user){
|
|
public function constructionList($data,$user){
|
|
$model = Construction::Clear($user,$data);
|
|
$model = Construction::Clear($user,$data);
|
|
$model = $model->where('del_time',0)
|
|
$model = $model->where('del_time',0)
|
|
- ->select('title','id','model_type','order_number','customer_id','customer_contact_id','install_method','install_position','sales_order_id','construction_fee','construction_time','handover_time','urgency','crt_id','crt_time','mark','state','address1','address2','introduction','service_price','storehouse_id','start_time','end_time','pq_state','day_start_stamp','day_end_stamp')
|
|
|
|
->orderby('id', 'desc');
|
|
->orderby('id', 'desc');
|
|
-
|
|
|
|
- if(isset($data['state'])) $model->where('state', $data['state']);
|
|
|
|
|
|
+ if(empty($data['select_field'])){
|
|
|
|
+ $model->select('title','id','model_type','order_number','customer_id','customer_contact_id','install_method','install_position','sales_order_id','construction_fee','construction_time','handover_time','urgency','crt_id','crt_time','mark','state','address1','address2','introduction','service_price','storehouse_id','start_time','end_time','pq_state','day_start_stamp','day_end_stamp');
|
|
|
|
+ }else{
|
|
|
|
+ $model->select('sales_order_id');
|
|
|
|
+ }
|
|
|
|
+ if(isset($data['state'])) {
|
|
|
|
+ $today_stamp = strtotime(date("Y-m-d H:i:00"));
|
|
|
|
+ if($data['state'] == Construction::STATE_DIFF_TWO){
|
|
|
|
+ $model->where('state', Construction::STATE_TWO);
|
|
|
|
+ $model->where('start_time', '>', $today_stamp);
|
|
|
|
+ }elseif($data['state'] == Construction::STATE_TWO){
|
|
|
|
+ $model->where('state', Construction::STATE_TWO);
|
|
|
|
+ $model->where('start_time', '<=', $today_stamp);
|
|
|
|
+ }else{
|
|
|
|
+ $model->where('state', $data['state']);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if(isset($data['pq_state'])) $model->where('pq_state', $data['pq_state']);
|
|
if(isset($data['pq_state'])) $model->where('pq_state', $data['pq_state']);
|
|
if(! empty($data['title'])) $model->where('title', 'LIKE', '%'.$data['title'].'%');
|
|
if(! empty($data['title'])) $model->where('title', 'LIKE', '%'.$data['title'].'%');
|
|
if(! empty($data['model_type'])) $model->where('model_type',$data['model_type']);
|
|
if(! empty($data['model_type'])) $model->where('model_type',$data['model_type']);
|
|
@@ -596,6 +610,7 @@ class ConstructionService extends Service
|
|
}
|
|
}
|
|
if(! empty($data['order_number'])) $model->where('order_number', 'LIKE', '%'.$data['order_number'].'%');
|
|
if(! empty($data['order_number'])) $model->where('order_number', 'LIKE', '%'.$data['order_number'].'%');
|
|
|
|
|
|
|
|
+ if(! empty($data['select_field'])) return $model->get()->toArray();
|
|
$list = $this->limit($model,'',$data);
|
|
$list = $this->limit($model,'',$data);
|
|
$list = $this->fillData($list);
|
|
$list = $this->fillData($list);
|
|
|
|
|
|
@@ -815,6 +830,7 @@ class ConstructionService extends Service
|
|
}
|
|
}
|
|
|
|
|
|
public function makeState($value, $state_array){
|
|
public function makeState($value, $state_array){
|
|
|
|
+ $today_stamp = strtotime(date("Y-m-d H:i:00"));
|
|
if(! empty($state_array[$value['order_number']])){
|
|
if(! empty($state_array[$value['order_number']])){
|
|
$return = $state_array[$value['order_number']];
|
|
$return = $state_array[$value['order_number']];
|
|
if($value['state'] == Construction::State_minus_one){
|
|
if($value['state'] == Construction::State_minus_one){
|
|
@@ -824,6 +840,8 @@ class ConstructionService extends Service
|
|
}
|
|
}
|
|
}elseif($value['state'] == Construction::STATE_ZERO){
|
|
}elseif($value['state'] == Construction::STATE_ZERO){
|
|
$state = "待" . $value['crt_name'] . "提交";
|
|
$state = "待" . $value['crt_name'] . "提交";
|
|
|
|
+ }elseif($value['state'] == Construction::STATE_TWO && $value['start_time'] > $today_stamp){
|
|
|
|
+ $state = Construction::$name[Construction::STATE_DIFF_TWO] ?? '';
|
|
}else{
|
|
}else{
|
|
$state = Construction::$name[$value['state']] ?? '';
|
|
$state = Construction::$name[$value['state']] ?? '';
|
|
}
|
|
}
|