From 3913b3c5c8cde03f8c92d1c738d28c4a9bae7e55 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期三, 22 十一月 2023 08:48:02 +0800
Subject: [PATCH] #

---
 pages/business/goBusiness/goBusiness.vue |  176 ++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 103 insertions(+), 73 deletions(-)

diff --git a/pages/business/goBusiness/goBusiness.vue b/pages/business/goBusiness/goBusiness.vue
index c4f7af3..5e4aa80 100644
--- a/pages/business/goBusiness/goBusiness.vue
+++ b/pages/business/goBusiness/goBusiness.vue
@@ -3,9 +3,8 @@
 		<view class="status_bar">
 			<!-- 杩欓噷鏄姸鎬佹爮 -->
 		</view>
-		<uni-nav-bar left-icon="left" title="鍑哄樊" @clickLeft="back" @clickRight="scan" :fixed="true"
-			:border="false" rightWidth="160rpx" leftWidth="160rpx"
-			>
+		<uni-nav-bar left-icon="left" title="鍑哄樊" @clickLeft="back" @clickRight="scan" :fixed="true" :border="false"
+			rightWidth="160rpx" leftWidth="160rpx">
 			<block slot="right">
 				<view class="city">
 					<view>
@@ -15,27 +14,20 @@
 				</view>
 			</block>
 		</uni-nav-bar>
-		<!-- <view class="main-box">
-			<view class="box" v-for="item in list">
-				<view class="box-single-row flex-row" v-for="rule in listRule"> 
-					<view style="flex: 1;">{{rule.label}}</view>
-					<view style="flex: 4;">{{item[rule.attribute]}}</view>
-				</view>
-			</view>
-		</view> -->
 		
+		<!-- 鎼滅储妗� -->
+		<view class="search-bg">
+			<u-search placeholder="杈撳叆" v-model="keyword" :clearabled="true" @custom="search()" @search="search()"></u-search>
+		</view>
+
 		<view class="main-box">
-			<view class="box" v-for="item in list">
-				<!-- <view class="box-flag" >{{item.settle$}}</view> -->
+			<view class="box" v-for="item in list" @click="goDetl(item)">
 				<view style="display: flex;">
 					<view class="box-title" style="flex: 1;">{{item.userId$}}鎻愪氦鐨勫嚭宸敵璇�</view>
 					<view class="box-time">{{item.createTime$.substring(0,10)}}</view>
 				</view>
-				
 				<view class="box-item">鍑哄樊浜嬬敱:{{item.businessTripReasons}}</view>
 				<view class="box-item">鍑哄樊澶╂暟:{{item.businessTripDays$}}</view>
-				<!-- <view class="box-item">鍚岃浜�:{{item.businessPeers}}</view> -->
-				
 				<view style="display: flex;">
 					<view class="box-item" style="flex: 1;">鍚岃浜�:{{item.businessPeers}}</view>
 					<view class="box-settle" :style="item.bgcolor">{{item.settle$}}</view>
@@ -43,48 +35,29 @@
 			</view>
 		</view>
 		
+		<u-empty v-if="true" icon="../../../static/image/emptyList.png" v-show="list.length <= 0" />
+		<view class="fxbtn">
+			<uni-icons type="plusempty" color="#fff" @click="add()" ></uni-icons>
+		</view>
+
 		<!-- 鍨簳 -->
 		<view style="height: 120rpx;"></view>
 	</view>
 </template>
 
 <script>
