فهرست منبع

维修退回修改

HD_wangm 3 ماه پیش
والد
کامیت
554042cde3
3فایلهای تغییر یافته به همراه43 افزوده شده و 26 حذف شده
  1. 28 13
      pages/order/detail/index.uvue
  2. 14 12
      pages/order/detail/returnIndex.uvue
  3. 1 1
      pages/order/index.uvue

+ 28 - 13
pages/order/detail/index.uvue

@@ -38,7 +38,7 @@
 					
 					<view class="info-item" v-if="acceptReturnType">
 					    <text class="info-label">接单退回原因</text>
-					    <text class="info-value">{{ getReturnTypeName(acceptReturnType)}}</text>
+					    <text class="info-value">{{ getAcceptReturnTypeName(acceptReturnType)}}</text>
 					</view>
 					<view class="info-item" v-if="acceptReturnReason">
 					    <text class="info-label">接单退回说明</text>
@@ -100,6 +100,7 @@
 	const acceptReturnType = ref<string>("")
 	const acceptReturnReason = ref<string>("")
 	const returnTypeDictList = ref<SysDictData[]>([]) // 退回原因字典列表
+	const acceptReturnTypeDictList = ref<SysDictData[]>([]) // 退回原因字典列表
 	
 
 	const formatDate = (dateString: string): string => {
@@ -302,17 +303,26 @@
 	    const dictItem = returnTypeDictList.value.find(dict => dict.dictValue == rawStatus)
 	    return dictItem!=null ? dictItem.dictLabel : rawStatus
 	}
+	const getAcceptReturnTypeName = (item: string | null): string | null => {
+	    if (item == null) return ''
+	    // const orderInfoItem = item as orderInfo
+	    const rawStatus = item
+	
+	    if (rawStatus==null) return ''
+	
+		// 如果字典尚未加载,返回原始值
+		if (dictLoaded.value == false) {
+			return rawStatus
+		}
 	
-	const loadReturnDictList = async (): Promise<void> => {
+	    // 查找字典中对应的标签
+	    const dictItem = acceptReturnTypeDictList.value.find(dict => dict.dictValue == rawStatus)
+	    return dictItem!=null ? dictItem.dictLabel : rawStatus
+	}
+	
+	const loadReturnDictList = async (returnTypeDict: string): Promise<void> => {
 	    try {
-			const dictString = ref("")
-			if(detailData.value.workOrderStatus == 'assigned') {
-				dictString.value = "gxt_accept_return_type"
-			} else {
-				dictString.value = "gxt_return_type"
-			}
-			
-			const result = await getDictDataByType(dictString.value)
+			const result = await getDictDataByType(returnTypeDict)
 	        const resultObj = result as UTSJSONObject
 	
 	        if (resultObj['code'] == 200) {
@@ -340,8 +350,12 @@
 	                    dictData.push(dictItem)
 	                }
 	            }
-	
-	            returnTypeDictList.value = dictData
+				if(returnTypeDict == 'gxt_return_type') {
+					returnTypeDictList.value = dictData
+				} else {
+					acceptReturnTypeDictList.value = dictData
+				}
+	            
 	        }
 	    } catch (e: any) {
 	        console.error('获取工单状态字典失败:', e.message)
@@ -432,7 +446,8 @@
                     workEndTime: data['workEndTime'] as string | null  // 新增字段
                 }
                 detailData.value = orderDtail
-				await loadReturnDictList()
+				await loadReturnDictList('gxt_return_type')
+				await loadReturnDictList('gxt_accept_return_type')
 				returnType.value = (data['returnType'] as string | null) ?? ''
 				returnReason.value = (data['returnReason'] as string | null) ?? ''
 				acceptReturnType.value = (data['acceptReturnType'] as string | null) ?? ''

+ 14 - 12
pages/order/detail/returnIndex.uvue

@@ -162,7 +162,7 @@
 	const dictList = async (): Promise<void> => {
 	    try {
 			const dictString = ref("")
-			if(workOrderStatus.value == 'assigned') {
+			if(workOrderStatus.value != 'to_finish') {
 				dictString.value = "gxt_accept_return_type"
 			} else {
 				dictString.value = "gxt_return_type"
@@ -230,7 +230,7 @@
 		}
 		if (returnType.value == '0' && (returnReason.value == '' || returnReason.value.trim() === '')) {
 			uni.showToast({
-				title: '请输入退回说明',
+				title: '请输入退回说明',
 				icon: 'none'
 			})
 			return
@@ -242,10 +242,10 @@
 			orderType: orderType.value,
 			workOrderProjectNo: workOrderProjectNo.value,
 			workOrderStatus: workOrderStatus.value,
-			returnType: workOrderStatus.value != 'assigned' ? returnType.value : null,
-			returnReason: workOrderStatus.value != 'assigned' && returnType.value == '0' ? returnReason.value : null,
-			acceptReturnType: workOrderStatus.value == 'assigned' ? returnType.value : null,
-			acceptReturnReason: workOrderStatus.value == 'assigned' && returnType.value == '0' ? returnReason.value : null,
+			returnType: workOrderStatus.value == 'to_finish' ? returnType.value : null,
+			returnReason: workOrderStatus.value == 'to_finish' && returnType.value == '0' ? returnReason.value : null,
+			acceptReturnType: workOrderStatus.value != 'to_finish' ? returnType.value : null,
+			acceptReturnReason: workOrderStatus.value != 'to_finish' && returnType.value == '0' ? returnReason.value : null,
 		} as UTSJSONObject
 
 		try {
@@ -320,13 +320,15 @@
 				brand.value = (data['brand'] as string | null) ?? ''
 				model.value = (data['model'] as string | null) ?? ''
 				acceptTime.value = (data['acceptTime'] as string | null) ?? ''
-				returnType.value = (data['returnType'] as string | null) ?? ''
-				returnReason.value = (data['returnReason'] as string | null) ?? ''
-				acceptReturnType.value = (data['acceptReturnType'] as string | null) ?? ''
-				acceptReturnReason.value = (data['acceptReturnReason'] as string | null) ?? ''
+				returnType.value = workOrderStatus.value == 'to_finish' ? '1' : ''
+				// returnType.value = (data['returnType'] as string | null) ?? ''
+				// returnReason.value = (data['returnReason'] as string | null) ?? ''
+				// acceptReturnType.value = (data['acceptReturnType'] as string | null) ?? ''
+				// acceptReturnReason.value = (data['acceptReturnReason'] as string | null) ?? ''
 				await dictList()
-				if (returnTypeOptions.value.length > 0 && returnType.value != '') {
-					// 循环匹配
+				if (returnTypeOptions.value.length > 0 && workOrderStatus.value == 'to_finish') {
+					// returnTypeLabel.value = returnTypeOptions.value[0].label
+					// // 循环匹配
 				    for (const option of returnTypeOptions.value) {
 						// 严格匹配value
 						if (returnType.value == option.value) {

+ 1 - 1
pages/order/index.uvue

@@ -66,7 +66,7 @@
 						</view>
 						<view class="btn-group">
 							<view
-								v-if="getOrderStatus(item) == 'assigned' && canHandleOrder(item,'accept')"
+								v-if="(getOrderStatus(item) == 'assigned' || getOrderStatus(item) == 'return') && canHandleOrder(item,'accept')"
 								class="btn-primary info-value"
 								@click.stop="handleItemClick(item,'')"
 								>