detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  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. background: linear-gradient(
  189. 180deg,
  190. #ffe6e8 0%,
  191. rgba(255, 255, 255, 0) 100%
  192. );
  193. .info {
  194. width: 320px;
  195. .name {
  196. font-size: 24px;
  197. color: #101010;
  198. font-weight: bold;
  199. margin-bottom: 34px;
  200. }
  201. .mobile,
  202. .address {
  203. position: relative;
  204. padding-left: 24px;
  205. margin-top: 16px;
  206. line-height: 24px;
  207. font-size: 16px;
  208. color: #404040;
  209. &::after {
  210. content: '';
  211. display: block;
  212. width: 16px;
  213. height: 16px;
  214. position: absolute;
  215. left: 0;
  216. top: 4px;
  217. background-size: 16px;
  218. background-repeat: no-repeat;
  219. }
  220. }
  221. .mobile {
  222. &::after {
  223. background-image: url(https://static.caimei365.com/www/authentic/pc/icon-phone-active.png);
  224. }
  225. }
  226. .address {
  227. &::after {
  228. background-image: url(https://static.caimei365.com/www/authentic/pc/icon-address-active.png);
  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(https://static.caimei365.com/www/authentic/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. background-color: #ffe6e8;
  259. font-size: 16px;
  260. @include themify($themes) {
  261. color: themed('color');
  262. border: 1px solid themed('color');
  263. }
  264. cursor: pointer;
  265. &::after {
  266. content: '';
  267. display: block;
  268. width: 16px;
  269. height: 16px;
  270. background: url(https://static.caimei365.com/www/authentic/pc/icon-arround-right.png)
  271. no-repeat center;
  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. background: linear-gradient(
  346. 180deg,
  347. #ffe6e8 0%,
  348. rgba(255, 255, 255, 0) 100%
  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. background-image: url(https://static.caimei365.com/www/authentic/h5/icon-phone-active.png);
  381. }
  382. }
  383. .address {
  384. &::after {
  385. background-image: url(https://static.caimei365.com/www/authentic/h5/icon-address-active.png);
  386. }
  387. }
  388. }
  389. .logo {
  390. position: relative;
  391. width: 18vw;
  392. height: 18vw;
  393. border-radius: 9vw 9vw 0 9vw;
  394. overflow: hidden;
  395. &::after {
  396. position: absolute;
  397. bottom: 0;
  398. right: 0;
  399. content: '';
  400. display: block;
  401. width: 3.6vw;
  402. height: 3.6vw;
  403. background: url(https://static.caimei365.com/www/authentic/h5/icon-avatar-v.png)
  404. no-repeat center;
  405. background-size: 3.6vw;
  406. }
  407. }
  408. .navigation {
  409. display: flex;
  410. justify-content: center;
  411. align-items: center;
  412. width: 14.4vw;
  413. height: 6.4vw;
  414. border-radius: 0.4vw;
  415. background-color: #ffe6e8;
  416. font-size: 3.2vw;
  417. @include themify($themes) {
  418. color: themed('color');
  419. border: 1px solid themed('color');
  420. }
  421. &::after {
  422. content: '';
  423. display: block;
  424. width: 3.6vw;
  425. height: 3.6vw;
  426. background: url(https://static.caimei365.com/www/authentic/h5/icon-arround-right.png)
  427. no-repeat center;
  428. background-size: 3.6vw;
  429. }
  430. }
  431. .distance {
  432. font-size: 3vw;
  433. color: #404040;
  434. }
  435. }
  436. .device-list {
  437. .title {
  438. padding: 4vw;
  439. padding-bottom: 0;
  440. font-size: 4vw;
  441. font-weight: bold;
  442. color: #101010;
  443. }
  444. .device {
  445. padding: 4vw 0;
  446. margin: 0 4vw;
  447. border-bottom: 0.4vw solid #d8d8d8;
  448. .info {
  449. .name {
  450. font-size: 3.6vw;
  451. color: #101010;
  452. }
  453. .code {
  454. margin-top: 3.2vw;
  455. font-size: 3vw;
  456. color: #666;
  457. }
  458. }
  459. .detail {
  460. display: flex;
  461. justify-content: center;
  462. align-items: center;
  463. width: 15.8vw;
  464. height: 6.4vw;
  465. border-radius: 0.4vw;
  466. font-size: 3vw;
  467. color: #ffffff;
  468. @include themify($themes) {
  469. background: themed('color');
  470. }
  471. }
  472. }
  473. }
  474. }
  475. }
  476. </style>