<template>
	<view class="page">
		<view class="" :style="{height:tab1==0?'356rpx':'175rpx'}"
			style="background: #fff;padding: 0 32rpx;border-bottom: 2rpx solid rgba(0, 0, 0, 0);">
			<u-navbar :fixed="false" bgColor='rgba(0,0,0,0)' placeholder :safeAreaInsetTop="true" @leftClick="return1">
				<view class="index-header  u-flex u-row-between" slot="center" style="position: relative;">
					<view class="" style="margin-left: -11rpx;">
						<u-tabs :current="tab1" :list="list4" lineWidth="42" lineHeight="5" :lineColor="bgImage"
							:activeStyle="{
							    color: '#303133',
							    fontWeight: 'bold',
							}" :inactiveStyle="{
							    color: '#606266',
							}" itemStyle=" padding-right: 15px; height: 34px;" @click="TabsTop">
						</u-tabs>
					</view>
				</view>
			</u-navbar>
			<view v-if="tab1 ==0" class="search u-flex" style="margin-top: 20rpx;">
				<u-icon name="search"></u-icon>
				<input type="text" placeholder="请输入关键词搜索">
			</view>
			<view v-if="tab1 ==0" class="shaixuan u-flex u-row-between"
				style="margin-top: 20rpx;border-top:2rpx solid #f6f6f6 ;padding-top: 16rpx;">
				<view class="u-flex" @click="showtime = true">
					<text style="margin-right: 14rpx;">{{date || '选择时间'}}</text>
					<u-icon name="arrow-down-fill" size="16"></u-icon>
				</view>
				<view class="u-flex" @click="show = true">
					<text style="margin-right: 14rpx;">{{label}}</text>
					<u-icon name="arrow-down-fill" size="16"></u-icon>
				</view>
			</view>
		</view>
		<view class="content">
			<view class="list" v-if="tab1 == 0">
				<view class="" v-if="source_type == 'order'">
					<view class="">
						订单编号：287910109281003
					</view>
					<view class="u-flex u-row-between"
						style="margin-top: 20rpx; border-top:2rpx solid #F6F6F6;padding-top: -18rpx;box-sizing: border-box;">
						<view class="left">
							<view class="top">
								<text class="left">
									陈昂
								</text>
								<text class="right">
									Java高级工程师
								</text>
							</view>
							<view class="concent">
								<text class="left">佣金内容</text>
								<text class="right">协助完成面试</text>
							</view>
							<view class="concent u-flex">
								<text class="left">佣金金额</text>
								<view class="money">
									<text style="font: 24rpx;">¥</text>
									<text style="font-size: 32rpx;">200.00</text>
								</view>
							</view>
						</view>
						<view class="right">
							<view class="top">
								<text class="left">
									职位负责人
								</text>
								<text class="right">
									林景宁
								</text>
							</view>
							<view class="concent">
								<text class="left">offer时间</text>
								<text class="right">2023.03.12 12:43</text>
							</view>
							<view class="concent">
								<text class="left">过保时间</text>
								<text class="right">2023.03.12 12:43</text>
							</view>
						</view>
					</view>
					<view class="bottom u-flex u-row-between">
						<view class="left">
							<text>推荐时间：2023.03.23 12:30</text>
						</view>
						<view class="right">
							<text>佣金结算状态：未回款</text>
						</view>
					</view>
				</view>
				<view class="list1" v-if="source_type == 'invite'">
					<view class="">
						订单编号：287910109281003
					</view>
					<view class="u-flex u-row-between">
						<view class="u-flex"
							style="border-top: 2rpx solid #F6F6F6;margin-top: 20rpx;padding-top: 20rpx;">
							<text style="margin-right: 16rpx;" class="title">猎头成单</text>
							<view class="back u-flex">
								<image style="width: 26rpx;height: 26rpx;margin-top: 3rpx;"
									src="static/images/dikou-tips.png" mode="">
								</image>
								<text class="font" style="margin-left: 12rpx;">订单疑问</text>
							</view>
						</view>
						<view class="money">
							<text style="font-size: 24rpx;">¥</text>
							<text style="font-size: 32rpx;">200.00</text>
						</view>
					</view>
					<view class="u-flex u-row-between" style="margin-top: 22rpx;">
						<text class="data">邀请日期 2023.03.12 12:4</text>
						<text class="data1">结算款时间:2023.03.12 12:</text>
					</view>
				</view>
			</view>
			<view class="" v-if="tab1 == 1">
				<u-subsection mode="subsection" :list="list2" :current="current" @change="change"
					keyName="label"></u-subsection>
				<view class="yong">
					<view class="top">
						<text class="left">订单编号：287910109281003</text>
						<view class="right">
							<text style="font-size: 24rpx;">¥</text>
							<text style="font-size: 32rpx;">200.00</text>
						</view>
					</view>
					<view class="" style="border-top:2rpx solid #F6F6F6 ;margin-top: 20rpx;">
						<view class="u-flex u-row-between leftf">
							<text class="leftff">邀请类型</text>
							<text>猎头成单</text>
						</view>
						<view class="u-flex u-row-between leftf">
							<text class="leftff">邀请时间</text>
							<text>2023.08.23 12:16</text>
						</view>
						<view class="u-flex u-row-between leftf">
							<text class="leftff">提现账号</text>
							<text>中国农业银行(2392)</text>
						</view>
						<view class="u-flex u-row-between leftf">
							<text class="leftff">申请时间</text>
							<text>2023.08.23 12:16</text>
						</view>
						<view class="u-flex u-row-between leftf">
							<text class="leftff">到账时间</text>
							<text>2023.08.23 12:16</text>
						</view>
						<view class="u-flex u-row-between leftf">
							<text class="leftff">提现状态</text>
							<text>已提现</text>
						</view>
					</view>
				</view>
			</view>
			<view style="height: 70vh;justify-content: center;" class="u-flex" v-if="list.length == 0&&tab1 == 0">
				<u-empty text="暂无数据" mode="list"></u-empty>
			</view>
			<view style="height: 88vh;justify-content: center;" class="u-flex" v-if="list.length == 0 &&tab1 == 1">
				<u-empty text="暂无数据" mode="list"></u-empty>
			</view>
		</view>
		<u-datetime-picker :show="showtime" mode="year-month" @confirm="changetime"
			@cancel="showtime = false"></u-datetime-picker>
		<u-picker :show="show" :columns="columns" keyName="label" @cancel="show = false" @confirm="enter"></u-picker>
	</view>
