From e6a02c8b09a796e436a501e9b87d19e25c34c9d1 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期日, 07 四月 2024 15:53:37 +0800
Subject: [PATCH] #

---
 pages/business/plan/plan.vue |  211 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 192 insertions(+), 19 deletions(-)

diff --git a/pages/business/plan/plan.vue b/pages/business/plan/plan.vue
index 1fb4446..2b69ffb 100644
--- a/pages/business/plan/plan.vue
+++ b/pages/business/plan/plan.vue
@@ -16,33 +16,44 @@
 				</view>
 			</block>
 		 </uni-nav-bar>
+		<!-- 鎼滅储妗� -->
 		<view class="search-bg">
-			<uni-search-bar placeholder="瀹㈡埛浠e彿/鍚嶇О" bgColor="#f4f4f4"  @confirm="search" />
+			<u-search placeholder="杈撳叆" v-model="keyword" :clearabled="true" @custom="search()" @search="search()"></u-search>
 		</view>
 		<view>
 			<!-- 瀹㈡埛鍒楄〃 -->
-			<view class="c-list" @click="getDetails(item.id)" v-for="(item,index) in csmtrList" :key="index">
-				<view class="titles">
-					<y-title :title="item.name"></y-title>
+			<view class="c-list" v-for="(item,index) in csmtrList" :key="index">
+				<view class="titles" @click="getDetails(item.id)">
+					<view style="flex: 1;">
+						<y-title :title="item.name"></y-title>
+					</view>
+					<uni-icons class="opt-icon" type="right" size="20" color="#b9b9b9"></uni-icons>
 				</view>
 				<view style="display: grid;grid-template-columns: 1fr 3fr;">
+					<view class="list-item1">ID</view><view class="list-item2">{{item.id}}</view>
 					<view class="list-item1">涓氬姟鍛�</view><view class="list-item2">{{item.userId$}}</view>
 					<view class="list-item1">涓氬姟绫诲瀷</view><view class="list-item2">{{item.planType$}}</view>
 					<view class="list-item1">瑙勫垝鍗曞彿</view><view class="list-item2">{{item.uuid}}</view>
 					<view class="list-item1">鎵�闇�</view><view class="list-item2">{{item.planNeed$}}</view>
 					<view class="list-item1">瑙勫垝鍛�</view><view class="list-item2">{{item.planner$}}</view>
-					<view class="list-item1">璺熻釜椤圭洰</view><view class="list-item2 color-main">{{item.cstmrId$}}</view>
+					<view class="list-item1">璺熻釜椤圭洰</view><view class="list-item2 color-main" 
+						@click="goDetls(item.orderId)">{{item.orderId$}}</view>
+					<view class="list-item1">鐢宠鏃ユ湡</view><view class="list-item2">{{item.appleTime$}}</view>
 					<view class="list-item1">杩涘害</view><view class="list-item2">{{item.settle$}}</view>
-					<view class="list-item1">娣诲姞鏃ユ湡</view><view class="list-item2">{{item.createTime$}}</view>
+					<view class="list-item1">鐘舵��</view><view class="list-item2">{{item.status$}}</view>
+					<view class="list-item1">淇敼浜�</view><view class="list-item2">{{item.updateBy$}}</view>
+					<view class="list-item1">鍏宠仈娴佺▼</view><view class="list-item2 color-main"
+						@click="lookAssistantPlan(item.id)">鏌ョ湅鍏宠仈娴佺▼</view>
+					<view class="list-item1">涓诲壇鏍囪</view><view class="list-item2">{{item.assistantHostSign$}}</view>
 				</view>
 			</view>
 		</view>
 		<!-- <uni-load-more :status="status" :icon-size="16" :content-text="contentText" /> -->
 		<u-empty v-if="true" icon="../../../static/image/emptyList.png" v-show="csmtrList.length <= 0" />
 		<view>
-			<!-- 鏅�氬脊绐� -->
+			<!-- 娣诲姞寮圭獥 -->
 			<uni-popup ref="popup" background-color="#fff">
-				<view class="popup-content" :class="{ 'popup-height': type === 'left' || type === 'right' }">
+				<view class="popup-content">
 					<view>
 						<button v-for="item in planType" class="button btnn" type="primary" @click="add(item.value)">{{item.name}}</button>
 					</view>
@@ -50,9 +61,47 @@
 			</uni-popup>
 		</view>
 		
