index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <div class="page">
  3. <van-list
  4. v-model="isLoadingMore"
  5. :finished="finished"
  6. :immediate-check="false"
  7. :finished-text="total ? '没有更多了' : ''"
  8. @load="onLoadMore"
  9. >
  10. <div class="page-top flex flex-col justify-center items-center">
  11. <img class="logo" src="https://picsum.photos/200/200" />
  12. <div class="mt-2 name">
  13. <span v-text="supplierInfo.shopName"></span>
  14. <span>官方医师认证</span>
  15. </div>
  16. </div>
  17. <div class="page-content">
  18. <!-- 搜索区域 -->
  19. <div class="search">
  20. <SimpleSearch
  21. v-model="listQuery.doctorName"
  22. @search="onSearch"
  23. placeholder="搜索医师"
  24. />
  25. </div>
  26. <!-- 标题 -->
  27. <div class="title px-4 pt-12 pb-6">
  28. 共<span v-text="total"></span>位医师
  29. </div>
  30. <!-- 列表 -->
  31. <div class="list">
  32. <div
  33. class="section flex justify-between mb-4"
  34. v-for="item in list"
  35. :key="item.doctorId"
  36. @click="toDetail(item)"
  37. >
  38. <img class="cover" :src="item.doctorImage" />
  39. <div class="info">
  40. <div class="name" v-text="item.doctorName"></div>
  41. <div class="tag">{{ item.tagList.join(' | ') }}</div>
  42. <div class="code">资格证编号:{{ item.certificateNo }}</div>
  43. <div class="club-name">所在机构:{{ item.clubName }}</div>
  44. </div>
  45. </div>
  46. <div class="empty" v-for="i in emptyList" :key="'empty' + i"></div>
  47. </div>
  48. <!-- 列表为空 -->
  49. <SimpleEmpty
  50. v-if="!total && !isRequest"
  51. name="icon-empty-device.png"
  52. description="敬请期待~"
  53. ></SimpleEmpty>
  54. </div>
  55. </van-list>
  56. </div>
  57. </template>
  58. <script>
  59. import { mapGetters } from 'vuex'
  60. import { debounce } from '@/utils'
  61. export default {
  62. layout: 'app',
  63. data() {
  64. return {
  65. isLoadingMore: true,
  66. finished: false,
  67. isRequest: true,
  68. listQuery: {
  69. authUserId: '',
  70. doctorType: 1,
  71. doctorName: '',
  72. pageNum: 1,
  73. pageSize: 9,
  74. },
  75. list: [],
  76. total: 0,
  77. }
  78. },
  79. computed: {
  80. ...mapGetters(['supplierInfo', 'authUserId', 'authUserId']),
  81. isEmpty() {
  82. return this.list.length === 0
  83. },
  84. emptyList() {
  85. return 3 - (this.list.length % 3)
  86. },
  87. },
  88. mounted() {
  89. this.fetchList()
  90. },
  91. methods: {
  92. fetchList: debounce(async function () {
  93. try {
  94. this.isLoadingMore = true
  95. this.listQuery.authUserId = this.authUserId
  96. const res = await this.$http.api.fetchDoctorList(this.listQuery)
  97. this.list = [...this.list, ...res.data.list]
  98. this.finished = !res.data.hasNextPage
  99. this.total = res.data.total
  100. } catch (error) {
  101. console.log(error)
  102. } finally {
  103. this.isRequest = false
  104. this.isLoadingMore = false
  105. }
  106. }, 400),
  107. // 搜索
  108. onSearch() {
  109. this.list = []
  110. this.listQuery.pageNum = 1
  111. this.fetchList()
  112. },
  113. // 页码变化
  114. onPagiantionChange(index) {
  115. this.listQuery.pageNum = index
  116. this.fetchList()
  117. },
  118. // 机构详情
  119. toClubDetail(item) {
  120. localStorage.setItem('clubInfo', JSON.stringify({ authId: item.authId }))
  121. const url = `/${this.authUserId}/app/approve/club/detail`
  122. this.$router.push(url)
  123. },
  124. // 医师详情
  125. toDetail(item) {
  126. const url = `/${this.authUserId}/app/approve/personnel/operate/detail?id=${item.doctorId}`
  127. this.$router.push(url)
  128. },
  129. // 加载更多
  130. onLoadMore() {
  131. this.listQuery.pageNum += 1
  132. this.fetchList()
  133. },
  134. },
  135. }
  136. </script>
  137. <style scoped lang="scss">
  138. .page {
  139. position: relative;
  140. min-height: calc(100vh - 80px - 80px);
  141. background-color: #fff;
  142. }
  143. // pc 端
  144. @media screen and (min-width: 768px) {
  145. .page-top {
  146. height: 420px;
  147. background: url(https://static.caimei365.com/www/authentic/pc/bg-doctor.png)
  148. no-repeat center;
  149. background-size: auto 420px;
  150. .logo {
  151. display: block;
  152. width: 120px;
  153. height: 120px;
  154. border-radius: 50%;
  155. }
  156. .name {
  157. font-size: 30px;
  158. color: #fff;
  159. }
  160. .logo,
  161. .name {
  162. transform: translateY(-30px);
  163. }
  164. }
  165. .page-content {
  166. width: 1200px;
  167. margin: 0 auto;
  168. .search {
  169. position: absolute;
  170. left: 50%;
  171. top: 300px;
  172. transform: translateX(-50%);
  173. }
  174. .title {
  175. font-size: 16px;
  176. color: #404040;
  177. span {
  178. color: #bc1724;
  179. }
  180. }
  181. .list {
  182. display: flex;
  183. align-items: center;
  184. flex-wrap: wrap;
  185. justify-content: space-between;
  186. .empty {
  187. width: 390px;
  188. }
  189. .section {
  190. width: 390px;
  191. background-color: #f3f5f6;
  192. border-radius: 4px;
  193. box-sizing: border-box;
  194. padding: 12px;
  195. cursor: pointer;
  196. transition: all 0.4s;
  197. &:hover {
  198. box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
  199. }
  200. .cover {
  201. display: block;
  202. width: 84px;
  203. height: 84px;
  204. }
  205. .info {
  206. width: 270px;
  207. position: relative;
  208. margin-left: 12px;
  209. .name {
  210. font-size: 16px;
  211. color: #101010;
  212. font-weight: bold;
  213. text-overflow: ellipsis;
  214. white-space: nowrap;
  215. overflow: hidden;
  216. }
  217. .tag,
  218. .code,
  219. .club-name {
  220. height: 20px;
  221. position: relative;
  222. font-size: 14px;
  223. color: #404040;
  224. line-height: 20px;
  225. text-overflow: ellipsis;
  226. white-space: nowrap;
  227. overflow: hidden;
  228. span {
  229. color: #6d9eff;
  230. }
  231. }
  232. .tag {
  233. color: #909399;
  234. }
  235. }
  236. }
  237. }
  238. }
  239. }
  240. // 移动 端
  241. @media screen and (max-width: 768px) {
  242. .page-top {
  243. height: 46vw;
  244. background: url(https://static.caimei365.com/www/authentic/h5/bg-doctor.png);
  245. background-size: auto 46vw;
  246. .logo {
  247. display: block;
  248. width: 14.8vw;
  249. height: 14.8vw;
  250. border-radius: 50%;
  251. }
  252. .name {
  253. font-size: 4vw;
  254. color: #fff;
  255. }
  256. }
  257. .page-content {
  258. position: relative;
  259. .search {
  260. position: absolute;
  261. left: 50%;
  262. top: 0;
  263. transform: translate(-50%, -50%);
  264. }
  265. .city {
  266. padding-top: 12vw;
  267. }
  268. .title {
  269. font-size: 3.4vw;
  270. color: #404040;
  271. span {
  272. color: #bc1724;
  273. }
  274. }
  275. .list {
  276. display: flex;
  277. align-items: center;
  278. flex-direction: column;
  279. .section {
  280. width: 93.6vw;
  281. background-color: #f3f5f6;
  282. border-radius: 4px;
  283. box-sizing: border-box;
  284. padding: 3.2vw;
  285. .cover {
  286. display: block;
  287. width: 21.6vw;
  288. height: 21.6vw;
  289. }
  290. .info {
  291. position: relative;
  292. margin-left: 3.2vw;
  293. .name {
  294. font-size: 4vw;
  295. color: #101010;
  296. font-weight: bold;
  297. margin-bottom: 0.8vw;
  298. text-overflow: ellipsis;
  299. white-space: nowrap;
  300. overflow: hidden;
  301. }
  302. .tag,
  303. .code,
  304. .club-name {
  305. width: 62vw;
  306. height: 5vw;
  307. position: relative;
  308. font-size: 3vw;
  309. color: #404040;
  310. line-height: 5vw;
  311. text-overflow: ellipsis;
  312. white-space: nowrap;
  313. overflow: hidden;
  314. span {
  315. color: #6d9eff;
  316. }
  317. }
  318. .tag {
  319. color: #909399;
  320. }
  321. }
  322. }
  323. }
  324. }
  325. }
  326. </style>