Browse Source

feat: 对账单静态

liujt 1 month ago
parent
commit
609cb088c1

+ 590 - 0
src/views/saleManage/saleOrder/accountstatement/components/accountDetailTable.vue

@@ -0,0 +1,590 @@
+<template>
+  <div class="account-detail-table">
+    <div class="detail-toolbar">
+      <el-button
+        v-if="!isView"
+        type="primary"
+        size="small"
+        @click="batchSetTaxRate"
+        >批量设置税率</el-button
+      >
+      <el-button
+        v-if="!isView"
+        type="primary"
+        size="small"
+        @click="batchSetPrice"
+        >批量设置单价</el-button
+      >
+      <el-button
+        v-if="!isView"
+        type="primary"
+        size="small"
+        @click="batchSetDiscount"
+        >批量设置折让比例</el-button
+      >
+      <div class="summary-info">
+        <span
+          >本次总对账金额:<b>{{ totalStatementAmount }}</b> 元</span
+        >
+        <span
+          >本次总对账数量:<b>{{ totalStatementCount }}</b></span
+        >
+      </div>
+    </div>
+
+    <el-form ref="detailForm" :model="{ flatList }">
+      <ele-pro-table
+        ref="detailTable"
+        row-key="id"
+        :needPage="false"
+        :columns="columns"
+        max-height="500px"
+        :datasource="flatList"
+        cache-key="account-detail-table"
+        class="time-form"
+      >
+        <template v-slot:statementCount="scope">
+          <el-form-item
+            :prop="'flatList.' + scope.$index + '.statementCount'"
+            :rules="{
+              validator: (rule, value, cb) =>
+                validateStatementCount(rule, value, cb, scope.row),
+              trigger: 'change'
+            }"
+          >
+            <el-input
+              v-model="scope.row.statementCount"
+              type="number"
+              :disabled="isView || queryDimension == 1"
+              @input="handleCountChange(scope.row, scope.$index)"
+            />
+          </el-form-item>
+        </template>
+
+        <template v-slot:singlePrice="scope">
+          <el-form-item
+            :prop="'flatList.' + scope.$index + '.singlePrice'"
+            :rules="{
+              required: true,
+              message: '请输入单价',
+              trigger: 'change'
+            }"
+          >
+            <el-input
+              v-model="scope.row.singlePrice"
+              type="number"
+              :disabled="isView"
+              @input="handlePriceChange(scope.row, scope.$index)"
+            />
+            <div v-if="isPriceInvalid(scope.row)" class="price-warning">
+              单价无效,请核对商品价格
+            </div>
+          </el-form-item>
+        </template>
+
+        <template v-slot:taxRate="scope">
+          <el-form-item
+            :prop="'flatList.' + scope.$index + '.taxRate'"
+            :rules="{
+              required: isTaxRate == 1,
+              message: '请输入税率',
+              trigger: 'change'
+            }"
+          >
+            <el-input
+              v-model="scope.row.taxRate"
+              type="number"
+              :disabled="isView"
+              @input="handleTaxChange(scope.row, scope.$index)"
+            />
+          </el-form-item>
+        </template>
+
+        <template v-slot:discountRatio="scope">
+          <el-form-item
+            :prop="'flatList.' + scope.$index + '.discountRatio'"
+            :rules="{
+              required: true,
+              message: '请输入折让比例',
+              trigger: 'change'
+            }"
+          >
+            <el-input
+              v-model="scope.row.discountRatio"
+              type="number"
+              :min="0"
+              :max="100"
+              :disabled="isView"
+              @input="handleDiscountChange(scope.row, scope.$index)"
+            />
+          </el-form-item>
+        </template>
+
+        <template v-slot:statementAmount="scope">
+          <span>{{ scope.row.statementAmount }}</span>
+        </template>
+
+        <template v-slot:action="scope">
+          <el-link
+            v-if="!isView && queryDimension == 2"
+            type="danger"
+            :underline="false"
+            icon="el-icon-delete"
+            @click="removeRow(scope.$index)"
+            >删除</el-link
+          >
+          <span v-else>--</span>
+        </template>
+      </ele-pro-table>
+    </el-form>
+
+    <!-- 批量设置弹窗 -->
+    <el-dialog
+      :visible.sync="batchDialogVisible"
+      title="批量设置"
+      width="400px"
+      append-to-body
+    >
+      <el-form label-width="100px">
+        <el-form-item :label="batchLabel">
+          <el-input v-model="batchValue" type="number" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer">
+        <el-button @click="batchDialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="confirmBatchSet">确定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import { parameterGetByCode } from '@/api/main/index.js';
+
+  export default {
+    name: 'accountDetailTable',
+    props: {
+      datasource: {
+        type: Array,
+        default: () => []
+      },
+      dialogType: {
+        type: String,
+        default: 'add'
+      },
+      queryDimension: {
+        type: Number,
+        default: 1
+      }
+    },
+    data() {
+      return {
+        isTaxRate: 0,
+        flatList: [],
+        totalStatementAmount: 0,
+        totalStatementCount: 0,
+        batchDialogVisible: false,
+        batchType: '',
+        batchValue: '',
+        batchLabel: '',
+        columns: [
+          {
+            width: 60,
+            label: '序号',
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            minWidth: 140,
+            prop: 'saleOrderNo',
+            label: '销售订单编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 140,
+            prop: 'statementSubOrderNo',
+            label: '发货单编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 120,
+            prop: 'productOperateTime',
+            label: '发货日期',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 120,
+            prop: 'productCode',
+            label: '产品编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 140,
+            prop: 'productName',
+            label: '产品名称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 120,
+            prop: 'batchNo',
+            label: '批次号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 100,
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 100,
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 80,
+            prop: 'color',
+            label: '颜色',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 110,
+            prop: 'statementedCount',
+            label: '已对账数量',
+            align: 'center'
+          },
+          {
+            minWidth: 140,
+            prop: 'statementCount',
+            label: '本次对账数量',
+            align: 'center',
+            slot: 'statementCount'
+          },
+          {
+            minWidth: 120,
+            prop: 'statementAmount',
+            label: '本次对账金额',
+            align: 'center',
+            slot: 'statementAmount'
+          },
+          {
+            minWidth: 120,
+            prop: 'singlePrice',
+            label: '单价',
+            align: 'center',
+            slot: 'singlePrice'
+          },
+          {
+            minWidth: 100,
+            prop: 'taxRate',
+            label: '税率',
+            align: 'center',
+            slot: 'taxRate'
+          },
+          {
+            minWidth: 120,
+            prop: 'discountRatio',
+            label: '折让比例',
+            align: 'center',
+            slot: 'discountRatio'
+          },
+          {
+            minWidth: 140,
+            prop: 'processRouteName',
+            label: '工艺路线',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 80,
+            prop: 'action',
+            label: '操作',
+            align: 'center',
+            slot: 'action',
+            fixed: 'right'
+          }
+        ]
+      };
+    },
+    computed: {
+      isView() {
+        return this.dialogType === 'view';
+      }
+    },
+    watch: {
+      datasource: {
+        handler() {
+          this.$nextTick(() => {
+            this.initDefaultValues();
+            this.buildFlatList();
+            this.calcTotals();
+          });
+        },
+        immediate: true
+      },
+      queryDimension() {
+        this.buildFlatList();
+        this.calcTotals();
+      }
+    },
+    created() {
+      parameterGetByCode({ code: 'eom_saleOrder_order-taxRate' }).then(
+        (res) => {
+          this.isTaxRate = res.value;
+        }
+      );
+    },
+    methods: {
+      buildRow(item, orderNo, isReturn) {
+        const outboundCount = +item.totalCount || 0;
+        // 退货单数量为负
+        const count = isReturn ? -Math.abs(outboundCount) : outboundCount;
+        const statemented = +item.statementedCount || 0;
+        // 发货单:本次对账数量=出库数量(不可改);调拨单:默认=出库数量(可改)
+        let statementCount = item.statementCount;
+        if (
+          statementCount === undefined ||
+          statementCount === null ||
+          statementCount === ''
+        ) {
+          statementCount = count;
+        }
+        const singlePrice = +item.singlePrice || 0;
+        const discountRatio =
+          item.discountRatio === undefined || item.discountRatio === null
+            ? 100
+            : +item.discountRatio;
+        const taxRate =
+          item.taxRate === undefined || item.taxRate === null
+            ? 0
+            : +item.taxRate;
+        const amount =
+          Math.round(
+            statementCount * singlePrice * (discountRatio / 100) * 100
+          ) / 100;
+        // 直接修改原 item,保证编辑同步回 datasource
+        this.$set(item, 'id', item.id || Math.random().toString(36).slice(2));
+        this.$set(item, 'saleOrderNo', orderNo);
+        this.$set(
+          item,
+          'statementSubOrderNo',
+          item.statementSubOrderNo || item.subOrderNo || ''
+        );
+        this.$set(
+          item,
+          'productOperateTime',
+          item.productOperateTime || item.deliveryDate || ''
+        );
+        this.$set(item, 'outboundCount', count);
+        this.$set(item, 'statementedCount', statemented);
+        this.$set(item, 'statementCount', statementCount);
+        this.$set(item, 'singlePrice', singlePrice);
+        this.$set(item, 'taxRate', taxRate);
+        this.$set(item, 'discountRatio', discountRatio);
+        this.$set(item, 'statementAmount', amount);
+        this.$set(item, 'isReturn', isReturn);
+        this.$set(item, 'processRouteName', item.processRouteName || '');
+        return item;
+      },
+      initDefaultValues() {
+        this.datasource.forEach((order) => {
+          (order.deliveryProducts || []).forEach((item) => {
+            if (item.singlePrice === undefined)
+              this.$set(item, 'singlePrice', 0);
+            if (item.taxRate === undefined) this.$set(item, 'taxRate', 0);
+            if (item.discountRatio === undefined)
+              this.$set(item, 'discountRatio', 100);
+          });
+          (order.returnProducts || []).forEach((item) => {
+            if (item.singlePrice === undefined)
+              this.$set(item, 'singlePrice', 0);
+            if (item.taxRate === undefined) this.$set(item, 'taxRate', 0);
+            if (item.discountRatio === undefined)
+              this.$set(item, 'discountRatio', 100);
+          });
+        });
+      },
+      buildFlatList() {
+        const list = [];
+        this.datasource.forEach((order) => {
+          const orderNo = order.orderNo || '';
+          (order.deliveryProducts || []).forEach((item) => {
+            list.push(this.buildRow(item, orderNo, false));
+          });
+          (order.returnProducts || []).forEach((item) => {
+            list.push(this.buildRow(item, orderNo, true));
+          });
+        });
+        this.flatList = list;
+      },
+      calcTotals() {
+        const amount =
+          this.flatList.reduce(
+            (pre, cur) => pre + Math.round((+cur.statementAmount || 0) * 100),
+            0
+          ) / 100;
+        const count = this.flatList.reduce(
+          (pre, cur) => pre + (+cur.statementCount || 0),
+          0
+        );
+        this.totalStatementAmount = amount;
+        this.totalStatementCount = count;
+        this.$emit('totalChange', amount);
+        this.$emit('countChange', count);
+      },
+      // 重算某一行金额
+      calcRow(row) {
+        const count = +row.statementCount || 0;
+        const price = +row.singlePrice || 0;
+        const ratio = +row.discountRatio || 0;
+        const amount = Math.round(count * price * (ratio / 100) * 100) / 100;
+        this.$set(row, 'statementAmount', amount);
+      },
+      handleCountChange(row, index) {
+        this.calcRow(row);
+        this.calcTotals();
+        this.emitChange();
+      },
+      handlePriceChange(row, index) {
+        this.calcRow(row);
+        this.calcTotals();
+        this.emitChange();
+      },
+      handleTaxChange(row, index) {
+        this.emitChange();
+      },
+      handleDiscountChange(row, index) {
+        this.calcRow(row);
+        this.calcTotals();
+        this.emitChange();
+      },
+      emitChange() {
+        this.$emit('update:datasource', [...this.datasource]);
+      },
+      // 单价校验:单价缺失或为 0 视为无效(需结合商品价目表有效期进一步校验)
+      isPriceInvalid(row) {
+        const price = +row.singlePrice || 0;
+        return price <= 0;
+      },
+      validateStatementCount(rule, value, callback, row) {
+        const val = +value || 0;
+        const max = Math.abs(row.outboundCount || 0);
+        if (Math.abs(val) > max) {
+          callback(new Error('不能超出库数量'));
+        } else if (this.queryDimension == 1 && val != row.outboundCount) {
+          callback(new Error('按发货单查询时不可修改'));
+        } else {
+          callback();
+        }
+      },
+      removeRow(index) {
+        // 调拨单模式下允许删除行(实际应根据业务规则限制)
+        const list = [...this.flatList];
+        list.splice(index, 1);
+        this.$emit('update:datasource', this.rebuildDatasource(list));
+      },
+      rebuildDatasource(flatList) {
+        const group = {};
+        flatList.forEach((row) => {
+          const key = row.saleOrderNo || '_default';
+          if (!group[key]) {
+            group[key] = {
+              orderNo: row.saleOrderNo,
+              deliveryProducts: [],
+              returnProducts: []
+            };
+          }
+          if (row.isReturn) {
+            group[key].returnProducts.push(row);
+          } else {
+            group[key].deliveryProducts.push(row);
+          }
+        });
+        return Object.values(group);
+      },
+      // 批量设置
+      batchSetTaxRate() {
+        this.batchType = 'taxRate';
+        this.batchLabel = '税率';
+        this.batchValue = '';
+        this.batchDialogVisible = true;
+      },
+      batchSetPrice() {
+        this.batchType = 'singlePrice';
+        this.batchLabel = '单价';
+        this.batchValue = '';
+        this.batchDialogVisible = true;
+      },
+      batchSetDiscount() {
+        this.batchType = 'discountRatio';
+        this.batchLabel = '折让比例';
+        this.batchValue = '';
+        this.batchDialogVisible = true;
+      },
+      confirmBatchSet() {
+        this.datasource.forEach((order) => {
+          (order.deliveryProducts || []).forEach((item) => {
+            this.$set(item, this.batchType, +this.batchValue);
+          });
+          (order.returnProducts || []).forEach((item) => {
+            this.$set(item, this.batchType, +this.batchValue);
+          });
+        });
+        this.initDefaultValues();
+        this.batchDialogVisible = false;
+        this.emitChange();
+      },
+      getValidForm() {
+        return new Promise((resolve, reject) => {
+          this.$refs.detailForm.validate((valid) => {
+            if (valid) resolve(true);
+            else {
+              this.$message.error('对账明细未填写完整');
+              reject(false);
+            }
+          });
+        });
+      }
+    }
+  };
+</script>
+
+<style scoped lang="scss">
+  .account-detail-table {
+    .detail-toolbar {
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+      margin-bottom: 10px;
+      .summary-info {
+        span {
+          margin-left: 20px;
+          b {
+            color: #f56c6c;
+          }
+        }
+      }
+    }
+    .time-form .el-form-item {
+      margin-bottom: 0 !important;
+    }
+    .price-warning {
+      color: #f56c6c;
+      font-size: 12px;
+      line-height: 1.4;
+      margin-top: 2px;
+    }
+  }
+</style>

