sanfangHetong.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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 @click="handleEditor(item)">
  40. <view class="head-top">
  41. <button type="default" @click.stop="handlePreview(item)">预览</button>
  42. <button type="default">推送</button>
  43. <button type="default" @click="handleDelete(item)">删除</button>
  44. </view>
  45. <view>
  46. <view>
  47. <view>家政人员名称</view>
  48. <view>{{item.jzRealName}}</view>
  49. </view>
  50. <view>
  51. <view>客户名称</view>
  52. <view>{{item.khRealName}}</view>
  53. </view>
  54. </view>
  55. <view>
  56. <view>
  57. <view>合同开始时间</view>
  58. <view>{{item.startDate}}</view>
  59. </view>
  60. <view>
  61. <view>合同结束时间</view>
  62. <view>{{item.endDate}}</view>
  63. </view>
  64. <view>
  65. <view>合同状态</view>
  66. <view v-if="item.status== 0">待签字</view>
  67. <view v-if="item.status== 1">待审核</view>
  68. <view v-if="item.status== 2">有效</view>
  69. <view v-if="item.status== 3">失效</view>
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. </uni-list-item>
  75. <uni-load-more :status="data.state" @click="getMore(0)"
  76. :contentText="data.contentText"></uni-load-more>
  77. </uni-list>
  78. </scroll-view>
  79. </view>
  80. <!-- 删除子账号 -->
  81. <common-dialog ref="commonDialogRef" title="删除确认" content="你确定要执行这个操作吗"
  82. @confirm-btn="handleDeleteConfirm"></common-dialog>
  83. <customTabbarAdminVue :current-tab="1"></customTabbarAdminVue>
  84. </view>
  85. </template>
  86. <script setup>
  87. import {
  88. ref,
  89. reactive,
  90. nextTick
  91. } from "vue";
  92. import {
  93. onShow,
  94. onLoad
  95. } from "@dcloudio/uni-app";
  96. import * as httpApi from "@/api/sanfang.js"
  97. import searchDialog from "./components/search.vue";
  98. import customTabbarAdminVue from "@/components/custom-tabbar/custom-tabbar-admin.vue";
  99. import commonDialog from '@/components/dialog/commonDialog.vue';
  100. import {getSanfangDelete} from "../../../api/sanfang";
  101. const searchDialogRef = ref(null);
  102. const commonDialogRef = ref(null)
  103. const data = reactive({
  104. status: 0,
  105. statusText: '待签字',
  106. state: 'more',
  107. list: [], // 考试列表
  108. loading: false,
  109. jzRealName: '',
  110. khRealName: '',
  111. page: 0,
  112. size: 10,
  113. })
  114. const isOpen = ref(false)
  115. const active = ref(null);
  116. const listStatus = ref([{
  117. statusText: '有效',
  118. status: 2,
  119. },
  120. {
  121. statusText: '待审核',
  122. status: 1,
  123. },
  124. {
  125. statusText: '待签字',
  126. status: 0,
  127. }, {
  128. statusText: '失效',
  129. status: 3,
  130. }
  131. ])
  132. const shenfen = ref(null);
  133. function toggle() {
  134. searchDialogRef.value.handleShow();
  135. }
  136. function goUpPage() {
  137. uni.redirectTo({
  138. url: '/pages/admin/ShouYe/shouye'
  139. })
  140. }
  141. function clickAlltype() {
  142. isOpen.value = !isOpen.value;
  143. }
  144. function handleSelectStatus(item) {
  145. data.status = item.status;
  146. data.statusText = item.statusText;
  147. onRefresh();
  148. }
  149. function handleAdd() {
  150. uni.navigateTo({
  151. url: '/pages/admin/Hetong/addSanfangHetong'
  152. })
  153. }
  154. function handleDelete(item) {
  155. active.value = item;
  156. commonDialogRef.value.handleShow();
  157. }
  158. function handleDeleteConfirm() {
  159. httpApi.getSanfangDelete({id: active.value.id}).then(res => {
  160. if (res.code == 0) {
  161. uni.showToast({
  162. title: '成功'
  163. })
  164. onRefresh();
  165. } else {
  166. uni.showToast({
  167. title: '失败'
  168. })
  169. }
  170. })
  171. }
  172. function handleEditor(item) {
  173. uni.navigateTo({
  174. url: `/pages/admin/Hetong/addSanfangHetong?flag=editor&id=${item.id}`
  175. })
  176. }
  177. function handlePreview(item) {
  178. uni.navigateTo({
  179. url: `/pages/admin/Hetong/previewHetong?id=${item.id}`
  180. })
  181. }
  182. function dialogSearchBtn(opt, searchInput) {
  183. if (opt == 2) {
  184. data.khRealName = searchInput
  185. data.jzRealName = '';
  186. } else {
  187. data.khRealName = '';
  188. data.jzRealName = searchInput
  189. }
  190. onRefresh()
  191. }
  192. function dialogSearchReset() {
  193. data.jzRealName = '';
  194. data.khRealName = '';
  195. }
  196. function onScrolltolower() {
  197. getMore()
  198. }
  199. function onRefresh() {
  200. if (data.loading) return;
  201. data.page = 0;
  202. data.list = [];
  203. data.loading = true;
  204. refreshData();
  205. }
  206. function refreshData() {
  207. const opt = {
  208. jzRealName: data.jzRealName,
  209. khRealName: data.khRealName,
  210. page: data.page,
  211. size: data.size,
  212. status: data.status
  213. }
  214. data.list = [];
  215. // 数学
  216. data.state = 'loading';
  217. data.page++;
  218. opt.page = data.page;
  219. httpApi.getSanfangList(opt).then(res => {
  220. data.list = data.list.concat(res.data.data);
  221. data.loading = false;
  222. if (res.data.total > data.list.length) {
  223. data.state = 'more';
  224. } else {
  225. data.state = 'no-more';
  226. }
  227. }).catch(err => {
  228. data.state = 'more';
  229. }).finally(() => {
  230. data.loading = false;
  231. })
  232. }
  233. function getMore() {
  234. const opt = {
  235. jzRealName: data.jzRealName,
  236. khRealName: data.khRealName,
  237. page: data.page,
  238. size: data.size,
  239. status: data.status
  240. }
  241. if (data.state == 'no-more') return;
  242. data.state = 'loading';
  243. data.page++;
  244. opt.page = data.page;
  245. httpApi.getSanfangList(opt).then(res => {
  246. data.list = data.list.concat(res.data.data);
  247. data.loading = false;
  248. if (res.data.total > data.list.length) {
  249. data.state = 'more';
  250. } else {
  251. data.state = 'no-more';
  252. }
  253. }).catch(err => {
  254. data.state = 'more';
  255. }).finally(() => {
  256. data.loading = false;
  257. })
  258. }
  259. onLoad((options) => {
  260. console.log('options', options)
  261. const {
  262. from,
  263. jzName,
  264. khName
  265. } = options;
  266. if (jzName) {
  267. data.jzRealName = jzName;
  268. shenfen.value = 'jz'
  269. nextTick(() => {
  270. searchDialogRef.value.handleSetValue(jzName)
  271. })
  272. }
  273. if (khName) {
  274. data.khRealName = khName
  275. shenfen.value = 'kh'
  276. nextTick(() => {
  277. searchDialogRef.value.handleSetValue(khName)
  278. })
  279. }
  280. })
  281. onShow(() => {
  282. getMore()
  283. })
  284. </script>
  285. <style>
  286. </style>