<template>
	<view class="container">
		<view class="page-block">
			<view class="page-title-block">
				<view class="title">提现信息</view>
			</view>
			
			<view class="content">
				
				<view class="cell flex flex-y-center">
					<view class="title-block">
						<text>提现状态</text>
					</view>
					<view class="desc">
						<view class="input-box" style="color: red;">{{info.state==1?'待审核' :info.state==2?'通过': info.state==3?'拒绝':''}}</view>
					</view>
				</view>
				
				<view class="cell flex flex-y-center">
					<view class="title-block">
						<text>提现姓名</text>
					</view>
					<view class="desc">
						<view class="input-box">{{info.username}}</view>
					</view>
				</view>
				
				<view class="cell flex flex-y-center">
					<view class="title-block">
						<text>提现账号</text>
					</view>
					<view class="desc">
						<view class="input-box">{{info.account}}</view>
					</view>
				</view>
				
				<view class="cell flex flex-y-center">
					<view class="title-block">
						<text>提现金额</text>
					</view>
					<view class="desc">
						<view class="input-box">￥{{info.tx_cost}}</view>
					</view>
				</view>
				
				<view class="cell flex flex-y-center">
					<view class="title-block">
						<text>实际金额</text>
					</view>
					<view class="desc">
						<view class="input-box">￥{{info.sj_cost}}</view>
					</view>
				</view>
				
				<view class="cell flex flex-y-center">
					<view class="title-block">
						<text>提现类型：</text>
					</view>
					<view class="desc">
						<view class="input-box">{{info.type==1?'微信':info.type==2?'支付宝':"银行"}}</view>
					</view>
				</view>
				
				<view class="cell flex flex-y-center" v-if="info.state != 1">
					<view class="title-block">
						<text>审核时间</text>
					</view>
					<view class="desc">
						<view class="input-box">{{sh_time}}</view>
					</view>
				</view>
				
				<view class="cell flex flex-y-center" v-if="info.state == 3">
					<view class="title-block">
						<text>拒绝理由</text>
					</view>
					<view class="desc">
						<view class="input-box">{{info.reason}}</view>
					</view>
				</view>
				
			</view>
		</view>
		
		<view style="height:30rpx;"></view>
		
		<view class="footer-bar" style="height: 100rpx;" v-if="info.state == 1">
			<view class="content flex flex-center" style="height: 100rpx;">
				<view class="detail-btn flex flex-center" @click="del" style="border-right: 2rpx solid #F4F5F7;">
					<image src="../static/images/icon_16.png" mode="aspectFit" class="btn-icon"></image>
					<view style="color:#999999">拒绝</view>
				</view>
				<view class="detail-btn flex flex-center" @click="enit">
					<image src="../static/images/icon_17.png" mode="aspectFit" class="btn-icon"></image>
					<view style="color:#3387FF">线下打款</view>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	

	
	export default {
		data() {
			return {
				info: {},
				type:2,
				store_id:'',
				id:'',
				admin_id:'',shop_title:'',
				sh_time:'',
			}
		},
		
		onLoad(e) {
			this.store_id = uni.getStorageSync("store_id");
			this.admin_id = uni.getStorageSync("admin_id");
			this.id = e.id;
			this.getData(e.id);
		},


		methods: {
			
			enit() {
				uni.showModal({
					title: '提示',
					content: '确定已打款吗？',
					showCancel: true,
					cancelText: '取消',
					confirmText: '确定',
					success: res => {
						if (res.confirm) {
							this.request({
								url: 'Smdcshop/shared_withdrawal_state',
								data: {
									id: this.id,
									state:2
								},
							}).then(res => {
								console.log(res, "res")
								if (res.code === 200 || res.code === "200") {
									uni.showToast({
										title:res.message,
										icon: "none",
									})
									setTimeout(() => {
										this.getData(this.id);
									}, 2000)
								}
							}).catch((res) => {
								uni.showToast({
									title: res.message,
									icon: "none",
								})
							});
						}
					},
					fail: () => {},
					complete: () => {}
				});
			},
			
			del() {
				uni.showModal({
					title: '提示',
					content: '是否要拒绝吗？',
					showCancel: true,
					cancelText: '取消',
					confirmText: '确定',
					success: res => {
						if (res.confirm) {
							this.request({
								url: 'Smdcshop/shared_withdrawal_jujue',
								data: {
									id: this.id,
									reason:'',
								},
							}).then(res => {
								console.log(res, "res")
								if (res.code === 200 || res.code === "200") {
									uni.showToast({
										title:res.message,
										icon: "none",
									})
									setTimeout(() => {
										this.getData(this.id);
									}, 2000)
								}
							}).catch((res) => {
								uni.showToast({
									title: res.message,
									icon: "none",
								})
							});
						}
					},
					fail: () => {},
					complete: () => {}
				});
			},
			
			getData(id) {
				this.request({
					url: 'Smdcshop/shared_withdrawal_info',
					data: {
						id: id
					}
				}).then(res => {
					if (res.code == "200") {
					this.info = res.data
					this.sh_time = filterTime( Number(res.data.sh_time*1000) )
					function filterTime(time) {
							const date = new Date(time)
							const Y = date.getFullYear()
							const M = date.getMonth() + 1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1
							const D = date.getDate()
							const H = date.getHours() // 小时
							const K = date.getMinutes() // 分钟
							const S = date.getSeconds() // 秒
							return `${Y}-${M}-${D} ${H}:${K}:${S}`
						}
					}
				})
			}
		}
	}
