feat: 创建工单的优化调整

This commit is contained in:
2025-08-10 23:34:45 +08:00
parent bb33726459
commit 76a176d4cd
2 changed files with 22 additions and 16 deletions

View File

@@ -9,10 +9,10 @@
<image src="./images/icon_service.png" class="order-icon"></image> <image src="./images/icon_service.png" class="order-icon"></image>
<uni-data-select <uni-data-select
v-if="!isCallSuccess && workOrderTypeList.length > 0" v-if="!isCallSuccess && workOrderTypeList.length > 0"
class="order-select" class="order-select"
placeholder="请选择服务工单" placeholder="请选择服务工单"
v-model="workOrderTypeName" v-model="workOrderTypeName"
:localdata="workOrderTypeList" :localdata="workOrderTypeListSelectData"
@change="changeWorkOrderType" @change="changeWorkOrderType"
></uni-data-select> ></uni-data-select>
<text v-else class="order-description">{{ workOrderTypeName }}</text> <text v-else class="order-description">{{ workOrderTypeName }}</text>
@@ -96,11 +96,16 @@ const contactPhone = ref("");
const isCallSuccess = ref(false); // 呼叫成功状态 const isCallSuccess = ref(false); // 呼叫成功状态
const workOrderId = ref(0); // 工单ID const workOrderId = ref(0); // 工单ID
const workOrderTypeList = ref([]) const workOrderTypeList = ref([])
const workOrderTypeListSelectData = ref([])
const changeWorkOrderType = (item) => { const changeWorkOrderType = (index) => {
console.log(item) if (index < 0 || index >= workOrderTypeListSelectData.value.length) {
workOrderTypeId.value = item.value return;
workOrderTypeName.value = item.text }
const item = workOrderTypeList.value[index]
console.log("item:", item)
workOrderTypeId.value = item.id
workOrderTypeName.value = item.workOrderTypeName
} }
const handleCall = async () => { const handleCall = async () => {
@@ -177,17 +182,18 @@ const sendCreateWorkOrder = async () => {
/// 获取工单类型 /// 获取工单类型
const getWorkOrderType = async () => { const getWorkOrderType = async () => {
const res = await workOrderTypeListForBiz() const res = await workOrderTypeListForBiz()
if(res.code === 0) { if (res.code === 0) {
res.data.forEach((item, index) => { workOrderTypeList.value = res.data
workOrderTypeList.value.push({ workOrderTypeList.value.forEach((item, index) => {
value: item.id, workOrderTypeListSelectData.value.push({
text: item.workOrderTypeName, value: index,
}) text: item.workOrderTypeName,
})
}) })
if (workOrderTypeList.value.length > 0) { if (workOrderTypeList.value.length > 0) {
workOrderTypeId.value = workOrderTypeList.value[0].value workOrderTypeId.value = workOrderTypeList.value[0].id
workOrderTypeName.value = workOrderTypeList.value[0].text workOrderTypeName.value = workOrderTypeList.value[0].workOrderTypeName
} }
} }
} }

View File

@@ -86,7 +86,7 @@
align-items: center; align-items: center;
margin-bottom: 10px; margin-bottom: 10px;
font-size: 14px; font-size: 14px;
color: #666; color: #333;
} }
.detail-label { .detail-label {
@@ -103,7 +103,7 @@
outline: none; outline: none;
width: calc(100% - 80px); width: calc(100% - 80px);
font-size: 14px; font-size: 14px;
color: #999; color: #333;
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
} }