yuan
3 天以前 7726b6cdab80596d2e2f7dd3fe1ec3dfbdeee155
src/views/procurementManagement/purchaseReturnOrder/New.vue
@@ -3,8 +3,10 @@
    <el-dialog
        v-model="isShow"
        title="新增采购退货"
        width="1600"
        width="70%"
        top="3vh"
        @close="closeModal"
        class="purchase-return-dialog"
    >
      <el-form label-width="140px" :model="formState" label-position="top" ref="formRef" :inline="true">
        <div class="section-title">
@@ -221,19 +223,19 @@
          <el-input style="width: 240px" v-model="formState.remark" :rows="1" type="textarea" placeholder="请输入备注"/>
        </el-form-item>
        <div style="margin: 20px 0;">
        <div style="margin:20px 0;min-width:0;">
            <div class="section-title">
              <span class="title-dot"></span>
              <span class="title-text">产品列表</span>
            </div>
            <el-button type="primary" size="small" style="margin-bottom: 20px" @click="isShowProductsModal = true" :disabled="!formState.purchaseLedgerId">添加产品</el-button>
            <div class="product-table-scroll">
            <el-table class="product-table-inner"
            <el-button type="primary" size="small" style="margin-bottom:20px" @click="isShowProductsModal = true" :disabled="!formState.purchaseLedgerId">添加产品</el-button>
            <el-table
                      :data="formState.purchaseReturnOrderProductsDtos"
                      border
                      max-height="400"
                      show-summary
                      :summary-method="summarizeChildrenTable">
                      :summary-method="summarizeChildrenTable"
                      style="width:100%;min-width:0;">
              <el-table-column align="center"
                               type="selection"
                               width="55" />
@@ -261,8 +263,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">
@@ -321,7 +326,6 @@
                </template>
              </el-table-column>
            </el-table>
            </div>
          </div>
        <div class="section-title">
@@ -526,6 +530,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)
@@ -689,7 +701,7 @@
    ...item,
    returnQuantity: undefined,
    taxInclusiveTotalPrice: 0,
    salesLedgerProductId: item.salesLedgerProductId ?? item.id,
    // salesLedgerProductId: item.salesLedgerProductId,
  }));
  formState.value.purchaseReturnOrderProductsDtos.push(...newProducts);
  syncTotalAmount()
@@ -792,12 +804,5 @@
  margin-right: 8px;
}
.product-table-scroll {
  width: 100%;
  overflow-x: auto;
}
.product-table-inner {
  min-width: 1280px;
}
</style>