refactor(purchase_product_offer): 重构采购产品报价逻辑
- 注释掉 ProductOffer::push($offer) 行,暂时不推送报价信息 - 在 catch 块中添加调试信息输出,便于排查错误 - 修复商户和供货商价格计算逻辑,优化价格计算过程
This commit is contained in:
parent
71d861dd78
commit
b2a3df87c4
@ -221,10 +221,11 @@ class PurchaseProductOfferLogic extends BaseLogic
|
|||||||
}else{
|
}else{
|
||||||
$offer['pay_type_name']='没设置';
|
$offer['pay_type_name']='没设置';
|
||||||
}
|
}
|
||||||
ProductOffer::push($offer);
|
// ProductOffer::push($offer);
|
||||||
return true;
|
return true;
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
|
d($e);
|
||||||
throw new BusinessException($e->getMessage());
|
throw new BusinessException($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -359,7 +360,7 @@ class PurchaseProductOfferLogic extends BaseLogic
|
|||||||
$storeProductGroupPrice = StoreProductGroupPrice::where('product_id', $product['id'])->select()->toArray();
|
$storeProductGroupPrice = StoreProductGroupPrice::where('product_id', $product['id'])->select()->toArray();
|
||||||
$storeProductGroupPrice = reset_index($storeProductGroupPrice, 'group_id');
|
$storeProductGroupPrice = reset_index($storeProductGroupPrice, 'group_id');
|
||||||
$purchase=0;
|
$purchase=0;
|
||||||
foreach ($storeProductGroupPrice as $k => $v) {
|
foreach ($productCatePriceRate as $k => $v) {
|
||||||
if ($v['id'] == 100001) {
|
if ($v['id'] == 100001) {
|
||||||
//供货
|
//供货
|
||||||
$data['purchase_lv'] = bcdiv($v['rate'], 100, 2);
|
$data['purchase_lv'] = bcdiv($v['rate'], 100, 2);
|
||||||
@ -368,13 +369,10 @@ class PurchaseProductOfferLogic extends BaseLogic
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($productCatePriceRate as $k => $v) {
|
foreach ($productCatePriceRate as $k => $v) {
|
||||||
if ($v['id'] == 4 &&$purchase>0) {
|
if ($v['id'] == 4 &&$purchase>0) {
|
||||||
//商户
|
//商户
|
||||||
$data['cost_lv'] = bcdiv($v['rate'], 100, 2);
|
$data['cost_lv'] = bcdiv($v['rate'], 100, 2);
|
||||||
$data['purchase_lv'] = bcdiv($v['rate'], 100, 2);
|
|
||||||
$purchase=bcmul($purchase, bcadd($data['purchase_lv'], 1, 2), 2);
|
|
||||||
$data['cost'] = bcmul($purchase, bcadd($data['cost_lv'], 1, 2), 2);
|
$data['cost'] = bcmul($purchase, bcadd($data['cost_lv'], 1, 2), 2);
|
||||||
continue;
|
continue;
|
||||||
}elseif ($v['id'] == 100002 &&$purchase>0) {
|
}elseif ($v['id'] == 100002 &&$purchase>0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user