accountDetail.vue 3.5 KB
<template>
	<view>
		<view class="tabList">
			<view class="tabItem" :class="{active:tabIndex == 0}" @click="changeTab(0)">
				全部
			</view>
			<view class="tabItem" :class="{active:tabIndex == 1}" @click="changeTab(1)">
				充值
			</view>
			<view class="tabItem" :class="{active:tabIndex == 2}" @click="changeTab(2)">
				提现
			</view>
			<view class="line" :style="{left:60 + 210 * tabIndex + 105 - 40 + 'rpx'}"></view>
		</view>
		<view style="height: 88rpx;"></view>
		<view class="detailListWrap">
			<view class="detailItem" v-for="(item,index) in list" :key="index">
				<view class="detailLeft">
					<view class="detailTime">
						{{item.createtime}}
					</view>
					<view class="detailDesc">
						{{item.text}}
						<!-- {{
							item.type == '1' ? '余额充值' : 
							item.type == '2' ? '预约服务' : 
							item.type == '3' ? '尾款支付' : 
							item.type == '4' ? '送礼物' :
							item.type == '5' ? '问野币充值' :
							item.type == '6' ? '礼物收益' :
							item.type == '7' ? '预约收益' :
							item.type == '8' ? '预约退款' :
							item.type == '9' ? '礼物收益提现' : '预约收益提现'
						}} -->
					</view>
				</view>
				<!-- 类型:1=余额充值,2=预约服务,3=尾款支付,4=送礼物,5=问野币充值,6=礼物收益,7=预约收益,8=预约退款,9=礼物收益提现,10=预约收益提现 -->
				<text><!-- {{item.type == '1' || item.type == '5' || item.type == '6' || item.type == '7' || item.type == '9' || item.type == '10' ? '-' : '+'}} -->{{item.money}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				last_page:0,
				current_page:1,
				param:{
					type:'1',//1=账户明细全部,2=充值,3=提现,4=收到礼物,5=送出礼物
					page:1,
					per_page:15
				},
				tabIndex:0,
				list:[]
			}
		},
		onShow() {
			this.param.page = 1
			this.last_page = 0
			this.current_page = 1
			this.list = []
			this.getData()
		},
		onReachBottom(){
			console.log('滑动到底部了')
			if(this.current_page == this.last_page){
				uni.showToast({
					title:'无更多数据',
					icon:'none'
				})
			}else{
				this.param.page++
				this.getData()
			}
		},
		methods:{
			getData(){
				this.$request('/wallet/getDetailedList',this.param).then((res)=>{
					this.last_page = res.data.last_page
					this.current_page = res.data.current_page
					this.list = this.list.concat(res.data.data)
				})
			},
			changeTab(index){
				this.param.page = 1
				this.last_page = 0
				this.current_page = 1
				this.list = []
				this.tabIndex = index
				this.param.type = index == 0 ? '1' : index == 1 ? '2' : '3'
				this.getData()
			}
		}
	}
</script>

<style lang="scss" scoped>
	page{background: #f8f8f9;}
	.tabList{
		position: fixed;
		width: 100%;
		height: 88rpx;
		border-top: 2rpx solid rgba(25,24,51,0.06);
		top: 0;
		padding: 0 60rpx;
		display: flex;
		color: #969799;
		font-size: 28rpx;
		background: #fff;
		z-index: 1;
		.tabItem{
			width: 210rpx;
			text-align: center;
			line-height: 88rpx;
		}
		.tabItem.active{
			color: #35655f;
		}
		.line{
			position: absolute;
			bottom: 0;
			width: 80rpx;
			height: 6rpx;
			background: #35655f;
			border-radius: 4rpx;
			transition: 0.5s;
		}
	}
	.detailListWrap{
		padding: 0 32rpx;
		.detailItem{
			height: 130rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			text{font-size: 28rpx;}
			.detailLeft{
				.detailTime{
					color: rgba(25,24,51,0.25);
					font-size: 24rpx;
				}
				.detailDesc{
					font-size: 28rpx;
				}
			}
		}
	}
</style>