<template>
	<view>
		<!-- #ifdef H5 -->
		<view style="color: #000000;">
			<tn-nav-bar backgroundColor="#ffffff" :bottomShadow="false">推广者中心</tn-nav-bar>
			<view :style="{height: tobheight+'px'}"></view>
		</view>
		<!-- #endif -->
		<view style="width:100%;height: 100%;">
			<!-- <view class="commission-wrap" :class="{ blur: !hasAuth }"> -->
			<view class="commission-wrap">
				<!-- 用户资料 -->
				<view class="user-card">
					<view class="card-top u-flex u-row-between">
						<view class="u-flex">
							<view class="head-img-box">
								<image class="head-img" :src="userInfo.avatar?userInfo.avatar:'/static/images/head.jpg'"
									mode=""></image>
							</view>
							<view class="u-flex-col">
								<view class="user-name">{{userInfo.nickname?userInfo.nickname:'默认用户'}}</view>
								<view class="user-info-box u-flex">
									<view class="tag-box u-flex" v-if="true">
										<!-- <image v-if="true" class="tag-img" src="/static/images/head.jpg" mode="">
										</image> -->
										<!-- <text class="tag-title">{{userInfo.is_distributor?"合伙人":'普通用户'}}</text> -->
										<text class="tag-title">合伙人</text>
										<!-- <view v-show="showLv" class="u-iconfont uicon-arrow-right" style="color: #fff;font-size: 28rpx;"></view> -->
									</view>
								</view>

								<view class="invite-code">
									<text class="iTex">邀请码：</text>{{userInfo.invite_code}}
									<view class="btn" @click="copy(userInfo.invite_code)">复制</view>
								</view>
							</view>
						</view>
						<view class="u-flex-col">
							<view class="u-flex-col u-col-center">
								<!-- 	<view class=""
									style="width: 250rpx;display: flex;align-items: center;justify-content: center;"> -->
								<view class="" style="">
									<!-- 	<button class="u-reset-button log-btn u-m-b-20"
										style="width: auto;padding-left: 10rpx;padding-right: 10rpx;"
										@tap="toTeam">任务明细</button> -->
									<button class="u-reset-button log-btn u-m-b-20"
										style="width: auto;padding-left: 10rpx;padding-right: 10rpx;"
										@tap="toTeam2">明细</button>
								</view>
								<button class="u-reset-button look-btn" @tap="showMoney = !showMoney">
									<!-- <view class="u-iconfont" :class="showMoney ? 'uicon-eye-fill' : 'uicon-eye-off'" style="color: #fff;font-size: 50rpx;"></view> -->
									<u-icon :name="showMoney ? 'eye-fill':'eye-off'" color="#fff" size="22"></u-icon>
								</button>
							</view>
						</view>
					</view>
					<!-- 收益 -->
					<view class="card-bottom u-flex">
						<view class="u-flex-1 ">
							<view class="item-title">累计收入</view>
							<view class="item-detail">{{showMoney?Number(recommendSum.total_income).toFixed(2):'****'}}
							</view>
						</view>
						<view class="u-flex-1 u-col-center">
							<view class="item-title">待入账佣金</view>
							<view class="item-detail">
								{{showMoney?Number(recommendSum.wait_income).toFixed(2):'****'}}
							</view>
						</view>
					</view>
				</view>

				<!-- 滚动明细 -->
				<view class="commission-log">
					<scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-box log-scroll">
						<view class="log-item-box u-flex u-row-between" :key="" @tap="$u.toast('item.remark')">
							<view class="log-item-wrap">
								<view class="log-item u-flex u-ellipsis-1 u-col-center">
									<view class="u-flex u-col-center ">
										<image class="log-img"
											:src="userInfo.avatar?userInfo.avatar:'/static/images/head.jpg'" mode="">
										</image>
									</view>
									<view class="log-text u-ellipsis-1">恭喜您成为了合伙人</view>
								</view>
							</view>
							<text class="log-time">{{userInfo.created_at}}</text>
						</view>
					</scroll-view>
				</view>

				<!-- 功能菜单 -->
				<view class="menu-box u-flex">
					<view class="menu-item u-flex-col u-col-center" v-for="(menu, index) in menuList"
						v-if="!menu.isAgentFrom" :key="index" @tap="jump(menu.path)">
						<image class="item-img" :src="menu.img" mode=""></image>
						<view class="item-title">{{ menu.title }}</view>
					</view>
				</view>
				<!-- #ifdef H5 -->
				<!-- 	<view class="bill">
					<u-button @click="createPoster" color="#ffc107" type="primary" shape="circle"
						text="推广海报"></u-button>
				</view> -->
				<!-- #endif -->


			</view>

			<!-- 佣金中心权限验证 -->
			<!-- 		<u-popup class="auth-box" :mask="false" v-model="showAuthModal" mode="center" :mask-close-able="false"
				close-icon-pos="top-left" border-radius="20">
				<view class="notice-box">
					<view class="img-wrap">
						<image class="notice-img" :src="authNotice.img" mode=""></image>
					</view>
					<view class="notice-title">{{ authNotice.title }}</view>
					<view class="notice-detail">{{ authNotice.detail }}</view>
					<button class="u-reset-button notice-btn"
						@tap="onAuthBtn(authNotice.btnPath)">{{ authNotice.btnText }}</button>
					<button class="u-reset-button back-btn" @tap="$Router.back()" v-if="!authNotice.hideBtn">返回</button>
					<button class="u-reset-button back-btn" @tap="hasAuth = true" v-else>取消</button>
				</view>
			</u-popup> -->

			<!-- 成为分销商条件 -->
			<!-- 				<u-popup v-if="showTerm" class="into-agent-modal" :bgStyle="{
					background: 'none'
				}" v-model="showTerm" mode="center" :mask="false" :mask-close-able="false">
				<view class="condition-box u-flex u-row-center u-col-center">
					<view class="goods-condition u-flex u-row-between" v-if="showMoneyTerm">

						<view class="btn-box u-flex-col u-p-20 u-col-center">
							<button class="u-reset-button buy-btn u-m-b-10" @tap="$Router.back()">知道了</button>
							<view class="tips">* 满足指定消费金额即可成为分销商</view>
						</view>
					</view>
				</view>
			</u-popup> -->
		</view>
		<!-- <wike-loading-page :isLoading="isLoading"></wike-loading-page> -->

		<!-- 		<u-popup :show="showPoster" mode="bottom" :round="10" @close="close">
			<view class="poster">
				<wike-painter :board="posterObj" @success="posterSuccess" ref="painter"></wike-painter>
				<view class="footer-btn">
					<view class="" @click="showPoster = false">退出</view>
					<view class="save" @click="toSave">保存/分享</view>
				</view>
			</view>
		</u-popup> -->
	</view>
