todayIncomeList.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <div class="todayIncomeList">
  3. <!-- 头部 -->
  4. <div class="header">
  5. <el-button class="back-btn" @click="goBack"> 返回 </el-button>
  6. <h2 class="title">今日可收益金额</h2>
  7. </div>
  8. <div class="table-box">
  9. <ProTable
  10. ref="proTable"
  11. :columns="columns"
  12. :request-api="getTableList"
  13. :init-param="initParam"
  14. :data-callback="dataCallback"
  15. :pagination="true"
  16. >
  17. <!-- 表格操作 -->
  18. <template #operation="scope">
  19. <el-button type="primary" link @click="toDetail(scope.row)"> 查看详情 </el-button>
  20. </template>
  21. </ProTable>
  22. <el-dialog v-model="dialogVisible" title="详情" width="500px">
  23. <h2>{{ unposted.couponName }}</h2>
  24. <el-row class="couponRow">
  25. <el-col :span="12"> 实际收益:+138.32 </el-col>
  26. <el-col :span="12"> {{ `技术服务费(${unposted.commissionRate || 3}%)` }}:{{ unposted.commissionStr }} </el-col>
  27. </el-row>
  28. <el-row class="couponRow">
  29. <el-col :span="12"> 售价:{{ unposted.incomeMoney || ((unposted?.money || 0) / 100).toFixed(2) || "0.00" }} </el-col>
  30. </el-row>
  31. <h3 class="orderInfo">订单信息</h3>
  32. <div>
  33. <div class="couponRow">下单时间:{{ unposted.orderTime }}</div>
  34. <div class="couponRow">验券时间:{{ unposted.checkTime }}</div>
  35. <div class="couponRow">入账时间:</div>
  36. </div>
  37. </el-dialog>
  38. </div>
  39. </div>
  40. </template>
  41. <script setup lang="tsx" name="voucherManagement">
  42. import { computed, onActivated, onMounted, reactive, ref, watch } from "vue";
  43. import { useRouter } from "vue-router";
  44. import type { FormInstance, FormRules } from "element-plus";
  45. import { ElMessage } from "element-plus";
  46. import ProTable from "@/components/ProTable/index.vue";
  47. import { ColumnProps, ProTableInstance } from "@/components/ProTable/interface";
  48. import { getPaymentCycle } from "@/api/modules/homeEntry";
  49. import { ElMessageBox } from "element-plus/es";
  50. import { localGet } from "@/utils";
  51. const router = useRouter();
  52. const dialogVisible = ref(true);
  53. const unposted = ref<any>({});
  54. const toDetail = (row: any) => {
  55. dialogVisible.value = true;
  56. unposted.value = row;
  57. };
  58. // 返回
  59. const goBack = () => {
  60. router.back();
  61. };
  62. // ProTable 实例(需要在使用它的地方之前定义)
  63. const proTable = ref<ProTableInstance>();
  64. // 表格配置项
  65. const columns = reactive<ColumnProps<any>[]>([
  66. {
  67. prop: "couponName",
  68. label: "商品名称"
  69. },
  70. {
  71. prop: "price",
  72. label: "券码",
  73. render: (scope: any) => {
  74. return scope.row.price ? `¥${scope.row.price}` : "--";
  75. }
  76. },
  77. {
  78. prop: "createdTime",
  79. label: "实际收益",
  80. render: scope => {
  81. return scope.row.saleNum === null || !scope.row.saleNum ? "--" : scope.row.saleNum;
  82. }
  83. },
  84. {
  85. prop: "createdTime",
  86. label: "售价",
  87. render: scope => {
  88. return scope.row.saleNum === null || !scope.row.saleNum ? "--" : scope.row.saleNum;
  89. }
  90. },
  91. {
  92. prop: "createdTime",
  93. label: "技术服务费",
  94. render: scope => {
  95. return scope.row.saleNum === null || !scope.row.saleNum ? "--" : scope.row.saleNum;
  96. }
  97. },
  98. { prop: "operation", label: "操作", fixed: "right", width: 330 }
  99. ]);
  100. // 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
  101. const initParam = reactive({
  102. storeId: localGet("createdId"),
  103. incomeType: 0,
  104. paymentType: 0,
  105. startTime: null,
  106. endTime: null
  107. });
  108. // 页面加载时触发查询
  109. onMounted(async () => {
  110. proTable.value?.getTableList();
  111. });
  112. // 从其他页面返回时触发查询
  113. onActivated(() => {
  114. proTable.value?.getTableList();
  115. });
  116. // dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
  117. // 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
  118. const dataCallback = (data: any) => {
  119. return {
  120. list: data.data?.records || data.records || [],
  121. total: data.data?.total || data.total || 0
  122. };
  123. };
  124. // 如果你想在请求之前对当前请求参数做一些操作,可以自定义如下函数:params 为当前所有的请求参数(包括分页),最后返回请求列表接口
  125. // 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getUserList"
  126. const getTableList = (params: any) => {
  127. let newParams = JSON.parse(JSON.stringify(params));
  128. return getPaymentCycle(newParams);
  129. };
  130. </script>
  131. <style lang="scss" scoped>
  132. .todayIncomeList {
  133. height: 100%;
  134. border: 1px solid red;
  135. }
  136. .header {
  137. position: relative;
  138. display: flex;
  139. align-items: center;
  140. padding: 20px;
  141. background: #ffffff;
  142. border-bottom: 1px solid #e4e7ed;
  143. .back-btn {
  144. padding: 8px 16px;
  145. font-size: 14px;
  146. color: #606266;
  147. background-color: #f5f7fa;
  148. border: 1px solid #dcdfe6;
  149. border-radius: 4px;
  150. &:hover {
  151. color: #409eff;
  152. background-color: #ecf5ff;
  153. border-color: #b3d8ff;
  154. }
  155. }
  156. .title {
  157. position: absolute;
  158. left: 50%;
  159. margin: 0;
  160. font-size: 18px;
  161. font-weight: bold;
  162. color: #333333;
  163. transform: translateX(-50%);
  164. }
  165. }
  166. // 在组件样式中添加
  167. .date-range {
  168. display: block; // 确保换行生效
  169. padding: 0 8px; // 可选:增加内边距
  170. word-wrap: break-word; // 长单词内换行
  171. white-space: normal; // 允许自然换行
  172. }
  173. .table-header-btn {
  174. .button {
  175. margin-bottom: 10px;
  176. }
  177. .tabs {
  178. :deep(.el-tabs__nav-wrap::after) {
  179. height: 0;
  180. }
  181. }
  182. }
  183. .orderInfo {
  184. padding-bottom: 20px;
  185. font-size: 18px;
  186. font-weight: bold;
  187. }
  188. .couponRow {
  189. padding-bottom: 20px;
  190. }
  191. .couponRow:last-child {
  192. padding-bottom: 0;
  193. }
  194. .reject-reason-content {
  195. padding: 20px 0;
  196. .reject-reason-item {
  197. display: flex;
  198. margin-bottom: 20px;
  199. &:last-child {
  200. margin-bottom: 0;
  201. }
  202. .reject-reason-label {
  203. flex-shrink: 0;
  204. min-width: 100px;
  205. font-size: 14px;
  206. font-weight: 500;
  207. color: #606266;
  208. }
  209. .reject-reason-value {
  210. flex: 1;
  211. font-size: 14px;
  212. color: #303133;
  213. word-break: break-word;
  214. &.reject-reason-text {
  215. min-height: 80px;
  216. padding: 12px;
  217. line-height: 1.6;
  218. white-space: pre-wrap;
  219. background-color: #f5f7fa;
  220. border-radius: 4px;
  221. }
  222. }
  223. }
  224. }
  225. </style>