PlatformDetail.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <script lang="ts" setup>
  2. /**
  3. * @Name: PlatformDetail.vue
  4. * @Description: 平台详情页
  5. * @Author: Cheney
  6. */
  7. import { useResponse } from '/@/utils/useResponse';
  8. import * as api from '../api';
  9. import { Picture as IconPicture } from '@element-plus/icons-vue';
  10. import { columns } from '../useColumns';
  11. import router from '/@/router';
  12. const route = useRoute();
  13. const platform = route.query.platform;
  14. const platformOverview: any = ref([]);
  15. // const selectedTab = ref('1');
  16. const platformTableData = ref([]);
  17. const gridOptions: any = reactive({
  18. border: false,
  19. round: true,
  20. stripe: true,
  21. currentRowHighLight: true,
  22. height: 870,
  23. toolbarConfig: {
  24. custom: true,
  25. slots: {
  26. buttons: 'toolbar_buttons'
  27. // tools: 'toolbar_tools'
  28. }
  29. },
  30. rowConfig: {
  31. isHover: true
  32. },
  33. columnConfig: {
  34. resizable: true
  35. },
  36. pagerConfig: {
  37. total: 0,
  38. page: 1,
  39. limit: 10
  40. },
  41. loading: false,
  42. loadingConfig: {
  43. icon: 'vxe-icon-indicator roll',
  44. text: '正在拼命加载中...'
  45. },
  46. columns: columns,
  47. data: platformTableData
  48. });
  49. onBeforeMount(() => {
  50. fetchPlatformDetailOverview();
  51. fetchPlatformDetail();
  52. });
  53. async function fetchPlatformDetail() {
  54. const query = {
  55. platform,
  56. page: gridOptions.pagerConfig.page,
  57. limit: gridOptions.pagerConfig.limit
  58. };
  59. const res = await useResponse(query, api.getPlatformDetailTableData, gridOptions);
  60. gridOptions.pagerConfig.total = res.total;
  61. gridOptions.pagerConfig.page = res.page;
  62. gridOptions.pagerConfig.limit = res.limit;
  63. platformTableData.value = res.data;
  64. }
  65. function pageChange({ pageSize, currentPage }: any) {
  66. gridOptions.pagerConfig.limit = pageSize;
  67. gridOptions.pagerConfig.page = currentPage;
  68. fetchPlatformDetail();
  69. }
  70. async function fetchPlatformDetailOverview() {
  71. const res = await useResponse({ platform }, api.getPlatformDetailOverview);
  72. platformOverview.value = res.data;
  73. }
  74. // function handleTabChange(tabValue: any) {
  75. // console.log("(PlatformDetail.vue: 82)=> tabValue", tabValue);
  76. // if (tabValue === '2') {
  77. // const query = {};
  78. // }
  79. // }
  80. function handleNavigate(item: any) {
  81. router.push({
  82. path: '/shop/detail',
  83. query: { platform: item.platform }
  84. });
  85. }
  86. </script>
  87. <template>
  88. <div class="p-2.5">
  89. <!-- overview-card -->
  90. <el-card body-class="flex items-center" shadow="hover" style="border: none">
  91. <el-image :src="`/src/assets/platformImg/${ platform }.png`" class="mr-7 rounded-2xl" style="height: 100px; width: 100px; object-fit: contain">
  92. <template #error>
  93. <div class="mr-3.5 flex items-center justify-center text-5xl" style="height: 100px; width: 100px; background-color: #f5f5f5">
  94. <el-icon>
  95. <icon-picture/>
  96. </el-icon>
  97. </div>
  98. </template>
  99. </el-image>
  100. <div class="text-lg">
  101. <div class="font-semibold">
  102. 平台名称:
  103. <span class="font-medium italic ml-1.5" style="color: #64748b">
  104. {{ platformOverview[0]?.platform ? platformOverview[0]?.platform : '--' }}
  105. </span>
  106. </div>
  107. <div class="font-semibold">
  108. 公司:
  109. <span class="font-medium italic ml-1.5" style="color: #64748b">
  110. {{ platformOverview[0]?.countCompany ? platformOverview[0]?.countCompany : '--' }}
  111. </span>
  112. </div>
  113. <div class="font-semibold">
  114. 店铺:
  115. <span class="font-medium italic ml-1.5" style="color: #64748b">
  116. {{ platformOverview[0]?.countShop ? platformOverview[0]?.countShop : '--' }}
  117. </span>
  118. </div>
  119. <div class="font-semibold">
  120. 电脑:
  121. <span class="font-medium italic ml-1.5" style="color: #64748b">
  122. {{ platformOverview[0]?.countComputer ? platformOverview[0]?.countComputer : '--' }}
  123. </span>
  124. </div>
  125. </div>
  126. </el-card>
  127. <!-- table-card -->
  128. <el-card body-style="padding-top: 10px" class="mt-2.5" shadow="hover" style="border: none">
  129. <vxe-grid v-bind="gridOptions">
  130. <!--<template #toolbar_buttons>
  131. <el-radio-group v-model="selectedTab" @change="handleTabChange">
  132. <el-radio-button label="当前信息" value="1" :icon="Timer">
  133. <template #default>
  134. <el-icon style="top: 2px;"><Timer /></el-icon>
  135. 当前信息
  136. </template>
  137. </el-radio-button>
  138. <el-radio-button label="历史记录" value="2" :icon="RefreshLeft">
  139. <template #default>
  140. <el-icon style="top: 2px;"><RefreshLeft /></el-icon>
  141. 历史记录
  142. </template>
  143. </el-radio-button>
  144. </el-radio-group>
  145. </template>-->
  146. <template #platformNumber="{ row }">
  147. <el-button link style="font-weight: 700" type="primary" @click="handleNavigate(row)">
  148. <el-icon>
  149. <Link/>
  150. </el-icon>
  151. {{ row.platformNumber ? row.platformNumber : '--' }}
  152. </el-button>
  153. </template>
  154. <template #pager>
  155. <vxe-pager
  156. v-model:currentPage="gridOptions.pagerConfig.page"
  157. v-model:pageSize="gridOptions.pagerConfig.limit"
  158. :total="gridOptions.pagerConfig.total"
  159. @page-change="pageChange"
  160. >
  161. </vxe-pager>
  162. </template>
  163. </vxe-grid>
  164. </el-card>
  165. </div>
  166. </template>
  167. <style scoped></style>