_id.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <div class="page">
  3. <div class="page-top flex flex-col justify-center items-center">
  4. <img class="logo" src="https://picsum.photos/200/200" />
  5. <span class="name mt-2">上海品辉医疗科技有限公司</span>
  6. </div>
  7. <div class="page-content">
  8. <!-- 搜索区域 -->
  9. <div class="search">
  10. <SimpleSearch v-model="listQuery.snCode" @search="onSearch" />
  11. </div>
  12. <!-- 标题 -->
  13. <div class="title px-4 pt-12 pb-6 md:px-0">
  14. 共<span v-text="total"></span>台设备
  15. </div>
  16. <!-- 列表 -->
  17. <div class="list">
  18. <div
  19. class="section flex justify-between mb-4"
  20. v-for="item in list"
  21. :key="item.productId"
  22. @click="toDetail(item)"
  23. >
  24. <img class="cover" :src="item.productImage" />
  25. <div class="info">
  26. <div class="name" v-text="item.productName"></div>
  27. <div class="code">SN码:{{ item.snCode }}</div>
  28. <div class="club-name">
  29. 所属机构:<span @click="toClubDetail(item)">{{
  30. item.clubName
  31. }}</span>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="empty" v-for="i in emptyList" :key="i"></div>
  36. </div>
  37. <!-- 列表为空 -->
  38. <SimpleEmpty
  39. v-if="!total && !isRequest"
  40. description="敬请期待~"
  41. ></SimpleEmpty>
  42. <!-- 页码 -->
  43. <SimplePagination
  44. v-if="total > listQuery.pageSize"
  45. :total="total"
  46. :pageItems="listQuery.pageSize"
  47. @change="onPagiantionChange"
  48. ></SimplePagination>
  49. </div>
  50. </div>
  51. </template>
  52. <script>
  53. export default {
  54. layout: 'app',
  55. data() {
  56. return {
  57. isRequest: false,
  58. listQuery: {
  59. productTypeId: '',
  60. snCode: '',
  61. pageNum: 1,
  62. pageSize: 10,
  63. },
  64. list: [],
  65. total: 0,
  66. }
  67. },
  68. computed: {
  69. isEmpty() {
  70. return this.list.length === 0
  71. },
  72. emptyList() {
  73. return 3 - (this.list.length % 3)
  74. },
  75. },
  76. mounted() {
  77. this.fetchList()
  78. },
  79. methods: {
  80. async fetchList() {
  81. try {
  82. this.listQuery.productTypeId = this.$route.params.id
  83. const res = await this.$http.api.getAuthProductList(this.listQuery)
  84. this.list = res.data.list
  85. this.total = res.data.total
  86. } catch (error) {
  87. console.log(error)
  88. } finally {
  89. this.isRequest = false
  90. }
  91. },
  92. // 搜索
  93. onSearch() {
  94. this.listQuery.pageNum = 1
  95. this.fetchList()
  96. },
  97. // 页码变化
  98. onPagiantionChange(index) {
  99. this.listQuery.pageNum = index
  100. this.fetchList()
  101. },
  102. // 设备详情
  103. toDetail() {
  104. window.location.href = `${process.env.CIMEI_LOCAL}/product/auth/product-${item.productId}.html`
  105. },
  106. // 机构详情
  107. toClubDetail() {
  108. localStorage.setItem('clubInfo', JSON.stringify({ authId: item.authId }))
  109. this.$router.push('/ph/approve/club/detail')
  110. },
  111. },
  112. }
  113. </script>
  114. <style scoped lang="scss">
  115. // pc 端
  116. @media screen and (min-width: 768px) {
  117. .page {
  118. position: relative;
  119. min-height: calc(100vh - 80px - 80px);
  120. background-color: #fff;
  121. }
  122. .page-top {
  123. height: 420px;
  124. background: url(https://static.caimei365.com/www/authentic/pc/bg-device.png);
  125. background-size: auto 420px;
  126. .logo {
  127. display: block;
  128. width: 120px;
  129. height: 120px;
  130. border-radius: 50%;
  131. }
  132. .name {
  133. font-size: 30px;
  134. color: #fff;
  135. }
  136. .logo,
  137. .name {
  138. transform: translateY(-30px);
  139. }
  140. }
  141. .page-content {
  142. width: 1200px;
  143. margin: 0 auto;
  144. .search {
  145. position: absolute;
  146. left: 50%;
  147. top: 300px;
  148. transform: translateX(-50%);
  149. }
  150. .title {
  151. font-size: 16px;
  152. color: #404040;
  153. span {
  154. color: #bc1724;
  155. }
  156. }
  157. .list {
  158. display: flex;
  159. align-items: center;
  160. flex-wrap: wrap;
  161. justify-content: space-between;
  162. .empty {
  163. width: 390px;
  164. }
  165. .section {
  166. width: 390px;
  167. height: 108px;
  168. background-color: #f3f5f6;
  169. border-radius: 4px;
  170. box-sizing: border-box;
  171. padding: 12px;
  172. cursor: pointer;
  173. transition: all 0.4s;
  174. &:hover {
  175. box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
  176. }
  177. .cover {
  178. display: block;
  179. width: 84px;
  180. height: 84px;
  181. }
  182. .info {
  183. width: 270px;
  184. position: relative;
  185. .name {
  186. font-size: 16px;
  187. color: #101010;
  188. font-weight: bold;
  189. margin-bottom: 16px;
  190. text-overflow: ellipsis;
  191. white-space: nowrap;
  192. overflow: hidden;
  193. }
  194. .code,
  195. .club-name {
  196. position: relative;
  197. font-size: 14px;
  198. color: #404040;
  199. line-height: 24px;
  200. text-overflow: ellipsis;
  201. white-space: nowrap;
  202. overflow: hidden;
  203. span {
  204. color: #6d9eff;
  205. }
  206. }
  207. }
  208. }
  209. }
  210. }
  211. }
  212. // 移动 端
  213. @media screen and (max-width: 768px) {
  214. .page-top {
  215. height: 46vw;
  216. background: url(https://static.caimei365.com/www/authentic/h5/bg-club.png);
  217. background-size: auto 46vw;
  218. .logo {
  219. display: block;
  220. width: 14.8vw;
  221. height: 14.8vw;
  222. border-radius: 50%;
  223. }
  224. .name {
  225. font-size: 4vw;
  226. color: #fff;
  227. }
  228. }
  229. .page-content {
  230. position: relative;
  231. .search {
  232. position: absolute;
  233. left: 50%;
  234. top: 0;
  235. transform: translate(-50%, -50%);
  236. }
  237. .title {
  238. font-size: 3.4vw;
  239. color: #404040;
  240. span {
  241. color: #bc1724;
  242. }
  243. }
  244. .list {
  245. display: flex;
  246. align-items: center;
  247. flex-direction: column;
  248. .section {
  249. width: 93.6vw;
  250. height: 26vw;
  251. background-color: #f3f5f6;
  252. border-radius: 4px;
  253. box-sizing: border-box;
  254. padding: 3.2vw;
  255. .cover {
  256. display: block;
  257. width: 19.6vw;
  258. height: 19.6vw;
  259. }
  260. .info {
  261. position: relative;
  262. margin-left: 3.2vw;
  263. .name {
  264. font-size: 4vw;
  265. color: #101010;
  266. font-weight: bold;
  267. margin-bottom: 4vw;
  268. text-overflow: ellipsis;
  269. white-space: nowrap;
  270. overflow: hidden;
  271. }
  272. .code,
  273. .club-name {
  274. width: 66vw;
  275. position: relative;
  276. font-size: 3vw;
  277. color: #404040;
  278. line-height: 5vw;
  279. text-overflow: ellipsis;
  280. white-space: nowrap;
  281. overflow: hidden;
  282. span {
  283. color: #6d9eff;
  284. }
  285. }
  286. }
  287. }
  288. }
  289. }
  290. }
  291. </style>