Bläddra i källkod

feat: 销售发票

liujt 1 månad sedan
förälder
incheckning
8f87aca713

+ 8 - 1
src/BIZComponents/collectTableForm/index.vue

@@ -48,6 +48,9 @@
             />
           </el-form-item>
         </template>
+        <template v-slot:columnRequired="{ column }">
+          <span class="is-required">{{ column.label }}</span>
+        </template>
         <!-- 已收金额 -->
         <template v-slot:receivedTotalPrice="{ row: r, $index }">
           <el-form-item
@@ -76,8 +79,9 @@
               dictName="支付类型"
               placeholder="请选择"
               class="payment-select"
-              :disabled="isView || r?.id"
+              
             />
+            <!-- :disabled="isView || r?.id" -->
           </el-form-item>
         </template>
         <!-- 附件 -->
@@ -171,6 +175,7 @@
           },
           {
             prop: 'receivedDate',
+            headerSlot: 'columnRequired',
             label: '收款时间',
             align: 'center',
             minWidth: 160,
@@ -178,6 +183,7 @@
           },
           {
             prop: 'receivedTotalPrice',
+            headerSlot: 'columnRequired',
             label: '已收金额',
             align: 'center',
             minWidth: 140,
@@ -185,6 +191,7 @@
           },
           {
             prop: 'paymentType',
+            headerSlot: 'columnRequired',
             label: '支付类型',
             align: 'center',
             minWidth: 140,

+ 2 - 2
src/api/financialManage/invoiceManage/index.js

@@ -86,8 +86,8 @@ export async function invoiceApplySubmit(data) {
 }
 
 // 新版信息
-export async function  initInvoiceByStatementId(params) {
-  const res = await request.get(`/eom/accountstatement/getInitInvoiceByStatementId`, { params });
+export async function  initInvoiceByStatementId(data) {
+  const res = await request.post(`/eom/fininvoiceapply/init`, data);
   if (res.data.code == 0) {
     return res.data.data;
   }

+ 9 - 0
src/api/financialManage/payAndCollectPlan/index.js

@@ -26,4 +26,13 @@ export async function getMergeInvoiceInfoAPI(data) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
+}
+
+// 收付款计划收款
+export async function confirmReceiptAPI(data) {
+  const res = await request.post(`/eom/receipt_payment_plan/orderDetail/v1/confirmReceipt`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
 }

+ 54 - 9
src/views/financialManage/collectionPlan/components/collectionDialog.vue

@@ -11,9 +11,16 @@
     :maxable="true"
     :resizable="true"
   >
-    <info-table ref="feeRelatedInfoTable" v-if="form.id" :form.sync="form"></info-table>
+    <!-- <info-table ref="feeRelatedInfoTable" v-if="form.id" :form.sync="form"></info-table> -->
+     <collect-table-form
+        ref="collectTableFormRef"
+        :form.sync="form"
+        :total-price="form.planPaymentAmount"
+        :dialog-type="dialogType"
+        total-label="应收金额"
+      ></collect-table-form>
     <div slot="footer">
-      <el-button type="primary" @click="handleSave(0)">保存</el-button>
+      <el-button type="primary" @click="save(0)">保存</el-button>
       <el-button @click="cancel">返回</el-button>
     </div>
 
@@ -23,11 +30,14 @@
 import infoTable from "@/views/financialManage/receivableManage/components/infoTable.vue";
 import {finReceivableSaveAPI, getFinReceivableInfoAPI, finReceivableUpdateAmountAPI} from "@/api/financialManage/receivableManage";
 import { receiptPaymentPlanById } from '@/api/financialManage/payAndCollectPlan';
+import collectTableForm from '@/BIZComponents/collectTableForm/index.vue';
+import { confirmReceiptAPI } from '@/api/financialManage/payAndCollectPlan';
 
 export default {
   name: "collectionDialog",
   components: {
-    infoTable
+    infoTable,
+    collectTableForm
   },
   props: {
     collectionDialogFlag: {
@@ -66,20 +76,55 @@ export default {
       const detail = data.details.filter(item => item.detailNo === this.currentRow.detailNo)?.[0]
       if(detail) {
         this.form = {
-          ...detail
+          ...detail,
+          tableData: detail?.confirmList?.map(item => {
+            return {
+              ...item,
+              receivedDate: item.paymentDate,
+              receivedTotalPrice: item.paymentTotalPrice,
+            }
+          }) || []
         }
       }
     },
+
+    save() {
+        // 先校验公共组件内的表单
+        this.$refs.collectTableFormRef.validate().then(() => {
+          // 取整个表单数据
+          const data = this.$refs.collectTableFormRef.getData();
+          this.loading = true;
+          const params = data.tableData.map((item) => {
+            return {
+              ...item,
+              paymentDate: item.receivedDate,
+              paymentTotalPrice: item.receivedTotalPrice,
+              receiptPaymentId: this.currentRow.id,
+              receiptPaymentCode: this.currentRow.code
+            };
+          });
+          confirmReceiptAPI(params)
+            .then(() => {
+              this.loading = false;
+              this.$message.success('收款成功');
+              this.cancel()
+              this.done()
+            })
+            .catch(() => {
+              this.loading = false;
+            });
+        }).catch(() => {});
+      },
     //
     async handleSave() {
       let data = await this.$refs.feeRelatedInfoTable.getTableValidate()
       console.log('data~~~', data)
       let detailList = data[0]
-      let receivableTotalPrice = data[1]
-      await finReceivableUpdateAmountAPI(this.form.id, {
-        receivableTotalPrice: receivableTotalPrice
-      })
-     await finReceivableSaveAPI(detailList)
+      // let receivableTotalPrice = data[1]
+      // await finReceivableUpdateAmountAPI(this.form.id, {
+      //   receivableTotalPrice: receivableTotalPrice
+      // })
+     await confirmReceiptAPI(detailList)
       this.$message.success('操作成功')
       this.done()
       this.cancel()

+ 7 - 1
src/views/financialManage/invoiceManage/components/accountstatementDialog.vue

@@ -20,7 +20,7 @@
         height="calc(100vh - 500px)"
         class="dict-table"
         :selection.sync="selection"
-        :row-click-checked="true"
+        :row-click-checked="!multiple"
         :row-click-checked-intelligent="!multiple"
         @selection-change="handleSelectionChange"
       >
@@ -34,6 +34,7 @@
     </el-card>
 
     <div slot="footer">
+      <el-button size="small" @click="handleSubmit">选择</el-button>
       <el-button size="small" @click="handleClose">关闭</el-button>
     </div>
     <!-- 对账明细   -->
@@ -220,6 +221,11 @@
           this.$refs.accountInfoDialogRef.init(row, index);
         });
       },
+      handleSubmit(){
+        console.log(this.selection);
+        this.$emit('getAccountData', this.selection);
+        this.handleClose();
+      },
       // 选择变化:多选直接透传;单选只保留最后选中的一项
       handleSelectionChange(selection) {
         let result = selection;

+ 3 - 1
src/views/financialManage/invoiceManage/components/addOrEditDialog.vue

@@ -782,7 +782,9 @@
         this.$set(this.form, 'sourceType', sourceType);
 
         let res = await initInvoiceByStatementId({
-          statementId: data.id
+          sourceIds: [data.id],
+          sourceType: sourceType,
+          type: type
         })
 
         console.log('res~~~', res)

+ 256 - 200
src/views/financialManage/invoiceManage/components/addOrEditDialogNew.vue

@@ -44,44 +44,53 @@
               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="1"></el-option>
               <el-option label="合同" :value="2"></el-option>
-              <el-option label="订单" :value="3"></el-option>
+              <el-option label="订单" :value="3"></el-option> -->
               <!-- <el-option label="收款计划" :value="1"></el-option> -->
-              <el-option
+              <!-- <el-option
                 label="已收"
-                :value="8"
+                :value="5"
                 v-if="form.type == 1"
               ></el-option>
               <el-option
                 label="已付"
-                :value="9"
+                :value="4"
                 v-if="form.type == 2"
               ></el-option>
-              <el-option label="其他无订单无合同" :value="10"></el-option>
+              <el-option label="其他无订单无合同" :value="99"></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-col :span="8" v-if="form.sourceType == 1">
+          <el-form-item label="对账单" prop="sourceCode">
+            <el-input
+              v-model="form.sourceCode"
+              readonly
+              @click.native="handleSelectAccount(1)"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8" v-if="form.sourceType == 2">
+          <el-form-item label="合同" prop="sourceCode">
             <el-input
               v-model="form.sourceCode"
               readonly
-              @click.native="handleSelectAccount(6)"
+              @click.native="handleSelectAccount(2)"
             ></el-input>
           </el-form-item>
         </el-col>
-        <el-col :span="8" v-if="form.sourceType == 7">
-          <el-form-item label="付款计划编码" prop="sourceCode">
+        <el-col :span="8" v-if="form.sourceType == 3">
+          <el-form-item label="订单" prop="sourceCode">
             <el-input
               v-model="form.sourceCode"
               readonly
-              @click.native="handleSelectAccount(7)"
+              @click.native="handleSelectAccount(3)"
             ></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="8" v-if="form.sourceType == 5">
-          <el-form-item label="应收编码" prop="sourceCode">
+          <el-form-item label="已收" prop="sourceCode">
             <el-input
               v-model="form.sourceCode"
               readonly
@@ -90,7 +99,7 @@
           </el-form-item>
         </el-col>
         <el-col :span="8" v-if="form.sourceType == 4">
-          <el-form-item label="应付编码" prop="sourceCode">
+          <el-form-item label="已付" prop="sourceCode">
             <el-input
               v-model="form.sourceCode"
               readonly
@@ -277,13 +286,13 @@
       </el-row>
     
       <div class="payinfo" style="margin-top: 20px;">
-        <headerTitle :title="form.type == 2 ? '付款计划信息' : '收款计划信息'"></headerTitle>
+        <headerTitle title="来源清单"></headerTitle>
         <!-- <el-form ref="form" :model="tableForm"> -->
           <ele-pro-table
             ref="table"
             :needPage="false"
             :columns="columns"
-            :datasource="form.receiptPayments"
+            :datasource="form.relatedList"
             row-key="id"
             class="time-form"
           >
@@ -294,7 +303,7 @@
               <el-form-item
                 style="width: 100%;"
                 label-width="0"
-                :prop="'receiptPayments.' + scope.$index + '.planPaymentAmount'"
+                :prop="'relatedList.' + scope.$index + '.planPaymentAmount'"
                 :rules="[
                   {
                     required: false,
@@ -311,7 +320,7 @@
               <el-form-item
                 style="width: 100%;"
                 label-width="0"
-                :prop="'receiptPayments.' + scope.$index + '.invoiceAmount'"
+                :prop="'relatedList.' + scope.$index + '.invoiceAmount'"
                 :rules="[
                   {
                     required: false,
@@ -378,6 +387,7 @@
       @getAccountData="getAccountData"
       :contactData="contactData"
       :type="form.type"
+      :multiple="true"
     >
     </account-statement-dialog>
     <!--采购订单-->
@@ -387,6 +397,7 @@
     ></purchasinOrderListDialog>
     <!--销售订单-->
     <saleOrderListDialog
+      :isAll="true"
       ref="saleOrderListDialogref"
       @changeParent="changeOrder"
     ></saleOrderListDialog>
@@ -395,6 +406,7 @@
       ref="selectContractRef"
       @changeParent="changeContract"
       :type="form.type"
+      :multiple="true"
     ></contractListDialog>
     <!-- 应收 -->
     <receivableDialog
@@ -432,7 +444,8 @@
   import {
     invoiceApplyInfoV2API,
     invoiceApplyCreateAPI,
-    invoiceApplyUpdateV2API
+    invoiceApplyUpdateV2API,
+    initInvoiceByStatementId
   } from '@/api/financialManage/invoiceManage';
   import { getpurchaseorderDetail } from '@/api/purchasingManage/purchaseOrder';
   import { getSaleOrderDetail } from '@/api/saleManage/saleorder';
@@ -452,6 +465,7 @@
   import { updateContractStatus } from '@/api/contractManage/contractBook';
   import { getMergeInvoiceInfoAPI } from '@/api/financialManage/payAndCollectPlan';
   import { paymentTypeOp } from '@/enum/dict';
+  
 
   const defForm = {
     accountingSubjectCode: '',
@@ -488,7 +502,7 @@
     salesCompanyBankBranchNo: '',
     salesCompanyBankAccount: '',
     category: 1,
-    receiptPayments: [],
+    relatedList: [],
     productMap: {}
   };
   export default {
@@ -531,118 +545,101 @@
     computed: {
       ...mapGetters(['user']),
       sourceTypeOp() {
-        return this.form.type == 1 ? [{
-          label: '收款计划',
-          value: 6
-        }, {
-          label: '应收管理',
-          value: 5
-        }] : [{
-          label: '付款计划',
-          value: 7
-        }, {
-          label: '应付管理',
-          value: 4
-        }]
-      },
-      columns() {
-        return [
+        return this.form.type == 1 ? [
           {
-            width: 45,
-            type: 'index',
-            columnKey: 'index',
-            align: 'center',
-            fixed: 'left'
+            label: '对账单',
+            value: 1
           },
           {
-            width: 150,
-            prop: 'sourceOrderDetailNo',
-            label: this.form.type == 1 ? '收款计划编码' : '付款计划编码',
-            align: 'center'
+            label: '合同',
+            value: 2
           },
           {
-            width: 150,
-            prop: 'relatedOrderNo',
-            label: '订单编号',
-            align: 'center'
+            label: '订单',
+            value: 3
           },
           {
-            width: 120,
-            prop: 'relatedOrderType',
-            label: '订单类型',
-            align: 'center',
-            formatter: (row) => {
-              return row.relatedOrderType == 1 ? '销售订单' : '采购订单'
-            }
+            label: '已收',
+            value: 5
           },
           {
-            width: 120,
-            prop: 'contractNo',
-            label: '合同编码',
-            align: 'center'
+            label: '其他无订单无合同',
+            value: 99
+          }
+        ] : [
+          {
+            label: '对账单',
+            value: 1
           },
           {
-            width: 120,
-            prop: 'contractCode',
-            label: '合同编号',
-            align: 'center'
+            label: '合同',
+            value: 2
           },
           {
-            width: 120,
-            prop: 'contractName',
-            label: '合同名称',
-            align: 'center'
+            label: '订单',
+            value: 3
           },
           {
-            prop: 'issueNumber',
-            label: '期数',
-            align: 'center'
+            label: '已付',
+            value: 4
           },
           {
-            width: 120,
-            prop: 'paymentType',
-            label: '款项类型',
+            label: '其他无订单无合同',
+            value: 99
+          }
+        ]
+      },
+      columns() {
+        return [
+          {
+            width: 45,
+            type: 'index',
+            columnKey: 'index',
             align: 'center',
-            formatter: (row) => {
-              return this.paymentTypeOp.find(item => item.value == row.paymentType)?.label || ''
-            }
+            fixed: 'left'
           },
           {
-            prop: 'moneyName',
-            label: '款项名称',
-            align: 'center',
-            width: 170
+            minWidth: 150,
+            prop: 'sourceCode',
+            label: '来源编码',
+            align: 'center'
           },
+          // {
+          //   width: 150,
+          //   prop: 'relatedOrderNo',
+          //   label: '来源编号',
+          //   align: 'center'
+          // },
           {
-            width: 150,
-            prop: 'paymentRatio',
-            label: '比例',
+            minWidth: 120,
+            prop: 'sourceType',
+            label: '来源类型',
             align: 'center',
             formatter: (row) => {
-              return row.paymentRatio ? row.paymentRatio + '%' : ''
+              return this.sourceTypeList.find(item => item.value == row.sourceType)?.label || ''
             }
           },
+          // {
+          //   width: 170,
+          //   prop: 'planPaymentAmount',
+          //   label: this.form.type == 1 ? '计划收款金额' : '计划付款金额',
+          //   align: 'center',
+          //   slot: 'planPaymentAmount'
+          // },
           {
-            width: 170,
-            prop: 'planPaymentAmount',
-            label: this.form.type == 1 ? '计划收款金额' : '计划付款金额',
-            align: 'center',
-            slot: 'planPaymentAmount'
-          },
-          {
-            width: 150,
+            minWidth: 150,
             prop: 'unInvoiceAmount',
             label: '未开票金额',
             align: 'center'
           },
           {
-            width: 150,
+            minWidth: 150,
             prop: 'invoicedAmount',
             label: '已开票金额',
             align: 'center'
           },
           {
-            width: 160,
+            minWidth: 160,
             prop: 'invoiceAmount',
             label: '本次开票金额',
             align: 'center',
@@ -654,6 +651,34 @@
     },
     data() {
       return {
+        // 1-对账单,2-合同,3-订单,4-应付,5-应收,99-其他无订单无合同
+        sourceTypeList: [
+          {
+            label: '对账单',
+            value: 1
+          },
+          {
+            label: '合同',
+            value: 2
+          },
+          {
+            label: '订单',
+            value: 3
+          },
+          {
+            label: '已付',
+            value: 4
+          },
+          {
+            label: '已收',
+            value: 5
+          },
+          {
+            label: '其他无订单无合同',
+            value: 99
+          }
+        ],
+        
         businessId: '',
         paymentTypeOp,
         fullscreen: false,
@@ -664,6 +689,7 @@
         processSubmitDialogFlag: false,
         collectionPlanDialogFlag: false,
         paymentListDialogFlag: false,
+        accountStatementDialogFlag: false,
         enterprisePage: [],
         totalInvoiceAmount: 0,
         form: {
@@ -728,16 +754,19 @@
       },
       updateInvoiceAmount(row) {
         // row.invoiceAmount = Number(row.invoiceAmount).toFixed(2);
-        this.form.amount = this.form.receiptPayments.reduce((pre, cur) => {
+        this.form.amount = this.form.relatedList.reduce((pre, cur) => {
           return pre + Number(cur.invoiceAmount);
         }, 0);
-        // this.$refs.tableInfoRef.setSinglePrice(row, this.form.receiptPayments);
+        // this.$refs.tableInfoRef.setSinglePrice(row, this.form.relatedList);
       },
       //来源类型
       async handleSelectAccount(val) {
         if (val == 6 || val == 7) {
           this.collectionPlanDialogFlag = true;
         }
+        if (val == 1) {
+          this.accountStatementDialogFlag = true;
+        }
         if (val == 2) {
           this.$refs.selectContractRef.open({}, 1, 1);
         }
@@ -756,37 +785,42 @@
       },
       //合同回调
       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
-        );
+        console.log('changeOrder~~~', data);
+        const tempIds = data.map((item) => item.id);
+        const tempNames = data.map((item) => item.contractNo);
+        this.getPlanData(tempIds, tempNames);
+        // 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);
+        // });
 
-        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) {
@@ -846,38 +880,42 @@
       },
       //订单回调
       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('changeOrder~~~', data);
+        const tempIds = data.map((item) => item.id);
+        const tempNames = data.map((item) => item.orderNo);
+        this.getPlanData(tempIds, tempNames);
+        // 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);
+        // console.log(res);
       },
 
       //应收应付回调
@@ -901,28 +939,35 @@
         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);
-        }
+      async getPlanData(tempIds, tempNames) {
+        console.log('getPlanDatadata~~~', tempIds, tempNames);
+        // 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.statementNo);
+        // }
 
         this.form.sourceCode = tempNames.join(',');
         
-        const res = await getMergeInvoiceInfoAPI(tempIds)
-        res.receiptPayments = res.receiptPayments.map((item) => {
+        const res = await initInvoiceByStatementId(
+          {
+            sourceIds: tempIds,
+            sourceType: this.form.sourceType,
+            type: this.form.type
+          }
+        )
+        res.relatedList = res.relatedList.map((item) => {
           item.invoiceAmount = item.unInvoiceAmount;
           return item
         })
-        
-        this.form.receiptPayments = res.receiptPayments;
+        this.form.sourceId = res.sourceId;
+        this.form.relatedList = res.relatedList;
         this.form.productMap = res.productMap;
-        const amount = this.form.receiptPayments.reduce((prev, cur) => prev + 
+        const amount = this.form.relatedList.reduce((prev, cur) => prev + 
         +cur.invoiceAmount, 0) || 0;
         this.form.amount = amount;
         console.log('form~~~', this.form);
@@ -936,36 +981,45 @@
       },
       //对账单回调
       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
-          );
+        // 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);
-        });
+        //   this.$refs.table.getAccountData(tableInfo);
+        // });
+        const tempIds = tableInfo.map((item) => item.id);
+        const tempNames = tableInfo.map((item) => item.statementNo);
+        this.getPlanData(tempIds, tempNames);
+        console.log(tableInfo);
+
+        // this.getPlanData(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);
+        const tempIds = data.map((item) => item.id);
+        const tempNames = data.map((item) => item.statementNo);
+
+        this.getPlanData(tempIds, tempNames);
         // if (sourceType == 2) {
         //   this.changeContract(data);
         // }
@@ -1059,7 +1113,7 @@
         if (val == 'isType') {
           this.$set(this.form, 'sourceType', '');
         }
-        this.form.receiptPayments = [];
+        this.form.relatedList = [];
         this.$refs.tableInfoRef.clearTable();
         this.enterpriseChange(this.enterprisePage[0]?.name);
       },
@@ -1088,7 +1142,7 @@
 
       invoiceAmountChange(item, sum) {
         console.log('item~~~', item, sum);
-        const sameKeyItems = this.form.receiptPayments.filter((d) => d.relatedOrderNo === item.key)
+        const sameKeyItems = this.form.relatedList.filter((d) => d.sourceCode === item.key)
         console.log('sameKeyItems~~~', sameKeyItems);
         
         let remainingTotal = sum;
@@ -1117,10 +1171,10 @@
         item.unInvoiceAmount = item.planPaymentAmount - item.invoicedAmount;
         // 更新关联物品清单中的 defaultAmountTotalPrice
         const tableInfoRef = this.$refs.tableInfoRef;
-        if (tableInfoRef && item.relatedOrderNo) {
-          const key = item.relatedOrderNo;
-          const newTotal = this.form.receiptPayments
-            .filter((d) => d.relatedOrderNo === key)
+        if (tableInfoRef && item.sourceCode) {
+          const key = item.sourceCode;
+          const newTotal = this.form.relatedList
+            .filter((d) => d.sourceCode === key)
             .reduce((sum, d) => sum + (parseFloat(d.unInvoiceAmount) || 0), 0);
           tableInfoRef.tableForm.detailList.forEach((detail) => {
             if (detail.key === key) {
@@ -1192,7 +1246,8 @@
               : invoiceApplyUpdateV2API;
           const id = await API(this.form);
           if (this.form.sourceType == 2) {
-            updateContractStatus([this.form.sourceId]);
+            const idArr = this.form.sourceId?.split(',') || [];
+            updateContractStatus(idArr);
           }
           if (flag) {
             await this.handleSub(id);
@@ -1231,7 +1286,8 @@
               : invoiceApplyUpdateV2API;
           const id = await API(this.form);
           if (this.form.sourceType == 2) {
-            updateContractStatus([this.form.sourceId]);
+            const idArr = this.form.sourceId?.split(',') || [];
+            updateContractStatus(idArr);
           }
           if (flag) {
             await this.handleSub(id);

+ 123 - 113
src/views/financialManage/invoiceManage/components/detailDialog.vue

@@ -42,38 +42,50 @@
                 :disabled="true"
                 style="width: 100%"
               >
-                <el-option label="收款计划" :value="6"></el-option>
-                <el-option label="付款计划" :value="7"></el-option>
-                <el-option label="应收管理" :value="5"></el-option>
-                <el-option label="应付管理" :value="4"></el-option>
+                <el-option v-for="(item, index) in sourceTypeList" :key="index" :label="item.label" :value="item.value"></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" :disabled="true"></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" :disabled="true"></el-input>
-            </el-form-item>
-          </el-col>
-          <!-- <el-col :span="8" v-if="form.sourceType == 3">
-            <el-form-item label="订单" prop="sourceCode">
-              <el-input v-model="form.sourceCode" :disabled="true"></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" :disabled="true"></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" :disabled="true"></el-input>
-            </el-form-item>
-          </el-col>
+          <el-col :span="8" v-if="form.sourceType == 1">
+          <el-form-item label="对账单" prop="sourceCode">
+            <el-input
+              v-model="form.sourceCode"
+              readonly
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8" v-if="form.sourceType == 2">
+          <el-form-item label="合同" prop="sourceCode">
+            <el-input
+              v-model="form.sourceCode"
+              readonly
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8" v-if="form.sourceType == 3">
+          <el-form-item label="订单" prop="sourceCode">
+            <el-input
+              v-model="form.sourceCode"
+              readonly
+            ></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
+            ></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
+            ></el-input>
+          </el-form-item>
+        </el-col>
           <el-col :span="8">
             <el-form-item label="发票金额" prop="amount">
               <el-input
@@ -204,26 +216,42 @@
           </el-col>
         </el-row>
       </el-form>
-      <div style="margin-top: 20px; margin-bottom: 20px;">
-        <headerTitle :title="form.type == 2 ? '付款计划信息' : '收款计划信息'"></headerTitle>
+      <div class="payinfo" style="margin-top: 20px;">
+        <headerTitle title="来源清单"></headerTitle>
         <!-- <el-form ref="form" :model="tableForm"> -->
           <ele-pro-table
             ref="table"
             :needPage="false"
             :columns="columns"
-            :datasource="form.receiptPayments"
+            :datasource="form.relatedList"
             row-key="id"
             class="time-form"
           >
             <template v-slot:toolbar>
               <!-- <span>已开票金额:{{ totalInvoiceAmount }}</span> -->
             </template>
-            
+            <template v-slot:planPaymentAmount="scope">
+              <el-form-item
+                style="width: 100%;"
+                label-width="0"
+                :prop="'relatedList.' + scope.$index + '.planPaymentAmount'"
+                :rules="[
+                  {
+                    required: false,
+                    message: '请输入计划金额',
+                    trigger: 'blur'
+                  }
+                ]"
+              > 
+                <span v-if="dialogType === 'view'">{{ scope.row.planPaymentAmount }}</span>
+                <el-input v-else v-model="scope.row.planPaymentAmount" type="number" @input="updatePlanPaymentAmount(scope.row)"></el-input>
+              </el-form-item>
+            </template>
             <template v-slot:invoiceAmount="scope">
               <el-form-item
                 style="width: 100%;"
                 label-width="0"
-                :prop="'receiptPayments.' + scope.$index + '.invoiceAmount'"
+                :prop="'relatedList.' + scope.$index + '.invoiceAmount'"
                 :rules="[
                   {
                     required: false,
@@ -235,8 +263,8 @@
                     validator: (rule, value, callback) => {
                       if (value === undefined || value === null || value === '') {
                         callback('请输入开票金额');
-                      } else if (parseFloat(value) <= 0) {
-                        callback('开票金额必须大于0');  
+                      } else if (parseFloat(value) <= 0 || parseFloat(value) > parseFloat(scope.row.unInvoiceAmount)) {
+                        callback('开票金额必须大于0且不超过未开票金额');  
                       } else {
                         callback();
                       }
@@ -246,17 +274,19 @@
                 ]"
               > 
                 <span v-if="dialogType === 'view'">{{ scope.row.invoiceAmount }}</span>
-                <el-input :min="0" :max="scope.row.planPaymentAmount" v-limit="{ min: 0, max: scope.row.planPaymentAmount }" v-else v-model="scope.row.invoiceAmount" type="number" @input="updateInvoiceAmount(scope.row)"></el-input>
+                <el-input 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>
-      <headerTitle title="关联物品清单信息"></headerTitle>
-      <table-info-new
-        dialogType="view"
-        ref="tableInfoNewRef"
-      ></table-info-new>
+      <div style="margin-top: 20px;">
+        <headerTitle title="关联物品清单信息"></headerTitle>
+        <table-info-new
+          dialogType="view"
+          ref="tableInfoNewRef"
+        ></table-info-new>
+      </div>
     </div>
     <bpmDetail
       v-if="activeComp === 'bpm' && form.processInstanceId"
@@ -299,95 +329,49 @@
             fixed: 'left'
           },
           {
-            width: 150,
-            prop: 'sourceOrderDetailNo',
-            label: this.form.type == 1 ? '收款计划编码' : '付款计划编码',
+            minWidth: 150,
+            prop: 'sourceCode',
+            label: '来源编码',
             align: 'center'
           },
+          // {
+          //   width: 150,
+          //   prop: 'relatedOrderNo',
+          //   label: '来源编号',
+          //   align: 'center'
+          // },
           {
-            width: 150,
-            prop: 'relatedOrderNo',
-            label: '订单编号',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'relatedOrderType',
-            label: '订单类型',
+            minWidth: 120,
+            prop: 'sourceType',
+            label: '来源类型',
             align: 'center',
             formatter: (row) => {
-              return row.relatedOrderType == 1 ? '销售订单' : '采购订单'
+              return this.sourceTypeList.find(item => item.value == row.sourceType)?.label || ''
             }
           },
+          // {
+          //   width: 170,
+          //   prop: 'planPaymentAmount',
+          //   label: this.form.type == 1 ? '计划收款金额' : '计划付款金额',
+          //   align: 'center',
+          //   slot: 'planPaymentAmount'
+          // },
           {
-            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',
-            formatter: (row) => {
-              return row.paymentRatio ? row.paymentRatio + '%' : ''
-            }
-          },
-          {
-            width: 170,
-            prop: 'planPaymentAmount',
-            label: this.form.type == 1 ? '计划收款金额' : '计划付款金额',
-            align: 'center',
-          },
-          {
-            width: 150,
+            minWidth: 150,
             prop: 'unInvoiceAmount',
             label: '未开票金额',
             align: 'center'
           },
           {
-            width: 150,
+            minWidth: 150,
             prop: 'invoicedAmount',
             label: '已开票金额',
             align: 'center'
           },
           {
-            width: 160,
+            minWidth: 160,
             prop: 'invoiceAmount',
-            label: '开票金额',
+            label: '本次开票金额',
             align: 'center',
             // slot: 'invoiceAmount',
             fixed: 'right'
@@ -408,7 +392,33 @@
         dialogType: '',
         form: {
           files: []
-        }
+        },
+        sourceTypeList: [
+          {
+            label: '对账单',
+            value: 1
+          },
+          {
+            label: '合同',
+            value: 2
+          },
+          {
+            label: '订单',
+            value: 3
+          },
+          {
+            label: '已付',
+            value: 4
+          },
+          {
+            label: '已收',
+            value: 5
+          },
+          {
+            label: '其他无订单无合同',
+            value: 99
+          }
+        ],
       };
     },
     methods: {

+ 40 - 40
src/views/financialManage/invoiceManage/components/tableInfoNew.vue

@@ -114,9 +114,9 @@
             fixed: 'left'
           },
           {
-            width: 100,
+            width: 150,
             prop: 'key',
-            label: '对账单编码',
+            label: '来源编码',
             align: 'center'
           },
           // {
@@ -126,8 +126,8 @@
           //   align: 'center'
           // },
           {
-            width: 100,
-            prop: 'key',
+            width: 150,
+            prop: 'sourceOrderNo',
             label: '销售订单编码',
             align: 'center'
           },
@@ -144,7 +144,7 @@
           //   align: 'center'
           // },
           {
-            minWidth: 100,
+            minWidth: 150,
             prop: 'productName',
             label: '产品名称',
             slot: 'productName',
@@ -152,26 +152,26 @@
           },
         
           {
-            minWidth: 150,
+            minWidth: 130,
             prop: 'invoiceAmount',
             label: '本次开票金额',
             slot: 'invoiceAmount',
             align: 'center'
           },
           {
-            minWidth: 150,
+            minWidth: 130,
             prop: 'invoicedAmount',
             label: '已开票金额',
             align: 'center'
           },
           {
-            minWidth: 150,
+            minWidth: 130,
             prop: 'unInvoiceAmount',
             label: '未开票金额',
             align: 'center'
           },
           {
-            minWidth: 150,
+            minWidth: 130,
             prop: 'taxRate',
             label: '税率',
             align: 'center',
@@ -243,7 +243,7 @@
           },
           {
             width: 100,
-            prop: 'key',
+            prop: 'productCode',
             label: '产品编码',
             align: 'center'
           },
@@ -349,32 +349,32 @@
                 amountTotalPrice: amountTotalPrice,
                 defaultAmountTotalPrice: defaultAmountTotalPrice,
                 ...detail,
-                invoiceAmount: detail.invoiceAmount || 0,
+                invoiceAmount: type == 'setValue' ? detail.unInvoiceAmount : detail.invoiceAmount,
               });
             });
           });
 
-          if(type == 'setValue') {
-            const uniqueKeys = [...new Set(result.map(item => item.key))];
-            uniqueKeys.forEach(key => {
-              const sameKeyItems = result.filter(item => item.key === key);
-              if (sameKeyItems.length > 0) {
-                const defaultAmountTotalPrice = parseFloat(sameKeyItems[0].defaultAmountTotalPrice) || 0;
-                let remainingTotal = defaultAmountTotalPrice;
+          // if(type == 'setValue') {
+          //   const uniqueKeys = [...new Set(result.map(item => item.key))];
+          //   uniqueKeys.forEach(key => {
+          //     const sameKeyItems = result.filter(item => item.key === key);
+          //     if (sameKeyItems.length > 0) {
+          //       const defaultAmountTotalPrice = parseFloat(sameKeyItems[0].defaultAmountTotalPrice) || 0;
+          //       let remainingTotal = defaultAmountTotalPrice;
                 
-                sameKeyItems.forEach(item => {
-                  if (remainingTotal <= 0) {
-                    item.invoiceAmount = 0;
-                  } else {
-                    const unInvoiceAmount = parseFloat(item.unInvoiceAmount) || 0;
-                    const allocateAmount = Math.min(remainingTotal, unInvoiceAmount);
-                    item.invoiceAmount = allocateAmount.toFixed(2);
-                    remainingTotal -= allocateAmount;
-                  }
-                });
-              }
-            });
-          }
+          //       sameKeyItems.forEach(item => {
+          //         if (remainingTotal <= 0) {
+          //           item.invoiceAmount = 0;
+          //         } else {
+          //           const unInvoiceAmount = parseFloat(item.unInvoiceAmount) || 0;
+          //           const allocateAmount = Math.min(remainingTotal, unInvoiceAmount);
+          //           item.invoiceAmount = allocateAmount.toFixed(2);
+          //           remainingTotal -= allocateAmount;
+          //         }
+          //       });
+          //     }
+          //   });
+          // }
           
           
           
@@ -394,16 +394,16 @@
               sum += Number(r.invoiceAmount);
             }
           });
-          // if (val && +val > +item.unInvoiceAmount) {
+          if (val && +val > +item.unInvoiceAmount) {
+            this.$message.warning('物品开票金额不能大于未开票金额');
+            this.$set(item, 'invoiceAmount', '');
+            // return;
+          }
+          // if (sum > item.unInvoiceAmount) {
           //   this.$message.warning('物品开票金额不能大于未开票金额');
-          //   this.$set(item, 'invoiceAmount', '');
+          //   // this.$set(item, 'invoiceAmount', '');
           //   // return;
           // }
-          if (sum > item.defaultAmountTotalPrice) {
-            this.$message.warning('物品开票金额不能大于本次开票合计');
-            // this.$set(item, 'invoiceAmount', '');
-            // return;
-          }
           this.$set(item, 'invoiceAmount', val);
           const amountTotalPrice = this.fromPrecision(sum);
           const targetItems = this.tableForm.detailList.filter(d => d.key === key);
@@ -432,13 +432,13 @@
       putValue(data) {
         let tempData = JSON.parse(JSON.stringify(data));
         console.log('tableInfoNew putValue', tempData);
-        // tempData.detailList = this.convertToArrayFormat(tempData, 'putValue');
+        tempData.detailList = this.convertToArrayFormat(tempData, 'putValue');
         this.tableForm = tempData;
         console.log('tableInfoNew putValue~~~', this.tableForm);
       },
       setValue(data) {
         let tempData = JSON.parse(JSON.stringify(data));
-        // tempData.detailList = this.convertToArrayFormat(tempData, 'setValue');
+        tempData.detailList = this.convertToArrayFormat(tempData, 'setValue');
         console.log('tempData.detailList', tempData.detailList);
         this.tableForm = tempData;
       },

+ 1 - 1
src/views/financialManage/invoiceManage/index.vue

@@ -150,7 +150,7 @@
   import { reviewStatus } from '@/enum/dict';
   import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
   import tabMixins from '@/mixins/tableColumnsMixin';
-  import addOrEditDialogNew from '@/views/financialManage/invoiceManage/components/addOrEditDialog.vue'
+  import addOrEditDialogNew from '@/views/financialManage/invoiceManage/components/addOrEditDialogNew.vue'
 
   export default {
     mixins: [dictMixins, tabMixins],

+ 6 - 13
src/views/financialManage/receivableManage/components/addReceivableDialog.vue

@@ -557,7 +557,7 @@
           // 校验明细表与应收信息表单
           await this.$refs.accountDetailTableRef.getValidForm();
           await this.$refs.receivableInfoRef.validate();
-
+          console.log(this.dialogType, 'this.dialogType~~~');
           let api =
             this.dialogType == 'add'
               ? saveReceivableAPI
@@ -604,26 +604,19 @@
       async submitApprove(res) {
         console.log(res, 'res~~~');
         console.log(this.businessId || res, 'this.businessId || res');
-        const data = await accountstatementInfoAPI(this.businessId || res);
+        const data = await getFinReceivableInfoAPI(this.businessId || res);
         console.log(data, 'data~~~');
         this.processSubmitDialogFlag = true;
         this.$nextTick(() => {
-          const params = {
+          let params = {
             businessId: data.id,
-            businessKey: 'sales_account_statement_approve',
+            businessKey: 'fin_receivable_approve',
             formCreateUserId: data.createUserId,
             variables: {
-              type: data.type,
-              businessCode: data.statementNo,
+              businessCode: data.code,
               businessName: data.contactName,
-              businessType: '对账单'
+              businessType: '应收'
             }
-            // 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);
         });

+ 3 - 3
src/views/financialManage/receivableManage/components/collectionDialog.vue

@@ -95,8 +95,8 @@ export default {
             .then(() => {
               this.loading = false;
               this.$message.success('收款成功');
-              this.updateVisible(false);
-              this.$emit('done');
+              this.cancel()
+              this.done()
             })
             .catch(() => {
               this.loading = false;
@@ -105,7 +105,7 @@ export default {
       },
 
       updateVisible(value) {
-        this.visible = value;
+        this.collectionDialogFlag = value;
         if (!value) {
           this.row = {};
           this.form.tableData = [];

+ 139 - 69
src/views/financialManage/receivableManage/components/detailDialog.vue

@@ -24,42 +24,18 @@
       </ul>
     </div>
     <div v-if="activeComp === 'main'">
-      <el-form ref="form" :model="form" class="el-form-box" label-width="120px">
-        <headerTitle title="基本信息"></headerTitle>
-        <el-row :gutter="12">
+      <headerTitle title="基本信息" style="margin-top: 30px"></headerTitle>
+      <el-form ref="form" :model="dataForm" :rules="rules" label-width="120px">
+        <el-row>
           <el-col :span="8">
-            <el-form-item label="应收日期" prop="receivableDate">
-              <el-date-picker
-                style="width: 100%"
-                v-model="form.receivableDate"
-                disabled
-                type="date"
-                value-format="yyyy-MM-dd"
-              >
-              </el-date-picker>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="应收金额" prop="receivableTotalPrice">
-              <el-input-number
-                disabled
-                v-model="form.receivableTotalPrice"
-                :precision="2"
-                :controls="false"
-                style="width: 100%"
-                :min="0"
-              ></el-input-number>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="会计科目" prop="accountingSubjectId">
+            <el-form-item label="会计科目:" prop="accountingSubjectId">
               <ele-tree-select
-                disabled
                 clearable
+                :disabled="dialogType == 'view'"
                 filterable
                 ref="treeSelect"
                 :data="accountingSubjectList"
-                v-model="form.accountingSubjectId"
+                v-model="dataForm.accountingSubjectId"
                 valueKey="id"
                 labelKey="name"
                 placeholder="请选择"
@@ -68,70 +44,119 @@
               />
             </el-form-item>
           </el-col>
+          <el-col :span="8">
+            <el-form-item
+              label="应收日期"
+              prop="receivableDate"
+            >
+              <el-date-picker
+                :disabled="dialogType == 'view'"
+                v-model="dataForm.receivableDate"
+                value-format="yyyy-MM-dd"
+                type="date"
+                style="width: 100%"
+              >
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item prop="receivableTotalPrice" label="应收金额">
+              <el-input :disabled="dialogType == 'view'" v-model="dataForm.receivableTotalPrice"></el-input>
+            </el-form-item>
+          </el-col>
         </el-row>
-        <el-row :gutter="12">
+        <el-row>
           <el-col :span="8">
-            <el-form-item label="发票编码" prop="invoiceCode">
-              <el-input disabled v-model="form.invoiceCode"></el-input>
+            <el-form-item prop="invoiceCode" label="发票编码">
+              <el-input disabled v-model="dataForm.invoiceCode"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="发票号" prop="invoiceCode">
-              <el-input disabled v-model="form.invoiceCode"></el-input>
+            <el-form-item prop="invoiceNo" label="发票号">
+              <el-input disabled v-model="dataForm.invoiceNo"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="发票种类" prop="invoiceCode">
-              <el-input disabled v-model="form.invoiceCode"></el-input>
+            <el-form-item prop="category" label="发票种类">
+              <el-select
+                :disabled="true"
+                clearable
+                class="ele-block"
+                v-model="dataForm.category"
+                placeholder="请选择"
+              >
+                <el-option label="增值税专用发票" :value="1"></el-option>
+                <el-option label="增值税普通发票" :value="2"></el-option>
+              </el-select>
             </el-form-item>
           </el-col>
         </el-row>
-        <el-row :gutter="12">
+        <el-row>
           <el-col :span="8">
-            <el-form-item label="公司名称" prop="contactName">
-              <el-input disabled v-model="form.contactName"></el-input>
+            <el-form-item prop="contactName" label="公司名称">
+              <el-input disabled v-model="dataForm.contactName"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="8">
             <el-form-item label="来源类型" prop="sourceType">
-              <el-input
-                :value="payAndReceiveEnum.find(item=>item.value==form.sourceType)?.label"
-                disabled
-              ></el-input>
+              <el-select
+                :disabled="true"
+                clearable
+                class="ele-block"
+                v-model="dataForm.sourceType"
+                placeholder="请选择"
+              >
+                <el-option label="采购订单" :value="2" />
+                <!--            <el-option label="项目" :value="2"/>-->
+                <!-- <el-option label="合同" :value="4" /> -->
+
+                <el-option label="销售订单" :value="1" />
+              </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="来源编码" prop="sourceCode">
-              <el-input v-model="form.sourceCode" disabled></el-input>
+            <el-form-item prop="sourceCode" label="来源编码">
+              <el-input disabled v-model="dataForm.sourceCode"></el-input>
             </el-form-item>
           </el-col>
+        </el-row>
 
-          </el-row>
-          <el-row :gutter="12">
+        <el-row>
           <el-col :span="8">
-            <el-form-item label="备注" prop="remark">
-              <el-input disabled v-model="form.remark"></el-input>
+            <el-form-item prop="remark" label="备注">
+              <el-input :disabled="dialogType == 'view'" v-model="dataForm.remark"></el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="8">
-            <el-form-item label="附件">
-              <fileMain v-model="form.files" type="view"></fileMain>
+          <el-col :span="12">
+            <el-form-item prop="files" label="附件">
+              <fileMain v-model="dataForm.files" :type="dialogType == 'view' ? 'view' : 'add'"></fileMain>
             </el-form-item>
           </el-col>
         </el-row>
-        <headerTitle title="收款信息"></headerTitle>
-        <info-table
-          ref="feeRelatedInfoTable"
-          @invoiceChange="init"
-          dialog-type="view"
-          v-if="form.id"
-          :form.sync="form"
-        ></info-table>
       </el-form>
+
+      <headerTitle title="应收信息" style="margin-top: 30px"></headerTitle>
+      <receivable-info
+        :dataForm.sync="dataForm"
+        :receivableList.sync="receivableList"
+        dialogType="view"
+        ref="receivableInfoRef"
+        @addAdvanceReceipt="addAdvanceReceipt"
+      ></receivable-info>
+
+      <headerTitle title="对账明细" style="margin-top: 30px"></headerTitle>
+      <account-detail-table
+        ref="accountDetailTableRef"
+        :datasource.sync="datasource"
+        dialogType="view"
+        :queryDimension="dataForm.queryDimension"
+        @totalChange="handleTotalChange"
+        @countChange="handleCountChange"
+      ></account-detail-table>
     </div>
     <bpmDetail
-      v-if="activeComp === 'bpm' && form.processInstanceId"
-      :id="form.processInstanceId"
+      v-if="activeComp === 'bpm' && dataForm.processInstanceId"
+      :id="dataForm.processInstanceId"
     ></bpmDetail>
     <div slot="footer">
       <el-button @click="cancel">返回</el-button>
@@ -150,11 +175,16 @@
   import bpmDetail from '@/views/bpm/processInstance/detail.vue';
   import { payAndReceiveEnum } from "@/enum/dict";
 
+  import AccountDetailTable from '@/views/saleManage/saleOrder/accountstatement/components/accountDetailTable.vue';
+  import ReceivableInfo from '@/views/saleManage/saleOrder/accountstatement/components//receivableInfo.vue';
+
   export default {
     mixins: [dictMixins],
     components: {
       bpmDetail,
-      infoTable
+      infoTable,
+      AccountDetailTable,
+      ReceivableInfo
       // fileMain
     },
 
@@ -167,7 +197,7 @@
         ],
         payAndReceiveEnum,
         dialogType: '',
-        form: {
+        dataForm: {
           accountingSubjectCode: '',
           accountingSubjectId: '',
           accountingSubjectName: '',
@@ -186,6 +216,9 @@
           unreceiveTotalPrice: 0
         },
         accountingSubjectList: [],
+        datasource: [],
+        statReceipt: null,
+        receivableList: [],
         rules: {
           accountingSubjectId: {
             required: true,
@@ -209,11 +242,48 @@
     async created() {},
     methods: {
       //获取详情
-      async init(id) {
+      async init(id, type) {
+        this.dialogType = type;
         await this.getClassifyList(24, 'accountingSubjectList');
-        this.form = await getFinReceivableInfoAPI(id);
-        this.$nextTick(() => {
-          this.$refs.feeRelatedInfoTable.init();
+        const data = await getFinReceivableInfoAPI(id);
+
+        this.dataForm = {
+          ...this.dataForm,
+          ...data
+        };
+
+        this.statReceipt = data.statReceipt || null;
+
+        this.receivableList =
+        (data.statReceipt && data.statReceipt.statReceiptDetailList) || [];
+
+        this.datasource = data.productList || [];
+        
+        // this.$nextTick(() => {
+        //   this.$refs.feeRelatedInfoTable.init();
+        // });
+      },
+      handleTotalChange(total) {
+        this.dataForm.amountTotalPrice = total;
+      },
+      handleCountChange(count) {
+        this.dataForm.totalStatementCount = count;
+      },
+      // 新增预收款:打开预收款选择弹窗
+      addAdvanceReceipt() {
+        this.$refs.advanceReceiptSelectRef.open();
+      },
+      // 预收款选择器回调:将选中的预收款映射为应收信息行
+      onAdvanceReceiptSelected(row) {
+        this.receivableList.push({
+          saleOrderNo: row.saleOrderNo || '',
+          advanceReceiptCode: row.advanceReceiptCode || '',
+          fundTypeName: this.fundTypeLabel(row.fundType),
+          unConfirmAmount: +row.unConfirmAmount || 0,
+          // 本次对账预收款确收金额上限取「未对账确收金额」
+          statementAmount: +row.unConfirmAmount || 0,
+          currentConfirmAmount: 0,
+          currentReceivableAmount: 0
         });
       },
       downloadFile(file) {

+ 5 - 5
src/views/financialManage/receivableManage/index.vue

@@ -47,7 +47,7 @@
               type="primary"
               :underline="false"
               icon="el-icon-plus"
-              @click="handleDetail(row, 'update')"
+              @click="handleAddReceivable(row, 'update')"
               v-if="[0, 3].includes(row.approvalStatus)"
             >
               修改
@@ -130,7 +130,7 @@
     />
 
     <addReceivableDialog ref="addReceivableDialogRef" v-if="addReceivableDialogFlag"
-      :visible.sync="addReceivableDialogFlag"></addReceivableDialog>
+      :visible.sync="addReceivableDialogFlag" @done="reload"></addReceivableDialog>
   </div>
 </template>
 
@@ -506,16 +506,16 @@
         });
       },
       // 应收
-      handleAddReceivable(type, row) {
+      handleAddReceivable(row, type) {
         this.addReceivableDialogFlag = true;
         this.$nextTick(() => {
           this.$refs.addReceivableDialogRef.open(type, row);
         });
       },
       handleDetail(row = {}, type) {
-        this.addReceivableDialogFlag = true;
+        this.detailDialogFlag = true;
         this.$nextTick(() => {
-          this.$refs.addReceivableDialogRef.open(type, row);
+          this.$refs.detailDialogRef.init(row.id, type);
         });
       },
       handleInvoiceDetail(row = {}, type) {

+ 1 - 1
src/views/financialManage/receivedManaged/index.vue

@@ -454,7 +454,7 @@
       canAddInvoice() {
         return function(row) {
           if (!row) return false;
-          return [2].includes(row.approvalStatus) && row.transactionMode == 2 && row.invoiceStatus != 2 && row.unInvoiceAmount && +row.unInvoiceAmount > 0;
+          return [2].includes(row.approvalStatus);
         };
       }
     },

+ 11 - 8
src/views/saleManage/saleOrder/accountstatement/components/accountDetailTable.vue

@@ -474,16 +474,19 @@
         ) {
           statementCount = count;
         }
-        const singlePrice = +item.singlePrice || 0;
+        const singlePrice = +item.singlePrice;
         const discountRatio =
           item.discountRatio === undefined ||
           item.discountRatio === null ||
           item.discountRatio === ''
             ? 100
             : +item.discountRatio;
+        // 税率非必填,可空值:undefined/null/空字符串 均保持空,不默认 0
         const taxRate =
-          item.taxRate === undefined || item.taxRate === null
-            ? 0
+          item.taxRate === undefined ||
+          item.taxRate === null ||
+          item.taxRate === ''
+            ? ''
             : +item.taxRate;
         const amount =
           Math.round(
@@ -529,8 +532,8 @@
       initDefaultValues() {
         this.datasource.forEach((item) => {
             if (item.singlePrice === undefined)
-              this.$set(item, 'singlePrice', 0);
-            if (item.taxRate === undefined) this.$set(item, 'taxRate', 0);
+              this.$set(item, 'singlePrice', '');
+            if (item.taxRate === undefined) this.$set(item, 'taxRate', '');
             if (item.discountRatio === undefined)
               this.$set(item, 'discountRatio', 100);
         });
@@ -580,8 +583,8 @@
       },
       // 重算某一行金额(参考 inventoryTable.vue 价格计算链)
       calcRow(row) {
-        const count = +row.statementCount || 0;
-        const price = +row.singlePrice || 0;
+        const count = +row.statementCount;
+        const price = +row.singlePrice;
         // 折让比例未填写时按 100(不打折)计,避免金额被算成 0
         const ratio = row.discountRatio === '' ||
           row.discountRatio === null ||
@@ -589,7 +592,7 @@
           isNaN(+row.discountRatio)
           ? 100
           : +row.discountRatio;
-        const taxRate = +row.taxRate || 0;
+        const taxRate = +row.taxRate;
         // 本次对账金额
         const amount = Math.round(count * price * (ratio / 100) * 100) / 100;
         this.$set(row, 'statementAmount', amount);

+ 6 - 2
src/views/saleManage/saleOrder/accountstatement/components/receivableInfo.vue

@@ -177,6 +177,8 @@
         rules: {},
         // 本地维护的应收明细,避免每次编辑都同步回父组件
         localList: [],
+        // 当前打开收款条件选择器的行索引
+        currentRowIndex: null,
         columns: [
           {
             width: 60,
@@ -317,17 +319,19 @@
       },
 
       changeReceiveTerms(row, index) {
+        console.log('changeReceiveTerms~~~', row);
         const targetIndex = index != null ? index : this.currentRowIndex;
         if (targetIndex == null) return;
         this.updateRowField(targetIndex, 'collectionConditionId', row.id);
         this.updateRowField(targetIndex, 'collectionConditionName', row.name);
       },
       // 行内字段修改:仅更新本地副本
+      // 注意:必须用 $set 直接修改原对象属性,保持引用不变,
+      // 否则 ele-pro-table 内部缓存的 tableData 仍引用旧对象,导致表格不更新
       updateRowField(index, key, val) {
         const item = this.localList[index];
         if (!item) return;
-        this.localList[index] = { ...item, [key]: val };
-        this.recalcRow(item);
+        this.$set(item, key, val);
       },
       // 新增一行预收款(空白行,供手动填写)
       addRow() {

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

@@ -208,7 +208,7 @@
   } from '@/api/saleManage/accountstatement';
   import dictMixins from '@/mixins/dictMixins';
   import AccountInfoDialog from '@/views/financialManage/invoiceManage/components/accountInfoDialog.vue';
-  import addInvoiceDialog from '@/views/financialManage/invoiceManage/components/addOrEditDialog.vue'
+  import addInvoiceDialog from '@/views/financialManage/invoiceManage/components/addOrEditDialogNew.vue'
   import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
   import tabMixins from '@/mixins/tableColumnsMixin';
   import addReceivableDialog from '@/views/financialManage/receivableManage/components/addReceivableDialog.vue'
@@ -474,9 +474,9 @@
         setTimeout(() => {
           this.addInvoiceDialogFlag = true;
           this.$nextTick(() => {
-            this.$refs.addInvoiceDialogRef.createInvoice(
-              row,
-              1,
+            this.$refs.addInvoiceDialogRef.createInvoice1(
+              [row],
+              '1',
               1
             );
           });

+ 68 - 25
src/views/saleManage/saleOrder/components/contractListDialog.vue

@@ -37,9 +37,10 @@
             height="calc(100vh - 500px)"
             class="dict-table"
             @cell-click="cellClick"
-            :rowClickChecked="true"
+            :rowClickChecked="false"
+            :selection.sync="selection"
           >
-            <!-- 表头工具栏 -->
+            <!-- 单选:radio 列;多选:selection 列(由 columns 动态控制) -->
             <template v-slot:action="{ row }">
               <el-radio
                 class="radio"
@@ -63,7 +64,7 @@
     </el-card>
 
     <div class="btns" slot="footer">
-      <el-button type="primary" size="small" v-if="!isAcc" @click="selected"
+      <el-button type="primary" size="small" v-if="!isAcc || multiple" @click="selected"
         >选择</el-button
       >
       <el-button size="small" @click="handleClose">关闭</el-button>
@@ -112,13 +113,41 @@
       },
       isCreatedByOrder: {
         default: 0
+      },
+      // 是否多选:true 多选(复选框),false 单选(radio)
+      multiple: {
+        type: Boolean,
+        default: false
       }
     },
     data() {
       return {
         visible: false,
         currentIndex: null,
-        columns: [
+        selection: [],
+        isAcc: false, //是否对账
+        radio: null
+      };
+    },
+    computed: {
+      columns() {
+        // 根据 multiple 决定选择列:多选(复选框)或单选(radio)
+        const selectColumn = this.multiple
+          ? {
+              type: 'selection',
+              width: 55,
+              align: 'center',
+              fixed: 'left'
+            }
+          : {
+              action: 'action',
+              slot: 'action',
+              align: 'center',
+              label: '选择',
+              width: 80,
+              fixed: 'left'
+            };
+        return [
           {
             columnKey: 'index',
             label: '序号',
@@ -128,13 +157,7 @@
             showOverflowTooltip: true,
             fixed: 'left'
           },
-          {
-            action: 'action',
-            slot: 'action',
-            align: 'center',
-            label: '选择',
-            minWidth: 100
-          },
+          selectColumn,
           {
             prop: 'contractNo',
             label: '合同编码',
@@ -177,7 +200,6 @@
             showOverflowTooltip: true,
             minWidth: 130
           },
-
           {
             prop: 'partaTel',
             label: '甲方联系电话',
@@ -206,7 +228,6 @@
             showOverflowTooltip: true,
             minWidth: 130
           },
-
           {
             prop: 'enabled',
             label: '是否可用',
@@ -217,6 +238,16 @@
               return _row.enabled ? '是' : '否';
             }
           },
+          {
+            prop: 'hasGeneratedOrder',
+            label: '是否已生成订单',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 140,
+            formatter: (_row, _column, cellValue) => {
+              return _row.hasGeneratedOrder ? '是' : '否';
+            }
+          },
           {
             prop: 'contractStartDate',
             label: '签订日期',
@@ -248,7 +279,6 @@
             showOverflowTooltip: true,
             minWidth: 130
           },
-
           {
             prop: 'createTime',
             label: '创建时间',
@@ -256,12 +286,9 @@
             showOverflowTooltip: true,
             minWidth: 150
           }
-        ],
-        isAcc: false, //是否对账
-        radio: null
-      };
+        ];
+      }
     },
-
     methods: {
       open(item, currentIndex, isAcc = false) {
         this.currentIndex = currentIndex;
@@ -321,6 +348,7 @@
         this.visible = false;
         this.current = null;
         this.radio = '';
+        this.selection = [];
       },
       async addConfirm() {
         return await this.$confirm('该合同已经生成过订单, 是否继续?', '提示', {
@@ -336,24 +364,39 @@
           });
       },
       async selected() {
-        if (!this.current) {
+        // 多选模式:取 selection 数组;单选模式:取 current 单条
+        const selectedRows = this.multiple ? this.selection : [this.current];
+        if (!this.multiple && !this.current) {
+          return this.$message.warning('请至少选择一条数据');
+        }
+        if (this.multiple && !this.selection.length) {
           return this.$message.warning('请至少选择一条数据');
         }
         if (this.isChange) {
-          this.$emit('changeParent', this.current, this.currentIndex);
+          this.$emit('changeParent', this.multiple ? selectedRows : this.current, this.currentIndex);
           this.handleClose();
           return;
         }
         if (this.isAdd) {
-          this.$emit('changeParent', this.current, this.currentIndex);
+          this.$emit('changeParent', this.multiple ? selectedRows : this.current, this.currentIndex);
           this.handleClose();
           return;
         }
-        if (this.current.hasGeneratedOrder > 0 && !(await this.addConfirm())) {
-          return;
+        // 检查选中行是否已生成订单
+        if (this.multiple) {
+          // 多选:存在已生成订单的合同直接提示并拦截
+          if (selectedRows.some((item) => item.hasGeneratedOrder > 0)) {
+            this.$message.warning('已生成过订单的合同不能开发票');
+            return;
+          }
+        } else {
+          // 单选:弹确认框
+          if (this.current.hasGeneratedOrder > 0 && !(await this.addConfirm())) {
+            return;
+          }
         }
 
-        this.$emit('changeParent', this.current, this.currentIndex);
+        this.$emit('changeParent', this.multiple ? selectedRows : this.current, this.currentIndex);
         this.handleClose();
       },
       selected1(item) {