feat: 创建工单的类型拉取
This commit is contained in:
@@ -7,13 +7,19 @@
|
||||
<view class="order-content">
|
||||
<view class="order-item">
|
||||
<image src="./images/icon_service.png" class="order-icon"></image>
|
||||
<text class="order-description">加一台麻将机</text>
|
||||
<text class="order-description">{{ workOrderTypeName }}</text>
|
||||
</view>
|
||||
<view class="order-line"></view>
|
||||
<view class="order-details">
|
||||
<view class="detail-item">
|
||||
<text class="detail-label">房间号:</text>
|
||||
<text class="detail-value">302</text>
|
||||
<input
|
||||
v-if="!isCallSuccess"
|
||||
class="detail-input"
|
||||
placeholder="请填写房间号"
|
||||
v-model="roomId"
|
||||
/>
|
||||
<text v-else class="detail-value">{{ roomId }}</text>
|
||||
</view>
|
||||
<view class="detail-item">
|
||||
<text class="detail-label">服务时间:</text>
|
||||
@@ -73,15 +79,27 @@ import { ref, onMounted, nextTick } from "vue";
|
||||
import { SCROLL_TO_BOTTOM } from "@/constant/constant";
|
||||
|
||||
|
||||
import { createWorkOrder } from "@/request/api/OrderApi";
|
||||
|
||||
import { createWorkOrder, workOrderTypeListForBiz } from "@/request/api/OrderApi";
|
||||
const workOrderTypeId = ref('')
|
||||
const workOrderTypeName = ref('')
|
||||
const roomId = ref('')
|
||||
const contactName = ref("");
|
||||
const contactPhone = ref("");
|
||||
const isCallSuccess = ref(false); // 呼叫成功状态
|
||||
const workOrderId = ref(""); // 工单ID
|
||||
|
||||
|
||||
const handleCall = async () => {
|
||||
// 验证输入
|
||||
if (!roomId.value.trim()) {
|
||||
uni.showToast({
|
||||
title: '请填写房间号',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!contactName.value.trim()) {
|
||||
uni.showToast({
|
||||
title: '请填写联系人',
|
||||
@@ -100,12 +118,17 @@ const handleCall = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
sendCreateWorkOrder()
|
||||
};
|
||||
|
||||
/// 创建工单
|
||||
const sendCreateWorkOrder = () => {
|
||||
try {
|
||||
const res = await createWorkOrder({
|
||||
contactName: contactName.value,
|
||||
contactPhone: contactPhone.value,
|
||||
workOrderTypeId: '1942741501754765314',
|
||||
roomId: '302',
|
||||
workOrderTypeId: workOrderTypeId.value,
|
||||
roomId: roomId.value,
|
||||
});
|
||||
|
||||
if (res.code === 0) {
|
||||
@@ -135,7 +158,16 @@ const handleCall = async () => {
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// 获取工单类型
|
||||
const getWorkOrderType = async () => {
|
||||
const res = await workOrderTypeListForBiz()
|
||||
if(res.code === 0) {
|
||||
workOrderTypeId.value = res.data.id
|
||||
workOrderTypeName.value = res.data.workOrderTypeName
|
||||
}
|
||||
}
|
||||
|
||||
// 查看工单
|
||||
const viewWorkOrder = () => {
|
||||
|
||||
@@ -9,8 +9,13 @@ const userWorkOrderList = (args) => {
|
||||
return request.post("/hotelBiz/workOrder/userWorkOrderList", args);
|
||||
};
|
||||
|
||||
/// 获取工单类型
|
||||
const workOrderTypeListForBiz = () => {
|
||||
return request.get('/hotelBiz/workOrder/workOrderTypeListForBiz', {});
|
||||
}
|
||||
|
||||
/// 创建工单
|
||||
function createWorkOrder(args) {
|
||||
const createWorkOrder = (args) => {
|
||||
return request.post('/hotelBiz/workOrder/createWorkOrder', args);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user