|
|
@@ -3,7 +3,7 @@
|
|
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
|
<div v-show="showSearch" class="mb-[10px]">
|
|
|
<el-card shadow="hover">
|
|
|
- <el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
|
|
+ <el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="120">
|
|
|
<el-form-item label="报备单号" prop="preparedNo">
|
|
|
<el-input v-model="queryParams.preparedNo" placeholder="请输入" clearable @keyup.enter="handleQuery" />
|
|
|
</el-form-item>
|
|
|
@@ -37,7 +37,7 @@
|
|
|
<el-card shadow="hover">
|
|
|
<template #header>
|
|
|
<el-row :gutter="10">
|
|
|
- <el-col :span="1.5">
|
|
|
+ <!-- <el-col :span="1.5">
|
|
|
<el-button type="primary" plain icon="Plus" @click="handleAdd">新增报备</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
@@ -45,18 +45,26 @@
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="danger" plain :disabled="multiple" icon="Delete" @click="handleDelete()">删除</el-button>
|
|
|
- </el-col>
|
|
|
+ </el-col> -->
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
|
|
</el-col>
|
|
|
- <right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
|
|
+ <!-- <right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar> -->
|
|
|
</el-row>
|
|
|
</template>
|
|
|
|
|
|
- <el-table v-loading="loading" border :data="orderList" @selection-change="handleSelectionChange" row-key="id" :expand-row-keys="expandedRows" @expand-change="handleExpandChange">
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ border
|
|
|
+ :data="orderList"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ row-key="id"
|
|
|
+ :expand-row-keys="expandedRows"
|
|
|
+ @expand-change="handleExpandChange"
|
|
|
+ >
|
|
|
<el-table-column type="expand">
|
|
|
<template #default="scope">
|
|
|
- <div style="padding: 10px 50px; background: #f5f7fa;">
|
|
|
+ <div style="padding: 10px 50px; background: #f5f7fa">
|
|
|
<el-table :data="scope.row.products || []" border size="small">
|
|
|
<el-table-column label="产品编号" prop="productNo" width="120" />
|
|
|
<el-table-column label="产品名称" prop="productName" min-width="150" />
|
|
|
@@ -75,7 +83,11 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="金额" align="center" prop="amount" min-width="80" />
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" min-width="160" />
|
|
|
- <el-table-column label="报备到期日" align="center" prop="dueDate" min-width="120" />
|
|
|
+ <el-table-column label="报备到期日" align="center" prop="dueDate" min-width="120">
|
|
|
+ <template #default="scope">
|
|
|
+ <span>{{ parseTime(scope.row.dueDate, '{y}-{m}-{d}') }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="报备状态" align="center" prop="preparedStatus" min-width="80">
|
|
|
<template #default="scope">
|
|
|
<el-checkbox :model-value="scope.row.preparedStatus === 1" disabled />
|
|
|
@@ -88,7 +100,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" align="center" min-width="200">
|
|
|
<template #default="scope">
|
|
|
- <div style="display: flex; flex-wrap: wrap; gap: 4px; justify-content: center;">
|
|
|
+ <div style="display: flex; flex-wrap: wrap; gap: 4px; justify-content: center">
|
|
|
<el-button link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
|
|
|
<el-button link type="success" @click="handleSubmit(scope.row)">提交</el-button>
|
|
|
<el-button link type="danger" @click="handleReject(scope.row)">驳回</el-button>
|
|
|
@@ -102,7 +114,7 @@
|
|
|
<pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" :total="total" @pagination="getList" />
|
|
|
</el-card>
|
|
|
|
|
|
- <el-drawer v-model="dialog.visible" :title="dialog.title" direction="rtl" size="75%" @close="cancel">
|
|
|
+ <el-drawer v-model="dialog.visible" :title="dialog.title" direction="rtl" size="75%" @close="cancel" :close-on-click-modal="true">
|
|
|
<el-form ref="orderFormRef" :model="form" :rules="rules" label-width="120px">
|
|
|
<!-- 基本信息 -->
|
|
|
<el-divider content-position="left">
|
|
|
@@ -135,7 +147,13 @@
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="设计下单时间" prop="estimatedTime">
|
|
|
- <el-date-picker v-model="form.estimatedTime" type="date" placeholder="请选择设计下单时间" value-format="YYYY-MM-DD" style="width: 100%" />
|
|
|
+ <el-date-picker
|
|
|
+ v-model="form.estimatedTime"
|
|
|
+ type="date"
|
|
|
+ placeholder="请选择设计下单时间"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ style="width: 100%"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
@@ -278,7 +296,7 @@
|
|
|
</el-dialog>
|
|
|
|
|
|
<!-- 商品选择抽屉 -->
|
|
|
- <el-drawer v-model="productDrawer.visible" title="商品信息" direction="rtl" size="60%">
|
|
|
+ <el-drawer v-model="productDrawer.visible" title="商品信息" direction="rtl" size="60%" :close-on-click-modal="true">
|
|
|
<div style="margin-bottom: 20px; display: flex; gap: 10px">
|
|
|
<el-select v-model="productQuery.cooperationCode" placeholder="请选择" clearable style="width: 200px">
|
|
|
<el-option v-for="dict in cooperation_code" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
@@ -289,7 +307,7 @@
|
|
|
<el-button style="margin-left: auto">展开</el-button>
|
|
|
</div>
|
|
|
|
|
|
- <el-table :data="availableProducts" border @selection-change="handleProductSelectionChange" max-height="500">
|
|
|
+ <el-table :data="availableProducts" border @selection-change="handleProductSelectionChange" max-height="750">
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
<el-table-column label="合作项目/平台" align="center" prop="cooperationCode" width="120" />
|
|
|
<el-table-column label="商品编号" align="center" prop="productNo" width="120">
|
|
|
@@ -354,7 +372,7 @@
|
|
|
</el-drawer>
|
|
|
|
|
|
<!-- 附件查看抽屉 -->
|
|
|
- <el-drawer v-model="attachmentDrawer.visible" title="查看附件" direction="rtl" size="50%">
|
|
|
+ <el-drawer v-model="attachmentDrawer.visible" title="查看附件" direction="rtl" size="50%" :close-on-click-modal="true">
|
|
|
<el-table :data="attachmentDrawer.attachments" border style="width: 100%">
|
|
|
<el-table-column label="附件名称" prop="name" width="150" />
|
|
|
<el-table-column label="附件预览" align="center" width="200">
|
|
|
@@ -382,7 +400,18 @@
|
|
|
|
|
|
<script setup name="OrderReport" lang="ts">
|
|
|
import { getCurrentInstance, reactive, ref, toRefs, computed } from 'vue';
|
|
|
-import { listPartnerPrepared, getPartnerPrepared, addPartnerPrepared, updatePartnerPrepared, delPartnerPrepared, exportPartnerPrepared, listPartnerPreparedProduct, addPartnerPreparedProduct, delPartnerPreparedProduct, listSiteProducts } from '@/api/partner/prepared';
|
|
|
+import {
|
|
|
+ listPartnerPrepared,
|
|
|
+ getPartnerPrepared,
|
|
|
+ addPartnerPrepared,
|
|
|
+ updatePartnerPrepared,
|
|
|
+ delPartnerPrepared,
|
|
|
+ exportPartnerPrepared,
|
|
|
+ listPartnerPreparedProduct,
|
|
|
+ addPartnerPreparedProduct,
|
|
|
+ delPartnerPreparedProduct,
|
|
|
+ listSiteProducts
|
|
|
+} from '@/api/partner/prepared';
|
|
|
import { PartnerPreparedVO, PartnerPreparedForm, PartnerPreparedQuery } from '@/api/partner/prepared/types';
|
|
|
import { ComponentInternalInstance } from 'vue';
|
|
|
import { getToken } from '@/utils/auth';
|
|
|
@@ -407,9 +436,7 @@ const expandedRows = ref<string[]>([]);
|
|
|
const fileList = ref<any[]>([]);
|
|
|
|
|
|
// 文件上传配置
|
|
|
-const uploadAction = computed(() =>
|
|
|
- import.meta.env.VITE_APP_BASE_API + '/resource/oss/upload?clientid=' + import.meta.env.VITE_APP_CLIENT_ID
|
|
|
-);
|
|
|
+const uploadAction = computed(() => import.meta.env.VITE_APP_BASE_API + '/resource/oss/upload?clientid=' + import.meta.env.VITE_APP_CLIENT_ID);
|
|
|
const uploadHeaders = computed(() => ({
|
|
|
Authorization: 'Bearer ' + getToken()
|
|
|
}));
|
|
|
@@ -448,31 +475,39 @@ async function handleExpandChange(row: any, expandedRowsList: any[]) {
|
|
|
|
|
|
/** 提交按钮 */
|
|
|
function handleSubmit(row: any) {
|
|
|
- proxy?.$modal.confirm('是否确认提交该订单报备?').then(() => {
|
|
|
- const updateData: PartnerPreparedForm = {
|
|
|
- id: row.id,
|
|
|
- preparedStatus: 0 // 提交后变为待审核
|
|
|
- };
|
|
|
- return updatePartnerPrepared(updateData);
|
|
|
- }).then(() => {
|
|
|
- proxy?.$modal.msgSuccess('提交成功');
|
|
|
- getList();
|
|
|
- }).catch(() => {});
|
|
|
+ proxy?.$modal
|
|
|
+ .confirm('是否确认提交该订单报备?')
|
|
|
+ .then(() => {
|
|
|
+ const updateData: PartnerPreparedForm = {
|
|
|
+ id: row.id,
|
|
|
+ preparedStatus: 0 // 提交后变为待审核
|
|
|
+ };
|
|
|
+ return updatePartnerPrepared(updateData);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ proxy?.$modal.msgSuccess('提交成功');
|
|
|
+ getList();
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
}
|
|
|
|
|
|
/** 确认按钮 */
|
|
|
function handleConfirm(row: any) {
|
|
|
- proxy?.$modal.confirm('是否确认该订单报备?').then(() => {
|
|
|
- const updateData: PartnerPreparedForm = {
|
|
|
- id: row.id,
|
|
|
- preparedStatus: 1, // 已通过
|
|
|
- dealStatus: 2 // 已完成
|
|
|
- };
|
|
|
- return updatePartnerPrepared(updateData);
|
|
|
- }).then(() => {
|
|
|
- proxy?.$modal.msgSuccess('确认成功');
|
|
|
- getList();
|
|
|
- }).catch(() => {});
|
|
|
+ proxy?.$modal
|
|
|
+ .confirm('是否确认该订单报备?')
|
|
|
+ .then(() => {
|
|
|
+ const updateData: PartnerPreparedForm = {
|
|
|
+ id: row.id,
|
|
|
+ preparedStatus: 1, // 已通过
|
|
|
+ dealStatus: 2 // 已完成
|
|
|
+ };
|
|
|
+ return updatePartnerPrepared(updateData);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ proxy?.$modal.msgSuccess('确认成功');
|
|
|
+ getList();
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
}
|
|
|
|
|
|
const data = reactive({
|
|
|
@@ -528,13 +563,15 @@ const auditFormRef = ref();
|
|
|
|
|
|
function getList() {
|
|
|
loading.value = true;
|
|
|
- listPartnerPrepared(queryParams.value).then((res: any) => {
|
|
|
- orderList.value = res.rows;
|
|
|
- total.value = res.total;
|
|
|
- loading.value = false;
|
|
|
- }).catch(() => {
|
|
|
- loading.value = false;
|
|
|
- });
|
|
|
+ listPartnerPrepared(queryParams.value)
|
|
|
+ .then((res: any) => {
|
|
|
+ orderList.value = res.rows;
|
|
|
+ total.value = res.total;
|
|
|
+ loading.value = false;
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
function handleQuery() {
|
|
|
@@ -632,25 +669,29 @@ function submitForm() {
|
|
|
if (valid) {
|
|
|
if (form.value.id) {
|
|
|
// 修改订单
|
|
|
- updatePartnerPrepared(form.value).then(() => {
|
|
|
- // 保存商品列表
|
|
|
- return saveProductList(form.value.id as number);
|
|
|
- }).then(() => {
|
|
|
- proxy?.$modal.msgSuccess('修改成功');
|
|
|
- dialog.value.visible = false;
|
|
|
- getList();
|
|
|
- });
|
|
|
+ updatePartnerPrepared(form.value)
|
|
|
+ .then(() => {
|
|
|
+ // 保存商品列表
|
|
|
+ return saveProductList(form.value.id as number);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ proxy?.$modal.msgSuccess('修改成功');
|
|
|
+ dialog.value.visible = false;
|
|
|
+ getList();
|
|
|
+ });
|
|
|
} else {
|
|
|
// 新增订单
|
|
|
- addPartnerPrepared(form.value).then((res: any) => {
|
|
|
- const orderId = res.data;
|
|
|
- // 保存商品列表
|
|
|
- return saveProductList(orderId);
|
|
|
- }).then(() => {
|
|
|
- proxy?.$modal.msgSuccess('新增成功');
|
|
|
- dialog.value.visible = false;
|
|
|
- getList();
|
|
|
- });
|
|
|
+ addPartnerPrepared(form.value)
|
|
|
+ .then((res: any) => {
|
|
|
+ const orderId = res.data;
|
|
|
+ // 保存商品列表
|
|
|
+ return saveProductList(orderId);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ proxy?.$modal.msgSuccess('新增成功');
|
|
|
+ dialog.value.visible = false;
|
|
|
+ getList();
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -659,7 +700,7 @@ function submitForm() {
|
|
|
/** 保存商品列表 */
|
|
|
async function saveProductList(partnerPreparedId: number) {
|
|
|
if (!productList.value.length) return;
|
|
|
-
|
|
|
+
|
|
|
// 逐个保存商品(如果是新增的商品)
|
|
|
for (const product of productList.value) {
|
|
|
if (!product.id) {
|
|
|
@@ -739,30 +780,37 @@ function cancelAudit() {
|
|
|
}
|
|
|
|
|
|
function handleVerify(row: any) {
|
|
|
- proxy?.$modal.confirm('是否确认核实该订单报备?').then(() => {
|
|
|
- const updateData: PartnerPreparedForm = {
|
|
|
- id: row.id,
|
|
|
- preparedStatus: 1
|
|
|
- };
|
|
|
- return updatePartnerPrepared(updateData);
|
|
|
- }).then(() => {
|
|
|
- proxy?.$modal.msgSuccess('核实成功');
|
|
|
- getList();
|
|
|
- });
|
|
|
+ proxy?.$modal
|
|
|
+ .confirm('是否确认核实该订单报备?')
|
|
|
+ .then(() => {
|
|
|
+ const updateData: PartnerPreparedForm = {
|
|
|
+ id: row.id,
|
|
|
+ preparedStatus: 1
|
|
|
+ };
|
|
|
+ return updatePartnerPrepared(updateData);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ proxy?.$modal.msgSuccess('核实成功');
|
|
|
+ getList();
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
function handleReject(row: any) {
|
|
|
- proxy?.$modal.confirm('是否确认驳回该订单报备?').then(() => {
|
|
|
- const updateData: PartnerPreparedForm = {
|
|
|
- id: row.id,
|
|
|
- preparedStatus: 2,
|
|
|
- reject: '驳回'
|
|
|
- };
|
|
|
- return updatePartnerPrepared(updateData);
|
|
|
- }).then(() => {
|
|
|
- proxy?.$modal.msgSuccess('驳回成功');
|
|
|
- getList();
|
|
|
- }).catch(() => {});
|
|
|
+ proxy?.$modal
|
|
|
+ .confirm('是否确认驳回该订单报备?')
|
|
|
+ .then(() => {
|
|
|
+ const updateData: PartnerPreparedForm = {
|
|
|
+ id: row.id,
|
|
|
+ preparedStatus: 2,
|
|
|
+ reject: '驳回'
|
|
|
+ };
|
|
|
+ return updatePartnerPrepared(updateData);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ proxy?.$modal.msgSuccess('驳回成功');
|
|
|
+ getList();
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
}
|
|
|
|
|
|
function handleViewAttachment(row: any) {
|
|
|
@@ -824,29 +872,31 @@ function handleImportProduct() {
|
|
|
}
|
|
|
|
|
|
function searchProducts() {
|
|
|
- listSiteProducts(productQuery.value).then((res: any) => {
|
|
|
- availableProducts.value = (res.data?.rows || []).map((item: any) => ({
|
|
|
- id: item.id,
|
|
|
- cooperationCode: '--',
|
|
|
- productNo: item.productNo,
|
|
|
- platformNo: '--',
|
|
|
- productImage: item.productImage,
|
|
|
- productName: item.productName,
|
|
|
- category: item.isSelf === 1 ? '自营商品' : '非自营商品',
|
|
|
- unit: item.unitName || '包',
|
|
|
- marketPrice: item.marketPrice,
|
|
|
- memberPrice: item.memberPrice,
|
|
|
- basePrice: item.minSellingPrice,
|
|
|
- stockTotal: item.totalInventory || 0,
|
|
|
- stockAvailable: item.nowInventory || 0,
|
|
|
- stockCost: item.virtualInventory || 0,
|
|
|
- shelfStatus: item.productStatus
|
|
|
- }));
|
|
|
- productTotal.value = res.data?.total || 0;
|
|
|
- }).catch(() => {
|
|
|
- availableProducts.value = [];
|
|
|
- productTotal.value = 0;
|
|
|
- });
|
|
|
+ listSiteProducts(productQuery.value)
|
|
|
+ .then((res: any) => {
|
|
|
+ availableProducts.value = (res.data?.rows || []).map((item: any) => ({
|
|
|
+ id: item.id,
|
|
|
+ cooperationCode: '--',
|
|
|
+ productNo: item.productNo,
|
|
|
+ platformNo: '--',
|
|
|
+ productImage: item.productImage,
|
|
|
+ productName: item.productName,
|
|
|
+ category: item.isSelf === 1 ? '自营商品' : '非自营商品',
|
|
|
+ unit: item.unitName || '包',
|
|
|
+ marketPrice: item.marketPrice,
|
|
|
+ memberPrice: item.memberPrice,
|
|
|
+ basePrice: item.minSellingPrice,
|
|
|
+ stockTotal: item.totalInventory || 0,
|
|
|
+ stockAvailable: item.nowInventory || 0,
|
|
|
+ stockCost: item.virtualInventory || 0,
|
|
|
+ shelfStatus: item.productStatus
|
|
|
+ }));
|
|
|
+ productTotal.value = res.data?.total || 0;
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ availableProducts.value = [];
|
|
|
+ productTotal.value = 0;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
function resetProductQuery() {
|
|
|
@@ -868,7 +918,7 @@ function confirmAddProducts() {
|
|
|
proxy?.$modal.msgWarning('请至少选择一个商品');
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
let addedCount = 0;
|
|
|
// 将选中的商品添加到产品列表
|
|
|
selectedProducts.value.forEach((product: any) => {
|
|
|
@@ -890,7 +940,7 @@ function confirmAddProducts() {
|
|
|
addedCount++;
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
if (addedCount > 0) {
|
|
|
proxy?.$modal.msgSuccess(`成功添加 ${addedCount} 个商品`);
|
|
|
} else {
|