This commit is contained in:
luofei 2024-01-19 10:59:38 +08:00
commit 8d9c4d847a
5 changed files with 109 additions and 38 deletions

View File

@ -41,7 +41,7 @@ class StoreOrderBehalf extends BaseController
* @param App $app
* @param StoreOrderRepository $repository
*/
public function __construct(App $app, StoreOrderRepository $repository,StoreOrderDao $dao)
public function __construct(App $app, StoreOrderRepository $repository, StoreOrderDao $dao)
{
parent::__construct($app);
$this->repository = $repository;
@ -58,27 +58,31 @@ class StoreOrderBehalf extends BaseController
public function lst()
{
[$page, $limit] = $this->getPage();
$status = $this->request->param('status','all');
$status = $this->request->param('status', 'all');
$mer_id = $this->request->merId();
if ($mer_id) {
if($status=='all'){
$where['status']=['>=',0];
}else{
$where['status']=['=',$status];
if ($status == 'all') {
$where['status'] = ['>=', 0];
} else {
$where['status'] = ['=', $status];
}
$type_id = Db::name('merchant')->where('mer_id', $mer_id)->value('type_id');
$type_code = Db::name('merchant_type')->where('mer_type_id', $type_id)->value('type_code');
if($type_code=='TypeSupplyChain'){
$column = Db::name('store_order_behalf')->where('product_mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_id');
}else{
$column = Db::name('store_order_behalf')->where('master_mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_id');
}
$column = Db::name('store_order_behalf')->where('mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_id');
if ($column) {
$where['order_id'] = $column;
}
if ($status == 0) {
$where['status'] = 2;
} elseif ($status == 1) {
$where['status'] = 3;
}
$where['source']=103;
return app('json')->success($this->repository->getList($where,1, $limit));
$where['source'] = 103;
return app('json')->success($this->repository->getList($where, 1, $limit));
}
return app('json')->success([]);
}
@ -107,16 +111,44 @@ class StoreOrderBehalf extends BaseController
*/
public function number()
{
$mer_id=$this->request->merId();
$mer_id = $this->request->merId();
if ($mer_id) {
$noPostage = Db::name('store_order_behalf')
->where('mer_id', $mer_id)->where('status',0)
->count();
->where('product_mer_id', $mer_id)->where('status', 0)
->count();
$noDeliver = Db::name('store_order_behalf')
->where('mer_id', $mer_id)->where('status',1)
->count();
->where('product_mer_id', $mer_id)->where('status', 1)
->count();
}
return app('json')->success(compact('noDeliver', 'noPostage',));
}
/**
* 状态
*/
public function status($id)
{
$mer_id = $this->request->merId();
$status = $this->request->param('status');
$type_id = Db::name('merchant')->where('mer_id', $mer_id)->value('type_id');
$type_code = Db::name('merchant_type')->where('mer_type_id', $type_id)->value('type_code');
$res=0;
if ($status == 1) {
if($type_code=='TypeSupplyChain'){
$res = Db::name('store_order_behalf')->where('product_mer_id', $mer_id)
->where('id',$id)->where('status',0)->update(['status'=>1]);
}
}
if ($status == 3) {
if($type_code!='TypeSupplyChain'){
$res = Db::name('store_order_behalf')->where('master_mer_id', $mer_id)
->where('id',$id)->where('status',1)->update(['status'=>3]);
}
}
if($res){
return app('json')->success('设置成功');
}else{
return app('json')->fail('设置失败');
}
}
}

View File

@ -151,4 +151,34 @@ class StoreOrderBehalf extends BaseController
}
return app('json')->success(compact('noDeliver', 'noPostage',));
}
/**
* 状态
*/
public function status($id)
{
$uid = $this->request->userInfo()['uid'];
$status = $this->request->param('status');
$mer_id = Db::name('store_service')->where('uid', $uid)->where('is_del', 0)->value('mer_id');
$type_id = Db::name('merchant')->where('mer_id', $mer_id)->value('type_id');
$type_code = Db::name('merchant_type')->where('mer_type_id', $type_id)->value('type_code');
$res=0;
if ($status == 1) {
if($type_code=='TypeSupplyChain'){
$res = Db::name('store_order_behalf')->where('product_mer_id', $mer_id)
->where('id',$id)->where('status',0)->update(['status'=>1]);
}
}
if ($status == 3) {
if($type_code!='TypeSupplyChain'){
$res = Db::name('store_order_behalf')->where('master_mer_id', $mer_id)
->where('id',$id)->where('status',1)->update(['status'=>3]);
}
}
if($res){
return app('json')->success('设置成功');
}else{
return app('json')->fail('设置失败');
}
}
}

