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 #unQuantity="{ row }">
              {{ calcAlreadyReturned(row) }}
            </template>
            <template #returnQuantity="{ row }">
              <el-input 
                v-model="row.returnQuantity" 
@@ -146,7 +149,7 @@
      >
        <el-table-column align="center" type="selection" width="55" />
        <el-table-column align="center" prop="productCategory" label="产品大类" />
        <el-table-column align="center" prop="specificationModel" label="规格型号" />
        <el-table-column align="center" prop="specificationModel" label="图纸编号" />
        <el-table-column align="center" prop="unit" label="单位" />
        <el-table-column align="center" prop="shippingNum" label="总数量" />
        <el-table-column align="center" prop="unQuantity" label="未退货数量" />
@@ -208,19 +211,18 @@
const { form, rules } = toRefs(data);
const calcAlreadyReturned = (row) => {
  const total = Number(row?.shippingNum ?? 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);
  const total = Number(row?.shippingNum ?? row?.totalQuantity ?? 0);
  const returned = Number(row?.returnQuantity ?? row?.num ?? 0);
  if (!Number.isFinite(total) || !Number.isFinite(returned)) return 0;
  return total - returned;
};
const tableColumn = ref([
  {align: "center", label: "产品大类", prop: "productCategory" },
  {align: "center", label: "规格型号", prop: "specificationModel" },
  {align: "center", label: "图纸编号", prop: "specificationModel" },
  {align: "center", label: "单位", prop: "unit", width: 80 },
  {align: "center", label: "总数量", prop: "shippingNum", width: 120 },
  {align: "center", label: "已退货数量", prop: "totalReturnNum", width: 120 },
  {align: "center", label: "未退货数量", prop: "unQuantity", width: 120 },
  {align: "center", label: "未退货数量", prop: "unQuantity", width: 120, dataType: "slot", slot: "unQuantity"},
  {align: "center", label: "退货数量", prop: "returnQuantity", dataType: "slot", slot: "returnQuantity", width: 120 },
  {align: "center", label: "退货产品单价", prop: "price", dataType: "slot", slot: "price", width: 120 },
  {align: "center", label: "退货产品金额", prop: "amount", dataType: "slot", slot: "amount", width: 120 },
@@ -516,7 +518,6 @@
        specificationModel: product.specificationModel,
        unit: product.unit,
            shippingNum: product.shippingNum,
        totalReturnNum: product.totalReturnNum,
        unQuantity: product.unQuantity
      });
    }