selectJz.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <uni-popup ref="popupRef" type="bottom" background-color="#fff" :is-mask-click="false" :mask-click="false">
  3. <view class="ht-qm-popup">
  4. <view class="phone-navBar-box">
  5. <view @click="goback2" class="nav-bar-icon"></view>
  6. <text class="nav-bar-title">选择家政阿姨</text>
  7. <uni-icons class="nav-bar-right-icon bar-ml10" type="search" size="20"
  8. @click="toggle('top')"></uni-icons>
  9. </view>
  10. <view>
  11. <search-dialog ref="searchDialogRef" shenfen="jz" @search-btn="dialogSearchBtn"
  12. @reset-search="dialogSearchReset"></search-dialog>
  13. </view>
  14. <!-- 无限滚动容器 -->
  15. <view style="height: 300px">
  16. <scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="data.loading"
  17. :refresher-threshold="50" @scrolltolower="onScrolltolower" refresher-background="transparent"
  18. @refresherrefresh="onRefresh" class="jz-scroll-view">
  19. <uni-list class="admin-list-box">
  20. <radio-group @change="radioChange">
  21. <uni-list-item v-for="item in data.list" class="jz-list-item-box">
  22. <template v-slot:body>
  23. <view>
  24. <view>{{item.realName}}</view>
  25. <view>{{item.age}}</view>
  26. <view>{{item.zhuangtai}}</view>
  27. <view>{{item.jiguanShiName}}</view>
  28. <view>
  29. <radio :value="item.id && item.id.toString()" :checked="item.id == data.activeData" />
  30. </view>
  31. </view>
  32. </template>
  33. </uni-list-item>
  34. </radio-group>
  35. <uni-load-more :status="data.state" @click="getMore(0)"
  36. :contentText="data.contentText"></uni-load-more>
  37. </uni-list>
  38. </scroll-view>
  39. </view>
  40. <view>
  41. <button @click="handleSelect">选择此家政阿姨</button>
  42. </view>
  43. </view>
  44. </uni-popup>
  45. </template>
  46. <script setup>
  47. import {
  48. ref,
  49. reactive,
  50. nextTick
  51. } from "vue";
  52. import {
  53. onLoad
  54. } from "@dcloudio/uni-app";
  55. import * as httpApi from "@/api/sanfang.js"
  56. import {
  57. getJiazhengList
  58. } from "@/api/jiazheng.js"
  59. import searchDialog from "./search.vue";
  60. const emits = defineEmits(['select'])
  61. function goback2() {
  62. popupRef.value.close();
  63. }
  64. const searchDialogRef = ref(null);
  65. const popupRef = ref(null)
  66. const data = reactive({
  67. status: 0,
  68. statusText: '待签字',
  69. state: 'more',
  70. list: [], // 考试列表
  71. loading: false,
  72. realName: '',
  73. page: 0,
  74. size: 10,
  75. activeData: null
  76. })
  77. function toggle() {
  78. searchDialogRef.value.handleShow();
  79. }
  80. function dialogSearchBtn(opt, searchInput) {
  81. data.realName = searchInput
  82. onRefresh()
  83. }
  84. function dialogSearchReset() {
  85. data.realName = '';
  86. }
  87. function onScrolltolower() {
  88. getMore()
  89. }
  90. function onRefresh() {
  91. if (data.loading) return;
  92. data.page = 0;
  93. data.list = [];
  94. data.loading = true;
  95. refreshData();
  96. }
  97. function refreshData() {
  98. const opt = {
  99. realName: data.realName,
  100. page: data.page,
  101. size: data.size,
  102. status: data.status
  103. }
  104. data.list = [];
  105. // 数学
  106. data.state = 'loading';
  107. data.page++;
  108. opt.page = data.page;
  109. getJiazhengList(opt).then(res => {
  110. data.list = data.list.concat(res.data.data);
  111. data.loading = false;
  112. if (res.data.total > data.list.length) {
  113. data.state = 'more';
  114. } else {
  115. data.state = 'no-more';
  116. }
  117. }).catch(err => {
  118. data.state = 'more';
  119. }).finally(() => {
  120. data.loading = false;
  121. })
  122. }
  123. function getMore() {
  124. const opt = {
  125. realName: data.realName,
  126. page: data.page,
  127. size: data.size,
  128. status: data.status
  129. }
  130. if (data.state == 'no-more') return;
  131. data.state = 'loading';
  132. data.page++;
  133. opt.page = data.page;
  134. getJiazhengList(opt).then(res => {
  135. data.list = data.list.concat(res.data.data);
  136. data.loading = false;
  137. if (res.data.total > data.list.length) {
  138. data.state = 'more';
  139. } else {
  140. data.state = 'no-more';
  141. }
  142. }).catch(err => {
  143. data.state = 'more';
  144. }).finally(() => {
  145. data.loading = false;
  146. })
  147. }
  148. function radioChange(opt) {
  149. data.activeData = data.list.find(item => item.id == opt.detail.value)
  150. }
  151. function handleSelect() {
  152. emits('select', data.activeData)
  153. popupRef.value.close();
  154. }
  155. function handleShow() {
  156. data.realName = '';
  157. popupRef.value.open();
  158. onRefresh();
  159. }
  160. defineExpose({
  161. handleShow
  162. })
  163. </script>
  164. <style>
  165. </style>