CompanyDetail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <script lang="ts" setup>
  2. /**
  3. * @Name: CompanyDetail.vue
  4. * @Description: 公司详情
  5. * @Author: Cheney
  6. */
  7. import { Edit, Link, Picture as IconPicture } from '@element-plus/icons-vue';
  8. import { companyColumns } from '../useColumns';
  9. import { usePagination } from '/@/utils/usePagination';
  10. import { useTableData } from '/@/utils/useTableData';
  11. import * as api from '../api';
  12. import router from '/@/router';
  13. import { useResponse } from '/@/utils/useResponse';
  14. import EditDrawer from '../components/EditDrawer.vue';
  15. import { getFilterOptions } from '/@/views/shop-information/api'
  16. import {hasPermission} from "/@/utils/hasPermission";
  17. const route = useRoute();
  18. const companyId = route.query.id;
  19. const companyOverview: any = ref([]);
  20. const overviewLoading = ref();
  21. const { tableOptions, handlePageChange } = usePagination(fetchCompanyDetail);
  22. const platformTableData = ref([]);
  23. const gridOptions: any = reactive({
  24. border: false,
  25. round: true,
  26. stripe: true,
  27. currentRowHighLight: true,
  28. height: 680,
  29. toolbarConfig: {
  30. custom: true,
  31. slots: {
  32. buttons: 'toolbar_buttons',
  33. }
  34. },
  35. rowConfig: {
  36. isHover: true,
  37. },
  38. columnConfig: {
  39. resizable: true,
  40. },
  41. pagerConfig: {
  42. total: tableOptions.value.total,
  43. page: tableOptions.value.page,
  44. limit: tableOptions.value.limit,
  45. },
  46. loading: false,
  47. loadingConfig: {
  48. icon: 'vxe-icon-indicator roll',
  49. text: '正在拼命加载中...',
  50. },
  51. columns: companyColumns,
  52. data: platformTableData,
  53. });
  54. const isOpen = ref(false);
  55. const platformNumber = ref('');
  56. const platform = ref('');
  57. const country = ref('');
  58. const status = ref('');
  59. const countryOption = ref([]);
  60. const platformOption = ref([]);
  61. const statusOption = ref([
  62. {
  63. value: 1,
  64. label: '启用',
  65. },
  66. {
  67. value: 0,
  68. label: '暂停',
  69. },
  70. ]);
  71. onBeforeMount(() => {
  72. fetchCompanyOverview();
  73. fetchCompanyDetail();
  74. fetchFilterOptions();
  75. });
  76. async function fetchFilterOptions() {
  77. const res = await useResponse({}, getFilterOptions);
  78. countryOption.value = res.data.country;
  79. platformOption.value = res.data.platform;
  80. }
  81. async function fetchCompanyDetail() {
  82. const query = {
  83. id: companyId,
  84. platform: platform.value,
  85. status: status.value,
  86. country:country.value.toString(),
  87. platformNumber:platformNumber.value,
  88. page: gridOptions.pagerConfig.page,
  89. limit: gridOptions.pagerConfig.limit,
  90. };
  91. await useTableData(api.getTableData, query, gridOptions);
  92. }
  93. async function fetchCompanyOverview() {
  94. const res = await useResponse({ companyId }, api.getCompanyOverview, overviewLoading);
  95. companyOverview.value = res.data;
  96. }
  97. function handleNavigate(item: any) {
  98. router.push({
  99. path: '/shop/detail',
  100. query: { platformNumber: item.platformNumber },
  101. });
  102. }
  103. function drawerOpen() {
  104. isOpen.value = true;
  105. }
  106. function handleRefresh() {
  107. fetchCompanyOverview();
  108. }
  109. const contactGroups = computed(() => {
  110. const contacts = companyOverview.value?.companyPhoneEmail || [];
  111. if (!Array.isArray(contacts)) {
  112. console.error('companyPhoneEmail is not an array:', contacts);
  113. return [];
  114. }
  115. const groups = [];
  116. if (contacts.length > 0) {
  117. groups.push(contacts.slice(0, 2));
  118. }
  119. for (let i = 2; i < contacts.length; i += 3) {
  120. groups.push(contacts.slice(i, i + 3));
  121. }
  122. return groups;
  123. });
  124. function handleQuery() {
  125. gridOptions.pagerConfig.page = 1;
  126. fetchCompanyDetail()
  127. }
  128. </script>
  129. <template>
  130. <div class="p-2.5">
  131. <el-card v-loading="overviewLoading" body-class="flex items-center gap-10" shadow="hover" style="border: none; position: relative" >
  132. <el-image :src="`/src/assets/platformImg/${companyId}.png`" class="mr-7 rounded-2xl" fit="contain" style="height: 120px; width: 120px">
  133. <template #error>
  134. <div class="mr-3.5 flex items-center justify-center text-5xl" style="height: 100%; width: 100%; background-color: #f5f5f5">
  135. <el-icon>
  136. <icon-picture />
  137. </el-icon>
  138. </div>
  139. </template>
  140. </el-image>
  141. <div class="text-lg whitespace-nowrap">
  142. <div class="font-semibold relative">
  143. 公司名称:
  144. <span class="font-medium italic ml-1.5" style="color: #64748b">
  145. {{ companyOverview?.company ? companyOverview?.company : '--' }}
  146. </span>
  147. </div>
  148. <div class="font-semibold">
  149. 公司英文名:
  150. <span class="font-medium italic ml-1.5" style="color: #64748b">
  151. <el-tooltip effect="dark" :content="companyOverview?.companyEnglishName || '--'" placement="top">
  152. <span class="truncate">
  153. {{ companyOverview?.companyEnglishName ? companyOverview?.companyEnglishName : '--' }}
  154. </span>
  155. </el-tooltip>
  156. </span>
  157. </div>
  158. <div class="font-semibold">
  159. 公司注册地址:
  160. <span class="font-medium italic ml-1.5 truncate" style="color: #64748b">
  161. <el-tooltip effect="dark" :content="companyOverview?.address || '--'" placement="top">
  162. <span class="truncate">
  163. {{ companyOverview?.address ? companyOverview?.address : '--' }}
  164. </span>
  165. </el-tooltip>
  166. </span>
  167. </div>
  168. </div>
  169. <div class="text-lg whitespace-nowrap">
  170. <div class="font-semibold">
  171. 公司法人:
  172. <span class="font-medium italic ml-1.5" style="color: #64748b">
  173. {{ companyOverview?.juridicalPerson ? companyOverview?.juridicalPerson : '--' }}
  174. </span>
  175. </div>
  176. <div class="font-semibold">
  177. 法人信用卡号:
  178. <span class="font-medium italic ml-1.5" style="color: #64748b">
  179. {{ companyOverview?.juridicalPersonCreditCard ? companyOverview?.juridicalPersonCreditCard : '--' }}
  180. </span>
  181. </div>
  182. <div class="font-semibold">
  183. 法人信用卡地址:
  184. <span class="font-medium italic ml-1.5" style="color: #64748b">
  185. <el-tooltip effect="dark" :content="companyOverview?.juridicalPersonCreditCardAddress || '--'" placement="top">
  186. <span class="truncate">
  187. {{ companyOverview?.juridicalPersonCreditCardAddress ? companyOverview?.juridicalPersonCreditCardAddress : '--' }}
  188. </span>
  189. </el-tooltip>
  190. </span>
  191. </div>
  192. </div>
  193. <div class="text-lg whitespace-nowrap" >
  194. <div class="font-semibold">
  195. 主账号邮箱:
  196. <span class="font-medium italic ml-1.5" style="color: #64748b">
  197. {{ companyOverview?.shopEmail ? companyOverview.shopEmail : '--' }}
  198. </span>
  199. </div>
  200. <div class="font-semibold">
  201. 主账户电话:
  202. <span class="font-medium italic ml-1.5" style="color: #64748b">
  203. {{ companyOverview?.shopPhone ? companyOverview.shopPhone : '--' }}
  204. </span>
  205. </div>
  206. <div class="font-semibold">
  207. <el-button class="absolute" link style="right: 10px; top: 20px; transition: all 0.3s ease"
  208. type="warning" @click="drawerOpen"
  209. v-if="hasPermission('COMPANY_UPDATE')">
  210. <Edit style="width: 1.5em; height: 1.5em;"/>
  211. </el-button>
  212. IP地址:
  213. <span class="font-medium italic ml-1.5" style="color: #64748b">
  214. <el-tooltip effect="dark" :content="companyOverview?.ipaddress || '--'" placement="top">
  215. <span class="truncate">
  216. {{ companyOverview?.ipaddress ? companyOverview?.ipaddress : '--' }}
  217. </span>
  218. </el-tooltip>
  219. </span>
  220. </div>
  221. </div>
  222. <!-- <div v-if="contactGroups.length > 0" class="flex flex-wrap whitespace-nowrap">-->
  223. <!-- <div v-for="(group, groupIndex) in contactGroups" :key="groupIndex">-->
  224. <!-- <div class="text-lg font-semibold">-->
  225. <!-- <template v-if="groupIndex === 0"> 公司子账号联系方式: </template>-->
  226. <!-- <div v-for="(item, itemIndex) in group" :key="itemIndex" class="font-medium italic mr-3" style="color: #64748b">-->
  227. <!-- {{ item.phone }} - {{ item.email }}-->
  228. <!-- </div>-->
  229. <!-- </div>-->
  230. <!-- </div>-->
  231. <!-- </div>-->
  232. <!-- <div v-else class="text-lg font-semibold">暂无联系方式</div>-->
  233. </el-card>
  234. <EditDrawer
  235. v-if="isOpen"
  236. v-model="isOpen"
  237. :company="companyOverview.company"
  238. :companyOverview
  239. :formSelect
  240. @refresh="handleRefresh"
  241. />
  242. <el-card body-style="padding-top: 10px" class="mt-2.5" shadow="hover" style="border: none">
  243. <vxe-grid v-bind="gridOptions">
  244. <template #toolbar_buttons>
  245. <el-row :gutter="20" class="w-full whitespace-nowrap">
  246. <el-col :span="4">
  247. <div class="flex items-center gap-1.5">
  248. <span class="font-medium">平 台</span>
  249. <el-select v-model="platform" clearable @change="handleQuery">
  250. <el-option v-for="item in platformOption" :label="item" :value="item" />
  251. </el-select>
  252. </div>
  253. </el-col>
  254. <el-col :span="4">
  255. <div class="flex items-center gap-1.5">
  256. <span class="font-medium">店铺编号</span>
  257. <el-input v-model="platformNumber" clearable placeholder="请输入店铺编号" @change="handleQuery" />
  258. </div>
  259. </el-col>
  260. <el-col :span="4">
  261. <div class="flex items-center gap-1.5">
  262. <span class="font-medium">状 态</span>
  263. <el-select v-model="status" clearable @change="handleQuery">
  264. <el-option v-for="item in statusOption" :key="item.value" :label="item.label" :value="item.value" />
  265. </el-select>
  266. </div>
  267. </el-col>
  268. <el-col :span="4">
  269. <div class="flex items-center gap-1.5">
  270. <span class="font-medium">国 家</span>
  271. <el-select v-model="country" clearable collapse-tags collapse-tags-tooltip multiple
  272. @blur="handleQuery">
  273. <el-option v-for="item in countryOption" :label="item" :value="item" />
  274. </el-select>
  275. </div>
  276. </el-col>
  277. </el-row>
  278. </template>
  279. <template #platformNumber="{ row }">
  280. <el-button link style="font-weight: 700" type="primary" @click="handleNavigate(row)">
  281. <el-icon>
  282. <Link />
  283. </el-icon>
  284. {{ row.platformNumber ? row.platformNumber : '--' }}
  285. </el-button>
  286. </template>
  287. <template #pager>
  288. <vxe-pager
  289. v-model:currentPage="gridOptions.pagerConfig.page"
  290. v-model:pageSize="gridOptions.pagerConfig.limit"
  291. :total="gridOptions.pagerConfig.total"
  292. @page-change="handlePageChange"
  293. >
  294. </vxe-pager>
  295. </template>
  296. </vxe-grid>
  297. </el-card>
  298. </div>
  299. </template>
  300. <style scoped>
  301. .truncate {
  302. display: inline-block;
  303. white-space: nowrap;
  304. overflow: hidden;
  305. text-overflow: ellipsis;
  306. max-width: 250px; /* 添加固定宽度 */
  307. vertical-align: middle; /* 添加垂直对齐 */
  308. }
  309. </style>