</template>

<script>
	import {
		mapMutations,
		mapActions,
		mapState,
		mapGetters
	} from 'vuex';

	// import {
	// 	myTeam
	// } from '@/api/my/index.js'

	import {
		userInfo
	} from '@/api/my/index.js'
	// import {
	// 	taskCount
	// } from '@/api/my/index.js'


	import {
		recommendCount
	} from '@/api/my/index.js'
	import $platform from "@/common/platform";
	export default {
		data() {
			return {
				recommendSum: {},
				userInfo: {},
				teamDataList: [],


				isLoading: true,
				tobheight: 45,
				platform: this.$platform.get(),
				showAuthModal: true,
				empty: false,
				team: [{
					headimg: 'https://dev.iduomi.cc/attachment/headimg_2.jpg?time=1673514485',
					nickname: '多级火箭好',
					times: '2020/12/24'
				}, {
					headimg: 'https://dev.iduomi.cc/attachment/headimg_2.jpg?time=1673514485',
					nickname: '多级火箭好',
					times: '2020/12/24'
				}, {
					headimg: 'https://dev.iduomi.cc/attachment/headimg_2.jpg?time=1673514485',
					nickname: '多级火箭好',
					times: '2020/12/24'
				}],
				pages: 1,
				currentTab: 0,
				navbar: [{
						name: "下一级",
						type: 'shareuid'
					}, {
						name: "下下级",
						type: 'shareuid_grandpa'
					},
					// {
					// 	name: "下三级",
					// 	type:'shareuid_great_grandpa'
					// },
				],
				showShare: false, //是否显示分享海报
				showMoney: true, //是否显示金额
				hasAuth: true, //是否有权限
				commissionLv: {
					image: 'https://demo.shopro.top/uploads/20220909/5c5e361cd3869e363e8d19c4911905e5.jpg',
					name: '合伙人'
				}, //合伙人等级
				commissionWallet: null, //合伙人钱包
				agentFrom: null, //是否显示我的资料
				showLv: true,
				commissionLog: [{
					id: 1,
					oper_type: 'gf',
					oper: 'http://nywhcm.com/addons/wike_aging/public/static/storage/20230318/68a81221c8749f9889ebb8ca430a2d40.png',
					remark: '恭喜您成为了合伙人',
					createtime: '2023-05-24 11:04:22'
				}], //动态
				loadStatus: 'loadmore', //loadmore-加载前的状态，loading-加载中的状态，nomore-没有更多的状态
				currentPage: 1,
				lastPage: 1,
				logMap: {
					system: this.$IMG_URL + '/imgs/commission/commission_base_notice.png',
					admin: this.$IMG_URL + '/imgs/commission/commission_base_avatar.png'
				},
				showTerm: true, //条件弹窗
				showGoodsTerm: false, //商品条件
				showMoneyTerm: false, //金额条件
				goodsTermList: [],
				moneyTermNum: 0,
				authNotice: {},
				menuList: [
					//menu
					{
						img: 'https://file.shopro.top/imgs/commission/commission_icon1.png',
						title: '我的团队',
						path: '/pages/user/commission/team'
					},
					// {
					// 	img: 'https://file.shopro.top/imgs/commission/commission_icon2.png',
					// 	title: '任务佣金明细',
					// 	path: '/pages/user/commission/commission-log'
					// },
					// {
					// 	img: 'https://file.shopro.top/imgs/commission/commission_icon3.png',
					// 	title: '提现任务佣金',
					// 	path: '/pages/user/commission/withdraw?type=1',

					// },
					{
						img: 'https://file.shopro.top/imgs/commission/commission_icon2.png',
						title: '佣金明细',
						path: '/pages/user/commission/commission-log2'
					},
					{
						img: 'https://file.shopro.top/imgs/commission/commission_icon3.png',
						title: '提现佣金',
						path: '/pages/user/commission/withdraw?type=2',

					},
					{
						img: 'https://file.shopro.top/imgs/commission/commission_icon8.png',
						title: '提现记录',
						path: '/pages/user/commission/withdraw-log'
					},
					{
						img: 'https://file.shopro.top/imgs/commission/commission_icon7.png',
						title: '分享链接',
						path: 'share'
					},
					{
						img: 'https://file.shopro.top/imgs/commission/commission_icon3.png',
						title: '分销订单',
						path: '/pages/app/commission/order',
						isAgentFrom: true
					},
					// {
					// 	img: 'https://file.shopro.top/imgs/commission/commission_icon4.png',
					// 	title: '推广商品',
					// 	path: '/pages/app/commission/goods',
					// 	isAgentFrom: true
					// },
					// {
					// 	img: 'https://file.shopro.top/imgs/commission/commission_icon5.png',
					// 	title: '我的资料',
					// 	path: '/pages/app/commission/apply',
					// 	isAgentFrom: true
					// },
					// {
					// 	img: 'https://file.shopro.top/imgs/commission/commission_icon6.png',
					// 	title: '排行榜',
					// 	path: '/pages/user/commission/rankings'
					// },

					{
						img: 'https://file.shopro.top/imgs/commission/commission_icon8.png',
						title: '分享记录',
						path: '/pages/app/commission/share-log',
						isAgentFrom: true
					}
				],
				money_total: '0.00',
				on_cashout_money: '0.00',
				showPoster: false,
				posterObj: {},
				posterfff: '您好，我是AI语言模型，可以帮助你做很多事情。例如:\n- 回答你的问题\n- 给你提供某些信息\n- 帮你搜索网页\n- 聊天和闲聊\n- 玩一些小游戏\n- 计算数学题\n- 翻译语言\n- 生成文本\n等等.....\n如果你有任何问题或需要帮助，请随时告诉我。',
				spmplatform: 0,
				is_examine: 1
			}
		},
		computed: {
			// ...mapGetters(['appInfo', 'isLogin', 'userInfo'])
		},
		async onLoad() {
			let ress = await recommendCount()
			console.log('推广者中心-推广佣金汇总返回值', ress);
			if (ress.code == 0) {
				this.recommendSum = ress.data
			}



			// let res = await myTeam()
			// if (res.code == 0) {
			// 	this.teamDataList = res.data
			// }
			// console.log('我的团队返回值', res);

			let res = await userInfo()
			console.log('推广者中心-用户个人信息返回值', res);
			if (res.code == 0) {
				this.userInfo = res.data

				// if (!this.userInfo.is_distributor) {
				// 	this.islogin()
				// }
			}
		},
		async onShow() {
			// let ress = await taskCount()
			// if (ress.code == 0) {
			// 	this.commissionSum = ress.data
			// 	console.log('推广者中心-任务佣金汇总返回值', ress, this.commissionSum);
			// }
		},
		methods: {
			copy(data) {
				uni.setClipboardData({
					data,
					success: function() {
						uni.showToast({
							duration: 1500,
							title: '邀请码复制成功',
							icon: 'none'
						})
					}
				});
			},
			jump(e) {
				if (e == "share") {
					let host = $platform.host();
					console.log('测试分享链接host', host);
					// let host = 'http://www.liwantao.top'

					// let shareLink = 'http://t20.9026.com/h5/?iviteCode=' + this.userInfo.invite_code
					let shareLink = host + '?iviteCode=' + this.userInfo.invite_code
					// let shareLink = host + '?iviteCode=' + this.userInfo.invite_code
					// let shareLink = 'http://localhost:8080/h5/?iviteCode=' + this.userInfo.invite_code

					uni.setClipboardData({
						data: shareLink,
						success: function() {
							uni.showToast({
								title: '复制链接成功',
								duration: 1500,
								icon: 'success'
							});
						}
					});
				} else {
					uni.navigateTo({
						url: e
					})
				}
			},
			change(index) {
				this.currentTab = index;
				this.team = [];
				this.pages = 1;
				this.getInviteList()
			},
			toTeam() {
				// uni.navigateTo({
				// 	url:'/pages/user/commission/team'
				// })
				uni.navigateTo({
					url: '/pages/user/commission/commission-log'
				})
			},
			toTeam2() {
				// uni.navigateTo({
				// 	url:'/pages/user/commission/team'
				// })
				uni.navigateTo({
					url: '/pages/user/commission/commission-log2'
				})
			},
			islogin() {
				this.getCheck()
				// var that = this;
				// if (!this.isLogin) {
				// 	uni.navigateTo({
				// 		url: '../user/signin'
				// 	});
				// } else {
				// 	this.getCheck()
				// }

			},
			// commission() {
			// 	let that = this;
			// 	that.$http('conf.getGroupConf', {
			// 		group: 'system.commission'
			// 	}).then(res => {
			// 		if (res.code === 0) {
			// 			if (res.data.is_examine) {
			// 				this.is_examine = res.data.is_examine
			// 				// console.log(this.is_examine);
			// 			}
			// 			if (res.data.is_ranking == 1) {
			// 				let obj = {
			// 					img: 'https://file.shopro.top/imgs/commission/commission_icon6.png',
			// 					title: '排行榜',
			// 					path: '/pages/user/commission/rankings'
			// 				};
			// 				this.menuList.splice(2, 0, obj);
			// 			}
			// 		}
			// 	});
			// },

			// commonqrcodePath() {
			// 	let spm = this.userInfo.id + '.1.0.' + this.spmplatform + '.1';
			// 	// console.log(spm);
			// 	this.$http('common.qrcodePath', {
			// 		spm: spm
			// 	}).then(res => {
			// 		if (res.code == 0) {
			// 			this.qrcode = res.data;
			// 		}
			// 	});
			// },

			// createPoster(e) {
			// 	let that = this;
			// 	(this.posterObj = {
			// 		width: '670rpx',
			// 		background: '#fff',
			// 		borderRadius: '16rpx',
			// 		css: {
			// 			// 根节点若无尺寸，自动获取父级节点
			// 			width: '670rpx'
			// 		},
			// 		views: [{
			// 				type: 'view',
			// 				css: {
			// 					marginTop: '20rpx',
			// 					paddingLeft: '10rpx',
			// 					display: 'flex'
			// 				},
			// 				views: [{
			// 						type: 'image',
			// 						src: this.userInfo.avatar ? this.userInfo.avatar :
			// 							'/static/images/head.jpg',
			// 						css: {
			// 							marginTop: '10rpx',
			// 							marginLeft: '10rpx',
			// 							borderRadius: '16rpx',
			// 							width: '80rpx',
			// 							height: '80rpx',
			// 							border: '2rpx solid #fff',
			// 							objectFit: 'cover'
			// 						}
			// 					},
			// 					{
			// 						type: 'view',
			// 						css: {
			// 							marginTop: '10rpx',
			// 							marginLeft: '20rpx'
			// 							// display:'flex',
			// 							// flexDirection:'column'
			// 						},
			// 						views: [{
			// 								type: 'view',
			// 								views: [{
			// 									type: 'text',
			// 									text: this.userInfo.nickname ? this.userInfo
			// 										.nickname : '提问者',
			// 									css: {
			// 										marginTop: '10rpx',
			// 										fontSize: '28rpx',
			// 										fontWeight: 'bold',
			// 										color: '#1A2033',
			// 										lineHeight: '28rpx'
			// 									}
			// 								}]
			// 							},
			// 							{
			// 								type: 'view',
			// 								views: [{
			// 									type: 'text',
			// 									text: '我的提问',
			// 									css: {
			// 										marginTop: '15rpx',
			// 										fontSize: '22rpx',
			// 										// fontWeight: 'bold',
			// 										color: '#999',
			// 										lineHeight: '25rpx'
			// 									}
			// 								}]
			// 							}
			// 						]
			// 					}
			// 				]
			// 			},
			// 			{
			// 				type: 'view',
			// 				css: {
			// 					marginTop: '20rpx',
			// 					width: '610rpx',
			// 					padding: '10rpx',
			// 					background: '#d2f8d3',
			// 					borderRadius: '16rpx',
			// 					marginLeft: '20rpx',
			// 					marginRight: '10rpx'
			// 				},
			// 				views: [{
			// 					type: 'text',
			// 					text: 'hello！你可以帮我做些什么呢？',
			// 					css: {
			// 						fontSize: '28rpx',
			// 						color: '#1A2033',
			// 						lineHeight: '45rpx',
			// 						lineClamp: 2,
			// 						paddingLeft: '10rpx',
			// 						paddingRight: '10rpx',
			// 						width: '590rpx'
			// 						// padding:'10rpx'
			// 					}
			// 				}]
			// 			},
			// 			{
			// 				type: 'view',
			// 				css: {
			// 					marginTop: '20rpx',
			// 					paddingLeft: '10rpx',
			// 					display: 'flex'
			// 				},
			// 				views: [{
			// 						type: 'image',
			// 						src: '/static/images/open.png',
			// 						css: {
			// 							marginTop: '10rpx',
			// 							marginLeft: '10rpx',
			// 							borderRadius: '16rpx',
			// 							width: '80rpx',
			// 							height: '80rpx',
			// 							border: '2rpx solid #fff',
			// 							objectFit: 'cover'
			// 						}
			// 					},
			// 					{
			// 						type: 'view',
			// 						css: {
			// 							marginTop: '10rpx',
			// 							marginLeft: '20rpx'
			// 							// display:'flex',
			// 							// flexDirection:'column'
			// 						},
			// 						views: [{
			// 								type: 'view',
			// 								views: [{
			// 									type: 'text',
			// 									text: this.appInfo.site_name,
			// 									css: {
			// 										marginTop: '10rpx',
			// 										fontSize: '28rpx',
			// 										fontWeight: 'bold',
			// 										color: '#1A2033',
			// 										lineHeight: '28rpx'
			// 									}
			// 								}]
			// 							},
			// 							{
			// 								type: 'view',
			// 								views: [{
			// 									type: 'text',
			// 									text: '回答结果',
			// 									css: {
			// 										marginTop: '15rpx',
			// 										fontSize: '22rpx',
			// 										// fontWeight: 'bold',
			// 										color: '#999',
			// 										lineHeight: '25rpx'
			// 									}
			// 								}]
			// 							}
			// 						]
			// 					}
			// 				]
			// 			},
			// 			{
			// 				type: 'view',
			// 				css: {
			// 					marginTop: '20rpx',
			// 					width: '610rpx',
			// 					padding: '10rpx',
			// 					background: '#f5f6f8',
			// 					borderRadius: '16rpx',
			// 					marginLeft: '20rpx',
			// 					marginRight: '10rpx'
			// 				},
			// 				views: [{
			// 					type: 'text',
			// 					text: uni.$u.trim(that.posterfff),
			// 					css: {
			// 						fontSize: '28rpx',
			// 						color: '#1A2033',
			// 						lineHeight: '45rpx',
			// 						lineClamp: 11,
			// 						width: '590rpx',
			// 						// paddingLeft: '10rpx',
			// 						// paddingTop: '10rpx',
			// 						padding: '10rpx'
			// 					}
			// 				}]
			// 			},
			// 			{
			// 				type: 'view',
			// 				css: {
			// 					marginTop: '20rpx',
			// 					width: '100%',
			// 					textAlign: 'center'
			// 				},
			// 				// #ifdef H5
			// 				views: [{
			// 					type: 'qrcode',
			// 					text: this.qrcode,
			// 					css: {
			// 						width: '200rpx',
			// 						height: '200rpx'
			// 					}
			// 				}],
			// 				// #endif
			// 				// #ifdef MP-WEIXIN
			// 				views: [{
			// 					type: 'image',
			// 					src: this.qrcode,
			// 					css: {
			// 						width: '200rpx',
			// 						height: '200rpx'
			// 					}
			// 				}]
			// 				// #endif
			// 			},
			// 			{
			// 				type: 'text',
			// 				text: '————  ' + '长按识别 | 欢迎使用' + '  ————',
			// 				css: {
			// 					marginTop: '20rpx',
			// 					width: '100%',
			// 					textAlign: 'center',
			// 					fontSize: '24rpx',
			// 					color: '#989FB3',
			// 					lineHeight: '33rpx'
			// 				}
			// 			}
			// 		]
			// 	}),
			// 	(this.showPoster = true);
			// },
			toSave() {
				uni.showLoading({
					title: '海报生成中'
				});
				this.$refs.painter.canvasToTempFilePathSync({
					// 在nvue里是jpeg
					fileType: 'jpg',
					quality: 1,
					success: res => {
						// this.path = res.tempFilePath;
						// this.$refs.posterImg.open();
						// this.show_poster = true;

						// console.log(res.tempFilePath);
						// 非H5 保存到相册
						// H5 提示用户长按图另存
						// #ifdef MP-WEIXIN
						// uni.saveImageToPhotosAlbum({
						// 	filePath: res.tempFilePath,
						// 	success: function() {
						// 		uni.showToast({
						// 			title: '保存成功'
						// 		});
						// 		that.showPoster = false;
						// 	}
						// });

						wx.showShareImageMenu({
							path: res.tempFilePath
						})
						this.showPoster = false;
						uni.hideLoading();
						// #endif
						// #ifdef H5
						this.showPoster = false;
						uni.hideLoading();
						uni.showModal({
							confirmColor: '#26B3A0',
							confirmText: '查看图片',
							title: '提示',
							content: '查看图片后长按图片即可保存或分享',
							success(src) {
								if (src.confirm) {
									uni.previewImage({
										urls: [res.tempFilePath]
									});
								} else if (src.cancel) {
									this.showPoster = true;
								}
							}
						});
						// #endif
					}
				});
			},
			getCheck() {
				let that = this
				uni.showModal({
					confirmText: '申请',
					confirmColor: '#5e49c3',
					content: '立即申请成为合伙人',
					title: '提示',
					success(res) {
						if (res.confirm) {
							that.commissionapply()
						} else if (res.cancel) {
							// uni.navigateBack()
						}
					}
				})
				// var that = this;
				// that.$http('commission.auth').then(res => {
				// 	if (res.code == 0) {
				// 		uni.setNavigationBarTitle({
				// 			title: this.appInfo.site_name
				// 		});
				// 		that.money_total = res.data.money_total > 0 ? res.data.money_total : '0.00'
				// 		that.on_cashout_money = res.data.on_cashout_money > 0 ? res.data.on_cashout_money : '0.00'
				// 		that.commissionLog[0].createtime = res.data.create_time
				// 		this.isLoading = false

				// 	if (res.data.status == 0 && that.is_examine == 1) {
				// 		uni.showModal({
				// 			confirmText: '确定',
				// 			showCancel: false,
				// 			confirmColor: '#5e49c3',
				// 			content: '分销商申请已提交，等待后台审核通过',
				// 			title: '提示',
				// 			success(res) {
				// 				if (res.confirm) {
				// 					uni.navigateBack()
				// 				}
				// 			}
				// 		})
				// 	}
				// 	if (res.data.status == 2) {
				// 		uni.showModal({
				// 			confirmText: '联系客服',
				// 			confirmColor: '#5e49c3',
				// 			content: '已被禁用，有疑问请咨询客服',
				// 			title: '提示',
				// 			success(res) {
				// 				if (res.confirm) {
				// 					uni.navigateTo({
				// 						url: '/pages/user/public/kefu'
				// 					})
				// 				} else if (res.cancel) {
				// 					uni.navigateBack()
				// 				}
				// 			}
				// 		})
				// 	}
				// } else {
				// 	uni.showModal({
				// 		confirmText:'申请',
				// 		confirmColor:'#5e49c3',
				// 		content:'立即申请成为合伙人',
				// 		title:'提示',
				// 		success(res) {
				// 			if(res.confirm){
				// 				that.commissionapply()
				// 			}else if(res.cancel){
				// 				uni.navigateBack()
				// 			}
				// 		}
				// 	})
				// }
				// });
			},
			commissionapply() {
				var that = this;
				// that.$http('commission.apply').then(res => {
				// if (res.code == 0) {
				if (false) {
					uni.showToast({
						title: '申请成功'
					})
					// that.getCheck()
				} else {
					uni.showModal({
						confirmText: '重新申请',
						confirmColor: '#5e49c3',
						content: '合伙人申请失败',
						title: '提示',
						success(res) {
							if (res.confirm) {
								that.commissionapply()
							} else if (res.cancel) {
								// uni.navigateBack()
							}
						}
					})
				}
				// });
			},
			// 我的团队
			// getInviteList() {
			// 	var that = this;
			// 	that.$api('distribution.ulist', {
			// 		uid: this.userInfo.id,
			// 		type: this.navbar[this.currentTab].type
			// 	}).then(res => {
			// 		// console.log(res)
			// 		if (res.data.length > 0) {
			// 			if (that.team.length > 0) {
			// 				var dd = this.team;
			// 				this.team = dd.concat(res.data);
			// 				this.pages++;
			// 			} else {
			// 				this.team = res.data;
			// 				this.pages++;
			// 			}
			// 		} else {
			// 			// this.empty = true
			// 		}
			// 	});
			// },

		},
		onPullDownRefresh() {
			// var that = this;
			// setTimeout(function() {
			// 	this.pages = 1;
			// 	this.team = [];
			// 	that.getInviteList();
			// 	uni.stopPullDownRefresh();
			// }, 1000);
		},
		onReachBottom() {
			// this.getInviteList();
		},
	}
