sanfangHetong.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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 {toast} from "@/utils/common";
  118. import {
  119. getSanfangDelete
  120. } from "../../../api/sanfang";
  121. const searchDialogRef = ref(null);
  122. const commonDialogRef = ref(null)
  123. const data = reactive({
  124. status: 0,
  125. statusText: '待签字',
  126. state: 'more',
  127. list: [], // 考试列表
  128. loading: false,
  129. jzRealName: '',
  130. khRealName: '',
  131. page: 0,
  132. size: 10,
  133. })
  134. const isOpen = ref(false)
  135. const active = ref(null);
  136. const listStatus = ref([{
  137. statusText: '有效',
  138. status: 2,
  139. },
  140. {
  141. statusText: '待审核',
  142. status: 1,
  143. },
  144. {
  145. statusText: '待签字',
  146. status: 0,
  147. }, {
  148. statusText: '失效',
  149. status: 3,
  150. }
  151. ])
  152. const shenfen = ref(null);
  153. function toggle() {
  154. searchDialogRef.value.handleShow();
  155. }
  156. function handleShengxiao(da) {
  157. httpApi.getSanfangShengxiao({id:da.id}).then(res => {
  158. if (res.data) {
  159. uni.showToast({
  160. title: '合同已生效'
  161. })
  162. onRefresh();
  163. }
  164. })
  165. }
  166. function tuisong(data){
  167. // 分享到小程序 单独写不参与组件
  168. uni.share({
  169. provider: 'weixin',
  170. scene: "WXSceneSession",
  171. type: 5,
  172. imageUrl: 'https://www.chengxiangjiaoyu.com/pic/hetong.jpg',
  173. title: '合同',
  174. miniProgram: {
  175. id: 'gh_fa5889151e7d',
  176. path: 'pages/Login/clientIndex?from=appcx&id='+data.id,
  177. type: 2, //暂时用体验版
  178. webUrl: 'http://uniapp.dcloud.io'
  179. },
  180. success: ret => {
  181. console.log(JSON.stringify(ret));
  182. },
  183. fail:(error) =>{
  184. console.log('error',error);
  185. // uni.showToast({
  186. // title: error.errMsg
  187. // })
  188. toast(error.errMsg)
  189. }
  190. });
  191. }
  192. function goUpPage() {
  193. // uni.redirectTo({
  194. // url: '/pages/admin/ShouYe/shouye'
  195. // })
  196. uni.navigateBack()
  197. }
  198. function clickAlltype() {
  199. isOpen.value = !isOpen.value;
  200. }
  201. function handleSelectStatus(item) {
  202. data.status = item.status;
  203. data.statusText = item.statusText;
  204. onRefresh();
  205. }
  206. function handleAdd() {
  207. uni.navigateTo({
  208. url: '/pages/admin/Hetong/addSanfangHetong'
  209. })
  210. }
  211. function handleDelete(item) {
  212. active.value = item;
  213. commonDialogRef.value.handleShow();
  214. }
  215. function handleDeleteConfirm() {
  216. httpApi.getSanfangDelete({
  217. id: active.value.id
  218. }).then(res => {
  219. if (res.code == 0) {
  220. uni.showToast({
  221. title: '成功'
  222. })
  223. onRefresh();
  224. } else {
  225. uni.showToast({
  226. title: '失败'
  227. })
  228. }
  229. })
  230. }
  231. function handleEditor(item) {
  232. uni.navigateTo({
  233. url: `/pages/admin/Hetong/addSanfangHetong?flag=editor&id=${item.id}`
  234. })
  235. }
  236. function handlePreview(item) {
  237. uni.navigateTo({
  238. url: `/pages/admin/Hetong/previewHetong?id=${item.id}`
  239. })
  240. }
  241. function dialogSearchBtn(opt, searchInput) {
  242. if (opt == 2) {
  243. data.khRealName = searchInput
  244. data.jzRealName = '';
  245. } else {
  246. data.khRealName = '';
  247. data.jzRealName = searchInput
  248. }
  249. onRefresh()
  250. }
  251. function dialogSearchReset() {
  252. data.jzRealName = '';
  253. data.khRealName = '';
  254. }
  255. function onScrolltolower() {
  256. getMore()
  257. }
  258. function onRefresh() {
  259. if (data.loading) return;
  260. data.state = '';
  261. data.page = 0;
  262. data.list = [];
  263. data.loading = true;
  264. refreshData();
  265. }
  266. function refreshData() {
  267. const opt = {
  268. jzRealName: data.jzRealName,
  269. khRealName: data.khRealName,
  270. page: data.page,
  271. size: data.size,
  272. status: data.status
  273. }
  274. data.list = [];
  275. // 数学
  276. data.state = 'loading';
  277. data.page++;
  278. opt.page = data.page;
  279. httpApi.getSanfangList(opt).then(res => {
  280. data.list = data.list.concat(res.data.data);
  281. data.loading = false;
  282. if (res.data.total > data.list.length) {
  283. data.state = 'more';
  284. } else {
  285. data.state = 'no-more';
  286. }
  287. }).catch(err => {
  288. data.state = 'more';
  289. }).finally(() => {
  290. data.loading = false;
  291. })
  292. }
  293. function getMore() {
  294. const opt = {
  295. jzRealName: data.jzRealName,
  296. khRealName: data.khRealName,
  297. page: data.page,
  298. size: data.size,
  299. status: data.status
  300. }
  301. if (data.state == 'no-more') return;
  302. data.state = 'loading';
  303. data.page++;
  304. opt.page = data.page;
  305. httpApi.getSanfangList(opt).then(res => {
  306. data.list = data.list.concat(res.data.data);
  307. data.loading = false;
  308. if (res.data.total > data.list.length) {
  309. data.state = 'more';
  310. } else {
  311. data.state = 'no-more';
  312. }
  313. }).catch(err => {
  314. data.state = 'more';
  315. }).finally(() => {
  316. data.loading = false;
  317. })
  318. }
  319. onLoad((options) => {
  320. const {
  321. from,
  322. jzName,
  323. khName
  324. } = options;
  325. if (jzName) {
  326. data.jzRealName = jzName;
  327. shenfen.value = 'jz'
  328. nextTick(() => {
  329. searchDialogRef.value.handleSetValue(jzName)
  330. })
  331. }
  332. if (khName) {
  333. data.khRealName = khName
  334. shenfen.value = 'kh'
  335. nextTick(() => {
  336. searchDialogRef.value.handleSetValue(khName)
  337. })
  338. }
  339. })
  340. onShow(() => {
  341. data.page = 0;
  342. data.list = [];
  343. data.state = '';
  344. getMore()
  345. })
  346. </script>
  347. <style>
  348. </style>