|
@@ -7,6 +7,7 @@ use App\Model\Customer;
|
|
use App\Model\CustomerInfo;
|
|
use App\Model\CustomerInfo;
|
|
use App\Model\Depart;
|
|
use App\Model\Depart;
|
|
use App\Model\Employee;
|
|
use App\Model\Employee;
|
|
|
|
+use App\Model\FollowUpRecord;
|
|
use App\Model\Product;
|
|
use App\Model\Product;
|
|
use App\Model\SeeRange;
|
|
use App\Model\SeeRange;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\DB;
|
|
@@ -629,6 +630,21 @@ class CustomerService extends Service
|
|
->pluck('title','id')
|
|
->pluck('title','id')
|
|
->toArray();
|
|
->toArray();
|
|
|
|
|
|
|
|
+ //跟进记录
|
|
|
|
+ $record = FollowUpRecord::where('del_time',0)
|
|
|
|
+ ->where('type',FollowUpRecord::type_one)
|
|
|
|
+ ->whereIn('data_id',array_column($data['data'],'id'))
|
|
|
|
+ ->select('data_id',DB::raw('max(visit_time) as visit_time'))
|
|
|
|
+ ->groupBy('data_id')
|
|
|
|
+ ->pluck('visit_time','data_id')->toArray();
|
|
|
|
+ $record_array = [];
|
|
|
|
+ if(! empty($record)){
|
|
|
|
+ $now = time();
|
|
|
|
+ foreach ($record as $key => $value){
|
|
|
|
+ $record_array[$key] = $this->showTimeAgo($value, $now);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
$customer_info_map = [];
|
|
$customer_info_map = [];
|
|
if(! empty($ergs['customer_detail'])){
|
|
if(! empty($ergs['customer_detail'])){
|
|
$customer_info = CustomerInfo::where('del_time',0)
|
|
$customer_info = CustomerInfo::where('del_time',0)
|
|
@@ -684,6 +700,9 @@ class CustomerService extends Service
|
|
$data['data'][$key]['crt_name'] = $emp[$value['crt_id']] ?? '';
|
|
$data['data'][$key]['crt_name'] = $emp[$value['crt_id']] ?? '';
|
|
$data['data'][$key]['customer_detail'] = $customer_info_map[$value['id']] ?? [];
|
|
$data['data'][$key]['customer_detail'] = $customer_info_map[$value['id']] ?? [];
|
|
$data['data'][$key]['fz'] = $fz[$value['id']] ?? [];
|
|
$data['data'][$key]['fz'] = $fz[$value['id']] ?? [];
|
|
|
|
+ $record_tmp = $record_array[$value['id']] ?? "";
|
|
|
|
+ $data['data'][$key]['has_record'] = $record_tmp ? "查看" : "无记录";
|
|
|
|
+ $data['data'][$key]['follow_record'] = $record_array[$value['id']] ?? "";
|
|
}
|
|
}
|
|
|
|
|
|
return $data;
|
|
return $data;
|