From c478bc1b36e38774cf01c02fd5e23858bd70a4a3 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期三, 29 十一月 2023 13:42:46 +0800
Subject: [PATCH] #

---
 pages/business/goBusiness/reimburseOnline.vue |  177 +++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 148 insertions(+), 29 deletions(-)

diff --git a/pages/business/goBusiness/reimburseOnline.vue b/pages/business/goBusiness/reimburseOnline.vue
index 3cdd63d..31fdb56 100644
--- a/pages/business/goBusiness/reimburseOnline.vue
+++ b/pages/business/goBusiness/reimburseOnline.vue
@@ -3,10 +3,23 @@
 		<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>
-		<!-- todo锛氭悳绱� -->
+		<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>
+						<text class="uni-nav-bar-text">{{user.username}}</text>
+					</view>
+					<uni-icons type="arrowdown" color="#333333" size="20" />
+				</view>
+			</block>
+		 </uni-nav-bar>
+		<!-- 鎼滅储妗� -->
+		<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" @click="goDetl(item)">
 				<view style="display: flex;">
@@ -22,7 +35,7 @@
 			</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>
@@ -30,16 +43,144 @@
 </template>
 
 <script>
+	import user from '@/pages/api/user/user.js'
 	export default {
 		data() {
 			return {
-				list: []
+				keyword: '',
+				user: {
+					username: '',
+					id: 0,
+					type: 'user_id'
+				},
+				falg: true,
+				list: [],
+				curr: 2,
+				reload: false,
+				status: 'more',
 			}
 		},
 		onShow() {
+			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
+			})
+			if (this.falg) {
+				this.getDetail()
+			}
+			setTimeout(()=> {
+				this.getReimburseOnline1()
+			},50)
+		},
+		onReachBottom() {
+			this.status = 'more';
 			this.getReimburseOnline()
 		},
 		methods: {
+			getReimburseOnline1() {
+				let _this = this
+				_this.list = []
+				uni.showLoading({})
+				let param = {curr:1,limit:8,dept_id: 0,user_id: 67}
+				if (_this.user.type == 'user_id') {
+					param = {curr:1,limit:8,user_id: _this.user.id}
+				} else if(_this.user.type == 'dept_id') {
+					param = {curr:1,limit:8,dept_id: _this.user.id}
+				} else {
+					param = {curr:1,limit:8}
+				}
+				uni.request({
+					url: `${_this.baseUrl}/reimburseOnline/list/auth`,
+					header: { 'token': uni.getStorageSync('token') },
+					data: param,
+					success(res) {
+						res = res.data
+						if (res.code === 200) {
+							for (let k of res.data.records) {
+								if (k.settle == 3) {
+									k['bgcolor'] = 'color: #12d489'
+								} else if (k.settle == 2) {
+									k['bgcolor'] = 'color: #ffbd67'
+								}
+							}
+							let list = res.data.records
+							_this.list = _this.reload ? list : _this.list.concat(list);
+							if (res.data.records.length == 0) {
+								_this.status = 'noMore'
+							}
+						}
+					},
+					fail(result) {
+						uni.showToast({title: '璇锋眰澶辫触'})
+						setTimeout(() => {
+							uni.reLaunch({
+								url: '../../login/login'
+							});
+						}, 1000);
+					},
+					complete() {
+						uni.hideLoading()
+					}
+				})
+			},
+			getReimburseOnline() {
+				let _this = this
+				uni.showLoading({})
+				let param = {curr:_this.curr,limit:8,dept_id: 0,user_id: 67}
+				if (this.user.type == 'user_id') {
+					param = {curr:_this.curr,limit:8,user_id: _this.user.id}
+				} else if(this.user.type == 'dept_id') {
+					param = {curr:_this.curr,limit:8,dept_id: _this.user.id}
+				} else {
+					param = {curr:_this.curr,limit:8}
+				}
+				uni.request({
+					url: `${_this.baseUrl}/reimburseOnline/list/auth`,
+					header: { 'token': uni.getStorageSync('token') },
+					data: param,
+					success(res) {
+						res = res.data
+						if (res.code === 200) {
+							for (let k of res.data.records) {
+								if (k.settle == 3) {
+									k['bgcolor'] = 'color: #12d489'
+								} else if (k.settle == 2) {
+									k['bgcolor'] = 'color: #ffbd67'
+								}
+							}
+							let list = res.data.records
+							_this.list = _this.reload ? list : _this.list.concat(list);
+							_this.curr = _this.curr + 1
+							if (res.data.records.length == 0) {
+								_this.status = 'noMore'
+							}
+						}
+					},
+					fail(result) {
+						uni.showToast({title: '璇锋眰澶辫触'})
+						setTimeout(() => {
+							uni.reLaunch({
+								url: '../../login/login'
+							});
+						}, 1000);
+					},
+					complete() {
+						uni.hideLoading()
+					}
+				})
+			},
+			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)
+				}
+			},
 			add() {
 				uni.navigateTo({
 					url: '/pages/business/goBusiness/modiReimburseOnlineDetl',
@@ -51,35 +192,13 @@
 				})
 			},
 			goDetl(e) {
-				console.log(e);
+				// console.log(e);
 				uni.navigateTo({
 					url: '/pages/business/goBusiness/reimburseOnlineDetl',
 					success: function(res) {
 						res.eventChannel.emit('busunessDetl', {
 							data: e
 						})
-					}
-				})
-			},
-			getReimburseOnline() {
-				let _this = this
-				uni.request({
-					url: `${_this.baseUrl}/reimburseOnline/list/auth`,
-					header: { 'token': uni.getStorageSync('token') },
-					success(res) {
-						res = res.data
-						if (res.code === 200) {
-							for (let k of res.data.records) {
-								if (k.settle == 3) {
-									k['bgcolor'] = 'color: #12d489'
-								} else if (k.settle == 2) {
-									k['bgcolor'] = 'color: #ffbd67'
-								}
-							}
-							_this.list = res.data.records
-							console.log(_this.list);
-						}
-						// _this.list = 
 					}
 				})
 			},

--
Gitblit v1.9.1