reconciled.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <div class="table-box">
  3. <ProTable ref="proTable" :columns="columns" :request-api="getTableList" :init-param="initParam" :data-callback="dataCallback">
  4. <!-- 表格操作 -->
  5. <template #operation="scope">
  6. <el-button type="primary" link @click="toDetail(scope.row)"> 查看详情 </el-button>
  7. </template>
  8. </ProTable>
  9. <el-dialog v-model="dialogVisible" title="详情" width="500px">
  10. <h3>火锅一人惨</h3>
  11. <el-row>
  12. <el-col :span="12"> 实际收益:+138.32 </el-col>
  13. <el-col :span="12"> 技术服务费(3%):-138.32 </el-col>
  14. </el-row>
  15. <el-row>
  16. <el-col :span="12"> 售价:+138.32 </el-col>
  17. </el-row>
  18. <h3>订单信息</h3>
  19. <div>
  20. <div>券码:</div>
  21. <div>下单时间:</div>
  22. <div>验券时间:</div>
  23. <div>入账时间:</div>
  24. </div>
  25. </el-dialog>
  26. </div>
  27. </template>
  28. <script setup lang="tsx" name="voucherManagement">
  29. import { onActivated, onMounted, reactive, ref } from "vue";
  30. import ProTable from "@/components/ProTable/index.vue";
  31. import { ColumnProps, ProTableInstance } from "@/components/ProTable/interface";
  32. import { getPaymentCycle } from "@/api/modules/homeEntry";
  33. import { localGet } from "@/utils";
  34. const dialogVisible = ref(true);
  35. const toDetail = (row: any) => {
  36. dialogVisible.value = true;
  37. };
  38. // ProTable 实例(需要在使用它的地方之前定义)
  39. const proTable = ref<ProTableInstance>();
  40. // 表格配置项
  41. const columns = reactive<ColumnProps<any>[]>([
  42. {
  43. prop: "name",
  44. label: "商品名称",
  45. search: {
  46. el: "input"
  47. }
  48. },
  49. {
  50. prop: "price",
  51. label: "券码",
  52. render: (scope: any) => {
  53. return scope.row.price ? `¥${scope.row.price}` : "--";
  54. }
  55. },
  56. {
  57. prop: "saleNum",
  58. label: "入账时间",
  59. render: scope => {
  60. return scope.row.saleNum === null || !scope.row.saleNum ? "--" : scope.row.saleNum;
  61. }
  62. },
  63. { prop: "operation", label: "操作", fixed: "right", width: 330 }
  64. ]);
  65. // 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
  66. const initParam = reactive({
  67. storeId: localGet("createdId"),
  68. incomeType: 0,
  69. paymentType: 1,
  70. startTime: null,
  71. endTime: null
  72. });
  73. // 页面加载时触发查询
  74. onMounted(async () => {
  75. proTable.value?.getTableList();
  76. });
  77. // 从其他页面返回时触发查询
  78. onActivated(() => {
  79. proTable.value?.getTableList();
  80. });
  81. // dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
  82. // 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
  83. const dataCallback = (data: any) => {
  84. return {
  85. list: data.records,
  86. total: data.total
  87. };
  88. };
  89. // 如果你想在请求之前对当前请求参数做一些操作,可以自定义如下函数:params 为当前所有的请求参数(包括分页),最后返回请求列表接口
  90. // 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getUserList"
  91. const getTableList = (params: any) => {
  92. let newParams = JSON.parse(JSON.stringify(params));
  93. return getPaymentCycle(newParams);
  94. };
  95. </script>
  96. <style lang="scss" scoped>
  97. // 在组件样式中添加
  98. .date-range {
  99. display: block; // 确保换行生效
  100. padding: 0 8px; // 可选:增加内边距
  101. word-wrap: break-word; // 长单词内换行
  102. white-space: normal; // 允许自然换行
  103. }
  104. .table-header-btn {
  105. .button {
  106. margin-bottom: 10px;
  107. }
  108. .tabs {
  109. :deep(.el-tabs__nav-wrap::after) {
  110. height: 0;
  111. }
  112. }
  113. }
  114. .reject-reason-content {
  115. padding: 20px 0;
  116. .reject-reason-item {
  117. display: flex;
  118. margin-bottom: 20px;
  119. &:last-child {
  120. margin-bottom: 0;
  121. }
  122. .reject-reason-label {
  123. flex-shrink: 0;
  124. min-width: 100px;
  125. font-size: 14px;
  126. font-weight: 500;
  127. color: #606266;
  128. }
  129. .reject-reason-value {
  130. flex: 1;
  131. font-size: 14px;
  132. color: #303133;
  133. word-break: break-word;
  134. &.reject-reason-text {
  135. min-height: 80px;
  136. padding: 12px;
  137. line-height: 1.6;
  138. white-space: pre-wrap;
  139. background-color: #f5f7fa;
  140. border-radius: 4px;
  141. }
  142. }
  143. }
  144. }
  145. </style>