</template>

<script>
	import {
		commission_list
	} from "@/units/inquire.js"
	export default {
		data() {
			return {
				show: false,
				showtime: false,
				tab1: 0,
				current: 0,
				date: "",
				list: [],
				list2: [{
					label: '订单佣金',
					// 其他属性值
					source_type: "order"
				}, {
					label: '邀请佣金',
					source_type: "invite"
				}],
				source_type: "order",
				label: "订单佣金",
				columns: [
					[{
						label: '订单佣金',
						// 其他属性值
						source_type: "order"
						// ...
					}, {
						label: '邀请佣金',
						source_type: "invite"
					}]
				],
				list4: [{
						name: "佣金明细"
					},
					{
						name: "提现记录"
					}
				]
			}
		},
		onLoad(options) {
			this.source_type = options.source_type
			if(this.source_type == "order"){
				this.label= "订单佣金"
			}else{
				this.label= "邀请佣金"
			}
			this.commission_list()
		},
		computed: {
			bgImage() {
				return `url(${require('@/static/images/juxing.png')}) 100% 100%`
			}
		},
		methods: {
			return1() {
				uni.navigateBack()
			},
			change(e) {
				console.log(e);
				this.current = e
			},
			enter(e) {
				this.label = e.value[0].label
				this.source_type = e.value[0].source_type
				this.show = false
			},
			async changetime(e) {
				const timeFormat = uni.$u.timeFormat;
				let timeValue = await timeFormat(e.value, 'yyyy-mm');
				this.date = timeValue;
				this.page = 1
				this.total = 0
				this.list = []
				this.commission_list()
				this.showtime = false
			},
			TabsTop(item) {
				this.tab1 = item.index
			},
			commission_list() {
				commission_list({
					source_type: this.source_type,
					job_name: "",
					is_confirm: "",
					begin_time: "",
					end_time: "",
					time_type: "",
					status: ""
				}).then(res => {
					console.log(res);
					this.list = res.data.data
					console.log(this.list.length);
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.yong {
		background: #FFFFFF;
		border-radius: 16rpx;
		padding: 20rpx 20rpx 26rpx;
		box-sizing: border-box;

		.top {
			.left {
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #555555;
			}

			.right {
				font-family: SFPro-Regular, SFPro;
				font-weight: 400;
				color: #F2413A;
			}
		}

		.leftf {
			font-size: 26rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #555555;
			margin-top: 20rpx;
		}

		.leftff {
			font-size: 26rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #555555;
		}
	}

	.list1 {
		background: #FFFFFF;
		border-radius: 16rpx;

		.data {
			font-size: 24rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #888888;
		}

		.data1 {
			font-size: 24rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #222222;
		}

		.title {
			font-size: 32rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #222222;
		}

		.font {
			font-size: 24rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #fff;
			opacity: 1;
		}

		.back {
			background: #0C66C2;
			border-radius: 6rpx;
			padding: 4rpx 8rpx;
			opacity: 0.5;
		}

		.money {
			font-size: 24rpx;
			font-family: SFPro-Regular, SFPro;
			font-weight: 400;
			color: #F2413A;
			margin-left: 12rpx;
		}
	}
















	.page {
		height: 100vh;

		.content {
			padding: 0 24rpx;
			background: #F3F3F3;
			min-height: 78vh;
			padding-top: 20rpx;


			.list {
				background: #FFFFFF;
				border-radius: 16rpx;
				padding: 20rpx;
				box-sizing: border-box;
			}
		}
	}

	.bottom {
		border-top: 2rpx solid #F6F6F6;
		margin-top: 18rpx;
		padding-top: 18rpx;
		box-sizing: border-box;

		.left {
			font-size: 24rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #555555;
		}

		.right {
			font-size: 24rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #999999;
		}
	}

	.right {
		.concent {
			.left {
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #222222;
			}

			.money {
				font-size: 24rpx;
				font-family: SFPro-Regular, SFPro;
				font-weight: 400;
				color: #F2413A;
				margin-left: 12rpx;
			}

			.right {
				margin-left: 12rpx;
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #555555;
			}
		}

		.top {
			.left {
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #555555;
			}

			.right {
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #555555;
			}
		}
	}

	.left {
		.concent {
			.left {
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #222222;
			}

			.money {
				font-size: 24rpx;
				font-family: SFPro-Regular, SFPro;
				font-weight: 400;
				color: #F2413A;
				margin-left: 12rpx;
			}

			.right {
				margin-left: 12rpx;
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #555555;
			}
		}

		.top {
			.left {
				height: 44rpx;
				font-size: 32rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #222222;
			}

			.right {
				margin-left: 12rpx;
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #141414;
			}
		}
	}

	.search {
		height: 68rpx;
		background: #F3F3F3;
		border-radius: 38rpx;
		padding: 14rpx 28rpx;
		box-sizing: border-box;
	}

	.index-header {
		padding: 0 32rpx;
		height: 50rpx;

		.index-search {
			width: 200rpx;
			height: 64rpx;
			background: #FFFFFF;
			border-radius: 20rpx;
			padding: 0 28rpx;

			.text1 {
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #999999;
				margin-left: 16rpx;
			}
		}
	}

	::v-deep .u-navbar__content__left {
		padding: 0 !important;
	}

	// ::v-deep .u-subsection__item{
	// 	border-radius: 38rpx;
	// }
	// ::v-deep .u-subsection--subsection{
	// 	border-radius: 76rpx;
	// }
</style>