detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. <template>
  2. <div class="page md:flex md:justify-between">
  3. <div class="page-title">机构认证</div>
  4. <div class="page-top">
  5. <div class="swiper">
  6. <SimpleSwiper :imageList="clubInfo.bannerList"></SimpleSwiper>
  7. </div>
  8. </div>
  9. <div class="page-content">
  10. <div class="club-info">
  11. <div class="section flex justify-between items-center">
  12. <div class="info">
  13. <div class="name" v-text="clubInfo.authParty"></div>
  14. <div class="mobile">{{ clubInfo.mobile | formatEmpty }}</div>
  15. <div class="address" v-text="address"></div>
  16. </div>
  17. <div class="logo"><img :src="clubInfo.logo" /></div>
  18. </div>
  19. <div class="section flex justify-between items-center mt-6">
  20. <div class="navigation" @click="onMapNav">导航</div>
  21. <div
  22. class="distance"
  23. v-if="clubInfo.distance && clubInfo.distance < 99999"
  24. v-text="'距你' + clubInfo.distance + 'km'"
  25. ></div>
  26. </div>
  27. </div>
  28. <div class="divider"></div>
  29. <div class="device-list">
  30. <div class="title">已认证设备</div>
  31. <div class="list">
  32. <div
  33. class="device flex justify-between items-center"
  34. v-for="item in clubInfo.productList"
  35. :key="item.productId"
  36. >
  37. <div class="info">
  38. <div class="name" v-text="item.productName"></div>
  39. <div class="code">SN码:{{ item.snCode | formatSnCode }}</div>
  40. </div>
  41. <div class="detail" @click="toDetail(item)">查看认证</div>
  42. </div>
  43. </div>
  44. </div>
  45. <SimpleEmpty
  46. v-if="isEmpty"
  47. name="icon-empty-device.png"
  48. description="暂无已认证设备"
  49. ></SimpleEmpty>
  50. </div>
  51. <SimpleMapNav ref="mapNav" @click="navigation"></SimpleMapNav>
  52. </div>
  53. </template>
  54. <script>
  55. import { drawLogo } from '@/utils'
  56. import { mapNavigate } from '@/utils/map-utils'
  57. import { mapGetters } from 'vuex'
  58. export default {
  59. layout: 'app',
  60. filters: {
  61. formatEmpty(val) {
  62. return val || '暂无'
  63. },
  64. formatSnCode(code) {
  65. if (!code) return ''
  66. return code.replace(/^(\w{2})\w+(\w{4})$/, '$1******$2')
  67. },
  68. },
  69. data() {
  70. return {
  71. authId: '',
  72. clubInfo: {},
  73. }
  74. },
  75. computed: {
  76. ...mapGetters(['routePrefix']),
  77. address() {
  78. let resultAddress = this.clubInfo.area
  79. ? this.clubInfo.area + this.clubInfo.address
  80. : this.clubInfo.address
  81. return resultAddress || '暂无'
  82. },
  83. isEmpty() {
  84. return this.clubInfo.productList
  85. ? this.clubInfo.productList.length === 0
  86. : true
  87. },
  88. },
  89. mounted() {
  90. this.initData()
  91. },
  92. beforeDestroy() {
  93. this.$removeStorage(this.routePrefix, 'clubInfo')
  94. },
  95. methods: {
  96. // 设备详情
  97. toDetail(item) {
  98. window.location.href = `${process.env.CIMEI_LOCAL}/product/auth/product-${item.productId}.html`
  99. },
  100. // 初始化
  101. initData() {
  102. this.authId = parseInt(this.$route.query.id)
  103. const clubInfo = this.$getStorage(this.routePrefix, 'clubInfo')
  104. if (clubInfo) {
  105. this.clubInfo = clubInfo
  106. }
  107. this.fetchDetail()
  108. },
  109. // 获取机构详细信息
  110. async fetchDetail() {
  111. try {
  112. const res = await this.$http.api.getAuthClubDetail({
  113. authId: this.authId,
  114. })
  115. this.clubInfo = { ...this.clubInfo, ...res.data } // 合并
  116. } catch (error) {
  117. console.log(error)
  118. }
  119. // 默认轮播图
  120. if (this.clubInfo.bannerList.length <= 0) {
  121. this.clubInfo.bannerList.push('/placeholder.png')
  122. }
  123. // 默认logo
  124. if (!this.clubInfo.logo) {
  125. this.clubInfo.logo = drawLogo(this.clubInfo.authParty)
  126. }
  127. },
  128. // 地图导航
  129. onMapNav() {
  130. this.$refs.mapNav.open()
  131. },
  132. // 导航
  133. navigation(type) {
  134. const point = this.clubInfo.lngAndLat.split(',')
  135. const lng = point[0]
  136. const lat = point[1]
  137. mapNavigate(
  138. { lat, lng, title: this.clubInfo.authParty, address: this.address },
  139. type
  140. )
  141. this.$refs.mapNav.close()
  142. },
  143. },
  144. }
  145. </script>
  146. <style scoped lang="scss">
  147. // pc 端
  148. @media screen and (min-width: 768px) {
  149. .page {
  150. position: relative;
  151. width: 1200px;
  152. height: 612px;
  153. margin-left: auto;
  154. margin-right: auto;
  155. margin-top: 80px;
  156. background-color: #fff;
  157. box-sizing: border-box;
  158. padding: 16px;
  159. padding-right: 0;
  160. }
  161. .page-title {
  162. position: absolute;
  163. font-size: 24px;
  164. color: #333;
  165. top: -50px;
  166. left: 0;
  167. }
  168. .page-top {
  169. .swiper {
  170. width: 580px;
  171. height: 580px;
  172. background: #f7f7f7;
  173. ::v-deep {
  174. img {
  175. width: 580px;
  176. height: 580px;
  177. }
  178. }
  179. }
  180. }
  181. .page-content {
  182. width: 580px;
  183. overflow-y: auto;
  184. .club-info {
  185. padding: 32px 24px;
  186. @include themify($themes) {
  187. background: themed('cover-color');
  188. }
  189. .info {
  190. width: 320px;
  191. .name {
  192. font-size: 24px;
  193. color: #101010;
  194. font-weight: bold;
  195. margin-bottom: 34px;
  196. }
  197. .mobile,
  198. .address {
  199. position: relative;
  200. padding-left: 24px;
  201. margin-top: 16px;
  202. line-height: 24px;
  203. font-size: 16px;
  204. color: #404040;
  205. &::after {
  206. content: '';
  207. display: block;
  208. width: 16px;
  209. height: 16px;
  210. position: absolute;
  211. left: 0;
  212. top: 4px;
  213. background-size: 16px;
  214. background-repeat: no-repeat;
  215. }
  216. }
  217. .mobile {
  218. &::after {
  219. @include themify($themes) {
  220. background-image: themed('pc-icon-mobile');
  221. }
  222. }
  223. }
  224. .address {
  225. &::after {
  226. @include themify($themes) {
  227. background-image: themed('h5-icon-address');
  228. }
  229. }
  230. }
  231. }
  232. .logo {
  233. position: relative;
  234. width: 114px;
  235. height: 114px;
  236. border-radius: 50% 50% 0 50%;
  237. overflow: hidden;
  238. &::after {
  239. position: absolute;
  240. bottom: 0;
  241. right: 0;
  242. content: '';
  243. display: block;
  244. width: 23px;
  245. height: 23px;
  246. background: url(~assets/theme-images/common/pc-icon-avatar-v.png)
  247. no-repeat center;
  248. background-size: 23px;
  249. }
  250. }
  251. .navigation {
  252. display: flex;
  253. justify-content: center;
  254. align-items: center;
  255. width: 72px;
  256. height: 32px;
  257. border-radius: 4px;
  258. font-size: 16px;
  259. @include themify($themes) {
  260. color: themed('color');
  261. border: 1px solid themed('color');
  262. background-color: themed('sub-color');
  263. }
  264. cursor: pointer;
  265. &::after {
  266. content: '';
  267. display: block;
  268. width: 16px;
  269. height: 16px;
  270. margin-left: 4px;
  271. @include themify($themes) {
  272. background: themed('pc-icon-navigation') no-repeat center;
  273. }
  274. background-size: 16px;
  275. }
  276. }
  277. .distance {
  278. font-size: 14px;
  279. color: #404040;
  280. }
  281. }
  282. .device-list {
  283. .title {
  284. padding: 16px;
  285. font-size: 20px;
  286. font-weight: bold;
  287. color: #404040;
  288. background-color: #f3f5f6;
  289. }
  290. .list {
  291. padding-right: 16px;
  292. }
  293. .device {
  294. padding: 16px 0;
  295. border-bottom: 1px solid #d8d8d8;
  296. .info {
  297. .name {
  298. font-size: 18px;
  299. color: #101010;
  300. }
  301. .code {
  302. margin-top: 16px;
  303. font-size: 14px;
  304. color: #666;
  305. }
  306. }
  307. .detail {
  308. display: flex;
  309. justify-content: center;
  310. align-items: center;
  311. width: 80px;
  312. height: 32px;
  313. border-radius: 4px;
  314. font-size: 14px;
  315. color: #ffffff;
  316. @include themify($themes) {
  317. background: themed('color');
  318. }
  319. }
  320. }
  321. }
  322. }
  323. }
  324. // 移动 端
  325. @media screen and (max-width: 768px) {
  326. .page-title {
  327. display: none;
  328. }
  329. .page-top {
  330. .swiper {
  331. height: 100vw;
  332. background: #f7f7f7;
  333. ::v-deep {
  334. img {
  335. height: 100vw;
  336. }
  337. }
  338. }
  339. }
  340. .page-content {
  341. .divider {
  342. height: 3.2vw;
  343. background-color: #f7f7f7;
  344. }
  345. .club-info {
  346. padding: 4vw;
  347. @include themify($themes) {
  348. background: themed('cover-color');
  349. }
  350. .info {
  351. width: 67vw;
  352. .name {
  353. font-size: 4.8vw;
  354. color: #101010;
  355. font-weight: bold;
  356. margin-bottom: 4vw;
  357. }
  358. .mobile,
  359. .address {
  360. position: relative;
  361. padding-left: 5vw;
  362. margin-top: 1.6vw;
  363. line-height: 5vw;
  364. font-size: 3.2vw;
  365. color: #404040;
  366. &::after {
  367. content: '';
  368. display: block;
  369. width: 4vw;
  370. height: 4vw;
  371. position: absolute;
  372. left: 0;
  373. top: 0.5vw;
  374. background-size: 4vw 4vw;
  375. background-repeat: no-repeat;
  376. }
  377. }
  378. .mobile {
  379. &::after {
  380. @include themify($themes) {
  381. background-image: themed('h5-icon-mobile');
  382. }
  383. }
  384. }
  385. .address {
  386. &::after {
  387. @include themify($themes) {
  388. background-image: themed('h5-icon-address');
  389. }
  390. }
  391. }
  392. }
  393. .logo {
  394. position: relative;
  395. width: 18vw;
  396. height: 18vw;
  397. border-radius: 9vw 9vw 0 9vw;
  398. overflow: hidden;
  399. &::after {
  400. position: absolute;
  401. bottom: 0;
  402. right: 0;
  403. content: '';
  404. display: block;
  405. width: 3.6vw;
  406. height: 3.6vw;
  407. background: url(~assets/theme-images/common/h5-icon-avatar-v.png)
  408. no-repeat center;
  409. background-size: 3.6vw;
  410. }
  411. }
  412. .navigation {
  413. display: flex;
  414. justify-content: center;
  415. align-items: center;
  416. width: 14.4vw;
  417. height: 6.4vw;
  418. border-radius: 0.4vw;
  419. font-size: 3.2vw;
  420. @include themify($themes) {
  421. color: themed('color');
  422. border: 1px solid themed('color');
  423. background-color: themed('sub-color');
  424. }
  425. &::after {
  426. content: '';
  427. display: block;
  428. width: 3.6vw;
  429. height: 3.6vw;
  430. margin-left: 0.4vw;
  431. @include themify($themes) {
  432. background: themed('h5-icon-navigation') no-repeat center;
  433. }
  434. background-size: 3.6vw;
  435. }
  436. }
  437. .distance {
  438. font-size: 3vw;
  439. color: #404040;
  440. }
  441. }
  442. .device-list {
  443. .title {
  444. padding: 4vw;
  445. padding-bottom: 0;
  446. font-size: 4vw;
  447. font-weight: bold;
  448. color: #101010;
  449. }
  450. .device {
  451. padding: 4vw 0;
  452. margin: 0 4vw;
  453. border-bottom: 0.4vw solid #d8d8d8;
  454. .info {
  455. .name {
  456. font-size: 3.6vw;
  457. color: #101010;
  458. }
  459. .code {
  460. margin-top: 3.2vw;
  461. font-size: 3vw;
  462. color: #666;
  463. }
  464. }
  465. .detail {
  466. display: flex;
  467. justify-content: center;
  468. align-items: center;
  469. width: 15.8vw;
  470. height: 6.4vw;
  471. border-radius: 0.4vw;
  472. font-size: 3vw;
  473. color: #ffffff;
  474. @include themify($themes) {
  475. background: themed('color');
  476. }
  477. }
  478. }
  479. }
  480. }
  481. }
  482. </style>