From 2d391be892b1faca84656a7ac201cbb43640fab3 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 21 五月 2026 16:06:33 +0800
Subject: [PATCH] 财务功能修改
---
src/views/financialManagement/payable/purchaseIn.vue | 313 ++++----
src/views/financialManagement/payable/payment.vue | 438 ++++++-----
src/views/salesManagement/receiptPaymentLedger/index.vue | 2
src/views/financialManagement/receivable/receipt.vue | 1363 ++++++++++++++++++++-----------------
src/views/procurementManagement/paymentLedger/index.vue | 2
5 files changed, 1,139 insertions(+), 979 deletions(-)
diff --git a/src/views/financialManagement/payable/payment.vue b/src/views/financialManagement/payable/payment.vue
index d762ae9..18e7941 100644
--- a/src/views/financialManagement/payable/payment.vue
+++ b/src/views/financialManagement/payable/payment.vue
@@ -1,68 +1,76 @@
<template>
<div class="app-container">
- <el-form :model="filters" :inline="true">
+ <el-form :model="filters"
+ :inline="true">
<el-form-item label="浠樻鍗曞彿:">
- <el-input v-model="filters.paymentNumber" placeholder="璇疯緭鍏ヤ粯娆惧崟鍙�" clearable style="width: 200px;" />
+ <el-input v-model="filters.paymentNumber"
+ placeholder="璇疯緭鍏ヤ粯娆惧崟鍙�"
+ clearable
+ style="width: 200px;" />
</el-form-item>
<el-form-item label="渚涘簲鍟�:">
- <el-select v-model="filters.supplierId" placeholder="璇烽�夋嫨渚涘簲鍟�" clearable filterable style="width: 200px;">
- <el-option
- v-for="item in supplierList"
- :key="item.id"
- :label="item.supplierName"
- :value="item.id"
- />
+ <el-select v-model="filters.supplierId"
+ placeholder="璇烽�夋嫨渚涘簲鍟�"
+ clearable
+ filterable
+ style="width: 200px;">
+ <el-option v-for="item in supplierList"
+ :key="item.id"
+ :label="item.supplierName"
+ :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="浠樻鏂瑰紡:">
- <el-select v-model="filters.paymentMethod" placeholder="璇烽�夋嫨浠樻鏂瑰紡" clearable style="width: 150px;">
- <el-option
- v-for="item in checkout_payment"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
+ <el-select v-model="filters.paymentMethod"
+ placeholder="璇烽�夋嫨浠樻鏂瑰紡"
+ clearable
+ style="width: 150px;">
+ <el-option v-for="item in checkout_payment"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="浠樻鏃ユ湡:">
- <el-date-picker
- v-model="filters.dateRange"
- type="daterange"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- range-separator="鑷�"
- start-placeholder="寮�濮嬫棩鏈�"
- end-placeholder="缁撴潫鏃ユ湡"
- clearable
- style="width: 240px;"
- />
+ <el-date-picker v-model="filters.dateRange"
+ type="daterange"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ range-separator="鑷�"
+ start-placeholder="寮�濮嬫棩鏈�"
+ end-placeholder="缁撴潫鏃ユ湡"
+ clearable
+ style="width: 240px;" />
</el-form-item>
<el-form-item>
- <el-button type="primary" @click="onSearch">鎼滅储</el-button>
+ <el-button type="primary"
+ @click="onSearch">鎼滅储</el-button>
<el-button @click="resetFilters">閲嶇疆</el-button>
</el-form-item>
</el-form>
<div class="table_list">
<div class="actions">
<div>
- <el-statistic title="鏈〉浠樻鍚堣" :value="totalPaymentAmount" :precision="2" prefix="楼" />
+ <el-statistic title="鏈〉浠樻鍚堣"
+ :value="totalPaymentAmount"
+ :precision="2"
+ prefix="楼" />
</div>
<div>
- <el-button @click="handleExport" icon="Download">瀵煎嚭</el-button>
+ <el-button @click="handleExport"
+ icon="Download">瀵煎嚭</el-button>
</div>
</div>
- <PIMTable
- rowKey="id"
- :column="columns"
- :tableData="dataList"
- :tableLoading="tableLoading"
- :page="{
+ <PIMTable rowKey="id"
+ :column="columns"
+ :tableData="dataList"
+ :tableLoading="tableLoading"
+ :page="{
current: pagination.currentPage,
size: pagination.pageSize,
total: pagination.total,
}"
- @pagination="changePage"
- >
+ @pagination="changePage">
<template #amount="{ row }">
<span class="text-danger">楼{{ formatMoney(row.amount) }}</span>
</template>
@@ -70,7 +78,10 @@
<el-tag>{{ getPaymentMethodLabel(row.paymentMethod) }}</el-tag>
</template>
<template #operation="{ row }">
- <el-button type="danger" link @click="handleDelete(row)">鍒犻櫎</el-button>
+ <el-button :disabled="row.accountStatemen"
+ type="danger"
+ link
+ @click="handleDelete(row)">鍒犻櫎</el-button>
</template>
</PIMTable>
</div>
@@ -78,194 +89,211 @@
</template>
<script setup>
-import { ref, reactive, computed, onMounted, getCurrentInstance } from "vue";
-import { ElMessage, ElMessageBox } from "element-plus";
-import { getOptions } from "@/api/procurementManagement/procurementLedger.js";
-import {
- listPageAccountPurchasePayment,
- deleteAccountPurchasePayment,
-} from "@/api/financialManagement/accountPurchasePayment.js";
+ import { ref, reactive, computed, onMounted, getCurrentInstance } from "vue";
+ import { ElMessage, ElMessageBox } from "element-plus";
+ import { getOptions } from "@/api/procurementManagement/procurementLedger.js";
+ import {
+ listPageAccountPurchasePayment,
+ deleteAccountPurchasePayment,
+ } from "@/api/financialManagement/accountPurchasePayment.js";
-defineOptions({
- name: "浠樻鍗�",
-});
-
-const { proxy } = getCurrentInstance();
-const { checkout_payment } = proxy.useDict("checkout_payment");
-
-const filters = reactive({
- paymentNumber: "",
- supplierId: "",
- paymentMethod: "",
- dateRange: [],
-});
-
-const pagination = reactive({
- currentPage: 1,
- pageSize: 10,
- total: 0,
-});
-
-const columns = [
- { label: "浠樻鍗曞彿", prop: "paymentNumber", width: "150" },
- { label: "鍏宠仈鐢宠鍗�", prop: "invoiceApplicationNo", width: "150" },
- { label: "渚涘簲鍟�", prop: "supplierName", width: "180" },
- { label: "浠樻鏃ユ湡", prop: "paymentDate", width: "120" },
- { label: "浠樻閲戦", prop: "amount", dataType: "slot", slot: "amount" },
- { label: "浠樻鏂瑰紡", prop: "paymentMethod", dataType: "slot", slot: "paymentMethod", width: "120" },
- { label: "澶囨敞", prop: "remark", showOverflowTooltip: true },
- { label: "鎿嶄綔", prop: "operation", dataType: "slot", slot: "operation", width: "80", fixed: "right" },
-];
-
-const dataList = ref([]);
-const tableLoading = ref(false);
-const supplierList = ref([]);
-
-const totalPaymentAmount = computed(() =>
- dataList.value.reduce((sum, item) => sum + Number(item.amount ?? 0), 0)
-);
-
-const formatMoney = (value) => {
- if (value === undefined || value === null) return "0.00";
- return Number(value).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
-};
-
-const getPaymentMethodLabel = (value) => {
- if (value === undefined || value === null || value === "") return "-";
- const item = checkout_payment.value?.find((m) => String(m.value) === String(value));
- return item?.label ?? value;
-};
-
-const normalizeTableRow = (row) => ({
- ...row,
- paymentNumber: row.paymentNumber ?? row.paymentCode,
- invoiceApplicationNo: row.invoiceApplicationNo ?? row.applyCode ?? "",
- amount: row.paymentAmount ?? row.amount,
- bankAccountNum: row.bankAccountNum ?? row.bankAccount ?? "",
- bankAccountName: row.bankAccountName ?? row.bankName ?? "",
-});
-
-const getSupplierList = () => {
- getOptions().then((res) => {
- if (res.code === 200) {
- supplierList.value = res.data ?? [];
- }
- });
-};
-
-const appendFilterParams = (params) => {
- if (filters.paymentNumber) {
- params.paymentNumber = filters.paymentNumber;
- }
- if (filters.supplierId) {
- params.supplierId = filters.supplierId;
- }
- if (filters.paymentMethod) {
- params.paymentMethod = filters.paymentMethod;
- }
- if (filters.dateRange?.length === 2) {
- params.startDate = filters.dateRange[0];
- params.endDate = filters.dateRange[1];
- }
- return params;
-};
-
-const buildListParams = () =>
- appendFilterParams({
- current: pagination.currentPage,
- size: pagination.pageSize,
+ defineOptions({
+ name: "浠樻鍗�",
});
-const buildExportParams = () => appendFilterParams({});
+ const { proxy } = getCurrentInstance();
+ const { checkout_payment } = proxy.useDict("checkout_payment");
-const handleExport = () => {
- proxy.download(
- "/accountPurchasePayment/exportAccountPurchasePayment",
- buildExportParams(),
- `浠樻鍗昣${Date.now()}.xlsx`
+ const filters = reactive({
+ paymentNumber: "",
+ supplierId: "",
+ paymentMethod: "",
+ dateRange: [],
+ });
+
+ const pagination = reactive({
+ currentPage: 1,
+ pageSize: 10,
+ total: 0,
+ });
+
+ const columns = [
+ { label: "浠樻鍗曞彿", prop: "paymentNumber", width: "150" },
+ { label: "鍏宠仈鐢宠鍗�", prop: "invoiceApplicationNo", width: "150" },
+ { label: "渚涘簲鍟�", prop: "supplierName", width: "180" },
+ { label: "浠樻鏃ユ湡", prop: "paymentDate", width: "120" },
+ { label: "浠樻閲戦", prop: "amount", dataType: "slot", slot: "amount" },
+ {
+ label: "浠樻鏂瑰紡",
+ prop: "paymentMethod",
+ dataType: "slot",
+ slot: "paymentMethod",
+ width: "120",
+ },
+ { label: "澶囨敞", prop: "remark", showOverflowTooltip: true },
+ {
+ label: "鎿嶄綔",
+ prop: "operation",
+ dataType: "slot",
+ slot: "operation",
+ width: "80",
+ fixed: "right",
+ },
+ ];
+
+ const dataList = ref([]);
+ const tableLoading = ref(false);
+ const supplierList = ref([]);
+
+ const totalPaymentAmount = computed(() =>
+ dataList.value.reduce((sum, item) => sum + Number(item.amount ?? 0), 0)
);
-};
-const getTableData = () => {
- tableLoading.value = true;
- listPageAccountPurchasePayment(buildListParams())
- .then((res) => {
+ const formatMoney = value => {
+ if (value === undefined || value === null) return "0.00";
+ return Number(value)
+ .toFixed(2)
+ .replace(/\B(?=(\d{3})+(?!\d))/g, ",");
+ };
+
+ const getPaymentMethodLabel = value => {
+ if (value === undefined || value === null || value === "") return "-";
+ const item = checkout_payment.value?.find(
+ m => String(m.value) === String(value)
+ );
+ return item?.label ?? value;
+ };
+
+ const normalizeTableRow = row => ({
+ ...row,
+ paymentNumber: row.paymentNumber ?? row.paymentCode,
+ invoiceApplicationNo: row.invoiceApplicationNo ?? row.applyCode ?? "",
+ amount: row.paymentAmount ?? row.amount,
+ bankAccountNum: row.bankAccountNum ?? row.bankAccount ?? "",
+ bankAccountName: row.bankAccountName ?? row.bankName ?? "",
+ });
+
+ const getSupplierList = () => {
+ getOptions().then(res => {
if (res.code === 200) {
- dataList.value = (res.data?.records ?? []).map(normalizeTableRow);
- pagination.total = res.data?.total ?? 0;
- } else {
- dataList.value = [];
- pagination.total = 0;
- ElMessage.error(res.msg || "鏌ヨ澶辫触");
+ supplierList.value = res.data ?? [];
}
- })
- .catch(() => {
- dataList.value = [];
- pagination.total = 0;
- ElMessage.error("鏌ヨ澶辫触");
- })
- .finally(() => {
- tableLoading.value = false;
});
-};
+ };
-const onSearch = () => {
- pagination.currentPage = 1;
- getTableData();
-};
+ const appendFilterParams = params => {
+ if (filters.paymentNumber) {
+ params.paymentNumber = filters.paymentNumber;
+ }
+ if (filters.supplierId) {
+ params.supplierId = filters.supplierId;
+ }
+ if (filters.paymentMethod) {
+ params.paymentMethod = filters.paymentMethod;
+ }
+ if (filters.dateRange?.length === 2) {
+ params.startDate = filters.dateRange[0];
+ params.endDate = filters.dateRange[1];
+ }
+ return params;
+ };
-const resetFilters = () => {
- filters.paymentNumber = "";
- filters.supplierId = "";
- filters.paymentMethod = "";
- filters.dateRange = [];
- pagination.currentPage = 1;
- getTableData();
-};
+ const buildListParams = () =>
+ appendFilterParams({
+ current: pagination.currentPage,
+ size: pagination.pageSize,
+ });
-const changePage = ({ page, limit }) => {
- pagination.currentPage = page;
- pagination.pageSize = limit;
- getTableData();
-};
+ const buildExportParams = () => appendFilterParams({});
-const handleDelete = (row) => {
- ElMessageBox.confirm(`纭鍒犻櫎浠樻鍗曘��${row.paymentNumber}銆嶅悧锛焋, "鎻愮ず", {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- }).then(() => {
- deleteAccountPurchasePayment([row.id])
- .then((res) => {
+ const handleExport = () => {
+ proxy.download(
+ "/accountPurchasePayment/exportAccountPurchasePayment",
+ buildExportParams(),
+ `浠樻鍗昣${Date.now()}.xlsx`
+ );
+ };
+
+ const getTableData = () => {
+ tableLoading.value = true;
+ listPageAccountPurchasePayment(buildListParams())
+ .then(res => {
if (res.code === 200) {
- ElMessage.success("鍒犻櫎鎴愬姛");
- getTableData();
+ dataList.value = (res.data?.records ?? []).map(normalizeTableRow);
+ pagination.total = res.data?.total ?? 0;
} else {
- ElMessage.error(res.msg || "鍒犻櫎澶辫触");
+ dataList.value = [];
+ pagination.total = 0;
+ ElMessage.error(res.msg || "鏌ヨ澶辫触");
}
})
.catch(() => {
- ElMessage.error("鍒犻櫎澶辫触");
+ dataList.value = [];
+ pagination.total = 0;
+ ElMessage.error("鏌ヨ澶辫触");
+ })
+ .finally(() => {
+ tableLoading.value = false;
});
- });
-};
+ };
-onMounted(() => {
- getSupplierList();
- getTableData();
-});
+ const onSearch = () => {
+ pagination.currentPage = 1;
+ getTableData();
+ };
+
+ const resetFilters = () => {
+ filters.paymentNumber = "";
+ filters.supplierId = "";
+ filters.paymentMethod = "";
+ filters.dateRange = [];
+ pagination.currentPage = 1;
+ getTableData();
+ };
+
+ const changePage = ({ page, limit }) => {
+ pagination.currentPage = page;
+ pagination.pageSize = limit;
+ getTableData();
+ };
+
+ const handleDelete = row => {
+ ElMessageBox.confirm(`纭鍒犻櫎浠樻鍗曘��${row.paymentNumber}銆嶅悧锛焋, "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ }).then(() => {
+ deleteAccountPurchasePayment([row.id])
+ .then(res => {
+ if (res.code === 200) {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ getTableData();
+ } else {
+ ElMessage.error(res.msg || "鍒犻櫎澶辫触");
+ }
+ })
+ .catch(() => {
+ ElMessage.error("鍒犻櫎澶辫触");
+ });
+ });
+ };
+
+ onMounted(() => {
+ getSupplierList();
+ getTableData();
+ });
</script>
<style lang="scss" scoped>
-.actions {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 15px;
-}
+ .actions {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 15px;
+ }
-.text-danger {
- color: #f56c6c;
- font-weight: bold;
-}
+ .text-danger {
+ color: #f56c6c;
+ font-weight: bold;
+ }
</style>
diff --git a/src/views/financialManagement/payable/purchaseIn.vue b/src/views/financialManagement/payable/purchaseIn.vue
index ebc8f0c..fcb768f 100644
--- a/src/views/financialManagement/payable/purchaseIn.vue
+++ b/src/views/financialManagement/payable/purchaseIn.vue
@@ -1,34 +1,39 @@
<template>
<!-- 閲囪喘鍏ュ簱 -->
<div class="app-container">
- <el-form :model="filters" :inline="true">
+ <el-form :model="filters"
+ :inline="true">
<el-form-item label="鍏ュ簱鍗曞彿:">
- <el-input v-model="filters.inboundBatches" placeholder="璇疯緭鍏ュ叆搴撳崟鍙�" clearable style="width: 200px;" />
+ <el-input v-model="filters.inboundBatches"
+ placeholder="璇疯緭鍏ュ叆搴撳崟鍙�"
+ clearable
+ style="width: 200px;" />
</el-form-item>
<el-form-item label="渚涘簲鍟�:">
- <el-select v-model="filters.supplierId" placeholder="璇烽�夋嫨渚涘簲鍟�" clearable filterable style="width: 200px;">
- <el-option
- v-for="item in supplierList"
- :key="item.id"
- :label="item.supplierName"
- :value="item.id"
- />
+ <el-select v-model="filters.supplierId"
+ placeholder="璇烽�夋嫨渚涘簲鍟�"
+ clearable
+ filterable
+ style="width: 200px;">
+ <el-option v-for="item in supplierList"
+ :key="item.id"
+ :label="item.supplierName"
+ :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="鍏ュ簱鏃ユ湡:">
- <el-date-picker
- v-model="filters.dateRange"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- type="daterange"
- range-separator="鑷�"
- start-placeholder="寮�濮嬫棩鏈�"
- end-placeholder="缁撴潫鏃ユ湡"
- clearable
- />
+ <el-date-picker v-model="filters.dateRange"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="daterange"
+ range-separator="鑷�"
+ start-placeholder="寮�濮嬫棩鏈�"
+ end-placeholder="缁撴潫鏃ユ湡"
+ clearable />
</el-form-item>
<el-form-item>
- <el-button type="primary" @click="onSearch">鎼滅储</el-button>
+ <el-button type="primary"
+ @click="onSearch">鎼滅储</el-button>
<el-button @click="resetFilters">閲嶇疆</el-button>
</el-form-item>
</el-form>
@@ -36,21 +41,20 @@
<div class="actions">
<div></div>
<div>
- <el-button @click="handleOut" icon="Download">瀵煎嚭</el-button>
+ <el-button @click="handleOut"
+ icon="Download">瀵煎嚭</el-button>
</div>
</div>
- <PIMTable
- rowKey="id"
- :column="columns"
- :tableData="dataList"
- :tableLoading="tableLoading"
- :page="{
+ <PIMTable rowKey="id"
+ :column="columns"
+ :tableData="dataList"
+ :tableLoading="tableLoading"
+ :page="{
current: pagination.currentPage,
size: pagination.pageSize,
total: pagination.total,
}"
- @pagination="changePage"
- >
+ @pagination="changePage">
<template #inboundDate="{ row }">
{{ row.inboundDate ?? row.InboundDate ?? "" }}
</template>
@@ -60,136 +64,149 @@
</template>
<script setup>
-import { ref, reactive, onMounted, getCurrentInstance } from "vue";
-import { ElMessage } from "element-plus";
-import { listPageAccountPurchase } from "@/api/financialManagement/accountPurchase";
-import { listSupplier } from "@/api/basicData/supplierManageFile.js";
+ import { ref, reactive, onMounted, getCurrentInstance } from "vue";
+ import { ElMessage } from "element-plus";
+ import { listPageAccountPurchase } from "@/api/financialManagement/accountPurchase";
+ import { listSupplier } from "@/api/basicData/supplierManageFile.js";
-defineOptions({
- name: "閲囪喘鍏ュ簱",
-});
-
-const { proxy } = getCurrentInstance();
-
-const filters = reactive({
- inboundBatches: "",
- supplierId: "",
- dateRange: [],
-});
-
-const pagination = reactive({
- currentPage: 1,
- pageSize: 10,
- total: 0,
-});
-
-const columns = [
- { label: "鍏ュ簱鍗曞彿", prop: "inboundBatches", minWidth: "150" },
- { label: "渚涘簲鍟�", prop: "supplierName", minWidth: "180" },
- {
- label: "鍏ュ簱鏃ユ湡",
- prop: "inboundDate",
- minWidth: "170",
- dataType: "slot",
- slot: "inboundDate",
- },
- { label: "浜у搧鍚嶇О", prop: "productName", minWidth: "140" },
- { label: "浜у搧瑙勬牸", prop: "specificationModel", minWidth: "140" },
- { label: "閲囪喘璁㈠崟鍙�", prop: "purchaseContractNumber", minWidth: "150" },
-];
-
-const dataList = ref([]);
-const tableLoading = ref(false);
-const supplierList = ref([]);
-
-const buildFilterParams = () => {
- const params = {};
- if (filters.inboundBatches) {
- params.inboundBatches = filters.inboundBatches;
- }
- if (filters.supplierId) {
- params.supplierId = filters.supplierId;
- }
- if (filters.dateRange?.length === 2) {
- params.startDate = filters.dateRange[0];
- params.endDate = filters.dateRange[1];
- }
- return params;
-};
-
-const getSupplierList = () => {
- listSupplier({ current: -1, size: -1, isWhite: 0 }).then((res) => {
- if (res.code === 200) {
- supplierList.value = res.data?.records ?? [];
- }
+ defineOptions({
+ name: "閲囪喘鍏ュ簱",
});
-};
-const onSearch = () => {
- pagination.currentPage = 1;
- getTableData();
-};
+ const { proxy } = getCurrentInstance();
-const getTableData = () => {
- tableLoading.value = true;
- listPageAccountPurchase({
- ...buildFilterParams(),
- current: pagination.currentPage,
- size: pagination.pageSize,
- })
- .then((res) => {
- const ok = res.code === 200 || res.code === 0;
- if (ok && res.data) {
- pagination.total = res.data.total ?? 0;
- dataList.value = res.data.records ?? [];
- } else {
- ElMessage.error(res.msg || "鏌ヨ澶辫触");
+ const filters = reactive({
+ inboundBatches: "",
+ supplierId: "",
+ dateRange: [],
+ });
+
+ const pagination = reactive({
+ currentPage: 1,
+ pageSize: 10,
+ total: 0,
+ });
+
+ const columns = [
+ { label: "鍏ュ簱鍗曞彿", prop: "inboundBatches", minWidth: "150" },
+ { label: "渚涘簲鍟�", prop: "supplierName", minWidth: "180" },
+ {
+ label: "鍏ュ簱鏃ユ湡",
+ prop: "inboundDate",
+ minWidth: "170",
+ dataType: "slot",
+ slot: "inboundDate",
+ },
+ { label: "浜у搧鍚嶇О", prop: "productName", minWidth: "140" },
+ { label: "浜у搧瑙勬牸", prop: "specificationModel", minWidth: "140" },
+ {
+ label: "閲戦",
+ prop: "inboundAmount",
+ minWidth: "120",
+ align: "right",
+ formatData: val =>
+ val === null || val === undefined || val === ""
+ ? ""
+ : Number(val).toLocaleString("zh-CN", {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ }),
+ },
+ { label: "閲囪喘璁㈠崟鍙�", prop: "purchaseContractNumber", minWidth: "150" },
+ ];
+
+ const dataList = ref([]);
+ const tableLoading = ref(false);
+ const supplierList = ref([]);
+
+ const buildFilterParams = () => {
+ const params = {};
+ if (filters.inboundBatches) {
+ params.inboundBatches = filters.inboundBatches;
+ }
+ if (filters.supplierId) {
+ params.supplierId = filters.supplierId;
+ }
+ if (filters.dateRange?.length === 2) {
+ params.startDate = filters.dateRange[0];
+ params.endDate = filters.dateRange[1];
+ }
+ return params;
+ };
+
+ const getSupplierList = () => {
+ listSupplier({ current: -1, size: -1, isWhite: 0 }).then(res => {
+ if (res.code === 200) {
+ supplierList.value = res.data?.records ?? [];
+ }
+ });
+ };
+
+ const onSearch = () => {
+ pagination.currentPage = 1;
+ getTableData();
+ };
+
+ const getTableData = () => {
+ tableLoading.value = true;
+ listPageAccountPurchase({
+ ...buildFilterParams(),
+ current: pagination.currentPage,
+ size: pagination.pageSize,
+ })
+ .then(res => {
+ const ok = res.code === 200 || res.code === 0;
+ if (ok && res.data) {
+ pagination.total = res.data.total ?? 0;
+ dataList.value = res.data.records ?? [];
+ } else {
+ ElMessage.error(res.msg || "鏌ヨ澶辫触");
+ dataList.value = [];
+ pagination.total = 0;
+ }
+ })
+ .catch(() => {
dataList.value = [];
pagination.total = 0;
- }
- })
- .catch(() => {
- dataList.value = [];
- pagination.total = 0;
- ElMessage.error("鏌ヨ澶辫触");
- })
- .finally(() => {
- tableLoading.value = false;
- });
-};
+ ElMessage.error("鏌ヨ澶辫触");
+ })
+ .finally(() => {
+ tableLoading.value = false;
+ });
+ };
-const resetFilters = () => {
- filters.inboundBatches = "";
- filters.supplierId = "";
- filters.dateRange = [];
- pagination.currentPage = 1;
- getTableData();
-};
+ const resetFilters = () => {
+ filters.inboundBatches = "";
+ filters.supplierId = "";
+ filters.dateRange = [];
+ pagination.currentPage = 1;
+ getTableData();
+ };
-const changePage = ({ page, limit }) => {
- pagination.currentPage = page;
- pagination.pageSize = limit;
- getTableData();
-};
+ const changePage = ({ page, limit }) => {
+ pagination.currentPage = page;
+ pagination.pageSize = limit;
+ getTableData();
+ };
-const handleOut = () => {
- proxy.download(
- "/accountPurchase/exportAccountPurchaseInbound",
- buildFilterParams(),
- `閲囪喘鍏ュ簱_${Date.now()}.xlsx`
- );
-};
+ const handleOut = () => {
+ proxy.download(
+ "/accountPurchase/exportAccountPurchaseInbound",
+ buildFilterParams(),
+ `閲囪喘鍏ュ簱_${Date.now()}.xlsx`
+ );
+ };
-onMounted(() => {
- getSupplierList();
- getTableData();
-});
+ onMounted(() => {
+ getSupplierList();
+ getTableData();
+ });
</script>
<style lang="scss" scoped>
-.actions {
- display: flex;
- justify-content: space-between;
- margin-bottom: 15px;
-}
+ .actions {
+ display: flex;
+ justify-content: space-between;
+ margin-bottom: 15px;
+ }
</style>
diff --git a/src/views/financialManagement/receivable/receipt.vue b/src/views/financialManagement/receivable/receipt.vue
index f19da42..6ddb3fe 100644
--- a/src/views/financialManagement/receivable/receipt.vue
+++ b/src/views/financialManagement/receivable/receipt.vue
@@ -1,64 +1,80 @@
<template>
<div class="app-container">
- <el-form :model="filters" :inline="true">
+ <el-form :model="filters"
+ :inline="true">
<el-form-item label="鏀舵鍗曞彿:">
- <el-input v-model="filters.collectionNumber" placeholder="璇疯緭鍏ユ敹娆惧崟鍙�" clearable style="width: 200px;" />
+ <el-input v-model="filters.collectionNumber"
+ placeholder="璇疯緭鍏ユ敹娆惧崟鍙�"
+ clearable
+ style="width: 200px;" />
</el-form-item>
<el-form-item label="瀹㈡埛:">
- <el-select v-model="filters.customerId" placeholder="璇烽�夋嫨瀹㈡埛" clearable filterable style="width: 200px;">
- <el-option v-for="item in customerList" :key="item.id" :label="item.customerName" :value="item.id" />
+ <el-select v-model="filters.customerId"
+ placeholder="璇烽�夋嫨瀹㈡埛"
+ clearable
+ filterable
+ style="width: 200px;">
+ <el-option v-for="item in customerList"
+ :key="item.id"
+ :label="item.customerName"
+ :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="鏀舵鏂瑰紡:">
- <el-select v-model="filters.collectionMethod" placeholder="璇烽�夋嫨鏀舵鏂瑰紡" clearable style="width: 150px;">
- <el-option
- v-for="item in payment_methods"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
+ <el-select v-model="filters.collectionMethod"
+ placeholder="璇烽�夋嫨鏀舵鏂瑰紡"
+ clearable
+ style="width: 150px;">
+ <el-option v-for="item in payment_methods"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="鏀舵鏃ユ湡:">
- <el-date-picker
- v-model="filters.dateRange"
- type="daterange"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- range-separator="鑷�"
- start-placeholder="寮�濮嬫棩鏈�"
- end-placeholder="缁撴潫鏃ユ湡"
- clearable
- style="width: 240px;"
- />
+ <el-date-picker v-model="filters.dateRange"
+ type="daterange"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ range-separator="鑷�"
+ start-placeholder="寮�濮嬫棩鏈�"
+ end-placeholder="缁撴潫鏃ユ湡"
+ clearable
+ style="width: 240px;" />
</el-form-item>
<el-form-item>
- <el-button type="primary" @click="onSearch">鎼滅储</el-button>
+ <el-button type="primary"
+ @click="onSearch">鎼滅储</el-button>
<el-button @click="resetFilters">閲嶇疆</el-button>
</el-form-item>
</el-form>
<div class="table_list">
<div class="actions">
<div>
- <el-statistic title="鏈〉鏀舵鍚堣" :value="totalReceiptAmount" :precision="2" prefix="楼" />
+ <el-statistic title="鏈〉鏀舵鍚堣"
+ :value="totalReceiptAmount"
+ :precision="2"
+ prefix="楼" />
</div>
<div>
- <el-button type="primary" @click="add" icon="Plus">鏂板鏀舵</el-button>
- <el-button type="success" @click="handleExport" icon="Download">瀵煎嚭</el-button>
+ <el-button type="primary"
+ @click="add"
+ icon="Plus">鏂板鏀舵</el-button>
+ <el-button type="success"
+ @click="handleExport"
+ icon="Download">瀵煎嚭</el-button>
</div>
</div>
- <PIMTable
- rowKey="id"
- v-loading="tableLoading"
- :column="columns"
- :tableData="dataList"
- :page="{
+ <PIMTable rowKey="id"
+ v-loading="tableLoading"
+ :column="columns"
+ :tableData="dataList"
+ :page="{
current: pagination.currentPage,
size: pagination.pageSize,
total: pagination.total,
}"
- @pagination="changePage"
- >
+ @pagination="changePage">
<template #amount="{ row }">
<span class="text-success">楼{{ formatMoney(row.amount) }}</span>
</template>
@@ -66,60 +82,71 @@
<span>{{ getReceiptMethodLabel(row.receiptMethod) }}</span>
</template>
<template #operation="{ row }">
- <el-button type="primary" link @click="view(row)">鏌ョ湅</el-button>
- <el-button type="primary" link @click="edit(row)">缂栬緫</el-button>
- <el-button type="danger" link @click="handleDelete(row)">鍒犻櫎</el-button>
+ <el-button type="primary"
+ link
+ @click="view(row)">鏌ョ湅</el-button>
+ <el-button :disabled="row.accountStatemen"
+ type="primary"
+ link
+ @click="edit(row)">缂栬緫</el-button>
+ <el-button :disabled="row.accountStatemen"
+ type="danger"
+ link
+ @click="handleDelete(row)">鍒犻櫎</el-button>
</template>
</PIMTable>
</div>
-
- <FormDialog
- :title="dialogTitle"
- v-model="dialogVisible"
- width="800px"
- :operation-type="isView ? 'detail' : ''"
- @confirm="submitForm"
- @cancel="closeDialog"
- >
- <el-form :model="form" :rules="rules" ref="formRef" label-width="120px">
+ <FormDialog :title="dialogTitle"
+ v-model="dialogVisible"
+ width="800px"
+ :operation-type="isView ? 'detail' : ''"
+ @confirm="submitForm"
+ @cancel="closeDialog">
+ <el-form :model="form"
+ :rules="rules"
+ ref="formRef"
+ label-width="120px">
<el-row :gutter="20">
<el-col :span="24">
- <el-form-item label="鏀舵鍗曞彿" prop="receiptCode">
- <el-input v-model="form.receiptCode" placeholder="绯荤粺鑷姩鐢熸垚" disabled />
+ <el-form-item label="鏀舵鍗曞彿"
+ prop="receiptCode">
+ <el-input v-model="form.receiptCode"
+ placeholder="绯荤粺鑷姩鐢熸垚"
+ disabled />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="瀹㈡埛" prop="customerId">
- <el-select
- v-model="form.customerId"
- placeholder="璇烽�夋嫨瀹㈡埛"
- style="width: 100%;"
- :disabled="isEdit || isView"
- filterable
- @change="handleCustomerChange"
- >
- <el-option v-for="item in customerList" :key="item.id" :label="item.customerName" :value="item.id" />
+ <el-form-item label="瀹㈡埛"
+ prop="customerId">
+ <el-select v-model="form.customerId"
+ placeholder="璇烽�夋嫨瀹㈡埛"
+ style="width: 100%;"
+ :disabled="isEdit || isView"
+ filterable
+ @change="handleCustomerChange">
+ <el-option v-for="item in customerList"
+ :key="item.id"
+ :label="item.customerName"
+ :value="item.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鍏宠仈鍗曟嵁" prop="stockOutRecordIds">
- <el-input
- :model-value="outboundBatchDisplayText"
- placeholder="璇峰厛閫夋嫨瀹㈡埛"
- readonly
- :disabled="!form.customerId || isEdit || isView"
- class="outbound-batch-input"
- @click="handleOutboundInputClick"
- >
- <template v-if="!isEdit && !isView" #append>
- <el-button
- :disabled="!form.customerId"
- :loading="outboundBatchLoading"
- @click.stop="openOutboundSelectDialog"
- >
+ <el-form-item label="鍏宠仈鍗曟嵁"
+ prop="stockOutRecordIds">
+ <el-input :model-value="outboundBatchDisplayText"
+ placeholder="璇峰厛閫夋嫨瀹㈡埛"
+ readonly
+ :disabled="!form.customerId || isEdit || isView"
+ class="outbound-batch-input"
+ @click="handleOutboundInputClick">
+ <template v-if="!isEdit && !isView"
+ #append>
+ <el-button :disabled="!form.customerId"
+ :loading="outboundBatchLoading"
+ @click.stop="openOutboundSelectDialog">
閫夋嫨
</el-button>
</template>
@@ -129,95 +156,123 @@
</el-row>
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="鏀舵鏃ユ湡" prop="receiptDate">
- <el-date-picker
- v-model="form.receiptDate"
- type="date"
- placeholder="閫夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- style="width: 100%;"
- :disabled="isView"
- />
+ <el-form-item label="鏀舵鏃ユ湡"
+ prop="receiptDate">
+ <el-date-picker v-model="form.receiptDate"
+ type="date"
+ placeholder="閫夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ style="width: 100%;"
+ :disabled="isView" />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鏀舵閲戦" prop="amount">
- <el-input-number
- v-model="form.amount"
- :min="0"
- :precision="2"
- style="width: 100%;"
- :disabled="isView"
- placeholder="鏍规嵁鍏宠仈鍗曟嵁鑷姩姹囨�伙紝鍙慨鏀�"
- />
+ <el-form-item label="鏀舵閲戦"
+ prop="amount">
+ <el-input-number v-model="form.amount"
+ :min="0"
+ :precision="2"
+ style="width: 100%;"
+ :disabled="isView"
+ placeholder="鏍规嵁鍏宠仈鍗曟嵁鑷姩姹囨�伙紝鍙慨鏀�" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="鏀舵鏂瑰紡" prop="receiptMethod">
- <el-select
- v-model="form.receiptMethod"
- placeholder="璇烽�夋嫨鏀舵鏂瑰紡"
- style="width: 100%;"
- :disabled="isView"
- >
- <el-option
- v-for="item in payment_methods"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
+ <el-form-item label="鏀舵鏂瑰紡"
+ prop="receiptMethod">
+ <el-select v-model="form.receiptMethod"
+ placeholder="璇烽�夋嫨鏀舵鏂瑰紡"
+ style="width: 100%;"
+ :disabled="isView">
+ <el-option v-for="item in payment_methods"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
- <el-form-item label="澶囨敞" prop="remark">
- <el-input v-model="form.remark" type="textarea" :rows="3" placeholder="璇疯緭鍏ュ娉�" :disabled="isView" />
+ <el-form-item label="澶囨敞"
+ prop="remark">
+ <el-input v-model="form.remark"
+ type="textarea"
+ :rows="3"
+ placeholder="璇疯緭鍏ュ娉�"
+ :disabled="isView" />
</el-form-item>
</el-form>
- <template v-if="!isView" #footer>
- <el-button type="primary" :loading="submitLoading" @click="submitForm">纭畾</el-button>
+ <template v-if="!isView"
+ #footer>
+ <el-button type="primary"
+ :loading="submitLoading"
+ @click="submitForm">纭畾</el-button>
<el-button @click="closeDialog">鍙栨秷</el-button>
</template>
</FormDialog>
-
- <el-dialog
- v-model="outboundSelectVisible"
- title="閫夋嫨鍏宠仈鍗曟嵁"
- width="1200px"
- append-to-body
- destroy-on-close
- :close-on-click-modal="false"
- @closed="handleOutboundDialogClosed"
- >
- <el-table
- ref="outboundTableRef"
- v-loading="outboundBatchLoading"
- :data="outboundBatchList"
- row-key="id"
- border
- stripe
- max-height="480"
- @selection-change="handleOutboundDialogSelectionChange"
- >
- <el-table-column type="selection" width="55" align="center" />
- <el-table-column prop="outboundBatches" label="鍑哄簱鍗曞彿" min-width="140" show-overflow-tooltip />
- <el-table-column prop="customerName" label="瀹㈡埛鍚嶇О" min-width="120" show-overflow-tooltip />
- <el-table-column prop="productName" label="浜у搧鍚嶇О" min-width="120" show-overflow-tooltip />
- <el-table-column prop="specificationModel" label="瑙勬牸鍨嬪彿" min-width="140" show-overflow-tooltip />
- <el-table-column prop="salesContractNo" label="閿�鍞悎鍚屽彿" min-width="140" show-overflow-tooltip />
- <el-table-column prop="shippingNo" label="鍙戣揣鍗曞彿" min-width="130" show-overflow-tooltip />
- <el-table-column prop="shippingDate" label="鍙戣揣鏃ユ湡" width="110" align="center" />
- <el-table-column prop="outboundAmount" label="鍑哄簱閲戦" width="110" align="right">
+ <el-dialog v-model="outboundSelectVisible"
+ title="閫夋嫨鍏宠仈鍗曟嵁"
+ width="1200px"
+ append-to-body
+ destroy-on-close
+ :close-on-click-modal="false"
+ @closed="handleOutboundDialogClosed">
+ <el-table ref="outboundTableRef"
+ v-loading="outboundBatchLoading"
+ :data="outboundBatchList"
+ row-key="id"
+ border
+ stripe
+ max-height="480"
+ @selection-change="handleOutboundDialogSelectionChange">
+ <el-table-column type="selection"
+ width="55"
+ align="center" />
+ <el-table-column prop="outboundBatches"
+ label="鍑哄簱鍗曞彿"
+ min-width="140"
+ show-overflow-tooltip />
+ <el-table-column prop="customerName"
+ label="瀹㈡埛鍚嶇О"
+ min-width="120"
+ show-overflow-tooltip />
+ <el-table-column prop="productName"
+ label="浜у搧鍚嶇О"
+ min-width="120"
+ show-overflow-tooltip />
+ <el-table-column prop="specificationModel"
+ label="瑙勬牸鍨嬪彿"
+ min-width="140"
+ show-overflow-tooltip />
+ <el-table-column prop="salesContractNo"
+ label="閿�鍞悎鍚屽彿"
+ min-width="140"
+ show-overflow-tooltip />
+ <el-table-column prop="shippingNo"
+ label="鍙戣揣鍗曞彿"
+ min-width="130"
+ show-overflow-tooltip />
+ <el-table-column prop="shippingDate"
+ label="鍙戣揣鏃ユ湡"
+ width="110"
+ align="center" />
+ <el-table-column prop="outboundAmount"
+ label="鍑哄簱閲戦"
+ width="110"
+ align="right">
<template #default="{ row }">楼{{ formatMoney(row.outboundAmount) }}</template>
</el-table-column>
- <el-table-column prop="taxRate" label="绋庣巼" width="80" align="center">
+ <el-table-column prop="taxRate"
+ label="绋庣巼"
+ width="80"
+ align="center">
<template #default="{ row }">{{ row.taxRate }}%</template>
</el-table-column>
</el-table>
<template #footer>
- <el-button type="primary" @click="confirmOutboundSelection">纭畾</el-button>
+ <el-button type="primary"
+ @click="confirmOutboundSelection">纭畾</el-button>
<el-button @click="outboundSelectVisible = false">鍙栨秷</el-button>
</template>
</el-dialog>
@@ -225,516 +280,576 @@
</template>
<script setup>
-import { ref, reactive, computed, onMounted, nextTick, getCurrentInstance } from "vue";
-import { ElMessage, ElMessageBox } from "element-plus";
-import FormDialog from "@/components/Dialog/FormDialog.vue";
-import { listCustomer } from "@/api/basicData/customer.js";
-import {
- getOutboundBatchesByCustomer,
- addAccountSalesCollection,
- listPageAccountSalesCollection,
- updateAccountSalesCollection,
- deleteAccountSalesCollection,
-} from "@/api/financialManagement/accountSalesCollection.js";
+ import {
+ ref,
+ reactive,
+ computed,
+ onMounted,
+ nextTick,
+ getCurrentInstance,
+ } from "vue";
+ import { ElMessage, ElMessageBox } from "element-plus";
+ import FormDialog from "@/components/Dialog/FormDialog.vue";
+ import { listCustomer } from "@/api/basicData/customer.js";
+ import {
+ getOutboundBatchesByCustomer,
+ addAccountSalesCollection,
+ listPageAccountSalesCollection,
+ updateAccountSalesCollection,
+ deleteAccountSalesCollection,
+ } from "@/api/financialManagement/accountSalesCollection.js";
-defineOptions({
- name: "鏀舵鍗�",
-});
-
-const { proxy } = getCurrentInstance();
-const { payment_methods } = proxy.useDict("payment_methods");
-
-const filters = reactive({
- collectionNumber: "",
- customerId: "",
- collectionMethod: "",
- dateRange: [],
-});
-
-const pagination = reactive({
- currentPage: 1,
- pageSize: 10,
- total: 0,
-});
-
-const columns = [
- { label: "鏀舵鍗曞彿", prop: "receiptCode", width: "150" },
- { label: "瀹㈡埛鍚嶇О", prop: "customerName", width: "180" },
- { label: "鏀舵鏃ユ湡", prop: "receiptDate", width: "120" },
- { label: "鏀舵閲戦", prop: "amount", dataType: "slot", slot: "amount" },
- { label: "鏀舵鏂瑰紡", prop: "receiptMethod", dataType: "slot", slot: "receiptMethod", width: "120" },
- { label: "澶囨敞", prop: "remark", showOverflowTooltip: true },
- { label: "鎿嶄綔", prop: "operation", dataType: "slot", slot: "operation", width: "200", fixed: "right" },
-];
-
-const dataList = ref([]);
-const tableLoading = ref(false);
-const dialogVisible = ref(false);
-const dialogTitle = ref("");
-const formRef = ref(null);
-const isEdit = ref(false);
-const isView = ref(false);
-const currentId = ref(null);
-const submitLoading = ref(false);
-
-const customerList = ref([]);
-const outboundBatchList = ref([]);
-const outboundBatchOptions = ref([]);
-const outboundBatchLoading = ref(false);
-const outboundSelectVisible = ref(false);
-const outboundTableRef = ref(null);
-const dialogOutboundSelection = ref([]);
-
-const getReceiptMethodLabel = (value) => {
- if (value === undefined || value === null || value === "") return "-";
- const item = payment_methods.value?.find((m) => String(m.value) === String(value));
- return item?.label ?? value;
-};
-
-const getDefaultReceiptMethod = () => payment_methods.value?.[0]?.value ?? "";
-
-const form = reactive({
- receiptCode: "",
- customerId: "",
- receiptDate: "",
- amount: 0,
- receiptMethod: "",
- stockOutRecordIds: [],
- outboundBatches: "",
- remark: "",
-});
-
-const rules = {
- customerId: [{ required: true, message: "璇烽�夋嫨瀹㈡埛", trigger: "change" }],
- stockOutRecordIds: [{ required: true, type: "array", min: 1, message: "璇烽�夋嫨鍏宠仈鍗曟嵁", trigger: "change" }],
- receiptDate: [{ required: true, message: "璇烽�夋嫨鏀舵鏃ユ湡", trigger: "change" }],
- amount: [{ required: true, message: "璇疯緭鍏ユ敹娆鹃噾棰�", trigger: "blur" }],
- receiptMethod: [{ required: true, message: "璇烽�夋嫨鏀舵鏂瑰紡", trigger: "change" }],
-};
-
-const totalReceiptAmount = computed(() =>
- dataList.value.reduce((sum, item) => sum + Number(item.amount || 0), 0)
-);
-
-const formatMoney = (value) => {
- if (value === undefined || value === null) return "0.00";
- return Number(value).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
-};
-
-const parseStockOutRecordIds = (value) => {
- if (!value) return [];
- if (Array.isArray(value)) return value;
- return String(value)
- .split(/[,锛宂/)
- .map((s) => s.trim())
- .filter(Boolean)
- .map((s) => (/^\d+$/.test(s) ? Number(s) : s));
-};
-
-const formatOutboundBatches = (value) => {
- if (value === undefined || value === null || value === "") return "";
- if (Array.isArray(value)) return value.filter(Boolean).join("銆�");
- return String(value)
- .split(/[,锛宂/)
- .map((s) => s.trim())
- .filter(Boolean)
- .join("銆�");
-};
-
-const normalizeTableRow = (row) => ({
- ...row,
- receiptCode: row.collectionNumber ?? row.receiptCode,
- receiptDate: row.collectionDate ?? row.receiptDate,
- amount: row.collectionAmount ?? row.amount,
- receiptMethod: row.collectionMethod ?? row.receiptMethod ?? "",
- stockOutRecordIds: row.stockOutRecordIds ?? row.stockOutRecordId ?? "",
- outboundBatches: formatOutboundBatches(row.outboundBatches),
-});
-
-const getCustomerList = () => {
- listCustomer({ current: -1, size: -1, type: 0 }).then((res) => {
- if (res.code === 200) {
- customerList.value = res.data?.records || [];
- }
- });
-};
-
-const normalizeOutboundBatchOptions = (data) => {
- const list = Array.isArray(data) ? data : [];
- return list.map((item, index) => {
- if (typeof item === "string" || typeof item === "number") {
- const text = String(item);
- return { label: text, value: text, outboundAmount: 0 };
- }
- const label =
- item.outboundBatches ??
- item.batchNo ??
- item.shippingNo ??
- item.outboundNo ??
- item.label ??
- `鍑哄簱鍗�${index + 1}`;
- const value = item.id ?? item.stockOutRecordId ?? label;
- return { label: String(label), value, outboundAmount: Number(item.outboundAmount) || 0 };
- });
-};
-
-const isSameOutboundId = (a, b) => String(a) === String(b);
-
-const getOutboundRowId = (row) => row?.id ?? row?.stockOutRecordId;
-
-const outboundBatchDisplayText = computed(() => {
- if (isEdit.value || isView.value) {
- return form.outboundBatches || "";
- }
- if (form.outboundBatches) return form.outboundBatches;
- const ids = form.stockOutRecordIds || [];
- if (!ids.length) return "";
- const labels = outboundBatchOptions.value
- .filter((opt) => ids.some((id) => isSameOutboundId(id, opt.value)))
- .map((opt) => opt.label);
- if (labels.length) return labels.join("銆�");
- return ids.join("銆�");
-});
-
-const handleOutboundInputClick = () => {
- if (isEdit.value || isView.value) return;
- openOutboundSelectDialog();
-};
-
-/** 涓哄凡閫� ID 琛ュ叏閫夐」锛堢紪杈�/鏌ョ湅鍥炴樉锛� */
-const ensureOutboundOptionsForSelected = () => {
- const ids = form.stockOutRecordIds || [];
- ids.forEach((id) => {
- const exists = outboundBatchOptions.value.some((opt) => isSameOutboundId(opt.value, id));
- if (exists) return;
- const fromList = outboundBatchList.value.find((row) => isSameOutboundId(getOutboundRowId(row), id));
- if (fromList) {
- const [option] = normalizeOutboundBatchOptions([fromList]);
- if (option) outboundBatchOptions.value.push(option);
- return;
- }
- outboundBatchOptions.value.push({
- label: String(id),
- value: id,
- outboundAmount: 0,
- });
- });
-};
-
-const syncCollectionAmount = () => {
- const selected = form.stockOutRecordIds || [];
- const sum = outboundBatchOptions.value
- .filter((opt) => selected.some((id) => isSameOutboundId(id, opt.value)))
- .reduce((acc, opt) => acc + (Number(opt.outboundAmount) || 0), 0);
- form.amount = sum > 0 ? Number(sum.toFixed(2)) : 0;
-};
-
-const restoreOutboundTableSelection = () => {
- nextTick(() => {
- const table = outboundTableRef.value;
- if (!table) return;
- table.clearSelection();
- const selectedIds = new Set((form.stockOutRecordIds || []).map((id) => String(id)));
- outboundBatchList.value.forEach((row) => {
- const rowId = getOutboundRowId(row);
- if (rowId !== undefined && rowId !== null && selectedIds.has(String(rowId))) {
- table.toggleRowSelection(row, true);
- }
- });
- });
-};
-
-const loadOutboundBatches = (customerId, keepSelected = false) => {
- if (!customerId) {
- outboundBatchList.value = [];
- outboundBatchOptions.value = [];
- if (!keepSelected) {
- form.stockOutRecordIds = [];
- form.amount = 0;
- }
- return Promise.resolve();
- }
- outboundBatchLoading.value = true;
- return getOutboundBatchesByCustomer({ customerId })
- .then((res) => {
- if (res.code === 200) {
- const list = res.data?.records ?? res.data ?? [];
- outboundBatchList.value = Array.isArray(list) ? list : [];
- outboundBatchOptions.value = normalizeOutboundBatchOptions(list);
- } else {
- outboundBatchList.value = [];
- outboundBatchOptions.value = [];
- }
- })
- .catch(() => {
- outboundBatchList.value = [];
- outboundBatchOptions.value = [];
- })
- .finally(() => {
- outboundBatchLoading.value = false;
- if (keepSelected) {
- ensureOutboundOptionsForSelected();
- restoreOutboundTableSelection();
- }
- });
-};
-
-const handleCustomerChange = (customerId) => {
- form.stockOutRecordIds = [];
- form.outboundBatches = "";
- form.amount = 0;
- loadOutboundBatches(customerId);
-};
-
-const openOutboundSelectDialog = () => {
- if (!form.customerId || isEdit.value || isView.value) return;
- outboundSelectVisible.value = true;
- loadOutboundBatches(form.customerId, true).then(() => {
- restoreOutboundTableSelection();
- });
-};
-
-const handleOutboundDialogSelectionChange = (selection) => {
- dialogOutboundSelection.value = selection;
-};
-
-const confirmOutboundSelection = () => {
- if (dialogOutboundSelection.value.length === 0) {
- ElMessage.warning("璇疯嚦灏戦�夋嫨涓�鏉″叧鑱斿崟鎹�");
- return;
- }
- form.stockOutRecordIds = dialogOutboundSelection.value
- .map((row) => getOutboundRowId(row))
- .filter((id) => id !== undefined && id !== null);
- form.outboundBatches = dialogOutboundSelection.value
- .map((row) => row.outboundBatches ?? row.batchNo ?? row.shippingNo ?? "")
- .filter(Boolean)
- .join("銆�");
- outboundSelectVisible.value = false;
- syncCollectionAmount();
- formRef.value?.validateField("stockOutRecordIds");
-};
-
-const handleOutboundDialogClosed = () => {
- dialogOutboundSelection.value = [];
-};
-
-const appendFilterParams = (params) => {
- if (filters.collectionNumber) {
- params.collectionNumber = filters.collectionNumber;
- }
- if (filters.customerId) {
- params.customerId = filters.customerId;
- }
- if (filters.collectionMethod) {
- params.collectionMethod = filters.collectionMethod;
- }
- if (filters.dateRange?.length === 2) {
- params.startDate = filters.dateRange[0];
- params.endDate = filters.dateRange[1];
- }
- return params;
-};
-
-const buildListParams = () =>
- appendFilterParams({
- current: pagination.currentPage,
- size: pagination.pageSize,
+ defineOptions({
+ name: "鏀舵鍗�",
});
-const buildExportParams = () => appendFilterParams({});
+ const { proxy } = getCurrentInstance();
+ const { payment_methods } = proxy.useDict("payment_methods");
-const buildSubmitPayload = (forUpdate = false) => {
- const payload = {
- customerId: form.customerId,
- collectionDate: form.receiptDate,
- collectionAmount: form.amount,
- collectionMethod: form.receiptMethod,
- collectionNumber: form.receiptCode || "",
- remark: form.remark || "",
- stockOutRecordIds: (form.stockOutRecordIds || []).join(","),
- };
- if (forUpdate) {
- payload.id = currentId.value;
- }
- return payload;
-};
-
-const fillFormFromRow = (row) => {
- const stockOutRecordIds = parseStockOutRecordIds(row.stockOutRecordIds ?? row.stockOutRecordId);
- Object.assign(form, {
- receiptCode: row.receiptCode ?? row.collectionNumber ?? "",
- customerId: row.customerId,
- receiptDate: row.receiptDate ?? row.collectionDate ?? "",
- amount: Number(row.amount ?? row.collectionAmount ?? 0),
- receiptMethod: row.receiptMethod ?? row.collectionMethod ?? "",
- stockOutRecordIds,
- outboundBatches: formatOutboundBatches(row.outboundBatches),
- remark: row.remark ?? "",
- });
-};
-
-const closeDialog = () => {
- dialogVisible.value = false;
- outboundSelectVisible.value = false;
- isView.value = false;
- isEdit.value = false;
-};
-
-const handleExport = () => {
- const params = buildExportParams();
- proxy.download("/accountSalesCollection/exportAccountSalesCollection", params, `鏀舵鍗昣${Date.now()}.xlsx`);
-};
-
-const getTableData = () => {
- tableLoading.value = true;
- listPageAccountSalesCollection(buildListParams())
- .then((res) => {
- const ok = res.code === 200 || res.code === 0;
- if (ok && res.data) {
- pagination.total = res.data.total ?? 0;
- dataList.value = (res.data.records ?? []).map(normalizeTableRow);
- } else {
- ElMessage.error(res.msg || "鏌ヨ澶辫触");
- dataList.value = [];
- pagination.total = 0;
- }
- })
- .catch(() => {
- dataList.value = [];
- pagination.total = 0;
- ElMessage.error("鏌ヨ澶辫触");
- })
- .finally(() => {
- tableLoading.value = false;
- });
-};
-
-const onSearch = () => {
- pagination.currentPage = 1;
- getTableData();
-};
-
-const resetFilters = () => {
- filters.collectionNumber = "";
- filters.customerId = "";
- filters.collectionMethod = "";
- filters.dateRange = [];
- pagination.currentPage = 1;
- getTableData();
-};
-
-const changePage = ({ current, size }) => {
- pagination.currentPage = current;
- pagination.pageSize = size;
- getTableData();
-};
-
-const add = () => {
- isEdit.value = false;
- isView.value = false;
- dialogTitle.value = "鏂板鏀舵";
- Object.assign(form, {
- receiptCode: "SK" + Date.now().toString().slice(-8),
+ const filters = reactive({
+ collectionNumber: "",
customerId: "",
- receiptDate: new Date().toISOString().split("T")[0],
+ collectionMethod: "",
+ dateRange: [],
+ });
+
+ const pagination = reactive({
+ currentPage: 1,
+ pageSize: 10,
+ total: 0,
+ });
+
+ const columns = [
+ { label: "鏀舵鍗曞彿", prop: "receiptCode", width: "150" },
+ { label: "瀹㈡埛鍚嶇О", prop: "customerName", width: "180" },
+ { label: "鏀舵鏃ユ湡", prop: "receiptDate", width: "120" },
+ { label: "鏀舵閲戦", prop: "amount", dataType: "slot", slot: "amount" },
+ {
+ label: "鏀舵鏂瑰紡",
+ prop: "receiptMethod",
+ dataType: "slot",
+ slot: "receiptMethod",
+ width: "120",
+ },
+ { label: "澶囨敞", prop: "remark", showOverflowTooltip: true },
+ {
+ label: "鎿嶄綔",
+ prop: "operation",
+ dataType: "slot",
+ slot: "operation",
+ width: "200",
+ fixed: "right",
+ },
+ ];
+
+ const dataList = ref([]);
+ const tableLoading = ref(false);
+ const dialogVisible = ref(false);
+ const dialogTitle = ref("");
+ const formRef = ref(null);
+ const isEdit = ref(false);
+ const isView = ref(false);
+ const currentId = ref(null);
+ const submitLoading = ref(false);
+
+ const customerList = ref([]);
+ const outboundBatchList = ref([]);
+ const outboundBatchOptions = ref([]);
+ const outboundBatchLoading = ref(false);
+ const outboundSelectVisible = ref(false);
+ const outboundTableRef = ref(null);
+ const dialogOutboundSelection = ref([]);
+
+ const getReceiptMethodLabel = value => {
+ if (value === undefined || value === null || value === "") return "-";
+ const item = payment_methods.value?.find(
+ m => String(m.value) === String(value)
+ );
+ return item?.label ?? value;
+ };
+
+ const getDefaultReceiptMethod = () => payment_methods.value?.[0]?.value ?? "";
+
+ const form = reactive({
+ receiptCode: "",
+ customerId: "",
+ receiptDate: "",
amount: 0,
- receiptMethod: getDefaultReceiptMethod(),
+ receiptMethod: "",
stockOutRecordIds: [],
outboundBatches: "",
remark: "",
});
- outboundBatchList.value = [];
- outboundBatchOptions.value = [];
- dialogVisible.value = true;
-};
-const edit = (row) => {
- isEdit.value = true;
- isView.value = false;
- currentId.value = row.id;
- dialogTitle.value = "缂栬緫鏀舵";
- fillFormFromRow(row);
- dialogVisible.value = true;
-};
+ const rules = {
+ customerId: [{ required: true, message: "璇烽�夋嫨瀹㈡埛", trigger: "change" }],
+ stockOutRecordIds: [
+ {
+ required: true,
+ type: "array",
+ min: 1,
+ message: "璇烽�夋嫨鍏宠仈鍗曟嵁",
+ trigger: "change",
+ },
+ ],
+ receiptDate: [
+ { required: true, message: "璇烽�夋嫨鏀舵鏃ユ湡", trigger: "change" },
+ ],
+ amount: [{ required: true, message: "璇疯緭鍏ユ敹娆鹃噾棰�", trigger: "blur" }],
+ receiptMethod: [
+ { required: true, message: "璇烽�夋嫨鏀舵鏂瑰紡", trigger: "change" },
+ ],
+ };
-const view = (row) => {
- isView.value = true;
- isEdit.value = false;
- dialogTitle.value = "鏌ョ湅鏀舵";
- fillFormFromRow(row);
- dialogVisible.value = true;
-};
+ const totalReceiptAmount = computed(() =>
+ dataList.value.reduce((sum, item) => sum + Number(item.amount || 0), 0)
+ );
-const handleDelete = (row) => {
- ElMessageBox.confirm(`纭鍒犻櫎鏀舵鍗曘��${row.receiptCode ?? row.collectionNumber}銆嶅悧锛焋, "鎻愮ず", {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- }).then(() => {
- deleteAccountSalesCollection([row.id])
- .then((res) => {
- if (res.code === 200) {
- ElMessage.success("鍒犻櫎鎴愬姛");
- getTableData();
- } else {
- ElMessage.error(res.msg || "鍒犻櫎澶辫触");
- }
- })
- .catch(() => {
- ElMessage.error("鍒犻櫎澶辫触");
- });
+ const formatMoney = value => {
+ if (value === undefined || value === null) return "0.00";
+ return Number(value)
+ .toFixed(2)
+ .replace(/\B(?=(\d{3})+(?!\d))/g, ",");
+ };
+
+ const parseStockOutRecordIds = value => {
+ if (!value) return [];
+ if (Array.isArray(value)) return value;
+ return String(value)
+ .split(/[,锛宂/)
+ .map(s => s.trim())
+ .filter(Boolean)
+ .map(s => (/^\d+$/.test(s) ? Number(s) : s));
+ };
+
+ const formatOutboundBatches = value => {
+ if (value === undefined || value === null || value === "") return "";
+ if (Array.isArray(value)) return value.filter(Boolean).join("銆�");
+ return String(value)
+ .split(/[,锛宂/)
+ .map(s => s.trim())
+ .filter(Boolean)
+ .join("銆�");
+ };
+
+ const normalizeTableRow = row => ({
+ ...row,
+ receiptCode: row.collectionNumber ?? row.receiptCode,
+ receiptDate: row.collectionDate ?? row.receiptDate,
+ amount: row.collectionAmount ?? row.amount,
+ receiptMethod: row.collectionMethod ?? row.receiptMethod ?? "",
+ stockOutRecordIds: row.stockOutRecordIds ?? row.stockOutRecordId ?? "",
+ outboundBatches: formatOutboundBatches(row.outboundBatches),
});
-};
-const submitForm = () => {
- formRef.value.validate((valid) => {
- if (!valid) return;
- submitLoading.value = true;
- const request = isEdit.value
- ? updateAccountSalesCollection(buildSubmitPayload(true))
- : addAccountSalesCollection(buildSubmitPayload());
- request
- .then((res) => {
+ const getCustomerList = () => {
+ listCustomer({ current: -1, size: -1, type: 0 }).then(res => {
+ if (res.code === 200) {
+ customerList.value = res.data?.records || [];
+ }
+ });
+ };
+
+ const normalizeOutboundBatchOptions = data => {
+ const list = Array.isArray(data) ? data : [];
+ return list.map((item, index) => {
+ if (typeof item === "string" || typeof item === "number") {
+ const text = String(item);
+ return { label: text, value: text, outboundAmount: 0 };
+ }
+ const label =
+ item.outboundBatches ??
+ item.batchNo ??
+ item.shippingNo ??
+ item.outboundNo ??
+ item.label ??
+ `鍑哄簱鍗�${index + 1}`;
+ const value = item.id ?? item.stockOutRecordId ?? label;
+ return {
+ label: String(label),
+ value,
+ outboundAmount: Number(item.outboundAmount) || 0,
+ };
+ });
+ };
+
+ const isSameOutboundId = (a, b) => String(a) === String(b);
+
+ const getOutboundRowId = row => row?.id ?? row?.stockOutRecordId;
+
+ const outboundBatchDisplayText = computed(() => {
+ if (isEdit.value || isView.value) {
+ return form.outboundBatches || "";
+ }
+ if (form.outboundBatches) return form.outboundBatches;
+ const ids = form.stockOutRecordIds || [];
+ if (!ids.length) return "";
+ const labels = outboundBatchOptions.value
+ .filter(opt => ids.some(id => isSameOutboundId(id, opt.value)))
+ .map(opt => opt.label);
+ if (labels.length) return labels.join("銆�");
+ return ids.join("銆�");
+ });
+
+ const handleOutboundInputClick = () => {
+ if (isEdit.value || isView.value) return;
+ openOutboundSelectDialog();
+ };
+
+ /** 涓哄凡閫� ID 琛ュ叏閫夐」锛堢紪杈�/鏌ョ湅鍥炴樉锛� */
+ const ensureOutboundOptionsForSelected = () => {
+ const ids = form.stockOutRecordIds || [];
+ ids.forEach(id => {
+ const exists = outboundBatchOptions.value.some(opt =>
+ isSameOutboundId(opt.value, id)
+ );
+ if (exists) return;
+ const fromList = outboundBatchList.value.find(row =>
+ isSameOutboundId(getOutboundRowId(row), id)
+ );
+ if (fromList) {
+ const [option] = normalizeOutboundBatchOptions([fromList]);
+ if (option) outboundBatchOptions.value.push(option);
+ return;
+ }
+ outboundBatchOptions.value.push({
+ label: String(id),
+ value: id,
+ outboundAmount: 0,
+ });
+ });
+ };
+
+ const syncCollectionAmount = () => {
+ const selected = form.stockOutRecordIds || [];
+ const sum = outboundBatchOptions.value
+ .filter(opt => selected.some(id => isSameOutboundId(id, opt.value)))
+ .reduce((acc, opt) => acc + (Number(opt.outboundAmount) || 0), 0);
+ form.amount = sum > 0 ? Number(sum.toFixed(2)) : 0;
+ };
+
+ const restoreOutboundTableSelection = () => {
+ nextTick(() => {
+ const table = outboundTableRef.value;
+ if (!table) return;
+ table.clearSelection();
+ const selectedIds = new Set(
+ (form.stockOutRecordIds || []).map(id => String(id))
+ );
+ outboundBatchList.value.forEach(row => {
+ const rowId = getOutboundRowId(row);
+ if (
+ rowId !== undefined &&
+ rowId !== null &&
+ selectedIds.has(String(rowId))
+ ) {
+ table.toggleRowSelection(row, true);
+ }
+ });
+ });
+ };
+
+ const loadOutboundBatches = (customerId, keepSelected = false) => {
+ if (!customerId) {
+ outboundBatchList.value = [];
+ outboundBatchOptions.value = [];
+ if (!keepSelected) {
+ form.stockOutRecordIds = [];
+ form.amount = 0;
+ }
+ return Promise.resolve();
+ }
+ outboundBatchLoading.value = true;
+ return getOutboundBatchesByCustomer({ customerId })
+ .then(res => {
if (res.code === 200) {
- ElMessage.success(isEdit.value ? "淇敼鎴愬姛" : "鏂板鎴愬姛");
- closeDialog();
- getTableData();
+ const list = res.data?.records ?? res.data ?? [];
+ outboundBatchList.value = Array.isArray(list) ? list : [];
+ outboundBatchOptions.value = normalizeOutboundBatchOptions(list);
} else {
- ElMessage.error(res.msg || (isEdit.value ? "淇敼澶辫触" : "鏂板澶辫触"));
+ outboundBatchList.value = [];
+ outboundBatchOptions.value = [];
}
})
.catch(() => {
- ElMessage.error(isEdit.value ? "淇敼澶辫触" : "鏂板澶辫触");
+ outboundBatchList.value = [];
+ outboundBatchOptions.value = [];
})
.finally(() => {
- submitLoading.value = false;
+ outboundBatchLoading.value = false;
+ if (keepSelected) {
+ ensureOutboundOptionsForSelected();
+ restoreOutboundTableSelection();
+ }
});
- });
-};
+ };
-onMounted(() => {
- getCustomerList();
- getTableData();
-});
+ const handleCustomerChange = customerId => {
+ form.stockOutRecordIds = [];
+ form.outboundBatches = "";
+ form.amount = 0;
+ loadOutboundBatches(customerId);
+ };
+
+ const openOutboundSelectDialog = () => {
+ if (!form.customerId || isEdit.value || isView.value) return;
+ outboundSelectVisible.value = true;
+ loadOutboundBatches(form.customerId, true).then(() => {
+ restoreOutboundTableSelection();
+ });
+ };
+
+ const handleOutboundDialogSelectionChange = selection => {
+ dialogOutboundSelection.value = selection;
+ };
+
+ const confirmOutboundSelection = () => {
+ if (dialogOutboundSelection.value.length === 0) {
+ ElMessage.warning("璇疯嚦灏戦�夋嫨涓�鏉″叧鑱斿崟鎹�");
+ return;
+ }
+ form.stockOutRecordIds = dialogOutboundSelection.value
+ .map(row => getOutboundRowId(row))
+ .filter(id => id !== undefined && id !== null);
+ form.outboundBatches = dialogOutboundSelection.value
+ .map(row => row.outboundBatches ?? row.batchNo ?? row.shippingNo ?? "")
+ .filter(Boolean)
+ .join("銆�");
+ outboundSelectVisible.value = false;
+ syncCollectionAmount();
+ formRef.value?.validateField("stockOutRecordIds");
+ };
+
+ const handleOutboundDialogClosed = () => {
+ dialogOutboundSelection.value = [];
+ };
+
+ const appendFilterParams = params => {
+ if (filters.collectionNumber) {
+ params.collectionNumber = filters.collectionNumber;
+ }
+ if (filters.customerId) {
+ params.customerId = filters.customerId;
+ }
+ if (filters.collectionMethod) {
+ params.collectionMethod = filters.collectionMethod;
+ }
+ if (filters.dateRange?.length === 2) {
+ params.startDate = filters.dateRange[0];
+ params.endDate = filters.dateRange[1];
+ }
+ return params;
+ };
+
+ const buildListParams = () =>
+ appendFilterParams({
+ current: pagination.currentPage,
+ size: pagination.pageSize,
+ });
+
+ const buildExportParams = () => appendFilterParams({});
+
+ const buildSubmitPayload = (forUpdate = false) => {
+ const payload = {
+ customerId: form.customerId,
+ collectionDate: form.receiptDate,
+ collectionAmount: form.amount,
+ collectionMethod: form.receiptMethod,
+ collectionNumber: form.receiptCode || "",
+ remark: form.remark || "",
+ stockOutRecordIds: (form.stockOutRecordIds || []).join(","),
+ };
+ if (forUpdate) {
+ payload.id = currentId.value;
+ }
+ return payload;
+ };
+
+ const fillFormFromRow = row => {
+ const stockOutRecordIds = parseStockOutRecordIds(
+ row.stockOutRecordIds ?? row.stockOutRecordId
+ );
+ Object.assign(form, {
+ receiptCode: row.receiptCode ?? row.collectionNumber ?? "",
+ customerId: row.customerId,
+ receiptDate: row.receiptDate ?? row.collectionDate ?? "",
+ amount: Number(row.amount ?? row.collectionAmount ?? 0),
+ receiptMethod: row.receiptMethod ?? row.collectionMethod ?? "",
+ stockOutRecordIds,
+ outboundBatches: formatOutboundBatches(row.outboundBatches),
+ remark: row.remark ?? "",
+ });
+ };
+
+ const closeDialog = () => {
+ dialogVisible.value = false;
+ outboundSelectVisible.value = false;
+ isView.value = false;
+ isEdit.value = false;
+ };
+
+ const handleExport = () => {
+ const params = buildExportParams();
+ proxy.download(
+ "/accountSalesCollection/exportAccountSalesCollection",
+ params,
+ `鏀舵鍗昣${Date.now()}.xlsx`
+ );
+ };
+
+ const getTableData = () => {
+ tableLoading.value = true;
+ listPageAccountSalesCollection(buildListParams())
+ .then(res => {
+ const ok = res.code === 200 || res.code === 0;
+ if (ok && res.data) {
+ pagination.total = res.data.total ?? 0;
+ dataList.value = (res.data.records ?? []).map(normalizeTableRow);
+ } else {
+ ElMessage.error(res.msg || "鏌ヨ澶辫触");
+ dataList.value = [];
+ pagination.total = 0;
+ }
+ })
+ .catch(() => {
+ dataList.value = [];
+ pagination.total = 0;
+ ElMessage.error("鏌ヨ澶辫触");
+ })
+ .finally(() => {
+ tableLoading.value = false;
+ });
+ };
+
+ const onSearch = () => {
+ pagination.currentPage = 1;
+ getTableData();
+ };
+
+ const resetFilters = () => {
+ filters.collectionNumber = "";
+ filters.customerId = "";
+ filters.collectionMethod = "";
+ filters.dateRange = [];
+ pagination.currentPage = 1;
+ getTableData();
+ };
+
+ const changePage = ({ current, size }) => {
+ pagination.currentPage = current;
+ pagination.pageSize = size;
+ getTableData();
+ };
+
+ const add = () => {
+ isEdit.value = false;
+ isView.value = false;
+ dialogTitle.value = "鏂板鏀舵";
+ Object.assign(form, {
+ receiptCode: "SK" + Date.now().toString().slice(-8),
+ customerId: "",
+ receiptDate: new Date().toISOString().split("T")[0],
+ amount: 0,
+ receiptMethod: getDefaultReceiptMethod(),
+ stockOutRecordIds: [],
+ outboundBatches: "",
+ remark: "",
+ });
+ outboundBatchList.value = [];
+ outboundBatchOptions.value = [];
+ dialogVisible.value = true;
+ };
+
+ const edit = row => {
+ isEdit.value = true;
+ isView.value = false;
+ currentId.value = row.id;
+ dialogTitle.value = "缂栬緫鏀舵";
+ fillFormFromRow(row);
+ dialogVisible.value = true;
+ };
+
+ const view = row => {
+ isView.value = true;
+ isEdit.value = false;
+ dialogTitle.value = "鏌ョ湅鏀舵";
+ fillFormFromRow(row);
+ dialogVisible.value = true;
+ };
+
+ const handleDelete = row => {
+ ElMessageBox.confirm(
+ `纭鍒犻櫎鏀舵鍗曘��${row.receiptCode ?? row.collectionNumber}銆嶅悧锛焋,
+ "鎻愮ず",
+ {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ }
+ ).then(() => {
+ deleteAccountSalesCollection([row.id])
+ .then(res => {
+ if (res.code === 200) {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ getTableData();
+ } else {
+ ElMessage.error(res.msg || "鍒犻櫎澶辫触");
+ }
+ })
+ .catch(() => {
+ ElMessage.error("鍒犻櫎澶辫触");
+ });
+ });
+ };
+
+ const submitForm = () => {
+ formRef.value.validate(valid => {
+ if (!valid) return;
+ submitLoading.value = true;
+ const request = isEdit.value
+ ? updateAccountSalesCollection(buildSubmitPayload(true))
+ : addAccountSalesCollection(buildSubmitPayload());
+ request
+ .then(res => {
+ if (res.code === 200) {
+ ElMessage.success(isEdit.value ? "淇敼鎴愬姛" : "鏂板鎴愬姛");
+ closeDialog();
+ getTableData();
+ } else {
+ ElMessage.error(res.msg || (isEdit.value ? "淇敼澶辫触" : "鏂板澶辫触"));
+ }
+ })
+ .catch(() => {
+ ElMessage.error(isEdit.value ? "淇敼澶辫触" : "鏂板澶辫触");
+ })
+ .finally(() => {
+ submitLoading.value = false;
+ });
+ });
+ };
+
+ onMounted(() => {
+ getCustomerList();
+ getTableData();
+ });
</script>
<style lang="scss" scoped>
-.actions {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 15px;
-}
-
-.text-success {
- color: #67c23a;
- font-weight: bold;
-}
-
-.outbound-batch-input:not(.is-disabled) {
- :deep(.el-input__wrapper) {
- cursor: pointer;
+ .actions {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 15px;
}
-}
+
+ .text-success {
+ color: #67c23a;
+ font-weight: bold;
+ }
+
+ .outbound-batch-input:not(.is-disabled) {
+ :deep(.el-input__wrapper) {
+ cursor: pointer;
+ }
+ }
</style>
diff --git a/src/views/procurementManagement/paymentLedger/index.vue b/src/views/procurementManagement/paymentLedger/index.vue
index d46aaa7..99b4b39 100644
--- a/src/views/procurementManagement/paymentLedger/index.vue
+++ b/src/views/procurementManagement/paymentLedger/index.vue
@@ -127,7 +127,7 @@
// 瀛愭ā鍧�
const tableColumnSon = ref([
{
- label: "鍙戠敓鏃ユ湡",
+ label: "鍚堝悓绛捐鏃ユ湡",
prop: "executionDate",
width: 110,
},
diff --git a/src/views/salesManagement/receiptPaymentLedger/index.vue b/src/views/salesManagement/receiptPaymentLedger/index.vue
index 4aa01fd..d92843d 100644
--- a/src/views/salesManagement/receiptPaymentLedger/index.vue
+++ b/src/views/salesManagement/receiptPaymentLedger/index.vue
@@ -78,7 +78,7 @@
label="搴忓彿"
type="index"
width="60" />
- <el-table-column label="鍙戠敓鏃ユ湡"
+ <el-table-column label="鍚堝悓绛捐鏃ユ湡"
prop="executionDate"
show-overflow-tooltip
width="110" />
--
Gitblit v1.9.3