detail.vue 12 KB

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