+ 159 - 55
src/views/saleManage/saleOrder/accountstatement/components/addAccountDialog.vue

@@ -2,7 +2,7 @@
   <ele-modal
     custom-class="ele-dialog-form long-dialog-form"
     :centered="true"
-    :visible.sync="addAccountDialogFlag"
+    :visible="addAccountDialogFlag"
     :title="title"
     :append-to-body="true"
     :close-on-click-modal="false"
@@ -19,12 +19,20 @@
         :datasource.sync="datasource"
         :contactData="contactData"
         :saleOrderData="saleOrderData"
-        :recorpayList.sync="recorpayList"
         :dialogType="dialogType"
         ref="saleFormRef"
       ></sale-form>
+      <headerTitle title="应收信息" style="margin-top: 30px"></headerTitle>
+      <receivable-info
+        :dataForm.sync="dataForm"
+        :receivableList.sync="receivableList"
+        :dialogType="dialogType"
+        @addAdvanceReceipt="addAdvanceReceipt"
+        ref="receivableInfoRef"
+      ></receivable-info>
+
       <headerTitle title="对账明细" style="margin-top: 30px">
-        <template v-slot>
+        <!-- <template v-slot>
           <el-row style="font-weight: 700; color: red">
             <span>订单总金额:</span>
             <span>{{ isNonDirectionalSale ? '--' : dataForm.orderTotalAmount || 0 }}</span>
