index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <view class="admin-jiazheng-list">
  3. <view class="phone-navBar-box">
  4. <view @click="goUpPage" class="nav-bar-icon"></view>
  5. <text class="nav-bar-title">家政人员</text>
  6. <view class="nav-bar-icon-box">
  7. <text class="nav-bar-right-icon" @click="addJiazhengRenyuan">+</text>
  8. <uni-icons class="nav-bar-right-icon" type="search" size="18" color="#666"
  9. @click="toggle('top')"></uni-icons>
  10. </view>
  11. </view>
  12. <view class="jiazheng-search-box">
  13. <view @click.stop="clickAlltype" class="select-item-box">
  14. <text>{{data.leixing}}</text>
  15. <icon :class="allJtClass" />
  16. </view>
  17. <view class="jiazheng-search-right">
  18. <!-- 当前点击 增加 saixuan-active-->
  19. <view class="saixuan-item-box saixuan-active">
  20. <text @click="timeClick">更新时间</text>
  21. <icon :class="updataJtClass" />
  22. </view>
  23. <view class="saixuan-item-box">
  24. <!-- class切换 saixuan-jt-default saixuan-jt-click-->
  25. <text>录入时间</text>
  26. <icon :class="luruJtClass" />
  27. </view>
  28. </view>
  29. </view>
  30. <view class="all-type-box" v-show="isOpen" @click="clickAlltype">
  31. <dataChecked :list="allType" mode="single" :defaultCount="99" :showAdd="false"
  32. @change="selectChangeSkill" />
  33. </view>
  34. <view>
  35. <scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="data.loading"
  36. :refresher-threshold="50" refresher-background="transparent" @refresherrefresh="onRefresh"
  37. class="phone-scroll-view">
  38. <uni-list class="admin-list-box">
  39. <uni-list-item v-for="item in data.list" class="admin-list-item-box">
  40. <template v-slot:body>
  41. <view>
  42. <view>{{item.realName}}</view>
  43. <view @click="telephone(item)">打电话</view>
  44. </view>
  45. <view @click="lookUserInfo(item)">
  46. <image :src="item.icon ||defauleImg" mode=""></image>
  47. <view>
  48. <p> {{item.age}}岁|{{item.jingyan}}年经验</p>
  49. <p>{{item.jiguan}}</p>
  50. </view>
  51. <view>
  52. {{item.zhuangtai}}
  53. </view>
  54. </view>
  55. </template>
  56. </uni-list-item>
  57. <uni-load-more :status="data.state" @click="getMore(0)"
  58. :contentText="data.contentText"></uni-load-more>
  59. </uni-list>
  60. </scroll-view>
  61. </view>
  62. <view>
  63. <search-dialog ref="searchDialogRef" @search-btn="dialogSearchBtn"
  64. @reset-search="dialogSearchReset"></search-dialog>
  65. </view>
  66. </view>
  67. </template>
  68. <script setup>
  69. import {
  70. ref,
  71. reactive
  72. } from "vue";
  73. import {
  74. onLoad
  75. } from "@dcloudio/uni-app";
  76. import {
  77. getJiazhengList,
  78. getJiazhengLeixing
  79. } from "@/api/jiazheng.js"
  80. import dataChecked from './common/dataChecked.vue';
  81. import searchDialog from "./common/search.vue";
  82. const searchDialogRef = ref(null);
  83. let allType = ref([])
  84. let data = reactive({
  85. leixing: '全部类型',
  86. page: 0,
  87. size: 10,
  88. realName: '',
  89. sortRule: '', //排序规则(1降序,2升序
  90. sortRule: '', //排序类型(1更新时间,2录入时间)
  91. userName: '',
  92. list: [], // 考试列表
  93. loading: false,
  94. state: 'more',
  95. contentText: {
  96. contentdown: '查看更多',
  97. contentrefresh: '加载中',
  98. contentnomore: '没有更多'
  99. }
  100. })
  101. let isOpen = ref(false)
  102. let defauleImg = ref('@/static/images/my/user-default-img.png')
  103. const allJtClass = 'select-jt-default';
  104. const updataJtClass = 'saixuan-jt-default';
  105. const luruJtClass = 'saixuan-jt-click';
  106. const isOpenSelect = ref(false);
  107. const selectedOption = ref('');
  108. function dialogSearchBtn(name, searchData) {
  109. switch (name) {
  110. case '姓名':
  111. dialogSearchReset();
  112. data.realName = searchData.value;
  113. break;
  114. case '手机号':
  115. data.userName = searchData.value;
  116. break;
  117. }
  118. data.page = 0;
  119. refreshData();
  120. }
  121. function dialogSearchReset() {
  122. data.userName = '';
  123. data.realName = '';
  124. }
  125. const clickAlltype = (data) => {
  126. isOpen.value = !isOpen.value;
  127. }
  128. const toggle = (data, index) => {
  129. searchDialogRef.value.handleShow();
  130. }
  131. const addJiazhengRenyuan = () => {
  132. let pageInfo = {
  133. status: 'add'
  134. }
  135. uni.redirectTo({
  136. url: "/pages/admin/Jiazheng/jiazhengUserManager?pageInfo=" + JSON.stringify(pageInfo)
  137. })
  138. }
  139. const lookUserInfo = (data) => {
  140. let pageInfo = {
  141. status: 'edit',
  142. id: data.id,
  143. userId: data.userId
  144. }
  145. uni.redirectTo({
  146. url: `/pages/admin/Jiazheng/jiazhengUserInfo?pageInfo=` + JSON.stringify(pageInfo)
  147. })
  148. }
  149. function goUpPage() {
  150. uni.redirectTo({
  151. url: `/pages/admin/ShouYe/shouye`
  152. })
  153. }
  154. function onRefresh() {
  155. data.page = 0;
  156. data.list = [];
  157. data.loading = true;
  158. refreshData();
  159. }
  160. function telephone(data) {
  161. console.log('data', data);
  162. uni.makePhoneCall({
  163. phoneNumber: '114' //仅为示例
  164. });
  165. }
  166. function selectChangeSkill(item) {
  167. data.leixing = item[0].name
  168. console.log('selectChangeSkill', item);
  169. data.page = 0;
  170. refreshData()
  171. }
  172. function refreshData() {
  173. const opt = {
  174. "leixing": data.leixing == '全部类型' ? '' : data.leixing,
  175. "page": 1,
  176. "realName": data.realName,
  177. "size": 10,
  178. "sortRule": data.sortRule,
  179. "sortType": data.sortType,
  180. "userName": data.userName
  181. }
  182. data.list = [];
  183. // 数学
  184. data.state = 'loading';
  185. data.page++;
  186. opt.page = data.page;
  187. getJiazhengList(opt).then(res => {
  188. data.list = data.list.concat(res.data.data);
  189. data.loading = false;
  190. if (res.data.total > data.list.length) {
  191. data.state = 'more';
  192. data.loading = false;
  193. } else {
  194. data.state = 'no-more';
  195. data.loading = false;
  196. }
  197. }).catch(err => {
  198. data.state = 'more';
  199. data.loading = false;
  200. })
  201. }
  202. function timeClick() {
  203. }
  204. function getMore() {
  205. const opt = {
  206. "leixing": data.leixing == '全部类型' ? '' : data.leixing,
  207. "page": 1,
  208. "realName": data.realName,
  209. "size": 10,
  210. "sortRule": data.sortRule,
  211. "sortType": data.sortType,
  212. "userName": data.userName
  213. }
  214. if (data.state == 'no-more') return;
  215. data.state = 'loading';
  216. data.page++;
  217. opt.page = data.page;
  218. getJiazhengList(opt).then(res => {
  219. data.list = data.list.concat(res.data.data);
  220. data.loading = false;
  221. if (res.data.total > data.list.length) {
  222. data.state = 'more';
  223. data.loading = false;
  224. } else {
  225. data.state = 'no-more';
  226. data.loading = false;
  227. }
  228. }).catch(err => {
  229. data.state = 'more';
  230. data.loading = false;
  231. })
  232. }
  233. function getLeixing() {
  234. let req = {}
  235. getJiazhengLeixing(req).then(res => {
  236. allType = dataConversionObject(res.data)
  237. console.log('allType', allType.value);
  238. })
  239. }
  240. function dataConversionObject(data) {
  241. let newList
  242. newList = data.map((name, index) => ({
  243. id: index,
  244. name: name
  245. }));
  246. return newList
  247. }
  248. onLoad(() => {
  249. getMore()
  250. getLeixing()
  251. })
  252. </script>