HD_wangm 3 месяцев назад
Родитель
Сommit
0e1fd39e8b
3 измененных файлов с 128 добавлено и 41 удалено
  1. 93 0
      pages/order/detail/index.uvue
  2. 33 39
      pages/order/detail/returnIndex.uvue
  3. 2 2
      pages/score/index.uvue

+ 93 - 0
pages/order/detail/index.uvue

@@ -27,6 +27,24 @@
                         <text class="info-label">机型</text>
                         <text class="info-value">{{ detailData.brand ?? '' }} {{ detailData.model ?? '' }}</text>
                     </view>
+					<view class="info-item" v-if="returnType">
+					    <text class="info-label">结单退回原因</text>
+					    <text class="info-value">{{ getReturnTypeName(returnType)}}</text>
+					</view>
+					<view class="info-item" v-if="returnReason">
+					    <text class="info-label">结单退回说明</text>
+					    <text class="info-value">{{ returnReason}}</text>
+					</view>
+					
+					<view class="info-item" v-if="acceptReturnType">
+					    <text class="info-label">接单退回原因</text>
+					    <text class="info-value">{{ getReturnTypeName(acceptReturnType)}}</text>
+					</view>
+					<view class="info-item" v-if="acceptReturnReason">
+					    <text class="info-label">接单退回说明</text>
+					    <text class="info-value">{{ acceptReturnReason}}</text>
+					</view>
+					
 					<view class="info-item">
 					    <text class="info-label">{{getLabel(detailData)}}</text>
 					    <text class="info-value">{{ getDisplayTime(detailData) }}</text>
@@ -77,6 +95,12 @@
 	const statusDictList = ref<SysDictData[]>([]) // 工单状态字典列表
 	// 添加字典加载状态
 	const dictLoaded = ref<boolean>(false)
+	const returnType = ref<string>("")
+	const returnReason = ref<string>("")
+	const acceptReturnType = ref<string>("")
+	const acceptReturnReason = ref<string>("")
+	const returnTypeDictList = ref<SysDictData[]>([]) // 退回原因字典列表
+	
 
 	const formatDate = (dateString: string): string => {
 	  if (dateString == '' || dateString == null) return ''
@@ -188,6 +212,8 @@
 	        dictLoaded.value = true
 	    }
 	}
+	
+	
     // 详情数据
     const detailData = ref<acceptOrderInfo>({
 		orderType: 0,
@@ -259,6 +285,68 @@
 	    const dictItem = statusDictList.value.find(dict => dict.dictValue == rawStatus)
 	    return dictItem!=null ? dictItem.dictLabel : rawStatus
 	}
+	
+	const getReturnTypeName = (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 dictItem = returnTypeDictList.value.find(dict => dict.dictValue == rawStatus)
+	    return dictItem!=null ? dictItem.dictLabel : rawStatus
+	}
+	
+	const loadReturnDictList = async (): 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 resultObj = result as UTSJSONObject
+	
+	        if (resultObj['code'] == 200) {
+	            const data = resultObj['data'] as any[]
+	            const dictData: SysDictData[] = []
+	
+	            if (data.length > 0) {
+	                for (let i = 0; i < data.length; i++) {
+	                    const item = data[i] as UTSJSONObject
+	                    // 只提取需要的字段
+	                    const dictItem: SysDictData = {
+							dictValue: item['dictValue'] as string | null,
+							dictLabel: item['dictLabel'] as string | null,
+							dictCode: null,
+							dictSort: null,
+							dictType: null,
+							cssClass: null,
+							listClass: null,
+							isDefault: null,
+							status: null,
+							default: null,
+							createTime: null,
+							remark: null
+						}
+	                    dictData.push(dictItem)
+	                }
+	            }
+	
+	            returnTypeDictList.value = dictData
+	        }
+	    } catch (e: any) {
+	        console.error('获取工单状态字典失败:', e.message)
+	    }
+	}
 
     // 加载详情数据
     const loadDetail = async (id: string, orderType?: number): Promise<void> => {
@@ -344,6 +432,11 @@
                     workEndTime: data['workEndTime'] as string | null  // 新增字段
                 }
                 detailData.value = orderDtail
