<template>
	<view class="page">
		<!-- #ifdef H5-->
		<uni-nav-bar  v-if="!$isWxBrowser()" :fixed="true" background-color="#FFE05C" :border="false" :statusBar="false"  left-icon="left" title="收益记录" @clickLeft="back" />
		<!-- #endif -->

		<view class="flex-col statistics">
			<view class="flex-row grid">
				<view class="flex-col gridItem">
					<view  class="title flex-row justify-center">
						<text>累计奖励</text>
					</view>
					<view class="number flex-row justify-center">
						<text>{{withdrawStaticsData.totalIncome}}</text>
					</view>
				</view>
				<view class="flex-col gridItem leftBorder">
					<view  class="title flex-row justify-center">
						<text>累计提现</text>
					</view>
					<view class="number flex-row justify-center">
						<text>{{withdrawStaticsData.totalWithdraw}}</text>
					</view>
				</view>
				<view class="flex-col gridItem leftBorder">
					<view  class="title flex-row justify-center">
						<text>可提现</text>
					</view>
					<view class="number flex-row justify-center">
						<text>{{withdrawStaticsData.canWithdraw}}</text>
					</view>
				</view>
			</view>
			<view class="flex-row justify-center">
				<view class="flex-row justify-center tixian" @click="navigateTo('/pages/withdraw/withdraw')">
					<text>去提现</text>
					<u-icon name="arrow-right" color="#000" size="14"></u-icon>
				</view>
			</view>

		</view>
		<view class="flex-row grid1">
			<view class="flex-col justify-evenly gridItem1">
				<view  class="title flex-row justify-center">
					<text>累计拓客</text>
				</view>
				<view class="number1 flex-row justify-center">
					<text>{{expandAppTotalData.totalExpand}}</text>
				</view>
			</view>
			<view class="flex-col justify-evenly gridItem1 leftBorder1">
				<view  class="title flex-row justify-center">
					<text>用券人数</text>
				</view>
				<view class="number1 flex-row justify-center">
					<text>{{expandAppTotalData.useCouponTotal}}</text>
				</view>
			</view>
			<view class="flex-col justify-evenly gridItem1 leftBorder1">
				<view  class="title flex-row justify-center">
					<text>充值人数</text>
				</view>
				<view class="number1 flex-row justify-center">
					<text>{{expandAppTotalData.rechargeTotal}}</text>
				</view>
			</view>
			<view class="flex-col  justify-evenly gridItem1 leftBorder1">
				<view  class="title flex-row justify-center">
					<text>消费次数累计</text>
				</view>
				<view class="number1 flex-row justify-center">
					<text>{{expandAppTotalData.consume}}</text>
				</view>
			</view>
		</view>

		<view class="title-h1">
			<text>拓客数据(今日)</text>
		</view>
		<view class="flex-row grid1">
			<view class="flex-col justify-evenly gridItem1">
				<view  class="title flex-row justify-center">
					<text>累计拓客</text>
				</view>
				<view class="number1 flex-row justify-center">
					<text>{{expandAppTodayData.totalExpand}}</text>
				</view>
			</view>
			<view class="flex-col justify-evenly gridItem1 leftBorder1">
				<view  class="title flex-row justify-center">
					<text>用券人数</text>
				</view>
				<view class="number1 flex-row justify-center">
					<text>{{expandAppTodayData.useCouponTotal}}</text>
				</view>
			</view>
			<view class="flex-col justify-evenly gridItem1 leftBorder1">
				<view  class="title flex-row justify-center">
					<text>充值人数</text>
				</view>
				<view class="number1 flex-row justify-center">
					<text>{{expandAppTodayData.rechargeTotal}}</text>
				</view>
			</view>
			<view class="flex-col  justify-evenly gridItem1 leftBorder1">
				<view  class="title flex-row justify-center">
					<text>消费次数累计</text>
				</view>
				<view class="number1 flex-row justify-center">
					<text>{{expandAppTodayData.consume}}</text>
				</view>
			</view>
		</view>
		<view class="title-h1">
			<text>间接拓客数据(今日)</text>
		</view>
		<view class="flex-row grid1">
			<view class="flex-col justify-evenly gridItem1">
				<view  class="title flex-row justify-center">
					<text>累计拓客</text>
				</view>
				<view class="number1 flex-row justify-center">
					<text>{{expandAppIndirectData.totalExpand}}</text>
				</view>
			</view>
			<view class="flex-col justify-evenly gridItem1 leftBorder1">
				<view  class="title flex-row justify-center">
					<text>用券人数</text>
				</view>
				<view class="number1 flex-row justify-center">
					<text>{{expandAppIndirectData.useCouponTotal}}</text>
				</view>
			</view>
			<view class="flex-col justify-evenly gridItem1 leftBorder1">
				<view  class="title flex-row justify-center">
					<text>充值人数</text>
				</view>
				<view class="number1 flex-row justify-center">
					<text>{{expandAppIndirectData.rechargeTotal}}</text>
				</view>
			</view>
			<view class="flex-col  justify-evenly gridItem1 leftBorder1">
				<view  class="title flex-row justify-center">
					<text>消费次数累计</text>
				</view>
				<view class="number1 flex-row justify-center">
					<text>{{expandAppIndirectData.consume}}</text>
				</view>
			</view>
		</view>
		<view v-for="i in 10">
			<view class="title-h1 flex-row">
				<text>2024-06</text>
				<u-icon name="arrow-right" color="#000" size="16"></u-icon>
				<u-icon name="arrow-down" color="#000" size="16"></u-icon>
			</view>
			<view class="listItem" v-for="i in 2">
				<view class="flex-row justify-between listItemMsg">
					<view class="memberNo">
						<text>会员编号：Vip.00006379</text>
					</view>
					<view class="flex-row justify-between msg">
						<text>发券</text>
						<text>0.01</text>
					</view>
				</view>
				<view class="time">
					<text>2024-02-05:12:01:22</text>
				</view>
			</view>
		</view>

		<view class="flex-row justify-center seeMore">
			<text>查看更多</text>
		</view>


		<!--#ifdef H5-->
		<liu-drag-button v-if="$isWxBrowser()" @clickBtn="back">返回</liu-drag-button>
		<!--#endif-->
	</view>
