Browse Source

feat: 销售开票

liujt 2 months ago
parent
commit
a0304d0717

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

@@ -84,3 +84,12 @@ export async function invoiceApplySubmit(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 新版信息
+export async function  initInvoiceByStatementId(params) {
+  const res = await request.get(`/eom/accountstatement/getInitInvoiceByStatementId`, { params });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+} 

+ 26 - 0
src/api/financialManage/receivableManage/index.js

@@ -58,3 +58,29 @@ export async function finReceivableUpdateAmountAPI(id, data) {
   return Promise.reject(new Error(res.data.message));
 }
 
+// 获取应收初始化信息
+export async function getFinReceivableInitInfoAPI(params) {
+  const res = await request.get(`/eom/accountstatement/getReceivableByStatementId`, {params});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+//保存应收
+export async function saveReceivableAPI(data) {
+  const res = await request.post(`/eom/accountstatement/saveReceivable`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 更新应收
+export async function updateReceivableAPI(data) {
+  const res = await request.put(`/eom/finreceivable/update`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 100 - 0
src/views/financialManage/collectionPlan/components/collectionDialog.vue

@@ -0,0 +1,100 @@
+<template>
+  <ele-modal
+    custom-class="ele-dialog-form long-dialog-form"
+    :centered="true"
+    :visible.sync="collectionDialogFlag"
+    :title="title"
+    :append-to-body="true"
+    :close-on-click-modal="false"
+    width="60%"
+    :before-close="cancel"
+    :maxable="true"
+    :resizable="true"
+  >
+    <info-table ref="feeRelatedInfoTable" v-if="form.id" :form.sync="form"></info-table>
+    <div slot="footer">
+      <el-button type="primary" @click="handleSave(0)">保存</el-button>
+      <el-button @click="cancel">返回</el-button>
+    </div>
+
+  </ele-modal>
+</template>
+<script>
+import infoTable from "@/views/financialManage/receivableManage/components/infoTable.vue";
+import {finReceivableSaveAPI, getFinReceivableInfoAPI, finReceivableUpdateAmountAPI} from "@/api/financialManage/receivableManage";
+import { receiptPaymentPlanById } from '@/api/financialManage/payAndCollectPlan';
+
+export default {
+  name: "collectionDialog",
+  components: {
+    infoTable
+  },
+  props: {
+    collectionDialogFlag: {
+      type: Boolean,
+      default: false
+    },
+  },
+  computed: {},
+  data() {
+    return {
+      dialogType: '',
+      title: '',
+      form: {
+        id: '',
+      },
+      rules: {}
+    }
+  },
+  created() {
+
+  },
+  methods: {
+    //初始化
+    async init(row = {}, type) {
+      this.title = '收款'
+      this.dialogType = type
+      this.currentRow = row
+
+      await this.getInfo(row.orderId)
+
+    },
+    //获取详情
+    async getInfo(id) {
+      const data = await receiptPaymentPlanById(id)
+
+      const detail = data.details.filter(item => item.detailNo === this.currentRow.detailNo)?.[0]
+      if(detail) {
+        this.form = {
+          ...detail
+        }
+      }
+    },
+    //
+    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)
+      this.$message.success('操作成功')
+      this.done()
+      this.cancel()
+    },
+    //刷新主列表数据
+    done() {
+      this.$emit('reload')
+    },
+    //关闭弹窗
+    cancel() {
+      this.$emit('update:collectionDialogFlag', false)
+    }
+  }
+}
+</script>
+<style scoped lang="scss">
+
+</style>

+ 19 - 4
src/views/financialManage/collectionPlan/index.vue

@@ -37,7 +37,7 @@
             >
               <!-- 表头工具栏 -->
               <template v-slot:toolbar>
-                <el-button
+                <!-- <el-button
                   size="small"
                   type="primary"
                   icon="el-icon-plus"
@@ -45,7 +45,7 @@
                   @click="handleModal('add')"
                 >
                   合并开票
-                </el-button>
+                </el-button> -->
               </template>
 
               <!-- 查看详情列 -->
@@ -103,7 +103,7 @@
                   type="primary"
                   :underline="false"
                   icon="el-icon-plus"
-                  @click="openEdit(row, 'single')"
+                  @click="handleCollection(row, 'update')"
                 >
                   确认收款
                 </el-link>
@@ -148,6 +148,12 @@
       type="1"
       @getPlanData="(selection) => openEdit(selection, 'merge')"
     ></collectionPlanDialog>
+    <collection-dialog
+      ref="collectionDialogRef"
+      v-if="collectionDialogFlag"
+      :collection-dialog-flag.sync="collectionDialogFlag"
+      @reload="reload"
+    ></collection-dialog>
   </div>
 </template>
 
@@ -168,6 +174,7 @@ import contractDetailDialog from '@/views/contractManage/contractBook/components
 import invoiceDetailDialog from '@/views/financialManage/invoiceManage/components/detailDialog.vue';
 import receivableOrderDetailDialog from '@/views/financialManage/receivableManage/components/detailDialog.vue';
 import collectionPlanDialog from '@/views/financialManage/invoiceManage/components/collectionPlanDialog.vue'   // 收款计划列表
+import collectionDialog from './components/collectionDialog.vue';
 export default {
   mixins: [dictMixins, tabMixins],
   components: {
@@ -178,7 +185,8 @@ export default {
     invoiceDetailDialog,
     receivableOrderDetailDialog,
     drawer,
-    collectionPlanDialog
+    collectionPlanDialog,
+    collectionDialog
   },
   data() {
     return {
@@ -189,6 +197,7 @@ export default {
       paymentStatus,
       invoiceStatusOp,
       receivableOrderDetailDialogFlag: false,
+      collectionDialogFlag: false,
       collectionPlanDialogFlag: false,
       tabOptions: [
         { key: 'collectionPlan', name: '收款计划管理', reminder: 'purchaseOrderNum' },
@@ -557,6 +566,12 @@ export default {
     
   },
   methods: {
+    handleCollection(row = {}, type) {
+        this.collectionDialogFlag = true;
+        this.$nextTick(() => {
+          this.$refs.collectionDialogRef.init(row, type);
+        });
+      },
     /* 表格数据源 1:销售订单、2:采购订单 */
     datasource({ page, limit, where, order }) {
       this.params = {

+ 48 - 12
src/views/financialManage/invoiceManage/components/accountstatementDialog.vue

@@ -19,6 +19,10 @@
         row-key="id"
         height="calc(100vh - 500px)"
         class="dict-table"
+        :selection.sync="selection"
+        :row-click-checked="true"
+        :row-click-checked-intelligent="!multiple"
+        @selection-change="handleSelectionChange"
       >
         <!-- 表头工具栏 -->
         <template v-slot:action="{ row }">
@@ -67,6 +71,11 @@
         default: false,
         type: Boolean
       },
+      // 选择模式:true 多选(复选框列),false 单选(radio 列)
+      multiple: {
+        type: Boolean,
+        default: false
+      },
       contactData: {
         type: Object,
         default: () => {
@@ -78,7 +87,22 @@
       return {
         currentIndex: null,
         accountInfoDialogFlag: false,
-        columns: [
+        selection: [],
+        currentRow: {},
+        radio: null
+      };
+    },
+    computed: {
+      columns() {
+        // element-ui 原生不支持 type="radio",统一用 selection 复选框列,
+        // 单选/多选通过 handleSelectionChange 约束选中数量实现
+        const selectColumn = {
+          type: 'selection',
+          width: 55,
+          align: 'center',
+          fixed: 'left'
+        };
+        return [
           {
             columnKey: 'index',
             label: '序号',
@@ -88,13 +112,14 @@
             showOverflowTooltip: true,
             fixed: 'left'
           },
-          {
-            action: 'action',
-            slot: 'action',
-            align: 'center',
-            label: '选择',
-            fixed: 'left'
-          },
+          selectColumn,
+          // {
+          //   action: 'action',
+          //   slot: 'action',
+          //   align: 'center',
+          //   label: '操作',
+          //   fixed: 'left'
+          // },
           {
             prop: 'statementNo',
             label: '对账单编码',
@@ -154,10 +179,8 @@
             showOverflowTooltip: true,
             minWidth: 170
           }
-        ],
-        currentRow: {},
-        radio: null
-      };
+        ];
+      }
     },
 
     methods: {
@@ -197,6 +220,19 @@
           this.$refs.accountInfoDialogRef.init(row, index);
         });
       },
+      // 选择变化:多选直接透传;单选只保留最后选中的一项
+      handleSelectionChange(selection) {
+        let result = selection;
+        if (!this.multiple && selection.length > 1) {
+          // 单选模式:只保留最新选中的一项,回写表格勾选状态
+          const last = selection[selection.length - 1];
+          result = [last];
+          this.$refs.table.clearSelection();
+          this.$refs.table.toggleRowSelection(last, true);
+        }
+        this.selection = result;
+        this.$emit('selectionChange', result);
+      },
       handleClose() {
         this.$emit('update:accountstatementDialogFlag', false);
       }

+ 62 - 42
src/views/financialManage/invoiceManage/components/addOrEditDialog.vue

@@ -45,17 +45,18 @@
               <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="4"></el-option>
-              <!-- <el-option
-                label="应收"
+              
+              <el-option
+                label="已收"
                 :value="5"
                 v-if="form.type == 1"
               ></el-option>
               <el-option
-                label="应付"
+                label="已付"
                 :value="4"
                 v-if="form.type == 2"
-              ></el-option> -->
+              ></el-option>
+              <el-option label="其他无订单无合同" :value="6"></el-option>
             </el-select>
           </el-form-item>
         </el-col>
@@ -87,7 +88,7 @@
           </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
@@ -96,7 +97,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
@@ -271,16 +272,18 @@
         </el-col>
       </el-row>
     </el-form>
-    <headerTitle title="关联物品清单"></headerTitle>
-    <table-info
-      :isOtherSourceFlag="isOtherSourceFlag"
-      :dialogType="dialogType"
-      :form="form"
-      :contactData="contactData"
-      ref="table"
-      @setPrice="setPrice"
-      :invoiceAmount="form.invoiceAmount"
-    ></table-info>
+    <div style="margin-top: 20px">
+      <headerTitle title="关联物品清单"></headerTitle>
+      <table-info
+        :isOtherSourceFlag="isOtherSourceFlag"
+        :dialogType="dialogType"
+        :form="form"
+        :contactData="contactData"
+        ref="table"
+        @setPrice="setPrice"
+        :invoiceAmount="form.invoiceAmount"
+      ></table-info>
+    </div>
     <div slot="footer">
       <el-button type="primary" @click="handleSave(0)">保存</el-button>
       <el-button
@@ -351,7 +354,8 @@
   import {
     invoiceApplyInfoAPI,
     invoiceApplySaveAPI,
-    invoiceApplyUpdateAPI
+    invoiceApplyUpdateAPI,
+    initInvoiceByStatementId
   } from '@/api/financialManage/invoiceManage';
   import { getpurchaseorderDetail } from '@/api/purchasingManage/purchaseOrder';
   import { getSaleOrderDetail } from '@/api/saleManage/saleorder';
@@ -677,35 +681,51 @@
         this.$set(this.form, 'type', Number(type));
         this.$set(this.form, 'sourceType', sourceType);
 
-        await this.init({}, 'add');
+        // await this.init({}, 'add');
 
-        if (sourceType == 2) {
-          this.changeContract(data);
-        }
-        if (sourceType == 3) {
-          this.changeOrder(data);
-        }
-        if (sourceType == 4 || sourceType == 5) {
-          this.payableManage(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'
+      async createInvoice(
+        data, type, sourceType
       ) {
-        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);
+        this.$set(this.form, 'type', Number(type));
+        this.$set(this.form, 'sourceType', sourceType);
+
+        let res = await initInvoiceByStatementId({
+          statementId: data.id
+        })
+
+        console.log('res~~~', res)
+
+        this.form = {
+          ...this.form,
+          ...res
+        }
+
+        this.$nextTick(() => {
+          this.$refs.table.setValue(this.form);
+        });
+        // 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) {

+ 39 - 51
src/views/financialManage/invoiceManage/components/tableInfoNew.vue

@@ -116,36 +116,32 @@
           {
             width: 100,
             prop: 'key',
-            label: '编码',
+            label: '对账单编码',
             align: 'center'
           },
+          // {
+          //   width: 100,
+          //   prop: 'key',
+          //   label: '对账日期',
+          //   align: 'center'
+          // },
           {
             width: 100,
-            prop: 'typeName',
-            label: '类型',
-            slot: 'typeName',
+            prop: 'key',
+            label: '销售订单编码',
             align: 'center'
           },
           // {
-          //   minWidth: 100,
-          //   prop: 'sourceCode',
-          //   label: '类型编码',
-          //   slot: 'sourceCode',
-          //   align: 'center'
-          // },
-          // {
           //   width: 100,
-          //   prop: 'productCategoryName',
-          //   label: '分类',
-          //   slot: 'productCategoryName',
-          //   align: "center"
+          //   prop: 'key',
+          //   label: '发货单编码',
+          //   align: 'center'
           // },
           // {
           //   width: 100,
-          //   prop: 'productCode',
-          //   label: '编码',
-          //   slot: 'productCode',
-          //   align: "center"
+          //   prop: 'key',
+          //   label: '发货日期',
+          //   align: 'center'
           // },
           {
             minWidth: 100,
@@ -154,36 +150,7 @@
             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',
@@ -274,6 +241,27 @@
             label: '折让合计',
             align: 'center'
           },
+          {
+            width: 100,
+            prop: 'key',
+            label: '产品编码',
+            align: 'center'
+          },
+          {
+            minWidth: 100,
+            prop: 'modelType',
+            label: '型号',
+            slot: 'modelType',
+            align: 'center'
+          },
+
+          {
+            minWidth: 100,
+            prop: 'specification',
+            label: '规格',
+            slot: 'specification',
+            align: 'center'
+          },
           // {
           //   width: 100,
           //   prop: 'sourceType',
@@ -444,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;
       },

+ 2 - 2
src/views/financialManage/paymentPlan/index.vue

@@ -39,7 +39,7 @@
             >
               <!-- 表头工具栏 -->
               <template v-slot:toolbar>
-                <el-button
+                <!-- <el-button
                   size="small"
                   type="primary"
                   icon="el-icon-plus"
@@ -47,7 +47,7 @@
                   @click="handleModal('add')"
                 >
                   合并开票
-                </el-button>
+                </el-button> -->
               </template>
 
               <!-- 查看详情列 -->

+ 187 - 166
src/views/financialManage/receivableManage/components/addReceivableDialog.vue

@@ -20,7 +20,7 @@
             <el-form-item label="会计科目:" prop="accountingSubjectId">
               <ele-tree-select
                 clearable
-                :disabled="isDetail"
+                :disabled="dialogType == 'view'"
                 filterable
                 ref="treeSelect"
                 :data="accountingSubjectList"
@@ -36,11 +36,11 @@
           <el-col :span="8">
             <el-form-item
               label="应收日期"
-              prop="date"
+              prop="receivableDate"
             >
               <el-date-picker
                 :disabled="dialogType == 'view'"
-                v-model="dataForm.date"
+                v-model="dataForm.receivableDate"
                 value-format="yyyy-MM-dd"
                 type="date"
                 style="width: 100%"
@@ -49,8 +49,8 @@
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item prop="receivablePrice" label="应收金额">
-              <el-input disabled v-model="dataForm.receivablePrice"></el-input>
+            <el-form-item prop="receivableTotalPrice" label="应收金额">
+              <el-input :disabled="dialogType == 'view'" v-model="dataForm.receivableTotalPrice"></el-input>
             </el-form-item>
           </el-col>
         </el-row>
@@ -66,62 +66,59 @@
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item prop="createUserName" label="发票种类">
+            <el-form-item prop="category" label="发票种类">
               <el-select
-                :disabled="dialogType == 'view' || !!saleOrderData?.id"
+                :disabled="true"
                 clearable
                 class="ele-block"
-                v-model="dataForm.sourceType"
+                v-model="dataForm.category"
                 placeholder="请选择"
               >
-                <el-option label="客户" :value="1" />
-                <!--            <el-option label="项目" :value="2"/>-->
-                <!-- <el-option label="合同" :value="4" /> -->
-
-                <el-option label="销售订单" :value="3" />
+                <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>
           <el-col :span="8">
-            <el-form-item prop="createUserName" label="公司名称">
-              <el-input disabled v-model="dataForm.price"></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-select
-                :disabled="dialogType == 'view' || !!saleOrderData?.id"
+                :disabled="true"
                 clearable
                 class="ele-block"
                 v-model="dataForm.sourceType"
                 placeholder="请选择"
               >
-                <el-option label="客户" :value="1" />
+                <el-option label="采购订单" :value="2" />
                 <!--            <el-option label="项目" :value="2"/>-->
                 <!-- <el-option label="合同" :value="4" /> -->
 
-                <el-option label="销售订单" :value="3" />
+                <el-option label="销售订单" :value="1" />
               </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item prop="createUserName" label="来源编码">
-              <el-input disabled v-model="dataForm.price"></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-col :span="8">
-            <el-form-item prop="createTime" label="备注">
-              <el-input disabled v-model="dataForm.createTime"></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="12">
-            <el-form-item prop="repliedFiles" label="附件">
-              <fileMain v-model="dataForm.repliedFiles" type="view"></fileMain>
+            <el-form-item prop="files" label="附件">
+              <fileMain v-model="dataForm.files" :type="dialogType == 'view' ? 'view' : 'add'"></fileMain>
             </el-form-item>
           </el-col>
         </el-row>
@@ -131,38 +128,16 @@
       <receivable-info
         :dataForm.sync="dataForm"
         :receivableList.sync="receivableList"
-        :dialogType="dialogType"
+        dialogType="view"
         @addAdvanceReceipt="addAdvanceReceipt"
         ref="receivableInfoRef"
       ></receivable-info>
 
-      <headerTitle title="对账明细" style="margin-top: 30px">
-        <!-- <template v-slot>
-          <el-row style="font-weight: 700; color: red">
-            <span>订单总金额:</span>
-            <span>{{ isNonDirectionalSale ? '--' : dataForm.orderTotalAmount || 0 }}</span>
-            <el-divider direction="vertical"></el-divider>
-            <span>已对账金额:</span>
-            <span>{{ dataForm.amountCompletePrice || 0 }}</span>
-            <el-divider direction="vertical"></el-divider>
-            <span>未对账金额:</span>
-            <span>{{ dataForm.amountUnCompletePrice || 0 }}</span>
-            <el-divider direction="vertical"></el-divider>
-            <span>本次对账总金额:</span>
-            <span>{{ dataForm.amountTotalPrice || 0 }}</span>
-          </el-row>
-        </template> -->
-      </headerTitle>
-      <!-- <recorpayTableList
-        ref="recorpayListRef"
-        :dataForm="dataForm"
-        :recorpayList.sync="recorpayList"
-        :dialogType="dialogType"
-      ></recorpayTableList> -->
+      <headerTitle title="对账明细" style="margin-top: 30px"></headerTitle>
       <account-detail-table
         ref="accountDetailTableRef"
         :datasource.sync="datasource"
-        :dialogType="dialogType"
+        dialogType="view"
         :queryDimension="dataForm.queryDimension"
         @totalChange="handleTotalChange"
         @countChange="handleCountChange"
@@ -214,6 +189,7 @@
     accountstatementInfoAPI,
     accountstatementUpdateAPI
   } from '@/api/saleManage/accountstatement';
+  import { getFinReceivableInitInfoAPI, getFinReceivableInfoAPI, saveReceivableAPI, updateReceivableAPI } from '@/api/financialManage/receivableManage';
   import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
   import { paymentTypeOp } from '@/enum/dict';
   import { getTreeByPid } from '@/api/classifyManage';
@@ -257,7 +233,11 @@
         receivableList: [],
         accountingSubjectList: [],
         isDetail: false,
+        statReceipt: null,
         dataForm: {
+          accountingSubjectId: '',
+          accountingSubjectCode: '',
+          accountingSubjectName: '',
           sourceType: 1,
           dateType: 1,
           queryDimension: 1,
@@ -286,26 +266,29 @@
           totalReceivableAmount: 0
         },
         rules: {
-          sourceType: { required: true, message: '请选择', trigger: 'change' },
-          contactId: { required: true, message: '请选择', trigger: 'change' },
-          projectId: { required: true, message: '请选择', trigger: 'change' },
-          orderId: { required: true, message: '请选择', trigger: 'change' },
-          dateType: { required: true, message: '请选择', trigger: 'change' },
-          year: { required: true, message: '请选择', trigger: 'change' },
-          quarter: { required: true, message: '请选择', trigger: 'change' },
-          month: { required: true, message: '请选择', trigger: 'change' },
-          dateTimeRange: {
-            required: true,
-            message: '请选择',
-            trigger: 'change'
-          },
-          sourceId: { required: true, message: '请选择', trigger: 'change' },
-          contractId: { required: true, message: '请选择', trigger: 'change' },
-          queryDimension: {
-            required: true,
-            message: '请选择',
-            trigger: 'change'
-          }
+          accountingSubjectId: { required: true, message: '请选择', trigger: 'change' },
+          receivableDate: { required: true, message: '请选择', trigger: 'change' },
+          receivableTotalPrice: { required: true, message: '请输入', trigger: 'change' },
+          // sourceType: { required: true, message: '请选择', trigger: 'change' },
+          // contactId: { required: true, message: '请选择', trigger: 'change' },
+          // projectId: { required: true, message: '请选择', trigger: 'change' },
+          // orderId: { required: true, message: '请选择', trigger: 'change' },
+          // dateType: { required: true, message: '请选择', trigger: 'change' },
+          // year: { required: true, message: '请选择', trigger: 'change' },
+          // quarter: { required: true, message: '请选择', trigger: 'change' },
+          // month: { required: true, message: '请选择', trigger: 'change' },
+          // dateTimeRange: {
+          //   required: true,
+          //   message: '请选择',
+          //   trigger: 'change'
+          // },
+          // sourceId: { required: true, message: '请选择', trigger: 'change' },
+          // contractId: { required: true, message: '请选择', trigger: 'change' },
+          // queryDimension: {
+          //   required: true,
+          //   message: '请选择',
+          //   trigger: 'change'
+          // }
         },
         title: '',
         processSubmitDialogFlag: false,
@@ -314,9 +297,9 @@
       };
     },
     computed: {
-      isNonDirectionalSale() {
-        return this.datasource.some((item) => item.orderCategory == 4);
-      }
+      // isNonDirectionalSale() {
+      //   return this.datasource.some((item) => item.orderCategory == 4);
+      // }
     },
     methods: {
       changeSubjectInfo(val) {
@@ -364,95 +347,133 @@
             : dialogType == 'update'
             ? '修改'
             : '详情';
-        this.dataForm.type = type;
+        // this.dataForm.type = type;
         await this.getClassifyList(24, 'accountingSubjectList');
-        this.$nextTick(() => {
-          if (this.contactData.id) {
-            this.$refs.saleFormRef.getCusInfo(this.contactData);
-          }
-          if (this.saleOrderData.id) {
-            this.$refs.saleFormRef.getOrderInfo(this.saleOrderData);
-          }
-        });
+        // this.$nextTick(() => {
+        //   if (this.contactData.id) {
+        //     this.$refs.saleFormRef.getCusInfo(this.contactData);
+        //   }
+        //   if (this.saleOrderData.id) {
+        //     this.$refs.saleFormRef.getOrderInfo(this.saleOrderData);
+        //   }
+        // });
         if (this.dialogType !== 'add') {
           this.businessId = row.id;
           this.getInfo(row);
+        } else {
+          let data = await getFinReceivableInitInfoAPI({
+            statementId: row.id
+          });
+
+          this.dataForm = {
+            ...this.dataForm,
+            ...data
+          };
+
+          this.statReceipt = data.statReceipt || null;
+
+          this.receivableList =
+          (data.statReceipt && data.statReceipt.statReceiptDetailList) || [];
+
+          this.datasource = data.productList || [];
+
+
+          console.log('data~~~~~~~', data);
         }
       },
+      // 应收
+      // handleAddReceivable(type, row) {
+      //   this.addReceivableDialogFlag = true;
+      //   this.$nextTick(() => {
+      //     this.$refs.addReceivableDialogRef.open(type, row);
+      //   });
+      // },
       //获取对账单详情
       async getInfo(row) {
-        let data = await accountstatementInfoAPI(row.id);
-        console.log('data~~~', data);
-        // this.recorpayList = data.recorpayList || [];
-        // 解决小数精度丢失问题,使用分进行计算
-        data.orderTotalAmount =
-          data.orderList.reduce(
-            (pre, cur) => pre + Math.round(+cur.orderAmount * 100),
-            0
-          ) / 100;
-        data.amountTotalPrice =
-          data.orderList.reduce(
-            (pre, cur) => pre + Math.round(+cur.statementAmount * 100),
-            0
-          ) / 100;
-        data.amountCompletePrice =
-          data.orderList.reduce(
-            (pre, cur) => pre + Math.round(+cur.statementedAmount * 100),
-            0
-          ) / 100;
-        data.amountUnCompletePrice =
-          data.orderList.reduce(
-            (pre, cur) => pre + Math.round(+cur.unStatementAmount * 100),
-            0
-          ) / 100;
-        data.orderList = data.orderList.map((item) => {
-          item.deliveryProducts = item.deliveryProducts.map((i) => {
-            return {
-              ...i,
-              taxRate: i.taxRate || 0,
-              discountRatio: i.discountRatio || 100,
-              singlePrice: i.singlePrice || 0,
-              originalTotalCount: i.totalCount // 保存原始数量值用于校验
-            };
-          });
-          return item;
-        });
-        this.datasource = data.orderList || [];
-        this.receivableList = data.receivableList || [];
+        let data = await getFinReceivableInfoAPI(row.id);
+        console.log('getInfo~~~', data);
+
         this.dataForm = {
           ...this.dataForm,
-          ...data,
-          fundType: data.fundType || 2,
-          transactionMethod: data.transactionMethod || 1,
-          collectionTerms: data.collectionTerms || '',
-          receiptStatus: data.receiptStatus || 0,
-          totalAdvanceConfirmAmount: data.totalAdvanceConfirmAmount || 0,
-          totalReceivableAmount: data.totalReceivableAmount || 0
+          ...data
         };
-        switch (this.dataForm.dateType) {
-          case 1:
-            // this.dataForm.year = this.dataForm.dateValue;
-            this.$set(this.dataForm, 'year', this.dataForm.dateValue);
-            break;
-          case 2: {
-            //2023年-四季度
-            let data = this.dataForm.dateValue.split('年-');
 
-            this.$set(this.dataForm, 'year', data[0]);
-            this.$set(this.dataForm, 'quarter', data[1]);
-            break;
-          }
-          case 3:
-            this.$set(this.dataForm, 'month', this.dataForm.dateValue);
+        this.statReceipt = data.statReceipt || null;
 
-            break;
-          default:
-            this.dataForm.dateValue = '';
-            this.$set(this.dataForm, 'dateTimeRange', [
-              this.dataForm.startDate,
-              this.dataForm.endDate
-            ]);
-        }
+        this.receivableList =
+        (data.statReceipt && data.statReceipt.statReceiptDetailList) || [];
+
+        this.datasource = data.productList || [];
+        // this.recorpayList = data.recorpayList || [];
+        // 解决小数精度丢失问题,使用分进行计算
+        // data.orderTotalAmount =
+        //   data.orderList.reduce(
+        //     (pre, cur) => pre + Math.round(+cur.orderAmount * 100),
+        //     0
+        //   ) / 100;
+        // data.amountTotalPrice =
+        //   data.orderList.reduce(
+        //     (pre, cur) => pre + Math.round(+cur.statementAmount * 100),
+        //     0
+        //   ) / 100;
+        // data.amountCompletePrice =
+        //   data.orderList.reduce(
+        //     (pre, cur) => pre + Math.round(+cur.statementedAmount * 100),
+        //     0
+        //   ) / 100;
+        // data.amountUnCompletePrice =
+        //   data.orderList.reduce(
+        //     (pre, cur) => pre + Math.round(+cur.unStatementAmount * 100),
+        //     0
+        //   ) / 100;
+        // data.orderList = data.orderList.map((item) => {
+        //   item.deliveryProducts = item.deliveryProducts.map((i) => {
+        //     return {
+        //       ...i,
+        //       taxRate: i.taxRate || 0,
+        //       discountRatio: i.discountRatio || 100,
+        //       singlePrice: i.singlePrice || 0,
+        //       originalTotalCount: i.totalCount // 保存原始数量值用于校验
+        //     };
+        //   });
+        //   return item;
+        // });
+        // this.datasource = data.orderList || [];
+        // this.receivableList = data.receivableList || [];
+        // this.dataForm = {
+        //   ...this.dataForm,
+        //   ...data,
+        //   fundType: data.fundType || 2,
+        //   transactionMethod: data.transactionMethod || 1,
+        //   collectionTerms: data.collectionTerms || '',
+        //   receiptStatus: data.receiptStatus || 0,
+        //   totalAdvanceConfirmAmount: data.totalAdvanceConfirmAmount || 0,
+        //   totalReceivableAmount: data.totalReceivableAmount || 0
+        // };
+        // switch (this.dataForm.dateType) {
+        //   case 1:
+        //     // this.dataForm.year = this.dataForm.dateValue;
+        //     this.$set(this.dataForm, 'year', this.dataForm.dateValue);
+        //     break;
+        //   case 2: {
+        //     //2023年-四季度
+        //     let data = this.dataForm.dateValue.split('年-');
+
+        //     this.$set(this.dataForm, 'year', data[0]);
+        //     this.$set(this.dataForm, 'quarter', data[1]);
+        //     break;
+        //   }
+        //   case 3:
+        //     this.$set(this.dataForm, 'month', this.dataForm.dateValue);
+
+        //     break;
+        //   default:
+        //     this.dataForm.dateValue = '';
+        //     this.$set(this.dataForm, 'dateTimeRange', [
+        //       this.dataForm.startDate,
+        //       this.dataForm.endDate
+        //     ]);
+        // }
         this.$forceUpdate();
       },
       //关闭弹窗
@@ -539,26 +560,26 @@
 
           let api =
             this.dialogType == 'add'
-              ? createAccountStatementAPI
-              : accountstatementUpdateAPI;
-          const totalAdvanceConfirmAmount =
-            this.receivableList.reduce(
-              (pre, cur) =>
-                pre + Math.round((+cur.currentConfirmAmount || 0) * 100),
-              0
-            ) / 100;
-          const totalReceivableAmount =
-            Math.round(
-              ((+this.dataForm.amountTotalPrice || 0) -
-                totalAdvanceConfirmAmount) *
-                100
-            ) / 100;
+              ? saveReceivableAPI
+              : updateReceivableAPI;
+          // const totalAdvanceConfirmAmount =
+          //   this.receivableList.reduce(
+          //     (pre, cur) =>
+          //       pre + Math.round((+cur.currentConfirmAmount || 0) * 100),
+          //     0
+          //   ) / 100;
+          // const totalReceivableAmount =
+          //   Math.round(
+          //     ((+this.dataForm.amountTotalPrice || 0) -
+          //       totalAdvanceConfirmAmount) *
+          //       100
+          //   ) / 100;
           let params = {
             ...this.dataForm,
-            totalAdvanceConfirmAmount,
-            totalReceivableAmount,
-            orderList: this.datasource,
-            receivableList: this.receivableList
+            // totalAdvanceConfirmAmount,
+            // totalReceivableAmount,
+            productList: this.datasource,
+            statReceipt: this.statReceipt
             // recorpayList: this.recorpayList
           };
           this.saveLoading = true;

+ 4 - 3
src/views/financialManage/receivableManage/components/infoTable.vue

@@ -5,7 +5,8 @@
         <el-divider direction="vertical"></el-divider>
         <span>应收金额:</span>
         <span>
-          <el-input style="width: 200px;" v-model="form.receivableTotalPrice" type="number" placeholder="请输入应收金额" :min="0" @change="updateReceivableTotalPrice" />
+          <!-- <el-input style="width: 200px;" v-model="form.receivableTotalPrice" type="number" placeholder="请输入应收金额" :min="0" @change="updateReceivableTotalPrice" /> -->
+          {{ form.receivableTotalPrice }}
         </span>
         <el-divider direction="vertical"></el-divider>
         <span>已收金额:</span>
@@ -40,7 +41,7 @@
         </template>
 
         <template v-slot:action="{ row, $index }">
-          <el-link
+          <!-- <el-link
             v-if="
               dialogType == 'view' && !row.invoiceStatus && !form.invoiceCode
             "
@@ -49,7 +50,7 @@
             @click="addInvoice(row)"
           >
             新增发票
-          </el-link>
+          </el-link> -->
           <el-popconfirm
             class="ele-action"
             title="确定要删除此信息吗?"

+ 47 - 23
src/views/financialManage/receivableManage/index.vue

@@ -42,6 +42,17 @@
             >
               收款
             </el-link>
+
+            <el-link
+              type="primary"
+              :underline="false"
+              icon="el-icon-plus"
+              @click="handleDetail(row, 'update')"
+              v-if="[0, 3].includes(row.approvalStatus)"
+            >
+              修改
+            </el-link>
+
             <el-link
               type="primary"
               :underline="false"
@@ -51,7 +62,7 @@
             >
               提交
             </el-link>
-            <el-link
+            <!-- <el-link
               type="primary"
               :underline="false"
               icon="el-icon-plus"
@@ -59,7 +70,7 @@
               v-if="canAddInvoice(row)"
             >
               新增发票
-            </el-link>
+            </el-link> -->
           </template>
           <!-- 收款信息 -->
           <template v-slot:code="{ row }">
@@ -117,6 +128,9 @@
       :isEditType="false"
       @reload="reload"
     />
+
+    <addReceivableDialog ref="addReceivableDialogRef" v-if="addReceivableDialogFlag"
+      :visible.sync="addReceivableDialogFlag"></addReceivableDialog>
   </div>
 </template>
 
@@ -133,6 +147,7 @@
   import tabMixins from '@/mixins/tableColumnsMixin';
   import { shippingModeOp, transactionMethodsOp, paymentTypeOp, paymentStatus, invoiceStatusOp } from '@/enum/dict.js';
   import addOrEditDialogNew from '@/views/financialManage/invoiceManage/components/addOrEditDialogNew.vue'
+  import addReceivableDialog from '@/views/financialManage/receivableManage/components/addReceivableDialog.vue'
 
   export default {
     mixins: [dictMixins,tabMixins],
@@ -142,7 +157,8 @@
       detailDialog,
       invoiceDetailDialog,
       processSubmitDialog,
-      addOrEditDialogNew
+      addOrEditDialogNew,
+      addReceivableDialog
     },
     //客户管理数据
     props: {
@@ -174,6 +190,7 @@
         paymentStatus,
         selection: [],
         addOrEditDialogNewFlag: false,
+        addReceivableDialogFlag: false,
         statusList: [
           {
             label: '未收款',
@@ -221,7 +238,7 @@
           {
             minWidth: 160,
             prop: 'receiptPlanOrderNo',
-            label: '收款计划编码',
+            label: '对账单编码',
             align: 'center',
             slot: 'receiptPlanOrderNo',
             showOverflowTooltip: true
@@ -298,13 +315,13 @@
             slot: 'paymentTypeName',
             showOverflowTooltip: true
           },
-          {
-            minWidth: 100,
-            prop: 'orderAmount',
-            label: '订单总额',
-            align: 'center',
-            showOverflowTooltip: true
-          },
+          // {
+          //   minWidth: 100,
+          //   prop: 'orderAmount',
+          //   label: '订单总额',
+          //   align: 'center',
+          //   showOverflowTooltip: true
+          // },
           {
             minWidth: 100,
             prop: 'receivableTotalPrice',
@@ -417,16 +434,16 @@
             align: 'center',
             showOverflowTooltip: true
           },
-        {
-          prop: 'externalId',
-          label: '是否推送',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 120,
-          formatter: (_row, _column, cellValue) => {
-            return _row.externalId? '已推送' : '未推送';
-          }
-        },
+          {
+            prop: 'externalId',
+            label: '是否推送',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 120,
+            formatter: (_row, _column, cellValue) => {
+              return _row.externalId? '已推送' : '未推送';
+            }
+          },
           {
             minWidth: 100,
             prop: 'approvalStatus',
@@ -489,10 +506,17 @@
           this.$refs.collectionDialogRef.init(row, type);
         });
       },
+      // 应收
+      handleAddReceivable(type, row) {
+        this.addReceivableDialogFlag = true;
+        this.$nextTick(() => {
+          this.$refs.addReceivableDialogRef.open(type, row);
+        });
+      },
       handleDetail(row = {}, type) {
-        this.detailDialogFlag = true;
+        this.addReceivableDialogFlag = true;
         this.$nextTick(() => {
-          this.$refs.detailDialogRef.init(row.id);
+          this.$refs.addReceivableDialogRef.open(type, row);
         });
       },
       handleInvoiceDetail(row = {}, type) {

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

@@ -418,16 +418,16 @@
             align: 'center',
             showOverflowTooltip: true
           },
-        {
-          prop: 'externalId',
-          label: '是否推送',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 120,
-          formatter: (_row, _column, cellValue) => {
-            return _row.externalId? '已推送' : '未推送';
-          }
-        },
+        // {
+        //   prop: 'externalId',
+        //   label: '是否推送',
+        //   align: 'center',
+        //   showOverflowTooltip: true,
+        //   minWidth: 120,
+        //   formatter: (_row, _column, cellValue) => {
+        //     return _row.externalId? '已推送' : '未推送';
+        //   }
+        // },
           {
             minWidth: 100,
             prop: 'approvalStatus',

+ 19 - 8
src/views/saleManage/saleOrder/accountstatement/index.vue

@@ -462,14 +462,25 @@
       /*新增发票*/
       handleAddInvoice(row) {
         this.currentRow = row;
-        this.accountInfoDialogFlag = true;
-        this.$nextTick(() => {
-          this.$refs.accountInfoDialogRef.createInvoice(
-            row,
-            'add',
-            'saleOrder'
-          );
-        });
+        // this.accountInfoDialogFlag = true;
+        // this.$nextTick(() => {
+        //   this.$refs.accountInfoDialogRef.createInvoice(
+        //     row,
+        //     'add',
+        //     'saleOrder'
+        //   );
+        // });
+        // this.currentRow.children = row;
+        setTimeout(() => {
+          this.addInvoiceDialogFlag = true;
+          this.$nextTick(() => {
+            this.$refs.addInvoiceDialogRef.createInvoice(
+              row,
+              1,
+              1
+            );
+          });
+        }, 400);
       },
       // 应收
       handleAddReceivable(type, row) {