<template>
	<view class="row-c m-t20">
		<view class="column_item sys-background-dominant r-30 column-justify-sb" v-if="enteringType===1">
			<view class="column_build column-c">
				<view class="row-c" @click="onCreationTask">
					<image class="wh-80 m-r30"
						src="https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/index/index-add.png"
						mode="">
					</image>
					<text class="text-color-fff sys-weight-600 size-30">新建任务</text>
				</view>
			</view>
			<view class="column_record row-justify-sb center p-lr20">
				<view class="column_task" @click="onGetDraft">
					<view class="row-c m-b16 column-c justify-center line-30">
						<text class="size-26 text-color-fff">任务记录</text>
					</view>
					<text class="column_record_num text-color-fff size-24 text-center r-12 line-30 p-tb6">
						草稿({{memberData.draftNum>99?99:memberData.draftNum}})
					</text>
				</view>
				<view class="column_line"></view>
				<view class="column_task">
					<view class="row-c m-b16 column-c justify-center line-30">
						<text class="size-26 text-color-fff">征信审核</text>
					</view>
					<text class="column_record_num text-color-fff size-24 text-center r-12 line-30 p-tb6">
						待审({{memberData.creditNum>99?99:memberData.creditNum}})
					</text>
				</view>
			</view>
		</view>
		<view class="column_item column-justify-sb" v-else>
			<view class="column column_loan justify-center r-30 p-lr24">
				<view class="row-c">
					<view class="sys-background-dominant r-10" style="width: 8rpx;height: 24rpx;">
					</view>
					<text class="text-color-12 sys-weight-600 size-24 m-l10">今日放款</text>
				</view>
				<view class="row-justify-sb center m-t20 line-40">
					<view class=" row-justify-l">
						<en-number :end-num="memberData.out_money" :text-color="'color-02154E'" :text-weight="'sys-weight-600'"
							:text-size="'size-30'"></en-number>
						<view class="row-justify-sb center line-40 sys-weight-600 color-02154E">万</view>
					</view>
					<view class="row-c">
						<en-number :end-num="moneyData.out_num" :text-color="'color-02154E'"
							:text-weight="'sys-weight-600'" :text-size="'size-30'"></en-number>
						<text class="size-24 text-color-999 m-l10">笔</text>
					</view>
				</view>
			</view>
			<view class="column column_proceeds justify-center r-30 p-lr24">
				<view class="row-c">
					<view class="sys-background-dominant r-10" style="width: 8rpx;height: 24rpx;">
					</view>
					<text class="text-color-12 sys-weight-600 size-24 m-l10">今日回款</text>
				</view>
				<view class="row-justify-sb center m-t20 line-40">
					<view class=" row-justify-l">
						<en-number :end-num="moneyData.put_money" :text-color="'color-02154E'"
							:text-weight="'sys-weight-600'" :text-size="'size-30'"></en-number>
						<view class="row-justify-sb center line-40 sys-weight-600 color-02154E">万</view>
					</view>
					<view class="row-c">
						<en-number :end-num="moneyData.put_num" :text-color="'color-02154E'"
							:text-weight="'sys-weight-600'" :text-size="'size-30'"></en-number>
						<text class="size-24 text-color-999 m-l10">笔</text>
					</view>
				</view>
			</view>
		</view>
		<view class="column_item m-l20 column-justify-sb">
			<view class="task_item row-justify center r-30" @click="onGetTask">
				<view class="m-l40" style="position: relative;">
					<image class="wh-90 r-circle m-r20"
						src="https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/index/index-task.png"
						mode="">
					</image>
					<view class="task_num text-color-fff size-20" style="" v-if="memberData.take_num>0">
						{{memberData.take_num}}
					</view>
				</view>
				<text class="text-color-12 sys-weight-600">领取任务</text>
			</view>
			<view class="task_message row-justify center r-30" @click="onMessage">
				<view class="m-l40" style="position: relative;">
					<image class="wh-90 r-circle m-r20"
						src="https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/index/index-money.png"
						mode="">
					</image>
					<view class="task_num text-color-fff size-20" style="" v-if="memberData.noticeNum>0">
						{{Number(memberData.noticeNum)>99?'99+':memberData.noticeNum}}
					</view>
				</view>
				<text class="text-color-12 sys-weight-600">任务消息</text>
			</view>
		</view>
	</view>
