8 天以前 63afcf7bd6eff23e4feee8b6d12053bd8e78abb8
src/views/procurementManagement/purchaseReturnOrder/index.vue
@@ -36,6 +36,7 @@
      >
        <template #operation="{ row }">
          <el-button link type="primary" size="small" style="color: #67C23A" @click="handleDetail(row)">详情</el-button>
          <el-button link size="small" @click="handleDelete(row)">删除</el-button>
        </template>
      </PIMTable>
    </div>
@@ -87,10 +88,10 @@
          <el-table-column label="含税单价(元)" prop="taxInclusiveUnitPrice" width="130">
            <template #default="scope">{{ formatAmount(scope.row.taxInclusiveUnitPrice) }}</template>
          </el-table-column>
          <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" width="130">
          <el-table-column label="退货总价(元)" prop="taxInclusiveTotalPrice" width="130">
            <template #default="scope">{{ formatAmount(scope.row.taxInclusiveTotalPrice) }}</template>
          </el-table-column>
          <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" width="140">
          <el-table-column label="不退货总价(元)" prop="taxExclusiveTotalPrice" width="140">
            <template #default="scope">{{ formatAmount(scope.row.taxExclusiveTotalPrice) }}</template>
          </el-table-column>
          <el-table-column label="是否质检" prop="isChecked" width="100" align="center">
@@ -113,7 +114,7 @@
import PIMTable from '@/components/PIMTable/PIMTable.vue'
import { ref, reactive, toRefs, onMounted, defineAsyncComponent, getCurrentInstance } from 'vue'
const { proxy } = getCurrentInstance()
import {findPurchaseReturnOrderListPage, getPurchaseReturnOrderDetail} from "@/api/procurementManagement/purchase_return_order.js";
import {findPurchaseReturnOrderListPage, getPurchaseReturnOrderDetail, deletePurchaseReturnOrder} from "@/api/procurementManagement/purchase_return_order.js";
const New = defineAsyncComponent(() => import("@/views/procurementManagement/purchaseReturnOrder/New.vue"));
const tableData = ref([])
const selectedRows = ref([])
@@ -181,7 +182,7 @@
    prop: 'returnUserName',
    width: 110,
  },
  {
    label: '整单折扣额',
    prop: 'totalDiscountAmount',
@@ -218,13 +219,24 @@
    width: 180,
  },
  {
    fixed: 'right',
    label: '操作',
    dataType: 'slot',
    slot: 'operation',
    width: 100,
    align: 'center',
    dataType: "action",
    width: 120,
      label: "操作",
      align: "center",
      fixed: "right",
    operation: [
      {
            name: "详情",
            type: "text",
            clickFun: row => {handleDetail(row);},
         },
      {
        name: "删除",
        clickFun: row => {handleDelete(row)},
      },
  ],
  },
])
const data = reactive({
  searchForm: {
@@ -240,9 +252,27 @@
  getList()
}
// 删除操作
const handleDelete = (row) => {
  console.log('删除行数据:', row)
  proxy?.$modal?.confirm('确定要删除吗?删除将无法恢复').then(() => {
    // 这里调用删除接口,传入 row.id
    deletePurchaseReturnOrder(row.id).then(() => {
      proxy?.$modal?.msgSuccess?.("删除成功");
      getList()
    }).catch(() => {
      proxy?.$modal?.msgError?.('删除失败')
    })
  }).catch(() => {
    // 取消删除
    proxy?.$modal?.msgInfo?.('已取消删除')
  })
}
// 查看详情
const handleDetail = (row) => {
  if (!row?.id) {
    proxy?.$modal?.msgWarning('未获取到单据ID')
    proxy?.$modal?.msgWarning?.('未获取到单据ID')
    return
  }
  detailVisible.value = true
@@ -251,13 +281,13 @@
    const payload = res?.data || {}
    detailData.value = payload
    // 拼接连个对象成一个对象,方便展示 item 和 item.salesLedgerProduct 里的字段
    detailProducts.value =
      payload.purchaseReturnOrderProductsDetailVoList.map(item => ({ ...item, ...item.salesLedgerProduct })) ||
      []
  }).catch(() => {
    proxy?.$modal?.msgError('获取详情失败')
    proxy?.$modal?.msgError?.('获取详情失败')
  }).finally(() => {
    detailLoading.value = false
  })
@@ -310,4 +340,9 @@
  getList()
})
</script>
<style scoped>
.table_list {
   margin-top: unset;
}
</style>