sanfangHetong.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  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" v-if="item.status == 0" @click="tuisong(item)">推送</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)" v-if="item.status<2">编辑</button>
  49. <button type="default" v-if="item.status==1" class="phone-white-btn ht-head-btn"
  50. @click.stop="handleShengxiao(item)">生效</button>
  51. </view>
  52. <view class="card-body-row">
  53. <view class="body-row">
  54. <view class="title-text">
  55. <icon class="user-icon"></icon>家政人员名称
  56. </view>
  57. <view class="value-text">{{item.realName}}</view>
  58. </view>
  59. <view class="body-row">
  60. <view class="title-text">
  61. <icon class="idcard-icon"></icon>客户名称
  62. </view>
  63. <view class="value-text">{{item.khName}}</view>
  64. </view>
  65. </view>
  66. <view class="card-body-row">
  67. <view class="body-row">
  68. <view class="title-text">
  69. <icon class="date-icon"></icon>合同开始时间
  70. </view>
  71. <view class="value-text">{{item.startDate}}</view>
  72. </view>
  73. <view class="body-row">
  74. <view class="title-text">
  75. <icon class="date-icon"></icon>合同结束时间
  76. </view>
  77. <view class="value-text">{{item.endDate}}</view>
  78. </view>
  79. <view class="body-row">
  80. <view class="title-text">
  81. <icon class="htzt-icon"></icon>合同状态
  82. </view>
  83. <view class="status-0" v-if="item.status== 0">待签字</view>
  84. <view class="status-1" v-if="item.status== 1">待审核</view>
  85. <view class="status-2" v-if="item.status== 2">有效</view>
  86. <view class="status-3" v-if="item.status== 3">失效</view>
  87. </view>
  88. </view>
  89. </view>
  90. </template>
  91. </uni-list-item>
  92. <uni-load-more :status="data.state" @click="getMore(0)"
  93. :contentText="data.contentText"></uni-load-more>
  94. </uni-list>
  95. </scroll-view>
  96. </view>
  97. <!-- 删除子账号 -->
  98. <common-dialog ref="commonDialogRef" title="删除确认" content="你确定要执行这个操作吗"
  99. @confirm-btn="handleDeleteConfirm"></common-dialog>
  100. <customTabbarAdminVue :current-tab="1"></customTabbarAdminVue>
  101. </view>
  102. </template>
  103. <script setup>
  104. import {
  105. ref,
  106. reactive,
  107. nextTick
  108. } from "vue";
  109. import {
  110. onShow,
  111. onLoad
  112. } from "@dcloudio/uni-app";
  113. import * as httpApi from "@/api/sanfang.js"
  114. import searchDialog from "./components/search.vue";
  115. import customTabbarAdminVue from "@/components/custom-tabbar/custom-tabbar-admin.vue";
  116. import commonDialog from '@/components/dialog/commonDialog.vue';
  117. import {
  118. getSanfangDelete
  119. } from "../../../api/sanfang";
  120. const searchDialogRef = ref(null);
  121. const commonDialogRef = ref(null)
  122. const data = reactive({
  123. status: 0,
  124. statusText: '待签字',
  125. state: 'more',
  126. list: [], // 考试列表
  127. loading: false,
  128. jzRealName: '',
  129. khRealName: '',
  130. page: 0,
  131. size: 10,
  132. })
  133. const isOpen = ref(false)
  134. const active = ref(null);
  135. const listStatus = ref([{
  136. statusText: '有效',
  137. status: 2,
  138. },
  139. {
  140. statusText: '待审核',
  141. status: 1,
  142. },
  143. {
  144. statusText: '待签字',
  145. status: 0,
  146. }, {
  147. statusText: '失效',
  148. status: 3,
  149. }
  150. ])
  151. const shenfen = ref(null);
  152. function toggle() {
  153. searchDialogRef.value.handleShow();
  154. }
  155. function handleShengxiao(da) {
  156. httpApi.getSanfangShengxiao({id:da.id}).then(res => {
  157. if (res.data) {
  158. uni.showToast({
  159. title: '合同已生效'
  160. })
  161. onRefresh();
  162. }
  163. })
  164. }
  165. function tuisong(data){
  166. if (!plus.runtime.isApplicationExist({
  167. pname: 'com.tencent.mm'
  168. })) {
  169. uni.showToast({
  170. title: '请先安装微信',
  171. icon: 'none'
  172. });
  173. return;
  174. }
  175. // 分享到小程序 我想加个参数
  176. uni.share({
  177. provider: 'weixin',
  178. scene: "WXSceneSession",
  179. type: 5,
  180. imageUrl: 'https://www.chengxiangjiaoyu.com/pic/hetong.jpg',
  181. title: '合同',
  182. miniProgram: {
  183. id: 'gh_fa5889151e7d',
  184. path: 'pages/Login/clientIndex?from=appcx&id='+data.id,
  185. type: 2, //暂时用体验版
  186. webUrl: 'http://uniapp.dcloud.io'
  187. },
  188. success: ret => {
  189. console.log(JSON.stringify(ret));
  190. }
  191. });
  192. }
  193. function goUpPage() {
  194. // uni.redirectTo({
  195. // url: '/pages/admin/ShouYe/shouye'
  196. // })
  197. uni.navigateBack()
  198. }
  199. function clickAlltype() {
  200. isOpen.value = !isOpen.value;
  201. }
  202. function handleSelectStatus(item) {
  203. data.status = item.status;
  204. data.statusText = item.statusText;
  205. onRefresh();
  206. }
  207. function handleAdd() {
  208. uni.navigateTo({
  209. url: '/pages/admin/Hetong/addSanfangHetong'
  210. })
  211. }
  212. function handleDelete(item) {
  213. active.value = item;
  214. commonDialogRef.value.handleShow();
  215. }
  216. function handleDeleteConfirm() {
  217. httpApi.getSanfangDelete({
  218. id: active.value.id
  219. }).then(res => {
  220. if (res.code == 0) {
  221. uni.showToast({
  222. title: '成功'
  223. })
  224. onRefresh();
  225. } else {
  226. uni.showToast({
  227. title: '失败'
  228. })
  229. }
  230. })
  231. }
  232. function handleEditor(item) {
  233. uni.navigateTo({
  234. url: `/pages/admin/Hetong/addSanfangHetong?flag=editor&id=${item.id}`
  235. })
  236. }
  237. function handlePreview(item) {
  238. uni.navigateTo({
  239. url: `/pages/admin/Hetong/previewHetong?id=${item.id}`
  240. })
  241. }
  242. function dialogSearchBtn(opt, searchInput) {
  243. if (opt == 2) {
  244. data.khRealName = searchInput
  245. data.jzRealName = '';
  246. } else {
  247. data.khRealName = '';
  248. data.jzRealName = searchInput
  249. }
  250. onRefresh()
  251. }
  252. function dialogSearchReset() {
  253. data.jzRealName = '';
  254. data.khRealName = '';
  255. }
  256. function onScrolltolower() {
  257. getMore()
  258. }
  259. function onRefresh() {
  260. if (data.loading) return;
  261. data.state = '';
  262. data.page = 0;
  263. data.list = [];
  264. data.loading = true;
  265. refreshData();
  266. }
  267. function refreshData() {
  268. const opt = {
  269. jzRealName: data.jzRealName,
  270. khRealName: data.khRealName,
  271. page: data.page,
  272. size: data.size,
  273. status: data.status
  274. }
  275. data.list = [];
  276. // 数学
  277. data.state = 'loading';
  278. data.page++;
  279. opt.page = data.page;
  280. httpApi.getSanfangList(opt).then(res => {
  281. data.list = data.list.concat(res.data.data);
  282. data.loading = false;
  283. if (res.data.total > data.list.length) {
  284. data.state = 'more';
  285. } else {
  286. data.state = 'no-more';
  287. }
  288. }).catch(err => {
  289. data.state = 'more';
  290. }).finally(() => {
  291. data.loading = false;
  292. })
  293. }
  294. function getMore() {
  295. const opt = {
  296. jzRealName: data.jzRealName,
  297. khRealName: data.khRealName,
  298. page: data.page,
  299. size: data.size,
  300. status: data.status
  301. }
  302. if (data.state == 'no-more') return;
  303. data.state = 'loading';
  304. data.page++;
  305. opt.page = data.page;
  306. httpApi.getSanfangList(opt).then(res => {
  307. data.list = data.list.concat(res.data.data);
  308. data.loading = false;
  309. if (res.data.total > data.list.length) {
  310. data.state = 'more';
  311. } else {
  312. data.state = 'no-more';
  313. }
  314. }).catch(err => {
  315. data.state = 'more';
  316. }).finally(() => {
  317. data.loading = false;
  318. })
  319. }
  320. onLoad((options) => {
  321. const {
  322. from,
  323. jzName,
  324. khName
  325. } = options;
  326. if (jzName) {
  327. data.jzRealName = jzName;
  328. shenfen.value = 'jz'
  329. nextTick(() => {
  330. searchDialogRef.value.handleSetValue(jzName)
  331. })
  332. }
  333. if (khName) {
  334. data.khRealName = khName
  335. shenfen.value = 'kh'
  336. nextTick(() => {
  337. searchDialogRef.value.handleSetValue(khName)
  338. })
  339. }
  340. })
  341. onShow(() => {
  342. data.page = 0;
  343. data.list = [];
  344. data.state = '';
  345. getMore()
  346. })
  347. </script>
  348. <style>
  349. </style>