| | |
| | | }) |
| | | } |
| | | // 售后处理-附件删除 |
| | | export function afterSalesServiceFileDel(ids) { |
| | | export function afterSalesServiceFileDel(id) { |
| | | return request({ |
| | | url: '/afterSalesService/file/del', |
| | | url: `/afterSalesService/file/del/${id}`, |
| | | method: 'delete', |
| | | data: ids, |
| | | }) |
| | | } |
| | | |
| | |
| | | // 临期售后管理-分页查询 |
| | | export function expiryAfterSalesListPage(query) { |
| | | return request({ |
| | | url: '/expiryAfterSales/listPage', |
| | | url: '/afterSalesNearExpiryService/listPage', |
| | | method: 'get', |
| | | params: query, |
| | | }) |
| | |
| | | // 临期售后管理-新增 |
| | | export function expiryAfterSalesAdd(query) { |
| | | return request({ |
| | | url: '/expiryAfterSales/add', |
| | | url: '/afterSalesNearExpiryService/add', |
| | | method: 'post', |
| | | data: query, |
| | | }) |
| | |
| | | // 临期售后管理-更新 |
| | | export function expiryAfterSalesUpdate(query) { |
| | | return request({ |
| | | url: '/expiryAfterSales/update', |
| | | url: '/afterSalesNearExpiryService/update', |
| | | method: 'post', |
| | | data: query, |
| | | }) |
| | | } |
| | | |
| | | // 临期售后管理-删除 |
| | | export function expiryAfterSalesDelete(query) { |
| | | export function expiryAfterSalesDelete(ids) { |
| | | return request({ |
| | | url: '/expiryAfterSales/delete', |
| | | url: '/afterSalesNearExpiryService/delete?ids=' + ids, |
| | | method: 'delete', |
| | | data: query, |
| | | }) |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | // 打开附件弹框----- TODO:接口是没有对接的,需要新增接口,为写报告添加的 |
| | | // 打开附件弹框 |
| | | const openFilesFormDia = async (row) => { |
| | | currentFileRow.value = row |
| | | try { |
| | |
| | | try { |
| | | const formData = new FormData() |
| | | formData.append("file", file) |
| | | formData.append("id", currentFileRow.value.id) |
| | | const uploadRes = await request({ |
| | | url: "/file/upload", |
| | | url: "/afterSalesService/file/upload", |
| | | method: "post", |
| | | data: formData, |
| | | headers: { |
| | |
| | | }, |
| | | }) |
| | | if (uploadRes.code === 200) { |
| | | const fileData = { |
| | | afterSalesServiceId: currentFileRow.value.id, |
| | | name: uploadRes.data?.originalName || file.name, |
| | | url: uploadRes.data?.tempPath || uploadRes.data?.url, |
| | | } |
| | | const saveRes = await afterSalesServiceFileAdd(fileData) |
| | | if (saveRes.code === 200) { |
| | | proxy.$modal.msgSuccess("文件上传成功") |
| | | // 重新获取文件列表 |
| | | const listRes = await afterSalesServiceFileListPage({ |
| | | afterSalesServiceId: currentFileRow.value.id, |
| | | current: 1, |
| | |
| | | }) |
| | | if (listRes.code === 200 && fileListRef.value) { |
| | | const fileList = (listRes.data?.records || []).map((item) => ({ |
| | | name: item.name || item.fileName, |
| | | url: item.url || item.fileUrl, |
| | | name: item.fileName, |
| | | url: item.fileUrl, |
| | | id: item.id, |
| | | ...item, |
| | | })) |
| | | fileListRef.value.setList(fileList) |
| | | } |
| | | resolve({ name: fileData.name, url: fileData.url, id: saveRes.data?.id }) |
| | | } else { |
| | | proxy.$modal.msgError(saveRes.msg || "文件保存失败") |
| | | resolve(null) |
| | | } |
| | | resolve({ name: file.name, url: "", id: null }) |
| | | } else { |
| | | proxy.$modal.msgError(uploadRes.msg || "文件上传失败") |
| | | resolve(null) |
| | |
| | | // 删除附件 |
| | | const handleFileDelete = async (row) => { |
| | | try { |
| | | const res = await afterSalesServiceFileDel([row.id]) |
| | | // 添加确认对话框 |
| | | const confirmResult = await ElMessageBox.confirm( |
| | | '确定要删除这个附件吗?', |
| | | '删除确认', |
| | | { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | } |
| | | ) |
| | | |
| | | if (confirmResult === 'confirm') { |
| | | const res = await afterSalesServiceFileDel(row.id) |
| | | if (res.code === 200) { |
| | | proxy.$modal.msgSuccess("删除成功") |
| | | if (currentFileRow.value && fileListRef.value) { |
| | |
| | | }) |
| | | if (listRes.code === 200) { |
| | | const fileList = (listRes.data?.records || []).map((item) => ({ |
| | | name: item.name || item.fileName, |
| | | url: item.url || item.fileUrl, |
| | | name: item.fileName, |
| | | url: item.fileUrl, |
| | | id: item.id, |
| | | ...item, |
| | | })) |
| | |
| | | proxy.$modal.msgError(res.msg || "删除失败") |
| | | return false |
| | | } |
| | | } |
| | | } catch (error) { |
| | | // 如果用户取消删除,不显示错误信息 |
| | | if (error !== 'cancel') { |
| | | proxy.$modal.msgError("删除失败") |
| | | } |
| | | return false |
| | | } |
| | | } |
| | |
| | | import {ref, computed} from "vue"; |
| | | import useUserStore from "@/store/modules/user.js"; |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | | // import {userListNoPageByTenantId} from "@/api/system/user.js"; // 暂时注释掉,使用假数据 |
| | | // import {expiryAfterSalesAdd, expiryAfterSalesUpdate} from "@/api/customerService/index.js"; // 暂时注释掉,使用假数据 |
| | | import {userListNoPageByTenantId} from "@/api/system/user.js"; |
| | | import {expiryAfterSalesAdd, expiryAfterSalesUpdate} from "@/api/customerService/index.js"; |
| | | const { proxy } = getCurrentInstance() |
| | | const emit = defineEmits(['close']) |
| | | const dialogFormVisible = ref(false); |
| | |
| | | operationType.value = type; |
| | | dialogFormVisible.value = true; |
| | | |
| | | // 模拟获取用户列表 |
| | | userList.value = [ |
| | | { userId: 1, nickName: "张三" }, |
| | | { userId: 2, nickName: "李四" }, |
| | | { userId: 3, nickName: "王五" }, |
| | | { userId: 4, nickName: "赵六" }, |
| | | { userId: 5, nickName: "孙八" } |
| | | ]; |
| | | // 获取用户列表 |
| | | userListNoPageByTenantId().then(res => { |
| | | userList.value = res.data; |
| | | }); |
| | | |
| | | if (type === 'add') { |
| | | // 新增时重置表单 |
| | |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | if (valid) { |
| | | // 模拟提交操作 |
| | | setTimeout(() => { |
| | | console.log("模拟提交的数据:", form.value); |
| | | const submitData = { |
| | | id: form.value.id, |
| | | productName: form.value.productName, |
| | | batchNumber: form.value.batchNumber, |
| | | expireDate: form.value.expiryDate, |
| | | stockQuantity: form.value.stockQuantity, |
| | | customerName: form.value.customerName, |
| | | contactPhone: form.value.contactPhone, |
| | | disRes: form.value.problemDesc, |
| | | status: form.value.status, |
| | | disposeUserId: form.value.handlerId, |
| | | disposeNickName: userList.value.find(item => item.userId === form.value.handlerId)?.nickName, |
| | | disposeResult: form.value.handleResult, |
| | | disDate: form.value.handleDate |
| | | }; |
| | | |
| | | const apiCall = operationType.value === 'add' ? expiryAfterSalesAdd : expiryAfterSalesUpdate; |
| | | apiCall(submitData).then(() => { |
| | | proxy.$modal.msgSuccess(operationType.value === 'add' ? "新增成功" : "更新成功"); |
| | | closeDia(); |
| | | }, 300); |
| | | }).catch(error => { |
| | | console.error('提交数据失败:', error); |
| | | proxy.$modal.msgError('提交数据失败,请稍后重试'); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | |
| | | import {onMounted, ref} from "vue"; |
| | | import FormDia from "@/views/customerService/expiryAfterSales/components/formDia.vue"; |
| | | import {ElMessageBox} from "element-plus"; |
| | | // import {expiryAfterSalesDelete, expiryAfterSalesListPage} from "@/api/customerService/index.js"; // 暂时注释掉,使用假数据 |
| | | import {expiryAfterSalesDelete, expiryAfterSalesListPage} from "@/api/customerService/index.js"; |
| | | import useUserStore from "@/store/modules/user.js"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const userStore = useUserStore() |
| | |
| | | label: "处理状态", |
| | | prop: "status", |
| | | width: "", |
| | | slot: true, |
| | | dataType: "slot", |
| | | slot: "status", |
| | | }, |
| | | { |
| | | label: "处理人", |
| | |
| | | { |
| | | label: "操作", |
| | | prop: "operation", |
| | | slot: true, |
| | | dataType: "slot", |
| | | slot: "operation", |
| | | width: "200", |
| | | }, |
| | | ], |
| | |
| | | // 获取列表数据 |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | // 取消注释并使用真实API |
| | | // expiryAfterSalesListPage({ |
| | | // ...searchForm.value, |
| | | // current: page.value.current, |
| | | // size: page.value.size |
| | | // }).then(res => { |
| | | // tableData.value = res.data.records; |
| | | // page.value.total = res.data.total; |
| | | // tableLoading.value = false; |
| | | // }); |
| | | // 构造查询参数,映射前端字段到后端字段 |
| | | const queryParams = { |
| | | expireDate: searchForm.value.expiryDate, |
| | | disDate: searchForm.value.handleDate, |
| | | status: searchForm.value.status, |
| | | current: page.value.current, |
| | | size: page.value.size |
| | | }; |
| | | |
| | | // 暂时返回空数据 |
| | | tableData.value = []; |
| | | page.value.total = 0; |
| | | expiryAfterSalesListPage(queryParams).then(res => { |
| | | // 映射后端返回数据到前端表格 |
| | | tableData.value = res.data.records.map(item => ({ |
| | | id: item.id, |
| | | productName: item.productName, |
| | | batchNumber: item.batchNumber, |
| | | expiryDate: item.expireDate, |
| | | stockQuantity: item.stockQuantity, |
| | | customerName: item.customerName, |
| | | contactPhone: item.contactPhone, |
| | | problemDesc: item.disRes, |
| | | status: item.status, |
| | | handlerId: item.disposeUserId, |
| | | handlerName: item.disposeNickName, |
| | | handleResult: item.disposeResult, |
| | | handleDate: item.disDate |
| | | })); |
| | | page.value.total = res.data.total; |
| | | tableLoading.value = false; |
| | | }).catch(error => { |
| | | console.error('获取列表数据失败:', error); |
| | | tableLoading.value = false; |
| | | proxy.$modal.msgError('获取数据失败,请稍后重试'); |
| | | }); |
| | | }; |
| | | |
| | | // 打开弹框 |
| | |
| | | }) |
| | | .then(() => { |
| | | tableLoading.value = true; |
| | | // 取消注释并使用真实API |
| | | // expiryAfterSalesDelete(ids).then(() => { |
| | | // proxy.$modal.msgSuccess("删除成功"); |
| | | // getList(); |
| | | // }).finally(() => { |
| | | // tableLoading.value = false; |
| | | // }); |
| | | |
| | | // 暂时模拟删除成功 |
| | | tableLoading.value = false; |
| | | expiryAfterSalesDelete(ids).then(() => { |
| | | proxy.$modal.msgSuccess("删除成功"); |
| | | getList(); |
| | | }).finally(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已取消"); |