From b3af089315a98903163a394a3b1ca0e4c634b9ab Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 14 一月 2026 17:51:37 +0800
Subject: [PATCH] Merge branch 'dev_New' of http://114.132.189.42:9002/r/product-inventory-management into dev_New

---
 src/views/salesManagement/receiptPayment/index.vue |  427 +++++++++++++++++++++++-----------------------------
 1 files changed, 191 insertions(+), 236 deletions(-)

diff --git a/src/views/salesManagement/receiptPayment/index.vue b/src/views/salesManagement/receiptPayment/index.vue
index 3521017..40e6f14 100644
--- a/src/views/salesManagement/receiptPayment/index.vue
+++ b/src/views/salesManagement/receiptPayment/index.vue
@@ -13,24 +13,6 @@
                 prefix-icon="Search"
               />
             </el-form-item>
-            <el-form-item label="瀹㈡埛鍚堝悓鍙�">
-              <el-input
-                v-model="searchForm.customerContractNo"
-                placeholder="璇疯緭鍏�"
-                @change="handleQuery"
-                clearable
-                prefix-icon="Search"
-              />
-            </el-form-item>
-            <el-form-item label="椤圭洰鍚嶇О">
-              <el-input
-                v-model="searchForm.projectName"
-                placeholder="璇疯緭鍏�"
-                @change="handleQuery"
-                clearable
-                prefix-icon="Search"
-              />
-            </el-form-item>
             <el-form-item>
               <el-checkbox
                 v-model="searchForm.status"
@@ -49,7 +31,7 @@
       <div class="actions">
         <div></div>
         <div>
-          <el-button type="primary" icon="Plus" @click="openForm('add')">
+          <el-button type="primary" @click="openForm('add')">
             鏂板鍥炴
           </el-button>
           <el-button icon="Download" @click="handleOut"> 瀵煎嚭 </el-button>
@@ -83,7 +65,7 @@
                 type="index"
                 width="60"
               />
-              <el-table-column label="鍥炴鏃ユ湡" prop="receiptPaymentDate" />
+              <el-table-column label="鍥炴鏃ユ湡" prop="receiptPaymentDate"  width="130"/>
               <el-table-column label="鍥炴閲戦" prop="receiptPaymentAmount">
                 <template #default="scope">
 									<el-input-number :step="0.01" :min="0" style="width: 100%"
@@ -112,9 +94,9 @@
                   </el-select>
                 </template>
               </el-table-column>
-              <el-table-column label="鐧昏浜�" prop="registrant" />
-              <el-table-column label="鐧昏鏃ユ湡" prop="createTime" />
-              <el-table-column label="鎿嶄綔" width="150">
+              <el-table-column label="鐧昏浜�" prop="registrant" width="90"/>
+              <el-table-column label="鐧昏鏃ユ湡" prop="createTime"   width="130"/>
+              <el-table-column label="鎿嶄綔" width="150" align="center">
                 <template #default="scope">
                   <el-button
                     link
@@ -122,7 +104,6 @@
                     size="small"
                     @click="changeEditType(scope.row)"
                     v-if="!scope.row.editType"
-										:disabled="scope.row.registrant !== userStore.nickName"
                     >缂栬緫</el-button
                   >
                   <el-button
@@ -131,7 +112,6 @@
                     size="small"
                     @click="saveReceiptPayment(scope.row)"
                     v-if="scope.row.editType"
-										:disabled="scope.row.registrant !== userStore.nickName"
                     >淇濆瓨</el-button
                   >
                   <el-button
@@ -139,7 +119,6 @@
                     type="primary"
                     size="small"
                     @click="delReceiptRecord(scope.row)"
-										:disabled="scope.row.registrant !== userStore.nickName"
                     >鍒犻櫎</el-button
                   >
                 </template>
@@ -155,24 +134,22 @@
           width="240"
         />
         <el-table-column
-          label="瀹㈡埛鍚堝悓鍙�"
-          prop="customerContractNo"
-          show-overflow-tooltip
-          width="240"
-
-        />
-        <el-table-column
           label="瀹㈡埛鍚嶇О"
           prop="customerName"
           show-overflow-tooltip
           width="240"
         />
         <el-table-column
