|
@@ -115,7 +115,7 @@ class AppointmentService
|
|
|
if ($timesStr == $applyJsonTimes) {
|
|
|
$extendJson['times'][$key]['person'] -= $applyJson['person'];
|
|
|
if ($extendJson['times'][$key]['person'] < $params['person']) {
|
|
|
- return json_fail('当前时段已满员,请选择其他时段');
|
|
|
+ return json_fail('当前时段人数超出限制,请选择其他时段');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -246,7 +246,9 @@ class AppointmentService
|
|
|
'join_pay_order_id' => $orderId,
|
|
|
'pay_amount' => $sheet['order_sheet_pay'],
|
|
|
'pay_remark' => '预约单',
|
|
|
- 'pay_addtimes' => time()
|
|
|
+ 'pay_addtimes' => time(),
|
|
|
+ 'pay_prepayid' => 0,
|
|
|
+ 'pay_paytimes' => date('Y-m-d H:i:s')
|
|
|
];
|
|
|
// 现金余额结算
|
|
|
if ($params['settlement_mode'] == 'CASH') {
|
|
@@ -268,13 +270,19 @@ class AppointmentService
|
|
|
]);
|
|
|
$pay['pay_status'] = 'SUCCESS';
|
|
|
$pay['join_pay_object_json'] = json_encode(['payment' => ['member_account_id' => $account->member_account_id]]);
|
|
|
+ // 更新订单状态
|
|
|
+ Order::where('order_id', $orderId)->update(['order_status_system' => 'CONFIRM', 'order_status_payment' => 'SUCCESS']);
|
|
|
+ OrderSheet::where('join_sheet_order_id', $orderId)->update(['order_sheet_status' => 'CONFIRM']);
|
|
|
}
|
|
|
$pay['pay_category'] = 'CASH';
|
|
|
PayDetail::insert($pay);
|
|
|
- }elseif ($params['settlement_mode'] == 'QRCODE'){
|
|
|
+ } elseif ($params['settlement_mode'] == 'QRCODE') {
|
|
|
$pay['pay_category'] = 'QRCODE';
|
|
|
$pay['pay_status'] = 'SUCCESS';
|
|
|
PayDetail::insert($pay);
|
|
|
+ // 更新订单状态
|
|
|
+ Order::where('order_id', $orderId)->update(['order_status_system' => 'CONFIRM', 'order_status_payment' => 'SUCCESS']);
|
|
|
+ OrderSheet::where('join_sheet_order_id', $orderId)->update(['order_sheet_status' => 'CONFIRM']);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -397,7 +405,7 @@ class AppointmentService
|
|
|
];
|
|
|
OrderSheet::insert($sheet);
|
|
|
// 订单号更新到预约
|
|
|
- Appointment::where('appointment_id', $data['appointment_id'])->update(['join_appointment_order_id' => $orderId]);
|
|
|
+ Appointment::where('appointment_id', $appointmentId)->update(['join_appointment_order_id' => $orderId]);
|
|
|
|
|
|
// 支付数据
|
|
|
$pay = [
|
|
@@ -405,7 +413,9 @@ class AppointmentService
|
|
|
'join_pay_order_id' => $orderId,
|
|
|
'pay_amount' => $sheet['order_sheet_pay'],
|
|
|
'pay_remark' => '预约单',
|
|
|
- 'pay_addtimes' => time()
|
|
|
+ 'pay_addtimes' => time(),
|
|
|
+ 'pay_prepayid' => 0,
|
|
|
+ 'pay_paytimes' => date('Y-m-d H:i:s')
|
|
|
];
|
|
|
// 现金余额结算
|
|
|
if ($params['settlement_mode'] == 'CASH') {
|
|
@@ -427,13 +437,19 @@ class AppointmentService
|
|
|
]);
|
|
|
$pay['pay_status'] = 'SUCCESS';
|
|
|
$pay['join_pay_object_json'] = json_encode(['payment' => ['member_account_id' => $account->member_account_id]]);
|
|
|
+ // 更新订单状态
|
|
|
+ Order::where('order_id', $orderId)->update(['order_status_system' => 'CONFIRM', 'order_status_payment' => 'SUCCESS']);
|
|
|
+ OrderSheet::where('join_sheet_order_id', $orderId)->update(['order_sheet_status' => 'CONFIRM']);
|
|
|
}
|
|
|
$pay['pay_category'] = 'CASH';
|
|
|
PayDetail::insert($pay);
|
|
|
- }elseif ($params['settlement_mode'] == 'QRCODE'){
|
|
|
+ } elseif ($params['settlement_mode'] == 'QRCODE' && empty($appointment->join_appointment_order_id)) {
|
|
|
$pay['pay_category'] = 'QRCODE';
|
|
|
$pay['pay_status'] = 'SUCCESS';
|
|
|
PayDetail::insert($pay);
|
|
|
+ // 更新订单状态
|
|
|
+ Order::where('order_id', $orderId)->update(['order_status_system' => 'CONFIRM', 'order_status_payment' => 'SUCCESS']);
|
|
|
+ OrderSheet::where('join_sheet_order_id', $orderId)->update(['order_sheet_status' => 'CONFIRM']);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -441,7 +457,7 @@ class AppointmentService
|
|
|
return json_success("数据更新成功");
|
|
|
} catch (\Exception $e) {
|
|
|
Db::rollBack();
|
|
|
- dump($e->getMessage());
|
|
|
+ dump($e->getTrace());
|
|
|
return json_fail("数据更新失败");
|
|
|
}
|
|
|
}
|
|
@@ -450,7 +466,8 @@ class AppointmentService
|
|
|
{
|
|
|
$goodsId = $request->get('goods_id', '');
|
|
|
$date = $request->get('date', '');
|
|
|
- $memberId = $request->get('member_id', '');
|
|
|
+// $memberId = $request->get('member_id', '');
|
|
|
+ $appointmentId = $request->get('appointment_id', '');
|
|
|
if (!$goodsId || !$date) {
|
|
|
return json_fail("查询时间段失败!");
|
|
|
}
|
|
@@ -463,7 +480,9 @@ class AppointmentService
|
|
|
// 当前服务已预约出去的
|
|
|
$appointments = Appointment::where('join_appointment_goods_id', $goodsId)
|
|
|
->where('appointment_datetime', $date)
|
|
|
- ->where('join_appointment_member_id', '<>', $memberId)
|
|
|
+ ->when($appointmentId != '', function ($query) use ($appointmentId) {
|
|
|
+ $query->where('appointment_id', '<>', $appointmentId);
|
|
|
+ })
|
|
|
->get()
|
|
|
->toArray();
|
|
|
if ($goods->is_support_appointment == 'Y' && !empty($goods->goods_extend_json)) {
|
|
@@ -479,7 +498,7 @@ class AppointmentService
|
|
|
if ($timesStr == $applyJsonTimes) {
|
|
|
$times[$key]['person'] -= $applyJson['person'];
|
|
|
if ($times[$key]['person'] < 1) {
|
|
|
- unset($times[$key]);
|
|
|
+ $times[$key]['disabled'] = true;
|
|
|
}
|
|
|
}
|
|
|
}
|