diff --git a/admin/src/views/order/index.vue b/admin/src/views/order/index.vue index 850d958e..5a37b61d 100644 --- a/admin/src/views/order/index.vue +++ b/admin/src/views/order/index.vue @@ -186,7 +186,7 @@ v-if="scope.row.is_direct_mode && scope.row.appointment_status == 1" size="small" icon="el-icon-thumb" - @click="dyOrderConfirm(scope.row)" + @click="confirmOrder(scope.row)" > 确认接单 @@ -570,6 +570,81 @@ + + + + {{ item.product_name }} + + + + + {{ item.order_status_name }} + + + {{ item.quantity }} + + + {{ item.mobile }} + + + {{ item.create_at | parseTime("{y}-{m}-{d} {h}:{i}") }} + + + + + + 大人 + + 小孩 + + + + + + {{ item.dyOrderAppointments.book_info.book_start_date }} + + + + {{ item.dyOrderAppointments.book_info.book_end_date }} + + + + + + + + + + + + + + + + + @@ -692,12 +767,13 @@ export default { os_status: [], appointment_status: "", }, - item: { next_follow: "", personnel: { adult: "" } }, + item: { next_follow: "", personnel: { adult: "" }, dyOrderAppointments:{book_info:{}} }, follow: [], dialogVisible: false, dialog2Visible: false, applyVisible: false, + orderConfirmDialogVisible:false, oss: [], isSynchronization: false, item3: { @@ -854,6 +930,15 @@ export default { }) .catch((err) => {}); }, + confirmOrder(item) { + this.$axios + .get("/admin/order/info", { params: { id: item.id } }) + .then((res) => { + this.item = res.data; + this.orderConfirmDialogVisible = true; + }) + .catch((err) => {}); + }, resetForm(formName) { this.$refs[formName].resetFields(); }, @@ -1039,16 +1124,17 @@ export default { }); }); }, - dyOrderConfirm(item) { + dyOrderConfirm(item, confirm_result) { this.$axios - .post("/admin/order/dyOrderConfirm", { id: item.id }) + .post("/admin/order/dyOrderConfirm", { id: item.id, confirm_result:confirm_result }) .then((res) => { this.$notify({ title: "成功", - message: "接单成功", + message: "操作成功", type: "success", }); - // this.getList(); + this.orderConfirmDialogVisible = false; + this.getList(); }) .catch((err) => { this.$notify.error({ diff --git a/service/app/admin/controller/IndexController.php b/service/app/admin/controller/IndexController.php index e80deaad..9327af53 100644 --- a/service/app/admin/controller/IndexController.php +++ b/service/app/admin/controller/IndexController.php @@ -425,4 +425,4 @@ class IndexController extends base return $this->success($list); } -} \ No newline at end of file +} diff --git a/service/app/admin/controller/OrderController.php b/service/app/admin/controller/OrderController.php index f008ca6f..23a5912d 100644 --- a/service/app/admin/controller/OrderController.php +++ b/service/app/admin/controller/OrderController.php @@ -242,7 +242,7 @@ class OrderController extends base if($request->admin->is_super == 0) { $where[] = ['admin_id','=',$request->admin->id]; } - $item = Orders::where($where)->with(['follow.admin','finance'])->find(); + $item = Orders::where($where)->with(['follow.admin','finance', 'dyOrderAppointments'])->find(); if(empty($item)) { return $this->error(2002, '订单没有找到或者已经转移到其他人'); @@ -714,11 +714,13 @@ class OrderController extends base return $this->error(2004, '记录没有找到.'); } // 1:接单 2:拒单 -// if (!$request->post('confirm_result') || !in_array($request->post('confirm_result'), [1, 2])) { -// return $this->error(2005, '确认状态错误'); -// } - // 抖音预约信息 - $appoint = DyOrderProductAppointments::query()->where(['source_order_id' => $order['sn']])->find(); + if (!$request->post('confirm_result') || !in_array($request->post('confirm_result'), [1, 2])) { + return $this->error(2005, '确认状态错误'); + } + $confirmResult = $request->post('confirm_result', 1); + + // 抖音预约信息z + $appoint = DyOrderProductAppointments::query()->where(['source_order_id' => $order['sn']])->order('id desc')->find(); if (empty($appoint)) { return $this->error(2004, '该订单暂未预约,不可接单'); } @@ -739,7 +741,7 @@ class OrderController extends base 'order_id' => $appoint->dy_order_id, 'source_order_id' => $appoint->source_order_id, 'confirm_info' => [ - 'confirm_result' => $request->post('confirm_result', 1), + 'confirm_result' => $confirmResult, 'reject_code' => $request->post('reject_code'), // 1: 库存已约满 2:商品需加价 3:无法满足顾客需求 // 'hotel_info' => [], // 境内住宿类目/酒景套餐 必填 // 'play_info' => [], // 境内游玩类目 必填 @@ -748,7 +750,7 @@ class OrderController extends base ]; // 自由行必填参数 $dyApiService = new DyApiService(); - if (in_array($dyOrderProduct->category_id, $zyxCategoryIds)) { + if ($confirmResult == 1 && in_array($dyOrderProduct->category_id, $zyxCategoryIds)) { $onedayTourList = []; foreach ($dyOrderProduct->travel_details as $k => $travel_detail) { array_push($onedayTourList, [ @@ -759,7 +761,7 @@ class OrderController extends base } $confirmData['confirm_info']['free_travel_info']['oneday_tour_list'] = $onedayTourList; } - if (in_array($dyOrderProduct->category_id, $jnCategoryIds)) { + if ($confirmResult == 1 && in_array($dyOrderProduct->category_id, $jnCategoryIds)) { // 获取poi信息 $poiRes = $dyApiService->send(DyApiService::POI_QUERY, ['order_id' => $order->sn, 'account_id' => env('DY_ACCOUNT_ID')]); $payInfo = [ diff --git a/service/app/model/Orders.php b/service/app/model/Orders.php index 1a1bd660..821a79d0 100644 --- a/service/app/model/Orders.php +++ b/service/app/model/Orders.php @@ -179,6 +179,11 @@ class Orders extends base return $this->belongsTo(Products::class, 'product_id', 'third_product_id'); } + public function dyOrderAppointments() + { + return $this->belongsTo(DyOrderProductAppointments::class, 'sn', 'source_order_id'); + } + public static function fish($id, $admin_id) { return Db::transaction(function () use ($id, $admin_id) { diff --git a/service/app/server/Douyin.php b/service/app/server/Douyin.php index d0fe8a09..c506085a 100644 --- a/service/app/server/Douyin.php +++ b/service/app/server/Douyin.php @@ -499,7 +499,7 @@ class Douyin 'Content-type: application/json' ]; if ($method == 'GET' || $method == 'POST') { - $header[] = 'x-secsdk-csrf-token: ' . $this->_token('', $this->os); + $header[] = 'x-secsdk-csrf-token: ' . $this->_token(''); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); } else { curl_setopt($ch, CURLOPT_HEADER, 1); diff --git a/service/app/server/Meituan.php b/service/app/server/Meituan.php index 30961bf9..563cd4a4 100644 --- a/service/app/server/Meituan.php +++ b/service/app/server/Meituan.php @@ -164,9 +164,9 @@ class Meituan { Log::info('http:' . $http); Log::info('body:' . $body); -// if ($this->tryTimes > 1) { + if ($this->tryTimes > 1) { (new ThirdApiService())->weComNotice($this->os); -// } + } $this->tryTimes++; } return $res;