yyb
2026-05-13 faf0dbe7ea8859905e22fb7b82f4eb1db5fbd06f
销售退货/采购退货:退货数量=总数量-未退货数量
已修改5个文件
65 ■■■■ 文件已修改
src/views/procurementManagement/purchaseReturnOrder/New.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/purchaseReturnOrder/ProductList.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/purchaseReturnOrder/index.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/returnOrder/components/detailDia.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/returnOrder/components/formDia.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/purchaseReturnOrder/New.vue
@@ -261,8 +261,11 @@
                               prop="unQuantity"
                               width="130" />
              <el-table-column label="已退货数量"
                               prop="totalReturnNum"
                               width="130" />
                               width="130">
                <template #default="scope">
                  {{ calcAlreadyReturned(scope.row) }}
                </template>
              </el-table-column>
              <el-table-column label="退货数量"
                               prop="returnQuantity"
                               width="180">
@@ -526,6 +529,14 @@
  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) => {
  const qty = toNumber(row?.returnQuantity)
  const unitPrice = toNumber(row?.taxInclusiveUnitPrice)
src/views/procurementManagement/purchaseReturnOrder/ProductList.vue
@@ -38,8 +38,11 @@
                           prop="unQuantity"
                           width="130" />
          <el-table-column label="已退货数量"
                           prop="totalReturnNum"
                           width="130" />
                           width="130">
            <template #default="scope">
              {{ calcAlreadyReturned(scope.row) }}
            </template>
          </el-table-column>
          <!-- <el-table-column label="库存预警数量"
                           prop="warnNum"
                           width="120"
@@ -116,6 +119,14 @@
  return parseFloat(cellValue).toFixed(2);
};
/** 已退货数量 = 入库行总数量 − 当前可退货数量(剩余) */
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 handleChangeSelection = (val) => {
  selectedRows.value = val;
}
src/views/procurementManagement/purchaseReturnOrder/index.vue
@@ -146,8 +146,11 @@
                           prop="unQuantity"
                           width="100" />
          <el-table-column label="已退货数量"
                           prop="totalReturnNum"
                           width="100" />
                           width="100">
            <template #default="scope">
              {{ calcAlreadyReturned(scope.row) }}
            </template>
          </el-table-column>
          <!-- <el-table-column label="库存预警数量" prop="warnNum" width="120" /> -->
          <!-- <el-table-column label="税率(%)" prop="taxRate" width="90" /> -->
          <el-table-column
@@ -458,6 +461,14 @@
  return num.toFixed(2);
};
/** 已退货数量 = 入库行总数量 − 当前可退货数量(剩余) */
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);
};
onMounted(() => {
  getList();
});
src/views/salesManagement/returnOrder/components/detailDia.vue
@@ -20,7 +20,11 @@
      <div style="padding-top: 20px">
        <span class="descriptions">产品列表</span>
        <PIMTable :isShowPagination="false" rowKey="id" :column="tableColumn" :tableData="tableData" />
        <PIMTable :isShowPagination="false" rowKey="id" :column="tableColumn" :tableData="tableData">
          <template #totalReturnNum="{ row }">
            {{ calcAlreadyReturned(row) }}
          </template>
        </PIMTable>
      </div>
    </div>
    <template #footer>
@@ -101,6 +105,13 @@
const firstNonEmptyText = (...vals) => {
  const hit = vals.find((v) => !isEmptyText(v));
  return hit === undefined ? "" : hit;
};
const calcAlreadyReturned = (row) => {
  const total = Number(row?.stockOutNum ?? row?.totalQuantity ?? row?.totalReturnNum ?? 0);
  const un = Number(row?.unQuantity ?? 0);
  if (!Number.isFinite(total) || !Number.isFinite(un)) return 0;
  return Math.max(total - un, 0);
};
/** 详情表用 productName / model;合并时勿让空串盖掉出库行字段 */
@@ -241,7 +252,7 @@
  {align: "center", label: "规格型号", prop: "model"},
  {align: "center", label: "单位", prop: "unit", width: 80},
  {align: "center", label: "总数量", prop: "stockOutNum", width: 120},
  {align: "center", label: "已退货数量", prop: "totalReturnNum", width: 120},
  {align: "center", label: "已退货数量", prop: "totalReturnNum", width: 120, dataType: "slot", slot: "totalReturnNum"},
  {align: "center", label: "未退货数量", prop: "unQuantity", width: 120},
  {align: "center", label: "退货数量", prop: "returnQuantity", width: 120},
  {align: "center", label: "退货产品单价", prop: "price", width: 120},
src/views/salesManagement/returnOrder/components/formDia.vue
@@ -82,6 +82,9 @@
            <el-button type="primary" @click="openProductSelection" :disabled="!form.shippingId">添加产品</el-button>
          </div>
          <PIMTable :isShowPagination="false" rowKey="id" :column="tableColumn" :tableData="tableData">
            <template #totalReturnNum="{ row }">
              {{ calcAlreadyReturned(row) }}
            </template>
            <template #returnQuantity="{ row }">
              <el-input 
                v-model="row.returnQuantity" 
@@ -223,7 +226,7 @@
  {align: "center", label: "规格型号", prop: "specificationModel" },
  {align: "center", label: "单位", prop: "unit", width: 80 },
  {align: "center", label: "总数量", prop: "stockOutNum", width: 120 },
  {align: "center", label: "已退货数量", prop: "totalReturnNum", width: 120 },
  {align: "center", label: "已退货数量", prop: "totalReturnNum", width: 120, dataType: "slot", slot: "totalReturnNum" },
  {align: "center", label: "未退货数量", prop: "unQuantity", width: 120 },
  {align: "center", label: "退货数量", prop: "returnQuantity", dataType: "slot", slot: "returnQuantity", width: 120 },
  {align: "center", label: "退货产品单价", prop: "price", dataType: "slot", slot: "price", width: 120 },