+		<view>
+			<!-- 鍏宠仈娴佺▼寮圭獥 -->
+			<uni-popup ref="assistantPlan">
+				<view class="popup-bottom">
+					<view style="height: 10rpx;"></view>
+					<!-- 瀹㈡埛鍒楄〃 -->
+					<view class="c-list" v-for="(item,index) in assCsmtr" :key="index">
+						<view class="titles" @click="getDetails(item.id)">
+							<view style="flex: 1;">
+								<y-title :title="item.name"></y-title>
+							</view>
+							<uni-icons class="opt-icon" type="right" size="20" color="#b9b9b9"></uni-icons>
+						</view>
+						<view style="display: grid;grid-template-columns: 1fr 3fr;">
+							<view class="list-item1">ID</view><view class="list-item2">{{item.id}}</view>
+							<view class="list-item1">涓氬姟鍛�</view><view class="list-item2">{{item.userId$}}</view>
+							<view class="list-item1">涓氬姟绫诲瀷</view><view class="list-item2">{{item.planType$}}</view>
+							<view class="list-item1">瑙勫垝鍗曞彿</view><view class="list-item2">{{item.uuid}}</view>
+							<view class="list-item1">鎵�闇�</view><view class="list-item2">{{item.planNeed$}}</view>
+							<view class="list-item1">瑙勫垝鍛�</view><view class="list-item2">{{item.planner$}}</view>
+							<view class="list-item1">璺熻釜椤圭洰</view><view class="list-item2 color-main" 
+								@click="goDetls(item.orderId)">{{item.orderId$}}</view>
+							<view class="list-item1">鐢宠鏃ユ湡</view><view class="list-item2">{{item.appleTime$}}</view>
+							<view class="list-item1">杩涘害</view><view class="list-item2">{{item.settle$}}</view>
+							<view class="list-item1">鐘舵��</view><view class="list-item2">{{item.status$}}</view>
+							<view class="list-item1">淇敼浜�</view><view class="list-item2">{{item.updateBy$}}</view>
+							<!-- <view class="list-item1">鍏宠仈娴佺▼</view><view class="list-item2 color-main"
+								@click="lookAssistantPlan(item.id)">鏌ョ湅鍏宠仈娴佺▼</view> -->
+							<view class="list-item1">涓诲壇鏍囪</view><view class="list-item2">{{item.assistantHostSign$}}</view>
+						</view>
+					</view>
+					<view style="height: 5rpx;"></view>
+				</view>
+			</uni-popup>
+		</view>
+		
+		<view style="height: 5rpx;"></view>
 		<view class="fxbtn">
 			<uni-icons type="plusempty" color="#fff" @click="gotoggle()" ></uni-icons>
 		</view>
+		<uni-load-more :status="status" :icon-size="16" :content-text="contentText" />
 	</view>
 </template>
 
@@ -61,6 +110,7 @@
 	export default { 
 		data() {
 			return {
+				keyword: '',
 				user: {
 					username: '',
 					id: 0,
@@ -68,6 +118,7 @@
 				},
 				falg: true,
 				csmtrList: [],
+				assCsmtr: [],
 				last_id: '',
 				reload: false,
 				status: 'more',
@@ -103,7 +154,12 @@
 						name:'骞冲簱',
 						value: 6
 					},
-				]
+					{
+						name:'鍏朵粬',
+						value: 7
+					},
+				],
+				param: {curr:1,limit:4}
 			}
 		},
 		onLoad() {
@@ -121,7 +177,7 @@
 				this.getDetail()
 			}
 			setTimeout(()=> {
-				this.getCsmtr1()
+				this.getList()
 			},50)
 		},
 		onReachBottom() {
@@ -142,28 +198,40 @@
 				this.toggle('right')
 			},
 			add(val) {
-				let addPlan = 'addPlan'
+				let addPlan = 'addPlan',_this = this
 				if (val > 1) {
 					addPlan = 'addPlan' + val
 				}
 				uni.navigateTo({
 					url:'/pages/business/plan/' + addPlan,
+					success() {
+						_this.$refs.popup.close()
+					}
 				})
+				
+				
 			},
 			toggle(type) {
 				this.type = type
 				// open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦� uni-popup 缁勪欢涓婄粦瀹� type灞炴��
 				this.$refs.popup.open(type)
 			},
