Forráskód Böngészése

销售对账单功能

liujt 2 hónapja
szülő
commit
fc284a8f38

+ 2 - 1
src/views/financialManage/advanceReceipt/components/receiveTermsDialog.vue

@@ -7,7 +7,7 @@
     :append-to-body="true"
     :close-on-click-modal="false"
     custom-class="ele-dialog-form"
-    title="收款条件"
+    :title="conditionType == 'rules' ? '收款条件' : '付款条件'"
     @update:visible="updateVisible"
   >
     <ele-pro-table
@@ -81,6 +81,7 @@
             type: Boolean,
             default: false
         },
+        // 收/付款条件类型 rules:收款条件 terms:付款条件
         conditionType: {
             type: String,
             default: ''

+ 2 - 2
src/views/purchasingManage/purchaseOrder/accountstatement/components/purchaseForm.vue

@@ -20,7 +20,7 @@
           >
             <el-option label="供应商" :value="1" />
             <!-- <el-option label="项目" :value="2"/> -->
-            <el-option label="合同" :value="4" />
+            <!-- <el-option label="合同" :value="4" /> -->
 
             <el-option label="采购订单" :value="3" />
           </el-select>
@@ -191,7 +191,7 @@
     </el-row>
     <el-row>
       <el-col :span="8">
-        <el-form-item prop="accountStatementPrice" label="对账金额">
+        <el-form-item prop="accountStatementPrice" label="本次总对账金额">
           <el-input disabled v-model="accountStatementPrice"></el-input>
         </el-form-item>
       </el-col>

+ 86 - 22
src/views/purchasingManage/purchaseOrder/components/addDialogNew.vue

@@ -253,11 +253,26 @@
             >
             </el-date-picker>
           </el-form-item>
+          <el-form-item label="付款条件" prop="collectionConditionName">
+            <el-input
+              clearable
+              readonly
+              v-model="form.collectionConditionName"
+              @click.native="handlePaymentConditionBtn"
+              placeholder="请输入"
+            />
+          </el-form-item>
           <el-form-item prop="orderFiles" label="附件">
             <fileMain v-model="form.orderFiles"></fileMain>
           </el-form-item>
         </el-col>
         <el-col :span="8">
+          <el-form-item label="生成付款计划表" prop="isGenerateReceiptPlan">
+            <el-radio-group v-model="form.isGenerateReceiptPlan" @change="generatePlanChange">
+              <el-radio :label="1">是</el-radio>
+              <el-radio :label="0">否</el-radio>
+            </el-radio-group>
+          </el-form-item>
           <el-form-item label="交易方式" prop="transactionMode">
             <el-select
               v-model="form.transactionMode"
@@ -350,6 +365,7 @@
             </el-input>
           </el-form-item>
           <el-form-item
+             v-if="form.isGenerateReceiptPlan != 0"
             label="期数"
             prop="issueNumber"
           >
@@ -600,17 +616,18 @@
           </el-form-item>
         </el-col>
       </el-row>
-
-      <headerTitle
-        title="付款计划"
-        style="margin-top: 30px"
-      ></headerTitle>
-      <PaymentCollectionPlan
-        ref="paymentCollectionPlanRef"
-        menu="purchase"
-        :info="form"
-        @getIssueNumber="setIssueNumber"
-      ></PaymentCollectionPlan>
+      <div v-if="form.isGenerateReceiptPlan != 0">
+        <headerTitle
+          title="付款计划"
+          style="margin-top: 30px"
+        ></headerTitle>
+        <PaymentCollectionPlan
+          ref="paymentCollectionPlanRef"
+          menu="purchase"
+          :info="form"
+          @getIssueNumber="setIssueNumber"
+        ></PaymentCollectionPlan>
+      </div>
 
     </el-form>
 
@@ -709,6 +726,9 @@
       @changeParent="changeHistoryOrder"
     ></orderListDialog>
 
+    <!-- 付款条件 -->
+    <receiveTermsDialog ref="receiveTermsDialogRef" conditionType="terms" @changeParent="changeReceiveTerms"></receiveTermsDialog>
+
     <ele-modal
       custom-class="ele-dialog-form long-dialog-form"
       :visible.sync="supplierListShow"
@@ -800,7 +820,7 @@
   import { formatPrice } from '@/BIZComponents/setProduct.js';
   import { parameterGetByCode } from '@/api/main/index.js';
   import orderListDialog from '@/views/purchasingManage/purchaseOrder/invoice/components/orderListDialog.vue';
-
+  import receiveTermsDialog from '@/views/financialManage/advanceReceipt/components/receiveTermsDialog.vue'
   export default {
     mixins: [dictMixins],
     props: {
@@ -829,7 +849,8 @@
       returnOrderDealDialog,
       purchaseReturnOrderDialog,
       PaymentCollectionPlan,
-      orderListDialog
+      orderListDialog,
+      receiveTermsDialog
     },
     data() {
       let formDef = {
@@ -851,6 +872,7 @@
         saleType: '',
         saleTypeName: '',
         totalAmount: '',
+        isGenerateReceiptPlan: 0,
         settlementMode: '4',
         settlementModeName: '分期付款',
         partaUnifiedSocialCreditCode: '',
@@ -945,7 +967,8 @@
         shippingModePurchaseOp,
         transactionMethodsOp,
         defaultTransactionMode: 1,
-        isBatchNo: 0
+        isBatchNo: 0,
+        isGenReceiptPlan: 1
       };
     },
     computed: {
@@ -1069,8 +1092,37 @@
       }).then((res) => {
         this.isBatchNo = res.value;
       });
+
+      // 是否生成收款计划单默认配置//0否 1是
+      parameterGetByCode({
+        code: 'sale_order_gen_receipt_plan'
+      }).then((res) => {
+        this.isGenReceiptPlan = res.value;
+        console.log('isGenReceiptPlan', this.isGenReceiptPlan);
+      });
     },
     methods: {
+      changeReceiveTerms(row, index) {
+        console.log('changeReceiveTerms~~~', row)
+        this.form.collectionConditionId = row.id;
+        this.form.collectionConditionName = row.name;
+        console.log('changeReceiveTerms!!!', this.form)
+        this.$forceUpdate()
+      },
+      handlePaymentConditionBtn() {
+        this.$refs.receiveTermsDialogRef.open();
+      },
+      generatePlanChange(val) {
+        console.log(val)
+        if(val == 0) {
+ 
+        } else {
+          this.issueNumberChange(this.form.issueNumber);
+          // this.$refs.paymentCollectionPlanRef?.setDiscountAmount(
+          //   this.form.payAmount
+          // );
+        }
+      },
       orderListShow() {
         if (!this.form.partbName) {
           this.$message.warning('请先选择供应商');
@@ -2119,6 +2171,7 @@
             })
           }
           this.form.contractStartDate = formatDate(new Date(), 'yyyy-MM-dd');
