selectJz.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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>
  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>
  26. <radio :value="item.id" :checked="item.id === data.activeData" />
  27. </view>
  28. </view>
  29. </template>
  30. </uni-list-item>
  31. </radio-group>
  32. <uni-load-more :status="data.state" @click="getMore(0)"
  33. :contentText="data.contentText"></uni-load-more>
  34. </uni-list>
  35. </scroll-view>
  36. </view>
  37. <view>
  38. <button @click="handleSelect">选择此家政阿姨</button>
  39. </view>
  40. </view>
  41. </uni-popup>
  42. </template>
  43. <script setup>
  44. import {
  45. ref,
  46. reactive,
  47. nextTick
  48. } from "vue";
  49. import {
  50. onLoad
  51. } from "@dcloudio/uni-app";
  52. import * as httpApi from "@/api/sanfang.js"
  53. import {
  54. getJiazhengList
  55. } from "@/api/jiazheng.js"
  56. import searchDialog from "./search.vue";
  57. const emits = defineEmits(['select'])
  58. function goback2() {
  59. popupRef.value.close();
  60. }
  61. const searchDialogRef = ref(null);
  62. const popupRef = ref(null)
  63. const data = reactive({
  64. status: 0,
  65. statusText: '待签字',
  66. state: 'more',
  67. list: [], // 考试列表
  68. loading: false,
  69. realName: '',
  70. page: 0,
  71. size: 10,
  72. activeData: null
  73. })
  74. function toggle() {
  75. searchDialogRef.value.handleShow();
  76. }
  77. function dialogSearchBtn(opt, searchInput) {
  78. data.realName = searchInput
  79. onRefresh()
  80. }
  81. function dialogSearchReset() {
  82. data.realName = '';
  83. }
  84. function onScrolltolower() {
  85. getMore()
  86. }
  87. function onRefresh() {
  88. if (data.loading) return;
  89. data.page = 0;
  90. data.list = [];
  91. data.loading = true;
  92. refreshData();
  93. }
  94. function refreshData() {
  95. const opt = {
  96. realName: data.realName,
  97. page: data.page,
  98. size: data.size,
  99. status: data.status
  100. }
  101. data.list = [];
  102. // 数学
  103. data.state = 'loading';
  104. data.page++;
  105. opt.page = data.page;
  106. getJiazhengList(opt).then(res => {
  107. data.list = data.list.concat(res.data.data);
  108. data.loading = false;
  109. if (res.data.total > data.list.length) {
  110. data.state = 'more';
  111. } else {
  112. data.state = 'no-more';
  113. }
  114. }).catch(err => {
  115. data.state = 'more';
  116. }).finally(() => {
  117. data.loading = false;
  118. })
  119. }
  120. function getMore() {
  121. const opt = {
  122. realName: data.realName,
  123. page: data.page,
  124. size: data.size,
  125. status: data.status
  126. }
  127. if (data.state == 'no-more') return;
  128. data.state = 'loading';
  129. data.page++;
  130. opt.page = data.page;
  131. getJiazhengList(opt).then(res => {
  132. data.list = data.list.concat(res.data.data);
  133. data.loading = false;
  134. if (res.data.total > data.list.length) {
  135. data.state = 'more';
  136. } else {
  137. data.state = 'no-more';
  138. }
  139. }).catch(err => {
  140. data.state = 'more';
  141. }).finally(() => {
  142. data.loading = false;
  143. })
  144. }
  145. function radioChange(opt) {
  146. data.activeData = opt.id
  147. }
  148. function handleSelect() {
  149. emits('select', data.activeData)
  150. }
  151. function handleShow() {
  152. data.realName = '';
  153. popupRef.value.open();
  154. onRefresh();
  155. }
  156. defineExpose({
  157. handleShow
  158. })
  159. </script>
  160. <style>
  161. </style>