修改预订单导出

This commit is contained in:
lewis 2025-03-15 11:18:26 +08:00
parent f27d25311a
commit a8acf3ae67
2 changed files with 17 additions and 9 deletions

View File

@ -431,6 +431,7 @@ class BeforehandOrderLogic extends BaseLogic
// } else {
// $price = StoreProductGroupPrice::where('product_id', $arr['product_id'])->where('group_id', $user_ship)->value('price') ?? 0;
// }
$cost = StoreProduct::where('id', $arr['product_id'])->withTrashed()->value('cost') ?? 0;
$data = [
'warehouse_id' => $warehouse_id,
'product_id' => $arr['product_id'],
@ -443,6 +444,7 @@ class BeforehandOrderLogic extends BaseLogic
'admin_id' => $admin_id,
'total_price' => $arr['total_price'],
'price' => $arr['price'],
'cost' => $cost,
'vip_price' => StoreProduct::where('id',$arr['product_id'])->withTrashed()->value('vip_price') ?? 0,
'purchase' => $arr['purchase'],
'oid' => $res['id'],
@ -958,18 +960,23 @@ 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'];
if ($v['vip_price'] > 0) {
$v['pay_price'] = bcmul($v['vip_price'], $v['nums'], 2);
$price =$v['vip_price'];
if (isset($params['type']) && $params['type'] == 2) {
$price = $v['cost'];
$v['pay_price'] = bcmul($price, $v['nums'], 2);
} else {
$price = StoreProductGroupPrice::where('product_id', $v['product_id'])->where('group_id', $user_ship)->value('price');
if ($price > 0) {
$v['pay_price'] = bcmul($price, $v['nums'], 2);
if ($v['vip_price'] > 0) {
$v['pay_price'] = bcmul($v['vip_price'], $v['nums'], 2);
$price = $v['vip_price'];
} else {
$price = $find['cost'];
$v['pay_price'] = bcmul($price, $v['nums'], 2);
$price = StoreProductGroupPrice::where('product_id', $v['product_id'])->where('group_id', $user_ship)->value('price');
if ($price > 0) {
$v['pay_price'] = bcmul($price, $v['nums'], 2);
} else {
$price = $find['cost'];
$v['pay_price'] = bcmul($price, $v['nums'], 2);
}
WarehouseProduct::where('id', $v['id'])->update(['vip_price' => $price]);
}
WarehouseProduct::where('id', $v['id'])->update(['vip_price' => $price]);
}
$v['purchase'] = $price;

View File

@ -176,6 +176,7 @@ class WarehouseProductLogic extends BaseLogic
'price' => $params['price'] ?? 0,
'purchase' => $params['purchase'] ?? 0,
'vip_price' => $params['vip_price'] ?? 0,
'cost' => $params['cost'] ?? 0,
'total_price' => $params['total_price'] ?? 0,
'admin_id' => $params['admin_id'],
'code' => $params['code'] ?? '',