</template>

<script>
	export default {
		components: {
		},
		data() {
			return {
				height:'',
				withdrawStaticsData:{},
				expandAppTotalData:{},
				expandAppTodayData:{},
				expandAppIndirectData:{},
			}
		},
		onLoad(e) {
			let sysInfo = uni.getSystemInfoSync()
			this.height = sysInfo.windowHeight  - 70 + 'px' //除标题栏栏外的屏幕可用高度
		},
		onShow(){

			this.withdrawStatics()
			this.expandAppTotal()
			this.expandAppToday()
			this.expandAppIndirect()

		},
		methods: {

			withdrawStatics(){
				this.$api.service.withdrawStatics().then(res=>{
					this.withdrawStaticsData = res.data.data
				})

			},
			expandAppTotal(){
				this.$api.service.expandAppTotal().then(res=>{
					this.expandAppTotalData = res.data.data
				})

			},

			expandAppToday(){
				this.$api.service.expandAppToday().then(res=>{
					this.expandAppTodayData = res.data.data
				})

			},

			expandAppIndirect(){
				this.$api.service.expandAppIndirect().then(res=>{
					this.expandAppIndirectData = res.data.data
				})

			},


			navigateTo(url) {
				uni.navigateTo({
					url: url
				})
			},

			back() {
				let pages = getCurrentPages()
				if (pages.length > 1){
					uni.navigateBack({
						delta: 1,
						fail:err=>{
							console.log(err)
						}
					})
				}else {
					uni.switchTab({
						url: '/pages/my/my'
					});
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	@import './index.rpx.css';
</style>
