feat: 预约上门时间

This commit is contained in:
苟川东 2025-04-14 16:45:58 +08:00
parent cdd2f1211f
commit f1320b0221
3 changed files with 39 additions and 8 deletions

View File

@ -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

View File

@ -36,7 +36,7 @@
<view class="item-row flex-sb line-after">
<view class="title flex-l">预约上门时间</view>
<view class="value flex-r">
<text>{{data.order_info.plan_time}}</text>
<text>{{data.plan_time}}</text>
</view>
</view>
<view class="item-multi-line line-after">

View File

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