sanfangHetong.vue 5.6 KB

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