+	import user from '@/pages/api/user/user.js'
 	export default {
 		data() {
 			return {
+				keyword: '',
 				user: {
-					username: '鏉ㄦ垚寮�',
+					username: '',
 					id: 0,
 					type: ''
 				},
-				listRule: [
-					{
-						label: "鍑哄彂鏃ユ湡",
-						attribute: "businessStartTimeDay$",
-					},
-					{
-						label: "缁撴潫鏃ユ湡",
-						attribute: "businessEndTimeDay$",
-					},
-					{
-						label: "鐢宠浜�",
-						attribute: "userId$",
-					},
-					{
-						label: "杩涘害",
-						attribute: "settle$",
-					},
-					{
-						label: "鍑哄樊澶囨敞",
-						attribute: "businessNotes",
-					},
-					{
-						label: "鍑哄樊浜嬬敱",
-						attribute: "businessTripReasons",
-					},
-				],
-				list: [
-					{
+				falg: true,
+				list: [{
 						businessTripReasons: '娌熼�氱珛搴撲簨瀹�',
 						businessTransportation$: '浜ら�氬伐鍏�',
 						businessStartAddr$: '鍑哄彂鍦�',
@@ -104,23 +77,64 @@
 						createTime$: '2023-11-06 08:51:24',
 						bgcolor: 'color:#24ab59'
 					},
-					
 				]
 			}
 		},
 		onShow() {
-			this.getBusinessTrip()
+			let that = this
+			uni.$on('isRefresh',function(data){
+				that.user.username = data.title
+				that.user.id = data.id
+				that.user.type = data.key
+				that.falg = false
+			})
+			setTimeout(()=> {
+				this.getBusinessTrip()
+			},50)
+			if (this.falg) {
+				this.getDetail()
+			}
 		},
 		methods: {
+			async getDetail() {
+				let res = await user.getDetail()
+				if (res.code === 200) {
+					this.user.username = res.data.username
+					this.user.id = res.data.id
+				} else if (res.code === 403) {
+					this.backLogin(res)
+				}
+			},
+			goDetl(e) {
+				uni.navigateTo({
+					url: '/pages/business/goBusiness/goBusinessDetil',
+					success: function(res) {
+						res.eventChannel.emit('busunessDetl', {
+							data: e
+						})
+					}
+				})
+			},
 			getBusinessTrip() {
 				let _this = this
+				let param = {curr:1,limit:16,dept_id: 0,user_id: 67}
+				if (_this.user.type == 'user_id') {
+					param = {curr:1,limit:16,user_id: _this.user.id}
+				} else if(_this.user.type == 'dept_id') {
+					param = {curr:1,limit:16,dept_id: _this.user.id}
+				} else {
+					param = {curr:1,limit:16}
+				}
 				uni.request({
 					url: `${_this.baseUrl}/businessTrip/list/auth`,
-					header: {'token' : uni.getStorageSync('token')},
+					header: {
+						'token': uni.getStorageSync('token')
+					},
+					data: param,
 					success(res) {
 						res = res.data
 						if (res.code === 200) {
-							for(let k of res.data.records) {
+							for (let k of res.data.records) {
 								if (k.settle == 2) {
 									k['bgcolor'] = 'color: #12d489'
 								} else if (k.settle == 1) {
@@ -133,9 +147,19 @@
 					}
 				})
 			},
-			back() {
-				uni.navigateBack({
+			// 鍑哄樊鐢宠
+			add() {
+				uni.navigateTo({
+					url: '/pages/business/goBusiness/addgoBusiness',
+					success: function(res) {
+						res.eventChannel.emit('goBusinessDel', {
+							data: 'add'
+						})
+					}
 				})
+			},
+			back() {
+				uni.navigateBack({})
 			},
 			scan() {
 				uni.navigateTo({
@@ -150,16 +174,19 @@
 	.flex-row {
 		display: flex;
 	}
+
 	.flex-col {
 		display: flex;
 		flex-direction: column;
 	}
+
 	.main-box {
 		/* margin: 16rpx; */
 		/* background-color: #FFF; */
 		border-radius: 20rpx;
 		padding: 8rpx;
 	}
+
 	.box {
 		margin: 16rpx 8rpx;
 		/* height: 200px; */
@@ -171,51 +198,54 @@
 		font-size: 24rpx;
 		color: #bdbdbd;
 	}
+
 	.box-flag {
 		position: absolute;
 		right: 0;
-		top:10rpx;
+		top: 10rpx;
 		background-color: #74B9E9;
 		padding: 6rpx;
 		font-size: 10rpx;
 		color: #FFF;
 	}
+
 	.box-time {
 		color: #bdbdbd;
 	}
-	.box-settle{
+
+	.box-settle {
 		font-size: 26rpx;
 		/* font-weight: bold; */
 	}
+
 	.box-title {
 		font-size: 28rpx;
 		font-weight: bold;
 		color: #000;
 	}
-	.box-single-row {
-		
-	}
+
+	.box-single-row {}
 </style>
 
 
 
 
 list: [
-	{
-		businessTripReasons: '娌熼�氱珛搴撲簨瀹�',
-		businessTransportation$: '浜ら�氬伐鍏�',
-		businessStartAddr$: '鍑哄彂鍦�',
-		businessEndAddr$: '鐩殑鍦�',
-		businessStartTimeDay$: '鍑哄彂鏃ユ湡',
-		businessEndTimeDay$: '缁撴潫鏃ユ湡',
-		businessDuration$: '鍑哄樊鏃堕暱',
-		businessTripDays$: '鍑哄樊澶╂暟',
-		businessPeers: '鍚岃浜�',
-		userId$: '鐢宠浜�',
-		orderId: '璺熻釜椤圭洰',
-		updateTime$: '鏇存柊鏃堕棿',
-		updateId$: '鏇存柊浜哄憳',
-		settle$: '杩涘害',
-		businessNotes: '鍑哄樊澶囨敞',
-	},
+{
+businessTripReasons: '娌熼�氱珛搴撲簨瀹�',
+businessTransportation$: '浜ら�氬伐鍏�',
+businessStartAddr$: '鍑哄彂鍦�',
+businessEndAddr$: '鐩殑鍦�',
+businessStartTimeDay$: '鍑哄彂鏃ユ湡',
+businessEndTimeDay$: '缁撴潫鏃ユ湡',
+businessDuration$: '鍑哄樊鏃堕暱',
+businessTripDays$: '鍑哄樊澶╂暟',
+businessPeers: '鍚岃浜�',
+userId$: '鐢宠浜�',
+orderId: '璺熻釜椤圭洰',
+updateTime$: '鏇存柊鏃堕棿',
+updateId$: '鏇存柊浜哄憳',
+settle$: '杩涘害',
+businessNotes: '鍑哄樊澶囨敞',
+},
 ]
\ No newline at end of file

--
Gitblit v1.9.1