</script>

<style lang="scss" scoped>
	.commission-wrap {
		background: url('http://file.shopro.top/imgs/commission/commission_bg1.jpg') no-repeat;
		background-size: cover;
		height: 100%;
		width: 100%;
		position: absolute;
		background-position: 50%;
		transition: all 0.3s ease-in-out 0s;
		overflow: hidden;
	}

	// 进度条
	.progress-box {
		.progress-tip {
			font-size: 24rpx;
			font-weight: 500;
			color: #c7b2ff;
		}

		.progress-num {
			font-size: 24rpx;
			position: absolute;
			color: #c7b2ff;
			bottom: -30rpx;
			white-space: nowrap;
		}

		.round-wrap {
			width: 30rpx;
			height: 30rpx;
			border: 2rpx solid #5c3cff;
			background: linear-gradient(0deg, #a36fff 0%, #846fff 100%);
			border-radius: 50%;
			position: absolute;
			bottom: -6rpx;
			transform: translateY(-50%);
			left: 0;
			margin-left: -15rpx;

			.round-inner {
				width: 20rpx;
				height: 20rpx;
				border: 2rpx solid #5c3cff;
				background: linear-gradient(0deg, #a36fff 0%, #846fff 100%);
				border-radius: 50%;
				position: absolute;
				top: 50%;
				left: 50%;
				transform: translate(-50%, -50%);
			}
		}
	}

	// 佣金中心权限验证蒙层
	.blur {
		filter: blur(20rpx);
		transition: all 0.3s ease-in-out 0s;
	}

	.auth-box {
		width: 100%;
		height: 100%;
		background: none;

		.notice-box {
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			background-color: #fff;
			width: 612rpx;
			min-height: 658rpx;
			background: #ffffff;
			padding: 30rpx;
			border-radius: 20rpx;

			.img-wrap {
				margin-bottom: 50rpx;

				.notice-img {
					width: 180rpx;
					height: 170rpx;
				}
			}

			.notice-title {
				font-size: 35rpx;
				font-weight: bold;
				color: #46351b;
				margin-bottom: 28rpx;
			}

			.notice-detail {
				font-size: 28rpx;
				font-weight: 400;
				color: #999999;
				line-height: 36rpx;
				margin-bottom: 50rpx;
			}

			.notice-btn {
				width: 492rpx;
				line-height: 70rpx;
				background: linear-gradient(-90deg, #a36fff, #5336ff);
				box-shadow: 0px 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34);
				border-radius: 35rpx;
				font-size: 28rpx;
				font-weight: 500;
				color: #ffffff;
				margin-bottom: 10rpx;
			}

			.back-btn {
				width: 492rpx;
				line-height: 70rpx;
				font-size: 28rpx;
				font-weight: 500;
				color: #c5b8fb;
				background: none;
			}
		}
	}

	// 成为分销商
	.into-agent-modal {
		.condition-box {
			width: 640rpx;
			height: 786rpx;
			background: url('http://file.shopro.top/imgs/commission/into_commission.png') no-repeat;
			background-size: 100% 100%;
		}

		.goods-condition {
			width: 484rpx;
			height: 580rpx;
			padding: 80rpx 0 30rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			position: relative;

			.card-wrap {
				width: 484rpx;
				height: 460rpx;
				padding: 10rpx;
				padding-bottom: 30rpx;
			}

			.modal-progress {
				.progress-tip {
					font-size: 24rpx;
				}

				.progress-box {
					margin-right: 10rpx;

					.cu-progress {
						width: 200rpx;
						position: relative;

						.round-wrap {
							width: 20rpx;
							height: 20rpx;
						}

						.round-inner {
							width: 10rpx;
							height: 10rpx;
						}
					}
				}
			}

			.card-box {
				background: rgba(#c3b6ff, 0.3);
				padding: 10rpx;
				border-radius: 10rpx;

				.img-wrap {
					background: #fff;
					width: 110rpx;
					height: 110rpx;
					border-radius: 10rpx;
					margin-right: 20rpx;

					.goods-img {
						width: 110rpx;
						height: 110rpx;
						border-radius: 10rpx;
					}
				}

				.detail {
					height: 110rpx;
					width: 280rpx;
					align-items: flex-start;

					.title {
						font-size: 20rpx;
						font-weight: 500;
						color: #333333;
						line-height: 35rpx;
						text-align: left;
					}

					.sub {
						font-size: 16rpx;
						font-weight: 500;
						color: #9281e2;
						text-align: left;
						width: 280rpx;
					}
				}
			}

			.filter-card {
				filter: grayscale(100%);
				filter: gray;
			}

			.btn-box {
				background-color: #fff;
				width: 100%;
				position: absolute;
				bottom: 0;

				.buy-btn {
					width: 390rpx;
					line-height: 60rpx;
					background: linear-gradient(-90deg, #a36fff, #5336ff);
					box-shadow: 0px 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34);
					border-radius: 35rpx;
					font-size: 24rpx;
					font-weight: 500;
					color: #ffffff;
				}

				.tips {
					font-size: 20rpx;
					font-weight: 500;
					color: #9281e2;
				}
			}
		}
	}

	// 用户资料卡片
	.user-card {
		width: 690rpx;
		min-height: 350rpx;
		border-radius: 14rpx;
		margin: 30rpx;
		background: url('http://file.shopro.top/imgs/commission/commission_card_bg.png') no-repeat;
		background-size: 100% 100%;
		padding-top: 10rpx;

		.card-top {
			padding: 40rpx 40rpx 30rpx;
			margin-bottom: 30rpx;
			border-bottom: 1px solid rgba(#fff, 0.12);

			.user-name {
				font-size: 26rpx;
				font-weight: 500;
				color: #ffffff;
				line-height: 30rpx;
				margin-bottom: 20rpx;

			}

			.invite-code {
				margin-top: 20rpx;
				font-size: 26rpx;
				font-weight: 500;
				color: #ffffff;
				line-height: 30rpx;
				display: flex;

				// margin-bottom: 20rpx;
				.btn {
					margin-left: 15rpx;
				}
			}

			.log-btn {
				width: 86rpx;
				line-height: 41rpx;
				border: 1rpx solid rgba(#ffffff, 0.33);
				border-radius: 32rpx;
				font-size: 22rpx;
				font-weight: 400;
				color: #ffffff;
			}

			.look-btn {
				color: #fff;
				font-size: 40rpx;
			}
		}

		.head-img-box {
			margin-right: 26rpx;
			width: 76rpx;
			height: 76rpx;
			border-radius: 50px;
			position: relative;
			background: #fff;
			padding: 10rpx;
			background-clip: padding-box;

			.head-img {
				width: 66rpx;
				height: 66rpx;
				border-radius: 50%;
				position: absolute;
				top: 50%;
				left: 50%;
				transform: translate(-50%, -50%);
			}
		}

		.user-info-box {
			.tag-box {
				background: rgba(0, 0, 0, 0.2);
				border-radius: 21rpx;
				line-height: 38rpx;

				.tag-img {
					width: 36rpx;
					height: 36rpx;
					border-radius: 50%;
				}

				.tag-title {
					font-size: 20rpx;
					padding: 0 10rpx;
					font-weight: 500;
					color: rgba(255, 255, 255, 1);
					line-height: 36rpx;
				}
			}
		}

		.card-bottom {
			margin: 0 40rpx 40rpx;

			.item-title {
				font-size: 24rpx;

				font-weight: 400;
				color: #ffffff;
				line-height: 30rpx;
			}

			.item-detail {
				font-size: 40rpx;
				font-family: DIN;
				font-weight: 500;
				color: #fefefe;
				line-height: 30rpx;
				margin-top: 30rpx;
			}
		}
	}

	// 滚动明细
	.commission-log {
		min-height: 400rpx;
		padding: 0 30rpx;
		margin-top: 60rpx;

		.log-scroll {
			height: 380rpx;

			.log-item-box {
				height: 78rpx;

				.log-time {
					margin-left: 30rpx;
					font-size: 22rpx;
					font-weight: 500;
					color: #fefefe;
					text-align: right;
				}
			}

			.loadmore-wrap {
				line-height: 80rpx;
			}

			.log-item {
				height: 48rpx;
				background: rgba(#5e49c3, 0.4);
				border-radius: 24rpx;
				padding-left: 6rpx;
				padding-right: 20rpx;

				.log-img {
					width: 40rpx;
					height: 40rpx;
					border-radius: 50%;
					margin-right: 10rpx;
				}

				.log-text {
					font-size: 22rpx;
					font-weight: 500;
					color: #fefefe;
					max-width: 480rpx;
				}
			}
		}
	}

	// 功能菜单
	.commission-bottom-bg {
		position: fixed;
		width: 100%;
		bottom: 0;
		z-index: 6;
	}

	.menu-box {
		flex-wrap: wrap;
		margin: 30rpx;
		// position: fixed;
		// width: 750rpx;
		bottom: 0;
		z-index: 10;

		.menu-item {
			width: (690rpx/4);
			margin-bottom: 50rpx;

			.item-img {
				width: 68rpx;
				height: 68rpx;
			}

			.item-title {
				font-size: 24rpx;
				font-weight: 600;
				color: #fff;
				line-height: 30rpx;
				margin-top: 16rpx;
			}
		}
	}

	.bill {
		margin: 30rpx;
		font-weight: bold;
	}

	.u-flex-col {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
	}

	.poster {
		padding: 24rpx 40rpx;

		.footer-btn {
			margin-top: 24rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			view {
				width: 319rpx;
				height: 66rpx;
				border-radius: 40rpx;
				border: 1px solid #4070ff;
				font-size: 26rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #4070ff;
				line-height: 66rpx;
				text-align: center;
			}

			.save {
				background: #4070ff;
				color: #ffffff;
			}
		}
	}
</style>