View File

@ -29,7 +29,7 @@ class StoreOrder extends BaseController
'product_source_id' => $find['product_source_id'],
'order_id' => $order['order_id'],
'delivery' => 0,
'status' => 1,
'status' => 0,
];
Db::name('store_order_behalf')->insert($datas);
}

View File

@ -45,16 +45,16 @@ Route::group(function () {
})->prefix('admin.order.')->option([
'_path' => '/order/list',
'_auth' => true,
'_append'=> [
'_append' => [
[
'_name' =>'systemStoreExcelLst',
'_path' =>'/order/list',
'_name' => 'systemStoreExcelLst',
'_path' => '/order/list',
'_alias' => '导出列表',
'_auth' => true,
],
[
'_name' =>'systemStoreExcelDownload',
'_path' =>'/order/list',
'_name' => 'systemStoreExcelDownload',
'_path' => '/order/list',
'_alias' => '导出列表',
'_auth' => true,
],
@ -65,13 +65,13 @@ Route::group(function () {
Route::get('take_title', 'Order/takeTitle')->name('systemOrderTakeStat')->option([
'_alias' => '核销',
]);
]);
Route::get('takelst', 'Order/getTakeList')->name('systemTakeOrderLst')->option([
'_alias' => '核销订单',
]);
]);
Route::get('takechart', 'Order/takeChart')->name('systemTakeOrderTitle')->option([
'_alias' => '头部统计',
]);
]);
})->prefix('admin.order.')->option([
'_path' => '/order/cancellation',
'_auth' => true,
@ -80,23 +80,23 @@ Route::group(function () {
Route::group('order', function () {
Route::get('refund/lst', 'RefundOrder/getAllList')->name('systemRefundOrderLst')->option([
'_alias' => '列表',
]);
]);
Route::get('refund/excel', 'RefundOrder/Excel')->name('systemRefundOrderExcel')->option([
'_alias' => '导出',
]);
]);
})->prefix('admin.order.')->option([
'_path' => '/order/refund',
'_auth' => true,
'_append'=> [
'_append' => [
[
'_name' =>'systemStoreExcelLst',
'_path' =>'/order/refund',
'_name' => 'systemStoreExcelLst',
'_path' => '/order/refund',
'_alias' => '导出列表',
'_auth' => true,
],
[
'_name' =>'systemStoreExcelDownload',
'_path' =>'/order/refund',
'_name' => 'systemStoreExcelDownload',
'_path' => '/order/refund',
'_alias' => '导出下载',
'_auth' => true,
],
@ -134,22 +134,30 @@ Route::group(function () {
})->prefix('admin.order.')->option([
'_path' => '/order/list',
'_auth' => true,
'_append'=> [
'_append' => [
[
'_name' =>'systemStoreExcelLst',
'_path' =>'/order/list',
'_name' => 'systemStoreExcelLst',
'_path' => '/order/list',
'_alias' => '导出列表',
'_auth' => true,
],
[
'_name' =>'systemStoreExcelDownload',
'_path' =>'/order/list',
'_name' => 'systemStoreExcelDownload',
'_path' => '/order/list',
'_alias' => '导出列表',
'_auth' => true,
],
]
]);
//代发货订单
Route::group('behalf_admin', function () {
Route::get('/order_list', '/lst');
Route::get('/code', '/logisticsCode');
Route::get('/number', '/number');
Route::post('/status', '/status');
})->prefix('admin.order.StoreOrderBehalf');
})->middleware(AllowOriginMiddleware::class)
->middleware(AdminTokenMiddleware::class, true)
->middleware(AdminAuthMiddleware::class)

View File

@ -388,6 +388,7 @@ Route::group('api/', function () {
Route::get('/order_list', '/lst');
Route::get('/code', '/logisticsCode');
Route::get('/number', '/number');
Route::post('/status', '/status');
})->prefix('api.store.order.StoreOrderBehalf');
//管理员申请转账
Route::get('admin/:merId/apply', 'api.store.merchant.Merchant/apply');