feat: 工单列表的接口调试

This commit is contained in:
2025-10-27 21:17:43 +08:00
parent d0711c7f12
commit d7aea9cf55
3 changed files with 74 additions and 21 deletions

View File

@@ -195,8 +195,8 @@ const sendCreateWorkOrder = async () => {
try { try {
const res = await createWorkOrder({ const res = await createWorkOrder({
workOrderTypeId: workOrderTypeId.value, workOrderTypeId: workOrderTypeId.value,
roomId: roomId.value, roomNo: roomId.value,
contactPhone: contactPhone.value, userPhone: contactPhone.value,
content: contactText.value, content: contactText.value,
contentImgUrl: contentImgUrl.value, contentImgUrl: contentImgUrl.value,
}); });
@@ -235,7 +235,7 @@ const viewWorkOrder = () => {
console.log("查看工单:", workOrderId.value); console.log("查看工单:", workOrderId.value);
// 这里可以跳转到工单详情页面 // 这里可以跳转到工单详情页面
uni.navigateTo({ uni.navigateTo({
url: `/pages-order/order/list?id=${workOrderId.value}`, url: `/pages-service/order/list`,
}); });
}; };

View File

@@ -1,8 +1,5 @@
<template> <template>
<view <view class="order-card bg-white border-box p-12 rounded-12 m-12">
class="order-card bg-white border-box p-12 rounded-12 m-12"
@click="handleCardClick"
>
<!-- 卡片头部 --> <!-- 卡片头部 -->
<view class="border-box flex flex-items-center pb-12"> <view class="border-box flex flex-items-center pb-12">
<image <image
@@ -10,50 +7,63 @@
src="https://oss.nianxx.cn/mp/static/version_101/service/service_icon.png" src="https://oss.nianxx.cn/mp/static/version_101/service/service_icon.png"
/> />
<text class="font-size-14 color-525866 line-height-20">工单</text> <text class="font-size-14 color-525866 line-height-20">工单</text>
<text class="font-size-12 color-525866 line-height-20 ml-auto" <text class="font-size-12 color-525866 line-height-20 ml-auto">{{
>已完成</text isCancelWork ? "已取消" : workOrderStatus(orderData.workOrderStatus)
> }}</text>
</view> </view>
<!-- 卡片内容 --> <!-- 卡片内容 -->
<view class="border-box card-content flex flex-items-center pb-12"> <view class="border-box card-content flex flex-items-center pb-12">
<view class="border-box left flex-full pr-20"> <view class="border-box left flex-full pr-20">
<view class="font-size-12 color-525866 line-height-20 mb-4" <view class="font-size-12 color-525866 line-height-20 mb-4"
>房间号A01</view >房间号{{ orderData.roomNo }}</view
> >
<view class="font-size-12 color-525866 line-height-20 mb-4" <view class="font-size-12 color-525866 line-height-20 mb-4"
>联系方式:173822042402</view >联系方式: {{ orderData.userPhone }}</view
> >
<view class="font-size-12 color-525866 line-height-20 ellipsis-2" <view class="font-size-12 color-525866 line-height-20 ellipsis-2"
>需求描述:我太渴了立即立刻马上现在给我送两瓶水过来我太渴了立即立刻马上现在给我送两瓶水过来我太渴了立即立刻马上现在给我送两瓶水过来我太渴了立即立刻马上现在给我送两瓶水过来</view >需求描述: {{ orderData.content }}</view
> >
</view> </view>
<image <image
v-if="orderData.contentImgUrl"
class="right rounded-6" class="right rounded-6"
src="https://picsum.photos/300/300" :src="orderData.contentImgUrl"
mode="aspectFill" mode="aspectFill"
/> />
</view> </view>
<!-- 服务人员 --> <!-- 服务人员 -->
<view <view
v-if="orderData.processMemberName && orderData.processMemberPhone"
class="service-user border-box p-8 flex flex-items-center flex-justify-between mb-12" class="service-user border-box p-8 flex flex-items-center flex-justify-between mb-12"
> >
<view class="font-size-12 line-height-16">服务人员张三</view> <view class="font-size-12 line-height-16"
>服务人员{{ orderData.processMemberName }}</view
>
<uni-icons <uni-icons
class="ml-auto mr-4" class="ml-auto mr-4"
type="phone-filled" type="phone-filled"
size="14" size="14"
color="#436799" color="#436799"
/> />
<text class="font-size-12 line-height-16">拨打电话</text> <text class="font-size-12 line-height-16" @click="callService"
>拨打电话</text
>
</view> </view>
<!-- 取消操作 --> <!-- 取消操作 -->
<view class="flex flex-items-center flex-justify-between"> <view
v-if="
!isCancelWork &&
orderData.workOrderStatus !== '2' &&
orderData.workOrderStatus !== '3'
"
class="flex flex-items-center flex-justify-between"
>
<text <text
class="cancel border-box border rounded-6 font-size-12 line-height-16 color-525866 ml-auto" class="cancel border-box border rounded-6 font-size-12 line-height-16 color-525866 ml-auto"
@click="cancelCall"
>取消呼叫</text >取消呼叫</text
> >
</view> </view>
@@ -62,18 +72,55 @@
<script setup> <script setup>
import { defineProps } from "vue"; import { defineProps } from "vue";
import { closeWorkOrder } from "@/request/api/OrderApi";
import { ref } from "vue";
const isCancelWork = ref(false);
// Props // Props
const props = defineProps({ const props = defineProps({
item: { orderData: {
type: Object, type: Object,
required: true, required: true,
default: () => ({}), default: () => ({}),
}, },
}); });
// 处理卡片点击 /// 工单状态 0-待接单 1-处理中 2-已完成 3-已关闭
const handleCardClick = () => {}; const workOrderStatus = (status) => {
if (status === "0") {
return "待处理";
} else if (status === "1") {
return "处理中";
} else if (status === "2") {
return "已完成";
} else if (status === "3") {
return "已取消";
} else {
return "";
}
};
// 拨打电话
const callService = () => {
uni.makePhoneCall({
phoneNumber: props.orderData.processMemberPhone,
});
};
// 取消呼叫
const cancelCall = async () => {
const res = await closeWorkOrder({
workOrderId: props.orderData.id,
});
if (res.data) {
isCancelWork.value = true;
}
uni.showToast({
title: res.data ? "取消呼叫成功" : res.message || "取消呼叫失败",
icon: "success",
duration: 2000,
});
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -19,6 +19,11 @@ const createWorkOrder = (args) => {
return request.post("/hotelBiz/workOrder/createWorkOrder", args); return request.post("/hotelBiz/workOrder/createWorkOrder", args);
}; };
// 关闭工单
const closeWorkOrder = (args) => {
return request.post("/hotelBiz/workOrder/closeWorkOrder", args);
};
// 获取订单详情 // 获取订单详情
const userOrderDetail = (args) => { const userOrderDetail = (args) => {
return request.post("/hotelBiz/order/userOrderDetail", args); return request.post("/hotelBiz/order/userOrderDetail", args);
@@ -49,6 +54,7 @@ export {
userWorkOrderList, userWorkOrderList,
workOrderTypeListForBiz, workOrderTypeListForBiz,
createWorkOrder, createWorkOrder,
closeWorkOrder,
userOrderDetail, userOrderDetail,
preOrder, preOrder,
orderCancel, orderCancel,