xiaofeijilu.vue 4.2 KB
<template>
	<view class="box">
		<view class="kindnav">

			<view class="kindnav_item" :class="currentTab==1?'kindactive':''" @click="navbarTap" data-id="1">数板
			</view>

			<view class="kindnav_item" :class="currentTab==2?'kindactive':''" @click="navbarTap" data-id="2">数管</view>
		</view>

		<view class="nodata" v-if="xiaofeilist.length==0">暂无数据</view>

		<view class="xiaofeilist" v-if="currentTab==1">
			<view class="xiaofeiitem" v-for="(item,index) in xiaofeilist" :key="index" @click="xiaofeijilushuban" :data-id="item.id">
				<view class="xfitemleft">
					<view class="ordernum">订单号:{{item.order_sn}}</view>
					<view class="orderword">{{item.recharge}}</view>
				</view>
				<view class="orderright">
					<view class="ordertime">
						<view class="ordertimetop">{{item.createtime}} </view>
						<view class="ordertimebottom">¥{{item.pay_money}}</view>
					</view>
					<view class="orderrow">
						<image src="/static/img/rowright.png"></image>
					</view>
				</view>
			</view>
			
		</view>
		<view class="xiaofeilist" v-if="currentTab==2">
			<view class="xiaofeiitem" v-for="(item,index) in xiaofeilist" :key="index" @click="xiaofeijilushuguan" :data-id="item.id">
				<view class="xfitemleft">
					<view class="ordernum">订单号:{{item.order_sn}}</view>
					<view class="orderword">{{item.recharge}}</view>
				</view>
				<view class="orderright">
					<view class="ordertime">
						<view class="ordertimetop">{{item.createtime}} </view>
						<view class="ordertimebottom">¥{{item.pay_money}}</view>
					</view>
					<view class="orderrow">
						<image src="/static/img/rowright.png"></image>
					</view>
				</view>
			</view>
			
		</view>


	</view>
</template>

<script>
	import app from "../../App.vue"
	export default {
		data() {
			return {
				xiaofeilist: [],
				currentTab: 1,
				page: 1,
				type: 1,
			}
		},
		methods: {
			//获取消费记录
			getxiaofilist() {
				let param = {
					page: this.page,
					type: this.type
				}
				app.post("api/person/payRecordDetail", param, 'get')
					.then(res => {
						console.log(res);
						this.xiaofeilist = this.xiaofeilist.concat(res)

					})
					.catch(err => {});
			},
			// 消费记录切换
			navbarTap(e) {
				console.log(e)
				let id = e.currentTarget.dataset.id;
				this.currentTab = id;
				this.page = 1;
				this.xiaofeilist = [],
					this.page = 1
				if (id == 1) {
					this.type = 1
				} else {
					this.type = 2
				}
				this.getxiaofilist()
			},
			//消费记录详情
			xiaofeijilushuban(e) {
				let id = e.currentTarget.dataset.id;
				console.log(id)
				uni.navigateTo({
					url: '/pages/dingdanxiangqing/dingdanxiangqing?id=' + id + '&type=' + 0
				})
			},
			xiaofeijilushuguan(e) {
				let id = e.currentTarget.dataset.id;
				console.log(id)
				uni.navigateTo({
					url: '/pages/dingdanxiangqing/dingdanxiangqing?id=' + id + '&type=' + 1
				})
			}
		},
		mounted() {
			this.page = 1;
			this.xiaofeilist = [];
			this.getxiaofilist();

		},
		onReachBottom() {
			let newpage = this.page;
			newpage++;
			this.page = newpage;
			this.getxiaofilist()
		},
	}
</script>

<style>
	.xiaofeiitem {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 36rpx 32rpx;
		box-sizing: border-box;
		background: #fff;
	}

	.xiaofeilist {
		width: 750rpx;

		box-sizing: border-box;
	}

	.ordernum {
		color: #0A0808;
		font-size: 28rpx;
	}

	.orderword {
		color: #7F8389;
		font-size: 26rpx;
		margin-top: 22rpx
	}

	.orderright {
		display: flex;
		align-items: center;
	}

	.ordertimetop {
		color: #7F8389;
		font-size: 26rpx;
	}

	.ordertimebottom {
		color: #F29600;
		font-size: 26rpx;
		margin-top: 22rpx
	}

	.orderrow {
		width: 48rpx;
		height: 48rpx;
		font-size: 0;
		margin-left: 0rpx;
	}

	.kindnav {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 20rpx 158rpx;
		box-sizing: border-box;
		background: #fff;
	}

	.kindnav_item {
		color: #7F8389;
		font-size: 30rpx;
	}

	.kindactive {
		color: #F29600;
		position: relative
	}

	.kindactive::after {
		display: block;
		content: '';
		width: 48rpx;
		height: 6rpx;
		background: #F29600;
		position: absolute;
		left: 50%;
		right: 50%;
		transform: translate(-50%, -50%);
		bottom: -20rpx;
	}
</style>