From f1320b022114a3a64c223a96dcd1cfa298303e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=9F=E5=B7=9D=E4=B8=9C?= Date: Mon, 14 Apr 2025 16:45:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=A2=84=E7=BA=A6=E4=B8=8A=E9=97=A8?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api.js | 6 ++++++ pages/order/order-info.vue | 2 +- pages/order/select-time.vue | 39 ++++++++++++++++++++++++++++++------- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/api/api.js b/api/api.js index a10a0dd..60144f9 100644 --- a/api/api.js +++ b/api/api.js @@ -61,6 +61,12 @@ class Api { let url = `${config.host}/worker/order_dispatch/info`; return fetch.request('GET', url, data, true) } + + // 预约上门时间 + static appointmentTime(data) { + let url = `${config.host}/worker/order_dispatch/appointmentTime`; + return fetch.request('postFrom', url, data, true) + } } export default Api diff --git a/pages/order/order-info.vue b/pages/order/order-info.vue index d4f6a34..d891d70 100644 --- a/pages/order/order-info.vue +++ b/pages/order/order-info.vue @@ -36,7 +36,7 @@ 预约上门时间 - {{data.order_info.plan_time}} + {{data.plan_time}} diff --git a/pages/order/select-time.vue b/pages/order/select-time.vue index 63e8c58..f39bd97 100644 --- a/pages/order/select-time.vue +++ b/pages/order/select-time.vue @@ -29,15 +29,36 @@ import MeIcon from "../../components/me-icon/me-icon.vue"; import MeEmptySpace from "../../components/me-empty-space/me-empty-space.vue"; import MeButton from "../../components/me-button/me-button.vue"; import helpers from "../../utils/helpers"; -import {ref, reactive, computed, watch, inject} from 'vue' -import {onLoad, onShow} from '@dcloudio/uni-app' +import {ref} from 'vue' +import {onLoad} from '@dcloudio/uni-app' import api from "../../api/api"; +import {throttle} from "../../utils/throttle"; -const planTime = ref('') - -const submit = () => { - console.log(data.value) -} +//预约上门时间 +const submit = throttle(() => { + uni.showModal({ + title: '提示信息', + confirmText: '确认', + content: '确认已和客户约定上门时间?', + success: function (res) { + if (res.confirm) { + uni.showLoading({ + title: '提交中' + }); + api.appointmentTime({order_dispatch_id: id.value, plan_time: data.value.plan_time}).then(res => { + uni.hideLoading(); + uni.showToast({ + title: '预约成功', + icon: "success" + }) + setTimeout(() => { + helpers.jumpToPage('order-info', `id=${id.value}`, 'redirectTo') + }, 1000) + }).catch(() => {}) + } + } + }); +}) const id = ref(null) onLoad((params) => { @@ -48,6 +69,10 @@ onLoad((params) => { const data = ref(null) const init = () => { api.orderInfo({order_dispatch_id: id.value}).then(res => { + if (res.status !== 10) { + return helpers.showToast('该订单已预约') + } + data.value = res }).catch(() => {}) }