From 8bc17a9ea84a6af0b7d01e451c702f404a3ff895 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期六, 10 一月 2026 11:36:34 +0800
Subject: [PATCH] Merge branch 'dev_tide' into dev_tide_cbsglxt

---
 src/views/procurementManagement/paymentEntry/index.vue |  575 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 575 insertions(+), 0 deletions(-)

diff --git a/src/views/procurementManagement/paymentEntry/index.vue b/src/views/procurementManagement/paymentEntry/index.vue
new file mode 100644
index 0000000..02fda1a
--- /dev/null
+++ b/src/views/procurementManagement/paymentEntry/index.vue
@@ -0,0 +1,575 @@
+<template>
+  <div class="app-container">
+    <div class="search_form">
+      <el-form :inline="true" :model="searchForm" style="width: 100%">
+        <el-row justify="space-between">
+          <el-col :span="20">
+            <el-form-item label="渚涘簲鍟嗗悕绉�/鍚堝悓鍙�">
+              <el-input
+                v-model="searchForm.supplierNameOrContractNo"
+                style="width: 240px"
+                placeholder="杈撳叆渚涘簲鍟嗗悕绉�/鍚堝悓鍙锋悳绱�"
+                clearable
+                prefix-icon="Search"
+                @change="handleQuery"
+              />
+            </el-form-item>
+            <el-form-item>
+              <el-checkbox
+                v-model="searchForm.status"
+                label="涓嶆樉绀哄緟浠樻涓�0"
+                @change="handleQuery"
+              />
+            </el-form-item>
+            <el-form-item>
+              <el-button type="primary" @click="handleQuery"> 鎼滅储 </el-button>
+            </el-form-item>
+          </el-col>
+          <el-col :span="4">
+            <el-form-item style="float: right; margin-right: unset">
+              <el-button type="primary" @click="openForm('add')">
+                鏂板浠樻
+              </el-button>
+<!--              <el-button type="danger" plain @click="handleDelete">-->
+<!--                鍒犻櫎-->
+<!--              </el-button>-->
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+    </div>
+    <div class="table_list">
+      <PIMTable
+        rowKey="id"
+        :column="tableColumn"
+        :tableData="tableData"
+        :page="page"
+        :expandRowKeys="expandedRowKeys"
+        :isSelection="true"
+        :isShowSummary="isShowSummarySon"
+        :summaryMethod="summarizeMainTable1"
+        @selection-change="handleSelectionChange"
+        @expand-change="expandChange"
+        :tableLoading="tableLoading"
+        @pagination="pagination"
+        :total="page.total"
+      >
+				<template #expand="{ row }">
+					<el-table
+						:data="expandData"
+						border
+						show-summary
+						v-loading="childrenLoading"
+						:summary-method="summarizeMainTable2"
+						stripe
+					>
+						<el-table-column
+							align="center"
+							label="搴忓彿"
+							type="index"
+							width="60"
+						/>
+						<el-table-column label="浠樻鏃ユ湡" prop="paymentDate" />
+						<el-table-column label="浠樻閲戦" prop="currentPaymentAmount">
+							<template #default="scope">
+								<el-input-number :step="0.01" :min="0" style="width: 100%"
+																 v-model="scope.row.currentPaymentAmount"
+																 :disabled="!scope.row.editType"
+																 :precision="2"
+																 placeholder="璇疯緭鍏�"
+																 clearable
+								/>
+							</template>
+						</el-table-column>
+						<el-table-column label="浠樻鏂瑰紡" prop="paymentMethod">
+							<template #default="scope">
+								<el-input
+									:disabled="!scope.row.editType"
+									v-model="scope.row.paymentMethod"
+									placeholder="璇疯緭鍏�"
+									clearable
+								/>
+							</template>
+						</el-table-column>
+						<el-table-column label="鐧昏浜�" prop="registrant" />
+						<el-table-column label="鐧昏鏃ユ湡" prop="registrationtDate" />
+						<el-table-column label="鎿嶄綔" width="150">
+							<template #default="scope">
+								<el-button
+									link
+									type="primary"
+									size="small"
+									@click="changeEditType(scope.row)"
+									v-if="!scope.row.editType"
+									:disabled="scope.row.registrant !== userStore.nickName"
+								>缂栬緫</el-button
+								>
+								<el-button
+									link
+									type="primary"
+									size="small"
+									@click="saveReceiptPayment(scope.row)"
+									v-if="scope.row.editType"
+									:disabled="scope.row.registrant !== userStore.nickName"
+								>淇濆瓨</el-button
+								>
+								<el-button
+									link
+									type="primary"
+									size="small"
+									@click="handleDelete(scope.row)"
+									:disabled="scope.row.registrant !== userStore.nickName"
+								>鍒犻櫎</el-button
+								>
+							</template>
+						</el-table-column>
+					</el-table>
+				</template>
+			</PIMTable>
+    </div>
+    <el-dialog
+      v-model="dialogFormVisible"
+      :title="operationType === 'add' ? '鏂板浠樻鐧昏' : '缂栬緫浠樻鐧昏'"
+      width="60%"
+      @close="closeDia"
+    >
+      <el-form
+        :model="form"
+        label-width="140px"
+        label-position="top"
+        :rules="rules"
+        ref="formRef"
+      >
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="閲囪喘鍚堝悓鍙凤細" prop="purchaseContractNumber">
+              <el-input
+                v-model="form.purchaseContractNumber"
+                placeholder="鑷姩濉厖"
+                clearable
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="閿�鍞悎鍚屽彿锛�" prop="salesContractNo">
+              <el-input
+                v-model="form.salesContractNo"
+                placeholder="鑷姩濉厖"
+                clearable
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="渚涘簲鍟嗗悕绉帮細" prop="supplierName">
+              <el-input
+                v-model="form.supplierName"
+                placeholder="鑷姩濉厖"
+                clearable
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鍙戠エ鍙凤細" prop="invoiceNumber">
+              <el-input
+                v-model="form.invoiceNumber"
+                placeholder="鑷姩濉厖"
+                clearable
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="鍙戠エ閲戦(鍏�)锛�" prop="invoiceAmount">
+              <el-input
+                v-model="form.invoiceAmount"
+                placeholder="鑷姩濉厖"
+                clearable
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鏈浠樻閲戦锛�" prop="currentPaymentAmount">
+              <el-input-number :step="0.01" :min="0" style="width: 100%"
+															 :precision="2"
+                v-model="form.currentPaymentAmount"
+                placeholder="璇疯緭鍏�"
+                clearable
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="浠樻鏂瑰紡锛�" prop="paymentMethod">
+              <el-input
+                v-model="form.paymentMethod"
+                placeholder="璇疯緭鍏�"
+                clearable
+              />
+            </el-form-item>
+          </el-col>
+					<el-col :span="12">
+						<el-form-item label="浠樻鏃ユ湡锛�" prop="paymentDate">
+							<el-date-picker
+								style="width: 100%"
+								v-model="form.paymentDate"
+								value-format="YYYY-MM-DD"
+								format="YYYY-MM-DD"
+								type="date"
+								placeholder="璇烽�夋嫨"
+								clearable
+							/>
+						</el-form-item>
+					</el-col>
+        </el-row>
+        <el-row :gutter="30">
+					<el-col :span="12">
+						<el-form-item label="鐧昏浜猴細" prop="registrant">
+							<el-input
+								v-model="form.registrant"
+								placeholder="璇疯緭鍏�"
+								clearable
+								disabled
+							/>
+						</el-form-item>
+					</el-col>
+          <el-col :span="12">
+            <el-form-item label="鐧昏鏃ユ湡锛�" prop="registrationtDate">
+              <el-input
+                v-model="form.registrationtDate"
+                placeholder="璇疯緭鍏�"
+                clearable
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button type="primary" @click="submitForm">纭</el-button>
+          <el-button @click="closeDia">鍙栨秷</el-button>
+        </div>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { ref } from "vue";
+import { Search } from "@element-plus/icons-vue";
+import { ElMessageBox } from "element-plus";
+import useUserStore from "@/store/modules/user.js";
+import {
+  byPurchaseId,
+  paymentRegistrationAdd,
+  paymentRegistrationDel,
+  paymentRegistrationEdit,
+  getTicketNo,
+} from "@/api/procurementManagement/paymentEntry.js";
+import {
+	delPaymentRegistration,
+	invoiceListPage,
+	registrationListPageGetById,
+	updatePaymentRegistration
+} from "@/api/procurementManagement/procurementInvoiceLedger.js";
+import useFormData from "@/hooks/useFormData";
+
+const { proxy } = getCurrentInstance();
+const tableColumn = ref([
+	{
+		type: "expand",
+		dataType: "slot",
+		slot: "expand",
+	},
+  {
+    label: "閲囪喘鍚堝悓鍙�",
+    prop: "purchaseContractNumber",
+  },
+  {
+    label: "閿�鍞悎鍚屽彿",
+    prop: "salesContractNo",
+  },
+  {
+    label: "渚涘簲鍟嗗悕绉�",
+    prop: "supplierName",
+    width:240
+  },
+  {
+    label: "鍙戠エ鍙�",
+    prop: "invoiceNumber",
+    width:200
+  },
+  {
+    label: "鍙戠エ閲戦(鍏�)",
+    prop: "invoiceAmount",
+    formatData: (params) => {
+      return params ? parseFloat(params).toFixed(2) : 0;
+    },
+  },
+  {
+    label: "宸蹭粯娆鹃噾棰�(鍏�)",
+    prop: "paymentAmountTotal",
+    formatData: (params) => {
+      return params ? parseFloat(params).toFixed(2) : 0;
+    },
+  },
+  {
+    label: "寰呬粯娆鹃噾棰�(鍏�)",
+    prop: "unPaymentAmountTotal",
+    formatData: (params) => {
+      return params ? parseFloat(params).toFixed(2) : 0;
+    },
+  },
+  {
+    label: "褰曞叆浜�",
+    prop: "issUer",
+  },
+]);
+const tableData = ref([]);
+const expandData = ref([]);
+const selectedRows = ref([]);
+const tableLoading = ref(false);
+const childrenLoading = ref(false);
+const userStore = useUserStore();
+const page = reactive({
+  current: 1,
+  size: 100,
+	total: 0,
+});
+
+// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
+const operationType = ref("");
+const dialogFormVisible = ref(false);
+const data = reactive({
+  searchForm: {
+    supplierNameOrContractNo: "",
+    status: false,
+  },
+  form: {
+    purchaseContractNumber: "",
+    purchaseLedgerId: "",
+    salesContractNo: "",
+    supplierName: "",
+    invoiceNumber: "",
+    invoiceAmount: "",
+    taxRate: "",
+    currentPaymentAmount: "",
+    paymentMethod: "",
+    registrant: "",
+    registrantId: "",
+    paymentDate: "",
+    registrationtDate: "",
+  },
+  rules: {
+    purchaseLedgerId: [
+      { required: true, message: "璇烽�夋嫨", trigger: "change" },
+    ],
+    currentPaymentAmount: [
+      { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+    ],
+    paymentMethod: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+    invoiceNumber: [
+      { required: true, message: "璇烽�夋嫨閲囪喘鍚堝悓鍙�", trigger: "change" },
+    ],
+  },
+});
+const { form, rules } = toRefs(data);
+const { form: searchForm, resetForm } = useFormData(data.searchForm);
+const isShowSummarySon = ref(true);
+const expandedRowKeys = ref([]);
+
+
+// 瀛愯〃鍚堣鏂规硶
+const summarizeMainTable1 = (param) => {
+  return proxy.summarizeTable(
+    param,
+    ["invoiceAmount", "paymentAmountTotal", "unPaymentAmountTotal"],
+    {
+      ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+      futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+    }
+  );
+};
+// 瀛愯〃鍚堣鏂规硶
+const summarizeMainTable2 = (param) => {
+	return proxy.summarizeTable(param, ["currentPaymentAmount"], {
+		ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+		futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+	});
+};
+// 鏌ヨ鍒楄〃
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+  page.current = 1;
+  getList();
+};
+const pagination = (obj) => {
+  page.current = obj.page;
+  page.size = obj.limit;
+  getList();
+};
+const getList = () => {
+  tableLoading.value = true;
+  invoiceListPage({ ...searchForm, ...page }).then((res) => {
+    tableLoading.value = false;
+    tableData.value = res.records;
+		page.total = res.total;
+		if (expandedRowKeys.value.length > 0) {
+			const arr = []
+			const index = tableData.value.findIndex(item => item.id === expandedRowKeys.value[0]);
+			if (index > -1) {
+				arr.push(tableData.value[index]);
+				expandChange(tableData.value[index], arr)
+			}
+		}
+  });
+};
+// 灞曞紑琛�
+const expandChange = (row, expandedRows) => {
+	if (expandedRows.length > 0) {
+		nextTick(() => {
+			expandedRowKeys.value = [];
+			try {
+				childrenLoading.value = true;
+				registrationListPageGetById({ id: row.id }).then((res) => {
+					childrenLoading.value = false;
+					const index = tableData.value.findIndex((item) => item.id === row.id);
+					if (index > -1) {
+						expandData.value = res;
+					}
+					expandedRowKeys.value.push(row.id);
+				});
+			} catch (error) {
+				childrenLoading.value = false;
+				console.log(error);
+			}
+		})
+	} else {
+		expandedRowKeys.value = [];
+	}
+};
+// 缂栬緫淇敼鐘舵��
+const changeEditType = (row) => {
+	row.editType = !row.editType;
+};
+// 淇濆瓨鍥炴璁板綍
+const saveReceiptPayment = (row) => {
+	let updateData = {
+		id: row.id,
+		currentPaymentAmount: row.currentPaymentAmount,
+		paymentMethod: row.paymentMethod,
+	};
+	updatePaymentRegistration(updateData).then((res) => {
+		row.editType = !row.editType;
+		getList();
+		proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+	});
+};
+// 琛ㄦ牸閫夋嫨鏁版嵁
+const handleSelectionChange = (selection) => {
+  selectedRows.value = selection;
+};
+// 鎵撳紑寮规
+const openForm = (type, row) => {
+  if (selectedRows.value.length !== 1) {
+    proxy.$message.error("璇烽�夋嫨涓�鏉″彂绁ㄦ暟鎹�");
+    return;
+  }
+	if (selectedRows.value[0].unPaymentAmountTotal == 0) {
+		proxy.$message.warning("鏃犻渶鍐嶄粯娆�");
+		return;
+	}
+  operationType.value = type;
+  form.value = {};
+  form.value = { ...selectedRows.value[0] };
+  form.value.ticketRegistrationId = selectedRows.value[0].id;
+  form.value.id = null;
+  // 鏌ヨ閲囪喘鍚堝悓鍙�
+  form.value.registrationtDate = getCurrentDate();
+  form.value.paymentDate = getCurrentDate();
+  form.value.registrant = userStore.name;
+  dialogFormVisible.value = true;
+};
+// 鎻愪氦琛ㄥ崟
+const submitForm = () => {
+  proxy.$refs["formRef"].validate((valid) => {
+    if (valid) {
+      if (operationType.value === "edit") {
+        submitEdit();
+      } else {
+        submitAdd();
+      }
+    }
+  });
+};
+// 鎻愪氦鏂板
+const submitAdd = () => {
+  paymentRegistrationAdd(form.value).then((res) => {
+    proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+    closeDia();
+    getList();
+  });
+};
+// 鎻愪氦淇敼
+const submitEdit = () => {
+  paymentRegistrationEdit(form.value).then((res) => {
+    proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+    closeDia();
+    getList();
+  });
+};
+// 鍏抽棴寮规
+const closeDia = () => {
+  proxy.resetForm("formRef");
+  dialogFormVisible.value = false;
+};
+// 鍒犻櫎
+const handleDelete = (row) => {
+  ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+    confirmButtonText: "纭",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  })
+    .then(() => {
+      tableLoading.value = true;
+			delPaymentRegistration(row.id)
+        .then((res) => {
+          proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+          getList();
+        })
+        .finally(() => {
+          tableLoading.value = false;
+        });
+    })
+    .catch(() => {
+      proxy.$modal.msg("宸插彇娑�");
+    });
+};
+// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
+function getCurrentDate() {
+  const today = new Date();
+  const year = today.getFullYear();
+  const month = String(today.getMonth() + 1).padStart(2, "0"); // 鏈堜唤浠�0寮�濮�
+  const day = String(today.getDate()).padStart(2, "0");
+  return `${year}-${month}-${day}`;
+}
+getList();
+</script>
+
+<style scoped lang="scss">
+.table_list {
+  margin-top: unset;
+}
+::v-deep(.el-checkbox__label) {
+  font-weight: bold;
+}
+</style>

--
Gitblit v1.9.3