selectJz.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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="goUpPage" 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 "./components/search.vue";
  57. const emits = defineEmits(['select'])
  58. function goback2() {}
  59. const searchDialogRef = ref(null);
  60. const popupRef = ref(null)
  61. const data = reactive({
  62. status: 0,
  63. statusText: '待签字',
  64. state: 'more',
  65. list: [], // 考试列表
  66. loading: false,
  67. realName: '',
  68. page: 0,
  69. size: 10,
  70. activeData: null
  71. })
  72. function toggle() {
  73. searchDialogRef.value.handleShow();
  74. }
  75. function dialogSearchBtn(opt, searchInput) {
  76. data.realName = searchInput
  77. onRefresh()
  78. }
  79. function dialogSearchReset() {
  80. data.realName = '';
  81. }
  82. function onScrolltolower() {
  83. getMore()
  84. }
  85. function onRefresh() {
  86. if (data.loading) return;
  87. data.page = 0;
  88. data.list = [];
  89. data.loading = true;
  90. refreshData();
  91. }
  92. function refreshData() {
  93. const opt = {
  94. realName: data.realName,
  95. page: data.page,
  96. size: data.size,
  97. status: data.status
  98. }
  99. data.list = [];
  100. // 数学
  101. data.state = 'loading';
  102. data.page++;
  103. opt.page = data.page;
  104. getJiazhengList(opt).then(res => {
  105. data.list = data.list.concat(res.data.data);
  106. data.loading = false;
  107. if (res.data.total > data.list.length) {
  108. data.state = 'more';
  109. } else {
  110. data.state = 'no-more';
  111. }
  112. }).catch(err => {
  113. data.state = 'more';
  114. }).finally(() => {
  115. data.loading = false;
  116. })
  117. }
  118. function getMore() {
  119. const opt = {
  120. realName: data.realName,
  121. page: data.page,
  122. size: data.size,
  123. status: data.status
  124. }
  125. if (data.state == 'no-more') return;
  126. data.state = 'loading';
  127. data.page++;
  128. opt.page = data.page;
  129. getJiazhengList(opt).then(res => {
  130. data.list = data.list.concat(res.data.data);
  131. data.loading = false;
  132. if (res.data.total > data.list.length) {
  133. data.state = 'more';
  134. } else {
  135. data.state = 'no-more';
  136. }
  137. }).catch(err => {
  138. data.state = 'more';
  139. }).finally(() => {
  140. data.loading = false;
  141. })
  142. }
  143. function radioChange(opt) {
  144. data.activeData = opt.id
  145. }
  146. function handleSelect() {
  147. emits('select', data.activeData)
  148. }
  149. function handleShow() {
  150. popupRef.value.open();
  151. onRefresh();
  152. }
  153. </script>
  154. <style>
  155. </style>