diff --git a/src/components/equipCardNew/index.vue b/src/components/equipCardNew/index.vue index dcd6ef7..50229be 100644 --- a/src/components/equipCardNew/index.vue +++ b/src/components/equipCardNew/index.vue @@ -21,7 +21,7 @@ 立即承租 @@ -30,12 +30,16 @@ + + + + + + + + + @@ -615,6 +698,7 @@ import { } from 'http/api/rent-termination/index' import { ElMessage } from 'element-plus' +import { Plus } from '@element-plus/icons-vue' const uploadUrl = import.meta.env.VITE_API_URL + '/file/upload' const addOrEditDialogVisible = ref(false) const leaseList = ref([]) @@ -633,7 +717,10 @@ const scrapSelect = ref([]) const repairRecordList = ref([]) const scrapRecordList = ref([]) const lossRecordList = ref([]) +const viewFileInfoList = ref([]) +const fileListAll = ref([]) const overhaulDetails = ref({}) +const innerVisible = ref(false) const props2 = { multiple: true, checkStrictly: true, @@ -787,53 +874,107 @@ const onAddScrap = () => { // 维修模块设备选择时change事件 const onChangeRepair = (maId: any, index: number) => { - repairSelect.value.forEach((e: any) => { - if (e.maId == maId) { - repairFormList.value[index].deviceName = e.deviceName - repairFormList.value[index].num = e.num - repairFormList.value[index].typeId = e.typeId - } - }) + ElMessage.closeAll() + try { + repairSelect.value.forEach((e: any) => { + if (e.maId == maId && e.isCheck === 0) { + repairFormList.value[index].deviceName = e.deviceName + repairFormList.value[index].num = e.num + repairFormList.value[index].typeId = e.typeId + e.isCheck = 1 + throw new Error() + } + if (e.maId == maId && e.isCheck === 1) { + ElMessage({ + type: 'warning', + message: '当前装备已选择,不可重复选择!', + }) + repairFormList.value[index].maId = '' + throw new Error() + } + }) + } catch (error) {} } const onChangeLoss = (maId: any, index: number) => { - lossSelect.value.forEach((e: any) => { - if (e.maId == maId) { - lossFormList.value[index].deviceName = e.deviceName - lossFormList.value[index].num = e.num - lossFormList.value[index].typeId = e.typeId - } - }) + ElMessage.closeAll() + try { + lossSelect.value.forEach((e: any) => { + if (e.maId == maId && e.isCheck === 0) { + lossFormList.value[index].deviceName = e.deviceName + lossFormList.value[index].num = e.num + lossFormList.value[index].typeId = e.typeId + e.isCheck = 1 + throw new Error() + } + if (e.maId == maId && e.isCheck === 1) { + ElMessage({ + type: 'warning', + message: '当前装备已选择,不可重复选择!', + }) + lossFormList.value[index].maId = '' + throw new Error() + } + }) + } catch (error) {} } const onChangeScrap = (maId: any, index: number) => { - scrapSelect.value.forEach((e: any) => { - if (e.maId == maId) { - scrapFormList.value[index].deviceName = e.deviceName - scrapFormList.value[index].num = e.num - scrapFormList.value[index].typeId = e.typeId - } - }) + ElMessage.closeAll() + try { + scrapSelect.value.forEach((e: any) => { + if (e.maId == maId && e.isCheck === 0) { + scrapFormList.value[index].deviceName = e.deviceName + scrapFormList.value[index].num = e.num + scrapFormList.value[index].typeId = e.typeId + e.isCheck = 1 + throw new Error() + } + if (e.maId == maId && e.isCheck === 1) { + ElMessage({ + type: 'warning', + message: '当前装备已选择,不可重复选择!', + }) + scrapFormList.value[index].maId = '' + throw new Error() + } + }) + } catch (error) {} } const onDeleteRepair = (index: number) => { + try { + repairSelect.value.forEach((e: any) => { + if (e.maId == repairFormList.value[index].maId) { + e.isCheck = 0 + throw new Error() + } + }) + } catch (error) {} repairFormList.value.splice(index, 1) repairFormRefList.value.splice(index, 1) - repairFormRefList.value.forEach((e: any) => { - if (e) e.clearValidate() - }) } const onDeleteLoss = (index: number) => { + try { + lossSelect.value.forEach((e: any) => { + if (e.maId == lossFormList.value[index].maId) { + e.isCheck = 0 + throw new Error() + } + }) + } catch (error) {} lossFormList.value.splice(index, 1) - lossFormList.value.splice(index, 1) - lossFormList.value.forEach((e: any) => { - if (e) e.clearValidate() - }) + lossFormRefList.value.splice(index, 1) } const onDeleteScrap = (index: number) => { + try { + scrapSelect.value.forEach((e: any) => { + if (e.maId == scrapFormList.value[index].maId) { + e.isCheck = 0 + throw new Error() + } + }) + } catch (error) {} scrapFormList.value.splice(index, 1) - scrapFormList.value.splice(index, 1) - scrapFormList.value.forEach((e: any) => { - if (e) e.clearValidate() - }) + scrapFormRefList.value.splice(index, 1) } // 重置 @@ -855,18 +996,18 @@ const onRepublish = async (type: any, orderId: any) => { type == 1 ? (dialogTitle.value = '退租检测') : (dialogTitle.value = '检修明细') if (type === 1) { - const { data: res }: any = await getOrderDetailsByIdApi(getOverhaulApi) + const { data: res }: any = await getOrderDetailsByIdApi(orderId) orderDetails.value = res - repairSelect.value = res.detailsList - lossSelect.value = res.detailsList - scrapSelect.value = res.detailsList + repairSelect.value = JSON.parse(JSON.stringify(res.detailsList)) + lossSelect.value = JSON.parse(JSON.stringify(res.detailsList)) + scrapSelect.value = JSON.parse(JSON.stringify(res.detailsList)) orderDetails.value.orderId = orderId } else { const { data: res }: any = await getOverhaulApi(orderId) - repairRecordList.value = res.repairRecordList scrapRecordList.value = res.scrapRecordList lossRecordList.value = res.lossRecordList + fileListAll.value = res.fileInfoList overhaulDetails.value = res } @@ -995,6 +1136,12 @@ const onClose = () => { scrapFormList.value = [] } +const onViewFileImg = (row: any, index: number) => { + viewFileInfoList.value = [] + viewFileInfoList.value = fileListAll.value.filter((e: any) => e.fileType == index) + innerVisible.value = true +} + onMounted(() => { getLeaseListData() }) @@ -1067,4 +1214,7 @@ h1 { background-color: #ccc; margin-bottom: 15px; } +:deep.upload-tip .el-form-item__label { + color: transparent; +} diff --git a/src/views/user/orderManagement/index.vue b/src/views/user/orderManagement/index.vue index 45f24e3..126b33d 100644 --- a/src/views/user/orderManagement/index.vue +++ b/src/views/user/orderManagement/index.vue @@ -2,7 +2,9 @@ import { ref } from 'vue' import PagingComponent from 'components/PagingComponent/index.vue' import { useRouter } from 'vue-router' -import { getOrderListApi, passApi, failApi } from 'http/api/usercenter/seekorder' +import { getOrderListApi, passApi, failApi, confirmPriceApi } from 'http/api/usercenter/seekorder' +import TitleTip from 'components/TitleTip/index.vue' +import { getOverhaulApi } from 'http/api/rent-termination/index' import uploadComponent from 'components/uploadComponent/index.vue' import previewImg from './previewImg/index.vue' import { ElMessage, ElMessageBox } from 'element-plus' @@ -11,6 +13,15 @@ import type { FormInstance } from 'element-plus' const store = useStore() import { mainStore } from 'store/main' const store2 = mainStore() + +const overhaulDetails = ref({}) +const repairRecordList = ref([]) +const scrapRecordList = ref([]) +const lossRecordList = ref([]) +const orderDetailDtoList = ref([]) +const viewFileInfoList = ref([]) +const fileListAll = ref([]) +const innerVisible = ref(false) /* 查询参数 */ const queryParams: any = ref({ deviceName: '', @@ -266,19 +277,6 @@ const tableData4: any = ref([ jy1: '1400', }, ]) -//费用清单 -const handleViewList = () => { - settleListTitle.value = '费用清单' - moneyParams1.value = { - /* 设备状态 */ - maStatus: 15, - detectionList: [], - insureList: [], - picList: [], - } - // 打开费用清单弹框 - dialogFormVisibleSettleList.value = true -} const settleWordTitle = ref('') const dialogFormVisibleSettleWord: any = ref(false) @@ -319,6 +317,58 @@ const confirmFail = async (index: number) => { }) .catch(() => {}) } + +const onViewOverhaulDetails = () => {} + +//费用清单 +const handleViewList = async (orderId: any) => { + settleListTitle.value = '费用清单' + getOverhaulDetails(orderId) +} +const getOverhaulDetails = (orderId: any) => { + getOverhaulApi(orderId).then((res: any) => { + const { data } = res + orderDetailDtoList.value = data.orderDetailDtoList + repairRecordList.value = data.repairRecordList + scrapRecordList.value = data.scrapRecordList + lossRecordList.value = data.lossRecordList + fileListAll.value = data.fileInfoList + overhaulDetails.value = data + dialogFormVisibleSettleList.value = true + }) +} +const onCostConfirm = (orderId: any) => { + settleListTitle.value = '费用确认' + getOverhaulDetails(orderId) +} +const onViewFileImg = (row: any, index: number) => { + viewFileInfoList.value = [] + viewFileInfoList.value = fileListAll.value.filter((e: any) => e.fileType == index) + innerVisible.value = true +} + +const costSubmit = () => { + ElMessageBox.confirm(`是否确认本次订单费用无误,并提交?`, '温馨提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'success', + }) + .then(async () => { + const res: any = await confirmPriceApi({ + orderId: overhaulDetails.value.orderId, + }) + if (res.code == 200) { + ElMessage({ + type: 'success', + message: '确认成功', + }) + dialogFormVisibleSettleList.value = false + // 刷新列表 + getList() + } + }) + .catch(async () => {}) +}