+				await loadReturnDictList()
+				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) ?? ''
             } else {
                 const msg = resultObj['msg'] as string | null
                 uni.showToast({

+ 33 - 39
pages/order/detail/returnIndex.uvue

@@ -39,29 +39,9 @@
 					    <text class="info-label">接单时间</text>
 					    <text class="info-value">{{ acceptTime ?? '' }}</text>
 					</view>
-					<!-- <view class="info-item">
-					    <text class="info-label">挂起原因</text>
-					    <view class="form-picker" @click="showReasonPicker = true">
-					        <view class="picker-display">
-					            <text v-if="suspendReason" class="selected-value">{{ suspendReason }}</text>
-					            <text v-else class="placeholder">请选择挂起原因</text>
-					            <text class="arrow">▼</text>
-					        </view>
-					    </view>
-					</view> -->
                 </view>
             </view>
-			<!-- <view class="info-section">
-				<view class="section-title">
-					<text class="section-title-text">工作负责人</text>
-				</view>
-				<view class="info-card">
-					<view class="info-item">
-						<input class="input" type="text" placeholder="请输入工作负责人" v-model="teamLeaderName" />
-					</view>
-				</view>
-			</view> -->
-			<!-- 工作负责人选择 -->
+			<!-- 退回原因选择 -->
 			<view class="info-section">
 			    <!-- <view class="section-title">
 			        <text class="section-title-text">退回类型</text>
@@ -69,26 +49,26 @@
 			    <view class="info-card">
 			        <view class="info-item">
 						<view class="info-label">
-							<text class="form-label required">退回类型<text style="color: red;">*</text></text>
+							<text class="form-label required">退回原因<text style="color: red;">*</text></text>
 						</view>
 						<view class="info-value">
 						    <view class="form-picker" @click="showReasonPicker = true">
 						        <view class="picker-display">
 						            <text v-if="returnType" class="selected-value">{{ returnTypeLabel }}</text>
-						            <text v-else class="placeholder">请选择退回类型</text>
+						            <text v-else class="placeholder">请选择退回原因</text>
 						            <text class="arrow">▼</text>
 						        </view>
 						    </view>
 						</view>
 					</view>
-					<view class="info-item">
+					<view class="info-item" v-if="returnType == '0'">
 						<view class="info-label">
-							<text class="form-label required">退回原因<text style="color: red;">*</text></text>
+							<text class="form-label required">退回说明<text style="color: red;">*</text></text>
 						</view>
 						<view class="info-value">
 							 <textarea
 								class="reject-reason-textarea"
-								placeholder="请输入退回原因(必填)"
+								placeholder="请输入退回说明(必填)"
 								v-model="returnReason"
 								maxlength="100"
 								:show-confirm-bar="false"
@@ -159,11 +139,13 @@
 	const returnType = ref<string>('')
 	const returnReason = ref<string>("")
 	const returnTypeLabel = ref<string>("")
-	
+	const acceptReturnType = ref<string>('')
+	const acceptReturnReason = ref<string>("")
+
 	const teamLeaderName = ref<string>("")
 	// 添加字典加载状态
 	const dictLoaded = ref<boolean>(false)
-	
+
 	// 选择器选项类型
 	type PickerOption = {
 	    label: string
@@ -171,7 +153,7 @@
 	}
 
 	// 选中的挂起原因
-	
+
 	const selectedReasonIndex = ref<number>(-1)
 	const returnTypeOptions = ref<PickerOption[]>([])
 	const showReasonPicker = ref<boolean>(false)
@@ -179,7 +161,14 @@
 	// 获取负责人列表(使用用户列表接口)
 	const dictList = async (): Promise<void> => {
 	    try {
-	        const result = await getDictDataByType('gxt_return_type')
+			const dictString = ref("")
+			if(workOrderStatus.value == 'assigned') {
+				dictString.value = "gxt_accept_return_type"
+			} else {
+				dictString.value = "gxt_return_type"
+			}
+
+	        const result = await getDictDataByType(dictString.value)
 	        const resultObj = result as UTSJSONObject
 
 	        if (resultObj['code'] == 200) {
@@ -230,18 +219,18 @@
 
 	const isDealing = ref(false)
 	const hasDealed = ref(false)
-	// 处理接单操作
+	// 处理退回操作
 	const handleSuspendOrder = async (): Promise<void> => {
 		if (returnType.value == '') {
 			uni.showToast({
-				title: '请选择退回类型',
+				title: '请选择退回原因',
 				icon: 'none'
 			})
 			return
 		}
-		if (returnReason.value == '' || returnReason.value.trim() === '') {
+		if (returnType.value == '0' && (returnReason.value == '' || returnReason.value.trim() === '')) {
 			uni.showToast({
-				title: '请选输入退回原因',
+				title: '请选输入退回说明',
 				icon: 'none'
 			})
 			return
@@ -253,11 +242,13 @@
 			orderType: orderType.value,
 			workOrderProjectNo: workOrderProjectNo.value,
 			workOrderStatus: workOrderStatus.value,
-			returnType: returnType.value,
-			returnReason: returnReason.value
+			returnType: workOrderStatus.value != 'assigned' ? returnType.value : null,
+			returnReason: workOrderStatus.value != 'assigned' ? returnReason.value : null,
+			acceptReturnType: workOrderStatus.value == 'assigned' ? returnType.value : null,
+			acceptReturnReason: workOrderStatus.value == 'assigned' ? returnReason.value : null,
 			// gxtRepairOrder:
 		} as UTSJSONObject
-		
+
 		try {
 			const result = await returnRepairOrder(subOrder)
 			const resultObj = result as UTSJSONObject
@@ -302,8 +293,8 @@
     const loadDetail = async (id: string, orderType?: string): Promise<void> => {
         try {
             loading.value = true
-			
-			await dictList()
+
+
 
             let result: any;
 
@@ -332,6 +323,9 @@
 				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) ?? ''
+				await dictList()
 				if (returnTypeOptions.value.length > 0 && returnType.value != '') {
 					// 循环匹配
 				    for (const option of returnTypeOptions.value) {

+ 2 - 2
pages/score/index.uvue

@@ -224,9 +224,9 @@
         <view class="popup-header">
 			<text class="popup-title">选择年月</text>
 			<view class="popup-actions">
-				<view class="popup-btn">
+				<!-- <view class="popup-btn">
 					<text class="cancel-btn" @click="closeDatePicker">取消</text>
-				</view>
+				</view> -->
 			</view>
         </view>