detail.vue 13 KB

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