index.vue 7.8 KB

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