-          label="椤圭洰鍚嶇О"
-          prop="projectName"
-          show-overflow-tooltip
-          width="340"
-        />
+          label="鍥炴鐘舵��"
+          prop="statusName"
+          width="120"
+        >
+          <template #default="{ row }">
+            <el-tag :type="getStatusTagType(row.statusName)" disable-transitions>
+              {{ row.statusName || "--" }}
+            </el-tag>
+          </template>
+        </el-table-column>
         <el-table-column
           label="浜у搧澶х被"
           prop="productCategory"
@@ -180,35 +157,28 @@
           width="100"
         />
         <el-table-column
-          label="鍙戠エ鍙�"
-          prop="invoiceNo"
+          label="瑙勬牸鍨嬪彿"
+          prop="specificationModel"
           show-overflow-tooltip
-          width="200"
-        />
-        <el-table-column
-          label="鍙戠エ閲戦(鍏�)"
-          prop="invoiceTotal"
-          show-overflow-tooltip
-          :formatter="formattedNumber"
           width="200"
         />
         <el-table-column label="绋庣巼(%)" prop="taxRate" show-overflow-tooltip />
         <el-table-column
-          label="鍥炴閲戦(鍏�)"
-          prop="receiptPaymentAmountTotal"
+          label="宸插洖娆鹃噾棰�(鍏�)"
+          prop="invoiceTotal"
           show-overflow-tooltip
           :formatter="formattedNumber"
           width="200"
         />
         <el-table-column
           label="寰呭洖娆鹃噾棰�(鍏�)"
-          prop="noReceiptAmount"
+          prop="pendingInvoiceTotal"
           show-overflow-tooltip
           width="200"
         >
           <template #default="{ row, column }">
             <el-text type="danger">
-              {{ formattedNumber(row, column, row.noReceiptAmount) }}
+              {{ formattedNumber(row, column, row.pendingInvoiceTotal) }}
             </el-text>
           </template>
         </el-table-column>
@@ -222,145 +192,108 @@
         @pagination="paginationChange"
       />
     </div>
-    <el-dialog
+    <FormDialog
       v-model="dialogFormVisible"
-      title="鏂板鍙戠エ鍙烽〉闈�"
-      width="70%"
+      title="鏂板鍥炴椤甸潰"
+      :width="'90%'"
       @close="closeDia"
+      @confirm="submitForm"
+      @cancel="closeDia"
     >
-      <el-form
-        :model="form"
-        label-width="140px"
-        label-position="top"
-        :rules="rules"
-        ref="formRef"
+      <el-table
+        v-if="forms.length"
+        :data="forms"
+        border
+        style="width: 100%"
+        size="small"
       >
-        <el-row :gutter="30">
-          <el-col :span="12">
-            <el-form-item label="閿�鍞悎鍚屽彿锛�" prop="salesContractNo">
-              <el-input
-                v-model="form.salesContractNo"
-                placeholder="鑷姩濉厖"
-                disabled
+        <el-table-column type="index" label="搴忓彿" width="50" align="center"/>
+        <el-table-column label="閿�鍞悎鍚屽彿" prop="salesContractNo" show-overflow-tooltip />
+        <el-table-column label="瀹㈡埛鍚嶇О" prop="customerName" show-overflow-tooltip />
+				<el-table-column
+					label="浜у搧澶х被"
+					prop="productCategory"
+					show-overflow-tooltip
+					width="100"
+				/>
+				<el-table-column
+					label="瑙勬牸鍨嬪彿"
+					prop="specificationModel"
+					show-overflow-tooltip
+					width="200"
+				/>
+        <el-table-column label="绋庣巼(%)" width="110">
+          <template #default="{ row }">
+            <el-input v-model="row.taxRate" disabled />
+          </template>
+        </el-table-column>
+        <el-table-column
+          label="寰呭洖娆鹃噾棰�(鍏�)"
+          prop="pendingInvoiceTotal"
+          show-overflow-tooltip
+          width="170"
+        >
+          <template #default="{ row, column }">
+            <el-text type="danger">
+              {{ formattedNumber(row, column, row.pendingInvoiceTotal) }}
+            </el-text>
+          </template>
+        </el-table-column>
+        <el-table-column label="鏈鍥炴閲戦(鍏�)" width="180">
+          <template #default="{ row }">
+            <el-input-number
+              v-model="row.receiptPaymentAmount"
+              :step="0.01"
+              :min="0"
+              :max="Number(row.pendingInvoiceTotal || 0)"
+              :precision="2"
+              style="width: 100%"
+              placeholder="璇疯緭鍏�"
+            />
+          </template>
+        </el-table-column>
+        <el-table-column label="鍥炴褰㈠紡" width="160">
+          <template #default="{ row }">
+            <el-select v-model="row.receiptPaymentType" placeholder="璇烽�夋嫨" clearable>
+              <el-option
+                v-for="opt in receipt_payment_type"
+                :key="opt.value"
+                :label="opt.label"
+                :value="opt.value"
               />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="瀹㈡埛鍚嶇О锛�" prop="customerName">