</template>

<script>
	import tools from "@/service/tools";
	import {
		getSysCashier
	} from "@/api/statistics";
	import EnNumber from "@/components/en-utils/en-number/en-number.vue";

	export default {
		name: 'index_column',
		components: {
			EnNumber
		},
		props: {
			memberData: {
				default: {
					position_name: "",
					head_img: "",
					id: 5,
					name: "",
					nickname: "",
					phone: "",
					draftNum: "0",
					creditNum: "0",
					noticeNum: "0",
					take_num: "0",
				}
			},
			is_admin: {
				type: Boolean,
				default: false
			},

			modelTime: {
				default: ''
			}
		},
		watch: {
			'modelTime': function() {

			}
		},
		data() {
			return {
				enteringType: 0,
				moneyData: {
					out_money: 0,
					out_num: 0,
					put_money: 0,
					put_num: 0,
				},
				dateTypeObj: {
					dateType: 1, //时间类型
					selectDate: '', //自定义的时候传数组，其它传开始日期
					money_type: 1,
					censusUserType: 0,
				},
			}
		},
		mounted() {
			this.enteringType = tools.getEnteringType();
			if (this.enteringType !== 1) {
				this.getSysCashier()
			}
		},
		methods: {
			getSysCashier() {
				if (this.enteringType === 1 || this.modelTime === '') {
					return ''
				}
				this.dateTypeObj.selectDate = this.modelTime
				getSysCashier(this.dateTypeObj).then((res) => {
					if (res.code === 1) {
						this.moneyData = res.data
					}
				})
			},
			onGetDraft() {
				uni.navigateTo({
					url: "/page_task/draft/index"
				})
			},
			onGetTask() {
				uni.navigateTo({
					url: "/page_task/gain_task/gain_task"
				})
			},
			onMessage() {
				uni.navigateTo({
					url: "/page_subpack/message/message"
				})
			},
			onCreationTask() {
				uni.navigateTo({
					url: "/page_task/creation_task/creation_task"
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.column_item {
		width: 50%;
		height: 300rpx;
	}

	.column_build {
		height: 160rpx;
		line-height: 160rpx;
	}

	.column_line {
		width: 1rpx;
		margin: 0 6rpx;
		height: 88rpx;
		background: #FFFFFF;
		opacity: 0.5;
	}

	.column_record {
		height: 140rpx;
		background-color: rgba(255, 255, 255, 0.2);
		border-radius: 16rpx 16rpx 30rpx 30rpx;
	}

	.column_task {
		width: 140rpx;
		text-align: center;
	}

	.column_record_num {
		background-color: rgba(0, 0, 0, 0.2);
		opacity: 0.7;
		line-height: 40rpx;
		padding: 0 16rpx;
		display: block;
		height: 46rpx;
		line-height: 46rpx;
	}

	.column_loan {
		height: 140rpx;
		background: linear-gradient(180deg, #94ECE1 0%, rgba(255, 255, 255, 1) 60%, rgba(255, 255, 255, 1) 100%);
	}

	.column_proceeds {
		height: 140rpx;
		background: linear-gradient(180deg, #FFF5DA 0%, rgba(255, 255, 255, 1) 60%, rgba(255, 255, 255, 1) 100%);
	}

	.task_item {
		height: 140rpx;
		background: linear-gradient(180deg, #FFEEDA 0%, rgba(255, 255, 255, 1) 100%);
	}

	.task_message {
		height: 140rpx;
		background: linear-gradient(180deg, #DAF4FF 0%, rgba(255, 255, 255, 1) 100%);
	}

	.task_num {
		border-radius: 40rpx;
		background: red;
		padding: 2rpx 10rpx;
		position: absolute;
		right: 10rpx;
		top: -10rpx;
		line-height: 30rpx;
	}
</style>