From e00905e53ee5d91d9e488ecf5ece3e25b9889436 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 20 一月 2026 16:14:44 +0800
Subject: [PATCH] 湟水峡 1.采购模块不要项目名称 2.加一个有待回款登记的提示 3.回款登记、付款登记改成和销售订单价格关联,并且可以多个一起回款或付款 4.合同管理不要下载合同了,跟合同相关的字段可以去掉了 5.重构生产模块 6.测试流程并修改bug

---
 src/views/salesManagement/receiptPayment/index.vue |  332 +++++++++++++++++++-----------------------------------
 1 files changed, 119 insertions(+), 213 deletions(-)

diff --git a/src/views/salesManagement/receiptPayment/index.vue b/src/views/salesManagement/receiptPayment/index.vue
index 18292b2..559b961 100644
--- a/src/views/salesManagement/receiptPayment/index.vue
+++ b/src/views/salesManagement/receiptPayment/index.vue
@@ -104,7 +104,6 @@
                     size="small"
                     @click="changeEditType(scope.row)"
                     v-if="!scope.row.editType"
-										:disabled="scope.row.registrant !== userStore.nickName"
                     >缂栬緫</el-button
                   >
                   <el-button
@@ -113,7 +112,6 @@
                     size="small"
                     @click="saveReceiptPayment(scope.row)"
                     v-if="scope.row.editType"
-										:disabled="scope.row.registrant !== userStore.nickName"
                     >淇濆瓨</el-button
                   >
                   <el-button
@@ -121,7 +119,6 @@
                     type="primary"
                     size="small"
                     @click="delReceiptRecord(scope.row)"
-										:disabled="scope.row.registrant !== userStore.nickName"
                     >鍒犻櫎</el-button
                   >
                 </template>
@@ -160,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>
@@ -202,141 +192,105 @@
         @pagination="paginationChange"
       />
     </div>
-    <el-dialog
+    <FormDialog
       v-model="dialogFormVisible"
       title="鏂板鍥炴椤甸潰"
-      width="90%"
+      :width="'90%'"
       @close="closeDia"
+      @confirm="submitForm"
+      @cancel="closeDia"
     >
       <el-table
-        :data="dialogTableData"
+        v-if="forms.length"
+        :data="forms"
         border
         style="width: 100%"
-        max-height="500px"
+        size="small"
       >
-        <el-table-column align="center" label="搴忓彿" type="index" width="60" />
-        <el-table-column
-          label="閿�鍞悎鍚屽彿"
-          prop="salesContractNo"
-          show-overflow-tooltip
-          width="200"
-        />
-        <el-table-column
-          label="瀹㈡埛鍚嶇О"
-          prop="customerName"
-          show-overflow-tooltip
-          width="200"
-        />
-        <el-table-column
-          label="浜у搧澶х被"
-          prop="productCategory"
-          show-overflow-tooltip
-          width="120"
-        />
-        <el-table-column
-          label="瑙勬牸鍨嬪彿"
-          prop="specification"
-          show-overflow-tooltip
-          width="150"
-        />
-        <el-table-column
-          label="鍙戠エ鍙�"
-          prop="invoiceNo"
-          show-overflow-tooltip
-          width="180"
-        />
-        <el-table-column
-          label="鍙戠エ閲戦(鍏�)"
-          prop="invoiceTotal"
-          show-overflow-tooltip
-          :formatter="formattedNumber"
-          width="150"
-        />
-        <el-table-column
-          label="绋庣巼(%)"
-          prop="taxRate"
-          show-overflow-tooltip
-          width="100"
-        />
+        <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="noReceiptAmount"
+          prop="pendingInvoiceTotal"
           show-overflow-tooltip
-          width="150"
+          width="170"
         >
-          <template #default="{ row }">
+          <template #default="{ row, column }">
             <el-text type="danger">
-              {{ formattedNumber(row, null, row.noReceiptAmount) }}
+              {{ formattedNumber(row, column, row.pendingInvoiceTotal) }}
             </el-text>
           </template>
         </el-table-column>
         <el-table-column label="鏈鍥炴閲戦(鍏�)" width="180">
