__('Status 10'), '20' => __('Status 20'), '30' => __('Status 30'), '40' => __('Status 40'), '41' => __('Status 41'), '50' => __('Status 50'), '60' => __('Status 60'), '-10' => __('Status -10')]; } public function getDispatchTypeList() { return ['10' => __('Dispatch_type 10'), '11' => __('Dispatch_type 11'), '20' => __('Dispatch_type 20')]; } public function getStatusTextAttr($value, $data) { $value = $value ?: ($data['status'] ?? ''); $list = $this->getStatusList(); return $list[$value] ?? ''; } public function getCollectTextAttr($value, $data) { $value = $value ?: ($data['collect'] ?? ''); //$list = $this->getCollectList(); return $list[$value] ?? ''; } public function getDispatchTypeTextAttr($value, $data) { $value = $value ?: ($data['dispatch_type'] ?? ''); $list = $this->getDispatchTypeList(); return $list[$value] ?? ''; } protected function scopeTab($query, $tab=null) { $status = $this->tabStatus($tab); if(!empty($status)){ $query->whereIn('fa_order.status', $status); } return $query; } public function tabStatus($tab){ $tabStatus = [ self::TAB_DISPATCH => [10,20], //派单管理状态 self::TAB_PENDING => [20,30,40,41], //订单跟进状态 self::TAB_AUDIT => [50,60], //待审核 self::TAB_REVIEW => [60], ]; return $tabStatus[$tab] ?? []; } public function user(){ return $this->belongsTo(Admin::class,'admin_id',); } public function area(){ return $this->belongsTo(Area::class,'area_id','area_code'); } public function phone(){ return $this->belongsTo(Phones::class,'work_tel_id',); } }