<template>
	<view>
		<public-module></public-module>
		<view class="headers dis a-c j-c" :style="headerStyle">
			<text>掌柜合伙人</text>
			<view class="right dis a-c">
				<image src="/static/home/customerService.png" mode=""></image>
				<text>客服</text>
			</view>
		</view>
		<view class="homeBackground"></view>
		<view class="" style="padding: 0 30rpx;">
			<view class="dailyData-block">
				<view class="title ">
					<text>今日状况</text>
					<image src="/static/home/icon1.png" class="image1" mode=""></image>
					<image src="/static/home/icon3.png" class="image3" mode=""></image>
				</view>
				<image src="/static/home/icon2.png" class="image2" mode=""></image>
				<view class="data dis f-wrap j-s">
					<view class="dis f-c a-start view">
						<text>3213213</text>
						<text>订单（笔）</text>
					</view>
					<view class="dis f-c a-start view">
						<text>3213213</text>
						<text>新增人员</text>
					</view>
					<view class="dis f-c a-start view">
						<text>3213213</text>
						<text>保费（元）</text>
					</view>
					<view class="dis f-c a-start view">
						<text>3213213</text>
						<text>佣金（元）</text>
					</view>
				</view>
			</view>
			<view class="statistics">
				<u-tabs :list="list" :is-scroll="true" active-color="#333" inactive-color="#999" :current="current"
					@change="change" style="background: transparent;border-bottom: 1rpx solid #EEEEEE;"></u-tabs>
				<view class="count">
					<image src="/static/home/icon4.png" class="mb-2" mode="" @click="invitationCode"></image>
					<view class="data dis f-wrap j-s mb-3">
						<view class="dis f-c a-c view" style="border-right: 1rpx solid #EEEEEE;" @click="closePartner">
							<text>22</text>
							<text>我的管理人</text>
						</view>
						<view class="dis f-c a-c view">
							<text>22</text>
							<text>管理人的工作室</text>
						</view>
						<view class="dis f-c a-c view" style="border-right: 1rpx solid #EEEEEE;">
							<text>22</text>
							<text>我今日新增合伙人</text>
						</view>
						<view class="dis f-c a-c view">
							<text>22</text>
							<text>今日管理人邀请的工作室</text>
						</view>
						<view class="dis f-c a-c view" style="border-right: 1rpx solid #EEEEEE;">
							<text>22</text>
							<text>今日保费</text>
						</view>
						<view class="dis f-c a-c view">
							<text>22</text>
							<text>今日佣金</text>
						</view>
					</view>
					<view class="earnings dis a-c j-s " @click="myEarnings">
						<view class="dis a-c ">
							<image src="/static/home/wallet.png" mode=""></image>
							<text>我的收益</text>
						</view>
						<u-icon name="arrow-right" size="30" color="rgba(35,40,50,0.5)"></u-icon>
					</view>
				</view>
			</view>
		</view>

	</view>
</template>
<script>
	import myDatePicker from '../components/todaydate-picker.vue';
	import QR from "@/common/wxqrcode.js"
	import {
		mapState,
		mapMutations
	} from "vuex"
	import {
		vShow
	} from "vue"
	export default {
		computed: {
			...mapState(['userInfo', "userCheckInfo"]),
		},
		components: {
			myDatePicker
		},
		data() {
			return {
				list: [{
						name: '我是创始人'
					}, {
						name: '我是管理人'
					},
					{
						name: '我是合伙人'
					},
					{
						name: '我是工作室'
					}
				],
				current: 0,
				showData: '全部数据',
				ShowModalCode: false,
				ShowModalCode1: false,
				ShowModalCodebusiness: false,
				teamImg: '',
				workImg: '',
				totalList: {},
				type: uni.getStorageSync('type'),
				headerStyle: {
					backgroundColor: 'transparent',
					backgroundImage: '',
					backgroundSize: '',
					backgroundPosition: '',
					boxShadow: ''
					// 其他样式属性...
				},
				styles: [{
						value: '1',
						text: '渠道',
						notestext: '团队长加出单员模式，无分销模式，结费都在团队长处。',
						checked: true
					},
					{
						value: '2',
						notestext: '团队长加代理人模式，三级分销模式，结费方式为个人，有佣金。',
						text: '个代'
					}
				],
				deptSource: 1
				// type:JSON.parse(localStorage.getItem('type')).data
			}
		},
		async onShow(e) {
			this.type = uni.getStorageSync('type')
			this.showData = '全部数据',
				this.getList()

			// let res = await this.$http.post('/APPPartner/getHomePage', {
			// 	type: uni.getStorageSync('type'),
			// });
			// if (res.code == '200') {
			// 	this.totalList = res.data
			// }

		},
		methods: {
			change(index) {
				this.current = index;
			},
			async getList(beginTime, endTime) {
				let params = {
					type: this.type,
					"endTime": endTime || '',
					"beginTime": beginTime || '',
				}
				let res = await this.$http.post('/APPPartner/getHomePage', params);
				if (res.code == '200') {
					this.totalList = res.data
				}
			},
			searchPopup() {
				this.$refs.datePicker.open()
			},
			confirmPickDate(dateStr, dateStr1, val) {
				if (dateStr) {
					dateStr += ' 00:00:01'
				}
				if (dateStr1) {
					dateStr1 += ' 23:59:59'
				}
				this.showData = val
				this.getList(dateStr, dateStr1)
			},
			styleChange(e) {
				this.deptSource = e.detail.value
			},
			recruitmentCode() {
				this.ShowModalCode = true
				this.teamImg = QR.createQrCodeImg(this.$base.h5BaseUrl + "/#/pages/index/applyteam?userId=" + this.userInfo
					.sysUser.userId, {
						size: parseInt(200) //二维码大小  
					})
			},
			ShowModalCodeSumbit() {
				console.log(this.deptSource, 44444444);
				this.ShowModalCode1 = true
				this.workImg = QR.createQrCodeImg(this.$base.h5BaseUrl + "/#/pages/index/applystudio?deptSource=" + this
					.deptSource + '&userId=' + this.userInfo.sysUser.userId, {
						size: parseInt(200) //二维码大小  
					})
			},
			recruitmentWorkCode() {
				this.ShowModalCodebusiness = true
				this.deptSource = 1

			},
			detail(id) {
				uni.navigateTo({
					url: "/pages/institutional/walletDetail?id=" + id
				})
			},
			closeDetailPro(val) {
				uni.navigateTo({
					url: `/pages/institutional/detail?deptId=${val.deptId}&deptName=${val.deptName}&startTime=${val.startTime}`
				})
			},

			closeInstitution() {
				// if(this.totalList.workroomNum>0){

				// }
				// this.totalList.type=1
				uni.navigateTo({
					url: "/pages/institutional/institutionalTeam?key=" + encodeURIComponent(JSON.stringify(this
						.totalList))
				})
			},
			closeStudion() {
				uni.navigateTo({
					url: "/pages/institutional/institutional?key=" + encodeURIComponent(JSON.stringify(this
						.totalList))
				})
			},
			//人员详情
			closePartner() {
				uni.navigateTo({
					url: "/pages/institutional/partner"
				})
			},
			//我的收益
			myEarnings() {
				uni.navigateTo({
					url: "/pages/institutional/myEarnings"
				})
			},
			//邀请码
			invitationCode() {
				uni.navigateTo({
					url: "/pages/institutional/invitationCode"
				})
			},
			viewTeam() {
				uni.navigateTo({
					url: "/pages/institutional/institutional"
				})
			},
			bankCard() {
				uni.navigateTo({
					url: "/pages/wallet/bankCard"
				})
			},
			bankwallet() {
				uni.navigateTo({
					url: "/pages/index/applystudio"
				})
			},
		}
	}
