detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  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: 1px solid #bc1724;
  258. border-radius: 4px;
  259. background-color: #ffe6e8;
  260. font-size: 16px;
  261. color: #bc1724;
  262. cursor: pointer;
  263. &::after {
  264. content: '';
  265. display: block;
  266. width: 16px;
  267. height: 16px;
  268. background: url(https://static.caimei365.com/www/authentic/pc/icon-arround-right.png)
  269. no-repeat center;
  270. background-size: 16px;
  271. }
  272. }
  273. .distance {
  274. font-size: 14px;
  275. color: #404040;
  276. }
  277. }
  278. .device-list {
  279. .title {
  280. padding: 16px;
  281. font-size: 20px;
  282. font-weight: bold;
  283. color: #404040;
  284. background-color: #f3f5f6;
  285. }
  286. .list {
  287. padding-right: 16px;
  288. }
  289. .device {
  290. padding: 16px 0;
  291. border-bottom: 1px solid #d8d8d8;
  292. .info {
  293. .name {
  294. font-size: 18px;
  295. color: #101010;
  296. }
  297. .code {
  298. margin-top: 16px;
  299. font-size: 14px;
  300. color: #666;
  301. }
  302. }
  303. .detail {
  304. display: flex;
  305. justify-content: center;
  306. align-items: center;
  307. width: 80px;
  308. height: 32px;
  309. background: #bc1724;
  310. border-radius: 4px;
  311. font-size: 14px;
  312. color: #ffffff;
  313. }
  314. }
  315. }
  316. }
  317. }
  318. // 移动 端
  319. @media screen and (max-width: 768px) {
  320. .page-title {
  321. display: none;
  322. }
  323. .page-top {
  324. .swiper {
  325. height: 100vw;
  326. background: #f7f7f7;
  327. ::v-deep {
  328. img {
  329. height: 100vw;
  330. }
  331. }
  332. }
  333. }
  334. .page-content {
  335. .divider {
  336. height: 3.2vw;
  337. background-color: #f7f7f7;
  338. }
  339. .club-info {
  340. padding: 4vw;
  341. background: linear-gradient(
  342. 180deg,
  343. #ffe6e8 0%,
  344. rgba(255, 255, 255, 0) 100%
  345. );
  346. .info {
  347. width: 67vw;
  348. .name {
  349. font-size: 4.8vw;
  350. color: #101010;
  351. font-weight: bold;
  352. margin-bottom: 4vw;
  353. }
  354. .mobile,
  355. .address {
  356. position: relative;
  357. padding-left: 5vw;
  358. margin-top: 1.6vw;
  359. line-height: 5vw;
  360. font-size: 3.2vw;
  361. color: #404040;
  362. &::after {
  363. content: '';
  364. display: block;
  365. width: 4vw;
  366. height: 4vw;
  367. position: absolute;
  368. left: 0;
  369. top: 0.5vw;
  370. background-size: 4vw 4vw;
  371. background-repeat: no-repeat;
  372. }
  373. }
  374. .mobile {
  375. &::after {
  376. background-image: url(https://static.caimei365.com/www/authentic/h5/icon-phone-active.png);
  377. }
  378. }
  379. .address {
  380. &::after {
  381. background-image: url(https://static.caimei365.com/www/authentic/h5/icon-address-active.png);
  382. }
  383. }
  384. }
  385. .logo {
  386. position: relative;
  387. width: 18vw;
  388. height: 18vw;
  389. border-radius: 9vw 9vw 0 9vw;
  390. overflow: hidden;
  391. &::after {
  392. position: absolute;
  393. bottom: 0;
  394. right: 0;
  395. content: '';
  396. display: block;
  397. width: 3.6vw;
  398. height: 3.6vw;
  399. background: url(https://static.caimei365.com/www/authentic/h5/icon-avatar-v.png)
  400. no-repeat center;
  401. background-size: 3.6vw;
  402. }
  403. }
  404. .navigation {
  405. display: flex;
  406. justify-content: center;
  407. align-items: center;
  408. width: 14.4vw;
  409. height: 6.4vw;
  410. border: 0.1vw solid #bc1724;
  411. border-radius: 0.4vw;
  412. background-color: #ffe6e8;
  413. font-size: 3.2vw;
  414. color: #bc1724;
  415. &::after {
  416. content: '';
  417. display: block;
  418. width: 3.6vw;
  419. height: 3.6vw;
  420. background: url(https://static.caimei365.com/www/authentic/h5/icon-arround-right.png)
  421. no-repeat center;
  422. background-size: 3.6vw;
  423. }
  424. }
  425. .distance {
  426. font-size: 3vw;
  427. color: #404040;
  428. }
  429. }
  430. .device-list {
  431. .title {
  432. padding: 4vw;
  433. padding-bottom: 0;
  434. font-size: 4vw;
  435. font-weight: bold;
  436. color: #101010;
  437. }
  438. .device {
  439. padding: 4vw 0;
  440. margin: 0 4vw;
  441. border-bottom: 0.4vw solid #d8d8d8;
  442. .info {
  443. .name {
  444. font-size: 3.6vw;
  445. color: #101010;
  446. }
  447. .code {
  448. margin-top: 3.2vw;
  449. font-size: 3vw;
  450. color: #666;
  451. }
  452. }
  453. .detail {
  454. display: flex;
  455. justify-content: center;
  456. align-items: center;
  457. width: 15.8vw;
  458. height: 6.4vw;
  459. background: #bc1724;
  460. border-radius: 0.4vw;
  461. font-size: 3vw;
  462. color: #ffffff;
  463. }
  464. }
  465. }
  466. }
  467. }
  468. </style>