商户 批发商户或批发零售商户列表

This commit is contained in:
liu 2024-03-15 14:37:32 +08:00
parent f2a93affe3
commit 10f2dbc871
4 changed files with 30 additions and 4 deletions

View File

@ -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;

View File

@ -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];

View File

@ -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;

View File

@ -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' => '审核',
]);