fix(admin): 修复订单价格和门店 id 保存问题

- 在 BeforehandOrderLogic 中添加 store_id 的保存逻辑
- 在 BeforehandOrderCartInfoLogic 中更新订单价格计算逻辑
This commit is contained in:
mkm 2024-11-19 14:38:28 +08:00
parent b7951806b8
commit 0b8e5372c4
2 changed files with 6 additions and 5 deletions
app/admin/logic
beforehand_order
beforehand_order_cart_info

@ -313,13 +313,11 @@ class BeforehandOrderLogic extends BaseLogic
Db::startTrans(); Db::startTrans();
try { try {
$find = BeforehandOrder::where('id', $params['id'])->find(); $find = BeforehandOrder::where('id', $params['id'])->find();
$other_data = $find['other_data']; $other_data = $params['other_data'];
if (!empty($params['other_data']['arrival_time'])) {
$other_data->arrival_time = $params['other_data']['arrival_time'];
}
$find->save([ $find->save([
'other_data' => json_encode($other_data, true), 'other_data' => json_encode($other_data, true),
'file' => $params['file'], 'file' => $params['file'],
'store_id' => $params['store_id'],
'mark' => $params['mark'] 'mark' => $params['mark']
]); ]);
Db::commit(); Db::commit();

@ -235,7 +235,10 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
if($find['is_buyer']==1){ if($find['is_buyer']==1){
PurchaseProductOffer::where('order_id',$find['bhoid'])->where('product_id',$find['product_id'])->update(['delete_time'=>time()]); PurchaseProductOffer::where('order_id',$find['bhoid'])->where('product_id',$find['product_id'])->update(['delete_time'=>time()]);
} }
return BeforehandOrderCartInfo::destroy($params['id']); $res=BeforehandOrderCartInfo::destroy($params['id']);
$pay_price=BeforehandOrderCartInfo::where('bhoid', $params['id'])->sum('pay_price');
BeforehandOrder::where('id',$find['bhoid'])->update(['pay_price'=>$pay_price]);
return $res;
} }