ShopDetail.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <script lang="ts" setup>
  2. /**
  3. * @Name: ShopDetail.vue
  4. * @Description: 店铺详情
  5. * @Author: Cheney
  6. */
  7. import { Edit, Monitor, Picture as IconPicture, RefreshLeft, Timer } from '@element-plus/icons-vue';
  8. import { useResponse } from '/@/utils/useResponse';
  9. import * as api from '/@/views/shop-information/api';
  10. import { computerColumns, historyColumns, shopCurrentColumns } from '/@/views/shop-information/useColumns';
  11. import { useTableData } from '/@/utils/useTableData';
  12. import { usePagination } from '/@/utils/usePagination';
  13. import EditDrawer from './EditDrawer.vue';
  14. const route = useRoute();
  15. const platformNumber = route.query.platformNumber;
  16. const shopOverview: any = ref([]);
  17. const overviewLoading = ref(false);
  18. const selectedTab = ref('1');
  19. const { tableOptions, handlePageChange } = usePagination(handleTabChange);
  20. const gridOptions: any = reactive({
  21. border: false,
  22. round: true,
  23. stripe: true,
  24. currentRowHighLight: true,
  25. height: 870,
  26. toolbarConfig: {
  27. custom: true,
  28. slots: {
  29. buttons: 'toolbar_buttons',
  30. tools: 'toolbar_tools'
  31. }
  32. },
  33. rowConfig: {
  34. isHover: true
  35. },
  36. columnConfig: {
  37. resizable: true
  38. },
  39. pagerConfig: {
  40. total: tableOptions.value.total,
  41. page: tableOptions.value.page,
  42. limit: tableOptions.value.limit
  43. },
  44. loading: false,
  45. loadingConfig: {
  46. icon: 'vxe-icon-indicator roll',
  47. text: '正在拼命加载中...'
  48. },
  49. columns: '',
  50. data: ''
  51. });
  52. const isOpen = ref(false);
  53. const formSelect = ref<{ country: string[], line: string[] }>({
  54. country: [],
  55. line: []
  56. });
  57. onBeforeMount(() => {
  58. fetchShopDetailOverview();
  59. handleTabChange(selectedTab.value);
  60. fetchSelect();
  61. });
  62. async function fetchSelect() {
  63. const res = await useResponse({}, api.getShopSelect);
  64. formSelect.value = res.data;
  65. }
  66. async function fetchShopDetailOverview() {
  67. const res = await useResponse({ platformNumber }, api.getShopDetailOverview, overviewLoading);
  68. shopOverview.value = res.data;
  69. }
  70. async function handleTabChange(tabValue: any) {
  71. gridOptions.pagerConfig.page = 1;
  72. gridOptions.pagerConfig.limit = 10;
  73. const query = {
  74. platformNumber,
  75. page: gridOptions.pagerConfig.page,
  76. limit: gridOptions.pagerConfig.limit
  77. };
  78. switch (tabValue) {
  79. case '1':
  80. gridOptions.columns = shopCurrentColumns;
  81. await useTableData(api.getCurrentInfo, query, gridOptions);
  82. break;
  83. case '2':
  84. gridOptions.columns = historyColumns;
  85. await useTableData(api.getHistoryInfo, query, gridOptions);
  86. break;
  87. case '3':
  88. gridOptions.columns = computerColumns;
  89. await useTableData(api.getComputerInfo, query, gridOptions);
  90. break;
  91. }
  92. }
  93. function drawerOpen() {
  94. isOpen.value = true;
  95. }
  96. function handleRefresh() {
  97. handleTabChange(selectedTab.value);
  98. }
  99. </script>
  100. <template>
  101. <div class="p-2.5">
  102. <el-card v-loading="overviewLoading" body-class="flex items-center gap-10" shadow="hover" style="border: none">
  103. <div v-if="platformNumber" class="artistic-text-container mr-7 ">
  104. <div class="artistic-text">
  105. {{ platformNumber }}
  106. </div>
  107. </div>
  108. <el-image v-else class="mr-7 rounded-2xl" src="" style="height: 120px; width: 120px; object-fit: contain">
  109. <template #error>
  110. <div class="mr-3.5 flex items-center justify-center text-5xl"
  111. style="height: 100%; width: 100%; background-color: #f5f5f5">
  112. <el-icon>
  113. <icon-picture/>
  114. </el-icon>
  115. </div>
  116. </template>
  117. </el-image>
  118. <div class="text-lg">
  119. <div class="font-semibold">
  120. 平台编号:
  121. <span class="font-medium italic ml-1.5" style="color: #64748b">
  122. {{ shopOverview[0]?.platformNumber ? shopOverview[0]?.platformNumber : '--' }}
  123. </span>
  124. </div>
  125. <div class="font-semibold">
  126. 所属公司:
  127. <span class="font-medium italic ml-1.5" style="color: #64748b">
  128. {{ shopOverview[0]?.company ? shopOverview[0]?.company : '--' }}
  129. </span>
  130. </div>
  131. <div class="font-semibold">
  132. 所属平台:
  133. <span class="font-medium italic ml-1.5" style="color: #64748b">
  134. {{ shopOverview[0]?.platform ? shopOverview[0]?.platform : '--' }}
  135. </span>
  136. </div>
  137. <div class="font-semibold">
  138. 运营:
  139. <span class="font-medium italic ml-1.5" style="color: #64748b">
  140. {{ shopOverview[0]?.operatorName ? shopOverview[0]?.operatorName : '--' }}
  141. </span>
  142. </div>
  143. <div class="font-semibold">
  144. 电脑:
  145. <span class="font-medium italic ml-1.5" style="color: #64748b">
  146. {{ shopOverview[0]?.countComputer === 0 ? '0' : shopOverview[0]?.countComputer || '--' }}
  147. </span>
  148. </div>
  149. </div>
  150. <div class="text-lg">
  151. <div class="font-semibold">
  152. 主账户手机号及归属人:
  153. <span class="font-medium italic ml-1.5" style="color: #64748b">
  154. {{ shopOverview[0]?.shopPhoneAndNameStr ? shopOverview[0]?.shopPhoneAndNameStr : '--' }}
  155. </span>
  156. </div>
  157. <div class="font-semibold">
  158. 主账户Email:
  159. <span class="font-medium italic ml-1.5" style="color: #64748b">
  160. {{ shopOverview[0]?.shopEmail ? shopOverview[0]?.shopEmail : '--' }}
  161. </span>
  162. </div>
  163. <div class="font-semibold">
  164. 子账户手机号及归属人:
  165. <span class="font-medium italic ml-1.5" style="color: #64748b">
  166. {{ shopOverview[0]?.subShopPhoneAndNameStr ? shopOverview[0]?.subShopPhoneAndNameStr : '--' }}
  167. </span>
  168. </div>
  169. <div class="font-semibold">
  170. 子账户Email:
  171. <span class="font-medium italic ml-1.5" style="color: #64748b">
  172. {{ shopOverview[0]?.subShopEmail ? shopOverview[0]?.subShopEmail : '--' }}
  173. </span>
  174. </div>
  175. </div>
  176. </el-card>
  177. <el-card body-style="padding-top: 10px" class="mt-2.5" shadow="hover" style="border: none">
  178. <vxe-grid v-bind="gridOptions">
  179. <template #toolbar_buttons>
  180. <el-radio-group v-model="selectedTab" @change="handleTabChange(selectedTab)">
  181. <el-radio-button label="当前信息" value="1">
  182. <template #default>
  183. <el-icon style="top: 2px;">
  184. <Timer/>
  185. </el-icon>
  186. 当前信息
  187. </template>
  188. </el-radio-button>
  189. <el-radio-button label="历史记录" value="2">
  190. <template #default>
  191. <el-icon style="top: 2px;">
  192. <RefreshLeft/>
  193. </el-icon>
  194. 历史记录
  195. </template>
  196. </el-radio-button>
  197. <el-radio-button label="电脑信息" value="3">
  198. <template #default>
  199. <el-icon style="top: 2px;">
  200. <Monitor/>
  201. </el-icon>
  202. 电脑信息
  203. </template>
  204. </el-radio-button>
  205. </el-radio-group>
  206. </template>
  207. <template #toolbar_tools>
  208. <div class="mr-2.5">
  209. <el-button :icon="Edit" plain circle type="warning" @click="drawerOpen" :disabled="selectedTab != '1'"></el-button>
  210. </div>
  211. </template>
  212. <template #pager>
  213. <vxe-pager
  214. v-model:currentPage="gridOptions.pagerConfig.page"
  215. v-model:pageSize="gridOptions.pagerConfig.limit"
  216. :total="gridOptions.pagerConfig.total"
  217. @page-change="handlePageChange"
  218. >
  219. </vxe-pager>
  220. </template>
  221. </vxe-grid>
  222. </el-card>
  223. <EditDrawer
  224. v-if="isOpen"
  225. v-model="isOpen"
  226. :formSelect
  227. :gridOptions="gridOptions"
  228. :platformNumber
  229. @refresh="handleRefresh"
  230. />
  231. </div>
  232. </template>
  233. <style scoped>
  234. .artistic-text-container {
  235. height: 120px; /* 高度与要求一致 */
  236. width: 120px; /* 宽度与要求一致 */
  237. display: flex;
  238. align-items: center; /* 垂直居中 */
  239. justify-content: center; /* 水平居中 */
  240. background-color: #f5f5f5; /* 背景色 */
  241. border-radius: 12px; /* 圆角 */
  242. overflow: hidden; /* 隐藏溢出部分 */
  243. position: relative; /* 为绝对定位提供参考 */
  244. }
  245. .artistic-text {
  246. font-size: 1rem; /* 初始字体大小 */
  247. font-weight: bold; /* 加粗字体 */
  248. text-align: center; /* 居中对齐 */
  249. background: linear-gradient(90deg, #c86fc9, #3023ae);
  250. -webkit-background-clip: text; /* 背景裁剪 */
  251. -webkit-text-fill-color: transparent; /* 字体颜色透明 */
  252. white-space: nowrap; /* 防止换行 */
  253. overflow: hidden; /* 隐藏溢出部分 */
  254. text-overflow: ellipsis; /* 溢出部分用省略号表示 */
  255. transform: scale(1); /* 默认缩放为 1 */
  256. transition: transform 0.2s ease; /* 动画过渡效果 */
  257. max-width: 100%; /* 最大宽度为 100% */
  258. }
  259. /* 当文本溢出时,缩小文本以适应容器 */
  260. .artistic-text-container:has(.artistic-text) {
  261. /* 计算并缩放文本 */
  262. animation: scale-text 0.2s forwards;
  263. }
  264. /* @keyframes scale-text {
  265. 0% {
  266. transform: scale(1);
  267. }
  268. 100% {
  269. transform: scale(calc(120px / var(--text-width))); !* 根据文本宽度缩放 *!
  270. }
  271. } */
  272. </style>