sanfangHetong.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  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" :shenfen="shenfen" @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. onShow,
  89. onLoad
  90. } from "@dcloudio/uni-app";
  91. import * as httpApi from "@/api/sanfang.js"
  92. import searchDialog from "./components/search.vue";
  93. import customTabbarAdminVue from "@/components/custom-tabbar/custom-tabbar-admin.vue";
  94. const searchDialogRef = ref(null);
  95. const data = reactive({
  96. status: 0,
  97. statusText: '待签字',
  98. state: 'more',
  99. list: [], // 考试列表
  100. loading: false,
  101. jzRealName: '',
  102. khRealName: '',
  103. page: 0,
  104. size: 10,
  105. })
  106. const isOpen = ref(false)
  107. const listStatus = ref([{
  108. statusText: '有效',
  109. status: 2,
  110. },
  111. {
  112. statusText: '待审核',
  113. status: 1,
  114. },
  115. {
  116. statusText: '待签字',
  117. status: 0,
  118. }, {
  119. statusText: '失效',
  120. status: 3,
  121. }
  122. ])
  123. const shenfen = ref(null);
  124. function toggle() {
  125. searchDialogRef.value.handleShow();
  126. }
  127. function goUpPage() {
  128. uni.redirectTo({
  129. url: '/pages/admin/ShouYe/shouye'
  130. })
  131. }
  132. function clickAlltype() {
  133. isOpen.value = !isOpen.value;
  134. }
  135. function handleSelectStatus(item) {
  136. data.status = item.status;
  137. data.statusText = item.statusText;
  138. onRefresh();
  139. }
  140. function handleAdd() {
  141. uni.navigateTo({
  142. url: '/pages/admin/Hetong/addSanfangHetong'
  143. })
  144. }
  145. function dialogSearchBtn(opt, searchInput) {
  146. if (opt == 2) {
  147. data.khRealName = searchInput
  148. data.jzRealName = '';
  149. } else {
  150. data.khRealName = '';
  151. data.jzRealName = searchInput
  152. }
  153. onRefresh()
  154. }
  155. function dialogSearchReset() {
  156. data.jzRealName = '';
  157. data.khRealName = '';
  158. }
  159. function onScrolltolower() {
  160. getMore()
  161. }
  162. function onRefresh() {
  163. if (data.loading) return;
  164. data.page = 0;
  165. data.list = [];
  166. data.loading = true;
  167. refreshData();
  168. }
  169. function refreshData() {
  170. const opt = {
  171. jzRealName: data.jzRealName,
  172. khRealName: data.khRealName,
  173. page: data.page,
  174. size: data.size,
  175. status: data.status
  176. }
  177. data.list = [];
  178. // 数学
  179. data.state = 'loading';
  180. data.page++;
  181. opt.page = data.page;
  182. httpApi.getSanfangList(opt).then(res => {
  183. data.list = data.list.concat(res.data.data);
  184. data.loading = false;
  185. if (res.data.total > data.list.length) {
  186. data.state = 'more';
  187. } else {
  188. data.state = 'no-more';
  189. }
  190. }).catch(err => {
  191. data.state = 'more';
  192. }).finally(() => {
  193. data.loading = false;
  194. })
  195. }
  196. function getMore() {
  197. const opt = {
  198. jzRealName: data.jzRealName,
  199. khRealName: data.khRealName,
  200. page: data.page,
  201. size: data.size,
  202. status: data.status
  203. }
  204. if (data.state == 'no-more') return;
  205. data.state = 'loading';
  206. data.page++;
  207. opt.page = data.page;
  208. httpApi.getSanfangList(opt).then(res => {
  209. data.list = data.list.concat(res.data.data);
  210. data.loading = false;
  211. if (res.data.total > data.list.length) {
  212. data.state = 'more';
  213. } else {
  214. data.state = 'no-more';
  215. }
  216. }).catch(err => {
  217. data.state = 'more';
  218. }).finally(() => {
  219. data.loading = false;
  220. })
  221. }
  222. onLoad((options) => {
  223. console.log('options', options)
  224. const {
  225. from,
  226. jzName,
  227. khName
  228. } = options;
  229. if (jzName) {
  230. data.jzRealName = jzName;
  231. shenfen.value = 'jz'
  232. nextTick(() => {
  233. searchDialogRef.value.handleSetValue(jzName)
  234. })
  235. }
  236. if (khName) {
  237. data.khRealName = khName
  238. shenfen.value = 'kh'
  239. nextTick(() => {
  240. searchDialogRef.value.handleSetValue(khName)
  241. })
  242. }
  243. })
  244. onShow(() => {
  245. getMore()
  246. })
  247. </script>
  248. <style>
  249. </style>