更新下单流程

This commit is contained in:
mkm 2024-01-18 18:45:56 +08:00
parent d268290840
commit 593c763e16
5 changed files with 109 additions and 38 deletions

View File

@ -66,10 +66,15 @@ class StoreOrderBehalf extends BaseController
} else {
$where['status'] = ['=', $status];
}
$column = Db::name('store_order_behalf')->where('mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_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');
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');
}
if ($column) {
$where['order_id'] = $column;
}
if ($status == 0) {
$where['status'] = 2;
@ -78,7 +83,6 @@ class StoreOrderBehalf extends BaseController
}
$where['source'] = 103;
return app('json')->success($this->repository->getList($where, 1, $limit));
}
return app('json')->success([]);
}
@ -110,13 +114,41 @@ class StoreOrderBehalf extends BaseController
$mer_id = $this->request->merId();
if ($mer_id) {
$noPostage = Db::name('store_order_behalf')
->where('mer_id', $mer_id)->where('status',0)
->where('product_mer_id', $mer_id)->where('status', 0)
->count();
$noDeliver = Db::name('store_order_behalf')
->where('mer_id', $mer_id)->where('status',1)
->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

@ -150,6 +150,14 @@ Route::group(function () {
]
]);
//代发货订单
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');