@@ -38,7 +46,7 @@
             <span>本次对账总金额:</span>
             <span>{{ dataForm.amountTotalPrice || 0 }}</span>
           </el-row>
-        </template>
+        </template> -->
       </headerTitle>
       <!-- <recorpayTableList
         ref="recorpayListRef"
@@ -46,14 +54,20 @@
         :recorpayList.sync="recorpayList"
         :dialogType="dialogType"
       ></recorpayTableList> -->
-      <inventoryTable
-        ref="inventoryTableref"
-        :dataForm="dataForm"
+      <account-detail-table
+        ref="accountDetailTableRef"
         :datasource.sync="datasource"
         :dialogType="dialogType"
-        @changeDiscountPrice="changeDiscountPrice"
-      ></inventoryTable>
+        :queryDimension="dataForm.queryDimension"
+        @totalChange="handleTotalChange"
+        @countChange="handleCountChange"
+      ></account-detail-table>
     </div>
+    <advance-receipt-select-dialog
+      ref="advanceReceiptSelectRef"
+      :contactId="dataForm.contactId"
+      @changeParent="onAdvanceReceiptSelected"
+    ></advance-receipt-select-dialog>
     <div slot="footer" class="footer">
       <el-button
         v-if="dialogType !== 'view'"
@@ -81,8 +95,9 @@
 </template>
 
 <script>
