refactor(admin): 优化前置订单处理逻辑
- 移除了不必要的采购价处理逻辑 - 删除了未使用的用户信息查询 - 简化了订单 ID 和验证码的生成过程
This commit is contained in:
parent
ff30059ddb
commit
74f5de71d6
@ -180,17 +180,6 @@ class BeforehandOrderLogic extends BaseLogic
|
||||
$product = StoreProduct::where('id', $v['product_id'])->find();
|
||||
$find = StoreProductLogic::ordinary($product, $params['store_id'], 0, $product);
|
||||
}
|
||||
if (in_array($order['order_type'], [2, 3])) {
|
||||
if (isset($v['purchase']) && $v['purchase'] > 0) {
|
||||
$purchase = $v['purchase'];
|
||||
} else {
|
||||
$purchase = StoreProduct::where('id', $v['product_id'])->withTrashed()->value('purchase');
|
||||
$find['purchase'] = $purchase;
|
||||
// $purchase = $v['price'];
|
||||
}
|
||||
$find->save(['price' => $v['price'], 'vip_price' => $v['price'], 'cost' => $v['price'], 'purchase' => $purchase]);
|
||||
}
|
||||
|
||||
|
||||
$cart_select[$k]['price'] = $v['price'];
|
||||
//判断如果采购价小于售价,则采购价等于售价
|
||||
@ -228,13 +217,10 @@ class BeforehandOrderLogic extends BaseLogic
|
||||
$cart_select[$k]['name'] = $find['store_name'];
|
||||
|
||||
$cart_select[$k]['store_id'] = $params['store_id'] ?? 0;
|
||||
|
||||
$total_price = bcadd($total_price, $total_prices, 2);
|
||||
$pay_price = bcadd($pay_price, $total_prices, 2);
|
||||
$cost_price = bcadd($pay_price, $cart_select[$k]['total_purchase'], 2);
|
||||
}
|
||||
$user = User::where('id', $params['user_id'])->find();
|
||||
|
||||
$order_id = getNewOrderId('PF');
|
||||
$code = rand(1, 10) . '-' . substr($order_id, -5);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user