</script>
<style lang="scss" scoped>
	page {
		background-color: #F7F7F7;
	}

	.headers {
		position: fixed;
		top: 0;
		left: 0;
		height: auto;
		width: 100%;
		z-index: 999999;
		padding: 30rpx;
		padding-top: 50px;

		text {
			font-size: 36rpx;
			font-weight: bold;
			color: #fff;
		}

		.right {
			position: absolute;
			right: 30rpx;

			image {
				width: 28rpx;
				height: 28rpx;
				margin-right: 4rpx;
			}

			text {
				font-weight: 400;
				color: #fff;
				font-size: 24rpx;
			}
		}
	}

	.homeBackground {
		height: 177px;
		width: 100%;
		background-image: url("/static/home/back.png");
		background-size: 100% 100%;
	}

	.dailyData-block {
		width: 100%;
		margin-top: -136rpx;
		background-image: url("/static/home/aaa.png");
		background-size: 100% 100%;
		backdrop-filter: blur(2rpx);
		padding: 20rpx 40rpx;

		// background: rgba(255, 255, 255, 0.2);
		// border-radius: 16px;
		// box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
		// backdrop-filter: blur(30px);
		// border: 1px solid rgba(255, 255, 255, 1);
		.title {
			position: relative;
			display: inline-block;

			text {
				color: #fff;
				font-weight: bold;
				font-size: 36rpx;
				margin-left: 10rpx;
			}

			.image1 {
				width: 16rpx;
				height: 16rpx;
				position: absolute;
				top: 0;
				right: -20rpx;
			}

			.image3 {
				width: 166rpx;
				height: 20rpx;
				position: absolute;
				bottom: 0;
				left: 0;
			}

		}

		.image2 {
			width: 138rpx;
			height: 138rpx;
			position: absolute;
			top: -50rpx;
			right: 22rpx;
		}

		.data {
			.view {
				width: 50%;

				text:first-child {
					font-size: 46rpx;
					color: #333;
					font-weight: bold;
				}

				text:last-child {
					font-size: 24rpx;
					color: #666;
				}
			}
		}
	}

	.statistics {
		background: #FFFFFF;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		margin-top: 15rpx;

		.count {
			padding: 34rpx 30rpx;
			box-sizing: border-box;

			image {
				width: 100%;
				height: 120rpx;
			}
		}

		.data {
			padding: 30rpx;
			box-sizing: border-box;
			background-color: #FBFBFB;
			border-radius: 8rpx;

			.view {
				width: 49%;

				text:first-child {
					font-size: 36rpx;
					color: #333;
					font-weight: bold;
					margin-bottom: 4rpx;
				}

				text:last-child {
					font-size: 22rpx;
					color: #999;
				}
			}
		}

		.earnings {
			image {
				width: 40rpx;
				height: 40rpx;
			}

			text {
				font-size: 30rpx;
				color: #333;
				margin-left: 14rpx;
			}
		}
	}

	::v-deep {
		.u-tab-bar {
			background: linear-gradient(90deg, #2DD9FF 0%, #2D6DFF 100%) !important;
			border-radius: 6rpx;
		}
	}
</style>