sanfangHetong.vue 8.1 KB

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