Browse Source

客户页面

wangxy 1 tháng trước cách đây
mục cha
commit
30de545b25

+ 62 - 42
pages/admin/Hetong/addSanfangHetong.vue

@@ -39,8 +39,10 @@
 		</view>
 
 		<view class="sfht-info-btn-box">
-      <button type="default" class="phone-green-btn" @click="handleAdd" v-if="data.type == 'addHetong'">创建合同</button>
-      <button type="default" class="phone-green-btn" @click="handleUpdate" v-if="data.type == 'editorHetong'">更新合同</button>
+			<button type="default" class="phone-green-btn" @click="handleAdd"
+				v-if="data.type == 'addHetong'">创建合同</button>
+			<button type="default" class="phone-green-btn" @click="handleUpdate"
+				v-if="data.type == 'editorHetong'">更新合同</button>
 		</view>
 	</view>
 </template>
@@ -52,7 +54,8 @@
 		nextTick
 	} from "vue";
 	import {
-		onLoad
+		onLoad,
+		onShow
 	} from "@dcloudio/uni-app";
 	import * as httpApi from "@/api/sanfang.js"
 
@@ -66,7 +69,9 @@
 	import {
 		useHetong
 	} from "./useHetong.js"
-  import {getSanfangInfo} from "../../../api/sanfang";
+	import {
+		getSanfangInfo
+	} from "../../../api/sanfang";
 
 	const {
 		provideHetong
@@ -116,11 +121,11 @@
 			shentizhuangkuang: 1, // 身体状态,1 能自理 ,2半自理, 3不能自理
 			beizhu: '', // 备注
 			qianming: '',
-      id: null
+			id: null
 		},
-    type: null
+		type: null
 	})
-	
+
 	const commonDialogRef = ref(null)
 
 	// 穿透式传参