-              <el-input
-                v-model="form.customerName"
-                placeholder="鑷姩濉厖"
-                disabled
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row :gutter="30">
-          <el-col :span="12">
-            <el-form-item label="鍙戠エ鍙凤細" prop="invoiceNo">
-              <el-input
-                v-model="form.invoiceNo"
-                placeholder="鑷姩濉厖"
-                disabled
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="鍙戠エ閲戦(鍏�)锛�" prop="invoiceTotal">
-              <el-input
-                type="number"
-                v-model="form.invoiceTotal"
-                placeholder="鑷姩濉厖"
-                :step="0.01"
-                disabled
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row :gutter="30">
-          <el-col :span="12">
-            <el-form-item label="绋庣巼锛�" prop="taxRate">
-              <el-input
-                type="number"
-                v-model="form.taxRate"
-                placeholder="鑷姩濉厖"
-                :step="0.01"
-                disabled
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="鏈鍥炴閲戦锛�" prop="receiptPaymentAmount">
-              <el-input-number :step="0.01" :min="0" style="width: 100%"
-															 :precision="2"
-                v-model="form.receiptPaymentAmount"
-                placeholder="璇疯緭鍏�"
-                clearable
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row :gutter="30">
-          <el-col :span="12">
-            <el-form-item label="鍥炴褰㈠紡锛�" prop="receiptPaymentType">
-              <el-select
-                v-model="form.receiptPaymentType"
-                placeholder="璇烽�夋嫨"
-                clearable
-              >
-                <el-option
-                  v-for="item in receipt_payment_type"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                />
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <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-row>
-        <el-row :gutter="30">
-          <el-col :span="12">
-            <el-form-item label="鏉ユ鏃ユ湡锛�" prop="receiptPaymentDate">
-              <el-date-picker
-                style="width: 100%"
-                v-model="form.receiptPaymentDate"
-                value-format="YYYY-MM-DD"
-                format="YYYY-MM-DD"
-                type="date"
-                placeholder="璇烽�夋嫨"
-                clearable
-              />
-            </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>
+            </el-select>
+          </template>
+        </el-table-column>
+        <el-table-column label="鍥炴鏃ユ湡" width="170">
+          <template #default="{ row }">
+            <el-date-picker
+              v-model="row.receiptPaymentDate"
+              value-format="YYYY-MM-DD"
+              format="YYYY-MM-DD"
+              type="date"
+              placeholder="璇烽�夋嫨"
+              style="width: 100%"
+            />
+          </template>
+        </el-table-column>
+        <el-table-column label="鐧昏浜�" width="140">
+          <template #default="{ row }">
+            <el-input v-model="row.registrant" />
+          </template>
+        </el-table-column>
+      </el-table>
+      <div v-else class="empty-tip">璇烽�夋嫨闇�瑕佸洖娆剧殑璁板綍</div>
+    </FormDialog>
   </div>
 </template>
 
 <script setup>
 import pagination from "@/components/PIMTable/Pagination.vue";
