detail.vue 11 KB

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