sanfangHetong.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  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" @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)">编辑</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 tuisong(data){
  154. if (!plus.runtime.isApplicationExist({
  155. pname: 'com.tencent.mm'
  156. })) {
  157. uni.showToast({
  158. title: '请先安装微信',
  159. icon: 'none'
  160. });
  161. return;
  162. }
  163. // 分享到小程序 我想加个参数
  164. uni.share({
  165. provider: 'weixin',
  166. scene: "WXSceneSession",
  167. type: 5,
  168. imageUrl: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/share-logo@3.png',
  169. title: '欢迎体验uniapp12312',
  170. miniProgram: {
  171. id: 'gh_fa5889151e7d',
  172. path: 'pages/Login/clientIndex?from=appcx&id='+data.id,
  173. type: 2, //暂时用体验版
  174. webUrl: 'http://uniapp.dcloud.io'
  175. },
  176. success: ret => {
  177. console.log(JSON.stringify(ret));
  178. }
  179. });
  180. }
  181. function goUpPage() {
  182. uni.redirectTo({
  183. url: '/pages/admin/ShouYe/shouye'
  184. })
  185. }
  186. function clickAlltype() {
  187. isOpen.value = !isOpen.value;
  188. }
  189. function handleSelectStatus(item) {
  190. data.status = item.status;
  191. data.statusText = item.statusText;
  192. onRefresh();
  193. }
  194. function handleAdd() {
  195. uni.navigateTo({
  196. url: '/pages/admin/Hetong/addSanfangHetong'
  197. })
  198. }
  199. function handleDelete(item) {
  200. active.value = item;
  201. commonDialogRef.value.handleShow();
  202. }
  203. function handleDeleteConfirm() {
  204. httpApi.getSanfangDelete({
  205. id: active.value.id
  206. }).then(res => {
  207. if (res.code == 0) {
  208. uni.showToast({
  209. title: '成功'
  210. })
  211. onRefresh();
  212. } else {
  213. uni.showToast({
  214. title: '失败'
  215. })
  216. }
  217. })
  218. }
  219. function handleEditor(item) {
  220. uni.navigateTo({
  221. url: `/pages/admin/Hetong/addSanfangHetong?flag=editor&id=${item.id}`
  222. })
  223. }
  224. function handlePreview(item) {
  225. uni.navigateTo({
  226. url: `/pages/admin/Hetong/previewHetong?id=${item.id}`
  227. })
  228. }
  229. function dialogSearchBtn(opt, searchInput) {
  230. if (opt == 2) {
  231. data.khRealName = searchInput
  232. data.jzRealName = '';
  233. } else {
  234. data.khRealName = '';
  235. data.jzRealName = searchInput
  236. }
  237. onRefresh()
  238. }
  239. function dialogSearchReset() {
  240. data.jzRealName = '';
  241. data.khRealName = '';
  242. }
  243. function onScrolltolower() {
  244. getMore()
  245. }
  246. function onRefresh() {
  247. if (data.loading) return;
  248. data.page = 0;
  249. data.list = [];
  250. data.loading = true;
  251. refreshData();
  252. }
  253. function refreshData() {
  254. const opt = {
  255. jzRealName: data.jzRealName,
  256. khRealName: data.khRealName,
  257. page: data.page,
  258. size: data.size,
  259. status: data.status
  260. }
  261. data.list = [];
  262. // 数学
  263. data.state = 'loading';
  264. data.page++;
  265. opt.page = data.page;
  266. httpApi.getSanfangList(opt).then(res => {
  267. data.list = data.list.concat(res.data.data);
  268. data.loading = false;
  269. if (res.data.total > data.list.length) {
  270. data.state = 'more';
  271. } else {
  272. data.state = 'no-more';
  273. }
  274. }).catch(err => {
  275. data.state = 'more';
  276. }).finally(() => {
  277. data.loading = false;
  278. })
  279. }
  280. function getMore() {
  281. const opt = {
  282. jzRealName: data.jzRealName,
  283. khRealName: data.khRealName,
  284. page: data.page,
  285. size: data.size,
  286. status: data.status
  287. }
  288. if (data.state == 'no-more') return;
  289. data.state = 'loading';
  290. data.page++;
  291. opt.page = data.page;
  292. httpApi.getSanfangList(opt).then(res => {
  293. data.list = data.list.concat(res.data.data);
  294. data.loading = false;
  295. if (res.data.total > data.list.length) {
  296. data.state = 'more';
  297. } else {
  298. data.state = 'no-more';
  299. }
  300. }).catch(err => {
  301. data.state = 'more';
  302. }).finally(() => {
  303. data.loading = false;
  304. })
  305. }
  306. onLoad((options) => {
  307. const {
  308. from,
  309. jzName,
  310. khName
  311. } = options;
  312. if (jzName) {
  313. data.jzRealName = jzName;
  314. shenfen.value = 'jz'
  315. nextTick(() => {
  316. searchDialogRef.value.handleSetValue(jzName)
  317. })
  318. }
  319. if (khName) {
  320. data.khRealName = khName
  321. shenfen.value = 'kh'
  322. nextTick(() => {
  323. searchDialogRef.value.handleSetValue(khName)
  324. })
  325. }
  326. })
  327. onShow(() => {
  328. onRefresh()
  329. })
  330. </script>
  331. <style>
  332. </style>