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(() => {})
}