Переглянути джерело

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-eom into dev

yusheng 7 місяців тому
батько
коміт
0b94d20f30
20 змінених файлів з 263 додано та 2036 видалено
  1. 99 23
      src/BIZComponents/paymentCollectionPlan/Index.vue
  2. 11 5
      src/views/contractManage/contractBook/components/addDialog.vue
  3. 0 1229
      src/views/financialManage/invoiceManage/components/addOrEditDialogNew copy.vue
  4. 17 7
      src/views/financialManage/invoiceManage/components/collectionPlanDialog.vue
  5. 0 688
      src/views/financialManage/invoiceManage/components/tableInfoNew copy 2.vue
  6. 2 3
      src/views/financialManage/invoiceManage/components/tableInfoNew.vue
  7. 1 1
      src/views/financialManage/payableManage/components/paymentListDialog.vue
  8. 2 1
      src/views/financialManage/receivableManage/components/infoTable.vue
  9. 24 14
      src/views/purchasingManage/inquiryManage/components/addDialog.vue
  10. 8 8
      src/views/purchasingManage/purchaseOrder/accountstatement/components/addAccountDialog.vue
  11. 5 4
      src/views/purchasingManage/purchaseOrder/accountstatement/components/detailDialog.vue
  12. 9 6
      src/views/purchasingManage/purchaseOrder/accountstatement/components/searchTable.vue
  13. 6 6
      src/views/purchasingManage/purchaseOrder/accountstatement/index.vue
  14. 11 5
      src/views/purchasingManage/purchaseOrder/components/addDialogNew.vue
  15. 19 9
      src/views/saleManage/saleOrder/accountstatement/components/addAccountDialog.vue
  16. 6 5
      src/views/saleManage/saleOrder/accountstatement/components/detailDialog.vue
  17. 18 10
      src/views/saleManage/saleOrder/accountstatement/components/inventoryTable.vue
  18. 1 1
      src/views/saleManage/saleOrder/accountstatement/index.vue
  19. 14 7
      src/views/saleManage/saleOrder/components/addDialogNew.vue
  20. 10 4
      src/views/saleManage/saleOrder/invoice/components/inventoryTable.vue

+ 99 - 23
src/BIZComponents/paymentCollectionPlan/Index.vue

@@ -354,7 +354,8 @@
         return this.form.datasource.reduce((acc, cur) => acc + Number(cur.ratio), 0).toFixed(2);
       },
       allPrice() {
-        return this.form.datasource.reduce((acc, cur) => acc + Number(cur.price), 0).toFixed(2);
+        // 使用分进行计算,避免浮点数精度问题
+        return (this.form.datasource.reduce((acc, cur) => acc + Math.round(Number(cur.price) * 100), 0) / 100).toFixed(2);
       },
     },
     watch: {
@@ -365,16 +366,16 @@
       },
       info: {
         handler(newval) {
-          if (newval && newval.receiptPaymentList) {
-            this.isLoadingFromApi = true;
-            this.form.datasource = newval.receiptPaymentList;
-            if (newval.payAmount) {
-              this.discountAmount = newval.payAmount;
-            }
-            setTimeout(() => {
-              this.isLoadingFromApi = false;
-            }, 100);
-          }
+          // if (newval && newval.receiptPaymentList) {
+          //   this.isLoadingFromApi = true;
+          //   this.form.datasource = newval.receiptPaymentList;
+          //   if (newval.payAmount) {
+          //     this.discountAmount = newval.payAmount;
+          //   }
+          //   setTimeout(() => {
+          //     this.isLoadingFromApi = false;
+          //   }, 100);
+          // }
         },
         deep: true
       }
@@ -382,11 +383,9 @@
     methods: {
       setDiscountAmount(val) {
         console.log(val, '000000');
-        this.isLoadingFromApi = true;
         this.discountAmount = val;
-        setTimeout(() => {
-          this.isLoadingFromApi = false;
-        }, 100);
+        // 立即更新价格,无需设置isLoadingFromApi为true
+        this.refreshprice();
       },
       typeChange(val, index = null) {
         // console.log(val, index, '55555');
@@ -449,14 +448,65 @@
         });
       },
       refreshprice() {
-        // console.log(this.form, '666666');
-        let newData = this.form.datasource;
-        newData.forEach(async (r, index) => {
+        // 如果正在从API加载数据,则不执行刷新操作
+        if (this.isLoadingFromApi) {
+          return;
+        }
+        
+        // 创建一个新的数组,避免直接修改原数组
+        let newData = JSON.parse(JSON.stringify(this.form.datasource));
+        console.log('newData after copy:', newData);
+        
+        // 先根据比例计算所有价格
+        for (let i = 0; i < newData.length; i++) {
+          const r = newData[i];
           if (r.ratio) {
-            console.log(this.ratioInput(Number(r.ratio)), '9999888888');
-            r.price = await this.ratioInput(Number(r.ratio));
+            // 直接计算价格,避免使用async/await的forEach
+            let val = Number(r.ratio);
+            let newval = (val / 100).toFixed(2);
+            let price = (this.discountAmount * newval).toFixed(2);
+            newData[i] = {
+              ...r,
+              price: price
+            };
           }
-        });
+        }
+        
+        // 验证并调整最后一行价格,确保总和等于优惠后的总金额
+        // 使用分进行计算,避免浮点数精度问题
+        const allPriceSum = newData.reduce((acc, cur) => acc + Math.round(Number(cur.price || 0) * 100), 0) / 100;
+        const discountAmount = Number(this.discountAmount);
+        // 直接计算比例总和,避免字符串转换问题
+        const allRatio = newData.reduce((acc, cur) => acc + Number(cur.ratio || 0), 0);
+        
+        console.log('allPriceSum:', allPriceSum, 'discountAmount:', discountAmount, 'allRatio:', allRatio);
+        
+        // 检查是否所有数据都有price且比例合计为100%
+        const allHavePrice = newData.every(item => item.price != null && item.price !== '');
+        
+        console.log('allHavePrice:', allHavePrice);
+        
+        if (allHavePrice && Math.abs(allRatio - 100) < 0.01 && Math.abs(allPriceSum - discountAmount) >= 0.01) {
+          // 调整最后一行的价格
+          if (newData.length > 0) {
+            const lastIndex = newData.length - 1;
+            // 使用分进行计算,避免浮点数精度问题
+            const otherPriceSum = newData.slice(0, lastIndex).reduce((acc, cur) => acc + Math.round(Number(cur.price || 0) * 100), 0) / 100;
+            // 计算最后一行应该有的价格
+            const lastPrice = Math.round((discountAmount - otherPriceSum) * 100) / 100;
+            newData[lastIndex] = {
+              ...newData[lastIndex],
+              price: lastPrice.toFixed(2)
+            };
+            console.log('adjusted last item price:', lastPrice);
+          }
+        }
+        
+        console.log('newData before update:', newData);
+        
+        // 确保更新this.form.datasource,触发Vue的响应式更新
+        this.form.datasource = newData;
+        console.log('after update, datasource:', this.form.datasource);
       },
       // 返回列表数据
       getTableValue() {
@@ -537,7 +587,15 @@
           }
         }
         console.log('tempList~~~', tempList);
-        this.form.datasource = tempList;
+        // 清空原数组并逐个添加新元素,确保Vue能够检测到变化
+        this.form.datasource = [];
+        this.$nextTick(() => {
+          this.form.datasource = tempList;
+          console.log('form.datasource after update:', this.form.datasource);
+          // 强制组件重新渲染
+          this.$forceUpdate();
+          console.log('forceUpdate called');
+        });
       },
 
       transformDaysFun(date) {
@@ -608,12 +666,23 @@
         const basicRatio = 100 / tempPeriod;
         let totalRatio = 0;
         
+        // 保存原有数据
+        const existingData = [...this.form.datasource];
+        
         // 生成付款计划列表项
         const tempList = [];
         
         // 根据传入的period参数生成付款计划
         for (let i = 0; i < tempPeriod; i++) {
           let item = JSON.parse(JSON.stringify(this.defaultForm));
+          // let item;
+          // // 如果原有数据中有对应项,则保留原有数据
+          // if (i < existingData.length) {
+          //   item = JSON.parse(JSON.stringify(existingData[i]));
+          // } else {
+          //   item = JSON.parse(JSON.stringify(this.defaultForm));
+          // }
+          
           // 获取日期:如果i小于日期数组长度则使用对应日期,否则设为空
           const deadLine = i < dateRange.length ? dateRange[i] : '';
           const ratio = parseFloat(basicRatio.toFixed(2));
@@ -635,9 +704,16 @@
         // }
         
         console.log('付款计划列表:~~', tempList);
-        this.form.datasource = tempList;
         // this.$set(this.form, 'datasource', tempList);
         console.log('付款计划列表:', this.form.datasource);
+        this.form.datasource = [];
+        this.$nextTick(() => {
+          this.form.datasource = tempList;
+          console.log('form.datasource after update:', this.form.datasource);
+          // 强制组件重新渲染
+          this.$forceUpdate();
+          console.log('forceUpdate called');
+        });
       },
       // 添加
       handlAdd() {

+ 11 - 5
src/views/contractManage/contractBook/components/addDialog.vue

@@ -360,6 +360,7 @@
               style="width: 100%"
               v-model="form.settlementDate"
               type="daterange"
+              :clearable="false"
               value-format="yyyy-MM-dd"
               range-separator="至"
               start-placeholder="开始日期"
@@ -378,6 +379,7 @@
             </el-date-picker> -->
             <el-date-picker
               v-model="form.settlementDate"
+              :clearable="false"
               type="monthrange"
               range-separator="至"
               start-placeholder="开始月份"
@@ -1960,15 +1962,19 @@
             return;
           }
 
-          let receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.price, 0);
+          // 使用分进行计算,避免浮点数精度问题
+          let receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 100), 0) / 100;
           const payAmount = +commitData.payAmount;
           
           if(+ratioSum == 100) {
-            const difference = payAmount - receiptPaymentListSum;
-            if (Math.abs(difference) > 0.01 && commitData.receiptPaymentList.length > 0) {
+            // 使用分进行计算,避免浮点数精度问题
+            const difference = Math.round((payAmount - receiptPaymentListSum) * 100) / 100;
+            if (Math.abs(difference) >= 0.01 && commitData.receiptPaymentList.length > 0) {
               const lastIndex = commitData.receiptPaymentList.length - 1;
-              commitData.receiptPaymentList[lastIndex].price = (+commitData.receiptPaymentList[lastIndex].price + difference).toFixed(2);
-              receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.price, 0);
+              // 使用分进行计算,避免浮点数精度问题
+              const newPrice = Math.round((+commitData.receiptPaymentList[lastIndex].price + difference) * 100) / 100;
+              commitData.receiptPaymentList[lastIndex].price = newPrice.toFixed(2);
+              receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 100), 0) / 100;
             }
           }
 

+ 0 - 1229
src/views/financialManage/invoiceManage/components/addOrEditDialogNew copy.vue

