更新
This commit is contained in:
@@ -471,6 +471,27 @@ class PrescriptionLogic
|
||||
->count() > 0;
|
||||
$arr['has_prescription_order'] = $hasBizOrder ? 1 : 0;
|
||||
|
||||
/**
|
||||
* 处方笺展示所需的"收件信息/订单号/合计"等字段,
|
||||
* 来源是该处方关联的「业务处方订单」(zyt_tcm_prescription_order)。
|
||||
* 取最近一条未删除且未取消的订单:
|
||||
* - recipient_name / recipient_phone / shipping_address 用于「收件信息」一行
|
||||
* - order_no 用于处方笺右上角「编号」
|
||||
* - amount 作为「合计」金额回填(前端再做 0 兜底展示)
|
||||
*/
|
||||
$latestPo = PrescriptionOrder::where('prescription_id', $id)
|
||||
->whereNull('delete_time')
|
||||
->where('fulfillment_status', '<>', 4)
|
||||
->order('id', 'desc')
|
||||
->find();
|
||||
if ($latestPo) {
|
||||
$arr['recipient_name'] = (string) ($latestPo->recipient_name ?? '');
|
||||
$arr['recipient_phone'] = (string) ($latestPo->recipient_phone ?? '');
|
||||
$arr['shipping_address'] = (string) ($latestPo->shipping_address ?? '');
|
||||
$arr['order_no'] = (string) ($latestPo->order_no ?? '');
|
||||
$arr['order_amount'] = round((float) ($latestPo->amount ?? 0), 2);
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user