|
|
|
|
@ -179,6 +179,11 @@ class OrderItems extends SoftDeletesModel
|
|
|
|
|
$this->factor_texts = $factor_texts;
|
|
|
|
|
|
|
|
|
|
if (!$this->product) {
|
|
|
|
|
// 没有 product 时设置默认值
|
|
|
|
|
if (!isset($this->paramedic_total) || $this->paramedic_total === null) {
|
|
|
|
|
$this->paramedic_total = $this->total ?? 0;
|
|
|
|
|
$this->fee = $this->fee ?? 0;
|
|
|
|
|
}
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -200,11 +205,21 @@ class OrderItems extends SoftDeletesModel
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!$factor) {
|
|
|
|
|
// 找不到因子时设置默认值
|
|
|
|
|
if (!isset($this->paramedic_total) || $this->paramedic_total === null) {
|
|
|
|
|
$this->paramedic_total = $this->total ?? 0;
|
|
|
|
|
$this->fee = $this->fee ?? 0;
|
|
|
|
|
}
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//todo:考虑不同项目的情况,目前是全部统一
|
|
|
|
|
if (!$this->order) {
|
|
|
|
|
// 没有 order 时设置默认值
|
|
|
|
|
if (!isset($this->paramedic_total) || $this->paramedic_total === null) {
|
|
|
|
|
$this->paramedic_total = $this->total ?? 0;
|
|
|
|
|
$this->fee = $this->fee ?? 0;
|
|
|
|
|
}
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -224,6 +239,14 @@ class OrderItems extends SoftDeletesModel
|
|
|
|
|
$this->fee = $fee;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 兜底逻辑:如果 paramedic_total 没有被设置,使用默认值
|
|
|
|
|
// 这通常发生在没有 product、fee_type 不是 "factor"、找不到因子或没有 order 的情况下
|
|
|
|
|
if (!isset($this->paramedic_total) || $this->paramedic_total === null) {
|
|
|
|
|
$this->paramedic_total = $this->total ?? 0;
|
|
|
|
|
$this->fee = $this->fee ?? 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|