-			getCsmtr1(e) {
+			getList() {
 				let that = this
 				that.csmtrList = []
+				uni.showLoading()
+				if (this.user.type == 'user_id') {
+					that.param = {curr:1,limit:4,user_id: that.user.id}
+				} else if(this.user.type == 'dept_id') {
+					that.param = {curr:1,limit:4,dept_id: that.user.id}
+				} 
 				uni.request({
 					url: that.baseUrl + '/plan/page/auth',
 					header: {'token' : uni.getStorageSync('token'),},
-					data: {curr:1,limit:4,deptId:19},
+					data: that.param,
 					method:'GET',
 					success(result) {
+						console.log(result);
 						if (result.statusCode ===  404) {
 							uni.showToast({title: '璇烽噸鏂扮櫥褰�', icon: "none", position: 'top'})
 							return
@@ -194,16 +262,84 @@
 							});
 						}, 1000);
 					},
+					complete() {
+						uni.hideLoading()
+					}
+				})
+			},
+			getCsmtr1(e) {
+				let that = this
+				that.csmtrList = []
+				uni.showLoading()
+				let param = {curr:1,limit:4,dept_id: 0,user_id: 67}
+				if (this.user.type == 'user_id') {
+					param = {curr:1,limit:4,user_id: that.user.id}
+				} else if(this.user.type == 'dept_id') {
+					param = {curr:1,limit:4,dept_id: that.user.id}
+				} else {
+					param = {curr:1,limit:4}
+				}
+				param = {curr:1,limit:4}
+				uni.request({
+					url: that.baseUrl + '/plan/page/auth',
+					header: {'token' : uni.getStorageSync('token'),},
+					data: param,
+					method:'GET',
+					success(result) {
+						console.log(result);
+						if (result.statusCode ===  404) {
+							uni.showToast({title: '璇烽噸鏂扮櫥褰�', icon: "none", position: 'top'})
+							return
+						}
+						var res = result.data
+						if (res.code === 200) {
+							let list = res.data.records
+							that.csmtrList = that.reload ? list : that.csmtrList.concat(list);
+							if (res.data.records.length == 0) {
+								that.status = 'noMore'
+							}
+						} else if (res.code === 403) {
+							uni.showToast({title: res.msg, icon: "none", position: 'top'})
+							setTimeout(() => {
+								uni.reLaunch({
+									url: '../../login/login'
+								});
+							}, 1000);
+						} else {
+							uni.showToast({title: res.msg, icon: "none",position: 'top'})
+						}
+					},
+					fail(result) {
+						uni.showToast({title: '璇锋眰澶辫触'})
+						setTimeout(() => {
+							uni.reLaunch({
+								url: '../../login/login'
+							});
+						}, 1000);
+					},
+					complete() {
+						uni.hideLoading()
+					}
 				})
 			},
 			getCsmtr() {
 				let that = this
+				uni.showLoading({})
+				let param = {curr:that.curr,limit:4,dept_id: 0,user_id: 67}
+				if (this.user.type == 'user_id') {
+					param = {curr:that.curr,limit:4,user_id: that.user.id}
+				} else if(this.user.type == 'dept_id') {
+					param = {curr:that.curr,limit:4,dept_id: that.user.id}
+				} else {
+					param = {curr:that.curr,limit:4}
+				}
 				uni.request({
 					url: that.baseUrl + '/plan/page/auth',
 					header: {'token' : uni.getStorageSync('token'),},
-					data: {curr:that.curr,limit:4},
+					data: param,
 					method:'GET',
 					success(result) {
+						console.log(result);
 						if (result.statusCode ===  404) {
 							uni.showToast({title: '璇烽噸鏂扮櫥褰�', icon: "none", position: 'top'})
 							return
@@ -212,7 +348,10 @@
 						if (res.code === 200) {
 							let list = res.data.records
 							that.csmtrList = that.reload ? list : that.csmtrList.concat(list);
-							that.curr = that.curr + 1
+							console.log(list);
+							if (list.length > 0) {
+								that.curr = that.curr + 1
+							}
 							if (res.data.records.length == 0) {
 								that.status = 'noMore'
 							}
@@ -235,11 +374,39 @@
 							});
 						}, 1000);
 					},
+					complete() {
+						uni.hideLoading()
+					}
 				})
 			},
 			getDetails(id) {
 				uni.navigateTo({
 					url: '/pages/business/plan/planDetails?id=' + id
+				})
+			},
+			goDetls(id) {
+				uni.navigateTo({
+					url: '/pages/business/saleManage/saleManageDetails?id=' + id
+				})
+			},
+			lookAssistantPlan(id) {
+				let _this = this
+				uni.request({
+					url: `${_this.baseUrl}/plan/assistantPlan/view/auth`,
+					header: {'token' : uni.getStorageSync('token')},
+					data: {hostPlanId:id},
+					success(res) {
+						res = res.data 
+						if (res.code === 200) {
+							_this.assCsmtr = res.data.records
+							if (_this.assCsmtr.length > 0) {
+								_this.$refs.assistantPlan.open('bottom')
+							} else {
+								uni.showToast({title: '鏃犲叧鑱旀祦绋�', icon: "none", position: 'center'})
+							}
+							
+						}
+					}
 				})
 			},
 			// ---
@@ -267,11 +434,17 @@
 		margin-top: 20px;
 	}
 	.popup-content {
-		margin-top: 150rpx;
+		width: 60vw;
+		margin-top: 260rpx;
 		display:  flex;
 		align-items: center;
 		justify-content: center;
 		background-color: #fff;
+	}
+	.popup-bottom {
+		height: 60vh;
+		background-color: #fff;
+		border-radius: 20rpx 20rpx 0 0;
 	}
 	.popup-height {
 		display: height;
@@ -292,14 +465,13 @@
 		margin-bottom: 20px;
 	}
 	.list-item1 {
-		
-		height: 45rpx;
+		min-height: 45rpx;
 		line-height: 45rpx;
 		color: #909399;
 		text-indent: 30rpx;
 	}
 	.list-item2 {
-		height: 45rpx;
+		min-height: 45rpx;
 		line-height: 45rpx;
 		color: black;
 	}
@@ -310,6 +482,7 @@
 		padding-left: 10rpx;
 		text-indent: 5rpx;
 		margin-top: 10rpx;
+		display: flex;
 	}
 	/* .title {
 		height: 60rpx;

--
Gitblit v1.9.1