<template>
	<!-- 分销 导航 佣金统计主页 -->
	<!-- tabbar -->
	<view class="reseller">
		<view class="top">
			<view class="num" style="margin-left: 30px;">
				<view>昨日收益</view>
				<view class="txc">{{counts.money_yesterday?counts.money_yesterday:0}}</view>
			</view>
			<view class="num1" style="">
				<view>可提现</view>
				<view style="font-size: 40px;">{{counts.gold?counts.gold:0}}</view>
			</view>
			<view class="num" style="margin-right: 30px;">
				<view>累计已提</view>
				<view>{{counts.amount_cash?counts.amount_cash:0}}</view>
			</view>
			<view class="tixian" @click="jump_cash">
				<view class="btnBox">
					<navigator url="#">
						<view class="btn" style="font-size: 16px;">立即提现</view>
					</navigator>
				</view>
				
			</view>
			<view class="jilu">
				<navigator url="/pages/user/record/record">
					<view class="jl">提现记录 ></view>
				</navigator>
			</view>
		</view>

		<view class="icon flex-wrap flex">
			<view class="ico mt-40">
				<navigator url="/pages/storeqrcode/storeqrcode">
					<view class="tubiao">

						<image class="img" src="/static/icon/rqcodeicon.png"></image>
					</view>
					<view class="tt">
						<view class="text">店铺二维码</view>
					</view>
				</navigator>
			</view>
			<view class="ico mt-40">
				<navigator url="/pages/user/mingxi/mingxi">
					<view class="tubiao">

						<image class="img" src="/static/icon/zijin.png"></image>
					</view>
					<view class="tt">
						<view class="text">佣金明细</view>
					</view>
				</navigator>
			</view>
			<view class="ico mt-40">
				<navigator url="/pages/user/fenxiao/bankcard/bankcard">
					<view class="tubiao">

						<image class="img" src="/static/icon/ordericons.png"></image>
					</view>
					<view class="tt">
						<view class="text">银行卡</view>
					</view>
				</navigator>
			</view>
			<view class="ico mt-40">
				<navigator url="/pages/setup/setup">
					<view class="tubiao">

						<image class="img" src="/static/icon/setupicon.png"></image>
					</view>
					<view class="tt">
						<view class="text">设置</view>
					</view>
				</navigator>
			</view>

		</view>
		<view class="kong"></view>

		<yomol-upgrade ref="yomolUpgrade"></yomol-upgrade>
		<!-- 升级组件 -->
		<eModal :visible.sync="visible" :animation='true'>
			<view class="eModalbox">
				<view class="names">绑定手机号</view>
				<view class="names-min">*请勿必绑定手机号，否则将无法提现</view>
				<view class="inputboxitem flex">
					<view class="inputsview flex1">
						<input type="number" value="" v-model="mobile" class="inputs" placeholder="请输入手机号" />
					</view>
				</view>
				<view class="submitbtn " @tap="isStoreSaveMobile">确认修改</view>
			</view>
		</eModal>
		<!-- 绑定手机号 -->
	</view>
</template>

<script>
	import {
		storeIndex,
		storeSaveMobile
	} from "@/utils/api/api.js";
	import yomolUpgrade from '@/components/yomol-upgrade/yomol-upgrade.vue'; //升级组件
	import eModal from "@/components/e-modal/e-modal.vue";
	export default {
		data() {
			return {
				list: [],
				visible: false,
				mobile: '',
				counts: {}, //统计的数据
			}
		},
		components: {
			yomolUpgrade,
			eModal,		
		},
		onLoad() {

		},
		//下拉刷新
		onPullDownRefresh() {
			this.getstoreIndex();
			// uni.stopPullDownRefresh();//结束下拉刷新
		},
		onShow() {
			this.getstoreIndex();
			//检测更新
			setTimeout(() => {
				// #ifdef APP-PLUS
				this.$refs.yomolUpgrade.checkVersionClick();
				// #endif
			}, 1000)
		},
		methods: {
			// 绑定手机号
			isStoreSaveMobile(e) {
				var data = {
					mobile: this.mobile
				}
				storeSaveMobile(data).then(res => {
					if (res.code == 0) {
						this.$api.msg(res.msg);
						this.visible = false
					} else {
						uni.showModal({
							title: '提示',
							content: res.msg,
							showCancel: false,
							confirmText: '确认',

						})
					}
				})
			},
			//获取统计信息接口
			async getstoreIndex() {
				let res = await storeIndex({

				});
				uni.stopPullDownRefresh();
				if (res.code == 0) {
					this.counts = res.data.counts;
					this.mobile = res.data.mobile //用户帮没帮定手机号
					if (!this.mobile) {
						this.visible = true
					};
				} else {
					this.$api.msg(res.msg);
				}
			},
			jump_cash() {
				uni.navigateTo({
					url: '/pages/yjWithdraw/yjWithdraw?type=2',
				});
			}
		}
	}
	
</script>

<style lang="scss">
	@import "./reseller.scss";
	.eModalbox{
		width: 100%;
		height: 40vh;
		padding: 40upx 40upx 0 40upx;
		.names{
			font-size:30upx;
			color:rgba(0,0,0,1);
			text-align: center;
			margin-bottom: 20upx;
		}
		.names-min{
			font-size:24upx;
			color:#ff6900;
			text-align: center;
			margin-bottom: 80upx;
		}
		.inputboxitem{
			height: 92upx;
			line-height: 92upx;
			border-bottom: 1px solid #E4E4E4;
			.inputs{
				height: 92upx;
				line-height: 92upx;
				font-size:30upx;
				color:rgba(0,0,0,1);
			}
		}
		.submitbtn{
				margin: 60upx 24upx;
				height:88upx;
				line-height: 88upx;
				text-align: center;
				background:#ff6900;
				border-radius:6upx;
				font-size:32upx;
				color:rgba(255,255,255,1);
			}
	
	}
</style>
