feat(CommissionProductLogic): updated calc logic for prod comm, added loss calc, & updated rel db fields
This commit is contained in:
parent
fe10a63fe0
commit
0718d0635b
@ -156,12 +156,20 @@ class CommissionProductLogic extends BaseLogic
|
||||
$purchase_price = bcmul($product['purchase'], $find['cart_num'], 2);
|
||||
$price = $product['cost'];
|
||||
|
||||
$rose=0;
|
||||
$rose_price = bcsub($product['cost'], $product['purchase'], 2);
|
||||
if ($rose_price > 0) {
|
||||
//利润除于零售
|
||||
$price_div = bcdiv($rose_price, $product['cost'], 2);
|
||||
$rose=bcmul($price_div, 100, 2);
|
||||
}
|
||||
|
||||
$platform_number = 0;
|
||||
$attrition_number = 0;
|
||||
if ($product['rose'] >= 6) {
|
||||
if ($rose >= 6) {
|
||||
$platform_number = bcmul($total_price, 0.02, 2); //平台
|
||||
}
|
||||
if ($product['rose'] >= 10) {
|
||||
if ($rose >= 10) {
|
||||
$attrition_number = bcmul($total_price, 0.02, 2); //损耗
|
||||
}
|
||||
//零售-供货价
|
||||
@ -181,10 +189,10 @@ class CommissionProductLogic extends BaseLogic
|
||||
}
|
||||
$data[] =$this->store('商户价门店',$order,$find,$price,$total_price,$store_number,$rate);
|
||||
//平台
|
||||
if ($product['rose'] >= 6) {
|
||||
if ($rose >= 6) {
|
||||
$data[] =$this->platform('商户价平台',$order,$find,$price,$total_price,$platform_number);
|
||||
}
|
||||
if ($product['rose'] >= 10) {
|
||||
if ($rose >= 10) {
|
||||
$data[] = $this->attrition('商户价损耗',$order,$find,$price,$total_price,$attrition_number);
|
||||
}
|
||||
(new StoreFinanceFlowProduct())->saveAll($data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user