-import { onMounted, ref } from "vue";
+import FormDialog from '@/components/Dialog/FormDialog.vue';
+import { onMounted, ref, reactive, getCurrentInstance } from "vue";
 import {
   receiptPaymentSaveOrUpdate,
   bindInvoiceNoRegPage,
-  invoiceInfo,
   receiptPaymentHistoryListNoPage,
   receiptPaymentDel,
 } from "../../../api/salesManagement/receiptPayment.js";
@@ -373,6 +306,7 @@
 const tableData = ref([]);
 const selectedRows = ref([]);
 const tableLoading = ref(false);
+const forms = ref([]);
 const page = reactive({
   current: 1,
   size: 100,
@@ -387,44 +321,21 @@
     searchText: "",
     status: true,
     customerName: "",
-    customerContractNo: "",
-    projectName: "",
-  },
-  form: {
-    salesContractNo: "",
-    customerName: "",
-    invoiceNo: "",
-    invoiceTotal: "",
-    taxRate: "",
-    receiptPaymentAmount: "",
-    receiptPaymentType: "",
-    registrant: "",
-    receiptPaymentDate: "",
-  },
-  rules: {
-    salesContractNo: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
-    customerName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-    invoiceNo: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
-    invoiceTotal: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-    taxRate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
-    receiptPaymentAmount: [
-      { required: true, message: "璇烽�夋嫨", trigger: "change" },
-    ],
-    receiptPaymentType: [
-      { required: true, message: "璇烽�夋嫨", trigger: "change" },
-    ],
-    registrant: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
-    receiptPaymentDate: [
-      { required: true, message: "璇烽�夋嫨", trigger: "change" },
-    ],
+    specificationModel: "",
   },
 });
-const { form, rules } = toRefs(data);
-const { form: searchForm, resetForm } = useFormData(data.searchForm);
+const { form: searchForm } = useFormData(data.searchForm);
 const { receipt_payment_type } = proxy.useDict("receipt_payment_type");
 
 const formattedNumber = (row, column, cellValue) => {
-  return parseFloat(cellValue).toFixed(2);
+  const val = Number(cellValue ?? 0);
+  return Number.isFinite(val) ? val.toFixed(2) : "0.00";
+};
+
+const getStatusTagType = (statusName = '') => {
+  const normalized = statusName.trim();
+  if (!normalized) return 'info';
+  return normalized === '鏈畬鎴愬洖娆�' ? 'danger' : 'success';
 };
 // 鏌ヨ鍒楄〃
 /** 鎼滅储鎸夐挳鎿嶄綔 */