+          this.form.isGenerateReceiptPlan = +this.isGenReceiptPlan;
         } else {
           this.isUpdate = true;
           await this.getpurchaseorderDetail(row.id);
@@ -2195,7 +2248,8 @@
       },
 
       getValidate() {
-        return Promise.all([
+
+        const arr = [
           new Promise((resolve, reject) => {
             this.$refs.form.validate((valid) => {
               if (!valid) {
@@ -2214,7 +2268,10 @@
               }
             });
           }),
-          new Promise((resolve, reject) => {
+        ]
+
+        if(this.form.isGenerateReceiptPlan != 0) {
+          arr.push(new Promise((resolve, reject) => {
             this.$refs.paymentCollectionPlanRef.validateForm((valid) => {
               if (!valid) {
                 reject(false);
@@ -2222,8 +2279,9 @@
                 resolve(true);
               }
             });
-          })
-        ]);
+          }))
+        }  
+        return Promise.all(arr);
       },
       async save(type) {
         let is = false;
@@ -2315,12 +2373,15 @@
             sourceTypeName: this.requirementSourceType.find(
               (val) => val.value == this.form.sourceType
             )?.label,
-            receiptPaymentList: this.$refs?.paymentCollectionPlanRef?.getTableValue() || [],
+            receiptPaymentList: this.form.isGenerateReceiptPlan == 0 ? [] : 
+              this.$refs?.paymentCollectionPlanRef?.getTableValue() || [],
             endSettlementDate: this.form.settlementDate?.length ? this.form.settlementDate[1] : '',
             startSettlementDate: this.form.settlementDate?.length ? this.form.settlementDate[0] : ''
           });
 
-          const ratioSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.ratio, 0);
+
+          if(this.form.isGenerateReceiptPlan != 0) {
+            const ratioSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.ratio, 0);
           // if(+ratioSum != 100){
           //   this.$message.error('比例合计必须为100%');
           //   return;
@@ -2330,10 +2391,13 @@
               this.$message.error('比例合计不能超过100%');
               return;
             }
+          }
+
+          
 
           // 使用万分之一进行计算,避免浮点数精度问题(对应4位小数)
-          let receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 10000), 0) / 10000;
-          const payAmount = +commitData.payAmount;
+          // let receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 10000), 0) / 10000;
+          // const payAmount = +commitData.payAmount;
           
           // if(+ratioSum == 100) {
           //   // 使用万分之一进行计算,避免浮点数精度问题

+ 34 - 23
src/views/purchasingManage/purchaseOrder/components/detailDialog.vue

@@ -158,7 +158,9 @@
             <el-form-item label="订单类型:" prop="sourceTypeName">
               <el-input v-model="form.sourceTypeName" disabled></el-input>
             </el-form-item>
-
+            <el-form-item label="付款条件:" prop="collectionConditionName">
+              <el-input v-model="form.collectionConditionName" disabled></el-input>
+            </el-form-item>
             <el-form-item label="交易方式" prop="transactionMode">
             <el-select
               v-model="form.transactionMode"
@@ -234,6 +236,7 @@
               </el-input>
             </el-form-item>
             <el-form-item
+              v-if="form.isGenerateReceiptPlan != 0"
               label="期数"
               prop="issueNumber"
             >
@@ -307,21 +310,27 @@
               <el-input v-model="form.returnTotalCount" disabled />
             </el-form-item>
             <el-form-item label="收货模式" prop="deliveryMode">
-            <el-select
-              v-model="form.deliveryMode"
-              placeholder="请选择"
-              style="width: 100%"
-              disabled
-            >
-              <el-option
-                v-for="item in shippingModePurchaseOp"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
+              <el-select
+                v-model="form.deliveryMode"
+                placeholder="请选择"
+                style="width: 100%"
+                disabled
               >
-              </el-option>
-            </el-select>
-          </el-form-item>
+                <el-option
+                  v-for="item in shippingModePurchaseOp"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="生成付款计划表" prop="isGenerateReceiptPlan">
+              <el-radio-group v-model="form.isGenerateReceiptPlan" @change="generatePlanChange">
+                <el-radio :label="1">是</el-radio>
+                <el-radio :label="0">否</el-radio>
+              </el-radio-group>
+            </el-form-item>
           </el-col>
         </el-row>
         <headerTitle title="基本信息"></headerTitle>
@@ -515,15 +524,17 @@
           </ele-pro-table>
         </el-tab-pane>
       </el-tabs>
-      <headerTitle
-        title="付款计划"
-        style="margin-top: 30px"
-      ></headerTitle>
-      <PaymentCollectionPlan
-        ref="paymentCollectionPlanRef"
-        menu="purchase"
-        type="view"
+      <div v-if="form.isGenerateReceiptPlan != 0">
+        <headerTitle
+          title="付款计划"
+          style="margin-top: 30px"
+        ></headerTitle>
+        <PaymentCollectionPlan
+          ref="paymentCollectionPlanRef"
+          menu="purchase"
+          type="view"
       ></PaymentCollectionPlan>
+      </div>
     </div>
     <bpmDetail
       v-if="activeComp === 'bpm' && form.processInstanceId"

+ 125 - 53
src/views/saleManage/saleOrder/accountstatement/components/accountDetailTable.vue

@@ -62,6 +62,15 @@
           </el-form-item>
         </template>
 
+        <template v-slot:technologyRouteName="scope">
+          <el-input
+            v-model="scope.row.technologyRouteName"
+            placeholder="请选择"
+            :disabled="isView"
+            @click.native="openVersion(scope.$index)"
+          />
+        </template>
+
         <template v-slot:singlePrice="scope">
           <el-form-item
             :prop="'flatList.' + scope.$index + '.singlePrice'"
@@ -77,9 +86,9 @@
               :disabled="isView"
               @input="handlePriceChange(scope.row, scope.$index)"
             />
-            <div v-if="isPriceInvalid(scope.row)" class="price-warning">
+            <!-- <div v-if="isPriceInvalid(scope.row)" class="price-warning">
               单价无效,请核对商品价格
-            </div>
+            </div> -->
           </el-form-item>
         </template>
 
@@ -160,15 +169,25 @@
         <el-button type="primary" @click="confirmBatchSet">确定</el-button>
       </div>
     </el-dialog>
