unposted.vue 5.8 KB

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