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