+
+    <!-- 工艺路线选择弹窗 -->
+    <ProductionVersion
+      ref="versionRefs"
+      @changeProduct="changeProduct"
+    ></ProductionVersion>
   </div>
 </template>
 
 <script>
   import { parameterGetByCode } from '@/api/main/index.js';
   import { pricingWayList } from '@/enum/dict.js';
+  import ProductionVersion from '@/components/ProductionVersion2/index.vue';
 
   export default {
     name: 'accountDetailTable',
+    components: {
+      ProductionVersion
+    },
     props: {
       datasource: {
         type: Array,
@@ -289,6 +308,7 @@
             prop: 'technologyRouteName',
             label: '工艺路线',
             align: 'center',
+            slot: 'technologyRouteName',
             showOverflowTooltip: true
           },
           {
@@ -319,6 +339,7 @@
           },
           {
             minWidth: 120,
+            headerSlot: 'headerRequired',
             prop: 'discountRatio',
             label: '折让比例',
             align: 'center',
@@ -398,9 +419,9 @@
       datasource: {
         handler(newVal, oldVal) {
           this.$nextTick(() => {
-            // this.initDefaultValues();
-            // this.buildFlatList();
-            this.flatList = newVal;
+            // 直接基于原始 productList 扁平行初始化派生字段(单价/税率/折让比例默认值及本次对账金额)
+            const list = (newVal || []).map((item) => this.buildRow(item, item.orderNo || '', false));
+            this.flatList = list;
             console.log(this.flatList)
             this.calcTotals();
           });
@@ -436,7 +457,9 @@
         }
         const singlePrice = +item.singlePrice || 0;
         const discountRatio =
-          item.discountRatio === undefined || item.discountRatio === null
+          item.discountRatio === undefined ||
+          item.discountRatio === null ||
+          item.discountRatio === ''
             ? 100
             : +item.discountRatio;
         const taxRate =
@@ -447,8 +470,17 @@
           Math.round(
             statementCount * singlePrice * (discountRatio / 100) * 100
           ) / 100;
+        const noTaxSinglePrice =
+          singlePrice && taxRate
+            ? +((singlePrice / (1 + taxRate / 100)).toFixed(4))
+            : '';
+        const totalPrice = Math.round(statementCount * singlePrice * 100) / 100;
+        const discountSinglePrice =
+          Math.round(singlePrice * (discountRatio / 100) * 100) / 100;
+        const discountTotalPrice =
+          Math.round(totalPrice * (discountRatio / 100) * 100) / 100;
         // 直接修改原 item,保证编辑同步回 datasource
-        this.$set(item, 'id', item.id || Math.random().toString(36).slice(2));
+        // this.$set(item, 'id', item.id || Math.random().toString(36).slice(2));
         this.$set(item, 'saleOrderNo', orderNo);
         this.$set(
           item,
@@ -467,26 +499,21 @@
         this.$set(item, 'taxRate', taxRate);
         this.$set(item, 'discountRatio', discountRatio);
         this.$set(item, 'statementAmount', amount);
+        this.$set(item, 'noTaxSinglePrice', noTaxSinglePrice);
+        this.$set(item, 'totalPrice', totalPrice);
+        this.$set(item, 'discountSinglePrice', discountSinglePrice);
+        this.$set(item, 'discountTotalPrice', discountTotalPrice);
         this.$set(item, 'isReturn', isReturn);
         this.$set(item, 'processRouteName', item.processRouteName || '');
         return item;
       },
       initDefaultValues() {
-        this.datasource.forEach((order) => {
-          (order.deliveryProducts || []).forEach((item) => {
-            if (item.singlePrice === undefined)
-              this.$set(item, 'singlePrice', 0);
-            if (item.taxRate === undefined) this.$set(item, 'taxRate', 0);
-            if (item.discountRatio === undefined)
-              this.$set(item, 'discountRatio', 100);
-          });
-          (order.returnProducts || []).forEach((item) => {
+        this.datasource.forEach((item) => {
             if (item.singlePrice === undefined)
               this.$set(item, 'singlePrice', 0);
             if (item.taxRate === undefined) this.$set(item, 'taxRate', 0);
             if (item.discountRatio === undefined)
               this.$set(item, 'discountRatio', 100);
-          });
         });
       },
       buildFlatList() {
@@ -516,14 +543,61 @@
         this.totalStatementCount = count;
         this.$emit('totalChange', amount);
         this.$emit('countChange', count);
+        // 按销售订单编码(saleOrderNo)汇总本次对账金额,供应收信息同步
+        this.emitStatementAmountChange();
+      },
+      // 按销售订单编码汇总本次对账金额并抛出
+      emitStatementAmountChange() {
+        const summaryMap = {};
+        this.flatList.forEach((row) => {
+          const key = row.saleOrderNo;
+          if (!key) return;
+          summaryMap[key] =
+            Math.round(
+              ((summaryMap[key] || 0) + (+row.statementAmount || 0)) * 100
+            ) / 100;
+        });
+        this.$emit('statementAmountChange', summaryMap);
       },
-      // 重算某一行金额
+      // 重算某一行金额(参考 inventoryTable.vue 价格计算链)
       calcRow(row) {
         const count = +row.statementCount || 0;
         const price = +row.singlePrice || 0;
-        const ratio = +row.discountRatio || 0;
+        // 折让比例未填写时按 100(不打折)计,避免金额被算成 0
+        const ratio = row.discountRatio === '' ||
+          row.discountRatio === null ||
+          row.discountRatio === undefined ||
+          isNaN(+row.discountRatio)
+          ? 100
+          : +row.discountRatio;
+        const taxRate = +row.taxRate || 0;
+        // 本次对账金额
         const amount = Math.round(count * price * (ratio / 100) * 100) / 100;
         this.$set(row, 'statementAmount', amount);
+        // 不含税单价 = 单价 / (1 + 税率/100)  (与 inventoryTable.getNotaxSinglePrice 一致)
+        if (price && taxRate) {
+          this.$set(
+            row,
+            'noTaxSinglePrice',
+            +((price / (1 + taxRate / 100)).toFixed(4))
+          );
+        } else {
+          this.$set(row, 'noTaxSinglePrice', '');
+        }
+        // 合计 = 对账数量 * 单价
+        this.$set(row, 'totalPrice', Math.round(count * price * 100) / 100);
+        // 折让单价 = 单价 * 折让比例/100
+        this.$set(
+          row,
+          'discountSinglePrice',
+          Math.round(price * (ratio / 100) * 100) / 100
+        );
+        // 折让合计 = 合计 * 折让比例/100
+        this.$set(
+          row,
+          'discountTotalPrice',
+          Math.round(row.totalPrice * (ratio / 100) * 100) / 100
+        );
       },
       handleCountChange(row, index) {
         this.calcRow(row);
@@ -536,6 +610,9 @@
         this.emitChange();
       },
       handleTaxChange(row, index) {
+        // 税率变化需重算不含税单价、合计及折让相关字段
+        this.calcRow(row);
+        this.calcTotals();
         this.emitChange();
       },
       handleDiscountChange(row, index) {
@@ -544,7 +621,8 @@
         this.emitChange();
       },
       emitChange() {
-        this.$emit('update:datasource', [...this.datasource]);
+        // 表格实际编辑的是 flatList,直接以其为新数据源回写父组件
+        this.$emit('update:datasource', [...this.flatList]);
       },
       // 单价校验:单价缺失或为 0 视为无效(需结合商品价目表有效期进一步校验)
       isPriceInvalid(row) {
@@ -562,31 +640,6 @@
           callback();
         }
       },
-      removeRow(index) {
-        // 调拨单模式下允许删除行(实际应根据业务规则限制)
-        const list = [...this.flatList];
-        list.splice(index, 1);
-        this.$emit('update:datasource', this.rebuildDatasource(list));
-      },
-      rebuildDatasource(flatList) {
-        const group = {};
-        flatList.forEach((row) => {
-          const key = row.saleOrderNo || '_default';
-          if (!group[key]) {
-            group[key] = {
-              orderNo: row.saleOrderNo,
-              deliveryProducts: [],
-              returnProducts: []
-            };
-          }
-          if (row.isReturn) {
-            group[key].returnProducts.push(row);
-          } else {
-            group[key].deliveryProducts.push(row);
-          }
-        });
-        return Object.values(group);
-      },
       // 批量设置
       batchSetTaxRate() {
         this.batchType = 'taxRate';
@@ -607,18 +660,24 @@
         this.batchDialogVisible = true;
       },
       confirmBatchSet() {
-        this.datasource.forEach((order) => {
-          (order.deliveryProducts || []).forEach((item) => {
-            this.$set(item, this.batchType, +this.batchValue);
-          });
-          (order.returnProducts || []).forEach((item) => {
-            this.$set(item, this.batchType, +this.batchValue);
-          });
+        // flatList 为表格实际渲染的扁平行数据,直接逐行设置并重新计算
+        this.flatList.forEach((item) => {
+          this.$set(item, this.batchType, +this.batchValue);
+          this.calcRow(item);
         });
-        this.initDefaultValues();
+        this.calcTotals();
         this.batchDialogVisible = false;
         this.emitChange();
       },
+      removeRow(index) {
+        // 调拨单模式下允许删除行,基于扁平行数组操作,保持数据格式一致
+        if (index < 0 || index >= this.flatList.length) return;
+        const list = [...this.flatList];
+        list.splice(index, 1);
+        this.flatList = list;
+        this.calcTotals();
+        this.emitChange();
+      },
       getValidForm() {
         return new Promise((resolve, reject) => {
           this.$refs.detailForm.validate((valid) => {
@@ -629,6 +688,19 @@
             }
           });
         });
+      },
+      // 打开工艺路线选择弹窗(参考 inventoryTable.openVersion)
+      openVersion(index) {
+        this.$refs.versionRefs.open(index);
+      },
+      // 工艺路线选择回调(参考 inventoryTable.changeProduct)
+      changeProduct(data, index) {
+        if (this.flatList[index]) {
+          this.$set(this.flatList[index], 'technologyRouteName', data.name);
+          this.$set(this.flatList[index], 'technologyRouteId', data.id);
+          this.$set(this.flatList[index], 'technologyRouteVersion', data.version);
+          this.emitChange();
+        }
       }
     }
   };

+ 45 - 160
src/views/saleManage/saleOrder/accountstatement/components/addAccountDialog.vue

@@ -25,35 +25,13 @@
       <headerTitle title="应收信息" style="margin-top: 30px"></headerTitle>
       <receivable-info
         :dataForm.sync="dataForm"
-        :receivableList.sync="receivableList"
+        :receivableList="receivableList"
         :dialogType="dialogType"
         @addAdvanceReceipt="addAdvanceReceipt"
         ref="receivableInfoRef"
       ></receivable-info>
 
-      <headerTitle title="对账明细" style="margin-top: 30px">
-        <!-- <template v-slot>
-          <el-row style="font-weight: 700; color: red">
-            <span>订单总金额:</span>
-            <span>{{ isNonDirectionalSale ? '--' : dataForm.orderTotalAmount || 0 }}</span>
-            <el-divider direction="vertical"></el-divider>
-            <span>已对账金额:</span>
-            <span>{{ dataForm.amountCompletePrice || 0 }}</span>
-            <el-divider direction="vertical"></el-divider>
-            <span>未对账金额:</span>
-            <span>{{ dataForm.amountUnCompletePrice || 0 }}</span>
-            <el-divider direction="vertical"></el-divider>
-            <span>本次对账总金额:</span>
-            <span>{{ dataForm.amountTotalPrice || 0 }}</span>
-          </el-row>
-        </template> -->
-      </headerTitle>
-      <!-- <recorpayTableList
-        ref="recorpayListRef"
-        :dataForm="dataForm"
-        :recorpayList.sync="recorpayList"
-        :dialogType="dialogType"
-      ></recorpayTableList> -->
+      <headerTitle title="对账明细" style="margin-top: 30px"></headerTitle>
       <account-detail-table
         ref="accountDetailTableRef"
         :datasource.sync="datasource"
@@ -61,13 +39,9 @@
         :queryDimension="dataForm.queryDimension"
         @totalChange="handleTotalChange"
         @countChange="handleCountChange"
+        @statementAmountChange="handleStatementAmountChange"
       ></account-detail-table>
     </div>
-    <advance-receipt-select-dialog
-      ref="advanceReceiptSelectRef"
-      :contactId="dataForm.contactId"
-      @changeParent="onAdvanceReceiptSelected"
-    ></advance-receipt-select-dialog>
     <div slot="footer" class="footer">
       <el-button
         v-if="dialogType !== 'view'"
@@ -97,15 +71,11 @@
 <script>
   import AccountDetailTable from './accountDetailTable.vue';
   import ReceivableInfo from './receivableInfo.vue';
-  import AdvanceReceiptSelectDialog from './advanceReceiptSelectDialog.vue';
 
   import saleForm from './saleForm.vue';
   import {
     getStatementRecordSummaryAPI,
-    infoAccountStatementAPI,
-    saveAccountStatementAPI,
     createAccountStatementAPI,
-    updateAccountStatementAPI,
     accountstatementInfoAPI,
     accountstatementUpdateAPI
   } from '@/api/saleManage/accountstatement';
@@ -118,7 +88,6 @@
       processSubmitDialog,
       AccountDetailTable,
       ReceivableInfo,
-      AdvanceReceiptSelectDialog,
       saleForm
     },
     //客户管理数据
@@ -147,35 +116,23 @@
         loading: false,
         saveLoading: false,
         datasource: [],
-        recorpayList: [],
         receivableList: [],
+        statReceipt: null,
         dataForm: {
           sourceType: 1,
           dateType: 1,
           queryDimension: 1,
           dateValue: '',
-          contactId: '',
-          contactName: '',
-          sourceName: '',
-          sourceId: '',
-          type: '',
+          type: 1,
           year: '',
           quarter: '',
           month: '',
           dateTimeRange: [],
-          orderNo: '',
-          orderId: '',
           id: '',
           startDate: '',
           endDate: '',
-          repliedFiles: [],
-          // 应收信息字段
-          fundType: 2,
-          transactionMethod: 1,
-          collectionTerms: '',
-          receiptStatus: 0,
-          totalAdvanceConfirmAmount: 0,
-          totalReceivableAmount: 0
+          statReceipt: {},
+          productList: []
         },
         title: '',
         processSubmitDialogFlag: false,
@@ -195,13 +152,19 @@
       handleCountChange(count) {
         this.dataForm.totalStatementCount = count;
       },
+      // 明细表本次对账金额变化时,按销售单号同步到应收信息对应行
+      handleStatementAmountChange(summaryMap) {
+        if (this.$refs.receivableInfoRef) {
+          this.$refs.receivableInfoRef.syncStatementAmount(summaryMap);
+        }
+      },
       // 新增预收款:打开预收款选择弹窗
       addAdvanceReceipt() {
         this.$refs.advanceReceiptSelectRef.open();
       },
-      // 预收款选择器回调:将选中的预收款映射为应收信息行(字段对齐接口 statReceiptDetailList
+      // 预收款选择器回调:将选中的预收款映射为应收信息行,交给 receivableInfo 本地维护
       onAdvanceReceiptSelected(row) {
-        this.receivableList.push({
+        const receivableRow = {
           advanceId: row.id,
           advanceCode: row.advanceReceiptCode || '',
           salesCode: row.saleOrderNo || '',
@@ -213,7 +176,10 @@
           statementAdvanceConfirmAmount: 0,
           transactionMode: this.dataForm.transactionMethod || 1,
           currentReceivableAmount: 0
-        });
+        };
+        if (this.$refs.receivableInfoRef) {
+          this.$refs.receivableInfoRef.addReceivableRow(receivableRow);
+        }
       },
       fundTypeLabel(val) {
         const item = (this.paymentTypeOp || []).find((i) => i.value === val);
@@ -245,52 +211,15 @@
       async getInfo(row) {
         let data = await accountstatementInfoAPI(row.id);
         console.log('data~~~', data);
-        // this.recorpayList = data.recorpayList || [];
-        // 解决小数精度丢失问题,使用分进行计算
-        data.orderTotalAmount =
-          data.orderList.reduce(
-            (pre, cur) => pre + Math.round(+cur.orderAmount * 100),
-            0
-          ) / 100;
-        data.amountTotalPrice =
-          data.orderList.reduce(
-            (pre, cur) => pre + Math.round(+cur.statementAmount * 100),
-            0
-          ) / 100;
-        data.amountCompletePrice =
-          data.orderList.reduce(
-            (pre, cur) => pre + Math.round(+cur.statementedAmount * 100),
-            0
-          ) / 100;
-        data.amountUnCompletePrice =
-          data.orderList.reduce(
-            (pre, cur) => pre + Math.round(+cur.unStatementAmount * 100),
-            0
-          ) / 100;
-        // data.orderList = data.orderList.map((item) => {
-        //   item.deliveryProducts = item.deliveryProducts.map((i) => {
-        //     return {
-        //       ...i,
-        //       taxRate: i.taxRate || 0,
-        //       discountRatio: i.discountRatio || 100,
-        //       singlePrice: i.singlePrice || 0,
-        //       originalTotalCount: i.totalCount // 保存原始数量值用于校验
-        //     };
-        //   });
-        //   return item;
-        // });
+
         this.datasource = data.productList || [];
         this.receivableList =
           (data.statReceipt && data.statReceipt.statReceiptDetailList) || [];
+        // 保存查询到的完整 statReceipt 对象,作为提交入参
+        this.statReceipt = data.statReceipt || null;
         this.dataForm = {
           ...this.dataForm,
           ...data,
-          fundType: data.fundType || 2,
-          transactionMethod: data.transactionMethod || 1,
-          collectionTerms: data.collectionTerms || '',
-          receiptStatus: data.receiptStatus || 0,
-          totalAdvanceConfirmAmount: data.totalAdvanceConfirmAmount || 0,
-          totalReceivableAmount: data.totalReceivableAmount || 0
         };
 
         console.log('this.dataForm~~~', this.dataForm, this.receivableList);
@@ -343,63 +272,16 @@
           console.log(data, 'data');
           this.loading = false;
 
-          this.datasource = data.productList || [];
+        this.datasource = data.productList || [];
         this.receivableList =
           (data.statReceipt && data.statReceipt.statReceiptDetailList) || [];
+        // 保存查询到的完整 statReceipt 对象,作为提交入参
+        this.statReceipt = data.statReceipt || null;
         this.dataForm = {
           ...this.dataForm,
           ...data,
-          fundType: data.fundType || 2,
-          transactionMethod: data.transactionMethod || 1,
-          collectionTerms: data.collectionTerms || '',
-          receiptStatus: data.receiptStatus || 0,
-          totalAdvanceConfirmAmount: data.totalAdvanceConfirmAmount || 0,
-          totalReceivableAmount: data.totalReceivableAmount || 0
         }
-          // data = data.map((item) => {
-          //   item.deliveryProducts = item.deliveryProducts.map((i) => {
-          //     return {
-          //       ...i,
-          //       taxRate: i.taxRate || 0,
-          //       discountRatio: i.discountRatio || 100,
-          //       singlePrice: i.singlePrice || 0,
-          //       originalTotalCount: i.totalCount // 保存原始数量值用于校验
-          //     };
-          //   });
-          //   return item;
-          // });
-          // this.datasource = data || [];
 
-          // console.log(this.datasource, 'this.datasource~~~');
-          // this.recorpayList = data.recorpayList || [];
-          // this.dataForm = {
-          //   ...this.dataForm,
-          //   // amountPayablePrice: data.amountPayablePrice,
-          //   // amountReceivablePrice: data.amountReceivablePrice,
-          //   // amountTotalPrice: data.amountTotalPrice,
-          //   // amountPayablePass: data.amountPayablePass,
-          //   // amountReceivablePass: data.amountReceivablePass
-          //   orderTotalAmount:
-          //     data.reduce(
-          //       (pre, cur) => pre + Math.round(+cur.orderAmount * 100),
-          //       0
-          //     ) / 100,
-          //   amountTotalPrice:
-          //     data.reduce(
-          //       (pre, cur) => pre + Math.round(+cur.statementAmount * 100),
-          //       0
-          //     ) / 100,
-          //   amountCompletePrice:
-          //     data.reduce(
-          //       (pre, cur) => pre + Math.round(+cur.statementedAmount * 100),
-          //       0
-          //     ) / 100,
-          //   amountUnCompletePrice:
-          //     data.reduce(
-          //       (pre, cur) => pre + Math.round(+cur.unStatementAmount * 100),
-          //       0
-          //     ) / 100
-          // };
           this.$forceUpdate();
         } catch (error) {
           this.loading = false;
@@ -420,26 +302,29 @@
             this.dialogType == 'add'
               ? createAccountStatementAPI
               : accountstatementUpdateAPI;
-          const totalAdvanceConfirmAmount =
-            this.receivableList.reduce(
-              (pre, cur) =>
-                pre + Math.round((+cur.statementAdvanceConfirmAmount || 0) * 100),
-              0
-            ) / 100;
-          const totalReceivableAmount =
-            Math.round(
-              ((+this.dataForm.amountTotalPrice || 0) -
-                totalAdvanceConfirmAmount) *
-                100
-            ) / 100;
+          // 提交时由应收信息组件一次性取回整个表单(本地明细 + 汇总),不再实时回写
+          const receivableData = this.$refs.receivableInfoRef.getSubmitData();
+          // statReceipt 为完整数据容器,保存时以它为基准组装应收明细与汇总
+
+           let statReceipt = {
+              statReceiptDetailList: receivableData.receivableList,
+              statementAdvanceTotalPrice:
+                receivableData.statementAdvanceTotalPrice,
+              receivedTotalPrice: receivableData.receivedTotalPrice
+            };
+            this.statReceipt = statReceipt;
+          
+          const statementAdvanceTotalPrice =
+            receivableData.statementAdvanceTotalPrice;
+          const receivedTotalPrice = receivableData.receivedTotalPrice;
           let params = {
             ...this.dataForm,
-            totalAdvanceConfirmAmount,
-            totalReceivableAmount,
+            statementAdvanceTotalPrice,
+            receivedTotalPrice,
+            totalAdvanceConfirmAmount: statementAdvanceTotalPrice,
+            totalReceivableAmount: receivedTotalPrice,
             productList: this.datasource,
-            receivableList: this.receivableList,
-            statReceipt: this.statReceipt
-            // recorpayList: this.recorpayList
+            statReceipt
           };
           this.saveLoading = true;
           let data = await api(params);

+ 58 - 13
src/views/saleManage/saleOrder/accountstatement/components/detailDialog.vue

@@ -32,8 +32,8 @@
       <!--销售表单表单-->
       <sale-form :dataForm.sync="dataForm" :datasource.sync="datasource"
                  dialogType="view"></sale-form>
-      <headerTitle title="对账明细" style="margin-top: 30px">
-        <template v-slot>
+      <!-- <headerTitle title="对账明细" style="margin-top: 30px"> -->
+        <!-- <template v-slot>
           <el-row style="font-weight: 700; color: red">
             <span>订单总金额:</span>
             <span>{{ isNonDirectionalSale ? '--' : dataForm.orderTotalAmount || 0 }}</span>
@@ -47,15 +47,36 @@
             <span>本次对账总金额:</span>
             <span>{{ dataForm.amountTotalPrice || 0 }}</span>
           </el-row>
-        </template>
-      </headerTitle>
+        </template> -->
+      <!-- </headerTitle> -->
       <!-- <recorpayTableList
         ref="recorpayListRef"
         :dataForm="dataForm"
         :recorpayList.sync="recorpayList"
         dialogType="view"
       ></recorpayTableList> -->
-      <inventoryTable ref="inventoryTableref" :dataForm="dataForm" :datasource.sync="datasource" dialogType="view"></inventoryTable>
+      <!-- <inventoryTable ref="inventoryTableref" :dataForm="dataForm" :datasource.sync="datasource" dialogType="view"></inventoryTable> -->
+
+      <headerTitle title="应收信息" style="margin-top: 30px"></headerTitle>
+      <receivable-info
+        :dataForm.sync="dataForm"
+        :receivableList="receivableList"
+        :dialogType="dialogType"
+        @addAdvanceReceipt="addAdvanceReceipt"
+        ref="receivableInfoRef"
+      ></receivable-info>
+
+      <headerTitle title="对账明细" style="margin-top: 30px"></headerTitle>
+      <account-detail-table
+        ref="accountDetailTableRef"
+        :datasource.sync="datasource"
+        :dialogType="dialogType"
+        :queryDimension="dataForm.queryDimension"
+        @totalChange="handleTotalChange"
+        @countChange="handleCountChange"
+        @statementAmountChange="handleStatementAmountChange"
+      ></account-detail-table>
+
     </div>
     <bpmDetail v-if="activeComp==='bpm'&&form.processInstanceId" :id="form.processInstanceId"></bpmDetail>
 
@@ -72,13 +93,18 @@ import InventoryTable from "@/views/saleManage/saleOrder/accountstatement/compon
 import saleForm from "@/views/saleManage/saleOrder/accountstatement/components/saleForm.vue";
 import {accountstatementInfoAPI} from "@/api/saleManage/accountstatement";
 import recorpayTableList from '@/views/saleManage/saleOrder/accountstatement/components/recorpayTableList.vue';
+import AccountDetailTable from './accountDetailTable.vue';
+import ReceivableInfo from './receivableInfo.vue';
 
 export default {
   props: ['detailDialogFlag'],
   components: {
     saleForm,
     InventoryTable,
-    bpmDetail,recorpayTableList
+    bpmDetail,
+    recorpayTableList,
+    AccountDetailTable,
+    ReceivableInfo
   },
   data() {
     return {
@@ -95,7 +121,7 @@ export default {
       datasource: [],
       recorpayList:[],
       title: '详情',
-
+      dialogType: 'view',
 
     };
   },
@@ -113,13 +139,16 @@ export default {
       let data = await accountstatementInfoAPI(row.id)
 
 
-      this.datasource = data.orderList
+      this.datasource = data.productList || [];
+        this.receivableList =
+          (data.statReceipt && data.statReceipt.statReceiptDetailList) || [];
+        // 保存查询到的完整 statReceipt 对象,作为提交入参
+        this.statReceipt = data.statReceipt || null;
+        this.dataForm = {
+          ...this.dataForm,
+          ...data,
+        };
       // this.recorpayList = data.recorpayList || [];
-      data.orderTotalAmount = data.orderList.reduce((pre, cur) => pre + Math.round(+cur.orderAmount * 100), 0) / 100;
-      data.amountTotalPrice = data.orderList.reduce((pre, cur) => pre + Math.round(+cur.statementAmount * 100), 0) / 100;
-      data.amountCompletePrice = data.orderList.reduce((pre, cur) => pre + Math.round(+cur.statementedAmount * 100), 0) / 100;
-      data.amountUnCompletePrice = data.orderList.reduce((pre, cur) => pre + Math.round(+cur.unStatementAmount * 100), 0) / 100;
-      this.dataForm = data
       switch (this.dataForm.dateType) {
         case 1:
           this.dataForm.year = this.dataForm.dateValue
@@ -138,6 +167,22 @@ export default {
           this.dataForm.dateTimeRange = [this.dataForm.startDate, this.dataForm.endDate]
       }
     },
+    handleTotalChange(total) {
+        this.dataForm.amountTotalPrice = total;
+      },
+      handleCountChange(count) {
+        this.dataForm.totalStatementCount = count;
+      },
+      // 明细表本次对账金额变化时,按销售单号同步到应收信息对应行
+      handleStatementAmountChange(summaryMap) {
+        if (this.$refs.receivableInfoRef) {
+          this.$refs.receivableInfoRef.syncStatementAmount(summaryMap);
+        }
+      },
+      // 新增预收款:打开预收款选择弹窗
+      addAdvanceReceipt() {
+        this.$refs.advanceReceiptSelectRef.open();
+      },
     cancel() {
       this.$emit('update:detailDialogFlag', false)
     },

+ 90 - 61
src/views/saleManage/saleOrder/accountstatement/components/receivableInfo.vue

@@ -4,14 +4,14 @@
       <el-row>
         <el-col :span="8">
           <el-form-item label="总对账预收款确收金额">
-            <el-input disabled v-model="totalAdvanceConfirmAmount">
+            <el-input disabled v-model="statementAdvanceTotalPrice">
               <template slot="append">元</template>
             </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="总应收金额">
-            <el-input disabled v-model="totalReceivableAmount">
+            <el-input disabled v-model="receivedTotalPrice">
               <template slot="append">元</template>
             </el-input>
           </el-form-item>
@@ -19,24 +19,14 @@
       </el-row>
     </el-form>
 
-    <!-- <div class="receivable-table-header">
-      <el-button
-        v-if="!isView"
-        type="primary"
-        size="small"
-        @click="addAdvanceReceipt"
-        icon="el-icon-plus"
-        >新增预收款</el-button
-      >
-    </div> -->
-    <el-form :model="{ receivableList }" ref="tableForm">
+    <el-form :model="{ receivableList: localList }" ref="tableForm">
       <ele-pro-table
         ref="receivableTable"
         row-key="id"
         :needPage="false"
         :columns="columns"
         max-height="400px"
-        :datasource="receivableList"
+        :datasource="localList"
         :cache-key="cacheKeyUrl"
         class="time-form"
       >
@@ -144,6 +134,7 @@
         type: Object,
         default: () => ({})
       },
+      // 父组件传入的初始应收明细,仅作为初始化值,修改不再回写父
       receivableList: {
         type: Array,
         default: () => []
@@ -160,6 +151,8 @@
         transactionMethodsOp,
         paymentStatusOp: paymentStatus,
         rules: {},
+        // 本地维护的应收明细,避免每次编辑都同步回父组件
+        localList: [],
         columns: [
           {
             width: 60,
@@ -215,8 +208,7 @@
             minWidth: 160,
             prop: 'statementAdvanceConfirmAmount',
             label: '本次对账预收款确收金额',
-            align: 'center',
-            // slot: 'statementAdvanceConfirmAmount'
+            align: 'center'
           },
           {
             minWidth: 120,
@@ -231,15 +223,7 @@
             label: '本次应收金额',
             align: 'center',
             showOverflowTooltip: true
-          },
-          // {
-          //   minWidth: 100,
-          //   prop: 'action',
-          //   label: '操作',
-          //   align: 'center',
-          //   slot: 'action',
-          //   fixed: 'right'
-          // }
+          }
         ]
       };
     },
@@ -247,26 +231,34 @@
       isView() {
         return this.dialogType === 'view';
       },
-      totalAdvanceConfirmAmount() {
+      statementAdvanceTotalPrice() {
         return (
-          this.receivableList.reduce(
+          this.localList.reduce(
             (pre, cur) =>
               pre + Math.round((+cur.statementAdvanceConfirmAmount || 0) * 100),
             0
           ) / 100
         );
       },
-      totalReceivableAmount() {
+      receivedTotalPrice() {
         return (
           Math.round(
             ((+this.dataForm.amountTotalPrice || 0) -
-              this.totalAdvanceConfirmAmount) *
+              this.statementAdvanceTotalPrice) *
               100
           ) / 100
         );
       }
     },
     watch: {
+      // 父传入初始值(查询/编辑回填)时同步到本地副本
+      receivableList: {
+        handler(val) {
+          this.localList = (val || []).map((item) => ({ ...item }));
+          this.recalcAllRows();
+        },
+        immediate: true
+      },
       'dataForm.amountTotalPrice': {
         handler() {
           this.recalcAllRows();
@@ -275,7 +267,6 @@
       }
     },
     methods: {
-
       openReceiveTerms(index) {
         this.currentRowIndex = index;
         this.$refs.receiveTermsDialogRef.open();
@@ -287,28 +278,48 @@
         this.updateRowField(targetIndex, 'collectionConditionId', row.id);
         this.updateRowField(targetIndex, 'collectionConditionName', row.name);
       },
-      // 行内字段修改:通过 .sync 回写 receivableList
+      // 行内字段修改:仅更新本地副本
       updateRowField(index, key, val) {
-        const list = [...this.receivableList];
-        list[index] = { ...list[index], [key]: val };
-        this.$emit('update:receivableList', list);
+        const item = this.localList[index];
+        if (!item) return;
+        this.localList[index] = { ...item, [key]: val };
+        this.recalcRow(item);
+      },
+      // 新增一行预收款(空白行,供手动填写)
+      addRow() {
+        this.localList.push({
+          id: 'local_' + Date.now() + '_' + this.localList.length,
+          salesCode: '',
+          advanceCode: '',
+          fundType: '',
+          transactionMode: '',
+          collectionConditionId: '',
+          collectionConditionName: '',
+          unreconciledAdvanceConfirmAmount: 0,
+          statementAdvanceConfirmAmount: 0,
+          statementAmount: 0,
+          receivedPrice: 0
+        });
       },
-      // 新增一行预收款(实际应从预收款管理选择器带出)
-      addAdvanceReceipt() {
-        this.$emit('addAdvanceReceipt');
+      // 由父组件预收款选择器回调调用:追加一行已映射好的应收明细(本地维护)
+      addReceivableRow(row) {
+        this.localList.push({ ...row });
       },
       removeRow(index) {
-        const list = [...this.receivableList];
-        list.splice(index, 1);
-        this.$emit('update:receivableList', list);
+        if (index < 0 || index >= this.localList.length) return;
+        this.localList.splice(index, 1);
       },
-      handleConfirmAmountChange(row, index) {
-        // 限制本次确收金额不能超过未对账金额和本次对账金额
-        let val = +row.statementAdvanceConfirmAmount || 0;
-        const max = Math.min(
+      // 本次对账预收款确收金额上限 = min(未对账预收款确收金额, 本次对账金额)
+      getMaxConfirmAmount(row) {
+        return Math.min(
           +row.unreconciledAdvanceConfirmAmount || 0,
           +row.statementAmount || 0
         );
+      },
+      handleConfirmAmountChange(row, index) {
+        // 限制本次确收金额不能超过未对账金额和本次对账金额
+        let val = +row.statementAdvanceConfirmAmount || 0;
+        const max = this.getMaxConfirmAmount(row);
         if (val > max) {
           val = max;
           this.$set(row, 'statementAdvanceConfirmAmount', val);
@@ -316,25 +327,35 @@
             '本次对账预收款确收金额不能超过未对账金额和本次对账金额'
           );
         }
-        const currentReceivable =
-          Math.round(((+row.statementAmount || 0) - val) * 100) / 100;
-        this.$set(row, 'receivedPrice', currentReceivable);
-        this.$emit('update:receivableList', [...this.receivableList]);
+        this.recalcRow(row);
+      },
+      // 根据本次对账金额重算单行:确收金额 = min(未对账预收款确收金额, 本次对账金额);应收金额 = 本次对账金额 - 确收金额
+      recalcRow(row) {
+        const statementAmount = +row.statementAmount || 0;
+        let val = +row.statementAdvanceConfirmAmount || 0;
+        const max = this.getMaxConfirmAmount(row);
+        if (val > max) val = max;
+        this.$set(row, 'statementAdvanceConfirmAmount', val);
+        this.$set(
+          row,
+          'receivedPrice',
+          Math.round((statementAmount - val) * 100) / 100
+        );
+      },
+      // 明细表按销售单号汇总本次对账金额后,同步到对应销售单号的应收行
+      syncStatementAmount(summaryMap) {
+        if (!summaryMap || !Object.keys(summaryMap).length) return;
+        this.localList.forEach((row) => {
+          const amount = summaryMap[row.salesCode];
+          if (amount !== undefined) {
+            this.$set(row, 'statementAmount', amount);
+            this.recalcRow(row);
+          }
+        });
       },
       recalcAllRows() {
-        this.receivableList.forEach((row) => {
-          const max = Math.min(
-            +row.unreconciledAdvanceConfirmAmount || 0,
-            +row.statementAmount || 0
-          );
-          let val = +row.statementAdvanceConfirmAmount || 0;
-          if (val > max) val = max;
-          this.$set(row, 'statementAdvanceConfirmAmount', val);
-          this.$set(
-            row,
-            'receivedPrice',
-            Math.round(((+row.statementAmount || 0) - val) * 100) / 100
-          );
+        this.localList.forEach((row) => {
+          this.recalcRow(row);
         });
       },
       validateConfirmAmount(rule, value, callback, row) {
@@ -351,6 +372,14 @@
           callback();
         }
       },
+      // 提交时由父组件调用,一次性取回整个应收表单(本地明细 + 汇总)
+      getSubmitData() {
+        return {
+          receivableList: this.localList.map((item) => ({ ...item })),
+          statementAdvanceTotalPrice: this.statementAdvanceTotalPrice,
+          receivedTotalPrice: this.receivedTotalPrice
+        };
+      },
       validate() {
         return new Promise((resolve, reject) => {
           const promises = [this.$refs.form.validate()];

+ 12 - 9
src/views/saleManage/saleOrder/components/addDialogNew.vue

@@ -402,7 +402,7 @@
               <template slot="append">日</template>
             </el-input>
           </el-form-item>
-          <el-form-item label="期数" prop="issueNumber">
+          <el-form-item v-if="form.isGenerateReceiptPlan != 0" label="期数" prop="issueNumber">
             <el-input
               type="number"
               :min="1"
@@ -2092,16 +2092,19 @@
             return;
           }
 
-          if (commitData.needProduce != 2 && commitData.needProduce != 4 && commitData.isGenerateReceiptPlan != 0) {
-            const ratioSum = commitData.receiptPaymentList.reduce(
-              (acc, cur) => acc + +cur.ratio,
-              0
-            );
+          if (commitData.needProduce != 2 && commitData.needProduce != 4) {
+            if(commitData.isGenerateReceiptPlan != 0) {
+                const ratioSum = commitData.receiptPaymentList.reduce(
+                (acc, cur) => acc + +cur.ratio,
+                0
+              );
 
-            if (+ratioSum > 100) {
-              this.$message.error('比例合计不能超过100%');
-              return;
+              if (+ratioSum > 100) {
+                this.$message.error('比例合计不能超过100%');
+                return;
+              }
             }
+            
             let is = false;
             commitData.productList.forEach((v, i) => {
               commitData.productList.forEach((v2, j) => {

+ 2 - 1
src/views/saleManage/saleOrder/components/darwerComponents/saleOrderInfo.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <el-form ref="form" class="el-form-box" :model="form" label-width="120px">
+    <el-form ref="form" class="el-form-box" :model="form" label-width="140px">
       <el-row>
         <el-col :span="8">
           <el-form-item label="订单编号:" prop="orderNo">
@@ -58,6 +58,7 @@
             </el-input>
           </el-form-item>
           <el-form-item
+             v-if="form.isGenerateReceiptPlan != 0"
             label="期数"
             prop="issueNumber"
           >