|
@@ -5,6 +5,7 @@ namespace app\admin\service\order;
|
|
|
use app\model\Appointment;
|
|
|
use support\Db;
|
|
|
use support\Request;
|
|
|
+use function _PHPStan_cc8d35ffb\RingCentral\Psr7\str;
|
|
|
|
|
|
class AppointmentService
|
|
|
{
|
|
@@ -20,6 +21,7 @@ class AppointmentService
|
|
|
->leftJoin('member', 'member.member_id', '=', 'appointment.join_appointment_member_id')
|
|
|
->leftJoin('goods', 'goods.goods_id', '=', 'appointment.join_appointment_goods_id')
|
|
|
->leftJoin('order', 'order.order_id', '=', 'appointment.join_appointment_order_id')
|
|
|
+ ->leftJoin('member_benefit', 'member_benefit.member_benefit_id', '=', 'appointment.join_appointment_member_benefit_id')
|
|
|
->leftJoin('goods_sku', 'goods_sku.goods_sku_id', '=', 'appointment.join_appointment_goods_sku_id')
|
|
|
->when($id != '', function ($query) use ($id) {
|
|
|
$query->where('appointment.appointment_id', 'like', '%' . $id . '%');
|
|
@@ -31,7 +33,9 @@ class AppointmentService
|
|
|
$rows = $rows->select('member.member_mobile', 'appointment.*', 'goods.goods_name', 'goods.goods_cover',
|
|
|
'order.order_name', 'goods_sku.goods_sku_specs_json', 'order.order_amount_total', 'order.order_amount_pay',
|
|
|
'order.order_category', 'order.order_status_system', 'order.order_status_payment', 'order.order_status_storage',
|
|
|
- 'order.order_addtimes')
|
|
|
+ 'order.order_addtimes',
|
|
|
+ 'member_benefit.member_benefit_name'
|
|
|
+ )
|
|
|
->orderBy('appointment.appointment_addtimes', 'desc')
|
|
|
->forPage($page, $pageSize)
|
|
|
->get();
|
|
@@ -62,4 +66,31 @@ class AppointmentService
|
|
|
return json_fail("操作失败");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public static function update(Request $request)
|
|
|
+ {
|
|
|
+ $appointmentId = $request->post('appointment_id');
|
|
|
+ if (!Appointment::where('appointment_id', $appointmentId)->exists()) {
|
|
|
+ return json_fail("数据不存在");
|
|
|
+ }
|
|
|
+ $params = $request->post();
|
|
|
+ try {
|
|
|
+ $data = [
|
|
|
+ 'appointment_status'=>$params['appointment_status'],
|
|
|
+ 'appointment_datetime'=>$params['appointment_datetime'] ? date('Y-m-d H:i:s',strtotime($params['appointment_datetime'])) : null,
|
|
|
+ 'appointment_apply_datetime'=>$params['appointment_apply_datetime'] ? date('Y-m-d H:i:s',strtotime($params['appointment_apply_datetime'])) : null,
|
|
|
+ 'appointment_doing_datetime'=>$params['appointment_doing_datetime'] ? date('Y-m-d H:i:s',strtotime($params['appointment_doing_datetime'])) : null,
|
|
|
+ 'appointment_done_datetime'=>$params['appointment_done_datetime'] ? date('Y-m-d H:i:s',strtotime($params['appointment_done_datetime'])) : null,
|
|
|
+ 'appointment_cancel_datetime'=>$params['appointment_cancel_datetime'] ? date('Y-m-d H:i:s',strtotime($params['appointment_cancel_datetime'])) : null,
|
|
|
+ 'appointment_remark'=>$params['appointment_remark'] ?? '',
|
|
|
+ ];
|
|
|
+
|
|
|
+ Appointment::where('appointment_id', $appointmentId)->update($data);
|
|
|
+
|
|
|
+ return json_success("数据更新成功");
|
|
|
+ }catch (\Exception $e){
|
|
|
+ dump($e->getMessage());
|
|
|
+ return json_fail("数据更新失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|