调整预订单转支付订单

This commit is contained in:
lewis 2025-01-03 11:44:45 +08:00
parent dfae914b6f
commit acd6f8b402

View File

@ -176,9 +176,12 @@ class BeforehandOrderLogic extends BaseLogic
public static function generateOrder(array $params): bool public static function generateOrder(array $params): bool
{ {
$order = BeforehandOrder::where('id', $params['id'])->find(); $order = BeforehandOrder::where('id', $params['id'])->find();
if ($order['order_type'] == 4) { if ($order['order_type'] == 4 || $order['order_type'] == 7) {
throw new BusinessException('该订单类型不能生成支付订单'); throw new BusinessException('该订单类型不能生成支付订单');
} }
if (!empty($order['order_sn'])) {
throw new BusinessException('当前订单已生成支付订单');
}
Db::startTrans(); Db::startTrans();
try { try {
$cart_info = BeforehandOrderCartInfo::where('bhoid', $params['id'])->select()->toArray(); $cart_info = BeforehandOrderCartInfo::where('bhoid', $params['id'])->select()->toArray();
@ -198,14 +201,14 @@ class BeforehandOrderLogic extends BaseLogic
} }
$cart_select[$k]['price'] = $v['price']; $cart_select[$k]['price'] = $v['price'];
//判断如果采购价小于售价,则采购价等于售 // //判断如果零售价小于供货价,则零售价等于供货
if ($v['price'] < $find['purchase'] && $find['purchase'] != 0) { // if ($v['price'] < $find['purchase'] && $find['purchase'] != 0) {
$cart_select[$k]['price'] = $find['purchase']; // $cart_select[$k]['price'] = $find['purchase'];
} // }
if ($user['user_ship'] == 4 && $find['cost'] != 0) { // if ($user['user_ship'] == 4 && $find['cost'] != 0) {
$cart_select[$k]['price'] = $find['cost']; // $cart_select[$k]['price'] = $find['cost'];
$total_prices = bcmul($find['cost'], $v['cart_num'], 2); // $total_prices = bcmul($find['cost'], $v['cart_num'], 2);
} // }
$cart_select[$k]['cost'] = $find['cost']; $cart_select[$k]['cost'] = $find['cost'];
$cart_select[$k]['purchase'] = $find['purchase']; $cart_select[$k]['purchase'] = $find['purchase'];
$cart_select[$k]['vip'] = 0; $cart_select[$k]['vip'] = 0;