添加确认预订单

This commit is contained in:
lewis 2025-01-13 11:14:26 +08:00
parent 5d73af5719
commit cce18cfcd5
4 changed files with 35 additions and 1 deletions

View File

@ -174,6 +174,16 @@ class BeforehandOrderController extends BaseAdminController
return $this->data($result); return $this->data($result);
} }
/**
* @notes 确认预订单
*/
public function confirm()
{
$params = $this->request->post();
BeforehandOrderLogic::confirm($params);
return $this->success('确认成功', [], 1, 1);
}
/** /**
* 导出标签 * 导出标签
*/ */

View File

@ -34,7 +34,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
public function setSearch(): array public function setSearch(): array
{ {
return [ return [
'=' => ['store_id', 'paid', 'status', 'order_type', 'admin_id', 'store_staff_id'], '=' => ['store_id', 'paid', 'status', 'order_type', 'admin_id'],
'%like' => ['order_id','order_sn'], '%like' => ['order_id','order_sn'],
'%like%' => ['mark'], '%like%' => ['mark'],
'between_time' => 'create_time' 'between_time' => 'create_time'
@ -75,6 +75,9 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
default: default:
break; break;
} }
if (!empty($this->params['store_staff_id'])) {
$this->searchWhere[] = ['store_staff_id', '>', 0];
}
if ($order_rk!='') { if ($order_rk!='') {
$oid=WarehouseOrder::where('financial_pm',1)->where('code','like','%'.$order_rk)->column('id'); $oid=WarehouseOrder::where('financial_pm',1)->where('code','like','%'.$order_rk)->column('id');
$this->searchWhere[] = ['warehousing_id','in',$oid]; $this->searchWhere[] = ['warehousing_id','in',$oid];
@ -236,6 +239,9 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
*/ */
public function count(): int public function count(): int
{ {
if (!empty($this->params['store_staff_id'])) {
$this->searchWhere[] = ['store_staff_id', '>', 0];
}
return BeforehandOrder::where($this->searchWhere)->count(); return BeforehandOrder::where($this->searchWhere)->count();
} }
/** /**

View File

@ -604,6 +604,20 @@ class BeforehandOrderLogic extends BaseLogic
return $res; return $res;
} }
/**
* @notes 确认预订单
* @param array $params
* @return bool
*/
public static function confirm(array $params): bool
{
$res = BeforehandOrder::find($params['id']);
if (!empty($res) && $res['is_confirm'] == 0) {
BeforehandOrder::where('id', $params['id'])->update(['is_confirm' => 1]);
}
return true;
}
/** /**
* @notes 获取预订单表详情 * @notes 获取预订单表详情

View File

@ -59,6 +59,10 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
*/ */
public static function appendAdd(array $params): bool public static function appendAdd(array $params): bool
{ {
$order = BeforehandOrder::where('id', $params['id'])->find();
if (!empty($order) && $order->is_confirm == 1) {
throw new BusinessException('该订单已确认,不能追加商品');
}
Db::startTrans(); Db::startTrans();
try { try {
$datas = []; $datas = [];