-  import InventoryTable from './inventoryTable.vue';
-  import recorpayTableList from './recorpayTableList.vue';
+  import AccountDetailTable from './accountDetailTable.vue';
+  import ReceivableInfo from './receivableInfo.vue';
+  import AdvanceReceiptSelectDialog from './advanceReceiptSelectDialog.vue';
 
   import saleForm from './saleForm.vue';
   import {
@@ -95,14 +110,16 @@
     accountstatementUpdateAPI
   } from '@/api/saleManage/accountstatement';
   import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
+  import { paymentTypeOp } from '@/enum/dict';
 
   export default {
     name: 'addAccountDialog',
     components: {
       processSubmitDialog,
-      InventoryTable,
-      saleForm,
-      recorpayTableList
+      AccountDetailTable,
+      ReceivableInfo,
+      AdvanceReceiptSelectDialog,
+      saleForm
     },
     //客户管理数据
     props: {
@@ -125,11 +142,13 @@
     },
     data() {
       return {
+        paymentTypeOp,
         fullscreen: false,
         loading: false,
         saveLoading: false,
         datasource: [],
         recorpayList: [],
+        receivableList: [],
         dataForm: {
           sourceType: 1,
           dateType: 1,
@@ -149,7 +168,14 @@
           id: '',
           startDate: '',
           endDate: '',
-          repliedFiles: []
+          repliedFiles: [],
+          // 应收信息字段
+          fundType: 2,
+          transactionMethod: 1,
+          collectionTerms: '',
+          receiptStatus: 0,
+          totalAdvanceConfirmAmount: 0,
+          totalReceivableAmount: 0
         },
         title: '',
         processSubmitDialogFlag: false,
@@ -159,17 +185,36 @@
     },
     computed: {
       isNonDirectionalSale() {
-        return this.datasource.some(item => item.orderCategory == 4);
+        return this.datasource.some((item) => item.orderCategory == 4);
       }
     },
     methods: {
-      changeDiscountPrice(price, tableIndex) {
-        console.log('price~~~', price, tableIndex)
-        this.datasource[tableIndex].statementAmount = price;
-        this.datasource[tableIndex].unStatementAmount = price;
-        console.log('this.datasource', this.datasource)
-        this.dataForm.amountTotalPrice = this.datasource.reduce((pre, cur) => pre + Math.round(+cur.statementAmount * 100), 0) / 100;
-        this.dataForm.amountUnCompletePrice = this.datasource.reduce((pre, cur) => pre + Math.round(+cur.unStatementAmount * 100), 0) / 100;
+      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
+        });
+      },
+      fundTypeLabel(val) {
+        const item = (this.paymentTypeOp || []).find((i) => i.value === val);
+        return item ? item.label : val != null && val !== '' ? String(val) : '';
       },
       open(dialogType, row, type = '') {
         this.dialogType = dialogType;
@@ -196,39 +241,66 @@
       //获取对账单详情
       async getInfo(row) {
         let data = await accountstatementInfoAPI(row.id);
-        console.log('data~~~', data)
+        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;
-          })
+        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.dataForm = data;
+        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:
+          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);
 
@@ -264,18 +336,18 @@
           let data = await getStatementRecordListAPI(searchQuery);
           console.log(data, 'data');
           this.loading = false;