@@ -157,8 +162,11 @@
 	}
 
 	function handleAdd() {
-		const opt = Object.assign({}, {...data.hetong,htId:data.mobanList[data.mobanIndex].id })
-		
+		const opt = Object.assign({}, {
+			...data.hetong,
+			htId: data.mobanList[data.mobanIndex].id
+		})
+
 		httpApi.getSanfangAdd(opt).then(res => {
 			if (res.data) {
 				uni.showToast({
@@ -171,20 +179,23 @@
 		})
 	}
 
-  function handleUpdate() {
-    const opt = Object.assign({}, {...data.hetong,htId:data.mobanList[data.mobanIndex].id })
-    httpApi.getSanfangUpdate(opt).then(res => {
-      if (res.data) {
-        uni.showToast({
-          title: "创建成功",
-          success() {
-            uni.navigateBack()
-          }
-        })
-      }
-    })
-  }
-	
+	function handleUpdate() {
+		const opt = Object.assign({}, {
+			...data.hetong,
+			htId: data.mobanList[data.mobanIndex].id
+		})
+		httpApi.getSanfangUpdate(opt).then(res => {
+			if (res.data) {
+				uni.showToast({
+					title: "创建成功",
+					success() {
+						uni.navigateBack()
+					}
+				})
+			}
+		})
+	}
+
 	function handleConfirm() {
 		uni.redirectTo({
 			url: '/pages/admin/my/jzInfo' // 跳转完善
@@ -193,27 +204,36 @@
 
 	onLoad((option) => {
 
-    const { flag, id } = option;
-
-    if (flag) {
-      data.type = 'editorHetong'
-      getMoban().then(() => {
-        httpApi.getSanfangInfo({id}).then(res => {
-          Object.assign(data.hetong,res.data)
-        })
-      })
-    } else {
-      data.type = 'addHetong'
-      httpApi.getSanfangCheck().then(res => {
-        if (res.data) {
-          getMoban();
-        } else {
-          commonDialogRef.value.handleShow()
-        }
-      })
-    }
+		const {
+			flag,
+			id
+		} = option;
 
+		if (flag) {
+			data.type = 'editorHetong'
+		} else {
+			data.type = 'addHetong'
+		}
+	})
 
+	onShow(() => {
+		if (data.type == 'editorHetong') {
+			getMoban().then(() => {
+				httpApi.getSanfangInfo({
+					id
+				}).then(res => {
+					Object.assign(data.hetong, res.data)
+				})
+			})
+		} else {
+			httpApi.getSanfangCheck().then(res => {
+				if (res.data) {
+					getMoban();
+				} else {
+					commonDialogRef.value.handleShow()
+				}
+			})
+		}
 	})
 </script>
 

+ 1 - 1
pages/admin/Hetong/components/jiawuItem.vue

@@ -11,7 +11,7 @@
 			<uni-easyinput v-model="data.hetong.mianji" placeholder="请输入住房面积" />
 		</view>
 		<view class="fwnr-label-input">
-			<view class="fwnr-form-label"><text class="form-label-require">*</text>常驻人口</view>
+			<view class="fwnr-form-label"><text class="form-label-require"></text>常驻人口</view>
 			<uni-easyinput v-model="data.hetong.renkou" placeholder="请输入常驻人口" />
 		</view>
 	</view>

+ 91 - 74
pages/admin/Hetong/sanfangHetong.vue

@@ -40,42 +40,55 @@
 				<uni-list class="sfht-scroll-view">
 					<uni-list-item v-for="item in data.list" class="sfht-list-item-box">
 						<template v-slot:body>
-              <view class="sfht-card-box" >
-                <view class="card-head-row" >
-                  <view @click="handleDelete(item)" class="del-btn-box"><icon class="del-btn"></icon></view>
-                  <button type="default" class="phone-green-btn ht-head-btn">推送</button>
-                  <button type="default" class="phone-green-btn ht-head-btn" @click.stop="handlePreview(item)">预览</button>
-				  <button type="default" class="phone-white-btn ht-head-btn"
-				  	@click.stop="handleEditor(item)">编辑</button>
-                </view>
-                <view class="card-body-row">
-                  <view class="body-row">
-                    <view class="title-text"><icon class="user-icon"></icon>家政人员名称</view>
-                    <view class="value-text">{{item.realName}}</view>
-                  </view>
-                  <view class="body-row">
-                    <view class="title-text"><icon class="idcard-icon"></icon>客户名称</view>
-                    <view class="value-text">{{item.khName}}</view>
-                  </view>
-                </view>
-                <view class="card-body-row">
-                  <view class="body-row">
-                    <view class="title-text"><icon class="date-icon"></icon>合同开始时间</view>
-                    <view class="value-text">{{item.startDate}}</view>
-                  </view>
-                  <view class="body-row">
-                    <view class="title-text"><icon class="date-icon"></icon>合同结束时间</view>
-                    <view class="value-text">{{item.endDate}}</view>
-                  </view>
-                  <view class="body-row">
-                    <view class="title-text"><icon class="htzt-icon"></icon>合同状态</view>
-                    <view class="status-0" v-if="item.status== 0">待签字</view>
-                    <view class="status-1" v-if="item.status== 1">待审核</view>
-                    <view class="status-2" v-if="item.status== 2">有效</view>
-                    <view class="status-3" v-if="item.status== 3">失效</view>
-                  </view>
-                </view>
-              </view>
+							<view class="sfht-card-box">
+								<view class="card-head-row">
+									<view @click="handleDelete(item)" class="del-btn-box">
+										<icon class="del-btn"></icon>
+									</view>
+									<button type="default" class="phone-green-btn ht-head-btn">推送</button>
+									<button type="default" class="phone-green-btn ht-head-btn"
+										@click.stop="handlePreview(item)">预览</button>
+									<button type="default" class="phone-white-btn ht-head-btn"
+										@click.stop="handleEditor(item)">编辑</button>
+								</view>
+								<view class="card-body-row">
+									<view class="body-row">
+										<view class="title-text">
+											<icon class="user-icon"></icon>家政人员名称
+										</view>
+										<view class="value-text">{{item.realName}}</view>
+									</view>
+									<view class="body-row">
+										<view class="title-text">
+											<icon class="idcard-icon"></icon>客户名称
+										</view>
+										<view class="value-text">{{item.khName}}</view>
+									</view>
+								</view>
+								<view class="card-body-row">
+									<view class="body-row">
+										<view class="title-text">
+											<icon class="date-icon"></icon>合同开始时间
+										</view>
+										<view class="value-text">{{item.startDate}}</view>
+									</view>
+									<view class="body-row">
+										<view class="title-text">
+											<icon class="date-icon"></icon>合同结束时间
+										</view>
+										<view class="value-text">{{item.endDate}}</view>
+									</view>
+									<view class="body-row">
+										<view class="title-text">
+											<icon class="htzt-icon"></icon>合同状态
+										</view>
+										<view class="status-0" v-if="item.status== 0">待签字</view>
+										<view class="status-1" v-if="item.status== 1">待审核</view>
+										<view class="status-2" v-if="item.status== 2">有效</view>
+										<view class="status-3" v-if="item.status== 3">失效</view>
+									</view>
+								</view>
+							</view>
 						</template>
 					</uni-list-item>
 					<uni-load-more :status="data.state" @click="getMore(0)"
@@ -84,9 +97,9 @@
 			</scroll-view>
 		</view>
 
-    <!-- 删除子账号 -->
-    <common-dialog ref="commonDialogRef" title="删除确认" content="你确定要执行这个操作吗"
-                   @confirm-btn="handleDeleteConfirm"></common-dialog>
+		<!-- 删除子账号 -->
+		<common-dialog ref="commonDialogRef" title="删除确认" content="你确定要执行这个操作吗"
+			@confirm-btn="handleDeleteConfirm"></common-dialog>
 
 		<customTabbarAdminVue :current-tab="1"></customTabbarAdminVue>
 
@@ -106,11 +119,13 @@
 	import * as httpApi from "@/api/sanfang.js"
 	import searchDialog from "./components/search.vue";
 	import customTabbarAdminVue from "@/components/custom-tabbar/custom-tabbar-admin.vue";
-  import commonDialog from '@/components/dialog/commonDialog.vue';
-  import {getSanfangDelete} from "../../../api/sanfang";
+	import commonDialog from '@/components/dialog/commonDialog.vue';
+	import {
+		getSanfangDelete
+	} from "../../../api/sanfang";
 
 	const searchDialogRef = ref(null);
-  const commonDialogRef = ref(null)
+	const commonDialogRef = ref(null)
 	const data = reactive({
 		status: 0,
 		statusText: '待签字',
@@ -124,7 +139,7 @@
 	})
 	const isOpen = ref(false)
 
-  const active = ref(null);
+	const active = ref(null);
 
 	const listStatus = ref([{
 			statusText: '有效',
@@ -171,37 +186,39 @@
 		})
 	}
 
-  function handleDelete(item) {
-    active.value = item;
-    commonDialogRef.value.handleShow();
-  }
-
-  function handleDeleteConfirm() {
-    httpApi.getSanfangDelete({id: active.value.id}).then(res => {
-      if (res.code == 0) {
-        uni.showToast({
-          title: '成功'
-        })
-        onRefresh();
-      } else {
-        uni.showToast({
-          title: '失败'
-        })
-      }
-    })
-  }
-
-  function handleEditor(item) {
-    uni.navigateTo({
-      url: `/pages/admin/Hetong/addSanfangHetong?flag=editor&id=${item.id}`
-    })
-  }
-
-  function handlePreview(item) {
-    uni.navigateTo({
-      url: `/pages/admin/Hetong/previewHetong?id=${item.id}`
-    })
-  }
+	function handleDelete(item) {
+		active.value = item;
+		commonDialogRef.value.handleShow();
+	}
+
+	function handleDeleteConfirm() {
+		httpApi.getSanfangDelete({
+			id: active.value.id
+		}).then(res => {
+			if (res.code == 0) {
+				uni.showToast({
+					title: '成功'
+				})
+				onRefresh();
+			} else {
+				uni.showToast({
+					title: '失败'
+				})
+			}
+		})
+	}
+
+	function handleEditor(item) {
+		uni.navigateTo({
+			url: `/pages/admin/Hetong/addSanfangHetong?flag=editor&id=${item.id}`
+		})
+	}
+
+	function handlePreview(item) {
+		uni.navigateTo({
+			url: `/pages/admin/Hetong/previewHetong?id=${item.id}`
+		})
+	}
 
 	function dialogSearchBtn(opt, searchInput) {
 		if (opt == 2) {