diff --git a/app/common/dao/system/merchant/MerchantIntentionDao.php b/app/common/dao/system/merchant/MerchantIntentionDao.php index b9b18c08..70745666 100644 --- a/app/common/dao/system/merchant/MerchantIntentionDao.php +++ b/app/common/dao/system/merchant/MerchantIntentionDao.php @@ -41,8 +41,8 @@ class MerchantIntentionDao extends BaseDao $query->where('mer_name|phone|mark', 'like', '%' . $where['keyword'] . '%'); })->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) { getModelTime($query, $where['date']); - })->when(isset($where['is_change']) && $where['is_change'] !== '', function ($query) use ($where) { - $query->where('is_change', $where['is_change']); + })->when(isset($where['type']) && $where['type'] !== '', function ($query) use ($where) { + $query->whereIn('type', $where['type']); })->where('is_del', 0); return $query; diff --git a/app/common/repositories/system/merchant/MerchantIntentionRepository.php b/app/common/repositories/system/merchant/MerchantIntentionRepository.php index 43219a89..321e7144 100644 --- a/app/common/repositories/system/merchant/MerchantIntentionRepository.php +++ b/app/common/repositories/system/merchant/MerchantIntentionRepository.php @@ -45,6 +45,18 @@ class MerchantIntentionRepository extends BaseRepository return compact('count', 'list'); } + public function getMoreList(array $where, $page, $limit) + { + $query = $this->dao->search($where); + $count = $query->count(); + $list = $query->page($page, $limit) + ->order('create_time DESC , status ASC')->with(['merchantCategory', 'merchantType']) + ->select(); + return compact('count', 'list'); + } + + + public function detail($id, ?int $uid) { $where = ['mer_intention_id' => $id]; diff --git a/app/controller/admin/system/merchant/MerchantIntention.php b/app/controller/admin/system/merchant/MerchantIntention.php index ca6c2b84..9624f2b8 100644 --- a/app/controller/admin/system/merchant/MerchantIntention.php +++ b/app/controller/admin/system/merchant/MerchantIntention.php @@ -38,10 +38,21 @@ class MerchantIntention extends BaseController public function lst() { [$page, $limit] = $this->getPage(); - $where = $this->request->params(['mer_name', 'status', 'date', 'keyword', 'mer_intention_id', 'category_id', 'type_id', 'type','is_change']); + $where = $this->request->params(['mer_name', 'status', 'date', 'keyword', 'mer_intention_id', 'category_id', 'type_id', 'type']); return app('json')->success($this->repository->getList($where, $page, $limit)); } + //批发零售列表 + public function list() + { + [$page, $limit] = $this->getPage(); + $where = $this->request->params(['mer_name', 'status', 'date', 'keyword', 'mer_intention_id', 'category_id', 'type_id', 'type']); + $where['type'] = [3,4];//批发零售 + return app('json')->success($this->repository->getMoreList($where, $page, $limit)); + } + + + public function form($id) { if (!$this->repository->getWhereCount(['mer_intention_id' => $id, 'is_del' => 0])) @@ -81,7 +92,6 @@ class MerchantIntention extends BaseController { if (!$this->repository->getWhereCount(['mer_intention_id' => $id, 'is_del' => 0])) return app('json')->fail('数据不存在'); - $data = $this->request->params(['status','mer_type_id','uid']); if(empty($data['status']) || empty($data['mer_type_id']) || empty($data['uid']) ) return app('json')->fail('缺失参数'); $data['wholesale'] = 0; diff --git a/route/admin/merchant.php b/route/admin/merchant.php index 5f70b5d3..91e9ca35 100644 --- a/route/admin/merchant.php +++ b/route/admin/merchant.php @@ -59,6 +59,10 @@ Route::group(function () { Route::get('lst', '/lst')->name('systemMerchantIntentionLst')->option([ '_alias' => '列表', ]); + Route::get('list', '/list')->name('systemMerchantIntentionList')->option([ + '_alias' => '批发和零售申请列表', + ]); + Route::post('status/:id', '/switchStatus')->name('systemMerchantIntentionStatus')->option([ '_alias' => '审核', ]);