修复
This commit is contained in:
@@ -195,12 +195,16 @@ class LedgerForm extends BaseModel
|
||||
* 医保支付(走月付)
|
||||
*/
|
||||
if ($productOrder['prescription']['category'] == 2) {
|
||||
$model = new MonthlyPaymentModel();
|
||||
$model->store_id = $productOrder->store_id;
|
||||
$model->order_id = $productOrder->id;
|
||||
$model->amount = $productOrder->market_price;
|
||||
$model->created_at = $time;
|
||||
$model->save();
|
||||
// 查询订单是否已生成月付
|
||||
$monthInfo = MonthlyPaymentModel::find()->where(['order_id' => $productOrder->id, 'store_id' => $productOrder->store_id])->one();
|
||||
if (!$monthInfo) {
|
||||
$model = new MonthlyPaymentModel();
|
||||
$model->store_id = $productOrder->store_id;
|
||||
$model->order_id = $productOrder->id;
|
||||
$model->amount = $productOrder->market_price;
|
||||
$model->created_at = $time;
|
||||
$model->save();
|
||||
}
|
||||
} else {
|
||||
$ledger[] = [
|
||||
'order_id' => $this->order_id,
|
||||
@@ -247,19 +251,18 @@ class LedgerForm extends BaseModel
|
||||
foreach($productOrderItems as $v){
|
||||
$totalPrice = round($v['number'] * $v['price'], 4);
|
||||
$totalBuyPrice = round($v['number'] * $v['buy_price'], 4);
|
||||
// 月付
|
||||
if ($productOrder['prescription']['category'] == 2) {
|
||||
// (new MonthlyPaymentModel)->save([
|
||||
// 'store_id' => $productOrder->store_id,
|
||||
// 'order_id' => $productOrder->id,
|
||||
// 'amount' => $totalBuyPrice,
|
||||
// 'created_at' => $time,
|
||||
// ]);
|
||||
$model = new MonthlyPaymentModel();
|
||||
$model->store_id = $productOrder->store_id;
|
||||
$model->order_id = $productOrder->id;
|
||||
$model->amount = $totalBuyPrice;
|
||||
$model->created_at = $time;
|
||||
$model->save();
|
||||
// 查询订单是否已生成月付
|
||||
$monthInfo = MonthlyPaymentModel::find()->where(['order_id' => $productOrder->id, 'store_id' => $productOrder->store_id])->one();
|
||||
if (!$monthInfo) {
|
||||
$model = new MonthlyPaymentModel();
|
||||
$model->store_id = $productOrder->store_id;
|
||||
$model->order_id = $productOrder->id;
|
||||
$model->amount = $productOrder->market_price;
|
||||
$model->created_at = $time;
|
||||
$model->save();
|
||||
}
|
||||
} else {
|
||||
$ledger[] = [
|
||||
'order_id' => $this->order_id,
|
||||
|
||||
Reference in New Issue
Block a user