客户下拉

This commit is contained in:
2025-09-02 15:42:30 +08:00
parent 36f9c82c8b
commit 4ad408c0b2
5 changed files with 59 additions and 3 deletions
+33
View File
@@ -164,6 +164,39 @@ class CustomerService
return $customer;
}
public function preset($params)
{
$keyword = $params['keyword'] ?? '';
$where = [];
$user_id =$params['user_id'];
$where[] = ['status', 1];
$where[] = ['user_id', $user_id];
if (!empty($countryId)){
$where[] = ['country_id', $countryId];
}
$query = Customer::select('id','code','sn','corp_id','email','phone','WhatsApp','contacts','company')->where($where);
if (!Util::isEmpty($keyword)) {
$query->where(function ($query) use ($keyword) {
$query->where('contacts', 'like', "%{$keyword}%")
->orWhere('phone', 'like', "%{$keyword}%")
->orWhere('email', 'like', "%{$keyword}%")
->orWhere('WhatsApp', 'like', "%{$keyword}%")
->orWhere('code', 'like', "%{$keyword}%");
});
}
$customer = $query->orderBy('follow_last','desc')->get();
foreach ($customer as &$item) {
}
unset($item);
return $customer;
}
/** 分页列表 */
public function serviceList(Request $request)