Эх сурвалжийг харах

revert: 回退应收应付对账异常来源(10/11)的预收确认式收付款逻辑,收款/付款弹窗恢复原明细勾选方式

lucw 5 өдөр өмнө
parent
commit
b99c19ff69

+ 7 - 32
src/BIZComponents/collectTableForm/index.vue

@@ -6,8 +6,8 @@
     <headerTitle :title="title"></headerTitle>
     <div style="margin: 10px 0; font-size: 14px; color: #606266">
       <span>{{ totalLabel }}:{{ totalPrice || 0 }} 元</span>
-      <span style="margin-left: 20px">{{ receivedLabel }}:{{ receivedAmount }} 元</span>
-      <span style="margin-left: 20px">{{ unreceivedLabel }}:{{ unreceivedAmount }} 元</span>
+      <span style="margin-left: 20px">已收金额:{{ receivedAmount }} 元</span>
+      <span style="margin-left: 20px">未收金额:{{ unreceivedAmount }} 元</span>
     </div>
 
     <el-button
@@ -37,7 +37,7 @@
             :prop="`tableData.${$index}.receivedDate`"
             :rules="{
               required: true,
-              message: '请选择' + dateLabel,
+              message: '请选择收款时间',
               trigger: 'change'
             }"
             class="table-form-item"
@@ -62,7 +62,7 @@
             :prop="`tableData.${$index}.receivedTotalPrice`"
             :rules="{
               required: true,
-              message: '请输入' + amountLabel,
+              message: '请输入已收金额',
               trigger: 'blur'
             }"
             class="table-form-item"
