From 64b38f57628375dff92d147ddeefd771e6e85439 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 08 七月 2026 15:55:36 +0800
Subject: [PATCH] Merge branch 'dev_NEW_pro' into dev_黎城_康森商砼

---
 src/views/financialManagement/receivable/outputInvoice.vue |  710 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 710 insertions(+), 0 deletions(-)

diff --git a/src/views/financialManagement/receivable/outputInvoice.vue b/src/views/financialManagement/receivable/outputInvoice.vue
new file mode 100644
index 0000000..effb0af
--- /dev/null
+++ b/src/views/financialManagement/receivable/outputInvoice.vue
@@ -0,0 +1,710 @@
+<template>
+  <div class="app-container">
+    <el-form :model="filters" :inline="true">
+      <el-form-item label="鍙戠エ鍙风爜:">
+        <el-input v-model="filters.invoiceNumber" placeholder="璇疯緭鍏ュ彂绁ㄥ彿鐮�" clearable style="width: 200px;" />
+      </el-form-item>
+      <el-form-item label="瀹㈡埛:">
+        <el-select v-model="filters.customerId" placeholder="璇烽�夋嫨瀹㈡埛" clearable 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-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 label="鐘舵��:">
+        <el-select v-model="filters.status" placeholder="璇烽�夋嫨鐘舵��" clearable style="width: 150px;">
+          <el-option label="姝e父" :value="0" />
+          <el-option label="浣滃簾" :value="1" />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <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></div>
+        <div>
+          <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"
+        isShowSummary
+        :summaryMethod="getSummaries"
+        :page="{
+          current: pagination.currentPage,
+          size: pagination.pageSize,
+          total: pagination.total,
+        }"
+        @pagination="changePage"
+      >
+        <template #amount="{ row }">
+          <span class="text-primary">楼{{ formatMoney(row.amount) }}</span>
+        </template>
+        <template #taxAmount="{ row }">
+          <span class="text-danger">楼{{ formatMoney(row.taxAmount) }}</span>
+        </template>
+        <template #totalAmount="{ row }">
+          <span class="text-success">楼{{ formatMoney(row.totalAmount) }}</span>
+        </template>
+        <template #status="{ row }">
+          <el-tag :type="getStatusType(row.status)" effect="light" round>
+            {{ getStatusLabel(row.status) }}
+          </el-tag>
+        </template>
+        <template #operation="{ row }">
+          <el-button type="primary" link @click="view(row)">鏌ョ湅</el-button>
+          <el-button
+            type="primary"
+            link
+            @click="openFileDialog(row)"
+            v-if="row.accountInvoiceApplicationId"
+          >
+            闄勪欢
+          </el-button>
+          <el-button type="warning" link @click="handleCancel(row)" v-if="isNormalStatus(row.status)">浣滃簾</el-button>
+          <el-button 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="100px">
+        <el-row v-if="isView" :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="鐘舵��">
+              <el-tag :type="getStatusType(form.status)" effect="light" round>
+                {{ getStatusLabel(form.status) }}
+              </el-tag>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="鍙戠エ鍙风爜" prop="invoiceNo">
+              <el-input v-model="form.invoiceNo" placeholder="璇疯緭鍏ュ彂绁ㄥ彿鐮�" :disabled="isView" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="瀹㈡埛" prop="customerId">
+              <el-select @change="checkCustomer" v-model="form.customerId" placeholder="璇烽�夋嫨瀹㈡埛" style="width: 100%;" :disabled="isView">
+                <el-option v-for="item in customerList" :key="item.id" :label="item.customerName" :value="item.id" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="鍏宠仈寮�绁ㄧ敵璇�" prop="accountInvoiceApplicationId">
+              <el-select v-model="form.accountInvoiceApplicationId"
+                        placeholder="璇峰厛閫夋嫨瀹㈡埛"
+                        readonly
+                         @change="selectionApply"
+                        :disabled="!form.customerId || isView"
+                        class="outbound-batch-select">
+                <el-option v-for="(item,index) in applyList" :key="index" :label="item.invoiceApplicationNo" :value="item.id"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="寮�绁ㄦ棩鏈�" prop="invoiceDate">
+              <el-date-picker
+                v-model="form.invoiceDate"
+                type="date"
+                placeholder="閫夋嫨鏃ユ湡"
+                value-format="YYYY-MM-DD"
+                style="width: 100%;"
+                :disabled="isView"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="鍙戠エ绫诲瀷" prop="invoiceType">
+              <el-select
+                  v-model="form.invoiceType"
+                  placeholder="璇烽�夋嫨鍙戠エ绫诲瀷"
+                  style="width: 100%;"
+                  :disabled="isView"
+              >
+                <el-option label="澧炲�肩◣涓撶敤鍙戠エ" value="澧炲�肩◣涓撶敤鍙戠エ" />
+                <el-option label="澧炲�肩◣鏅�氬彂绁�" value="澧炲�肩◣鏅�氬彂绁�" />
+                <el-option label="鐢靛瓙鍙戠エ" value="鐢靛瓙鍙戠エ" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="绋庣巼" prop="taxRate">
+              <el-select
+                v-model="form.taxRate"
+                placeholder="璇烽�夋嫨绋庣巼"
+                style="width: 100%;"
+                :disabled="isView"
+                @change="handleTaxRateChange"
+              >
+                <el-option
+                  v-for="dict in tax_rate"
+                  :key="dict.value"
+                  :label="dict.label"
+                  :value="Number(dict.value)"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="10">
+            <el-form-item label="閲戦(涓嶅惈绋�)" prop="amount">
+              <el-input-number
+                v-model="form.amount"
+                :min="0"
+                :precision="2"
+                style="width: 100%;"
+                :disabled="isView"
+                @change="handleTaxRateChange"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="7">
+            <el-form-item label="绋庨">
+              <el-input v-model="form.taxAmount" style="width: 100%;" disabled />
+            </el-form-item>
+          </el-col>
+          <el-col :span="7">
+            <el-form-item label="浠风◣鍚堣">
+              <el-input v-model="form.totalAmount" style="width: 100%;" disabled />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="鍙戠エ鍐呭" prop="content">
+          <el-input v-model="form.content" type="textarea" :rows="3" placeholder="璇疯緭鍏ュ彂绁ㄥ唴瀹�" :disabled="isView" />
+        </el-form-item>
+        <el-form-item label="澶囨敞" prop="remark">
+          <el-input v-model="form.remark" type="textarea" :rows="2" placeholder="璇疯緭鍏ュ娉�" :disabled="isView" />
+        </el-form-item>
+      </el-form>
+      <template v-if="!isView" #footer>
+        <el-button type="primary" :loading="submitLoading" @click="submitForm">纭畾</el-button>
+        <el-button @click="closeDialog">鍙栨秷</el-button>
+      </template>
+    </FormDialog>
+
+    <FileList
+      v-if="fileDialogVisible"
+      v-model:visible="fileDialogVisible"
+      record-type="account_invoice_application"
+      :record-id="currentRecordId"
+      :editable="false"
+    />
+  </div>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted, getCurrentInstance, defineAsyncComponent } from "vue";
+import { ElMessage, ElMessageBox } from "element-plus";
+import FormDialog from "@/components/Dialog/FormDialog.vue";
+import { listCustomer } from "@/api/basicData/customer.js";
+import {
+  addAccountSalesInvoice,
+  listPageAccountSalesInvoice,
+  cancelAccountSalesInvoice,
+  deleteAccountSalesInvoice,
+} from "@/api/financialManagement/accountSalesInvoice.js";
+import {getAccountInvoiceApplicationList} from "@/api/financialManagement/invoiceApply.js";
+
+const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
+
+defineOptions({
+  name: "閿�椤瑰彂绁�",
+});
+
+const { proxy } = getCurrentInstance();
+const { tax_rate } = proxy.useDict("tax_rate");
+
+const filters = reactive({
+  invoiceNumber: "",
+  customerId: "",
+  dateRange: [],
+  status: "",
+});
+
+const pagination = reactive({
+  currentPage: 1,
+  pageSize: 10,
+  total: 0,
+});
+
+const columns = [
+  { label: "鍙戠エ鍙风爜", prop: "invoiceNo", width: "140" },
+  { label: "瀹㈡埛鍚嶇О", prop: "customerName", width: "180" },
+  { label: "寮�绁ㄦ棩鏈�", prop: "invoiceDate", width: "120" },
+  { label: "閲戦", prop: "amount", dataType: "slot", slot: "amount" },
+  { label: "绋庨", prop: "taxAmount", dataType: "slot", slot: "taxAmount" },
+  { label: "浠风◣鍚堣", prop: "totalAmount", dataType: "slot", slot: "totalAmount" },
+  { label: "鍙戠エ绫诲瀷", prop: "invoiceType", width: "130" },
+  { label: "鐘舵��", prop: "status", dataType: "slot", slot: "status", width: "90", align: "center" },
+  { label: "鎿嶄綔", prop: "operation", dataType: "slot", slot: "operation", width: "260", fixed: "right" },
+];
+
+const dataList = ref([]);
+const tableLoading = ref(false);
+const dialogVisible = ref(false);
+const dialogTitle = ref("");
+const formRef = ref(null);
+const isView = ref(false);
+const submitLoading = ref(false);
+
+const customerList = ref([]);
+const fileDialogVisible = ref(false);
+const currentRecordId = ref(0);
+
+const applySelectVisible = ref(false);
+const applyList = ref([]);
+
+const openFileDialog = (row) => {
+  if (!row.accountInvoiceApplicationId) {
+    ElMessage.warning("鏈叧鑱斿紑绁ㄧ敵璇凤紝鏃犳硶鏌ョ湅闄勪欢");
+    return;
+  }
+  currentRecordId.value = row.accountInvoiceApplicationId;
+  fileDialogVisible.value = true;
+};
+
+/** 鐘舵�侊細0姝e父 1浣滃簾 */
+const STATUS_LABEL_MAP = { 0: "姝e父", 1: "浣滃簾" };
+const STATUS_TYPE_MAP = { 0: "success", 1: "info" };
+
+const normalizeStatus = (status) => {
+  if (status === undefined || status === null || status === "") return 0;
+  const num = Number(status);
+  return Number.isNaN(num) ? 0 : num;
+};
+
+const isNormalStatus = (status) => normalizeStatus(status) === 0;
+
+const getStatusLabel = (status) => {
+  const num = normalizeStatus(status);
+  return STATUS_LABEL_MAP[num] ?? "姝e父";
+};
+
+const getStatusType = (status) => {
+  const num = normalizeStatus(status);
+  return STATUS_TYPE_MAP[num] ?? "success";
+};
+
+const form = reactive({
+  invoiceNo: "",
+  customerId: "",
+  invoiceDate: "",
+  invoiceType: "澧炲�肩◣涓撶敤鍙戠エ",
+  taxRate: 13,
+  amount: 0,
+  taxAmount: 0,
+  totalAmount: 0,
+  content: "",
+  remark: "",
+  deptId: undefined,
+  accountInvoiceApplicationId: undefined,
+  storageAttachmentId: undefined,
+});
+
+const rules = {
+  invoiceNo: [{ required: true, message: "璇疯緭鍏ュ彂绁ㄥ彿鐮�", trigger: "blur" }],
+  accountInvoiceApplicationId: [{ required: true, message: "璇烽�夋嫨寮�绁ㄧ敵璇�", trigger: "change" }],
+  customerId: [{ required: true, message: "璇烽�夋嫨瀹㈡埛", trigger: "change" }],
+  invoiceDate: [{ required: true, message: "璇烽�夋嫨寮�绁ㄦ棩鏈�", trigger: "change" }],
+  invoiceType: [{ required: true, message: "璇烽�夋嫨鍙戠エ绫诲瀷", trigger: "change" }],
+  taxRate: [{ required: true, message: "璇烽�夋嫨绋庣巼", trigger: "change" }],
+  amount: [{ required: true, message: "璇疯緭鍏ラ噾棰�", trigger: "blur" }],
+};
+
+// 閫夋嫨瀹㈡埛
+const checkCustomer = (val) =>{
+  loadApplyList(val);
+}
+
+//鏌ヨ寮�绁ㄧ敵璇峰垪琛�
+const loadApplyList = (customerId) => {
+  if (!customerId) {
+    applyList.value = [];
+    return Promise.resolve();
+  }
+  return getAccountInvoiceApplicationList({ customerId })
+      .then(res => {
+        if (res.code === 200) {
+          const list = res.data?.records ?? res.data ?? [];
+          applyList.value = Array.isArray(list) ? list : [];
+        } else {
+          applyList.value = [];
+        }
+      })
+      .catch(() => {
+        applyList.value = [];
+      })
+};
+
+const selectionApply = (val)=>{
+  const applyObj = applyList.value.find(item=>item.id === val);
+  if(!applyObj){
+    ElMessage.warning("璇烽�夋嫨鍏宠仈鐨勫紑绁ㄧ敵璇�");
+    return;
+  }
+  form.remark = applyObj.remark;
+  form.content = applyObj.invoiceContent;
+  form.invoiceDate = applyObj.applyDate;
+  form.invoiceType = applyObj.invoiceType;
+  form.deptId = applyObj.deptId;
+  form.taxRate = applyObj.taxRate;
+  form.totalAmount = applyObj.invoiceAmount
+  handleTaxRateChange();
+}
+
+/** 浠风◣鍚堣鍙樻洿锛氭寜绋庣巼鍙嶇畻涓嶅惈绋庨噾棰濄�佺◣棰� */
+const calculateTaxFromInclusive = (inclusiveTotal) => {
+  const total = Number(inclusiveTotal ?? form.totalAmount ?? 0);
+  if (total <= 0) {
+    form.amount = 0;
+    form.taxAmount = 0;
+    form.totalAmount = 0;
+    return;
+  }
+  const rate = Number(form.taxRate) / 100;
+  form.totalAmount = Number(total.toFixed(2));
+  form.amount = Number((form.totalAmount / (1 + rate)).toFixed(2));
+  form.taxAmount = Number((form.totalAmount - form.amount).toFixed(2));
+};
+
+const calculateTaxFromExclusive = () => {
+  form.taxAmount = Number((form.amount * form.taxRate / 100).toFixed(2));
+  form.totalAmount = Number((form.amount + form.taxAmount).toFixed(2));
+};
+
+const handleTaxRateChange = () => {
+  if (form.totalAmount > 0) {
+    calculateTaxFromInclusive(form.totalAmount);
+  } else {
+    calculateTaxFromExclusive();
+  }
+};
+
+const getSummaries = ({ columns, data }) => {
+  const sums = [];
+  columns.forEach((col, index) => {
+    if (index === 0) {
+      sums[index] = "鍚堣";
+    } else if (col.property === "amount") {
+      const total = data.reduce((prev, cur) => {
+        const v = Number(cur.amount);
+        return prev + (isNaN(v) ? 0 : v);
+      }, 0);
+      sums[index] = total.toLocaleString("zh-CN", {
+        minimumFractionDigits: 2,
+        maximumFractionDigits: 2,
+      });
+    } else {
+      sums[index] = "";
+    }
+  });
+  return sums;
+};
+
+const formatMoney = (value) => {
+  if (value === undefined || value === null) return "0.00";
+  return Number(value).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
+};
+
+const normalizeTableRow = (row) => ({
+  ...row,
+  invoiceNo: row.invoiceNumber ?? row.invoiceNo,
+  invoiceDate: row.issueDate ?? row.invoiceDate,
+  amount: row.taxExclusivelPrice ?? row.amount,
+  taxAmount: row.taxPrice ?? row.taxAmount,
+  totalAmount: row.taxInclusivePrice ?? row.totalAmount,
+  content: row.invoiceContent ?? row.content,
+  status: normalizeStatus(row.status),
+});
+
+const fillFormFromRow = (row) => {
+  Object.assign(form, {
+    invoiceNo: row.invoiceNo ?? row.invoiceNumber ?? "",
+    customerId: row.customerId,
+    invoiceDate: row.invoiceDate ?? row.issueDate ?? "",
+    invoiceType: row.invoiceType ?? "澧炲�肩◣涓撶敤鍙戠エ",
+    taxRate: row.taxRate ?? 13,
+    amount: row.amount ?? row.taxExclusivelPrice ?? 0,
+    taxAmount: row.taxAmount ?? row.taxPrice ?? 0,
+    totalAmount: row.totalAmount ?? row.taxInclusivePrice ?? 0,
+    content: row.content ?? row.invoiceContent ?? "",
+    remark: row.remark ?? "",
+    accountInvoiceApplicationId: row.accountInvoiceApplicationId,
+    storageAttachmentId: row.storageAttachmentId,
+    status: normalizeStatus(row.status),
+  });
+};
+
+const buildCancelPayload = (row) => ({
+  id: row.id,
+  accountInvoiceApplicationId: row.accountInvoiceApplicationId,
+  invoiceNumber: row.invoiceNumber ?? row.invoiceNo,
+  taxRate: row.taxRate,
+  invoiceType: row.invoiceType,
+  issueDate: row.issueDate ?? row.invoiceDate,
+  taxExclusivelPrice: row.taxExclusivelPrice ?? row.amount,
+  taxPrice: row.taxPrice ?? row.taxAmount,
+  taxInclusivePrice: row.taxInclusivePrice ?? row.totalAmount,
+  remark: row.remark ?? "",
+  invoiceContent: row.invoiceContent ?? row.content,
+  customerId: row.customerId,
+  storageAttachmentId: row.storageAttachmentId,
+  status: 1,
+});
+
+const buildSubmitPayload = () => ({
+  invoiceNumber: form.invoiceNo,
+  customerId: form.customerId,
+  issueDate: form.invoiceDate,
+  invoiceType: form.invoiceType,
+  taxRate: form.taxRate,
+  taxExclusivelPrice: form.amount,
+  taxPrice: form.taxAmount,
+  taxInclusivePrice: form.totalAmount,
+  invoiceContent: form.content,
+  remark: form.remark || "",
+  accountInvoiceApplicationId: form.accountInvoiceApplicationId,
+  storageAttachmentId: form.storageAttachmentId,
+});
+
+const getCustomerList = () => {
+  listCustomer({ current: -1, size: -1, type: 0 }).then((res) => {
+    if (res.code === 200) {
+      customerList.value = res.data?.records || [];
+    }
+  });
+};
+
+const appendFilterParams = (params) => {
+  if (filters.invoiceNumber) {
+    params.invoiceNumber = filters.invoiceNumber;
+  }
+  if (filters.customerId) {
+    params.customerId = filters.customerId;
+  }
+  if (filters.dateRange?.length === 2) {
+    params.startDate = filters.dateRange[0];
+    params.endDate = filters.dateRange[1];
+  }
+  if (filters.status !== "" && filters.status != null) {
+    params.status = filters.status;
+  }
+  return params;
+};
+
+const buildListParams = () =>
+  appendFilterParams({
+    current: pagination.currentPage,
+    size: pagination.pageSize,
+  });
+
+const buildExportParams = () => appendFilterParams({});
+
+const handleExport = () => {
+  const params = buildExportParams();
+  proxy.download("/accountSalesInvoice/exportAccountSalesInvoice", params, `閿�椤瑰彂绁╛${Date.now()}.xlsx`);
+};
+
+const getTableData = () => {
+  tableLoading.value = true;
+  listPageAccountSalesInvoice(buildListParams())
+    .then((res) => {
+      if (res.code === 200) {
+        const records = res.data?.records ?? [];
+        dataList.value = records.map(normalizeTableRow);
+        pagination.total = res.data?.total ?? 0;
+      } else {
+        dataList.value = [];
+        pagination.total = 0;
+        ElMessage.error(res.msg || "鏌ヨ澶辫触");
+      }
+    })
+    .catch(() => {
+      dataList.value = [];
+      pagination.total = 0;
+      ElMessage.error("鏌ヨ澶辫触");
+    })
+    .finally(() => {
+      tableLoading.value = false;
+    });
+};
+
+const onSearch = () => {
+  pagination.currentPage = 1;
+  getTableData();
+};
+
+const resetFilters = () => {
+  filters.invoiceNumber = "";
+  filters.customerId = "";
+  filters.dateRange = [];
+  filters.status = "";
+  pagination.currentPage = 1;
+  getTableData();
+};
+
+const changePage = ({ current, size }) => {
+  pagination.currentPage = current;
+  pagination.pageSize = size;
+  getTableData();
+};
+
+const closeDialog = () => {
+  dialogVisible.value = false;
+  applySelectVisible.value = false;
+  isView.value = false;
+  isView.value = false;
+};
+
+const add = () => {
+  isView.value = false;
+  dialogTitle.value = "褰曞叆鍙戠エ";
+  Object.assign(form, {
+    invoiceNo: "",
+    customerId: "",
+    invoiceDate: new Date().toISOString().split("T")[0],
+    invoiceType: "澧炲�肩◣涓撶敤鍙戠エ",
+    taxRate: 13,
+    amount: 0,
+    taxAmount: 0,
+    totalAmount: 0,
+    content: "",
+    remark: "",
+    accountInvoiceApplicationId: undefined,
+    storageAttachmentId: undefined,
+  });
+  dialogVisible.value = true;
+};
+
+const view = (row) => {
+  isView.value = true;
+  dialogTitle.value = "鏌ョ湅鍙戠エ";
+  fillFormFromRow(row);
+  dialogVisible.value = true;
+};
+
+const handleCancel = (row) => {
+  ElMessageBox.confirm(`纭浣滃簾鍙戠エ銆�${row.invoiceNo ?? row.invoiceNumber}銆嶅悧锛焋, "浣滃簾纭", {
+    confirmButtonText: "纭畾",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  }).then(() => {
+    cancelAccountSalesInvoice(buildCancelPayload(row))
+      .then((res) => {
+        if (res.code === 200) {
+          ElMessage.success("浣滃簾鎴愬姛");
+          getTableData();
+        } else {
+          ElMessage.error(res.msg || "浣滃簾澶辫触");
+        }
+      })
+      .catch(() => {
+        ElMessage.error("浣滃簾澶辫触");
+      });
+  });
+};
+
+const handleDelete = (row) => {
+  ElMessageBox.confirm(`纭鍒犻櫎鍙戠エ銆�${row.invoiceNo ?? row.invoiceNumber}銆嶅悧锛熷垹闄ゅ悗涓嶅彲鎭㈠銆俙, "鍒犻櫎纭", {
+    confirmButtonText: "纭畾",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  }).then(() => {
+    deleteAccountSalesInvoice([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;
+    addAccountSalesInvoice(buildSubmitPayload())
+      .then((res) => {
+        if (res.code === 200) {
+          ElMessage.success("褰曞叆鎴愬姛");
+          closeDialog();
+          getTableData();
+        } else {
+          ElMessage.error(res.msg || "褰曞叆澶辫触");
+        }
+      })
+      .catch(() => {
+        ElMessage.error("褰曞叆澶辫触");
+      })
+      .finally(() => {
+        submitLoading.value = false;
+      });
+  });
+};
+
+onMounted(() => {
+  getCustomerList();
+  getTableData();
+});
+</script>
+
+<style lang="scss" scoped>
+.actions {
+  display: flex;
+  justify-content: space-between;
+  margin-bottom: 15px;
+}
+
+.text-primary {
+  color: #409eff;
+  font-weight: bold;
+}
+
+.text-danger {
+  color: #f56c6c;
+  font-weight: bold;
+}
+
+.text-success {
+  color: #67c23a;
+  font-weight: bold;
+}
+</style>

--
Gitblit v1.9.3