|
|
@@ -105,15 +105,20 @@ class OwnerStoragePriceModelService
|
|
|
}
|
|
|
|
|
|
//暂时不考虑单位换算问题:后期可能存在多单位换算,此处仅视为单位为 m²,m³
|
|
|
- public function calculationAmount(OwnerStoragePriceModel $model, $area, $owner_id = null, $month = null)
|
|
|
+ public function calculationAmount(OwnerStoragePriceModel $model, $area, $owner_id = null, $month = null):array
|
|
|
{
|
|
|
/** @var \stdClass $model */
|
|
|
if (!$model || !$area || $model->operation) return array(0,null);
|
|
|
if ($area < $model->minimum_area) $area = $model->minimum_area;
|
|
|
+
|
|
|
+ $GLOBALS["FEE_INFO"]["fee_description"] .= "起租面积:".$model->minimum_area;
|
|
|
+
|
|
|
switch ($model->discount_type){
|
|
|
case "按单减免":
|
|
|
+ $GLOBALS["FEE_INFO"]["fee_description"] .= ",按单减免";
|
|
|
if ($owner_id && $month){
|
|
|
if ($model->timeUnit->name == '月'){
|
|
|
+ $GLOBALS["FEE_INFO"]["fee_description"] .= ":每".$model->discount_value."单/月 减免1".$model->unit->name ?? 'm²';
|
|
|
$report = OwnerReport::query()->select("id",DB::raw("(to_business_quantity+to_customer_quantity) AS total"))
|
|
|
->where("owner_id",$owner_id)
|
|
|
->where("counting_month","like",$month."%")->first();
|
|
|
@@ -125,6 +130,7 @@ class OwnerStoragePriceModelService
|
|
|
$logisticSql = "(''";
|
|
|
foreach ($logistics as $logistic)$logisticSql.=",".$logistic;
|
|
|
$logisticSql .= ")";
|
|
|
+ $GLOBALS["FEE_INFO"]["fee_description"] .= ":每".$model->discount_value."单/".$model->timeUnit->name." 减免1".$model->unit->name ?? 'm²';
|
|
|
for($i=1;$i<=$days;$i++){
|
|
|
$d = $i<10 ? "0".$i : $i;
|
|
|
$query = DB::raw("SELECT COUNT(1) c FROM orders WHERE logistic_id IN {$logisticSql} AND wms_status = ? AND wms_edittime BETWEEN ? AND ?");
|
|
|
@@ -135,6 +141,7 @@ class OwnerStoragePriceModelService
|
|
|
}
|
|
|
break;
|
|
|
case "固定减免":
|
|
|
+ $GLOBALS["FEE_INFO"]["fee_description"] .= ",固定减免:每".$model->timeUnit->name."减免".$model->discount_value.($model->unit->name ?? 'm²');
|
|
|
if ($model->timeUnit->name == '月'){
|
|
|
$area -= $model->discount_value;
|
|
|
}else{
|
|
|
@@ -151,8 +158,10 @@ class OwnerStoragePriceModelService
|
|
|
if ($total>=$model->amount_interval[$i])$index = $i;
|
|
|
}
|
|
|
}
|
|
|
+ $GLOBALS["FEE_INFO"]["fee_description"] .= ",单价: ".$model->price[$index]."/".($model->unit->name ?? 'm²')."/".$model->timeUnit->name;
|
|
|
$money = $area>0 ? $area*$model->price[$index] : 0;
|
|
|
$taxFee = app("OwnerService")->getTaxRateFee($model, $owner_id, $money);
|
|
|
+ $GLOBALS["FEE_INFO"]["fee_description"] .= ",税费: ".$taxFee;
|
|
|
return array($money,$taxFee);
|
|
|
}
|
|
|
}
|