@@ -438,13 +349,20 @@
   getList();
 };
 const getList = () => {
-  expandedRowKeys.value = [];
   tableLoading.value = true;
   bindInvoiceNoRegPage({ ...searchForm, ...page })
     .then((res) => {
       tableLoading.value = false;
       tableData.value = res.data.records;
       total.value = res.data.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)
+				}
+			}
     })
     .catch(() => {
       tableLoading.value = false;
@@ -480,15 +398,13 @@
 // 琛ㄦ牸閫夋嫨鏁版嵁
 const handleSelectionChange = (selection) => {
   console.log("selection", selection);
-  selectedRows.value = selection.filter(
-    (item) => item.customerContractNo !== null
-  );
+  selectedRows.value = selection;
 };
 // 涓昏〃鍚堣鏂规硶
 const summarizeMainTable = (param) => {
   return proxy.summarizeTable(
     param,
-    ["invoiceTotal", "receiptPaymentAmountTotal", "noReceiptAmount"],
+    ["receiptPaymentAmountTotal", "noReceiptAmount"],
     {
       ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
       futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
@@ -501,40 +417,72 @@
 };
 // 鎵撳紑寮规
 const openForm = () => {
-  form.value = {};
-  if (selectedRows.value.length !== 1) {
-    proxy.$modal.msgError("璇烽�夋嫨涓�鏉℃暟鎹�");
+  if (selectedRows.value.length === 0) {
+    proxy.$modal.msgError("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
     return;
   }
-  //
-  console.log("(selectedRows.value", selectedRows.value);
-  if (selectedRows.value[0].noReceiptAmount === 0) {
-    proxy.$modal.msgError("寰呭洖娆鹃噾棰濅负0鍏�");
+  const validRows = selectedRows.value.filter((item) => item.noReceiptAmount !== 0);
+  if (validRows.length === 0) {
+    proxy.$modal.msgWarning("鎵�閫夎褰曞潎鏃犻渶鍥炴");
     return;
   }
-  invoiceInfo({ id: selectedRows.value[0].id }).then((res) => {
-    form.value = { ...res.data };
-    form.value.invoiceLedgerId = form.value.id;
-    form.value.id = "";
-    form.value.registrant = userStore.nickName;
-  });
+  forms.value = validRows.map((row) => ({
+    salesContractNo: row.salesContractNo || "",
+    customerName: row.customerName || "",
+    productCategory: row.productCategory || "",
+    specificationModel: row.specificationModel || "",
+    pendingInvoiceTotal: Number(row.pendingInvoiceTotal || 0),
+    taxRate: row.taxRate ?? "",
+    receiptPaymentAmount: "",
+    receiptPaymentType: "",
+    registrant: userStore.nickName,
+    receiptPaymentDate: "",
+    invoiceLedgerId: row.id,
+    salesLedgerId: row.salesLedgerId,
+    salesLedgerProductId: row.id,
+  }));
   dialogFormVisible.value = true;
 };
 // 鎻愪氦琛ㄥ崟
 const submitForm = () => {
-  proxy.$refs["formRef"].validate((valid) => {
-    if (valid) {
-      receiptPaymentSaveOrUpdate(form.value).then((res) => {
-        proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
-        closeDia();
-        getList();
-      });
+  if (forms.value.length === 0) {
+    proxy.$modal.msgError("璇烽�夋嫨鍥炴璁板綍");
+    return;
+  }
+  for (let i = 0; i < forms.value.length; i++) {
+    const item = forms.value[i];
+    const pendingAmount = Number(item.pendingInvoiceTotal || 0);
+    const currentAmount = Number(item.receiptPaymentAmount);
+    if (!item.receiptPaymentAmount && item.receiptPaymentAmount !== 0) {
+      proxy.$modal.msgError(`绗� ${i + 1} 鏉★細璇峰~鍐欏洖娆鹃噾棰漙);
+      return;
     }
+    if (currentAmount > pendingAmount) {
+      proxy.$modal.msgError(
+        `绗� ${i + 1} 鏉★細鍥炴閲戦涓嶈兘瓒呰繃寰呭洖娆鹃噾棰濓紙寰呭洖娆撅細${pendingAmount.toFixed(
+          2
+        )}锛塦
+      );
+      return;
+    }
+    if (!item.receiptPaymentType) {
+      proxy.$modal.msgError(`绗� ${i + 1} 鏉★細璇烽�夋嫨鍥炴褰㈠紡`);
+      return;
+    }
+    if (!item.receiptPaymentDate) {
+      proxy.$modal.msgError(`绗� ${i + 1} 鏉★細璇烽�夋嫨鍥炴鏃ユ湡`);
+      return;
+    }
+  }
+  receiptPaymentSaveOrUpdate(forms.value).then(() => {
+    proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+    closeDia();
+    getList();
   });
 };
 // 鍏抽棴寮规
 const closeDia = () => {
-  proxy.resetForm("formRef");
+  forms.value = [];
   dialogFormVisible.value = false;
 };
 
@@ -577,6 +525,8 @@
   };
   receiptPaymentSaveOrUpdate(updateData).then((res) => {
     row.editType = !row.editType;
+		getList();
+		proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
   });
 };
 
@@ -617,4 +567,9 @@
   justify-content: space-between;
   margin-bottom: 10px;
 }
+.empty-tip {
+  text-align: center;
+  padding: 20px 0;
+  color: #909399;
+}
 </style>

--
Gitblit v1.9.3