ShopDetail.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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, companySelect } 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. // const companySelect = ref<{ id: string, company: string }>({
  58. // id: '',
  59. // company: ''
  60. // });
  61. onBeforeMount(() => {
  62. fetchShopDetailOverview();
  63. handleTabChange(selectedTab.value);
  64. fetchSelect();
  65. });
  66. async function fetchSelect() {
  67. const res = await useResponse({}, api.getShopSelect);
  68. formSelect.value = res.data;
  69. // const ret = await useResponse({}, api.getCompanySelect);
  70. // companySelect.value = ret.data;
  71. }
  72. async function fetchShopDetailOverview() {
  73. const res = await useResponse({ platformNumber }, api.getShopDetailOverview, overviewLoading);
  74. shopOverview.value = res.data;
  75. }
  76. async function handleTabChange(tabValue: any) {
  77. gridOptions.pagerConfig.page = 1;
  78. gridOptions.pagerConfig.limit = 10;
  79. const query = {
  80. platformNumber,
  81. page: gridOptions.pagerConfig.page,
  82. limit: gridOptions.pagerConfig.limit
  83. };
  84. switch (tabValue) {
  85. case '1':
  86. gridOptions.columns = shopCurrentColumns;
  87. await useTableData(api.getCurrentInfo, query, gridOptions);
  88. break;
  89. case '2':
  90. gridOptions.columns = historyColumns;
  91. await useTableData(api.getHistoryInfo, query, gridOptions);
  92. break;
  93. case '3':
  94. gridOptions.columns = computerColumns;
  95. await useTableData(api.getComputerInfo, query, gridOptions);
  96. break;
  97. }
  98. }
  99. function drawerOpen() {
  100. isOpen.value = true;
  101. }
  102. function handleRefresh() {
  103. handleTabChange(selectedTab.value);
  104. }
  105. </script>
  106. <template>
  107. <div class="p-2.5">
  108. <el-card v-loading="overviewLoading" body-class="flex items-center gap-10" shadow="hover" style="border: none">
  109. <div v-if="platformNumber" class="artistic-text-container mr-7 ">
  110. <div class="artistic-text">
  111. {{ platformNumber }}
  112. </div>
  113. </div>
  114. <el-image v-else class="mr-7 rounded-2xl" src="" style="height: 120px; width: 120px; object-fit: contain">
  115. <template #error>
  116. <div class="mr-3.5 flex items-center justify-center text-5xl"
  117. style="height: 100%; width: 100%; background-color: #f5f5f5">
  118. <el-icon>
  119. <icon-picture/>
  120. </el-icon>
  121. </div>
  122. </template>
  123. </el-image>
  124. <div class="text-lg">
  125. <div class="font-semibold">
  126. 平台编号:
  127. <span class="font-medium italic ml-1.5" style="color: #64748b">
  128. {{ shopOverview[0]?.platformNumber ? shopOverview[0]?.platformNumber : '--' }}
  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]?.company ? shopOverview[0]?.company : '--' }}
  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]?.platform ? shopOverview[0]?.platform : '--' }}
  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]?.operatorName ? shopOverview[0]?.operatorName : '--' }}
  147. </span>
  148. </div>
  149. <div class="font-semibold">
  150. 电脑:
  151. <span class="font-medium italic ml-1.5" style="color: #64748b">
  152. {{ shopOverview[0]?.countComputer === 0 ? '0' : shopOverview[0]?.countComputer || '--' }}
  153. </span>
  154. </div>
  155. </div>
  156. <div class="text-lg">
  157. <div class="font-semibold">
  158. 主账户手机号及归属人:
  159. <span class="font-medium italic ml-1.5" style="color: #64748b">
  160. {{ shopOverview[0]?.shopPhoneAndNameStr ? shopOverview[0]?.shopPhoneAndNameStr : '--' }}
  161. </span>
  162. </div>
  163. <div class="font-semibold">
  164. 主账户Email:
  165. <span class="font-medium italic ml-1.5" style="color: #64748b">
  166. {{ shopOverview[0]?.shopEmail ? shopOverview[0]?.shopEmail : '--' }}
  167. </span>
  168. </div>
  169. <div class="font-semibold">
  170. 子账户手机号及归属人:
  171. <span class="font-medium italic ml-1.5" style="color: #64748b">
  172. {{ shopOverview[0]?.subShopPhoneAndNameStr ? shopOverview[0]?.subShopPhoneAndNameStr : '--' }}
  173. </span>
  174. </div>
  175. <div class="font-semibold">
  176. 子账户Email:
  177. <span class="font-medium italic ml-1.5" style="color: #64748b">
  178. {{ shopOverview[0]?.subShopEmail ? shopOverview[0]?.subShopEmail : '--' }}
  179. </span>
  180. </div>
  181. </div>
  182. </el-card>
  183. <el-card body-style="padding-top: 10px" class="mt-2.5" shadow="hover" style="border: none">
  184. <vxe-grid v-bind="gridOptions">
  185. <template #toolbar_buttons>
  186. <el-radio-group v-model="selectedTab" @change="handleTabChange(selectedTab)">
  187. <el-radio-button label="当前信息" value="1">
  188. <template #default>
  189. <el-icon style="top: 2px;">
  190. <Timer/>
  191. </el-icon>
  192. 当前信息
  193. </template>
  194. </el-radio-button>
  195. <el-radio-button label="历史记录" value="2">
  196. <template #default>
  197. <el-icon style="top: 2px;">
  198. <RefreshLeft/>
  199. </el-icon>
  200. 历史记录
  201. </template>
  202. </el-radio-button>
  203. <el-radio-button label="电脑信息" value="3">
  204. <template #default>
  205. <el-icon style="top: 2px;">
  206. <Monitor/>
  207. </el-icon>
  208. 电脑信息
  209. </template>
  210. </el-radio-button>
  211. </el-radio-group>
  212. </template>
  213. <template #toolbar_tools>
  214. <div class="mr-2.5">
  215. <el-button :icon="Edit" plain circle type="warning" @click="drawerOpen" :disabled="selectedTab != '1'"></el-button>
  216. </div>
  217. </template>
  218. <template #pager>
  219. <vxe-pager
  220. v-model:currentPage="gridOptions.pagerConfig.page"
  221. v-model:pageSize="gridOptions.pagerConfig.limit"
  222. :total="gridOptions.pagerConfig.total"
  223. @page-change="handlePageChange"
  224. >
  225. </vxe-pager>
  226. </template>
  227. </vxe-grid>
  228. </el-card>
  229. <EditDrawer
  230. v-if="isOpen"
  231. v-model="isOpen"
  232. :formSelect
  233. :companySelect
  234. :gridOptions="gridOptions"
  235. :platformNumber
  236. @refresh="handleRefresh"
  237. />
  238. </div>
  239. </template>
  240. <style scoped>
  241. .artistic-text-container {
  242. height: 120px; /* 高度与要求一致 */
  243. width: 120px; /* 宽度与要求一致 */
  244. display: flex;
  245. align-items: center; /* 垂直居中 */
  246. justify-content: center; /* 水平居中 */
  247. background-color: #f5f5f5; /* 背景色 */
  248. border-radius: 12px; /* 圆角 */
  249. overflow: hidden; /* 隐藏溢出部分 */
  250. position: relative; /* 为绝对定位提供参考 */
  251. }
  252. .artistic-text {
  253. font-size: 1rem; /* 初始字体大小 */
  254. font-weight: bold; /* 加粗字体 */
  255. text-align: center; /* 居中对齐 */
  256. background: linear-gradient(90deg, #c86fc9, #3023ae);
  257. -webkit-background-clip: text; /* 背景裁剪 */
  258. -webkit-text-fill-color: transparent; /* 字体颜色透明 */
  259. white-space: nowrap; /* 防止换行 */
  260. overflow: hidden; /* 隐藏溢出部分 */
  261. text-overflow: ellipsis; /* 溢出部分用省略号表示 */
  262. transform: scale(1); /* 默认缩放为 1 */
  263. transition: transform 0.2s ease; /* 动画过渡效果 */
  264. max-width: 100%; /* 最大宽度为 100% */
  265. }
  266. /* 当文本溢出时,缩小文本以适应容器 */
  267. .artistic-text-container:has(.artistic-text) {
  268. /* 计算并缩放文本 */
  269. animation: scale-text 0.2s forwards;
  270. }
  271. /* @keyframes scale-text {
  272. 0% {
  273. transform: scale(1);
  274. }
  275. 100% {
  276. transform: scale(calc(120px / var(--text-width))); !* 根据文本宽度缩放 *!
  277. }
  278. } */
  279. </style>