detailDialog.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <el-dialog
  3. v-model="dialogShow"
  4. title="订单详情"
  5. width="920px"
  6. destroy-on-close
  7. :close-on-click-modal="false"
  8. @close="handleClose"
  9. >
  10. <div class="detail-table">
  11. <ProTable ref="proTable" :data="detailList" :columns="columns" :tool-button="false" :border="true" height="360" />
  12. </div>
  13. </el-dialog>
  14. </template>
  15. <script setup lang="ts">
  16. import { ref, defineExpose } from "vue";
  17. import { ElMessage } from "element-plus";
  18. import ProTable from "@/components/ProTable/index.vue";
  19. import type { ColumnProps } from "@/components/ProTable/interface";
  20. import { getLawyerDetails } from "@/api/modules/lawyer";
  21. const dialogShow = ref(false);
  22. const detailList = ref<any[]>([]);
  23. const currentQuery = ref<String>("");
  24. const columns: ColumnProps[] = [
  25. { label: "用户ID", prop: "clientUserId", minWidth: 120 },
  26. { label: "用户名", prop: "clientUserName", minWidth: 160, showOverflowTooltip: true },
  27. { label: "订单编号", prop: "orderNumber", minWidth: 160, showOverflowTooltip: true },
  28. { label: "订单金额", prop: "orderAmount", minWidth: 140, align: "center" },
  29. { label: "购买时间", prop: "orderTime", minWidth: 180 }
  30. ];
  31. const fetchDetails = async () => {
  32. try {
  33. const res: any = await getLawyerDetails({
  34. lawyerId: currentQuery.value
  35. });
  36. detailList.value = res.data?.records;
  37. } catch (error) {
  38. detailList.value = [];
  39. ElMessage.error("加载详情失败,请稍后重试");
  40. }
  41. };
  42. const open = async (lawyerId: String) => {
  43. currentQuery.value = lawyerId;
  44. dialogShow.value = true;
  45. await fetchDetails();
  46. };
  47. const handleClose = () => {
  48. dialogShow.value = false;
  49. detailList.value = [];
  50. currentQuery.value = "";
  51. };
  52. defineExpose({
  53. open
  54. });
  55. </script>
  56. <style scoped lang="scss">
  57. .detail-table {
  58. min-height: 360px;
  59. max-height: 460px;
  60. overflow: hidden;
  61. }
  62. .detail-table :deep(.el-table__body-wrapper) {
  63. max-height: 380px;
  64. overflow: auto;
  65. }
  66. .detail-pagination {
  67. display: flex;
  68. justify-content: flex-end;
  69. margin-top: 12px;
  70. }
  71. </style>