</script>
<style>
	/* @import url("./static/css/common.css"); */
	page {
		background-color: #F4F5F7;
	}
	/*  */
		.page-block {}
	
		.page-block .page-title-block {
			padding: 20rpx 25rpx;
		}
	
		.page-block .page-title-block .title {
			font-size: 28rpx;
			line-height: 40rpx;
			color: #999;
		}
	
		.page-block .content {
			padding: 0 25rpx;
			background-color: #fff;
		}
	
		.page-block .cell {
			min-height: 100rpx;
			border-bottom: 1rpx solid #f5f5f5;
		}
	
		.page-block .cell:last-child {
			border-bottom: none;
		}
	
		.page-block .cell .title-block {
			min-width: 155rpx;
			flex: none;
			font-size: 30rpx;
			color: #333;
			font-weight: 600;
			padding-right: 20rpx;
		}
	
		.page-block .cell .required::after {
			content: "*";
			color: #f00;
		}
	
		.page-block .cell .desc {
			flex: auto;
			height: 100%;
		}
		.page-block .cell .desc .desc-info{
			padding:30rpx 0;
			font-size: 28rpx;
			color: #999;
			line-height: 40rpx;
		}
	
		.page-block .cell .input-box {
	
			height: 100rpx;
			line-height: 100rpx;
			font-size: 28rpx;
			/* color: #999; */
		}
	
		.page-block .radio-btn {
			zoom: 0.7;
		}
	
		.page-block .radio-text {
			margin: 0 40rpx 0 8rpx;
			font-size: 28rpx;
			color: #999;
		}
	
		/*  */
		.footer-bar {
			height: 160rpx;
			/*兼容 IOS<11.2*/
			padding-bottom: constant(safe-area-inset-bottom);
			/*兼容 IOS>11.2*/
			padding-bottom: env(safe-area-inset-bottom);
			box-sizing: content-box;
		}
	
		.footer-bar .content {
			width: 100%;
			height: 160rpx;
			background-color: #fff;
			position: fixed;
			left: 0;
			bottom: 0;
			z-index: 100;
			/*兼容 IOS<11.2*/
			padding-bottom: constant(safe-area-inset-bottom);
			/*兼容 IOS>11.2*/
			padding-bottom: env(safe-area-inset-bottom);
			box-sizing: content-box;
			box-shadow: 0 -5rpx 10rpx #eee;
			
		}
	
		.footer-bar .content .btn {
			width: 700rpx;
			height: 100rpx;
			background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
			border-radius: 8rpx;
			box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(51, 135, 255, 0.20);
			text-align: center;
			line-height: 100rpx;
			font-size: 36rpx;
			font-weight: 500;
			color: #fff;
		}
		.footer-bar .content .detail-btn {
			width: 50%;
			height: 40rpx;
		
		}
		
		.footer-bar .content .detail-btn .btn-icon {
			flex: none;
			display: block;
			width: 32rpx;
			height: 32rpx;
			margin-right: 8rpx;
		
		}
	
</style>
