소스 검색

feat: 对账单

liujt 3 주 전
부모
커밋
3229b99e9c

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

@@ -346,7 +346,7 @@
   import { listOrganizations } from '@/api/system/organization';
   import { mapGetters } from 'vuex';
   import fileUpload from '@/components/upload/fileUpload.vue';
-  import tableInfo from './tableInfo.vue';
+  import tableInfo from './tableInfoNew.vue';
   import { getTreeByPid } from '@/api/classifyManage';
   import {
     invoiceApplyInfoAPI,

+ 27 - 21
src/views/saleManage/saleOrder/accountstatement/components/addAccountDialog.vue

@@ -199,16 +199,19 @@
       addAdvanceReceipt() {
         this.$refs.advanceReceiptSelectRef.open();
       },
-      // 预收款选择器回调:将选中的预收款映射为应收信息行
+      // 预收款选择器回调:将选中的预收款映射为应收信息行(字段对齐接口 advanceInfoDetailList)
       onAdvanceReceiptSelected(row) {
         this.receivableList.push({
-          saleOrderNo: row.saleOrderNo || '',
-          advanceReceiptCode: row.advanceReceiptCode || '',
+          advanceId: row.id,
+          advanceCode: row.advanceReceiptCode || '',
+          salesCode: row.saleOrderNo || '',
+          fundType: row.fundType,
           fundTypeName: this.fundTypeLabel(row.fundType),
-          unConfirmAmount: +row.unConfirmAmount || 0,
-          // 本次对账预收款确收金额上限取「未对账确收金额」
+          unreconciledAdvanceConfirmAmount: +row.unConfirmAmount || 0,
+          // 本次对账金额上限取「未对账确收金额」
           statementAmount: +row.unConfirmAmount || 0,
-          currentConfirmAmount: 0,
+          statementAdvanceConfirmAmount: 0,
+          transactionMode: this.dataForm.transactionMethod || 1,
           currentReceivableAmount: 0
         });
       },
@@ -264,20 +267,21 @@
             (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 || [];
+        // 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.productList || [];
+        this.receivableList =
+          (data.advanceInfo && data.advanceInfo.advanceInfoDetailList) || [];
         this.dataForm = {
           ...this.dataForm,
           ...data,
@@ -288,6 +292,8 @@
           totalAdvanceConfirmAmount: data.totalAdvanceConfirmAmount || 0,
           totalReceivableAmount: data.totalReceivableAmount || 0
         };
+
+        console.log('this.dataForm~~~', this.dataForm, this.receivableList);
         switch (this.dataForm.dateType) {
           case 1:
             // this.dataForm.year = this.dataForm.dateValue;
@@ -403,7 +409,7 @@
           const totalAdvanceConfirmAmount =
             this.receivableList.reduce(
               (pre, cur) =>
-                pre + Math.round((+cur.currentConfirmAmount || 0) * 100),
+                pre + Math.round((+cur.statementAdvanceConfirmAmount || 0) * 100),
               0
             ) / 100;
           const totalReceivableAmount =

+ 95 - 165
src/views/saleManage/saleOrder/accountstatement/components/receivableInfo.vue

@@ -16,70 +16,6 @@
             </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-input
-              clearable
-              v-model="paymentConditionName"
-              @click.native="openReceiveTerms"
-              placeholder="请选择"
-              readonly
-            />
-          </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>
 
@@ -104,9 +40,56 @@
         cache-key="account-receivable-table"
         class="time-form"
       >
-        <template v-slot:currentConfirmAmount="scope">
+        <template v-slot:fundType="scope">
+          <el-select
+            v-model="scope.row.fundType"
+            placeholder="请选择"
+            class="ele-block"
+            :disabled="isView"
+            @change="(val) => updateRowField(scope.$index, 'fundType', val)"
+          >
+            <el-option
+              v-for="item in paymentTypeOp"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            />
+          </el-select>
+        </template>
+
+        <template v-slot:transactionMode="scope">
+          <el-select
+            v-model="scope.row.transactionMode"
+            placeholder="请选择"
+            class="ele-block"
+            :disabled="isView"
+            @change="
+              (val) => updateRowField(scope.$index, 'transactionMode', val)
+            "
+          >
+            <el-option
+              v-for="item in transactionMethodsOp"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            />
+          </el-select>
+        </template>
+
+        <template v-slot:paymentCondition="scope">
+          <el-input
+            clearable
+            :value="scope.row.paymentConditionName"
+            @click.native="openReceiveTerms(scope.$index)"
+            :placeholder="isView ? '' : '请选择'"
+            :disabled="isView"
+            readonly
+          />
+        </template>
+
+        <template v-slot:statementAdvanceConfirmAmount="scope">
           <el-form-item
-            :prop="'receivableList.' + scope.$index + '.currentConfirmAmount'"
+            :prop="'receivableList.' + scope.$index + '.statementAdvanceConfirmAmount'"
             :rules="{
               validator: (rule, value, cb) =>
                 validateConfirmAmount(rule, value, cb, scope.row),
@@ -114,7 +97,7 @@
             }"
           >
             <el-input
-              v-model="scope.row.currentConfirmAmount"
+              v-model="scope.row.statementAdvanceConfirmAmount"
               type="number"
               :disabled="isView"
               @input="handleConfirmAmountChange(scope.row, scope.$index)"
@@ -135,7 +118,11 @@
       </ele-pro-table>
     </el-form>
     <!-- 收款条件 -->
-    <receiveTermsDialog ref="receiveTermsDialogRef" conditionType="rules" @changeParent="changeReceiveTerms"></receiveTermsDialog>
+    <receiveTermsDialog
+      ref="receiveTermsDialogRef"
+      conditionType="rules"
+      @changeParent="changeReceiveTerms"
+    ></receiveTermsDialog>
   </div>
 </template>
 
@@ -171,30 +158,7 @@
         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'
-          }
-        },
+        rules: {},
         columns: [
           {
             width: 60,
@@ -206,38 +170,49 @@
           },
           {
             minWidth: 140,
-            prop: 'saleOrderNo',
+            prop: 'salesCode',
             label: '销售订单编码',
             align: 'center',
             showOverflowTooltip: true
           },
           {
             minWidth: 140,
-            prop: 'advanceReceiptCode',
+            prop: 'advanceCode',
             label: '预收编码',
             align: 'center',
             showOverflowTooltip: true
           },
           {
-            minWidth: 100,
-            prop: 'fundTypeName',
+            minWidth: 140,
             label: '款项类型',
             align: 'center',
-            showOverflowTooltip: true
+            slot: 'fundType'
+          },
+          {
+            minWidth: 140,
+            label: '交易方式',
+            align: 'center',
+            slot: 'transactionMode'
+          },
+          {
+            minWidth: 160,
+            label: '收款条件',
+            align: 'center',
+            slot: 'paymentCondition'
           },
           {
             minWidth: 140,
-            prop: 'unConfirmAmount',
+            prop: 'unreconciledAdvanceConfirmAmount',
             label: '未对账预收款确收金额',
             align: 'center',
             showOverflowTooltip: true
           },
           {
             minWidth: 160,
-            prop: 'currentConfirmAmount',
+            prop: 'statementAdvanceConfirmAmount',
             label: '本次对账预收款确收金额',
             align: 'center',
-            slot: 'currentConfirmAmount'
+            slot: 'statementAdvanceConfirmAmount'
           },
           {
             minWidth: 120,
@@ -268,61 +243,11 @@
       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);
-        }
-      },
-      paymentConditionId: {
-        get() {
-          return this.dataForm.paymentConditionId;
-        },
-        set(val) {
-          this.emitDataForm('paymentConditionId', val);
-        }
-      },
-      paymentConditionName: {
-        get() {
-          return this.dataForm.paymentConditionName;
-        },
-        set(val) {
-          this.emitDataForm('paymentConditionName', 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),
+              pre + Math.round((+cur.statementAdvanceConfirmAmount || 0) * 100),
             0
           ) / 100
         );