@@ -1,1229 +0,0 @@
-<template>
-  <ele-modal
-    custom-class="ele-dialog-form long-dialog-form"
-    :centered="true"
-    :visible.sync="addOrEditDialogFlag"
-    :title="title"
-    :append-to-body="true"
-    :close-on-click-modal="false"
-    width="70%"
-    :before-close="cancel"
-    :maxable="true"
-    :resizable="true"
-  >
-    <el-form
-      ref="form"
-      :rules="rules"
-      class="el-form-box"
-      :model="form"
-      label-width="160px"
-    >
-      <headerTitle title="基本信息"></headerTitle>
-      <el-row :gutter="12">
-        <el-col :span="8">
-          <el-form-item label="发票类型" prop="type">
-            <el-select
-              v-model="form.type"
-              @change="handleSelType('isType')"
-              clearable
-              :disabled="!isEditType"
-              style="width: 100%"
-            >
-              <el-option label="开票" value="1"></el-option>
-              <el-option label="收票" value="2"></el-option>
-            </el-select>
-          </el-form-item>
-        </el-col>
-        <el-col :span="8" v-if="form.type">
-          <el-form-item label="来源类型" prop="sourceType">
-            <el-select
-              v-model="form.sourceType"
-              @change="handleSelType()"
-              :disabled="!isEditType"
-              clearable
-              style="width: 100%"
-            >
-              <el-option v-for="item in sourceTypeOp" :label="item.label" :value="item.value" :key="item.value"></el-option>
-              <!-- <el-option label="对账单" :value="1"></el-option>
-              <el-option label="合同" :value="2"></el-option>
-              <el-option label="订单" :value="3"></el-option>
-              <el-option label="收款计划" :value="1"></el-option>
-              <el-option
-                label="应收"
-                :value="5"
-                v-if="form.type == 1"
-              ></el-option>
-              <el-option
-                label="应付"
-                :value="4"
-                v-if="form.type == 2"
-              ></el-option> -->
-            </el-select>
-          </el-form-item>
-        </el-col>
-        <el-col :span="8" v-if="form.sourceType == 6">
-          <el-form-item label="收款计划编码" prop="sourceCode">
-            <el-input
-              v-model="form.sourceCode"
-              readonly
-              @click.native="handleSelectAccount(6)"
-            ></el-input>
-          </el-form-item>
-        </el-col>
-        <el-col :span="8" v-if="form.sourceType == 7">
-          <el-form-item label="付款计划编码" prop="sourceCode">
-            <el-input
-              v-model="form.sourceCode"
-              readonly
-              @click.native="handleSelectAccount(7)"
-            ></el-input>
-          </el-form-item>
-        </el-col>
-        <el-col :span="8" v-if="form.sourceType == 5">
-          <el-form-item label="应收编码" prop="sourceCode">
-            <el-input
-              v-model="form.sourceCode"
-              readonly
-              @click.native="handleSelectAccount(5)"
-            ></el-input>
-          </el-form-item>
-        </el-col>
-        <el-col :span="8" v-if="form.sourceType == 4">
-          <el-form-item label="应付编码" prop="sourceCode">
-            <el-input
-              v-model="form.sourceCode"
-              readonly
-              @click.native="handleSelectAccount(4)"
-            ></el-input>
-          </el-form-item>
-        </el-col>
-        <el-col :span="8">
-          <el-form-item label="发票金额" prop="amount">
-            <el-input
-              type="number"
-              v-model="form.amount"
-              :precision="2"
-              :controls="false"
-              style="width: 100%"
-              disabled
-              :min="0"
-            >
-              <template slot="append">
-                <span>元</span>
-              </template>
-            </el-input>
-          </el-form-item>
-        </el-col>
-        <el-col :span="8">
-          <el-form-item label="发票号" prop="invoiceNos">
-            <el-input
-              v-model="form.invoiceNos"
-            ></el-input>
-          </el-form-item>
-        </el-col>
-        <el-col :span="8">
-          <el-form-item label="开票日期">
-            <el-date-picker
-              style="width: 100%"
-              v-model="form.expectInvoiceDate"
-              type="date"
-              value-format="yyyy-MM-dd"
-              placeholder="选择日期"
-            >
-            </el-date-picker>
-          </el-form-item>
-        </el-col>
-        <el-col :span="8">
-          <el-form-item label="申请部门" prop="applyDeptId">
-            <ele-tree-select
-              clearable
-              :data="deptTreeList"
-              v-model="form.applyDeptId"
-              valueKey="id"
-              labelKey="name"
-              placeholder="请选择"
-              @change="changeDeptInfo"
-              default-expand-all
-            />
-          </el-form-item>
-        </el-col>
-        <el-col :span="8">
-          <el-form-item label="申请人" prop="applyUserId">
-            <personSelect
-              ref="directorRef"
-              v-model="form.applyUserId"
-              @selfChange="changeUserInfo"
-            />
-          </el-form-item>
-        </el-col>
-        <el-col :span="8">
-          <el-form-item label="发票种类" prop="category">
-            <el-select
-              v-model="form.category"
-              clearable
-              style="width: 100%"
-            >
-              <el-option label="增值税专用发票" :value="1"></el-option>
-              <el-option label="增值税普通发票" :value="2"></el-option>
-            </el-select>
-          </el-form-item>
-        </el-col>
-        <el-col :span="8">
-          <el-form-item prop="files" label="发票附件">
-            <fileMain v-model="form.files"></fileMain>
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <headerTitle title="发票信息"></headerTitle>
-      <el-row :gutter="12">
-        <el-col :span="12">
-          <el-form-item label="购买方名称" prop="companyName">
-            <el-input
-              v-model="form.companyName"
-              placeholder="请输入"
-              v-if="enterprisePage.length <= 1 || form.type == 1"
-            />
-            <el-select
-              v-if="enterprisePage.length > 1 && form.type == 2"
-              style="width: 100%"
-              v-model="form.companyName"
-              placeholder="请选择"
-              @change="enterpriseChange"
-            >
-              <el-option
-                v-for="item in enterprisePage"
-                :key="item.id"
-                :label="item.name"
-                :value="item.name"
-              >
-              </el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item
-            label="统一社会信用代码"
-            prop="companyUsc"
-            class="form_item_label"
-          >
-            <el-input v-model="form.companyUsc"></el-input>
-          </el-form-item>
-          <el-form-item label="联系人" prop="companyContactName">
-            <el-input v-model="form.companyContactName"></el-input>
-          </el-form-item>
-          <el-form-item label="电话" prop="companyTel">
-            <el-input v-model="form.companyTel"></el-input>
-          </el-form-item>
-          <el-form-item label="银行账号" prop="companyBankAccount">
-            <el-input v-model="form.companyBankAccount"></el-input>
-          </el-form-item>
-          <el-form-item label="开户行" prop="companyBankBranchNo">
-            <el-input v-model="form.companyBankBranchNo"></el-input>
-          </el-form-item>
-          
-          <el-form-item label="地址" prop="companyAddress">
-            <el-input v-model="form.companyAddress"></el-input>
-          </el-form-item>
-        </el-col>
-        <el-col :span="12">
-          <el-form-item label="销售方名称" prop="receiverName">
-            <el-input
-              v-model="form.receiverName"
-              placeholder="请输入"
-              v-if="enterprisePage.length <= 1 || form.type == 2"
-            />
-            <el-select
-              v-if="enterprisePage.length > 1 && form.type == 1"
-              style="width: 100%"
-              v-model="form.receiverName"
-              placeholder="请选择"
-              @change="enterpriseChange"
-            >
-              <el-option
-                v-for="item in enterprisePage"
-                :key="item.id"
-                :label="item.name"
-                :value="item.name"
-              >
-              </el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item
-            label="统一社会信用代码"
-            prop="salesCompanyUsc"
-            class="form_item_label"
-          >
-            <el-input v-model="form.salesCompanyUsc"></el-input>
-          </el-form-item>
-          <el-form-item label="联系人" prop="receiverContactName">
-            <el-input v-model="form.receiverContactName"></el-input>
-          </el-form-item>
-          <el-form-item label="电话" prop="receiverTel">
-            <el-input v-model="form.receiverTel"></el-input>
-          </el-form-item>
-          <el-form-item label="银行账号" prop="salesCompanyBankAccount">
-            <el-input v-model="form.salesCompanyBankAccount"></el-input>
-          </el-form-item>
-          <el-form-item label="开户行" prop="salesCompanyBankBranchNo">
-            <el-input v-model="form.salesCompanyBankBranchNo"></el-input>
-          </el-form-item>
-          
-          <el-form-item label="地址" prop="receiverAddress">
-            <el-input v-model="form.receiverAddress"></el-input>
-          </el-form-item>
-          <!-- <el-form-item prop="files" label="发票附件">
-            <fileMain v-model="form.files"></fileMain>
-          </el-form-item> -->
-        </el-col>
-      </el-row>
-    
-      <div style="margin-top: 20px;">
-        <headerTitle :title="form.type == 2 ? '付款计划信息' : '收款计划信息'"></headerTitle>
-        <!-- <el-form ref="form" :model="tableForm"> -->
-          <ele-pro-table
-            ref="table"
-            :needPage="false"
-            :columns="columns"
-            :datasource="form.receiptPayments"
-            row-key="id"
-            class="time-form"
-          >
-            <template v-slot:toolbar>
-              <!-- <span>已开票金额:{{ totalInvoiceAmount }}</span> -->
-            </template>
-            
-            <template v-slot:invoiceAmount="scope">
-              <el-form-item
-                style="width: 100%;"
-                label-width="0"
-                :prop="'receiptPayments.' + scope.$index + '.invoiceAmount'"
-                :rules="[
-                  {
-                    required: true,
-                    message: '请输入开票金额',
-                    trigger: 'blur'
-                  },
-                  {
-                    validator: (rule, value, callback) => {
-                      if (value === undefined || value === null || value === '') {
-                        callback('请输入开票金额');
-                      } else if (parseFloat(value) <= 0 || parseFloat(value) > parseFloat(scope.row.unInvoiceAmount)) {
-                        callback('开票金额必须大于0且不超过未开票金额');  
-                      } else {
-                        callback();
-                      }
-                    },
-                    trigger: 'blur'
-                  }
-                ]"
-              > 
-                <span v-if="dialogType === 'view'">{{ scope.row.invoiceAmount }}</span>
-                <el-input :min="0" :max="scope.row.unInvoiceAmount" v-limit="{ min: 0, max: scope.row.unInvoiceAmount }" v-else v-model="scope.row.invoiceAmount" type="number" @input="updateInvoiceAmount(scope.row)"></el-input>
-              </el-form-item>
-            </template>
-          </ele-pro-table>
-        <!-- </el-form> -->
-      </div>
-    </el-form>
-    <div style="margin-top: 20px;">
-      <headerTitle title="关联物品清单信息"></headerTitle>
-      <table-info-new
-        :dialogType="dialogType"
-        :contactData="contactData"
-        ref="tableInfoRef"
-        :invoiceAmount="form.invoiceAmount"
-      ></table-info-new>
-    </div>
-    <div slot="footer">
-      <el-button type="primary" v-click-once @click="handleSave(0)">保存</el-button>
-      <el-button
-        type="primary"
-        v-if="isNeed_process_is_close"
-         v-click-once
-        @click="handleSave(1)"
-        >提交</el-button
-      >
-      <el-button  v-click-once @click="cancel">返回</el-button>
-    </div>
-    <process-submit-dialog
-      api-fun-name="fininvoiceapplyStatusAPI"
-      :processSubmitDialogFlag.sync="processSubmitDialogFlag"
-      v-if="processSubmitDialogFlag"
-      ref="processSubmitDialogRef"
-      @reload="reload"
-    ></process-submit-dialog>
-    <!--对账单-->
-    <!-- <account-statement-dialog
-      ref="accountStatementDialogRef"
-      :form="form"
-      v-if="accountStatementDialogFlag"
-      :accountstatement-dialog-flag.sync="accountStatementDialogFlag"
-      @getAccountData="getAccountData"
-      :contactData="contactData"
-      :type="form.type"
-    >
-    </account-statement-dialog> -->
-    <!--采购订单-->
-    <purchasinOrderListDialog
-      ref="orderListDialogRef"
-      @changeParent="changeOrder"
-    ></purchasinOrderListDialog>
-    <!--销售订单-->
-    <saleOrderListDialog
-      ref="saleOrderListDialogref"
-      @changeParent="changeOrder"
-    ></saleOrderListDialog>
-
-    <contractListDialog
-      ref="selectContractRef"
-      @changeParent="changeContract"
-      :type="form.type"
-    ></contractListDialog>
-    <!-- 应收 -->
-    <receivableDialog
-      ref="receivableRef"
-      @receivableDone="receivableDone"
-      v-if="receivableDialogFlag"
-      :receivableDialogFlag.sync="receivableDialogFlag"
-    ></receivableDialog>
-    <!-- 应付 -->
-    <paymentListDialog
-      ref="receivableRef1"
-      @receivableDone="receivableDone"
-      v-if="paymentListDialogFlag"
-      :paymentListDialogFlag.sync="paymentListDialogFlag"
-    ></paymentListDialog>
-
-    <!-- 收款计划列表 -->
-    <collectionPlanDialog
-      ref="collectionPlanDialogRef"
-      v-if="collectionPlanDialogFlag"
-      :collectionPlanDialogFlag.sync="collectionPlanDialogFlag"
-      @getPlanData="getPlanData"
-      :type="form.type"
-    ></collectionPlanDialog>
-
-  </ele-modal>
-</template>
-<script>
-  import personSelect from '@/components/CommomSelect/person-select.vue';
-  import { listOrganizations } from '@/api/system/organization';
-  import { mapGetters } from 'vuex';
-  import fileUpload from '@/components/upload/fileUpload.vue';
-  import tableInfoNew from './tableInfoNew.vue';
-  import { getTreeByPid } from '@/api/classifyManage';
-  import {
-    invoiceApplyInfoV2API,
-    invoiceApplyCreateAPI,
-    invoiceApplyUpdateV2API
-  } from '@/api/financialManage/invoiceManage';
-  import { getpurchaseorderDetail } from '@/api/purchasingManage/purchaseOrder';
-  import { getSaleOrderDetail } from '@/api/saleManage/saleorder';
-  import { getDetail } from '@/api/contractManage/contractBook';
-  import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
-  import accountStatementDialog from './accountstatementDialog.vue';
-  import contractListDialog from '@/views/saleManage/saleOrder/components/contractListDialog.vue';
-  import purchasinOrderListDialog from '@/views/purchasingManage/purchaseOrder/invoice/components/orderListDialog.vue'; //采购订单
-  import saleOrderListDialog from '@/views/saleManage/saleOrder/invoice/components/orderListDialog.vue'; //销售订单
-  import { enterprisePage } from '@/api/contractManage/contractBook';
-  import { contactDetail } from '@/api/saleManage/contact';
-  // import fileMain from '@/components/addDoc/index.vue';
-  import receivableDialog from '@/views/financialManage/receivableManage/components/receivableDialog.vue'; //应收
-  import paymentListDialog from '@/views/financialManage/payableManage/components/paymentListDialog.vue'; //应付
-  import collectionPlanDialog from './collectionPlanDialog.vue'   // 收款计划列表
-
-  import { updateContractStatus } from '@/api/contractManage/contractBook';
-  import { getMergeInvoiceInfoAPI } from '@/api/financialManage/payAndCollectPlan';
-  import { paymentTypeOp } from '@/enum/dict';
-
-  const defForm = {
-    accountingSubjectCode: '',
-    accountingSubjectId: '',
-    accountingSubjectName: '',
-    amount: undefined,
-    contactId: '',
-    companyAddress: '',
-    companyBankAccount: '',
-    companyUsc: '',
-    expectInvoiceDate: '',
-    companyBankBranchNo: '',
-    companyName: '',
-    receiverAddress: '',
-    receiverName: '',
-    receiverTel: '',
-    receiverContactName: '',
-    companyTel: '',
-    companyContactName: '',
-    detailList: [],
-    drawerId: '',
-    drawerName: '',
-    files: [],
-    invoiceStatus: '',
-    link: [],
-    remark: '',
-    settlementAccountId: '',
-    settlementAccountName: '',
-    invoiceAmount: 0,
-    getAccountData: '',
-    sourceId: '',
-    sourceCode: '',
-    salesCompanyUsc: '',
-    salesCompanyBankBranchNo: '',
-    salesCompanyBankAccount: '',
-    category: 1,
-    receiptPayments: [],
-    productMap: {}
-  };
-  export default {
-    name: 'add-or-edit-dialog',
-    components: {
-      processSubmitDialog,
-      fileUpload,
-      personSelect,
-      tableInfoNew,
-      accountStatementDialog,
-      contractListDialog,
-      purchasinOrderListDialog,
-      saleOrderListDialog,
-      // fileMain,
-      receivableDialog,
-      paymentListDialog,
-      collectionPlanDialog
-    },
-    props: {
-      isEditType: {
-        type: Boolean,
-        default: true
-      },
-      addOrEditDialogFlag: {
-        type: Boolean,
-        default: false
-      },
-      contactData: {
-        type: Object,
-        default: () => {
-          return {};
-        }
-      }
-    },
-    provide() {
-      return {
-        invoiceType: () => this.form.type
-      };
-    },
-    computed: {
-      ...mapGetters(['user']),
-      sourceTypeOp() {
-        return this.form.type == 1 ? [{
-          label: '收款计划',
-          value: 6
-        }, {
-          label: '应收管理',
-          value: 5
-        }] : [{
-          label: '付款计划',
-          value: 7
-        }, {
-          label: '应付管理',
-          value: 4
-        }]
-      },
-      columns() {
-        return [
-          {
-            width: 45,
-            type: 'index',
-            columnKey: 'index',
-            align: 'center',
-            fixed: 'left'
-          },
-          {
-            width: 150,
-            prop: 'sourceOrderDetailNo',
-            label: this.form.type == 1 ? '收款计划编码' : '付款计划编码',
-            align: 'center'
-          },
-          {
-            width: 150,
-            prop: 'relatedOrderNo',
-            label: '订单编号',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'relatedOrderType',
-            label: '订单类型',
-            align: 'center',
-            formatter: (row) => {
-              return row.relatedOrderType == 1 ? '销售订单' : '采购订单'
-            }
-          },
-          {
-            width: 120,
-            prop: 'contractNo',
-            label: '合同编码',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'contractCode',
-            label: '合同编号',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'contractName',
-            label: '合同名称',
-            align: 'center'
-          },
-          {
-            prop: 'issueNumber',
-            label: '期数',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'paymentType',
-            label: '款项类型',
-            align: 'center',
-            formatter: (row) => {
-              return this.paymentTypeOp.find(item => item.value == row.paymentType)?.label || ''
-            }
-          },
-          {
-            prop: 'moneyName',
-            label: '款项名称',
-            align: 'center',
-            width: 170
-          },
-          {
-            width: 150,
-            prop: 'paymentRatio',
-            label: '比例',
-            align: 'center'
-          },
-          {
-            width: 170,
-            prop: 'planPaymentAmount',
-            label: this.form.type == 1 ? '计划收款金额' : '计划付款金额',
-            align: 'center',
-          },
-          {
-            width: 150,
-            prop: 'unInvoiceAmount',
-            label: '未开票金额',
-            align: 'center'
-          },
-          {
-            width: 150,
-            prop: 'invoicedAmount',
-            label: '已开票金额',
-            align: 'center'
-          },
-          {
-            width: 160,
-            prop: 'invoiceAmount',
-            label: '开票金额',
-            align: 'center',
-            slot: 'invoiceAmount',
-            fixed: 'right'
-          }
-        ];
-      },
-    },
-    data() {
-      return {
-        businessId: '',
-        paymentTypeOp,
-        fullscreen: false,
-        receivableDialogFlag: false,
-        dialogType: '',
-        title: '',
-        isOtherSourceFlag: false,
-        processSubmitDialogFlag: false,
-        collectionPlanDialogFlag: false,
-        paymentListDialogFlag: false,
-        enterprisePage: [],
-        totalInvoiceAmount: 0,
-        form: {
-          applyDeptId: '',
-          applyDeptName: '',
-          applyUserId: '',
-          applyUserName: '',
-          type: '1',
-          id: '',
-          ...defForm
-        },
-        feeTypeList: [],
-        accountingSubjectList: [],
-        deptList: [],
-        deptTreeList: [],
-        rules: {
-          applyDeptId: { required: true, message: '请选择', trigger: 'change' },
-          applyUserId: { required: true, message: '请选择', trigger: 'change' },
-          accountingSubjectId: {
-            required: true,
-            message: '请选择',
-            trigger: 'change'
-          },
-          feeTypeId: { required: true, message: '请选择', trigger: 'change' },
-          // amount: { required: true, message: '请输入', trigger: 'blur' },
-          companyName: { required: true, message: '请输入', trigger: 'blur' },
-          type: { required: true, message: '请选择', trigger: 'change' },
-          sourceType: { required: true, message: '请选择', trigger: 'change' }
-        }
-      };
-    },
-    created() {
-      this.getClassifyList(24, 'accountingSubjectList');
-      this.getDeptList();
-    },
-    methods: {
-      //从发票管理新增发票初始化
-      async init(row = {}, type) {
-        this.businessId = row.id || '';
-        this.title = type == 'add' ? '新增' : '修改';
-        console.log('row', row, type);
-        this.dialogType = type;
-        if (type == 'add') {
-          this.form.applyDeptId = this.user.info.groupId;
-          this.form.applyDeptName = this.user.info.groupName;
-          this.form.applyUserId = this.user.info.userId;
-          this.form.applyUserName = this.user.info.name;
-          enterprisePage({
-            pageNum: 1,
-            size: 200
-          }).then((res) => {
-            this.enterprisePage = [];
-            this.enterprisePage.push(...res.list);
-            this.enterpriseChange(this.enterprisePage[0]?.name);
-          });
-        } else {
-          await this.getInfo(row.id);
-        }
-        this.$nextTick(async () => {
-          // await this.getUser List(this.form.applyDeptId);
-        });
-      },
-      updateInvoiceAmount(row) {
-        // row.invoiceAmount = Number(row.invoiceAmount).toFixed(2);
-        this.form.amount = this.form.receiptPayments.reduce((pre, cur) => {
-          return pre + Number(cur.invoiceAmount);
-        }, 0);
-        this.$refs.tableInfoRef.setSinglePrice(row, this.form.receiptPayments);
-      },
-      //来源类型
-      async handleSelectAccount(val) {
-        if (val == 6 || val == 7) {
-          this.collectionPlanDialogFlag = true;
-        }
-        if (val == 2) {
-          this.$refs.selectContractRef.open({}, 1, 1);
-        }
-        if (val == 3 && this.form.type == 2) {
-          this.$refs.orderListDialogRef.open({}, 1, true);
-        }
-        if (val == 3 && this.form.type == 1) {
-          this.$refs.saleOrderListDialogref.open({}, 1, true);
-        }
-        if (val == 5) {
-          this.receivableDialogFlag = true;
-        }
-        if (val == 4) {
-          this.paymentListDialogFlag = true;
-        }
-      },
-      //合同回调
-      async changeContract(data) {
-        const res = await getDetail(data.id);
-        this.$set(this.form, 'sourceId', data.id);
-        this.$set(this.form, 'sourceCode', data.contractNo);
-        this.$set(
-          this.form,
-          'amount',
-          res.contractVO?.discountTotalPrice - res.contractVO?.invoiceAmount
-        );
-        this.$set(this.form, 'invoiceAmount', res.contractVO?.invoiceAmount);
-        this.getContactDetail(
-          this.form.type == 2
-            ? res.contractVO?.partbId
-            : res.contractVO?.partaId,
-          res.contractVO
-        );
-
-        res.productList.forEach((item) => {
-          item.singlePrice =
-            (item.discountSinglePrice &&
-              Number(item.discountSinglePrice).toFixed(2)) ||
-            item.singlePrice;
-          item.totalPrice =
-            (item.discountTotalPrice &&
-              Number(item.discountTotalPrice).toFixed(2)) ||
-            item.totalPrice;
-          item.typeName = this.form.type == 1 ? '销售合同' : '采购合同';
-          item.type = this.form.type == 1 ? '101' : '102';
-        });
-        this.$nextTick(() => {
-          this.$refs.table.setValue(res.productList);
-        });
-        this.$forceUpdate();
-      },
-      async getContactDetail(id, data) {
-        let contactValue = {};
-        if (id) {
-          this.form.contactId = id;
-          contactValue = await contactDetail(id);
-        }
-        const { base, other, bankList, linkList } = contactValue;
-        if (this.form.type == 1) {
-          this.form.companyName = base.name;
-          this.form.companyUsc = base.unifiedSocialCreditCode;
-          this.form.companyAddress = other?.addressName + other?.address;
-          this.form.companyTel =
-            data.partbTel ||
-            linkList.find((item) => item.ifChief == 1)?.mobilePhone;
-
-          this.form.companyBankAccount = bankList[0]?.accountNo;
-          this.form.companyBankBranchNo = bankList[0]?.bankName;
-          this.enterpriseChange(data.partbName);
-        } else {
-          this.form.receiverName = base.name;
-          this.form.receiverAddress = base?.addressName + other?.address;
-          this.form.receiverTel =
-            data.partaTel ||
-            linkList.find((item) => item.ifChief == 1)?.mobilePhone;
-          this.form.salesCompanyUsc = base.unifiedSocialCreditCode;
-          this.form.salesCompanyBankAccount = bankList[0]?.accountNo;
-          this.form.salesCompanyBankBranchNo = bankList[0]?.bankName;
-          this.enterpriseChange(data.partaName);
-        }
-      },
-
-      setCompanyBankAccount(base) {
-        console.log('base~~~', base);
-        if (this.form.type == 1) {
-          console.log('base~~~111', base.companyName);
-          this.form.companyName = base.companyName;
-          this.form.companyUsc = base.companyUsc;
-          this.form.companyAddress = base.companyAddress;
-          this.form.companyTel = base.companyTel;
-          this.form.companyContactName = base.companyContactName;
-
-          this.form.companyBankAccount = base.companyBankAccount;
-          this.form.companyBankBranchNo = base.companyBankBranchNo;
-          // this.enterpriseChange(base.companyName);
-        } else {
-          this.form.receiverName = base.receiverName;
-          this.form.receiverAddress = base.receiverAddress;
-          this.form.receiverTel = base.receiverTel;
-          this.form.receiverContactName = base.receiverContactName;
-          this.form.salesCompanyUsc = base.salesCompanyUsc;
-          this.form.salesCompanyBankAccount = base.salesCompanyBankAccount;
-          this.form.salesCompanyBankBranchNo = base.salesCompanyBankBranchNo;
-          // this.enterpriseChange(base.receiverName);
-        }
-      },
-      //订单回调
-      async changeOrder(data) {
-        this.$set(this.form, 'sourceId', data.id);
-        this.$set(this.form, 'sourceCode', data.orderNo);
-        let res = {};
-        if (this.form.type == 2) {
-          res = await getpurchaseorderDetail(data.id);
-        } else {
-          res = await getSaleOrderDetail(data.id);
-        }
-        this.$set(this.form, 'amount', res.payAmount - res.invoiceAmount);
-        this.$set(this.form, 'invoiceAmount', res.invoiceAmount);
-        this.getContactDetail(
-          this.form.type == 2 ? res.partbId : res.partaId,
-          res
-        );
-        res.productList.forEach((item) => {
-          item.singlePrice =
-            (item.discountSinglePrice &&
-              Number(item.discountSinglePrice).toFixed(2)) ||
-            item.singlePrice;
-          item.totalPrice =
-            (item.discountTotalPrice &&
-              Number(item.discountTotalPrice).toFixed(2)) ||
-            item.totalPrice;
-          item.typeName = this.form.type == 1 ? '销售订单' : '采购订单';
-          item.type = this.form.type == 1 ? '201' : '202';
-        });
-        this.$nextTick(() => {
-          this.$refs.table.setValue(res.productList);
-        });
-        this.$forceUpdate();
-
-        console.log(res);
-      },
-
-      //应收应付回调
-      async payableManage(data) {
-        const { row, form } = data;
-        console.log(data);
-        this.$set(this.form, 'sourceId', row.id);
-        this.$set(this.form, 'sourceCode', row.code);
-        // this.$set(
-        //   this.form,
-        //   'amount',
-        //   row.receivedTotalPrice || row.paidTotalPrice
-        // );
-        // this.$set(this.form, 'invoiceAmount', row.invoiceAmount);
-        // this.getContactDetail(form.contactId, {});
-      },
-      receivableDone(data) {
-        // this.$set(this.form, 'type', Number(data.type));
-        // this.$set(this.form, 'sourceType', data.sourceType);
-        // this.payableManage(data.data);
-        this.getPlanData(data)
-      },
-      // 收/付款计划回调
-      async getPlanData(data) {
-        let tempIds = [];
-        let tempNames = [];
-        if(this.form.sourceType == 4 || this.form.sourceType == 5) {
-          tempIds = data.map((item) => item.receiptPlanOrderId);
-          tempNames = data.map((item) => item.code);
-        } else {
-          tempIds = data.map((item) => item.id);
-          tempNames = data.map((item) => item.detailNo);
-        }
-
-        this.form.sourceCode = tempNames.join(',');
-        
-        const res = await getMergeInvoiceInfoAPI(tempIds)
-        res.receiptPayments = res.receiptPayments.map((item) => {
-          item.invoiceAmount = item.unInvoiceAmount;
-          return item
-        })
-        
-        this.form.receiptPayments = res.receiptPayments;
-        this.form.productMap = res.productMap;
-        const amount = this.form.receiptPayments.reduce((prev, cur) => prev + 
-        +cur.invoiceAmount, 0) || 0;
-        this.form.amount = amount;
-        console.log('form~~~', this.form);
-        this.setCompanyBankAccount(res)
-        // this.form.detailList = res.detailList;
-        this.$nextTick(() => {
-          this.$refs.tableInfoRef.setValue(this.form);
-        })
-        console.log('getPlanData~~~', res);
-        // console.log('detailList~~~', res.detailList);
-      },
-      //对账单回调
-      async getAccountData(tableInfo) {
-        let res = {};
-        if (this.form.type == 2) {
-          res = await getpurchaseorderDetail(tableInfo?.children?.orderId);
-        } else {
-          res = await getSaleOrderDetail(tableInfo?.children?.orderId);
-        }
-        this.getContactDetail(tableInfo.contactId, res);
-        this.$nextTick(() => {
-          this.$set(this.form, 'sourceId', tableInfo?.children?.id);
-          this.$set(this.form, 'sourceCode', tableInfo?.statementNo);
-          this.$set(
-            this.form,
-            'invoiceAmount',
-            tableInfo?.children?.invoiceAmount
-          );
-
-          this.$refs.table.getAccountData(tableInfo);
-        });
-      },
-      //订单、合同列表
-      async createInvoice1(data, type, sourceType) {
-        console.log('createInvoice1~~~', data);
-        // const tempIds = data.map((item) => item.id).join(',');
-        this.$set(this.form, 'type', type);
-        this.$set(this.form, 'sourceType', sourceType);
-        // this.$set(this.form, 'sourceCode', tempIds);
-
-        await this.init({}, 'add');
-
-        this.getPlanData(data);
-        // if (sourceType == 2) {
-        //   this.changeContract(data);
-        // }
-        // if (sourceType == 3) {
-        //   this.changeOrder(data);
-        // }
-        // if (sourceType == 4 || sourceType == 5) {
-        //   this.payableManage(data);
-        // }
-      },
-
-      //对账单列表
-      createInvoice(
-        row = {},
-        invoiceType,
-        tableInfo = {},
-        isOtherSourceFlag = true,
-        dialogType = 'add'
-      ) {
-        this.dialogType = dialogType;
-        this.init(row, dialogType);
-        this.form.type = tableInfo.type;
-        this.$set(this.form, 'sourceType', invoiceType);
-        // this.form.sourceType=invoiceType
-        setTimeout(() => {
-          this.getAccountData(tableInfo);
-        }, 400);
-      },
-      //获取详情
-      async getInfo(id) {
-        this.form = await invoiceApplyInfoV2API(id);
-        this.$nextTick(() => {
-          this.$refs.tableInfoRef.putValue(this.form);
-        })
-      },
-
-      //获取分类管理中的数据
-      async getClassifyList(id, listName) {
-        let res = await getTreeByPid(id);
-        this[listName] = res.data;
-      },
-      //获取费用类别选中数据
-      changeFeeTypeInfo(val) {
-        if (!val) {
-          this.form.feeTypeName = '';
-          this.form.feeTypeCode = '';
-        }
-        let data = this.$refs.feeTypeTree?.$refs?.tree?.getCurrentNode() || {};
-        this.form.feeTypeName = data.name;
-        this.form.feeTypeCode = data.code;
-      },
-      //获取会计科目选中数据
-      changeSubjectInfo(val) {
-        if (!val) return (this.form.accountingSubjectName = '');
-        let data = this.$refs.treeSelect?.$refs?.tree?.getCurrentNode() || {};
-        this.form.accountingSubjectName = data.name;
-      },
-      // 获取部门数据
-      getDeptList() {
-        listOrganizations().then((list) => {
-          this.deptList = list;
-          this.deptTreeList = this.$util.toTreeData({
-            data: list,
-            idField: 'id',
-            parentIdField: 'parentId'
-          });
-        });
-      },
-      // 选择负责人部门
-      changeDeptInfo(id) {
-        const info = this.deptList.find((e) => e.id == id) || {};
-        this.form.applyDeptName = info.name;
-        this.form.applyUserId = '';
-        this.form.applyUserName = '';
-        this.getUserList(id);
-      },
-      // 获取人员数据
-      getUserList(deptId) {
-        if (deptId) {
-          this.$refs.directorRef.getList({ deptId });
-        }
-      },
-      //选择人员数据
-      changeUserInfo(val, info) {
-        this.form.applyUserName = info.name;
-      },
-
-      //
-      handleSelType(val) {
-        this.form = Object.assign({}, this.form, defForm);
-        if (val == 'isType') {
-          this.$set(this.form, 'sourceType', '');
-        }
-        this.form.receiptPayments = [];
-        this.$refs.tableInfoRef.clearTable();
-        this.enterpriseChange(this.enterprisePage[0]?.name);
-      },
-      setPrice(val) {
-        this.form.amount = val;
-      },
-      //系统公司信息
-      enterpriseChange(name) {
-        let data = this.enterprisePage.find((item) => item.name == name);
-
-        if (this.form.type == 2) {
-          this.form.companyName = data?.name;
-          this.form.companyUsc = data?.unifiedSocialCreditCode;
-          this.form.companyAddress = data?.address;
-          this.form.companyTel = data?.tel;
-          this.form.companyContactName = data?.contact;
-        } else {
-          this.form.receiverName = data?.name;
-          this.form.receiverAddress = data?.address;
-          this.form.salesCompanyUsc = data?.unifiedSocialCreditCode;
-          this.form.receiverTel = data?.tel;
-          this.form.receiverContactName = data?.contact;
-        }
-        this.$forceUpdate();
-      },
-
-      getValidate() {
-        console.log(this.form);
-        let arr = [
-          new Promise((resolve, reject) => {
-            this.$refs.form.validate((valid) => {
-              if (!valid) {
-                reject(false);
-              } else {
-                resolve(true);
-              }
-            });
-          })
-        ];
-       
-        // this.$refs.tableInfoRef.tableForm.detailList.forEach((item, index) => {
-        //   arr.push(
-        //     new Promise((resolve, reject) => {
-        //       this.$refs.tableInfoRef.$ref['form'+index].validateForm((valid) => {
-        //         if (!valid) {
-        //           reject(false);
-        //         } else {
-        //           resolve(true);
-        //         }
-        //       });
-        //     })
-        //   );
-        // })
-        return Promise.all(arr);
-      },
-
-      async handleSave(flag) {
-        // this.$refs.form.validate(async (valid) => {
-        try {
-          const valid = await this.getValidate();
-          console.log('valid~~~',valid);
-          // if (!valid) return this.$message.warning('有必填项未填,请检查');
-          
-          // if (this.form.sourceType != 4 || this.form.sourceType != 5) {
-          //   tableData = await this.$refs.table.getTableValidate();
-          // }
-          // // 校验表格数据
-          // const tableValid = await new Promise((resolve) => {
-          //   this.$refs.table.validateForm((valid) => {
-          //     resolve(valid);
-          //   });
-          // });
-          const tableValid = await this.$refs.tableInfoRef.getTableValidate();
-          console.log('tableValid~~~',tableValid);
-          // if (!tableValid) {
-          //   return;
-          // }
-
-          let tableData = this.$refs.tableInfoRef.getTableData();
-          // this.form.link = tableData.link;
-          this.form.productMap = tableData;
-          console.log('commitData~~~',this.form);
-          const API =
-            this.dialogType == 'add'
-              ? invoiceApplyCreateAPI
-              : invoiceApplyUpdateV2API;
-          const id = await API(this.form);
-          if (this.form.sourceType == 2) {
-            updateContractStatus([this.form.sourceId]);
-          }
-          if (flag) {
-            await this.handleSub(id);
-            return;
-          }
-          this.$message.success('操作成功');
-          this.done();
-          this.cancel();
-        // });
-        } catch (error) {
-          // this.$message.warning('有必填项未填,请检查');
-        }
-      },
-      //
-      handleSave1(flag) {
-        this.$refs.form.validate(async (valid) => {
-          if (!valid) return this.$message.warning('有必填项未填,请检查');
-          let tableData = {};
-          if (this.form.sourceType != 4 || this.form.sourceType != 5) {
-            tableData = await this.$refs.table.getTableValidate();
-          }
-          // 校验表格数据
-          const tableValid = await new Promise((resolve) => {
-            this.$refs.table.validateForm((valid) => {
-              resolve(valid);
-            });
-          });
-          if (!tableValid) {
-            return;
-          }
-          this.form.link = tableData.link;
-          this.form.detailList = tableData.detailList;
-          const API =
-            this.dialogType == 'add'
-              ? invoiceApplySaveAPI
-              : invoiceApplyUpdateV2API;
-          const id = await API(this.form);
-          if (this.form.sourceType == 2) {
-            updateContractStatus([this.form.sourceId]);
-          }
-          if (flag) {
-            await this.handleSub(id);
-            return;
-          }
-          this.$message.success('操作成功');
-          this.done();
-          this.cancel();
-        });
-      },
-      //提交-开启流程
-      async handleSub(id = '') {
-        let data = await invoiceApplyInfoV2API(this.businessId || id);
-        this.processSubmitDialogFlag = true;
-        let key =
-          data.type == 1 ? 'fin_invoice_apply' : 'fin_invoice_receive_apply';
-        this.$nextTick(() => {
-          let params = {
-            businessId: data.id,
-            businessKey: key,
-            formCreateUserId: data.createUserId,
-            variables: {
-              type: data.type,
-              businessCode: data.code,
-
-              businessName: data.companyName,
-              businessType: data.type == 1 ? '开票' : '收票'
-            }
-            // callBackMethodType : '1',
-            // callBackMethod : 'proTargetPlanApproveApiImpl.updatePlanApprovalStatus',
-            // pcHandle : '/bpm/handleTask/components/project-manage/plan-manage/submit.vue',
-            // pcView : '/bpm/handleTask/components/project-manage/plan-manage/detailDialog.vue',
-            // miniHandle : '',
-            // miniView : '',
-          };
-          this.$refs.processSubmitDialogRef.init(params);
-        });
-        // try {
-        //   await invoiceApplySubmit({
-        //     businessId: id || this.form.id,
-        //     type: this.form.type
-        //   });
-        // } catch (e) {
-        //   this.$message.error(e.message);
-        // }
-      },
-      reload() {
-        this.done();
-        this.cancel();
-      },
-      //刷新主列表数据
-      done() {
-        this.$emit('reload');
-      },
-      //关闭弹窗
-      cancel() {
-        this.$emit('update:addOrEditDialogFlag', false);
-      }
-    }
-  };
-</script>
-<style scoped lang="scss"></style>

