订单详情关联
This commit is contained in:
@@ -177,9 +177,15 @@ class ProductOrderController extends BaseAppController
|
|||||||
$h->select('name');
|
$h->select('name');
|
||||||
}])->asArray()->one();
|
}])->asArray()->one();
|
||||||
|
|
||||||
$prescription = Prescription::find()->select('cr_ids,wr_ids,gr_ids,category')->where(['id' => $ProductOrder['p_id']])->one();
|
$prescription = Prescription::find()->select('cr_ids,wr_ids,gr_ids,category,store_id')->where(['id' => $ProductOrder['p_id']])->one();
|
||||||
|
|
||||||
if($prescription['wr_ids']){
|
// 获取处方来源诊所信息
|
||||||
|
$prescriptionStore = null;
|
||||||
|
if ($prescription && isset($prescription['store_id']) && $prescription['store_id']) {
|
||||||
|
$prescriptionStore = Store::find()->select('id,name,mobile,position')->where(['id' => $prescription['store_id']])->asArray()->one();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($prescription && $prescription['wr_ids']){
|
||||||
$wr_ids = explode(',', $prescription['wr_ids']);
|
$wr_ids = explode(',', $prescription['wr_ids']);
|
||||||
if ($ProductOrder['prescription_type'] == 5) {
|
if ($ProductOrder['prescription_type'] == 5) {
|
||||||
$west = ServicePackageRepice::find()->select('content,number,total_price')->where([
|
$west = ServicePackageRepice::find()->select('content,number,total_price')->where([
|
||||||
@@ -194,7 +200,7 @@ class ProductOrderController extends BaseAppController
|
|||||||
$value['content']=Json::decode($value['content']);
|
$value['content']=Json::decode($value['content']);
|
||||||
}
|
}
|
||||||
$count = count($west);
|
$count = count($west);
|
||||||
}else if($prescription['cr_ids']){
|
}else if($prescription && $prescription['cr_ids']){
|
||||||
$cr_ids = explode(',', $prescription['cr_ids']);
|
$cr_ids = explode(',', $prescription['cr_ids']);
|
||||||
$chinese = ChineseRepice::find()->select('content,total_price')->where([
|
$chinese = ChineseRepice::find()->select('content,total_price')->where([
|
||||||
'in', 'id', $cr_ids
|
'in', 'id', $cr_ids
|
||||||
@@ -220,7 +226,7 @@ class ProductOrderController extends BaseAppController
|
|||||||
$count = count($granular['list']);
|
$count = count($granular['list']);
|
||||||
}
|
}
|
||||||
if ($ProductOrder['p_id'] !== 0 && $ProductOrder['order_type'] !== 2) {
|
if ($ProductOrder['p_id'] !== 0 && $ProductOrder['order_type'] !== 2) {
|
||||||
if ($prescription['category'] === 2) {
|
if ($prescription && isset($prescription['category']) && $prescription['category'] === 2) {
|
||||||
$ProductOrder['total_pay_price'] = $ProductOrder['trans_expenses'];
|
$ProductOrder['total_pay_price'] = $ProductOrder['trans_expenses'];
|
||||||
$ProductOrder['items_price'] = 0;
|
$ProductOrder['items_price'] = 0;
|
||||||
}
|
}
|
||||||
@@ -234,6 +240,7 @@ class ProductOrderController extends BaseAppController
|
|||||||
'west' => $west ?? null,
|
'west' => $west ?? null,
|
||||||
'chinese' => $chinese ?? null,
|
'chinese' => $chinese ?? null,
|
||||||
'granular' => $granular ?? null,
|
'granular' => $granular ?? null,
|
||||||
|
'store' => $prescriptionStore ? ['store' => $prescriptionStore] : null,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -426,11 +433,22 @@ class ProductOrderController extends BaseAppController
|
|||||||
$q->select('id,drug_name,function,specification,usage,instruction');
|
$q->select('id,drug_name,function,specification,usage,instruction');
|
||||||
}])->asArray()->all();
|
}])->asArray()->all();
|
||||||
$ProductOrder['count'] = count($ProductOrderItems);
|
$ProductOrder['count'] = count($ProductOrderItems);
|
||||||
|
|
||||||
|
// 获取处方来源诊所信息
|
||||||
|
$prescriptionStore = null;
|
||||||
|
if ($ProductOrder['p_id']) {
|
||||||
|
$prescription = Prescription::find()->select('store_id')->where(['id' => $ProductOrder['p_id']])->asArray()->one();
|
||||||
|
if ($prescription && isset($prescription['store_id']) && $prescription['store_id']) {
|
||||||
|
$prescriptionStore = Store::find()->select('id,name,mobile,position')->where(['id' => $prescription['store_id']])->asArray()->one();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'ProductOrder' => $ProductOrder,
|
'ProductOrder' => $ProductOrder,
|
||||||
'userInfo' => $userInfo,
|
'userInfo' => $userInfo,
|
||||||
'hospital' => $hospital,
|
'hospital' => $hospital,
|
||||||
'ProductOrderItems' => $ProductOrderItems
|
'ProductOrderItems' => $ProductOrderItems,
|
||||||
|
'store' => $prescriptionStore ? ['store' => $prescriptionStore] : null,
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user