-          <template #default="scope">
+          <template #default="{ row }">
             <el-input-number
+              v-model="row.receiptPaymentAmount"
               :step="0.01"
               :min="0"
-              :max="scope.row.noReceiptAmount"
-              style="width: 100%"
+              :max="Number(row.pendingInvoiceTotal || 0)"
               :precision="2"
-              v-model="scope.row.receiptPaymentAmount"
+              style="width: 100%"
               placeholder="璇疯緭鍏�"
-              clearable
             />
           </template>
         </el-table-column>
-        <el-table-column label="鍥炴鏂瑰紡" width="150">
-          <template #default="scope">
-            <el-select
-              v-model="scope.row.receiptPaymentType"
-              placeholder="璇烽�夋嫨"
-              clearable
-              style="width: 100%"
-            >
+        <el-table-column label="鍥炴褰㈠紡" width="160">
+          <template #default="{ row }">
+            <el-select v-model="row.receiptPaymentType" placeholder="璇烽�夋嫨" clearable>
               <el-option
-                v-for="item in receipt_payment_type"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
+                v-for="opt in receipt_payment_type"
+                :key="opt.value"
+                :label="opt.label"
+                :value="opt.value"
               />
             </el-select>
           </template>
         </el-table-column>
-        <el-table-column label="鍥炴鏃ユ湡" width="180">
-          <template #default="scope">
+        <el-table-column label="鍥炴鏃ユ湡" width="170">
+          <template #default="{ row }">
             <el-date-picker
-              style="width: 100%"
-              v-model="scope.row.receiptPaymentDate"
+              v-model="row.receiptPaymentDate"
               value-format="YYYY-MM-DD"
               format="YYYY-MM-DD"
               type="date"
               placeholder="璇烽�夋嫨"
-              clearable
+              style="width: 100%"
             />
           </template>
         </el-table-column>
-        <el-table-column label="鐧昏浜�" width="120">
-          <template #default="scope">
-            <el-input
-              v-model="scope.row.registrant"
-              placeholder="鑷姩濉厖"
-              disabled
-            />
+        <el-table-column label="鐧昏浜�" width="140">
+          <template #default="{ row }">
+            <el-input v-model="row.registrant" />
           </template>
         </el-table-column>
       </el-table>
-      <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 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,
@@ -352,6 +306,7 @@
 const tableData = ref([]);
 const selectedRows = ref([]);
 const tableLoading = ref(false);