+ 17 - 7
src/views/financialManage/invoiceManage/components/collectionPlanDialog.vue

@@ -126,7 +126,7 @@
   import dictMixins from '@/mixins/dictMixins';
   import tabMixins from '@/mixins/tableColumnsMixin';
   import accountInfoDialog from './accountInfoDialog.vue';
-  import { shippingModeOp, transactionMethodsOp, paymentStatus, paymentType, invoiceStatusOp } from '@/enum/dict.js';
+  import { shippingModeOp, transactionMethodsOp, paymentStatus, paymentType, invoiceStatusOp, paymentTypeOp, shippingModePurchaseOp } from '@/enum/dict.js';
   import { receiptPaymentPlanPage } from '@/api/financialManage/payAndCollectPlan';
   import customerList from '@/views/saleManage/contact/components/parentList.vue';
   import supplierList from '@/views/purchasingManage/supplierManage/components/parentList.vue';
@@ -161,6 +161,9 @@
       }
     },
     computed: {
+      shippingModeOptions() {
+        return this.type == 2 ? shippingModePurchaseOp : shippingModeOp;
+      },
       columns() {
         return [
           {
@@ -291,12 +294,12 @@
           },
           {
             prop: 'deliveryMode',
-            label: '发货模式',
+            label: this.type == 2 ? '收货模式' : '发货模式',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 130,
             formatter: (row) => {
-              return this.shippingModeOp.find(item => item.value == row.deliveryMode)?.label || '';
+              return this.shippingModeOptions.find(item => item.value == row.deliveryMode)?.label || '';
             }
           },
 
@@ -312,7 +315,10 @@
             label: '款项类型',
             align: 'center',
             showOverflowTooltip: true,
-            minWidth: 200
+            minWidth: 200,
+            formatter: (row) => {
+            return this.paymentTypeOp.find(item => item.value == row.paymentType)?.label || '';
+          }
           },
           {
             prop: 'moneyName',
@@ -326,7 +332,10 @@
             label: '比例',
             align: 'center',
             showOverflowTooltip: true,
-            minWidth: 140
+            minWidth: 140,
+            formatter: (row) => {
+              return row.paymentRatio + '%';
+            }
           },
           {
             prop: 'planPaymentAmount',
@@ -404,7 +413,7 @@
             align: 'center',
             showOverflowTooltip: true,
             formatter: (_row, _column, cellValue) => {
-              let options = this.menu === 'purchase' ? [
+              let options = this.type == 2 ? [
                 { value: 0, label: '待收货' },
                 { value: 1, label: '部分收货' },
                 { value: 2, label: '全部收货' }
@@ -507,7 +516,8 @@
         selection: [],
         paymentStatus,
         paymentType,
-        invoiceStatusOp
+        invoiceStatusOp,
+        paymentTypeOp
       };
     },
     created() {

+ 0 - 688
src/views/financialManage/invoiceManage/components/tableInfoNew copy 2.vue

@@ -1,688 +0,0 @@
-<template>
-  <div>
-    <el-tabs type="border-card">
-      <el-tab-pane :label="item.key" v-for="(item, idx) in tableForm.detailList" :key="idx">
-        <el-form :ref="'form' + idx" :model="tableForm">
-          <ele-pro-table
-            ref="table"
-            :needPage="false"
-            :columns="columns"
-            :datasource="item.details"
-            row-key="id"
-            class="time-form"
-          >
-            <template v-slot:toolbar>
-              <span>本次开票合计:{{ item.amountTotalPrice }}</span>
-            </template>
-            
-            <template v-slot:invoiceAmount="scope">
-            <el-form-item
-              style="width: 100%;"
-              :prop="'detailList.' + idx + '.details.' + scope.$index + '.invoiceAmount'"
-              :rules="[
-                {
-                  required: true,
-                  message: '请输入开票金额',
-                  trigger: 'blur'
-                },
-                {
-                  validator: (rule, value, callback) => {
-                    if (value === undefined || value === null || value === '') {
-                      callback('请输入开票金额');
-                    } else if (parseFloat(value) < 0 || parseFloat(value) > item.amountTotalPrice) {
-                      callback('开票金额不能小于0且小于等于本次开票合计');  
-                    } else {
-                      callback();
-                    }
-                  },
-                  trigger: 'blur'
-                }
-              ]"
-            > 
-              <span v-if="dialogType === 'view'">{{ scope.row.invoiceAmount }}</span>
-              <el-input v-else v-model="scope.row.invoiceAmount" type="number" @input="(val) => invoiceAmountChange(val, scope.row, idx, scope.$index)"></el-input>
-            </el-form-item>
-          </template>
-
-          <template v-slot:taxRate="scope">
-            <el-form-item
-              style="width: 100%;"
-              :prop="'detailList.' + idx + '.details.' + scope.$index + '.taxRate'"
-              :rules="[
-                {
-                  required: true,
-                  message: '请输入税率',
-                  trigger: 'blur'
-                },
-                {
-                  validator: (rule, value, callback) => {
-                    if (value === undefined || value === null || value === '') {
-                      callback('请输入税率');
-                    } else if (parseFloat(value) < 0) {
-                      callback('税率不能小于0');
-                    } else {
-                      callback();
-                    }
-                  },
-                  trigger: 'blur'
-                }
-              ]"
-            > 
-              <span v-if="dialogType === 'view'">{{ scope.row.taxRate }}</span>
-              <el-input v-else v-model="scope.row.taxRate" type="number" @input="getNotaxSinglePrice(scope.row, idx, scope.$index)" style="width: 80%;"></el-input>%
-            </el-form-item>
-          </template>
-
-          </ele-pro-table>
-        </el-form>
-      </el-tab-pane>
-    </el-tabs>
-    
-  </div>
-</template>
-<script>
-  export default {
-    name: 'tableInfo',
-    components: {},
-    props: {
-      form: {
-        type: Object,
-        default: () => {
-          return {
-            productMap: [],
-            receiptPayments: []
-          };
-        }
-      },
-      dialogType: {
-        type: String,
-        default: ''
-      },
-      isOtherSourceFlag: {
-        type: Boolean,
-        default: false
-      },
-      contactData: {
-        type: Object,
-        default: () => {
-          return {};
-        }
-      },
-      invoiceAmount: {
-        type: Number,
-        default: 0
-      }
-    },
-    data() {
-      return {
-        columns: [
-          {
-            width: 45,
-            type: 'index',
-            columnKey: 'index',
-            align: 'center',
-            fixed: 'left'
-          },
-
-          {
-            width: 100,
-            prop: 'typeName',
-            label: '类型',
-            slot: 'typeName',
-            align: 'center'
-          },
-          // {
-          //   minWidth: 100,
-          //   prop: 'sourceCode',
-          //   label: '类型编码',
-          //   slot: 'sourceCode',
-          //   align: 'center'
-          // },
-          // {
-          //   width: 100,
-          //   prop: 'productCategoryName',
-          //   label: '分类',
-          //   slot: 'productCategoryName',
-          //   align: "center"
-          // },
-          // {
-          //   width: 100,
-          //   prop: 'productCode',
-          //   label: '编码',
-          //   slot: 'productCode',
-          //   align: "center"
-          // },
-          {
-            minWidth: 100,
-            prop: 'productName',
-            label: '产品名称',
-            slot: 'productName',
-            align: 'center'
-          },
-          {
-            minWidth: 100,
-            prop: 'modelType',
-            label: '型号',
-            slot: 'modelType',
-            align: 'center'
-          },
-
-          {
-            minWidth: 100,
-            prop: 'specification',
-            label: '规格',
-            slot: 'specification',
-            align: 'center'
-          },
-          // {
-          //   width: 100,
-          //   prop: 'unInvoiceAmount',
-          //   label: '未开票金额',
-          //   slot: 'unInvoiceAmount',
-          //   align: "center"
-          // },
-          
-          // {
-          //   width: 80,
-          //   prop: 'singleWeight',
-          //   label: '单量',
-          //   align: 'center'
-          // },
-
-          {
-            minWidth: 150,
-            prop: 'invoiceAmount',
-            label: '开票金额',
-            slot: 'invoiceAmount',
-            align: 'center'
-          },
-          {
-            minWidth: 150,
-            prop: 'invoicedAmount',
-            label: '已开票金额',
-            align: 'center'
-          },
-          {
-            minWidth: 150,
-            prop: 'taxRate',
-            label: '税率',
-            align: 'center',
-            slot: 'taxRate',
-            // formatter: (_row, _column, cellValue) => {
-            //   return _row.taxRate
-            //     ? _row.taxRate+'%'
-            //     : '';
-            // },
-          },
-          {
-            minWidth: 100,
-            prop: 'noTaxSinglePrice',
-            label: '不含税单价',
-            slot: 'noTaxSinglePrice',
-            align: 'center'
-          },
-          {
-            width: 100,
-            prop: 'totalCount',
-            label: '订单数量',
-            // slot: 'totalCount',
-            align: 'center',
-          },
-          {
-            width: 150,
-            prop: 'quoteWay',
-            label: '报价方式',
-            formatter: (row, column) => {
-              return row.quoteWay == 1
-                ? '常规价'
-                : row.quoteWay == 2
-                ? '内部价'
-                : row.quoteWay == 3 ? '议价' : '';
-            },
-            align: 'center'
-
-          },
-          {
-            minWidth: 80,
-            prop: 'singlePrice',
-            label: '单价',
-            slot: 'singlePrice',
-            align: 'center'
-          },
-          {
-            width: 100,
-            prop: 'totalPrice',
-            label: '合计',
-            align: 'center'
-          },
-          {
-            width: 100,
-            prop: 'discountRatio',
-            label: '折让比例',
-            align: 'center'
-          },
-          {
-            width: 100,
-            prop: 'discountSinglePrice',
-            label: '折让单价',
-            align: 'center'
-          },
-          {
-            width: 100,
-            prop: 'discountAmount',
-            label: '折让合计',
-            align: 'center'
-          },
-          // {
-          //   width: 100,
-          //   prop: 'sourceType',
-          //   label: '来源类型',
-          //   slot: 'sourceType',
-          //   align: "center",
-          //   formatter: (row, column) => {
-          //     return row.sourceType == 2 ? '对账销售订单' : '对账采购订单';
-          //   }
-          // },
-        ],
-        tableForm: {
-          detailList: [
-            {
-              key: '',
-              amountTotalPrice: 0,
-              details: [{
-                invoicedAmount: '',
-                invoiceAmount: '',
-                taxRate: '',
-                noTaxSinglePrice: '',
-                totalCount: '',
-                quoteWay: '',
-                singlePrice: '',
-                totalPrice: '',
-                discountRatio: 100,
-                discountSinglePrice: '',
-                discountAmount: '',
-              }]
-            }
-          ],
-          productMap: [],
-          link: []
-        },
-        typeList: [
-          {
-            label: '销售发货',
-            value: '10'
-          },
-          {
-            label: '销售退货',
-            value: '11'
-          },
-          {
-            label: '采购收货',
-            value: '20'
-          },
-          {
-            label: '采购退货',
-            value: '21'
-          }
-        ],
-      };
-    },
-    mounted() {
-      // this.tableForm = this.form;
-    },
-    watch: {
-    form: {
-      handler(val) {
-        console.log('tableInfoNew form', val);
-        const data = JSON.parse(JSON.stringify(val));
-        data.detailList = data.productMap ? this.convertToArrayFormat(data) : [
-          {
-            key: '',
-            amountTotalPrice: 0,
-            details: []
-          }
-        ];
-        console.log('tableInfoNew detailList', data.detailList);
-        this.tableForm = data;
-      },
-      deep: true
-    }
-  },
-    methods: {
-      convertToArrayFormat(data) {
-          return Object.keys(data.productMap).map(key => {
-            console.log('key!!!', key);
-              const paymentItem = data.receiptPayments?.filter(item => item?.relatedOrderNo == key)|| [];
-              console.log('paymentItem', paymentItem);
-              return {
-                  key: key,
-                  amountTotalPrice: paymentItem.length ? paymentItem.reduce((acc, cur) => acc + cur.invoiceAmount, 0) : 0,
-                  defaultAmountTotalPrice: paymentItem.length ? paymentItem.reduce((acc, cur) => acc + cur.invoiceAmount, 0) : 0,
-                  details: data.productMap[key] || []
-              };
-          });
-      },
-      // 校验发票金额
-      invoiceAmountChange(val, item, idx, index) {
-        console.log('invoiceAmountChange', val, item, idx, index);
-        console.log('this.tableForm.detailList', this.tableForm.detailList)
-        if(index !=null) {
-          let newData = this.tableForm.detailList[idx].details;
-          console.log('newData', newData);
-          let sum =0;
-          newData.forEach((r) => {
-            if (r.invoiceAmount) {
-              sum += Number(r.invoiceAmount);
-            }
-          });
-          if(val && +val > +this.tableForm.detailList[idx].details[index].unInvoiceAmount) {
-            this.$message.error('物品开票金额不能大于未开票金额');
-            this.$set(this.tableForm.detailList[idx].details[index], 'invoiceAmount', '');
-            return;
-          }
-          if(sum > this.tableForm.detailList[idx].defaultAmountTotalPrice) {
-            this.$message.error('物品开票金额不能大于本次开票合计');
-            this.$set(this.tableForm.detailList[idx].details[index], 'invoiceAmount', '');
-            return;
-          }
-          this.$set(this.tableForm.detailList[idx].details[index], 'invoiceAmount', val);
-          this.$set(this.tableForm.detailList[idx], 'amountTotalPrice', sum);
-          console.log('sum', sum, this.tableForm.detailList[idx].details[index].invoiceAmount);
-        }
-      },
-      //计算不含税单价
-      getNotaxSinglePrice(item, idx, index) {
-        if (item.singlePrice && item.taxRate) {
-          this.$set(
-            this.tableForm.detailList[idx].details[index],
-            'noTaxSinglePrice',
-            parseFloat(
-              (item.singlePrice / (1 + item.taxRate / 100)).toFixed(2)
-            )
-          );
-        } else {
-          this.$set(this.tableForm.detailList[idx].details[index], 'noTaxSinglePrice', '');
-        }
-      },
-      //获取选择的对账单数据
-      async getAccountData(params) {
-        if (params.children.orderType == 6) {
-          this.tableForm.productMap = params.children.productMap;
-          this.tableForm.productMap.forEach((item, index) => {
-            item.sourceCode = params.children.orderNo;
-            item.sourceId = params.children.id;
-            item.sourceType = params.type == 1 ? 2 : 3;
-            item.type = 12;
-            item.singlePrice = item.discountSinglePrice;
-            item.totalPrice = item.discountTotalPrice;
-            item.typeName = '销售赔付';
-          });
-        } else {
-          this.tableForm.productMap = [];
-          params.children.subList.forEach((item, index) => {
-            item.productMap.forEach((i, n) => {
-              i.sourceCode = item.statementSubOrderCode;
-              i.sourceId = params.children.id;
-              i.sourceType = params.type == 1 ? 2 : 3;
-              i.type = item.subType;
-              console.log(item.subType);
-              i.typeName = this.typeList.find(
-                (i) => i.value == item.subType
-              ).label;
-              // i.singlePrice = item.discountSinglePrice
-              i.totalPrice = i.discountTotalPrice;
-            });
-            this.tableForm.productMap.push(...item.productMap);
-          });
-          this.$refs.table.reload();
-        }
-        this.$emit(
-          'setPrice',
-          params.children.amountTotalPrice - this.invoiceAmount
-        );
-        let row = {
-          id: params.id,
-          name: params.statementNo,
-          code: params.statementNo,
-          linkType: params.type == 1 ? 190 : 290,
-          linkTypeName: params.type == 1 ? '销售对账单' : '采购对账单'
-        };
-        this.setSelectData(row);
-      },
-      putValue(data) {
-        let tempData = JSON.parse(JSON.stringify(data));
-        console.log('tableInfoNew putValue', tempData);
-        tempData.detailList = this.convertToArrayFormat(tempData);
-        console.log('data.detailList', data.detailList);
-        this.tableForm = tempData;
-        console.log('tableInfoNew putValue~~~', this.tableForm);
-      },
-      setValue(data) {
-        let tempData = JSON.parse(JSON.stringify(data));
-        tempData.detailList = this.convertToArrayFormat(tempData);
-        this.allocateInvoiceAmount(tempData.detailList);
-        // for(let item of tempData.detailList) {
-        //   const total = item.amountTotalPrice;
-        //   const details = item.details;
-        //   const count = details.length;
-          
-        //   if (count === 0) continue;
-          
-        //   // 计算基础金额(向下取整)
-        //   const baseAmount = Math.floor(total / count);
-        //   // 计算余数
-        //   const remainder = total - (baseAmount * count);
-          
-        //   // 为所有项设置基础金额
-        //   details.forEach((detail) => {
-        //     detail.invoiceAmount = baseAmount;
-        //   });
-          
-        //   // 将余数加到最后一项
-        //   if (remainder > 0 && details.length > 0) {
-        //     details[details.length - 1].invoiceAmount += remainder;
-        //   }
-        // }
-        // this.$set(this, 'tableForm', data);
-        this.tableForm = tempData;
-        // console.log('tableInfoNew detailList~~~', tempData.detailList);
-        // this.$refs.table.reload();
-      },
-      /**
-       * 分配开票金额到明细项(根据未开票金额unInvoiceAmount限制)
-       * @param {Array|Object} data - 明细列表或单个明细对象
-       * @returns {Array|Object} 处理后的数据
-       */
-      allocateInvoiceAmount(data) {
-        if (Array.isArray(data)) {
-          data.forEach(item => {
-            if (item && typeof item === 'object') {
-              this.allocateSingleInvoiceAmount(item);
-            }
-          });
-          return data;
-        } else if (data && typeof data === 'object') {
-          this.allocateSingleInvoiceAmount(data);
-          return data;
-        }
-        return data;
-      },
-      allocateSingleInvoiceAmount(item) {
-        let remainingTotal = this.toPrecision(item.amountTotalPrice);
-        const details = item.details || [];
-        
-        details.forEach((detail) => {
-          if (remainingTotal <= 0) {
-            detail.invoiceAmount = 0;
-          } else {
-            const unInvoiceAmount = this.toPrecision(detail.unInvoiceAmount);
-            
-            if (remainingTotal > unInvoiceAmount) {
-              detail.invoiceAmount = this.fromPrecision(unInvoiceAmount);
-              remainingTotal = this.subPrecision(remainingTotal, unInvoiceAmount);
-            } else {
-              detail.invoiceAmount = this.fromPrecision(remainingTotal);
-              remainingTotal = 0;
-            }
-          }
-        });
-      },
-      toPrecision(value) {
-        const num = parseFloat(value) || 0;
-        return Math.round(num * 100);
-      },
-      fromPrecision(value) {
-        const num = parseFloat(value) || 0;
-        return (num / 100).toFixed(2);
-      },
-      subPrecision(a, b) {
-        return a - b;
-      },
-
-      setSinglePrice(row, data) {
-        let index = this.tableForm.detailList.findIndex(item => item.key == row.relatedOrderNo);
-        // let detail = this.tableForm.detailList[index];
-        // console.log('tableInfoNew setPrice', row, data, index);
-        const paymentItem = data.filter(item => item?.relatedOrderNo == row.relatedOrderNo);
-        console.log('tableInfoNew~~~', this.tableForm.detailList[index]);
-        this.tableForm.detailList[index].amountTotalPrice = paymentItem.length ? paymentItem.reduce((acc, cur) => acc + +cur.invoiceAmount, 0) : 0;
-        this.tableForm.detailList[index].defaultAmountTotalPrice = paymentItem.length ? paymentItem.reduce((acc, cur) => acc + +cur.invoiceAmount, 0) : 0;
-        // console.log('tableInfoNew tableForm', this.tableForm.detailList);
-        // 直接修改对象,不需要赋值
-        this.allocateInvoiceAmount(this.tableForm.detailList[index]);
-
-        this.tableForm = {...this.tableForm};
-        this.$forceUpdate();
-      },
-      clearTable() {
-        this.tableForm = {
-          detailList: [],
-          productMap: [],
-          receiptPayments: [],
-          link: []
-        };
-      },
-      // 当数量变化时更新金额
-      updateTotalPrice(row) {
-        if (row.totalCount && row.singlePrice) {
-          row.totalPrice = (parseFloat(row.totalCount) * parseFloat(row.singlePrice)).toFixed(2);
-        }
-      },
-      getTableValidate() {
-        return new Promise(async (resolve, reject) => {
-          // 2. 验证每个表格表单
-          const validationPromises = [];
-          this.tableForm.detailList.forEach((item, index) => {
-            validationPromises.push(
-              new Promise((formResolve, formReject) => {
-                // 正确获取表单实例
-                const formInstance = this.$refs['form' + index];
-                
-                if (formInstance) {
-                  // 确保formInstance有validate方法
-                  if (typeof formInstance.validate === 'function') {
-                    formInstance.validate((valid, errors) => {
-                      if (!valid && errors) {
-                        // 显示第一个错误信息
-                        const firstError = Object.values(errors)[0][0];
-                        if (firstError) {
-                          this.$message.warning(firstError.message);
-                        }
-                        formReject(false);
-                      } else {
-                        formResolve(true);
-                      }
-                    });
-                  } else {
-                    // 如果没有validate方法,检查是否是数组(多个表单实例)
-                    if (Array.isArray(formInstance) && formInstance.length > 0) {
-                      const firstForm = formInstance[0];
-                      if (typeof firstForm.validate === 'function') {
-                        firstForm.validate((valid, errors) => {
-                          if (!valid && errors) {
-                            const firstError = Object.values(errors)[0][0];
-                            if (firstError) {
-                              this.$message.warning(firstError.message);
-                            }
-                            formReject(false);
-                          } else {
-                            formResolve(true);
-                          }
-                        });
-                      } else {
-                        formResolve(true); // 没有validate方法时默认通过
-                      }
-                    } else {
-                      formResolve(true); // 不是预期的表单实例时默认通过
-                    }
-                  }
-                } else {
-                  formResolve(true); // 表单不存在时默认通过
-                }
-              })
-            );
-          });
-
-          console.log('validationPromises~~~',validationPromises);
-          
-          // 3. 处理验证结果
-          try {
-            await Promise.all(validationPromises);
-            
-            // 4. 校验 amountTotalPrice 和 defaultAmountTotalPrice 是否相等
-            for (let i = 0; i < this.tableForm.detailList.length; i++) {
-              const item = this.tableForm.detailList[i];
-              const amountTotalPrice = parseFloat(item.amountTotalPrice) || 0;
-              const defaultAmountTotalPrice = parseFloat(item.defaultAmountTotalPrice) || 0;
-              
-              if (amountTotalPrice !== defaultAmountTotalPrice) {
-                this.$message.warning(`第${i + 1}条本次开票合计(${amountTotalPrice})必须等于本次开票金额合计(${defaultAmountTotalPrice})`);
-                reject(false);
-                return;
-              }
-            }
-            
-            resolve(this.tableForm);
-            console.log('this.tableForm~~~',this.tableForm);
-          } catch (error) {
-            reject(false);
-          }
-        });
-      },
-      validateForm(callback) {
-        //开始表单校验
-        this.$refs.form.validate((valid, obj) => {
-          if (obj) {
-            let messages = Object.keys(obj).map((key) => obj[key][0]);
-            if (messages.length > 0) {
-              this.$message.warning(messages[0].message);
-            }
-          }
-          callback(valid);
-        });
-      },
-      setSelectData(val) {
-        this.tableForm.link = [{}];
-        this.$set(this.tableForm.link[0], 'linkId', val.id);
-        this.$set(this.tableForm.link[0], 'linkName', val.name);
-        this.$set(this.tableForm.link[0], 'linkCode', val.code);
-        this.$set(this.tableForm.link[0], 'linkType', val.linkType);
-        this.$set(this.tableForm.link[0], 'linkTypeName', val.linkTypeName);
-      },
-      getTableData() {
-        const  data = JSON.parse(JSON.stringify(this.tableForm.detailList));
-        const transformedData = data.reduce((result, item) => {
-          result[item.key] = item.details;
-          return result;
-        }, {});
-        return transformedData;
-      }
-    }
-  };
-</script>
-
-<style scoped lang="scss">
-.time-form .el-form-item {
-  margin-bottom: 0 !important;
-}
-</style>

+ 2 - 3
src/views/financialManage/invoiceManage/components/tableInfoNew.vue

@@ -327,9 +327,10 @@
     },
     computed: {
       totalAmountTotalPrice() {
-        return this.tableForm.detailList.reduce((total, item) => {
+        let tempTotal = this.tableForm.detailList.reduce((total, item) => {
           return total + (parseFloat(item.invoiceAmount) || 0);
         }, 0);
+        return tempTotal.toFixed(2);
       }
     },
     mounted() {
@@ -358,7 +359,6 @@
           });
 
           if(type == 'setValue') {
-            // Allocate defaultAmountTotalPrice to invoiceAmount for each key group
             const uniqueKeys = [...new Set(result.map(item => item.key))];
             uniqueKeys.forEach(key => {
               const sameKeyItems = result.filter(item => item.key === key);
@@ -437,7 +437,6 @@
         let tempData = JSON.parse(JSON.stringify(data));
         console.log('tableInfoNew putValue', tempData);
         tempData.detailList = this.convertToArrayFormat(tempData, 'putValue');
-        console.log('data.detailList', data.detailList);
         this.tableForm = tempData;
         console.log('tableInfoNew putValue~~~', this.tableForm);
       },

+ 1 - 1
src/views/financialManage/payableManage/components/paymentListDialog.vue

@@ -50,7 +50,7 @@
 <script>
   import { finPayablePageListAPI } from '@/api/financialManage/payableManage';
   import detailDialog1 from './detailDialog1.vue';
-  import { paymentStatus, invoiceStatusOp, transactionMethodsOp } from '@/enum/dict.js';
+  import { paymentType, invoiceStatusOp, transactionMethodsOp } from '@/enum/dict.js';
   import { reviewStatus } from '@/enum/dict';
   export default {
     name: 'collectionDialog',

+ 2 - 1
src/views/financialManage/receivableManage/components/infoTable.vue

@@ -103,6 +103,7 @@
               :controls="false"
               :precision="2"
               :min="0.0"
+              style="width: 95%"
             ></el-input-number>
           </el-form-item>
         </template>
@@ -349,7 +350,7 @@
             0
           );
           this.unreceiveTotalPrice =
-            this.form.receivableTotalPrice - this.receivedTotalPrice;
+            Number((this.form.receivableTotalPrice - this.receivedTotalPrice).toFixed(2));
         });
       },
       handleDelInfo(index) {

+ 24 - 14
src/views/purchasingManage/inquiryManage/components/addDialog.vue

@@ -184,6 +184,7 @@
   import _ from 'lodash';
   // import fileMain from '@/components/addDoc/index.vue';
   import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
+  import { orderSourceType } from '@/enum/dict';
 
   export default {
     name: 'eomInquiryManageAddDialog',
@@ -293,7 +294,7 @@
           [...data.detailList].forEach((item) => {
             item.supplierList = supplierObj[item.productId] || [];
           });
-          this.list = [...data.detailList, ...data.rawList, ...data.outputList];
+          this.list = orderSourceType.includes(this.form.sourceType) ? [...data.detailList, ...data.rawList, ...data.outputList] : [...data.detailList];
           this.rawList = data.rawList;
           this.outputList = data.outputList;
           this.$nextTick(() => {
@@ -331,7 +332,9 @@
             }
             item.supplierList = supplierObj[item.productId] || [];
             if (item.supplierList?.length) {
-              item.supplierIds =item.supplierId?[item.supplierId]:[item.supplierList[0].id];
+              item.supplierIds = item.supplierId
+                ? [item.supplierId]
+                : [item.supplierList[0].id];
               // this.supplierSelect(item);
             }
           });
@@ -341,6 +344,7 @@
           this.form.planName = data.planName;
           this.form.isFirstProcess = data.isFirstProcess;
           this.form.inquiryName = data.planName;
+          this.form.sourceType = data.sourceType;
 
           // if (type == 'change') {
           //   this.supplierList.forEach((item) => {
@@ -352,11 +356,15 @@
           if (type == 'init') {
             return;
           }
-          this.list = [
-            ...data.detailList,
-            ...data.rawDetailList,
-            ...data.outputDetailList
-          ];
+          if(orderSourceType.includes(this.form.sourceType)){
+            this.list = [
+              ...data.detailList,
+              ...data.rawDetailList,
+              ...data.outputDetailList
+            ];
+          } else {
+            this.list = [...data.detailList];
+          }
           data.detailList.forEach((item) => {
             item.isWinner = 1;
           });
@@ -457,7 +465,7 @@
         });
       },
       async supplierSelect(row) {
-        console.log(row)
+        console.log(row);
         // if (!row) {
         //   this.$message.warning('请选择供应商');
         //   return;
@@ -634,13 +642,15 @@
           if (!this.isUpdate) {
             delete this.form.id;
           }
-
+          console.log('orderSourceType~~~', orderSourceType, this.form.sourceType);
           this.form.supplierList.forEach((item) => {
-            item.resultList = [
-              ...item.resultList,
-              ...this.rawList,
-              ...this.outputList
-            ];
+            if (orderSourceType.includes(this.sourceType)) {
+              item.resultList = [
+                ...item.resultList,
+                ...this.rawList,
+                ...this.outputList
+              ];
+            }
           });
           let supplierIds = this.form.supplierList.map(
             (item) => item.supplierId

+ 8 - 8
src/views/purchasingManage/purchaseOrder/accountstatement/components/addAccountDialog.vue

@@ -149,10 +149,10 @@
       async getInfo(row) {
         let data = await accountstatementInfoAPI(row.id);
         // this.recorpayList = data.recorpayList || [];
-        data.orderTotalAmount = data.orderList.reduce((pre, cur) => pre + +cur.orderAmount, 0);
-        data.amountTotalPrice = data.orderList.reduce((pre, cur) => pre + +cur.amountTotalPrice, 0);
-        data.amountCompletePrice = data.orderList.reduce((pre, cur) => pre + +cur.statementAmount, 0);
-        data.amountUnCompletePrice = data.orderList.reduce((pre, cur) => pre + +cur.unStatementAmount, 0);
+        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.datasource = data.orderList || [];
         this.dataForm = data;
         switch (this.dataForm.dateType) {
@@ -204,10 +204,10 @@
           // amountTotalPrice: data.amountTotalPrice,
           // amountPayablePass: data.amountPayablePass,
           // amountReceivablePass: data.amountReceivablePass
-          orderTotalAmount: data.reduce((pre, cur) => pre + +cur.orderAmount, 0),
-          amountTotalPrice: data.reduce((pre, cur) => pre + +cur.amountTotalPrice, 0),
-          amountCompletePrice: data.reduce((pre, cur) => pre + +cur.statementAmount, 0),
-          amountUnCompletePrice: data.reduce((pre, cur) => pre + +cur.unStatementAmount, 0)
+          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
         };
         // if (!this.datasource.length) this.$message.warning('暂无订单信息');
       },

+ 5 - 4
src/views/purchasingManage/purchaseOrder/accountstatement/components/detailDialog.vue

@@ -37,7 +37,7 @@
       <headerTitle title="对账明细" style="margin-top: 30px">
         <template v-slot>
           <el-row style="font-weight: 700; color: red">
-            <span>总金额:</span>
+            <span>订单总金额:</span>
             <span>{{ dataForm.orderTotalAmount || 0 }}</span>
             <el-divider direction="vertical"></el-divider>
             <span>已对账金额:</span>
@@ -115,9 +115,10 @@
         this.dialogType = dialogType;
         this.dataForm.type = type;
         let data = await accountstatementInfoAPI(row.id);
-        data.amountTotalPrice = data.orderList.reduce((pre, cur) => pre + +cur.amountTotalPrice, 0),
-        data.amountCompletePrice = data.orderList.reduce((pre, cur) => pre + +cur.statementAmount, 0),
-        data.amountUnCompletePrice = data.orderList.reduce((pre, cur) => pre + +cur.unStatementAmount, 0)
+        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.datasource = data.orderList||[];
         this.recorpayList = data.recorpayList || [];
         this.dataForm = data;

+ 9 - 6
src/views/purchasingManage/purchaseOrder/accountstatement/components/searchTable.vue

@@ -3,14 +3,16 @@
   <seekPage :seekList="seekList" :formLength="3" @search="search"></seekPage>
 </template>
 <script>
-import { receiptType, reviewStatusSelect } from '@/enum/dict';
+import { receiptType, reviewStatusSelect, reconciliationType } from '@/enum/dict';
 import {
 
   assessmentIndicatorsOptions
 } from '@/views/targetManage/util.js';
 export default {
   data() {
-    return {};
+    return {
+
+    };
   },
   computed: {
     // 表格列配置
@@ -37,9 +39,10 @@ export default {
         {
           label: '对账方式:',
           value: 'dateType',
-          width: 380,
-          type: 'input',
-          placeholder: '请输入',
+          // width: 380,
+          placeholder: '请选择',
+          type: 'select',
+          planList: reconciliationType
         },
         // {
         //   label: '对账开始日期:',
@@ -83,7 +86,7 @@ export default {
         {
           label: '状态:',
           value: 'reviewStatus',
-          width: 380,
+          // width: 380,
           type: 'select',
           placeholder: '请选择状态',
           planList: reviewStatusSelect

+ 6 - 6
src/views/purchasingManage/purchaseOrder/accountstatement/index.vue

@@ -91,6 +91,11 @@
             <el-popconfirm
               class="ele-action"
               title="确定要删除此信息吗?"
+              v-if="
+                  (isNeed_process_is_close &&
+                    [0, 3].includes(row.reviewStatus)) ||
+                  !isNeed_process_is_close
+                "
               @confirm="remove([row.id])"
             >
               <template v-slot:reference>
@@ -98,11 +103,6 @@
                   type="danger"
                   :underline="false"
                   icon="el-icon-delete"
-                  v-if="
-                    (isNeed_process_is_close &&
-                      [0, 3].includes(row.reviewStatus)) ||
-                    !isNeed_process_is_close
-                  "
                 >
                   删除
                 </el-link>
@@ -289,7 +289,7 @@
           },
           {
             prop: 'amountTotalPrice',
-            label: '总金额',
+            label: '订单总金额',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 130

+ 11 - 5
src/views/purchasingManage/purchaseOrder/components/addDialogNew.vue

@@ -300,6 +300,7 @@
             <el-date-picker
               style="width: 100%"
               v-model="form.settlementDate"
+              :clearable="false"
               type="daterange"
               value-format="yyyy-MM-dd"
               range-separator="至"
@@ -320,6 +321,7 @@
             <el-date-picker
               v-model="form.settlementDate"
               type="monthrange"
+              :clearable="false"
               range-separator="至"
               start-placeholder="开始月份"
               end-placeholder="结束月份"
@@ -2164,15 +2166,19 @@
             return;
           }
 
-          let receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.price, 0);
+          // 使用分进行计算,避免浮点数精度问题
+          let receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 100), 0) / 100;
           const payAmount = +commitData.payAmount;
           
           if(+ratioSum == 100) {
-            const difference = payAmount - receiptPaymentListSum;
-            if (Math.abs(difference) > 0.01 && commitData.receiptPaymentList.length > 0) {
+            // 使用分进行计算,避免浮点数精度问题
+            const difference = Math.round((payAmount - receiptPaymentListSum) * 100) / 100;
+            if (Math.abs(difference) >= 0.01 && commitData.receiptPaymentList.length > 0) {
               const lastIndex = commitData.receiptPaymentList.length - 1;
-              commitData.receiptPaymentList[lastIndex].price = (+commitData.receiptPaymentList[lastIndex].price + difference).toFixed(2);
-              receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.price, 0);
+              // 使用分进行计算,避免浮点数精度问题
+              const newPrice = Math.round((+commitData.receiptPaymentList[lastIndex].price + difference) * 100) / 100;
+              commitData.receiptPaymentList[lastIndex].price = newPrice.toFixed(2);
+              receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 100), 0) / 100;
             }
           }
 

+ 19 - 9
src/views/saleManage/saleOrder/accountstatement/components/addAccountDialog.vue

@@ -26,7 +26,7 @@
       <headerTitle title="对账明细" style="margin-top: 30px">
         <template v-slot>
           <el-row style="font-weight: 700; color: red">
-            <span>总金额:</span>
+            <span>订单总金额:</span>
             <span>{{ dataForm.orderTotalAmount || 0 }}</span>
             <el-divider direction="vertical"></el-divider>
             <span>已对账金额:</span>
@@ -51,6 +51,7 @@
         :dataForm="dataForm"
         :datasource.sync="datasource"
         :dialogType="dialogType"
+        @changeDiscountPrice="changeDiscountPrice"
       ></inventoryTable>
     </div>
     <div slot="footer" class="footer">
@@ -158,6 +159,14 @@
     },
     computed: {},
     methods: {
+      changeDiscountPrice(price, tableIndex) {
+        console.log('price~~~', price, tableIndex)
+        this.datasource[tableIndex].statementAmount = price;
+        this.datasource[tableIndex].unStatementAmount = price;
+        console.log('this.datasource', this.datasource)
+        this.dataForm.amountTotalPrice = this.datasource.reduce((pre, cur) => pre + Math.round(+cur.statementAmount * 100), 0) / 100;
+        this.dataForm.amountUnCompletePrice = this.datasource.reduce((pre, cur) => pre + Math.round(+cur.unStatementAmount * 100), 0) / 100;
+      },
       open(dialogType, row, type = '') {
         this.dialogType = dialogType;
         this.title =
@@ -184,10 +193,11 @@
       async getInfo(row) {
         let data = await accountstatementInfoAPI(row.id);
         // this.recorpayList = data.recorpayList || [];
-        data.orderTotalAmount = data.orderList.reduce((pre, cur) => pre + +cur.orderAmount, 0);
-        data.amountTotalPrice = data.orderList.reduce((pre, cur) => pre + +cur.amountTotalPrice, 0);
-        data.amountCompletePrice = data.orderList.reduce((pre, cur) => pre + +cur.statementAmount, 0);
-        data.amountUnCompletePrice = data.orderList.reduce((pre, cur) => pre + +cur.unStatementAmount, 0);
+        // 解决小数精度丢失问题,使用分进行计算
+        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 {
@@ -270,10 +280,10 @@
             // amountTotalPrice: data.amountTotalPrice,
             // amountPayablePass: data.amountPayablePass,
             // amountReceivablePass: data.amountReceivablePass
-            orderTotalAmount: data.reduce((pre, cur) => pre + +cur.orderAmount, 0),
-            amountTotalPrice: data.reduce((pre, cur) => pre + +cur.amountTotalPrice, 0),
-            amountCompletePrice: data.reduce((pre, cur) => pre + +cur.statementAmount, 0),
-            amountUnCompletePrice: data.reduce((pre, cur) => pre + +cur.unStatementAmount, 0)
+            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) {

+ 6 - 5
src/views/saleManage/saleOrder/accountstatement/components/detailDialog.vue

@@ -28,14 +28,14 @@
         </div>
       </div>
     </el-card>
-    <div v-if="activeComp==='main'">
+    <div v-show="activeComp==='main'">
       <!--销售表单表单-->
       <sale-form :dataForm.sync="dataForm" :datasource.sync="datasource"
                  dialogType="view"></sale-form>
       <headerTitle title="对账明细" style="margin-top: 30px">
         <template v-slot>
           <el-row style="font-weight: 700; color: red">
-            <span>总金额:</span>
+            <span>订单总金额:</span>
             <span>{{ dataForm.orderTotalAmount || 0 }}</span>
             <el-divider direction="vertical"></el-divider>
             <span>已对账金额:</span>
@@ -110,9 +110,10 @@ export default {
 
       this.datasource = data.orderList
       // this.recorpayList = data.recorpayList || [];
-      data.amountTotalPrice = data.orderList.reduce((pre, cur) => pre + +cur.amountTotalPrice, 0),
-      data.amountCompletePrice = data.orderList.reduce((pre, cur) => pre + +cur.statementAmount, 0),
-      data.amountUnCompletePrice = data.orderList.reduce((pre, cur) => pre + +cur.unStatementAmount, 0)
+      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:

+ 18 - 10
src/views/saleManage/saleOrder/accountstatement/components/inventoryTable.vue

@@ -82,9 +82,9 @@
             <div class="collapse-title-left"><span class="collapse-title-index">{{ index + 1 }}</span> {{ type === 'purchase' ? '采购订单' : '销售订单' }}:{{ item.orderNo }}</div>
             <div class="collapse-title-right">
               <span>订单金额:{{ item.orderAmount || 0 }}元</span>
-              <span>已对账金额:{{ item.statementAmount || 0 }}元</span>
+              <span>已对账金额:{{ item.statementedAmount || 0 }}元</span>
               <span>未对账金额:{{ item.unStatementAmount || 0 }}元</span>
-              <span>本次对账金额:{{ item.amountTotalPrice || 0 }}元</span>
+              <span>本次对账金额:{{ item.statementAmount || 0 }}元</span>
             </div>
           </div>
         </template>
@@ -116,8 +116,8 @@
                       <el-input
                         v-model="scope.row.singlePrice"
                         placeholder="请输入"
-                        @input="changeCount(scope.row, scope.$index)"
-                        :disabled="item.orderCategory != 4"
+                        @input="changeCount(scope.row, scope.$index, item, index)"
+                        :disabled="item.orderCategory != 4 || dialogType === 'view'"
                         type="number"
                       >
                         <template slot="append">元</template>
@@ -139,7 +139,7 @@
                         placeholder="请输入"
                         type="number"
                         @input="getNotaxSinglePrice(scope.row, scope.$index)"
-                        :disabled="item.orderCategory != 4"
+                        :disabled="item.orderCategory != 4 || dialogType === 'view'"
                       >
                         <template slot="append">%</template>
                       </el-input>
@@ -161,8 +161,8 @@
                         type="number"
                         :min="0"
                         :max="100"
-                        :disabled="item.orderCategory != 4"
-                        @input="getDiscountRatioPrice(scope.row, scope.$index)"
+                        :disabled="item.orderCategory != 4 || dialogType === 'view'"
+                        @input="getDiscountRatioPrice(scope.row, scope.$index, item, index)"
                       >
                         <template slot="append">%</template>
                       </el-input>
@@ -629,7 +629,7 @@ export default {
   },
   methods: {
     //改变数量
-      changeCount(item, index) {
+      changeCount(item, index, row, tableIndex) {
         console.log('changeCount~~~', item)
         console.log('this.datasource[index]~~~', this.datasource[index])
         // row.totalPrice = parseFloat((item.totalCount * item.singlePrice).toFixed(2))
@@ -645,7 +645,7 @@ export default {
           item.totalPrice = ''
         }
         this.getNotaxSinglePrice(item, index);
-        this.getDiscountRatioPrice(item, index);
+        this.getDiscountRatioPrice(item, index, row, tableIndex);
         this.$forceUpdate();
         // if (this.clientEnvironmentId == 4 && !isBlockCount) {
         //   this.tableHandleKeyUp(row, index, 'sum');
@@ -675,7 +675,7 @@ export default {
       },
 
       // 计算折让单价,折让总价
-      getDiscountRatioPrice(item, index) {
+      getDiscountRatioPrice(item, index, row, tableIndex) {
 
           if (item.singlePrice && item.discountRatio) {
             // this.$set(
@@ -706,6 +706,14 @@ export default {
             item.discountSinglePrice = ''
             item.discountTotalPrice = ''
           }
+          console.log('row~~~', row, tableIndex)
+          row.unStatementAmount = this.datasource[tableIndex].deliveryProducts.reduce((prev, curr) => {
+            return prev + Number(curr.discountTotalPrice || 0)
+          }, 0)
+          row.statementAmount = this.datasource[tableIndex].deliveryProducts.reduce((prev, curr) => {
+            return prev + Number(curr.discountTotalPrice || 0)
+          }, 0)
+          this.$emit('changeDiscountPrice', row.statementAmount, tableIndex)
       },
     remove(tableIndex, lineIndex, delType) {
       let params = {

+ 1 - 1
src/views/saleManage/saleOrder/accountstatement/index.vue

@@ -309,7 +309,7 @@
           },
           {
             prop: 'amountTotalPrice',
-            label: '总金额',
+            label: '订单总金额',
             align: 'center',
             showOverflowTooltip: true,
             minWidth: 130

+ 14 - 7
src/views/saleManage/saleOrder/components/addDialogNew.vue

@@ -326,6 +326,7 @@
               style="width: 100%"
               v-model="form.settlementDate"
               type="daterange"
+              :clearable="false"
               value-format="yyyy-MM-dd"
               range-separator="至"
               start-placeholder="开始日期"
@@ -344,6 +345,7 @@
             </el-date-picker> -->
             <el-date-picker
               v-model="form.settlementDate"
+              :clearable="false"
               type="monthrange"
               range-separator="至"
               start-placeholder="开始月份"
@@ -1932,15 +1934,20 @@
               return;
             }
 
-            let receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.price, 0);
+            // 使用分进行计算,避免浮点数精度问题
+            let receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 100), 0) / 100;
             const payAmount = +commitData.payAmount;
             
             if(+ratioSum == 100) {
-              const difference = payAmount - receiptPaymentListSum;
-              if (Math.abs(difference) > 0.01 && commitData.receiptPaymentList.length > 0) {
+              // 使用分进行计算,避免浮点数精度问题
+              const difference = Math.round((payAmount - receiptPaymentListSum) * 100) / 100;
+              console.log('difference~~~', difference);
+              if (Math.abs(difference) >= 0.01 && commitData.receiptPaymentList.length > 0) {
                 const lastIndex = commitData.receiptPaymentList.length - 1;
-                commitData.receiptPaymentList[lastIndex].price = (+commitData.receiptPaymentList[lastIndex].price + difference).toFixed(2);
-                receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.price, 0);
+                // 使用分进行计算,避免浮点数精度问题
+                const newPrice = Math.round((+commitData.receiptPaymentList[lastIndex].price + difference) * 100) / 100;
+                commitData.receiptPaymentList[lastIndex].price = newPrice.toFixed(2);
+                receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 100), 0) / 100;
               }
             }
 
@@ -2089,9 +2096,9 @@
         }
         if(this.form.settlementMode == 2) {
         //   // this.transformMonth(val)
-          dateRange = this.transformMonthFun(val);
+          dateRange = this.transformMonthFun(val, this.form.receiptDate);
         }
-        // console.log('dateRange~~~', dateRange);
+        console.log('dateRange~~~', dateRange);
         this.$set(this.form, 'issueNumber', dateRange.length);
         // this.setDefaultList(dateRange)
         this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, this.form.issueNumber, dateRange);

+ 10 - 4
src/views/saleManage/saleOrder/invoice/components/inventoryTable.vue

@@ -803,8 +803,7 @@
           //   slot: 'measuringUnit',
           //   align: 'center'
           // },
-          this.clientEnvironmentId == 4
-            ? {
+          this.clientEnvironmentId == 4 ? {
                 width: 150,
                 prop: 'blockCount',
                 label: '发货块数',
@@ -1282,8 +1281,15 @@
           let modeHight = modelArr[2].substr(0, modelArr[2].indexOf('cm')); // model规格高度
           modeHight = Number(modeHight);
           if (name === 'sum') {
-            row.blockCount = Math.floor(
-              row.totalCount / ((modelLong * modeWide * modeHight) / 1000000)
+            // row.blockCount = Math.floor(
+            //   row.totalCount / ((modelLong * modeWide * modeHight) / 1000000)
+            // );
+            this.$set(
+              this.form.datasource[index],
+              'blockCount',
+              Math.floor(
+                row.totalCount / ((modelLong * modeWide * modeHight) / 1000000)
+              )
             );
           } else if (name === 'blockCount') {
             row.totalCount =