sanfangHetong.vue 8.3 KB

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