-          data = data.map(item => {
-            item.deliveryProducts = item.deliveryProducts.map(i => {
+          data = data.map((item) => {
+            item.deliveryProducts = item.deliveryProducts.map((i) => {
               return {
                 ...i,
                 taxRate: i.taxRate || 0,
                 discountRatio: i.discountRatio || 100,
                 singlePrice: i.singlePrice || 0,
                 originalTotalCount: i.totalCount // 保存原始数量值用于校验
-              }
-            })
+              };
+            });
             return item;
-          })
+          });
           this.datasource = data || [];
 
           console.log(this.datasource, 'this.datasource~~~');
@@ -287,10 +359,26 @@
             // amountTotalPrice: data.amountTotalPrice,
             // amountPayablePass: data.amountPayablePass,
             // amountReceivablePass: data.amountReceivablePass
-            orderTotalAmount: data.reduce((pre, cur) => pre + Math.round(+cur.orderAmount * 100), 0) / 100,
-            amountTotalPrice: data.reduce((pre, cur) => pre + Math.round(+cur.statementAmount * 100), 0) / 100,
-            amountCompletePrice: data.reduce((pre, cur) => pre + Math.round(+cur.statementedAmount * 100), 0) / 100,
-            amountUnCompletePrice: data.reduce((pre, cur) => pre + Math.round(+cur.unStatementAmount * 100), 0) / 100
+            orderTotalAmount:
+              data.reduce(
+                (pre, cur) => pre + Math.round(+cur.orderAmount * 100),
+                0
+              ) / 100,
+            amountTotalPrice:
+              data.reduce(
+                (pre, cur) => pre + Math.round(+cur.statementAmount * 100),
+                0
+              ) / 100,
+            amountCompletePrice:
+              data.reduce(
+                (pre, cur) => pre + Math.round(+cur.statementedAmount * 100),
+                0
+              ) / 100,
+            amountUnCompletePrice:
+              data.reduce(
+                (pre, cur) => pre + Math.round(+cur.unStatementAmount * 100),
+                0
+              ) / 100
           };
           this.$forceUpdate();
         } catch (error) {
@@ -302,18 +390,34 @@
       async save(is) {
         if (!this.datasource.length)
           return this.$message.warning('暂无对账信息');
-        
+
         try {
-          // 校验 inventoryTableref 组件的表单
-          await this.$refs.inventoryTableref.getValidForm();
-          
+          // 校验明细表与应收信息表单
+          await this.$refs.accountDetailTableRef.getValidForm();
+          await this.$refs.receivableInfoRef.validate();
+
           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;
           let params = {
             ...this.dataForm,
+            totalAdvanceConfirmAmount,
+            totalReceivableAmount,
             orderList: this.datasource,
+            receivableList: this.receivableList
             // recorpayList: this.recorpayList
           };
           this.saveLoading = true;

+ 167 - 0
src/views/saleManage/saleOrder/accountstatement/components/advanceReceiptSelectDialog.vue

@@ -0,0 +1,167 @@
+<template>
+  <el-dialog
+    title="选择预收款"
+    custom-class="ele-dialog-form long-dialog-form"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    top="5vh"
+    append-to-body
+    width="70%"
+  >
+    <el-form :inline="true" size="small" @submit.native.prevent>
+      <el-form-item label="预收款编码">
+        <el-input
+          v-model="keyword"
+          placeholder="请输入"
+          clearable
+          @keyup.enter.native="reload"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" @click="reload">查询</el-button>
+      </el-form-item>
+    </el-form>
+
+    <ele-pro-table
+      ref="table"
+      :columns="columns"
+      :datasource="datasource"
+      row-key="id"
+      height="calc(100vh - 460px)"
+      :needPage="true"
+      class="dict-table"
+      @cell-click="cellClick"
+    >
+      <template v-slot:action="{ row }">
+        <el-radio class="radio" v-model="radio" :label="row.id"
+          ><i></i
+        ></el-radio>
+      </template>
+    </ele-pro-table>
+
+    <div class="btns" slot="footer">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import { advanceReceiptPageList } from '@/api/financialManage/advanceReceipt';
+  import { paymentTypeOp } from '@/enum/dict';
+
+  export default {
+    name: 'advanceReceiptSelectDialog',
+    props: {
+      contactId: {
+        type: [String, Number],
+        default: ''
+      }
+    },
+    data() {
+      return {
+        visible: false,
+        keyword: '',
+        radio: null,
+        current: null,
+        paymentTypeOp,
+        columns: [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            action: 'action',
+            slot: 'action',
+            align: 'center',
+            label: '选择',
+            width: 70
+          },
+          {
+            prop: 'advanceReceiptCode',
+            label: '预收款编码',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160
+          },
+          {
+            prop: 'fundType',
+            label: '款项类型',
+            align: 'center',
+            minWidth: 120,
+            formatter: (_row, _column, cellValue) =>
+              this.fundTypeLabel(cellValue)
+          },
+          {
+            prop: 'saleOrderNo',
+            label: '关联销售订单',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 160
+          },
+          {
+            prop: 'unConfirmAmount',
+            label: '未对账确收金额',
+            align: 'center',
+            minWidth: 140
+          }
+        ]
+      };
+    },
+    methods: {
+      open() {
+        this.visible = true;
+        this.radio = null;
+        this.current = null;
+        this.$nextTick(() => {
+          if (this.$refs.table) this.$refs.table.reload({ pageNum: 1 });
+        });
+      },
+      fundTypeLabel(val) {
+        const item = (this.paymentTypeOp || []).find((i) => i.value === val);
+        return item ? item.label : val != null && val !== '' ? String(val) : '';
+      },
+      // ele-pro-table datasource:直接返回接口数据(与 orderListDialog 同约定)
+      datasource({ page, limit, where }) {
+        const params = {
+          pageNum: page,
+          size: limit,
+          contactId: this.contactId || undefined
+        };
+        if (this.keyword) params.advanceReceiptCode = this.keyword;
+        if (where) Object.assign(params, where);
+        return advanceReceiptPageList(params);
+      },
+      reload() {
+        if (this.$refs.table) this.$refs.table.reload({ pageNum: 1 });
+      },
+      cellClick(row) {
+        this.current = row;
+        this.radio = row.id;
+      },
+      handleClose() {
+        this.visible = false;
+      },
+      selected() {
+        if (!this.current) {
+          return this.$message.warning('请选择一条预收款记录');
+        }
+        this.$emit('changeParent', this.current);
+        this.handleClose();
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .btns {
+    text-align: center;
+    padding: 10px 0;
+  }
+</style>

+ 418 - 0
src/views/saleManage/saleOrder/accountstatement/components/receivableInfo.vue

@@ -0,0 +1,418 @@
+<template>
+  <div class="receivable-info">
+    <el-form ref="form" :model="dataForm" :rules="rules" label-width="150px">
+      <el-row>
+        <el-col :span="8">
+          <el-form-item label="总对账预收款确收金额">
+            <el-input disabled v-model="totalAdvanceConfirmAmount">
+              <template slot="append">元</template>
+            </el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="总应收金额">
+            <el-input disabled v-model="totalReceivableAmount">
+              <template slot="append">元</template>
+            </el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="款项类型" prop="fundType">
+            <el-select
+              v-model="fundType"
+              placeholder="请选择"
+              class="ele-block"
+              :disabled="isView"
+            >
+              <el-option
+                v-for="item in paymentTypeOp"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              />
+            </el-select>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-col :span="8">
+          <el-form-item label="交易方式" prop="transactionMethod">
+            <el-select
+              v-model="transactionMethod"
+              placeholder="请选择"
+              class="ele-block"
+              :disabled="isView"
+            >
+              <el-option
+                v-for="item in transactionMethodsOp"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              />
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="收款条件" prop="collectionTerms">
+            <el-select
+              v-model="collectionTerms"
+              placeholder="请选择"
+              class="ele-block"
+              :disabled="isView"
+            >
+              <el-option
+                v-for="item in collectionTermsOptions"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              />
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8" v-if="isView">
+          <el-form-item label="收款状态">
+            <el-select
+              v-model="receiptStatus"
+              placeholder="请选择"
+              class="ele-block"
+              disabled
+            >
+              <el-option
+                v-for="item in paymentStatusOp"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              />
+            </el-select>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+
+    <div class="receivable-table-header">
+      <el-button
+        v-if="!isView"
+        type="primary"
+        size="small"
+        @click="addAdvanceReceipt"
+        icon="el-icon-plus"
+        >新增预收款</el-button
+      >
+    </div>
+    <el-form :model="{ receivableList }" ref="tableForm">
+      <ele-pro-table
+        ref="receivableTable"
+        row-key="id"
+        :needPage="false"
+        :columns="columns"
+        max-height="400px"
+        :datasource="receivableList"
+        cache-key="account-receivable-table"
+        class="time-form"
+      >
+        <template v-slot:currentConfirmAmount="scope">
+          <el-form-item
+            :prop="'receivableList.' + scope.$index + '.currentConfirmAmount'"
+            :rules="{
+              validator: (rule, value, cb) =>
+                validateConfirmAmount(rule, value, cb, scope.row),
+              trigger: 'change'
+            }"
+          >
+            <el-input
+              v-model="scope.row.currentConfirmAmount"
+              type="number"
+              :disabled="isView"
+              @input="handleConfirmAmountChange(scope.row, scope.$index)"
+            />
+          </el-form-item>
+        </template>
+
+        <template v-slot:action="scope">
+          <el-link
+            v-if="!isView"
+            type="danger"
+            :underline="false"
+            icon="el-icon-delete"
+            @click="removeRow(scope.$index)"
+            >删除</el-link
+          >
+        </template>
+      </ele-pro-table>
+    </el-form>
+  </div>
+</template>
+
+<script>
+  import {
+    paymentTypeOp,
+    transactionMethodsOp,
+    paymentStatus
+  } from '@/enum/dict';
+
+  export default {
+    name: 'receivableInfo',
+    props: {
+      dataForm: {
+        type: Object,
+        default: () => ({})
+      },
+      receivableList: {
+        type: Array,
+        default: () => []
+      },
+      dialogType: {
+        type: String,
+        default: 'add'
+      }
+    },
+    data() {
+      return {
+        paymentTypeOp,
+        transactionMethodsOp,
+        paymentStatusOp: paymentStatus,
+        // 收款条件下拉,建议后续从主数据接口获取
+        collectionTermsOptions: [
+          { label: '货到付款', value: '货到付款' },
+          { label: '款到发货', value: '款到发货' },
+          { label: '月结', value: '月结' },
+          { label: '季度结', value: '季度结' }
+        ],
+        rules: {
+          fundType: {
+            required: true,
+            message: '请选择款项类型',
+            trigger: 'change'
+          },
+          transactionMethod: {
+            required: true,
+            message: '请选择交易方式',
+            trigger: 'change'
+          },
+          collectionTerms: {
+            required: true,
+            message: '请选择收款条件',
+            trigger: 'change'
+          }
+        },
+        columns: [
+          {
+            width: 60,
+            label: '序号',
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            minWidth: 140,
+            prop: 'saleOrderNo',
+            label: '销售订单编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 140,
+            prop: 'advanceReceiptCode',
+            label: '预收编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 100,
+            prop: 'fundTypeName',
+            label: '款项类型',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 140,
+            prop: 'unConfirmAmount',
+            label: '未对账预收款确收金额',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 160,
+            prop: 'currentConfirmAmount',
+            label: '本次对账预收款确收金额',
+            align: 'center',
+            slot: 'currentConfirmAmount'
+          },
+          {
+            minWidth: 120,
+            prop: 'statementAmount',
+            label: '本次对账金额',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 120,
+            prop: 'currentReceivableAmount',
+            label: '本次应收金额',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            minWidth: 100,
+            prop: 'action',
+            label: '操作',
+            align: 'center',
+            slot: 'action',
+            fixed: 'right'
+          }
+        ]
+      };
+    },
+    computed: {
+      isView() {
+        return this.dialogType === 'view';
+      },
+      // dataForm 通过 .sync 传入,下面 4 个字段用 computed 代理,
+      // set 时整体 emit 新的 dataForm,避免直接修改 prop(满足 vue/no-mutating-props)
+      fundType: {
+        get() {
+          return this.dataForm.fundType;
+        },
+        set(val) {
+          this.emitDataForm('fundType', val);
+        }
+      },
+      transactionMethod: {
+        get() {
+          return this.dataForm.transactionMethod;
+        },
+        set(val) {
+          this.emitDataForm('transactionMethod', val);
+        }
+      },
+      collectionTerms: {
+        get() {
+          return this.dataForm.collectionTerms;
+        },
+        set(val) {
+          this.emitDataForm('collectionTerms', val);
+        }
+      },
+      receiptStatus: {
+        get() {
+          return this.dataForm.receiptStatus;
+        },
+        set(val) {
+          this.emitDataForm('receiptStatus', val);
+        }
+      },
+      totalAdvanceConfirmAmount() {
+        return (
+          this.receivableList.reduce(
+            (pre, cur) =>
+              pre + Math.round((+cur.currentConfirmAmount || 0) * 100),
+            0
+          ) / 100
+        );
+      },
+      totalReceivableAmount() {
+        return (
+          Math.round(
+            ((+this.dataForm.amountTotalPrice || 0) -
+              this.totalAdvanceConfirmAmount) *
+              100
+          ) / 100
+        );
+      }
+    },
+    watch: {
+      'dataForm.amountTotalPrice': {
+        handler() {
+          this.recalcAllRows();
+        },
+        immediate: true
+      }
+    },
+    methods: {
+      // dataForm 为 .sync prop,整体替换以避免直接 mutation
+      emitDataForm(key, val) {
+        this.$emit('update:dataForm', { ...this.dataForm, [key]: val });
+      },
+      // 新增一行预收款(实际应从预收款管理选择器带出)
+      addAdvanceReceipt() {
+        this.$emit('addAdvanceReceipt');
+      },
+      removeRow(index) {
+        const list = [...this.receivableList];
+        list.splice(index, 1);
+        this.$emit('update:receivableList', list);
+      },
+      handleConfirmAmountChange(row, index) {
+        // 限制本次确收金额不能超过未对账金额和本次对账金额
+        let val = +row.currentConfirmAmount || 0;
+        const max = Math.min(
+          +row.unConfirmAmount || 0,
+          +row.statementAmount || 0
+        );
+        if (val > max) {
+          val = max;
+          this.$set(row, 'currentConfirmAmount', val);
+          this.$message.warning(
+            '本次对账预收款确收金额不能超过未对账金额和本次对账金额'
+          );
+        }
+        const currentReceivable =
+          Math.round(((+row.statementAmount || 0) - val) * 100) / 100;
+        this.$set(row, 'currentReceivableAmount', currentReceivable);
+        this.$emit('update:receivableList', [...this.receivableList]);
+      },
+      recalcAllRows() {
+        this.receivableList.forEach((row) => {
+          const max = Math.min(
+            +row.unConfirmAmount || 0,
+            +row.statementAmount || 0
+          );
+          let val = +row.currentConfirmAmount || 0;
+          if (val > max) val = max;
+          this.$set(row, 'currentConfirmAmount', val);
+          this.$set(
+            row,
+            'currentReceivableAmount',
+            Math.round(((+row.statementAmount || 0) - val) * 100) / 100
+          );
+        });
+      },
+      validateConfirmAmount(rule, value, callback, row) {
+        const val = +value || 0;
+        const max = Math.min(
+          +row.unConfirmAmount || 0,
+          +row.statementAmount || 0
+        );
+        if (val < 0) {
+          callback(new Error('不能小于0'));
+        } else if (val > max) {
+          callback(new Error(`不能超过${max}`));
+        } else {
+          callback();
+        }
+      },
+      validate() {
+        return new Promise((resolve, reject) => {
+          const promises = [this.$refs.form.validate()];
+          if (this.$refs.tableForm) {
+            promises.push(this.$refs.tableForm.validate());
+          }
+          Promise.all(promises)
+            .then(() => resolve(true))
+            .catch(() => reject(false));
+        });
+      }
+    }
+  };
+</script>
+
+<style scoped lang="scss">
+  .receivable-info {
+    .receivable-table-header {
+      display: flex;
+      justify-content: flex-end;
+      margin-bottom: 10px;
+    }
+  }
+</style>

+ 39 - 18
src/views/saleManage/saleOrder/accountstatement/components/saleForm.vue

@@ -41,7 +41,7 @@
           v-if="dataForm.sourceType == 3"
         >
           <el-input
-          :disabled="dialogType == 'view'"
+            :disabled="dialogType == 'view'"
             v-model="dataForm.sourceName"
             @click.native="handleGetOrd"
           ></el-input>
@@ -69,14 +69,14 @@
           >
             <el-option label="按发货单" :value="1" />
             <el-option label="按调拨单" :value="2" />
-            <el-option label="按收货单" :value="3" />
+            <!-- <el-option label="按收货单" :value="3" /> -->
           </el-select>
         </el-form-item>
       </el-col>
     </el-row>
     <el-row>
       <el-col :span="8">
-        <el-form-item label="查询方式" prop="dateType">
+        <el-form-item label="对账方式" prop="dateType">
           <el-select
             :disabled="dataForm.queryDimension == 2 || dialogType == 'view'"
             clearable
@@ -85,7 +85,12 @@
             @change="reloadTableData"
             placeholder="请选择"
           >
-            <el-option v-for="item in dateTypeOps" :key="item.value" :label="item.label" :value="item.value" />
+            <el-option
+              v-for="item in dateTypeOps"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            />
           </el-select>
         </el-form-item>
       </el-col>
@@ -183,7 +188,7 @@
     </el-row>
     <el-row>
       <el-col :span="8">
-        <el-form-item prop="createUserName" label="对账金额">
+        <el-form-item prop="createUserName" label="本次总对账金额">
           <el-input disabled v-model="accountStatementPrice"></el-input>
         </el-form-item>
       </el-col>
@@ -214,7 +219,11 @@
     </el-row>
     <el-row v-if="dataForm.queryDimension != 2 && dialogType !== 'view'">
       <el-col :span="24">
-        <el-button style="float: right" v-click-once @click="handleSearch" type="primary"
+        <el-button
+          style="float: right"
+          v-click-once
+          @click="handleSearch"
+          type="primary"
           >查询</el-button
         >
       </el-col>
@@ -241,13 +250,16 @@
   import { getFile } from '@/api/system/file';
   // import fileMain from '@/components/addDoc/index.vue';
   import contractListDialog from '@/views/saleManage/saleOrder/components/contractListDialog.vue';
-import { accountStatementExportAPI } from '@/api/saleManage/accountstatement';
+  import { accountStatementExportAPI } from '@/api/saleManage/accountstatement';
 
   export default {
     name: 'saleForm',
-    components: { OrderListDialog, parentList, 
+    components: {
+      OrderListDialog,
+      parentList,
       // fileMain,
-       contractListDialog },
+      contractListDialog
+    },
     //客户管理数据
     props: {
       dataForm: {
@@ -262,7 +274,7 @@ import { accountStatementExportAPI } from '@/api/saleManage/accountstatement';
           return [];
         }
       },
-      dialogType: '',
+      dialogType: String,
       contactData: {
         type: Object,
         default: () => {
@@ -274,14 +286,13 @@ import { accountStatementExportAPI } from '@/api/saleManage/accountstatement';
         default: () => {
           return {};
         }
-      },
+      }
       // recorpayList: {
       //   type: Object,
       //   default: () => {
       //     return [];
       //   }
       // },
-      
     },
     data() {
       return {
@@ -317,17 +328,26 @@ import { accountStatementExportAPI } from '@/api/saleManage/accountstatement';
           },
           sourceId: { required: true, message: '请选择', trigger: 'change' },
           contractId: { required: true, message: '请选择', trigger: 'change' },
-          queryDimension: { required: true, message: '请选择', trigger: 'change' },
+          queryDimension: {
+            required: true,
+            message: '请选择',
+            trigger: 'change'
+          }
         }
       };
     },
     computed: {
       dateTypeOps() {
-        return this.dataForm.queryDimension != 2 ? this.dateTypeOp.filter(item => item.value != 5) : this.dateTypeOp
+        return this.dataForm.queryDimension != 2
+          ? this.dateTypeOp.filter((item) => item.value != 5)
+          : this.dateTypeOp;
       },
       //计算未对账金额
       accountStatementPrice() {
-        return this.datasource.reduce((pre, cur) => pre + +cur.amountTotalPrice, 0);
+        return this.datasource.reduce(
+          (pre, cur) => pre + +cur.amountTotalPrice,
+          0
+        );
       },
       //计算相关订单号
       relatedOrderNumber() {
@@ -352,14 +372,15 @@ import { accountStatementExportAPI } from '@/api/saleManage/accountstatement';
             this.dataForm.endDate =
               this.dataForm.year + this.quarterList[this.dataForm.quarter][1];
             break;
-          case 3:
+          case 3: {
             this.dataForm.dateValue = this.dataForm.month;
             this.dataForm.startDate = this.dataForm.month + '-01 00:00:00';
-            let data = this.dataForm.month.split('-');
-            let days = new Date(data[0], data[1], 0).getDate();
+            const data = this.dataForm.month.split('-');
+            const days = new Date(data[0], data[1], 0).getDate();
             this.dataForm.endDate =
               this.dataForm.month + '-' + days + ' 23:59:59';
             break;
+          }
           default:
             this.dataForm.dateValue = '';
             this.dataForm.startDate =