ZN
6 小时以前 79537f4527695f3c6fbfb2d287edd877a289d472
售后服务-临期售后管理根据进销存升级同步
已修改3个文件
134 ■■■■■ 文件已修改
src/api/customerService/index.js 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/customerService/expiryAfterSales/components/formDia.vue 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/customerService/expiryAfterSales/index.vue 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/customerService/index.js
@@ -45,7 +45,7 @@
// 临期售后管理-分页查询
export function expiryAfterSalesListPage(query) {
  return request({
    url: '/expiryAfterSales/listPage',
    url: '/afterSalesNearExpiryService/listPage',
    method: 'get',
    params: query,
  })
@@ -54,7 +54,7 @@
// 临期售后管理-新增
export function expiryAfterSalesAdd(query) {
  return request({
    url: '/expiryAfterSales/add',
    url: '/afterSalesNearExpiryService/add',
    method: 'post',
    data: query,
  })
@@ -63,16 +63,16 @@
// 临期售后管理-更新
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,
  })
src/views/customerService/expiryAfterSales/components/formDia.vue
@@ -160,8 +160,9 @@
<script setup>
import {ref, computed} from "vue";
import useUserStore from "@/store/modules/user.js";
// import {userListNoPageByTenantId} from "@/api/system/user.js"; // 暂时注释掉,使用假数据
// import {expiryAfterSalesAdd, expiryAfterSalesUpdate} from "@/api/customerService/index.js"; // 暂时注释掉,使用假数据
import { getCurrentDate } from "@/utils/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);
@@ -217,14 +218,10 @@
  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') {
        // 新增时重置表单
@@ -255,12 +252,30 @@
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('提交数据失败,请稍后重试');
            });
        }
    });
}
@@ -271,15 +286,6 @@
  dialogFormVisible.value = false;
  emit('close')
};
// 获取当前日期并格式化为 YYYY-MM-DD
function getCurrentDate() {
    const today = new Date();
    const year = today.getFullYear();
    const month = String(today.getMonth() + 1).padStart(2, "0");
    const day = String(today.getDate()).padStart(2, "0");
    return `${year}-${month}-${day}`;
}
defineExpose({
  openDialog,
src/views/customerService/expiryAfterSales/index.vue
@@ -72,7 +72,7 @@
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()
@@ -127,7 +127,8 @@
            label: "处理状态",
            prop: "status",
            width: "",
            slot: true,
            dataType: "slot",
            slot: "status",
        },
        {
            label: "处理人",
@@ -142,7 +143,8 @@
        {
            label: "操作",
            prop: "operation",
            slot: true,
            dataType: "slot",
            slot: "operation",
            width: "200",
        },
    ],
@@ -190,21 +192,39 @@
// 获取列表数据
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;
    tableLoading.value = false;
    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('获取数据失败,请稍后重试');
    });
};
// 打开弹框
@@ -230,18 +250,12 @@
    })
        .then(() => {
            tableLoading.value = true;
            // 取消注释并使用真实API
            // expiryAfterSalesDelete(ids).then(() => {
            //     proxy.$modal.msgSuccess("删除成功");
            //     getList();
            // }).finally(() => {
            //     tableLoading.value = false;
            // });
            // 暂时模拟删除成功
            tableLoading.value = false;
            proxy.$modal.msgSuccess("删除成功");
            getList();
            expiryAfterSalesDelete(ids).then(() => {
                proxy.$modal.msgSuccess("删除成功");
                getList();
            }).finally(() => {
                tableLoading.value = false;
            });
        })
        .catch(() => {
            proxy.$modal.msg("已取消");