Merge pull request 'dev' (#461) from dev into main

Reviewed-on: #461
This commit is contained in:
mkm 2025-01-13 15:53:30 +08:00
commit c14fd650c4
4 changed files with 36 additions and 2 deletions

View File

@ -174,6 +174,16 @@ class BeforehandOrderController extends BaseAdminController
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
{
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%' => ['mark'],
'between_time' => 'create_time'
@ -75,6 +75,9 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
default:
break;
}
if (!empty($this->params['store_staff_id'])) {
$this->searchWhere[] = ['store_staff_id', '>', 0];
}
if ($order_rk!='') {
$oid=WarehouseOrder::where('financial_pm',1)->where('code','like','%'.$order_rk)->column('id');
$this->searchWhere[] = ['warehousing_id','in',$oid];
@ -236,6 +239,9 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
*/
public function count(): int
{
if (!empty($this->params['store_staff_id'])) {
$this->searchWhere[] = ['store_staff_id', '>', 0];
}
return BeforehandOrder::where($this->searchWhere)->count();
}
/**

View File

@ -604,6 +604,20 @@ class BeforehandOrderLogic extends BaseLogic
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 获取预订单表详情
@ -887,7 +901,7 @@ class BeforehandOrderLogic extends BaseLogic
$v['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name');
$v['store_name'] = $find['store_name'];
$v['mark'] = $find['after_sales'];
$v['purchase'] = StoreProductGroupPrice::where('product_id', $v['product_id'])->where('group_id', $user_ship)->value('price');
$v['purchase'] = $v['vip_price'];//StoreProductGroupPrice::where('product_id', $v['product_id'])->where('group_id', $user_ship)->value('price');
if ($v['purchase']) {
$v['pay_price'] = bcmul($v['purchase'], $v['nums'], 2);
} else {

View File

@ -59,6 +59,10 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
*/
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();
try {
$datas = [];