Compare commits

..

1 Commits

Author SHA1 Message Date
mkm
d02691ccd1 更新 app/api/lists/order/CartList.php 2025-04-02 16:11:10 +08:00
2 changed files with 17 additions and 6 deletions

View File

@ -968,14 +968,25 @@ class BeforehandOrderLogic extends BaseLogic
$v['store_name'] = $find['store_name'];
$v['mark'] = $find['after_sales'];
if (isset($params['type']) && $params['type'] == 2) {
$v['price'] = $v['vip_price']; //出库单价
$v['purchase'] = $v['cost']; //高级会员单,供货价=商户价
$price = $v['cost'];
$v['pay_price'] = bcmul($price, $v['nums'], 2);
} else {
$v['purchase'] = $v['vip_price'] > 0 ? $v['vip_price'] : $v['price']; //会员单,供货价=会员价
if ($v['vip_price'] > 0) {
$v['pay_price'] = bcmul($v['vip_price'], $v['nums'], 2);
$price = $v['vip_price'];
} 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);
} else {
$price = $find['cost'];
$v['pay_price'] = bcmul($price, $v['nums'], 2);
}
WarehouseProduct::where('id', $v['id'])->update(['vip_price' => $price]);
}
}
$v['total_price'] = bcmul($v['price'], $v['nums'], 2); //出库总价
$v['pay_price'] = bcmul($v['purchase'], $v['nums'], 2); //供货总价
$v['purchase'] = $price;
$v['profit'] = bcsub($v['total_price'], $v['pay_price'], 2);
$total_profit = bcadd($total_profit, $v['profit'], 2);
$pay_price = bcadd($pay_price, $v['pay_price'], 2);