yuan
5 天以前 9ea5ff67655241271bdf04bb50ca3a8d60c4e22a
src/views/procurementManagement/purchaseReturnOrder/New.vue
@@ -259,16 +259,13 @@
              <el-table-column label="数量"
                               prop="stockInNum"
                               width="100" />
              <el-table-column label="销售发货数量"
                               prop="saleOutQuantity"
                               width="120" />
                               <el-table-column label="可退货数量"
                               prop="unQuantity"
                               width="130" />
              <el-table-column label="已退货数量"
                               width="130">
                <template #default="scope">
                  {{ formattedNumber(scope.row, null, scope.row.totalReturnNum || 0) }}
                  {{ calcAlreadyReturned(scope.row) }}
                </template>
              </el-table-column>
              <el-table-column label="退货数量"
@@ -423,7 +420,7 @@
<script setup>
import {ref, computed, getCurrentInstance, watch, defineAsyncComponent} from "vue";
import {createPurchaseReturnOrder} from "@/api/procurementManagement/purchase_return_order.js";
import {getOptions, purchaseReturnableList} from "@/api/procurementManagement/procurementLedger.js";
import {getOptions, purchaseList} from "@/api/procurementManagement/procurementLedger.js";
import {userListNoPageByTenantId} from "@/api/system/user.js";
const ProductList = defineAsyncComponent(() => import("@/views/procurementManagement/purchaseReturnOrder/ProductList.vue"));
const props = defineProps({
@@ -531,6 +528,14 @@
const toNumber = (val) => {
  const num = Number(val)
  return Number.isNaN(num) ? 0 : num
}
/** 已退货数量 = 入库行总数量 − 当前可退货数量(剩余) */
const calcAlreadyReturned = (row) => {
  const total = Number(row?.stockInNum ?? row?.totalQuantity ?? row?.quantity ?? 0)
  const un = Number(row?.unQuantity ?? 0)
  if (!Number.isFinite(total) || !Number.isFinite(un)) return 0
  return Math.max(total - un, 0)
}
const getReturnTotal = (row) => {
@@ -669,7 +674,7 @@
const fetchPurchaseLedgerOptions = () => {
  purchaseLedgerOptions.value = []
  if (formState.value.supplierId) {
    purchaseReturnableList({ supplierId: formState.value.supplierId }).then((res) => {
    purchaseList({supplierId: formState.value.supplierId,approvalStatus:3}).then((res) => {
      purchaseLedgerOptions.value = res.rows;
    });
  }
@@ -800,4 +805,4 @@
}
</style>
</style>