<template>
	<view v-if="istrue" class="my plr30">
		<view class="mt30 ptb40 plr30 bgwhite" style="border-radius: 16rpx">
			<view class="flex_start">
				<image :src="tximg" style="width: 128rpx;height: 128rpx;" mode=""></image>
				<view class="flex_column ml35 mt20">
					<text class="f32 bold">{{name}}</text>
					<text class="f26 mt20" style="color: #444444;">{{info.nickname}}</text>
				</view>
			</view>
			<view class="mt30 f28 flex_column" style="color: #1C0F57;">
				<text class="bold">余额：{{info.integral}}积分</text>
				<!-- <text class="mt10 bold">剩余可分发商品数：60</text> -->
			</view>
		</view>
		<view class="mt40 bgwhite ptb30 plr30" style="border-radius: 8rpx;">
			<view class="flex_between flex_items" @click="prodire">
				<view class="flex_start flex_items">
					<image :src="mlimg" style="width: 48rpx;height: 48rpx;" mode=""></image>
					<text class="f26 ml30 bold">划拨记录</text>
				</view>
				<image :src="rightimg" style="width: 10rpx;height: 18rpx;" mode=""></image>
			</view>
			<view class="flex_between flex_items mt40" @click="gofen">
				<view class="flex_start flex_items">
					<image :src="fenfa" style="width: 48rpx;height: 48rpx;" mode=""></image>
					<text class="f26 ml30 bold">分发记录</text>
				</view>
				<image :src="rightimg" style="width: 10rpx;height: 18rpx;" mode=""></image>
			</view>
		</view>
		<view class="flex_items flex_center" style="margin-top:500rpx;">
			<view @click="goout" class="flex_items flex_center"
				style="width: 654rpx;height: 86rpx;background:linear-gradient(90deg, #A21E2E 0%, #190F58 100%);box-shadow: 0rpx 8rpx 14rpx 0rpx rgba(83,139,135,0.2);border-radius: 12rpx;">
				<text class="f28" style="color: #fff;">退出登录</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tximg: require("@/static/tx.png"),
				rightimg: require("@/static/right.png"),
				mlimg: require("@/static/ml.png"),
				fenfa: require("@/static/fenfa.png"),
				name: uni.getStorageSync('adminname'),
				info:{},
				istrue:false
			}
		},
		onLoad() {
			this.getData()
		},
		methods: {
			getData() {
				uni.showLoading({
					title: "加载中..."
				})
				this.api.myself().then((res) => {
					console.log(res)
					if (res.data.code == 200) {
						uni.stopPullDownRefresh();
						this.info = res.data.data
						uni.hideLoading()
					} else {
						uni.hideLoading()
						uni.showToast({
							icon: "none",
							title: res.data.message
						})
					}
					this.istrue = true
				})
			},
			gofen() {
				uni.reLaunch({
					url: '/pages/index/index'
				})
			},
			prodire() {
				uni.navigateTo({
					url: "/pages/directory/index"
				})
			},
			goout() {
				this.api.logout().then((res) => {
					console.log(res)
				})
				uni.clearStorageSync()
				uni.reLaunch({
					url: "/pages/login"
				})
			}
		},
		onPullDownRefresh() {
			this.getData()
		}
	}
</script>

<style>
	page {
		background: #FAFBFD !important;
	}
</style>