@@ -176,31 +176,6 @@
       dialogType: {
         type: String,
         default: 'update'
-      },
-      // 时间列标题(收款时间/付款时间)
-      dateLabel: {
-        type: String,
-        default: '收款时间'
-      },
-      // 金额列标题(已收金额/已付金额)
-      amountLabel: {
-        type: String,
-        default: '已收金额'
-      },
-      // 汇总区「已收金额」标签(应付场景传「已付金额」)
-      receivedLabel: {
-        type: String,
-        default: '已收金额'
-      },
-      // 汇总区「未收金额」标签(应付场景传「未付金额」)
-      unreceivedLabel: {
-        type: String,
-        default: '未收金额'
-      },
-      // 记录名称,用于「请至少添加一条xx」提示(收款记录/付款记录)
-      recordName: {
-        type: String,
-        default: '收款记录'
       }
     },
     data() {
@@ -226,7 +201,7 @@
           {
             prop: 'receivedDate',
             headerSlot: 'columnRequired',
-            label: this.dateLabel,
+            label: '收款时间',
             align: 'center',
             minWidth: 160,
             slot: 'receivedDate'
@@ -234,7 +209,7 @@
           {
             prop: 'receivedTotalPrice',
             headerSlot: 'columnRequired',
-            label: this.amountLabel,
+            label: '已收金额',
             align: 'center',
             minWidth: 140,
             slot: 'receivedTotalPrice'
@@ -317,7 +292,7 @@
             return;
           }
           if (this.form.tableData.length === 0) {
-            this.$message.warning('请至少添加一条' + this.recordName);
+            this.$message.warning('请至少添加一条收款记录');
             reject(false);
             return;
           }

+ 2 - 115
src/views/financialManage/payableManage/components/paymentDialog1.vue

@@ -11,26 +11,6 @@
     :maxable="true"
     :resizable="true"
   >
-    <!-- 对账异常来源(10/11):没有产品清单/对账明细,付款界面参考【预收管理-确收】按行录入付款信息 -->
-    <template v-if="isExceptionSource">
-      <div style="margin: 10px 0; font-size: 14px; color: #606266;">
-        <span>历史已付金额:{{ row.paidTotalPrice || 0 }} 元</span>
-        <span style="margin-left: 20px;">未付金额:{{ unpaidAmount }} 元</span>
-      </div>
-      <collect-table-form
-        ref="collectTableFormRef"
-        :form.sync="collectForm"
-        :total-price="selectedPayableAmount"
-        total-label="应付金额"
-        title="付款详情"
-        date-label="付款时间"
-        amount-label="已付金额"
-        received-label="已付金额"
-        unreceived-label="未付金额"
-        record-name="付款记录"
-      ></collect-table-form>
-    </template>
-    <template v-else>
     <div style="margin: 10px 0; font-size: 14px; color: #606266;">
       <span>应付金额:{{ selectedPayableAmount }} 元</span>
       <span style="margin-left: 20px;">本次付款金额:{{ paidAmount }} 元</span>
@@ -129,7 +109,6 @@
         </template>
       </ele-pro-table>
     </el-form>
-    </template>
 
     <div slot="footer">
       <el-button type="primary" @click="save()">保存</el-button>
@@ -141,12 +120,11 @@
 import { pricingWayList } from '@/enum/dict.js';
 import { finPayableSaveSingleDetailAPI, getFinPayableInfoAPI } from "@/api/financialManage/payableManage";
 import tabMixins from '@/mixins/tableColumnsMixin';
-import collectTableForm from '@/BIZComponents/collectTableForm/index.vue';
 
 export default {
   mixins: [tabMixins],
   name: "paymentDialog1",
-  components: { collectTableForm },
+  components: {},
   props: {
     paymentDialogFlag: {
       type: Boolean,
@@ -157,11 +135,6 @@ export default {
     isView() {
       return this.dialogType === 'view';
     },
-    // 来源类型为对账异常(10销售订单-对账异常 / 11采购订单-对账异常):
-    // 该类应付由异常处置自动生成,产品清单与对账明细允许为空,付款界面参考预收管理-确收录入
-    isExceptionSource() {
-      return [10, 11].includes(Number(this.sourceTypeValue));
-    },
     // 应付金额 = 接口下发的 row.payableTotalPrice
     selectedPayableAmount() {
       return this.row.payableTotalPrice || 0;
@@ -369,12 +342,6 @@ export default {
       title: '',
       loading: false,
       info: {},
-      // 来源类型(接口下发,兜底列表行):10/11 为对账异常来源
-      sourceTypeValue: '',
-      // 对账异常来源的付款记录表单(参考预收管理-确收)
-      collectForm: {
-        tableData: []
-      },
       form: {
         id: '',
         queryDimension: 1,
@@ -416,13 +383,6 @@ export default {
     // 获取详情
     async getInfo(id) {
       const data = await getFinPayableInfoAPI(id);
-      // 来源类型:接口下发优先,兜底列表行数据
-      this.sourceTypeValue =
-        data?.sourceType != null
-          ? data.sourceType
-          : this.row.sourceType != null
-          ? this.row.sourceType
-          : '';
       // 把接口返回的已付/未付金额回填到 row,供顶部汇总和表单展示
       this.row = {
         ...this.row,
@@ -438,23 +398,7 @@ export default {
         files: data?.files || [],
         remark: data?.remark || ''
       };
-      // 对账异常来源:没有产品清单/对账明细,按预收确认方式录入付款记录
-      if (this.isExceptionSource) {
-        this.datasource = [];
-        this.collectForm = {
-          tableData: [
-            {
-              receivedDate: '',
-              receivedTotalPrice: '',
-              paymentType: '',
-              files: [],
-              remark: ''
-            }
-          ]
-        };
-        return;
-      }
-      this.datasource = Array.isArray(data) ? data : data?.productList || [];
+      this.datasource = Array.isArray(data) ? data : (data?.productList || []);
     },
 
     // 构建单行派生字段
@@ -611,10 +555,6 @@ export default {
     },
 
     async save() {
-      // 对账异常来源:按【预收管理-确收】方式逐行保存付款记录(无产品明细)
-      if (this.isExceptionSource) {
-        return this.saveExceptionPayment();
-      }
       // 1. 校验付款信息表单
       const formValid = await new Promise((resolve) => {
         this.$refs.form.validate((valid) => resolve(valid));
@@ -666,59 +606,6 @@ export default {
         });
     },
 
-    // 对账异常来源付款保存:参考【预收管理-确收】,按行录入付款时间/已付金额/支付类型/附件/备注
-    async saveExceptionPayment() {
-      const formRef = this.$refs.collectTableFormRef;
-      if (!formRef) {
-        return this.$message.warning('付款信息加载失败,请重新打开');
-      }
-      const valid = await formRef.validate().catch(() => false);
-      if (!valid) return;
-      const tableData = this.collectForm.tableData || [];
-      if (!tableData.length) {
-        return this.$message.warning('请至少添加一条付款记录');
-      }
-      // 本次付款金额合计不能大于历史未付金额(用「分」做整数比较,避开浮点精度)
-      const totalAmount = tableData.reduce(
-        (pre, item) => pre + (+item.receivedTotalPrice || 0),
-        0
-      );
-      const totalCents = Math.round(totalAmount * 100);
-      const unpaidCents = Math.round((+this.unpaidAmount || 0) * 100);
-      if (totalCents > unpaidCents) {
-        return this.$message.warning(
-          `本次付款金额之和(${totalAmount.toFixed(2)} 元)不能大于未付金额(${this.unpaidAmount} 元)`
-        );
-      }
-      this.loading = true;
-      try {
-        // 逐条提交,避免并发重算应付已付/未付金额互相覆盖
-        for (const item of tableData) {
-          await finPayableSaveSingleDetailAPI({
-            payableId: this.row.id,
-            payableCode: this.row.code,
-            paidDate: item.receivedDate,
-            paidTotalPrice: +item.receivedTotalPrice || 0,
-            paymentType:
-              item.paymentType === '' || item.paymentType == null
-                ? null
-                : Number(item.paymentType),
-            files: item.files || [],
-            remark: item.remark || '',
-            // 对账异常来源应付没有产品清单
-            productList: []
-          });
-        }
-        this.$message.success('付款成功');
-        this.cancel();
-        this.done();
-      } catch (error) {
-        // 错误提示已由请求拦截器统一处理
-      } finally {
-        this.loading = false;
-      }
-    },
-
     // 刷新主列表数据
     done() {
       this.$emit('reload');

+ 1 - 110
src/views/financialManage/receivableManage/components/collectionDialog.vue

@@ -11,20 +11,6 @@
     :maxable="true"
     :resizable="true"
   >
-    <!-- 对账异常来源(10/11):没有产品清单/对账明细,收款界面参考【预收管理-确收】按行录入收款信息 -->
-    <template v-if="isExceptionSource">
-      <div style="margin: 10px 0; font-size: 14px; color: #606266;">
-        <span>历史已收金额:{{ row.receivedTotalPrice || 0 }} 元</span>
-        <span style="margin-left: 20px;">未收金额:{{ unreceivedAmount }} 元</span>
-      </div>
-      <collect-table-form
-        ref="collectTableFormRef"
-        :form.sync="collectForm"
-        :total-price="selectedReceivableAmount"
-        total-label="应收金额"
-      ></collect-table-form>
-    </template>
-    <template v-else>
     <div style="margin: 10px 0; font-size: 14px; color: #606266;">
       <span>应收金额:{{ selectedReceivableAmount }} 元</span>
       <span style="margin-left: 20px;">本次收款金额:{{ receivedAmount }} 元</span>
@@ -123,7 +109,6 @@
         </template>
       </ele-pro-table>
     </el-form>
-    </template>
 
     <div slot="footer">
       <el-button type="primary" @click="save()">保存</el-button>
@@ -135,12 +120,11 @@
 import { pricingWayList } from '@/enum/dict.js';
 import { finReceivableSaveAPI, getProductListForReceiptAPI } from "@/api/financialManage/receivableManage";
 import tabMixins from '@/mixins/tableColumnsMixin';
-import collectTableForm from '@/BIZComponents/collectTableForm/index.vue';
 
 export default {
   mixins: [tabMixins],
   name: "collectionDialog",
-  components: { collectTableForm },
+  components: {},
   props: {
     collectionDialogFlag: {
       type: Boolean,
@@ -161,11 +145,6 @@ export default {
     isView() {
       return this.dialogType === 'view';
     },
-    // 来源类型为对账异常(10销售订单-对账异常 / 11采购订单-对账异常):
-    // 该类应收由异常处置自动生成,产品清单与对账明细允许为空,收款界面参考预收管理-确收录入
-    isExceptionSource() {
-      return [10, 11].includes(Number(this.sourceTypeValue));
-    },
     // 应收金额 = 接口下发的 row.receivableTotalPrice
     selectedReceivableAmount() {
       return this.row.receivableTotalPrice || 0;
@@ -373,12 +352,6 @@ export default {
       title: '',
       loading: false,
       info: {},
-      // 来源类型(接口下发,兜底列表行):10/11 为对账异常来源
-      sourceTypeValue: '',
-      // 对账异常来源的收款记录表单(参考预收管理-确收)
-      collectForm: {
-        tableData: []
-      },
       form: {
         id: '',
         queryDimension: 1,
@@ -420,13 +393,6 @@ export default {
     // 获取详情(收款专用接口:仅返回产品列表,不带表单主信息)
     async getInfo(id) {
       const data = await getProductListForReceiptAPI(id);
-      // 来源类型:接口下发优先,兜底列表行数据
-      this.sourceTypeValue =
-        data?.sourceType != null
-          ? data.sourceType
-          : this.row.sourceType != null
-          ? this.row.sourceType
-          : '';
       // 把接口返回的已收/未收金额回填到 row,供顶部汇总和表单展示
       this.row = {
         ...this.row,
@@ -442,22 +408,6 @@ export default {
         files: data?.files || [],
         remark: data?.remark || ''
       };
-      // 对账异常来源:没有产品清单/对账明细,按预收确认方式录入收款记录
-      if (this.isExceptionSource) {
-        this.datasource = [];
-        this.collectForm = {
-          tableData: [
-            {
-              receivedDate: '',
-              receivedTotalPrice: '',
-              paymentType: '',
-              files: [],
-              remark: ''
-            }
-          ]
-        };
-        return;
-      }
       this.datasource = Array.isArray(data) ? data : data.productList || [];
       // 明细为空(没有对账明细)时无法勾选收款行,直接拦掉
       if (!this.datasource.length) {
@@ -570,10 +520,6 @@ export default {
     },
 
     async save() {
-      // 对账异常来源:按【预收管理-确收】方式逐行保存收款记录(无产品明细)
-      if (this.isExceptionSource) {
-        return this.saveExceptionCollection();
-      }
       // 1. 校验收款信息表单
       const formValid = await new Promise((resolve) => {
         this.$refs.form.validate((valid) => resolve(valid));
@@ -622,61 +568,6 @@ export default {
         });
     },
 
-    // 对账异常来源收款保存:参考【预收管理-确收】,按行录入收款时间/已收金额/支付类型/附件/备注
-    async saveExceptionCollection() {
-      const formRef = this.$refs.collectTableFormRef;
-      if (!formRef) {
-        return this.$message.warning('收款信息加载失败,请重新打开');
-      }
-      const valid = await formRef.validate().catch(() => false);
-      if (!valid) return;
-      const tableData = this.collectForm.tableData || [];
-      if (!tableData.length) {
-        return this.$message.warning('请至少添加一条收款记录');
-      }
-      // 本次收款金额合计不能大于历史未收金额(用「分」做整数比较,避开浮点精度)
-      const totalAmount = tableData.reduce(
-        (pre, item) => pre + (+item.receivedTotalPrice || 0),
-        0
-      );
-      const totalCents = Math.round(totalAmount * 100);
-      const unreceiveCents = Math.round((+this.unreceivedAmount || 0) * 100);
-      if (totalCents > unreceiveCents) {
-        return this.$message.warning(
-          `本次收款金额之和(${totalAmount.toFixed(2)} 元)不能大于未收金额(${
-            this.unreceivedAmount
-          } 元)`
-        );
-      }
-      this.loading = true;
-      try {
-        // 逐条提交,避免并发重算应收已收/未收金额互相覆盖
-        for (const item of tableData) {
-          await finReceivableSaveAPI({
-            receivableId: this.row.id,
-            receivableCode: this.row.code,
-            receivedDate: item.receivedDate,
-            receivedTotalPrice: +item.receivedTotalPrice || 0,
-            paymentType:
-              item.paymentType === '' || item.paymentType == null
-                ? null
-                : Number(item.paymentType),
-            files: item.files || [],
-            remark: item.remark || '',
-            // 对账异常来源应收没有产品清单
-            productList: []
-          });
-        }
-        this.$message.success('收款成功');
-        this.cancel();
-        this.done();
-      } catch (error) {
-        // 错误提示已由请求拦截器统一处理
-      } finally {
-        this.loading = false;
-      }
-    },
-
     // 刷新主列表数据
     done() {
       this.$emit('reload');