selectJz.vue 4.8 KB

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