+const forms = ref([]);
 const page = reactive({
   current: 1,
   size: 100,
@@ -361,48 +316,20 @@
 
 // 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
 const dialogFormVisible = ref(false);
-const dialogTableData = ref([]);
 const data = reactive({
   searchForm: {
     searchText: "",
     status: true,
     customerName: "",
-  },
-  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 = '') => {
@@ -477,7 +404,7 @@
 const summarizeMainTable = (param) => {
   return proxy.summarizeTable(
     param,
-    ["invoiceTotal", "receiptPaymentAmountTotal", "noReceiptAmount"],
+    ["receiptPaymentAmountTotal", "noReceiptAmount"],
     {
       ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
       futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
@@ -490,97 +417,72 @@
 };
 // 鎵撳紑寮规
 const openForm = () => {
-  // 鑷冲皯閫夋嫨涓�鏉℃暟鎹�
   if (selectedRows.value.length === 0) {
-    proxy.$modal.msgError("璇烽�夋嫨鏁版嵁");
+    proxy.$modal.msgError("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
     return;
   }
-
-  // 鏍¢獙鏄惁涓虹浉鍚岄攢鍞悎鍚屽彿
-  const firstContractNo = selectedRows.value[0].salesContractNo;
-  const isSameContract = selectedRows.value.every(
-    (item) => item.salesContractNo === firstContractNo
-  );
-  if (!isSameContract) {
-    proxy.$modal.msgError("璇烽�夋嫨鐩稿悓閿�鍞悎鍚屽彿鐨勬暟鎹繘琛屽洖娆�");
-    return;
-  }
-
-  // 杩囨护鍑烘湁寰呭洖娆鹃噾棰濈殑璁板綍
-  const validRows = selectedRows.value.filter(
-    (item) => Number(item.noReceiptAmount) > 0
-  );
+  const validRows = selectedRows.value.filter((item) => item.noReceiptAmount !== 0);
   if (validRows.length === 0) {
-    proxy.$modal.msgWarning("鎵�閫夋暟鎹潎鏃犻渶鍐嶅洖娆�");
+    proxy.$modal.msgWarning("鎵�閫夎褰曞潎鏃犻渶鍥炴");
     return;
   }
-
-  // 鐩存帴浣跨敤澶栭儴琛ㄦ牸鏁版嵁锛屼负姣忔潯璁板綍娣诲姞鍥炴鐩稿叧瀛楁
-  dialogTableData.value = validRows.map((row) => {
-    return {
-      ...row,
-      invoiceLedgerId: row.id,
-      receiptPaymentAmount: row.noReceiptAmount || "",
-      receiptPaymentType: "",
-      receiptPaymentDate: "",
-      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: Number(row.pendingInvoiceTotal || 0),
+    receiptPaymentType: "",
+    registrant: userStore.nickName,
+    receiptPaymentDate: "",
+    invoiceLedgerId: row.id,
+    salesLedgerId: row.salesLedgerId,
+    salesLedgerProductId: row.id,
+  }));
   dialogFormVisible.value = true;
 };
 // 鎻愪氦琛ㄥ崟
 const submitForm = () => {
-  // 鏍¢獙琛ㄦ牸鏁版嵁
-  const invalidRows = dialogTableData.value.filter((row) => {
-    return (
-      !row.receiptPaymentAmount ||
-      row.receiptPaymentAmount <= 0 ||
-      !row.receiptPaymentType ||
-      !row.receiptPaymentDate
-    );
-  });
-
-  if (invalidRows.length > 0) {
-    proxy.$modal.msgError("璇峰畬鍠勬墍鏈夊繀濉」锛氬洖娆鹃噾棰濄�佸洖娆炬柟寮忋�佸洖娆炬棩鏈�");
+  if (forms.value.length === 0) {
+    proxy.$modal.msgError("璇烽�夋嫨鍥炴璁板綍");
     return;
   }
-
-  // 鏍¢獙鍥炴閲戦涓嶈兘瓒呰繃寰呭洖娆鹃噾棰�
-  const exceedRows = dialogTableData.value.filter((row) => {
-    return Number(row.receiptPaymentAmount) > Number(row.noReceiptAmount);
-  });
-
-  if (exceedRows.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;
+    }
   }
-
-  // 缁勫悎鎴愭暟缁勬壒閲忔彁浜�
-  const submitDataList = dialogTableData.value.map((row) => {
-    return {
-      invoiceLedgerId: row.invoiceLedgerId,
-      receiptPaymentAmount: row.receiptPaymentAmount,
-      receiptPaymentType: row.receiptPaymentType,
-      receiptPaymentDate: row.receiptPaymentDate,
-      registrant: row.registrant,
-    };
+  receiptPaymentSaveOrUpdate(forms.value).then(() => {
+    proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+    closeDia();
+    getList();
   });
-
-  receiptPaymentSaveOrUpdate(submitDataList)
-    .then(() => {
-      proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
-      closeDia();
-      getList();
-    })
-    .catch((error) => {
-      console.error("鎻愪氦澶辫触:", error);
-      proxy.$modal.msgError("鎻愪氦澶辫触锛岃閲嶈瘯");
-    });
 };
 // 鍏抽棴寮规
 const closeDia = () => {
-  dialogTableData.value = [];
+  forms.value = [];
   dialogFormVisible.value = false;
 };
 
@@ -621,7 +523,6 @@
     receiptPaymentType: row.receiptPaymentType,
     receiptPaymentAmount: row.receiptPaymentAmount,
   };
-  // 瀛愯〃缂栬緫淇濆瓨涔熸寜鏁扮粍鎻愪氦锛堜笌鎵归噺鏂板淇濇寔涓�鑷达級
   receiptPaymentSaveOrUpdate([updateData]).then((res) => {
     row.editType = !row.editType;
 		getList();
@@ -666,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