index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <div class="mine">
  3. <div class="condition">
  4. <el-date-picker
  5. v-model="dates"
  6. type="daterange"
  7. range-separator="->"
  8. start-placeholder="开始日期"
  9. end-placeholder="结束日期"
  10. >
  11. </el-date-picker>
  12. <el-input placeholder="请输入内容" class="search" v-model="searchText">
  13. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  14. </el-input>
  15. <el-button type="primary" class="searchButton" @click="getSkinList"
  16. >搜索</el-button
  17. >
  18. </div>
  19. <div class="list">
  20. <div class="tab">
  21. <div class="head-img">头像</div>
  22. <div class="head-name">昵称</div>
  23. <div class="head-phone">联系电话</div>
  24. <div class="head-ts">检测时间</div>
  25. <div class="head-status">状态</div>
  26. </div>
  27. <div class="content">
  28. <div
  29. class="tab user-info"
  30. v-for="(item, index) in userList"
  31. :key="index"
  32. @click="onDetails(item.id)"
  33. >
  34. <div class="head-img"><img :src="item.avatar_url" alt="" /></div>
  35. <div class="head-name">{{ item.nickname }}</div>
  36. <div class="head-phone">{{ item.mobile }}</div>
  37. <div class="head-ts">{{ item.check_time }}</div>
  38. <div
  39. class="head-status"
  40. :style="item.status == 1 ? 'color: #61D09D;' : 'color: #FC3019;'"
  41. >
  42. {{ item.status == 1 ? "已面诊" : "未面诊" }}
  43. </div>
  44. </div>
  45. </div>
  46. <div class="pagin">
  47. <el-pagination
  48. background
  49. layout="prev, pager, next"
  50. @current-change="handleCurrentChange"
  51. :current-page.sync="currentPage1"
  52. :total="total"
  53. >
  54. </el-pagination>
  55. </div>
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. import api from "../../server/home";
  61. export default {
  62. components: {},
  63. data() {
  64. return {
  65. dates: [],
  66. searchText: "",
  67. userList: [],
  68. currentPage1: 1,
  69. limit: 10,
  70. total: 0,
  71. };
  72. },
  73. computed: {},
  74. watch: {},
  75. methods: {
  76. getSkinList() {
  77. let start_date = "",
  78. end_date = "";
  79. if (this.dates && this.dates.length > 0) {
  80. start_date = utils.formatTime(this.dates[0], "yyyy-MM-dd");
  81. end_date = utils.formatTime(this.dates[1], "yyyy-MM-dd");
  82. }
  83. let params = {
  84. page: this.currentPage1,
  85. limit: this.limit,
  86. keywords: this.searchText||this.$route.query.id,
  87. start_date: start_date,
  88. end_date: end_date,
  89. };
  90. api.getSkinList(params).then((res) => {
  91. if (res.code == 200) {
  92. // 将用户手机号中间四位变成****
  93. res.data.list.map((item) => {
  94. item.mobile =
  95. item.mobile.substring(0, 3) + "****" + item.mobile.substring(7);
  96. });
  97. this.userList = res.data.list;
  98. this.total = res.data.total;
  99. }
  100. });
  101. },
  102. onDetails(e) {
  103. this.$router.push({
  104. path: "/testSkin/details",
  105. query: {
  106. id: e,
  107. },
  108. });
  109. },
  110. handleCurrentChange(e) {
  111. this.currentPage1 = e;
  112. this.getSkinList();
  113. },
  114. },
  115. created() {
  116. this.getSkinList();
  117. },
  118. mounted() {},
  119. };
  120. </script>
  121. <style lang='less' scoped>
  122. .mine {
  123. .condition {
  124. display: flex;
  125. .search {
  126. width: 152px;
  127. margin-left: 18px;
  128. }
  129. .searchButton {
  130. margin-left: 18px;
  131. width: 68px;
  132. background: #fa7d22;
  133. border-radius: 2px;
  134. border-color: #fa7d22;
  135. }
  136. }
  137. .list {
  138. margin-top: 18px;
  139. padding: 14px 12px;
  140. background: #ffffff;
  141. box-shadow: 0px 2px 4px 0px rgba(184, 191, 198, 0.2);
  142. border-radius: 8px;
  143. .tab {
  144. padding-bottom: 9px;
  145. border-bottom: 1px solid #e6e6e6;
  146. display: flex;
  147. align-items: center;
  148. font-size: 14px;
  149. font-family: PingFangSC-Regular, PingFang SC;
  150. font-weight: 400;
  151. color: #999999;
  152. line-height: 20px;
  153. .head-img {
  154. width: 84px;
  155. img {
  156. width: 36px;
  157. }
  158. }
  159. .head-name {
  160. width: 144px;
  161. }
  162. .head-phone {
  163. width: 192px;
  164. }
  165. .head-ts {
  166. width: 288px;
  167. }
  168. .head-status {
  169. }
  170. }
  171. .content {
  172. border-bottom: 0px;
  173. padding-top: 14px;
  174. max-height: 300px;
  175. overflow: auto;
  176. .user-info {
  177. border-bottom: 18px;
  178. font-size: 14px;
  179. font-family: PingFangSC-Regular, PingFang SC;
  180. font-weight: 400;
  181. color: #333333;
  182. line-height: 22px;
  183. }
  184. }
  185. .el-pagination {
  186. text-align: center;
  187. margin-top: 50px;
  188. }
  189. }
  190. }
  191. </style>