...
|
...
|
@@ -347,14 +347,15 @@ class Aftersale extends Backend |
|
|
private function buildSearchOrder() {
|
|
|
$search = $this->request->get("search", ''); // 关键字
|
|
|
$status = $this->request->get("status", 'all');
|
|
|
$createtime = $this->request->get("createtime/a");
|
|
|
|
|
|
$orders = $this->orderModel->withTrashed();
|
|
|
|
|
|
$orders = $orders->whereExists(function ($query) use ($search, $status) {
|
|
|
$orders = $orders->whereExists(function ($query) use ($search, $status, $createtime) {
|
|
|
extract($this->getModelTable());
|
|
|
$aftersales = $query->table($aftersaleName)->where($aftersaleName . '.order_id=' . $orderName . '.id');
|
|
|
|
|
|
$aftersales = $this->aftersaleSearch($aftersales, $search, $status);
|
|
|
$aftersales = $this->aftersaleSearch($aftersales, $search, $status, $createtime);
|
|
|
|
|
|
return $aftersales;
|
|
|
});
|
...
|
...
|
@@ -363,7 +364,7 @@ class Aftersale extends Backend |
|
|
}
|
|
|
|
|
|
|
|
|
private function aftersaleSearch($aftersales, $search, $status) {
|
|
|
private function aftersaleSearch($aftersales, $search, $status, $createtime) {
|
|
|
extract($this->getModelTable());
|
|
|
|
|
|
if ($search) {
|
...
|
...
|
@@ -396,6 +397,19 @@ class Aftersale extends Backend |
|
|
}
|
|
|
}
|
|
|
|
|
|
// 申请时间
|
|
|
if ($createtime) {
|
|
|
$sym = 'BETWEEN';
|
|
|
if ($createtime[0] === '') {
|
|
|
$sym = '<=';
|
|
|
$createtime = $createtime[1];
|
|
|
} elseif ($createtime[1] === '') {
|
|
|
$sym = '>=';
|
|
|
$createtime = $createtime[0];
|
|
|
}
|
|
|
$aftersales = $aftersales->where('createtime',$sym . ' TIME',$createtime);
|
|
|
}
|
|
|
|
|
|
// 经销商
|
|
|
$dealer = [];
|
|
|
$group_id_arr = array_column($this->auth->getGroups(), 'group_id');
|
...
|
...
|
|