<wxs src="../../utils/filter.wxs" module="filter"></wxs>

<block wx:if="{{ userInfo}}" >
<view class="main">
	<!-- 头像 -->
	<view class="avatar-container t-c pdv40">
		<image class="bgImg" src="{{imghost + (ad_img ? ad_img:'/miniapp/images/user_index_powder.jpg')}}"/>
		<view class="pdb20 pr">
			<image class="avatar" src="{{userInfo.head_pic}}"/>
		</view>
		<view class="fs26 pr"><text class="nickname">{{filter.show_default(userInfo.nickname)}}</text></view>
	</view>
	<!-- 金额 -->
	<view>
		<view class="flex ai-center jc_sb pd2622 bdb arrow-r" bindtap="goto">
			<view><text class="iconfont icon-jine pdr10 ctb"></text>可提现金额</view>
			<view class="ctb money" data-url="/packageD/pages/user/member/menber">{{filter.show_default(data.liudong_money)}}</view>
		</view>
		
		<view class="flex jc_sa t-c">
			<view class="pd20 f1">
				<view class="money fs40">{{filter.show_default(data.today_money)}}</view>
				<view class="fs24 pdt10 cb">今日收入</view>
			</view>
			<view class="pd20 f1">
				<view class="money fs40">{{filter.show_default(data.sales_volume)}}</view>
				<view class="fs24 pdt10 cb">总销售额</view>
			</view>
			<view class="pd20 f1">
				<view class="money fs40">{{filter.show_default(data.distribut_money)}}</view>
				<view class="fs24 pdt10 cb">累计佣金</view>
			</view>
		</view>
	</view>
	<!-- 商品 -->
	<view class="flex t-c mgv20 fs30" bindtap="goto">
		<view class="f1 pd20 line" data-url="/packageA/pages/distribution/goods/goods?index=0"><text class="iconfont icon-shangjia pdr10 cf79"></text>上架商品</view>
		<view class="f1 pd20" data-url="/packageA/pages/distribution/goods/goods?index=1"><text class="iconfont icon-xiajia pdr10 c29f"></text>下架商品</view>
	</view>
	<!-- 图标列表 -->
	<view class="flex wrap pdv20">
		<view class="pd20 t-c w25" bindtap="goto" data-url="/packageA/pages/distribution/order/order">
			<view class="circle bgBlue"><text class="iconfont icon-order fs40"></text></view>
			<view class="fs24 pdt10">分销订单</view>
		</view>
		<view class="pd20 t-c w25" bindtap="goto" data-url="/packageA/pages/distribution/rank/rank">
			<view class="circle bgRed"><text class="iconfont icon-paihangbang fs40"></text></view>
			<view class="fs24 pdt10">分销排行</view>
		</view>
		<view class="pd20 t-c w25" bindtap="goto" data-url="/packageA/pages/distribution/myteam/myteam">
			<view class="circle bgPink"><text class="iconfont icon-tuandui fs40"></text></view>
			<view class="fs24 pdt10">我的团队</view>
		</view>
		<view class="pd20 t-c w25" bindtap="goto" data-url="/packageA/pages/distribution/commision/commision">
			<view class="circle bgRed"><text class="iconfont icon-yongjin fs40"></text></view>
			<view class="fs24 pdt10">佣金明细</view>
		</view>
		<view class="pd20 t-c w25" bindtap="goto" data-url="/packageA/pages/distribution/card/card">
			<view class="circle bgPurple"><text class="iconfont icon-mingpian fs40"></text></view>
			<view class="fs24 pdt10">我的名片</view>
		</view>
		<view class="pd20 t-c w25">
			<view class="circle bgYellow" bindtap="goto" data-url="/pages/user/index/index"><text class="iconfont icon-huiyuan fs40"></text></view>
			<view class="fs24 pdt10">会员中心</view>
		</view>
		<view class="pd20 t-c w25" bindtap="goto" data-url="/packageA/pages/distribution/shop/shop">
			<view class="circle bgBlue"><text class="iconfont icon-shop fs40"></text></view>
			<view class="fs24 pdt10">我的小店</view>
		</view>
		<view class="pd20 t-c w25" bindtap="goto" data-url="/packageA/pages/distribution/rookie/rookie">
			<view class="circle bgGreen"><text class="iconfont icon-xinshouyindao fs40"></text></view>
			<view class="fs24 pdt10">新手必看</view>
		</view>
	</view>
	
	<!-- 如果分销没有开启或者过期 -->
	<block wx:if="{{err_word}}">
		<view class="popup">	
			<view class="t-c pd20 title">提示<text class="iconfont icon-close" bindtap="goto" data-url="/pages/user/index/index"></text></view>
			<view class="t-c pd20">
				<image src="{{imghost + 'miniapp/images/user/nodistribut.png'}}" class="img"/>
				<view class="fs28 pdt40">{{err_word}}</view>
			</view>
		</view>
		<!-- 遮罩 -->
		<view class="mask"></view>
	</block>
	<!-- 分销商验证 -->
    <block  wx:elif="{{userInfo && !userInfo.is_distribut}}">
	<view class="popup">	
			<view class="t-c pd20 title">分销规则说明<text class="iconfont icon-close" bindtap="goto" data-url="/pages/user/index/index"></text></view>
			<view wx:if="{{fenxiao}}">
				<block wx:for="{{fenxiao}}">
					<view class="item" wx:if="{{item.type == 1}}">
						<view class="left f1">
							<view class="icon-container"><text class="iconfont icon-huiyuan1"></text></view>
							<view>仅限PLUS卡({{item.conditonRemark}})的会员, 
							   <text wx:if="{{item.pass}}" class="c-red" bindtap="goto" data-url="/packageE/pages/user/cardinfo/cardinfo">PLUS详情</text>
							   <text wx:else class="c-red" bindtap="goto" data-url="/pages/user/plus/plus">立即升级</text>
							</view>
						</view>
						<text class="iconfont {{item.pass ? 'icon-yes c-red':'icon-yuanquan c-c7'}}"></text>
					</view>
					<view class="item" wx:if="{{item.type == 2}}">
						<view class="left f1">
							<view class="icon-container"><text class="iconfont icon-renzheng"></text></view>
							<view class="flex ali-c">		
								<text wx:if="{{item.inviter}}">{{item.inviter}}</text>
								<input wx:else class="bg-f0 pdh10 input" type="number" value="{{item.inviter ? item.inviter:''}}" placeholder="请输入推荐人手机号码" disabled="{{item.pass}}" bindinput="getInput"/>
								<view class="verify" wx:if="{{!item.pass}}"   bindtap="verify" data-index="{{index}}" data-pass="{{item.pass}}">验证</view>
							</view>
						</view>
						<text class="iconfont {{item.pass ? 'icon-yes c-red':'icon-yuanquan c-c7'}}"></text>
					</view>
					<view class="item" wx:if="{{item.type == 3}}">
						<view class="left f1">
							<view class="icon-container"><text class="iconfont icon-gouwu"></text></view>
							<text>{{item.conditonRemark==null?'直接成为分销商':item.conditonRemark}}</text>
						</view>
						<text class="iconfont {{item.pass ? 'icon-yes c-red':'icon-yuanquan c-c7'}}"></text>
					</view>
				</block>
				<view class="item" data-url="1">
					<view class="left f1">
						<view class="icon-container"><text class="iconfont icon-yongjin"></text></view>
						<text>成功成为分销商,分享商品给好友即可获得相应收益</text>
					</view>
				</view>
				
				<view wx:if="{{buy_goods}}" class="t-c pd20 fs30 bdt co-red bold" bindtap="goto" data-url="{{buy_goods.url}}">去购买</view>
			</view>		   	    
	</view>
	<!-- 遮罩 -->
	<view class="mask"></view>
	</block>
	
</view>
</block>

<block wx:else>
	 <view class="flex jc-center bg-white ai_c t-c" style="position: absolute; width: 100%; height: 100%;">	 
		 <view>
			 <view>您还未登录，请先授权登录！</view>	 
			 <view style="margin-top: 200rpx;"><text bindtap="go_login" class="btn fs35">去授权</text></view>	  
		 </view>
	 </view>
</block>