|
@@ -1205,8 +1205,18 @@ class WholeController extends Curd
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private function discountRecord(){
|
|
|
|
-
|
|
|
|
|
|
+ private function discountRecord($orderDiscountJson, $params)
|
|
|
|
+ {
|
|
|
|
+ $json = [];
|
|
|
|
+ if (!empty($orderDiscountJson)) {
|
|
|
|
+ $json = json_decode($orderDiscountJson, true);
|
|
|
|
+ }
|
|
|
|
+ $orderDiscountAmount = 0;
|
|
|
|
+
|
|
|
|
+ $data = [
|
|
|
|
+ 'coupon_id'=>$params['coupon_id'] ?? null,
|
|
|
|
+ 'coupon_value' =>''
|
|
|
|
+ ];
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -4080,24 +4090,24 @@ class WholeController extends Curd
|
|
*/
|
|
*/
|
|
public function updateStatus(Request $request)
|
|
public function updateStatus(Request $request)
|
|
{
|
|
{
|
|
- $orderId = $request->post('order_id','');
|
|
|
|
- $orderStatusPayment = $request->post('order_status_payment','');
|
|
|
|
- $order = Order::where('order_id',$orderId)
|
|
|
|
- ->select('order_id','order_status_payment','order_config_json')
|
|
|
|
|
|
+ $orderId = $request->post('order_id', '');
|
|
|
|
+ $orderStatusPayment = $request->post('order_status_payment', '');
|
|
|
|
+ $order = Order::where('order_id', $orderId)
|
|
|
|
+ ->select('order_id', 'order_status_payment', 'order_config_json')
|
|
->first();
|
|
->first();
|
|
Db::beginTransaction();
|
|
Db::beginTransaction();
|
|
try {
|
|
try {
|
|
- if ($orderStatusPayment == 'AWAITING' && $order->order_status_payment != 'PENDING'){
|
|
|
|
|
|
+ if ($orderStatusPayment == 'AWAITING' && $order->order_status_payment != 'PENDING') {
|
|
return json_fail('当前订单不允许挂账');
|
|
return json_fail('当前订单不允许挂账');
|
|
}
|
|
}
|
|
// 挂账,释放餐桌
|
|
// 挂账,释放餐桌
|
|
- if ($order->order_status_payment == 'PENDING' && $orderStatusPayment == 'AWAITING'){
|
|
|
|
|
|
+ if ($order->order_status_payment == 'PENDING' && $orderStatusPayment == 'AWAITING') {
|
|
$order->order_status_payment = $orderStatusPayment;
|
|
$order->order_status_payment = $orderStatusPayment;
|
|
// 如果有餐桌,释放
|
|
// 如果有餐桌,释放
|
|
- if(!empty($order->order_config_json)){
|
|
|
|
- $orderConfigJson = json_decode($order->order_config_json,true);
|
|
|
|
- if (!empty($orderConfigJson['tableid'])){
|
|
|
|
- SysDept::where('dept_id',$orderConfigJson['tableid'])->update(['dept_status'=>'ACTIVED']);
|
|
|
|
|
|
+ if (!empty($order->order_config_json)) {
|
|
|
|
+ $orderConfigJson = json_decode($order->order_config_json, true);
|
|
|
|
+ if (!empty($orderConfigJson['tableid'])) {
|
|
|
|
+ SysDept::where('dept_id', $orderConfigJson['tableid'])->update(['dept_status' => 'ACTIVED']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -4105,7 +4115,7 @@ class WholeController extends Curd
|
|
|
|
|
|
Db::commit();
|
|
Db::commit();
|
|
return json_success('success');
|
|
return json_success('success');
|
|
- }catch (\Exception $e){
|
|
|
|
|
|
+ } catch (\Exception $e) {
|
|
Db::rollBack();
|
|
Db::rollBack();
|
|
return json_fail('修改订单状态失败');
|
|
return json_fail('修改订单状态失败');
|
|
}
|
|
}
|