@@ -347,17 +272,22 @@
     },
     methods: {
 
-      openReceiveTerms() {
+      openReceiveTerms(index) {
+        this.currentRowIndex = index;
         this.$refs.receiveTermsDialogRef.open();
       },
-      
+
       changeReceiveTerms(row, index) {
-        this.emitDataForm('paymentConditionId', row.id);
-        this.emitDataForm('paymentConditionName', row.name);
+        const targetIndex = index != null ? index : this.currentRowIndex;
+        if (targetIndex == null) return;
+        this.updateRowField(targetIndex, 'paymentConditionId', row.id);
+        this.updateRowField(targetIndex, 'paymentConditionName', row.name);
       },
-      // dataForm 为 .sync prop,整体替换以避免直接 mutation
-      emitDataForm(key, val) {
-        this.$emit('update:dataForm', { ...this.dataForm, [key]: val });
+      // 行内字段修改:通过 .sync 回写 receivableList
+      updateRowField(index, key, val) {
+        const list = [...this.receivableList];
+        list[index] = { ...list[index], [key]: val };
+        this.$emit('update:receivableList', list);
       },
       // 新增一行预收款(实际应从预收款管理选择器带出)
       addAdvanceReceipt() {
@@ -370,14 +300,14 @@
       },
       handleConfirmAmountChange(row, index) {
         // 限制本次确收金额不能超过未对账金额和本次对账金额
-        let val = +row.currentConfirmAmount || 0;
+        let val = +row.statementAdvanceConfirmAmount || 0;
         const max = Math.min(
-          +row.unConfirmAmount || 0,
+          +row.unreconciledAdvanceConfirmAmount || 0,
           +row.statementAmount || 0
         );
         if (val > max) {
           val = max;
-          this.$set(row, 'currentConfirmAmount', val);
+          this.$set(row, 'statementAdvanceConfirmAmount', val);
           this.$message.warning(
             '本次对账预收款确收金额不能超过未对账金额和本次对账金额'
           );
@@ -390,12 +320,12 @@
       recalcAllRows() {
         this.receivableList.forEach((row) => {
           const max = Math.min(
-            +row.unConfirmAmount || 0,
+            +row.unreconciledAdvanceConfirmAmount || 0,
             +row.statementAmount || 0
           );
-          let val = +row.currentConfirmAmount || 0;
+          let val = +row.statementAdvanceConfirmAmount || 0;
           if (val > max) val = max;
-          this.$set(row, 'currentConfirmAmount', val);
+          this.$set(row, 'statementAdvanceConfirmAmount', val);
           this.$set(
             row,
             'currentReceivableAmount',
@@ -406,7 +336,7 @@
       validateConfirmAmount(rule, value, callback, row) {
         const val = +value || 0;
         const max = Math.min(
-          +row.unConfirmAmount || 0,
+          +row.unreconciledAdvanceConfirmAmount || 0,
           +row.statementAmount || 0
         );
         if (val < 0) {