sanfangHetong.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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. uni.redirectTo({
  127. url: '/pages/admin/ShouYe/shouye'
  128. })
  129. }
  130. function clickAlltype() {
  131. isOpen.value = !isOpen.value;
  132. }
  133. function handleSelectStatus(item) {
  134. data.status = item.status;
  135. data.statusText = item.statusText;
  136. onRefresh();
  137. }
  138. function handleAdd() {
  139. uni.navigateTo({
  140. url: '/pages/admin/Hetong/addSanfangHetong'
  141. })
  142. }
  143. function dialogSearchBtn(opt, searchInput) {
  144. if (opt == 2) {
  145. data.khRealName = searchInput
  146. data.jzRealName = '';
  147. } else {
  148. data.khRealName = '';
  149. data.jzRealName = searchInput
  150. }
  151. onRefresh()
  152. }
  153. function dialogSearchReset() {
  154. data.jzRealName = '';
  155. data.khRealName = '';
  156. }
  157. function onScrolltolower() {
  158. getMore()
  159. }
  160. function onRefresh() {
  161. if (data.loading) return;
  162. data.page = 0;
  163. data.list = [];
  164. data.loading = true;
  165. refreshData();
  166. }
  167. function refreshData() {
  168. const opt = {
  169. jzRealName: data.jzRealName,
  170. khRealName: data.khRealName,
  171. page: data.page,
  172. size: data.size,
  173. status: data.status
  174. }
  175. data.list = [];
  176. // 数学
  177. data.state = 'loading';
  178. data.page++;
  179. opt.page = data.page;
  180. httpApi.getSanfangList(opt).then(res => {
  181. data.list = data.list.concat(res.data.data);
  182. data.loading = false;
  183. if (res.data.total > data.list.length) {
  184. data.state = 'more';
  185. } else {
  186. data.state = 'no-more';
  187. }
  188. }).catch(err => {
  189. data.state = 'more';
  190. }).finally(() => {
  191. data.loading = false;
  192. })
  193. }
  194. function getMore() {
  195. const opt = {
  196. jzRealName: data.jzRealName,
  197. khRealName: data.khRealName,
  198. page: data.page,
  199. size: data.size,
  200. status: data.status
  201. }
  202. if (data.state == 'no-more') return;
  203. data.state = 'loading';
  204. data.page++;
  205. opt.page = data.page;
  206. httpApi.getSanfangList(opt).then(res => {
  207. data.list = data.list.concat(res.data.data);
  208. data.loading = false;
  209. if (res.data.total > data.list.length) {
  210. data.state = 'more';
  211. } else {
  212. data.state = 'no-more';
  213. }
  214. }).catch(err => {
  215. data.state = 'more';
  216. }).finally(() => {
  217. data.loading = false;
  218. })
  219. }
  220. onLoad((options) => {
  221. getMore()
  222. })
  223. </script>
  224. <style>
  225. </style>