修改预订单追加商品
This commit is contained in:
parent
95a145db70
commit
7711ac417d
@ -54,6 +54,7 @@ class BeforehandOrderCartInfoController extends BaseAdminController
|
||||
public function append_add()
|
||||
{
|
||||
$params = $this->request->post();
|
||||
$params['admin_id']=$this->adminId;
|
||||
$result = BeforehandOrderCartInfoLogic::appendAdd($params);
|
||||
return $this->success('追加成功', [], 1, 1);
|
||||
|
||||
|
@ -61,7 +61,7 @@ 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) {
|
||||
if (!empty($order) && $order->is_confirm == 1 && empty($params['admin_id'])) {
|
||||
throw new BusinessException('该订单已确认,不能追加商品');
|
||||
}
|
||||
Db::startTrans();
|
||||
@ -358,7 +358,7 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
||||
if ($purchaseProductOffer['is_storage'] == 1) {
|
||||
throw new BusinessException('商品已入库');
|
||||
}
|
||||
$beforehandOrder = BeforehandOrder::where('id', $params['bhoid'])->field('id,order_type,warehousing_id')->find();
|
||||
$beforehandOrder = BeforehandOrder::where('id', $params['bhoid'])->field('id,order_type,warehousing_id,is_warehousing')->find();
|
||||
|
||||
$completed_amount = PurchaseProductOffer::where(['order_id' => $params['bhoid'], 'pay_type' => 1, 'is_storage' => 1])->sum('total_price');
|
||||
$outstanding_amount = PurchaseProductOffer::where(['order_id' => $params['bhoid'], 'pay_type' => 2, 'is_storage' => 1])->sum('total_price');
|
||||
@ -420,9 +420,9 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
||||
$attrs['is_buying'] = 1;
|
||||
}
|
||||
$result = BeforehandOrder::where('id', $params['bhoid'])->where('warehousing_id', 0)->where('is_warehousing', 0)->update($attrs);
|
||||
// if (!$result) {
|
||||
// throw new BusinessException('入库失败,预订单更新出错');
|
||||
// }
|
||||
if (!$result) {
|
||||
throw new BusinessException('入库失败,预订单更新出错');
|
||||
}
|
||||
}
|
||||
$purchaseProductOffer['purchase']=$purchaseProductOffer['price'];
|
||||
$product = StoreProduct::where('id', $purchaseProductOffer['product_id'])->withTrashed()->field('id,store_name,top_cate_id,two_cate_id,cate_id')->find();
|
||||
|
Loading…
x
Reference in New Issue
Block a user