From 2314d158476ac81fd16f1fcf95abdd9e252b755c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=A0=E6=96=87=E6=B6=9B?= <1909118034@qq.com>
Date: Thu, 6 Mar 2025 23:30:25 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8D=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
api/ticket.ts | 5 +-
pagesA/task_hall/detail.vue | 383 +++++++++++++++++++++++++--------
pagesA/task_hall/list.vue | 106 +++++++--
unocss/a-hua-unocss/index.scss | 3 -
utils/common.ts | 77 ++++++-
5 files changed, 469 insertions(+), 105 deletions(-)
diff --git a/api/ticket.ts b/api/ticket.ts
index ea3ef0c..2a8719a 100644
--- a/api/ticket.ts
+++ b/api/ticket.ts
@@ -1,5 +1,8 @@
import { get, post, put, del } from '../utils/request';
+// 工单池列表接口
export const ticketPoolList = (data : any = {}) => get('v1/ticket/pool/list', data);
+// 工单详情(工单池)
export const ticketPoolInfo = (data : any = {}) => get('v1/ticket/pool/info', data);
-// export const bannerList = (data : any = {}) => get('v2/banner/list', data);
\ No newline at end of file
+// 接单接口
+export const ticketAccept = (data : any = {}) => get('v1/ticket/accept', data);
\ No newline at end of file
diff --git a/pagesA/task_hall/detail.vue b/pagesA/task_hall/detail.vue
index 9dad4ad..ec1649a 100644
--- a/pagesA/task_hall/detail.vue
+++ b/pagesA/task_hall/detail.vue
@@ -21,24 +21,25 @@
-
- {{ticketInfo.ticket_no}}
-
+
+ {{ticketInfo?.ticket_no}}
+
- 创建时间: {{ticketInfo.create_time}}
+ 创建时间: {{ticketInfo?.create_time}}
-
+
{{getStatusText(ticketInfo.status)}}
-
-
-
+
- {{getStatusText(ticketInfo.status)}}
- 工单待处理,点击按钮确认接单
+ {{ticketInfo?.status !== undefined ? getStatusText(ticketInfo.status) : ''}}
+ {{ticketInfo?.status !== undefined ? getStatusDescription(ticketInfo.status) : ''}}
@@ -48,51 +49,81 @@
业主姓名
- {{ticketInfo.order.name}}
+ {{ticketInfo?.order?.name}}
- 联系方式
+ 联系方式
-
+
- {{ticketInfo.order.mobile}}
+ {{ticketInfo?.order?.mobile}}
-
+
上门地址
- {{ticketInfo.order.region_name}}{{ticketInfo.order.cell_name}}{{ticketInfo.order.house_name}}{{ticketInfo.order.address}}
+ {{ticketInfo?.order?.region_name}}{{ticketInfo?.order?.cell_name}}{{ticketInfo?.order?.house_name}}{{ticketInfo?.order?.address}}
-
+
预约时间
- {{ticketInfo.order.appoint_date}} {{ticketInfo.order.appoint_time}}
+ {{ticketInfo?.order?.appoint_date}}
+ {{ticketInfo?.order?.appoint_time}}
-
+
建筑面积
- {{ticketInfo.order.building_area}}
+ {{ticketInfo?.order?.building_area}}
-
+
订单状态
- 已提交
- 已完成
- 已取消
+
+
+ {{getOrderStatusText(ticketInfo?.order?.status)}}
+
+
-
- 上传照片
- {{ticketInfo.order.images}}
+
+
+ 工单备注
+ {{ticketInfo?.order?.remark}}
-
- 配送地址
- 中金北区17号楼一单元201室号
+
+
+ 工单类型
+
+ 商品
+ 量房
+ 维修
+
-
- 商品备注
- 放在门口即可
+
+
+ 附件上传
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
商品信息
燕京 8度U8 500ML*12瓶/箱*2 送燕京9度菊花听500ML*12听
@@ -110,15 +141,15 @@
-
- 订单备注
- {{ticketInfo.order.remark}}
-
+
- 接单
+ 接单
+
+
+
@@ -126,54 +157,102 @@
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useNavigation } from '@/hooks/useNavigation'
- import {ticketPoolInfo} from '@/api/ticket'
+ import { ticketPoolInfo, ticketAccept } from '@/api/ticket'
+ import { useToast } from '@/uni_modules/wot-design-uni'
+ import { throttle } from '@/utils/common'
+
+ const Toast = useToast()
+ const loading = ref(false)
+ const bntloading = ref(false)
+
+ const ticketInfo = ref({
+ ticket_no: '',
+ create_time: '',
+ status: undefined,
+ type: '',
+ order: {
+ name: '',
+ mobile: '',
+ region_name: '',
+ cell_name: '',
+ house_name: '',
+ address: '',
+ appoint_date: '',
+ appoint_time: '',
+ building_area: '',
+ status: 0,
+ images: '',
+ remark: ''
+ }
+ })
+
// 使用导航 composable
const {
- hasMultiplePages, // 是否有多个页面在路由栈中
- isTabBarPage, // 当前页面是否为 tabBar 页面
- checkRouteStack // 检查当前路由栈状态的方法
+ hasMultiplePages,
+ isTabBarPage,
+ checkRouteStack
} = useNavigation()
- onLoad(() => {
+ onLoad((q) => {
checkRouteStack()
+ if (q.ticket_id) {
+ loadInfo(q.ticket_id)
+ }
})
- // 状态颜色配置
- const getStatusColor = (status : number) => {
- const colorMap = {
- 0: '#ff9d00', // 待配送
- 1: '#37A5FF', // 未入库
- 2: '#00b42a', // 已完成
- 3: '#F42429' // 已取消
+
+ const loadInfo = async (ticket_id : string) => {
+ try {
+ loading.value = true
+ const res = await ticketPoolInfo({ ticket_id })
+ if (res.data) {
+ ticketInfo.value = {
+ ...ticketInfo.value,
+ ...res.data
+ }
+ }
+ } catch (error) {
+ Toast.error('加载失败,请重试')
+ console.error('加载工单信息失败:', error)
+ } finally {
+ loading.value = false
}
- return colorMap[status] || '#666666'
}
- // 状态背景色配置
- const getStatusBgColor = (status : number) => {
- const bgColorMap = {
- 0: '#fff6e9', // 待配送
- 1: '#e8f4ff', // 未入库
- 2: '#e8ffea', // 已完成
- 3: '#ffe8e8' // 已取消
- }
- return bgColorMap[status] || '#f5f5f5'
+ // 复制工单号
+ const copyTicketNo = () => {
+ if (!ticketInfo.value?.ticket_no) return
+ uni.setClipboardData({
+ data: ticketInfo.value.ticket_no,
+ showToast: false,
+ success: () => {
+ Toast.success('工单号已复制')
+ }
+ })
}
- // 状态文字配置
- const getStatusText = (status : number) => {
- const textMap = {
- 0: '待接单',
- 1: '已派单',
- 2: '已完成',
- 3: '已取消'
- }
- return textMap[status] || '未知状态'
+ const callNumber = () => {
+ uni.makePhoneCall({
+ phoneNumber: ticketInfo.value.order.mobile
+ });
+
}
- var ticketInfo = ref()
+ const sumbit = throttle(async () => {
+ bntloading.value = true
+ var res = await ticketAccept({ ticket_id: ticketInfo.value.ticket_id })
+ bntloading.value = false
+ if (res.code == 200) {
+ Toast.success('已接单')
+ setTimeout(() => {
+ uni.navigateBack({
+ delta: 1
+ })
+ }, 500)
+ }
+
+ }, 500)
const toPages = (item : any) => {
- console.log(item);
switch (item.type) {
case 'nav':
uni.navigateBack({
@@ -191,17 +270,81 @@
}
- const handleAction = (action : string) => {
- console.log(action);
+
+ // 状态配置
+ const statusConfig = {
+ 0: {
+ color: '#1890ff',
+ bgColor: '#f0f9ff',
+ icon: 'ri-time-line',
+ text: '待接单',
+ description: '工单待处理,点击按钮确认接单'
+ },
+ 1: {
+ color: '#1890ff',
+ bgColor: '#f0f9ff',
+ icon: 'ri-truck-line',
+ text: '已派单',
+ description: '工单已分配,请及时处理'
+ },
+ 2: {
+ color: '#52c41a',
+ bgColor: '#f0fff5',
+ icon: 'ri-checkbox-circle-line',
+ text: '已完成',
+ description: '工单已完成处理'
+ },
+ 3: {
+ color: '#8c8c8c',
+ bgColor: '#f5f5f5',
+ icon: 'ri-close-circle-line',
+ text: '已取消',
+ description: '工单已取消'
+ }
}
-
- onLoad((q)=>{
- loadInfo(q.ticket_id)
- })
-
- const loadInfo = async (ticket_id: any) => {
- const res = await ticketPoolInfo({ticket_id: ticket_id})
- ticketInfo.value = res.data
+
+ // 订单状态配置
+ const orderStatusConfig = {
+ 0: { text: '已提交', color: '#ff9d00', bgColor: '#fff7e6' },
+ 1: { text: '已完成', color: '#52c41a', bgColor: '#f6ffed' },
+ 2: { text: '已取消', color: '#8c8c8c', bgColor: '#fafafa' }
+ }
+
+ // 工单类型配置
+ const typeConfig = {
+ F2: { text: '配送', color: '#1890ff', bgColor: '#f0f7ff' },
+ F4: { text: '量房', color: '#722ed1', bgColor: '#f9f0ff' },
+ F6: { text: '维修', color: '#13c2c2', bgColor: '#f0fafa' }
+ }
+
+ // 获取状态颜色
+ const getStatusColor = (status : number) => {
+ return statusConfig[status]?.color || '#666666'
+ }
+
+ // 获取状态背景色
+ const getStatusBgColor = (status : number) => {
+ return statusConfig[status]?.bgColor || '#f5f5f5'
+ }
+
+ // 获取状态文字
+ const getStatusText = (status : number) => {
+ return statusConfig[status]?.text || '未知状态'
+ }
+
+ // 获取状态图标
+ const getStatusIcon = (status : number) => {
+ return `${statusConfig[status]?.icon} li-text-${getStatusColor(status).substring(1)}`
+ }
+
+ // 获取状态描述
+ const getStatusDescription = (status : number) => {
+ return statusConfig[status]?.description || '状态未知'
+ }
+
+ // 获取订单状态文字
+ const getOrderStatusText = (status : number) => {
+ return orderStatusConfig[status]?.text || '未知状态'
}
@@ -241,19 +384,87 @@
transition: all 0.3s ease;
}
+ .status-tag {
+ border-radius: 0 0 0 25rpx;
+
+ &.status-0 {
+ color: #1890ff;
+ background-color: #f0f9ff;
+ }
+
+ &.status-1 {
+ color: #1890ff;
+ background-color: #f0f9ff;
+ }
+
+ &.status-2 {
+ color: #52c41a;
+ background-color: #f0fff5;
+ }
+
+ &.status-3 {
+ color: #8c8c8c;
+ background-color: #f5f5f5;
+ }
+ }
+
+ .info-tag {
+ display: inline-block;
+ padding: 4rpx 16rpx;
+ font-size: 24rpx;
+ border-radius: 4rpx;
+
+ &.type-delivery {
+ color: #1890ff;
+ background-color: #f0f7ff;
+ border: 1px solid #e6f4ff;
+ }
+
+ &.type-measure {
+ color: #722ed1;
+ background-color: #f9f0ff;
+ border: 1px solid #f4e6ff;
+ }
+
+ &.type-repair {
+ color: #13c2c2;
+ background-color: #f0fafa;
+ border: 1px solid #e6f7f7;
+ }
+
+ &.status-0 {
+ color: #ff9d00;
+ background-color: #fff7e6;
+ border: 1px solid #ffedc7;
+ }
+
+ &.status-1 {
+ color: #52c41a;
+ background-color: #f6ffed;
+ border: 1px solid #e8ffd1;
+ }
+
+ &.status-2 {
+ color: #8c8c8c;
+ background-color: #fafafa;
+ border: 1px solid #f0f0f0;
+ }
+ }
+
::v-deep .wd-button {
width: 160rpx !important;
height: 65rpx !important;
min-width: 160rpx !important;
}
+
.custom-shadow {
height: 85rpx !important;
font-size: 32rpx !important;
box-shadow: 0 3px 1px -2px rgb(0 0 0 / 20%), 0 2px 2px 0 rgb(0 0 0 / 14%), 0 1px 5px 0 rgb(0 0 0 / 12%);
background-color: #2EA1EA !important;
width: 100% !important;
- display: flex!important;
- align-items: center!important;
- justify-content: center!important;
+ display: flex !important;
+ align-items: center !important;
+ justify-content: center !important;
}
\ No newline at end of file
diff --git a/pagesA/task_hall/list.vue b/pagesA/task_hall/list.vue
index dce25f0..8b3769f 100644
--- a/pagesA/task_hall/list.vue
+++ b/pagesA/task_hall/list.vue
@@ -14,20 +14,24 @@
-
+
- 工单编号: {{item.ticket_no}}
-
-
- 商城
- 维修
- 量房
+
+
+ {{item.ticket_no}}
+
+
+
+
+ {{getTaskTypeName(item.type)}}
+
-
+
预约时间
{{item.order.appoint_date}} {{item.order.appoint_time}}
@@ -67,7 +71,8 @@
详情
- 接单
+ 接单
@@ -75,6 +80,7 @@
+
@@ -82,10 +88,12 @@