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

feat(发票管理): 新增收款计划选择对话框并优化表格展示

liujt 5 місяців тому
батько
коміт
2ea56d6400

+ 2 - 2
src/BIZComponents/product-list.vue

@@ -140,7 +140,7 @@
             :initLoad="!isFirstRefreshTable"
             @columns-change="handleColumnChange"
             :rowClickChecked="true"
-            :cache-key="cacheKey"
+            :cache-key="cacheKeyUrl"
           >
             <!-- 表头工具栏 -->
             <template v-slot:action="{ row }">
@@ -260,7 +260,7 @@
         isColorId: [],
         dataSources: '1', // 0:仓库;1:主数据
         dimension: '1',
-        cacheKey: 'product-list-cache-key',
+        cacheKeyUrl: 'product-list-cache-key',
         searchForm: {
           categoryCode: '',
           categoryName: '',

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

@@ -251,11 +251,11 @@ export default {
           fixed: 'left'
         },
         {
-          prop: 'orderNo',
+          prop: 'collectionPlanCode',
           label: '收款计划编码',
           align: 'center',
           sortable: true,
-          slot: 'orderNo',
+          slot: 'collectionPlanCode',
           showOverflowTooltip: true,
           minWidth: 200,
         },
@@ -269,7 +269,7 @@ export default {
           minWidth: 200,
         },
         {
-          prop: 'sourceTypeName',
+          prop: 'orderType',
           label: '订单类型',
           align: 'center',
           sortable: true,
@@ -277,7 +277,7 @@ export default {
           minWidth: 200,
         },
         {
-          prop: 'sourceTypeName',
+          prop: 'contractCode',
           label: '合同编码',
           align: 'center',
           sortable: true,
@@ -285,7 +285,7 @@ export default {
           minWidth: 200,
         },
         {
-          prop: 'sourceTypeName',
+          prop: 'contractNo',
           label: '合同编号',
           align: 'center',
           sortable: true,
@@ -293,7 +293,7 @@ export default {
           minWidth: 200,
         },
         {
-          prop: 'sourceTypeName',
+          prop: 'contractName',
           label: '合同名称',
           align: 'center',
           sortable: true,
@@ -301,7 +301,7 @@ export default {
           minWidth: 200,
         },
         {
-          prop: 'sourceTypeName',
+          prop: 'invoiceNo',
           label: '发票号',
           align: 'center',
           sortable: true,
@@ -471,7 +471,7 @@ export default {
           minWidth: 120
         },
         {
-          prop: 'orderStatus',
+          prop: 'collectionPlanStatus',
           label: '审核状态',
           align: 'center',
           showOverflowTooltip: true,
@@ -491,7 +491,7 @@ export default {
           }
         },
         {
-          prop: 'orderStatus',
+          prop: 'orderStatus2',
           label: '收款状态',
           align: 'center',
           showOverflowTooltip: true,
@@ -501,7 +501,7 @@ export default {
           }
         },
         {
-          prop: 'orderStatus',
+          prop: 'orderStatus1',
           label: '逾期状态',
           align: 'center',
           showOverflowTooltip: true,

+ 76 - 7
src/views/financialManage/invoiceManage/components/addOrEditDialogNew.vue

@@ -273,7 +273,7 @@
           ref="table"
           :needPage="false"
           :columns="columns"
-          :datasource="tableData"
+          :datasource="tableForm.detailList"
           row-key="id"
           class="time-form"
         >
@@ -506,13 +506,13 @@
           },
           {
             width: 120,
-            prop: 'type',
+            prop: 'accountingSubjectCode',
             label: '收款计划编码',
             align: 'center'
           },
           {
             width: 120,
-            prop: 'type',
+            prop: 'orderCode',
             label: '订单编号',
             align: 'center'
           },
@@ -574,7 +574,8 @@
             prop: 'invoiceAmount',
             label: '开票金额',
             align: 'center',
-            slot: 'invoiceAmount'
+            slot: 'invoiceAmount',
+            fixed: 'right'
           }
         ];
       },
@@ -584,7 +585,7 @@
         tableData: [
           {
             id: 1,
-            type: 'SKJH202401001', // 收款计划编码
+            accountingSubjectCode: 'SKJH202401001', // 收款计划编码
             orderCode: 'DD202401001', // 订单编号
             orderType: '销售订单', // 订单类型
             contractCode: 'HT202401001', // 合同编码
@@ -595,10 +596,20 @@
             moneyName: '首期预付款', // 款项名称
             ratio: '30.00', // 比例
             price: 30000.00, // 计划收款金额
-            invoiceAmount: 15000.00 // 开票金额(测试用)
+            invoiceAmount: 15000.00, // 开票金额(测试用)
+            productList: [
+              {
+                productName: '商品A',
+                productCode: 'SK202401001',
+                productNum: 2,
+                productPrice: 10000.00,
+                productAmount: 20000.00
+              }
+            ]
           },
           {
             id: 2,
+            accountingSubjectCode: 'SKJH202401001', // 收款计划编码
             type: 'SKJH202401002',
             orderCode: 'DD202401001',
             orderType: '销售订单',
@@ -615,6 +626,7 @@
           {
             id: 3,
             type: 'SKJH202401003',
+            accountingSubjectCode: 'SKJH202401001', // 收款计划编码
             orderCode: 'DD202401001',
             orderType: '销售订单',
             contractCode: 'HT202401001',
@@ -651,7 +663,64 @@
         accountingSubjectList: [],
         deptList: [],
         deptTreeList: [],
-        tableForm: {},
+        tableForm: {
+          detailList: [
+            {
+              id: 1,
+              type: 'SKJH202401001', // 收款计划编码
+              orderCode: 'DD202401001', // 订单编号
+              orderType: '销售订单', // 订单类型
+              contractCode: 'HT202401001', // 合同编码
+              contractNumber: 'HTBH202401001', // 合同编号
+              contractName: '年度采购合同', // 合同名称
+              period: 1, // 期数
+              moneyType: '预付款', // 款项类型
+              moneyName: '首期预付款', // 款项名称
+              ratio: '30.00', // 比例
+              price: 30000.00, // 计划收款金额
+              invoiceAmount: 15000.00, // 开票金额(测试用)
+              productList: [
+                {
+                  productName: '商品A',
+                  productCode: 'SK202401001',
+                  productNum: 2,
+                  productPrice: 10000.00,
+                  productAmount: 20000.00
+                }
+              ]
+            },
+            {
+              id: 2,
+              type: 'SKJH202401002',
+              orderCode: 'DD202401001',
+              orderType: '销售订单',
+              contractCode: 'HT202401001',
+              contractNumber: 'HTBH202401001',
+              contractName: '年度采购合同',
+              period: 2,
+              moneyType: '进度款',
+              moneyName: '中期进度款',
+              ratio: '40.00',
+              price: 40000.00,
+              invoiceAmount: 20000.00
+            },
+            {
+              id: 3,
+              type: 'SKJH202401003',
+              orderCode: 'DD202401001',
+              orderType: '销售订单',
+              contractCode: 'HT202401001',
+              contractNumber: 'HTBH202401001',
+              contractName: '年度采购合同',
+              period: 3,
+              moneyType: '尾款',
+              moneyName: '最终尾款',
+              ratio: '30.00',
+              price: 30000.00,
+              invoiceAmount: 0
+            }
+          ]
+        },
         rules: {
           applyDeptId: { required: true, message: '请选择', trigger: 'change' },
           applyUserId: { required: true, message: '请选择', trigger: 'change' },

+ 237 - 0
src/views/financialManage/invoiceManage/components/collectionPlanDialog.vue

@@ -0,0 +1,237 @@
+<template>
+  <el-dialog
+    title="选择收款计划"
+    custom-class="ele-dialog-form long-dialog-form"
+    :visible.sync="accountstatementDialogFlag"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    top="5vh"
+    :close-on-press-escape="false"
+    append-to-body
+    width="70%"
+  >
+    <el-card shadow="never">
+      <search @search="reload"></search>
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        row-key="id"
+        height="calc(100vh - 500px)"
+        class="dict-table"
+      >
+        <!-- 表头工具栏 -->
+        <template v-slot:action="{ row }">
+          <el-button size="mini" type="text" @click="handleSelect(row)"
+            >对账明细</el-button
+          >
+        </template>
+      </ele-pro-table>
+    </el-card>
+
+    <div slot="footer">
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+    <!-- 对账明细   -->
+    <accountInfoDialog
+      ref="accountInfoDialogRef"
+      v-if="accountInfoDialogFlag"
+      :account-info-dialog-flag.sync="accountInfoDialogFlag"
+      @getAccountInfo="getAccountInfo"
+    ></accountInfoDialog>
+  </el-dialog>
+</template>
+
+<script>
+  import search from '@/views/financialManage/collectionPlan/components/searchTable.vue';
+  import { getAccountstatementList } from '@/api/saleManage/accountstatement';
+  import accountInfoDialog from './accountInfoDialog.vue';
+
+  export default {
+    components: {
+      search,
+      accountInfoDialog
+    },
+    props: {
+      form: {
+        type: Object,
+        default: () => {
+          return {};
+        }
+      },
+      type: {
+        type: String,
+        default: 1
+      },
+      accountstatementDialogFlag: {
+        default: false,
+        type: Boolean
+      },
+      contactData: {
+        type: Object,
+        default: () => {
+          return {};
+        }
+      }
+    },
+    data() {
+      return {
+        currentIndex: null,
+        accountInfoDialogFlag: false,
+        columns: [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            action: 'action',
+            slot: 'action',
+            align: 'center',
+            label: '选择',
+            fixed: 'left'
+          },
+          {
+            prop: 'statementNo',
+            label: '对账单编码',
+            align: 'center',
+            slot: 'statementNo',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+          {
+            prop: 'contactName',
+            label: '客户名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 180
+          },
+          {
+            prop: 'startDate',
+            label: '对账开始日期',
+            align: 'center',
+            slot: 'startDate',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+          {
+            prop: 'endDate',
+            label: '对账结束日期',
+            align: 'center',
+            slot: 'endDate',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+          {
+            prop: 'amountTotalPrice',
+            label: '总金额',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130
+          },
+          {
+            prop: 'amountReceivablePrice',
+            label: '应收金额',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130
+          },
+          {
+            prop: 'amountPayablePrice',
+            label: '应付金额',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 170
+          }
+        ],
+        currentRow: {},
+        radio: null
+      };
+    },
+
+    methods: {
+      init(item = {}, currentIndex = '') {
+        this.currentIndex = currentIndex;
+        // if (item.id) {
+        //   this.radio = item.id;
+        // }
+      },
+      getAccountInfo(item) {
+        this.currentRow.children = item;
+        this.$emit('getAccountData', this.currentRow);
+        this.handleClose();
+      },
+      /* 表格数据源 */
+      datasource({ page, limit, where, order }) {
+        if (this.contactData.id) {
+          where['contactId'] = this.contactData.id;
+        }
+        return getAccountstatementList({
+          pageNum: page,
+          size: limit,
+          ...where,
+          reviewStatus: 2,
+          type: this.type
+        });
+      },
+
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ pageNum: 1, where: where });
+      },
+      handleSelect(row, index) {
+        this.currentRow = row;
+        this.accountInfoDialogFlag = true;
+        this.$nextTick(() => {
+          this.$refs.accountInfoDialogRef.init(row, index);
+        });
+      },
+      handleClose() {
+        this.$emit('update:accountstatementDialogFlag', false);
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .tree_col {
+    border: 1px solid #eee;
+    padding: 10px 0;
+    box-sizing: border-box;
+    height: 500px;
+    overflow: auto;
+  }
+
+  .table_col {
+    padding-left: 10px;
+
+    ::v-deep .el-table th.el-table__cell {
+      background: #f2f2f2;
+    }
+  }
+
+  .pagination {
+    text-align: right;
+    padding: 10px 0;
+  }
+
+  .btns {
+    text-align: center;
+    padding: 10px 0;
+  }
+
+  .topsearch {
+    margin-bottom: 15px;
+  }
+</style>

+ 223 - 26
src/views/financialManage/invoiceManage/components/tableInfoNew.vue

@@ -1,24 +1,24 @@
 <template>
   <div>
     <el-tabs type="border-card">
-      <el-tab-pane label="用户管理">
-        <el-form ref="form" :model="tableForm">
+      <el-tab-pane :label="item.orderNo" v-for="(item, index) in formTable" :key="index">
+        <el-form ref="form" :model="item">
           <ele-pro-table
             ref="table"
             :needPage="false"
             :columns="columns"
-            :datasource="tableForm.detailList"
+            :datasource="item.detailList"
             row-key="id"
             class="time-form"
           >
             <template v-slot:toolbar>
-              <span>本次开票合计:{{ invoiceAmount }}</span>
+              <span>本次开票合计:{{ item.amountTotalPrice }}</span>
             </template>
             
-            <template v-slot:totalCount="scope">
+            <template v-slot:invoiceAmount="scope">
             <el-form-item
               style="width: 100%;"
-              :prop="'detailList.' + scope.$index + '.totalCount'"
+              :prop="'detailList.' + scope.$index + '.invoiceAmount'"
               :rules="[
                 {
                   required: true,
@@ -39,8 +39,37 @@
                 }
               ]"
             > 
-              <span v-if="dialogType === 'view'">{{ scope.row.totalCount }}</span>
-              <el-input v-else v-model="scope.row.totalCount" type="number" @input="updateTotalPrice(scope.row)"></el-input>
+              <span v-if="dialogType === 'view'">{{ scope.row.invoiceAmount }}</span>
+              <el-input v-else v-model="scope.row.invoiceAmount" type="number" @input="updateTotalPrice(scope.row)"></el-input>
+            </el-form-item>
+          </template>
+
+          <template v-slot:taxRate="scope">
+            <el-form-item
+              style="width: 100%;"
+              :prop="'detailList.' + scope.$index + '.taxRate'"
+              :rules="[
+                {
+                  required: true,
+                  message: '请输入数量',
+                  trigger: 'blur'
+                },
+                {
+                  validator: (rule, value, callback) => {
+                    if (value === undefined || value === null || value === '') {
+                      callback('请输入数量');
+                    } else if (parseFloat(value) <= 0) {
+                      callback('数量必须大于0');
+                    } else {
+                      callback();
+                    }
+                  },
+                  trigger: 'blur'
+                }
+              ]"
+            > 
+              <span v-if="dialogType === 'view'">{{ scope.row.taxRate }}</span>
+              <el-input v-else v-model="scope.row.taxRate" type="number" @input="updateTotalPrice(scope.row)"></el-input>
             </el-form-item>
           </template>
 
@@ -146,9 +175,9 @@
           },
           {
             width: 100,
-            prop: 'productBrand',
+            prop: 'unInvoiceAmount',
             label: '未开票金额',
-            slot: 'productBrand',
+            slot: 'unInvoiceAmount',
             align: "center"
           },
           
@@ -160,28 +189,29 @@
           // },
 
           {
-            minWidth: 80,
-            prop: 'totalPrice',
+            minWidth: 150,
+            prop: 'invoiceAmount',
             label: '开票金额',
-            slot: 'totalPrice',
+            slot: 'invoiceAmount',
             align: 'center'
           },
           {
-            minWidth: 80,
+            minWidth: 150,
             prop: 'taxRate',
             label: '税率',
             align: 'center',
-            formatter: (_row, _column, cellValue) => {
-              return _row.taxRate
-                ? _row.taxRate+'%'
-                : '';
-            },
+            slot: 'taxRate',
+            // formatter: (_row, _column, cellValue) => {
+            //   return _row.taxRate
+            //     ? _row.taxRate+'%'
+            //     : '';
+            // },
           },
           {
-            minWidth: 80,
-            prop: 'discountSinglePrice',
+            minWidth: 100,
+            prop: 'discountTaxPrice',
             label: '不含税单价',
-            slot: 'discountSinglePrice',
+            slot: 'discountTaxPrice',
             align: 'center'
           },
           {
@@ -247,8 +277,159 @@
           //   }
           // },
         ],
+        formTable: [
+          {
+            orderNo: 'DZD202401001', // 对账单编号
+            amountCompletePrice: 30000.00, // 已对账金额
+            amountUnCompletePrice: 20000.00, // 未对账金额
+            amountTotalPrice: 50000.00, // 本次对账总金额
+            detailList: [
+              {
+                id: 1,
+                type: '10', // 销售发货
+                typeName: '销售发货',
+                sourceCode: 'DZD202401001', // 对账单编号
+                sourceId: '123456',
+                sourceType: 2, // 销售对账单
+                productName: '工业传感器', // 产品名称
+                modelType: 'GS-2000', // 型号
+                specification: '高精度型', // 规格
+                productBrand: '西门子', // 品牌(未开票金额显示)
+                unInvoiceAmount: 15000.00, // 未开票金额
+                singlePrice: 1500.00, // 单价
+                totalCount: 10, // 订单数量
+                totalPrice: 15000.00, // 开票金额/合计
+                taxRate: 13, // 税率
+                discountTaxPrice: 1327.43, // 不含税单价
+                discountSinglePrice: 1327.43, // 折让单价
+                discountRate: 0, // 折让比例
+                discountTotalPrice: 13274.32, // 折让合计
+                pricingWay: 1 // 按数量计价
+              },
+              {
+                id: 2,
+                type: '10',
+                typeName: '销售发货',
+                sourceCode: 'DZD202401001',
+                sourceId: '123456',
+                sourceType: 2,
+                productName: '控制阀门',
+                modelType: 'FV-500',
+                specification: 'DN50',
+                productBrand: 'ABB',
+                unInvoiceAmount: 15000.00, // 未开票金额
+                singlePrice: 2800.00,
+                totalCount: 5,
+                totalPrice: 14000.00,
+                taxRate: 13,
+                discountTaxPrice: 2477.88,
+                discountSinglePrice: 2477.88,
+                discountRate: 0,
+                discountTotalPrice: 12389.38,
+                pricingWay: 1
+              },
+            ]
+          },
+          {
+            orderNo: 'DZD202401002', // 对账单编号
+            amountCompletePrice: 30000.00, // 已对账金额
+            amountUnCompletePrice: 20000.00, // 未对账金额
+            amountTotalPrice: 50000.00, // 本次对账总金额
+            detailList: [
+              {
+                id: 3,
+                type: '10',
+                typeName: '销售发货',
+                sourceCode: 'DZD202401001',
+                sourceId: '123456',
+                sourceType: 2,
+                productName: '变频器',
+                modelType: 'VFD-30K',
+                specification: '30KW',
+                productBrand: '施耐德',
+                unInvoiceAmount: 15000.00, // 未开票金额
+                singlePrice: 5500.00,
+                totalCount: 2,
+                totalPrice: 11000.00,
+                taxRate: 13,
+                discountTaxPrice: 4867.26,
+                discountSinglePrice: 4867.26,
+                discountRate: 0,
+                discountTotalPrice: 9734.51,
+                pricingWay: 1
+              }
+            ]
+          }
+        ],
         tableForm: {
-          detailList: [],
+          detailList: [
+            {
+              id: 1,
+              type: '10', // 销售发货
+              typeName: '销售发货',
+              sourceCode: 'DZD202401001', // 对账单编号
+              sourceId: '123456',
+              sourceType: 2, // 销售对账单
+              productName: '工业传感器', // 产品名称
+              modelType: 'GS-2000', // 型号
+              specification: '高精度型', // 规格
+              productBrand: '西门子', // 品牌(未开票金额显示)
+              unInvoiceAmount: 15000.00, // 未开票金额
+              singlePrice: 1500.00, // 单价
+              totalCount: 10, // 订单数量
+              totalPrice: 15000.00, // 开票金额/合计
+              taxRate: 13, // 税率
+              discountTaxPrice: 1327.43, // 不含税单价
+              discountSinglePrice: 1327.43, // 折让单价
+              discountRate: 0, // 折让比例
+              discountTotalPrice: 13274.32, // 折让合计
+              pricingWay: 1 // 按数量计价
+            },
+            {
+              id: 2,
+              type: '10',
+              typeName: '销售发货',
+              sourceCode: 'DZD202401001',
+              sourceId: '123456',
+              sourceType: 2,
+              productName: '控制阀门',
+              modelType: 'FV-500',
+              specification: 'DN50',
+              productBrand: 'ABB',
+              unInvoiceAmount: 15000.00, // 未开票金额
+              singlePrice: 2800.00,
+              totalCount: 5,
+              totalPrice: 14000.00,
+              taxRate: 13,
+              discountTaxPrice: 2477.88,
+              discountSinglePrice: 2477.88,
+              discountRate: 0,
+              discountTotalPrice: 12389.38,
+              pricingWay: 1
+            },
+            {
+              id: 3,
+              type: '10',
+              typeName: '销售发货',
+              sourceCode: 'DZD202401001',
+              sourceId: '123456',
+              sourceType: 2,
+              productName: '变频器',
+              modelType: 'VFD-30K',
+              specification: '30KW',
+              productBrand: '施耐德',
+              unInvoiceAmount: 15000.00, // 未开票金额
+              singlePrice: 5500.00,
+              totalCount: 2,
+              totalPrice: 11000.00,
+              taxRate: 13,
+              discountTaxPrice: 4867.26,
+              discountSinglePrice: 4867.26,
+              discountRate: 0,
+              discountTotalPrice: 9734.51,
+              pricingWay: 1
+            }
+          ],
           link: []
         },
         typeList: [
@@ -272,14 +453,30 @@
       };
     },
     mounted() {
-      this.tableForm = this.form;
+      // this.tableForm = this.form;
     },
     watch: {
       form(val) {
-        this.tableForm = this.form;
+        // this.tableForm = this.form;
       }
     },
     methods: {
+      //计算不含税单价
+      getNotaxSinglePrice() {
+        this.tableForm.detailList.forEach((item, index) => {
+          if (item.singlePrice && item.taxRate) {
+            this.$set(
+              this.form.detailList[index],
+              'notaxSinglePrice',
+              parseFloat(
+                (item.singlePrice / (1 + item.taxRate / 100)).toFixed(2)
+              )
+            );
+          } else {
+            this.$set(this.form.detailList[index], 'notaxSinglePrice', '');
+          }
+        });
+      },
       //获取选择的对账单数据
       async getAccountData(params) {
         if (params.children.orderType == 6) {
@@ -326,7 +523,7 @@
         this.setSelectData(row);
       },
       setValue(data) {
-        this.tableForm.detailList = data;
+        // this.tableForm.detailList = data;
       },
       clearTable() {
         this.tableForm = {