|
@@ -1446,28 +1446,6 @@ class PackagesController extends Curd
|
|
|
|
|
|
$writeOffDate = [];
|
|
|
$applyData = [];
|
|
|
- // 有预约单,状态已完成
|
|
|
- $appointment = Appointment::where('join_appointment_order_id', $params['order_id'])->first();
|
|
|
- if ($order->order_status_payment == 'SUCCESS' && $appointment) {
|
|
|
- $writeOffDate = OrderService::generateWriteOffData($params);
|
|
|
- $applyData = OrderService::generateAppointmentApplyData($params);
|
|
|
-
|
|
|
- $appointment->appointment_status = 'DONE';
|
|
|
- $appointment->appointment_done_datetime = date('Y-m-d H:i:s');
|
|
|
- $appointment->appointment_done_json = json_encode($writeOffDate);
|
|
|
- if (empty($appointment->appointment_apply_datetime)) {
|
|
|
- $appointment->appointment_apply_datetime = date('Y-m-d H:i:s');
|
|
|
- }
|
|
|
- if (empty($appointment->appointment_apply_json)) {
|
|
|
- $appointment->appointment_apply_json = json_encode($applyData);
|
|
|
- }
|
|
|
- if (empty($appointment->appointment_datetime)) {
|
|
|
- $appointment->appointment_datetime = date('Y-m-d');
|
|
|
- }
|
|
|
-
|
|
|
- $appointment->save();
|
|
|
- }
|
|
|
-
|
|
|
// // 买的单个服务
|
|
|
if ($order->order_status_payment == 'SUCCESS' && empty($appointment)) {
|
|
|
foreach ($params['goodsContentList'] as $goods) {
|
|
@@ -1866,17 +1844,19 @@ class PackagesController extends Curd
|
|
|
foreach ($waitToPayAccount as $item) {
|
|
|
$accountNbr = $item['nbr'];
|
|
|
$account = MemberAccount::where('member_account_nbr', $accountNbr)->first();
|
|
|
- $account->member_account_expend = $account->member_account_expend + $amount;
|
|
|
- if ($account->member_account_surplus < $amount && strpos($accountNbr, 'CASH') !== false) {
|
|
|
- $account->member_account_added = $account->member_account_added - ($amount - $account->member_account_surplus);
|
|
|
+ $account->member_account_expend = $account->member_account_expend + $item['amount'];
|
|
|
+ if ($account->member_account_surplus < $item['amount'] && strpos($accountNbr, 'CASH') !== false) {
|
|
|
+ $account->member_account_added = $account->member_account_added - ($item['amount'] - $account->member_account_surplus);
|
|
|
$account->member_account_surplus = 0;
|
|
|
} else {
|
|
|
- $account->member_account_surplus = $account->member_account_surplus - $amount;
|
|
|
+ $account->member_account_surplus = $account->member_account_surplus - $item['amount'];
|
|
|
}
|
|
|
$account->save();
|
|
|
}
|
|
|
}
|
|
|
// 买单个服务
|
|
|
+ $writeOffDate = [];
|
|
|
+ $applyData = [];
|
|
|
if ($order->order_status_payment == 'SUCCESS' && empty($appointment)) {
|
|
|
foreach ($params['goodsContentList'] as $goods) {
|
|
|
$params['join_sheet_goods_id'] = $goods['goods_id'];
|