sanfangHetong.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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. <uni-icons class="nav-bar-right-icon bar-ml10" type="search" size="20" @click="toggle('top')"></uni-icons>
  7. </view>
  8. <view class="jiazheng-search-box">
  9. <view @click.stop="clickAlltype" class="select-item-box">
  10. <text class="select-text">{{data.statusText}}</text>
  11. <icon class="select-jt-default" />
  12. </view>
  13. </view>
  14. <view class="jz-new-btn-box">
  15. <button type="default" class="phone-green-btn" @click="handleAdd">新增合同</button>
  16. </view>
  17. <!-- 状态面板 -->
  18. <view class="all-type-box" v-show="isOpen" @click="clickAlltype">
  19. <view class="phone-radio-group data-check-radio-group">
  20. <!-- 技能块展示 -->
  21. <view v-for="item in listStatus" @click="handleSelectStatus(item)" :key="item.status"
  22. class="phone-radio-item">
  23. {{ item.statusText }}
  24. </view>
  25. </view>
  26. </view>
  27. <view>
  28. <search-dialog ref="searchDialogRef" @search-btn="dialogSearchBtn"
  29. @reset-search="dialogSearchReset"></search-dialog>
  30. </view>
  31. <!-- 无限滚动容器 -->
  32. <view>
  33. <scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="data.loading"
  34. :refresher-threshold="50" @scrolltolower="onScrolltolower" refresher-background="transparent"
  35. @refresherrefresh="onRefresh" class="jz-scroll-view">
  36. <uni-list class="admin-list-box">
  37. <uni-list-item v-for="item in data.list" class="jz-list-item-box">
  38. <template v-slot:body>
  39. <view class="head-top">
  40. <button type="default">预览</button>
  41. <button type="default">推送</button>
  42. <button type="default">删除</button>
  43. </view>
  44. <view>
  45. <view>
  46. <view>家政人员名称</view>
  47. <view>{{item.jzRealName}}</view>
  48. </view>
  49. <view>
  50. <view>客户名称</view>
  51. <view>{{item.khRealName}}</view>
  52. </view>
  53. </view>
  54. <view>
  55. <view>
  56. <view>合同开始时间</view>
  57. <view>{{item.startDate}}</view>
  58. </view>
  59. <view>
  60. <view>合同结束时间</view>
  61. <view>{{item.endDate}}</view>
  62. </view>
  63. <view>
  64. <view>合同状态</view>
  65. <view v-if="item.status== 0">待签字</view>
  66. <view v-if="item.status== 1">待审核</view>
  67. <view v-if="item.status== 2">有效</view>
  68. <view v-if="item.status== 3">失效</view>
  69. </view>
  70. </view>
  71. </template>
  72. </uni-list-item>
  73. <uni-load-more :status="data.state" @click="getMore(0)"
  74. :contentText="data.contentText"></uni-load-more>
  75. </uni-list>
  76. </scroll-view>
  77. </view>
  78. <customTabbarAdminVue :current-tab="1"></customTabbarAdminVue>
  79. </view>
  80. </template>
  81. <script setup>
  82. import {
  83. ref,
  84. reactive,
  85. nextTick
  86. } from "vue";
  87. import {
  88. onLoad
  89. } from "@dcloudio/uni-app";
  90. import * as httpApi from "@/api/sanfang.js"
  91. import searchDialog from "./components/search.vue";
  92. import customTabbarAdminVue from "@/components/custom-tabbar/custom-tabbar-admin.vue";
  93. const searchDialogRef = ref(null);
  94. const data = reactive({
  95. status: 0,
  96. statusText: '待签字',
  97. state: 'more',
  98. list: [], // 考试列表
  99. loading: false,
  100. jzRealName: '',
  101. khRealName: '',
  102. page: 0,
  103. size: 10,
  104. })
  105. const isOpen = ref(false)
  106. const listStatus = ref([{
  107. statusText: '有效',
  108. status: 2,
  109. },
  110. {
  111. statusText: '待审核',
  112. status: 1,
  113. },
  114. {
  115. statusText: '待签字',
  116. status: 0,
  117. }, {
  118. statusText: '失效',
  119. status: 3,
  120. }
  121. ])
  122. function toggle() {
  123. searchDialogRef.value.handleShow();
  124. }
  125. function goUpPage() {}
  126. function clickAlltype() {
  127. isOpen.value = !isOpen.value;
  128. }
  129. function handleSelectStatus(item) {
  130. data.status = item.status;
  131. data.statusText = item.statusText;
  132. onRefresh();
  133. }
  134. function handleAdd() {}
  135. function dialogSearchBtn(opt, searchInput) {
  136. if (opt == 2) {
  137. data.khRealName = searchInput
  138. data.jzRealName = '';
  139. } else {
  140. data.khRealName = '';
  141. data.jzRealName = searchInput
  142. }
  143. onRefresh()
  144. }
  145. function dialogSearchReset() {
  146. data.jzRealName = '';
  147. data.khRealName = '';
  148. }
  149. function onScrolltolower() {
  150. getMore()
  151. }
  152. function onRefresh() {
  153. if (data.loading) return;
  154. data.page = 0;
  155. data.list = [];
  156. data.loading = true;
  157. refreshData();
  158. }
  159. function refreshData() {
  160. const opt = {
  161. jzRealName: data.jzRealName,
  162. khRealName: data.khRealName,
  163. page: data.page,
  164. size: data.size,
  165. status: data.status
  166. }
  167. data.list = [];
  168. // 数学
  169. data.state = 'loading';
  170. data.page++;
  171. opt.page = data.page;
  172. httpApi.getSanfangList(opt).then(res => {
  173. data.list = data.list.concat(res.data.data);
  174. data.loading = false;
  175. if (res.data.total > data.list.length) {
  176. data.state = 'more';
  177. } else {
  178. data.state = 'no-more';
  179. }
  180. }).catch(err => {
  181. data.state = 'more';
  182. }).finally(() => {
  183. data.loading = false;
  184. })
  185. }
  186. function getMore() {
  187. const opt = {
  188. jzRealName: data.jzRealName,
  189. khRealName: data.khRealName,
  190. page: data.page,
  191. size: data.size,
  192. status: data.status
  193. }
  194. if (data.state == 'no-more') return;
  195. data.state = 'loading';
  196. data.page++;
  197. opt.page = data.page;
  198. httpApi.getSanfangList(opt).then(res => {
  199. data.list = data.list.concat(res.data.data);
  200. data.loading = false;
  201. if (res.data.total > data.list.length) {
  202. data.state = 'more';
  203. } else {
  204. data.state = 'no-more';
  205. }
  206. }).catch(err => {
  207. data.state = 'more';
  208. }).finally(() => {
  209. data.loading = false;
  210. })
  211. }
  212. onLoad((options) => {
  213. getMore()
  214. })
  215. </script>
  216. <style>
  217. </style>