<template>
	<view>
		<view class="orderWrapper">
		    <!-- 头部区域：订单号、头像 -->
		    <view class="orderHead">
		        <view class="orderHeadTitle">
		            <view>
		                <text>订单号</text>
		                <text class="orderDetail">{{info.orderId}}</text>
		            </view>

		        </view>
		    </view>
		    <!-- 中部区域：订单详情 -->
		    <view class="orderMid">
		        <view>
		            <text>需求号</text>
		            <text class="courseNum" >{{info.requireId}}</text>
		        </view>
		        <view>
		            <text>课程号</text>
		            <text class="courseNum" >{{info.courseId}}</text>
		        </view>
		    </view>
		    <view class="orderBottom">

		        <view>
		            <text>下单日期</text>
		            <text class="orderDetail">{{info.datetime}}</text>
		        </view>
				<view>
				    <text>返现金额</text>
				    <text class="orderDetail">{{info.recoCommission/100}}</text>
				</view>
				<view>
				    <text>客户状态</text>
				    <text class="orderPayStatus">{{info.status}}</text>
				</view>
		        <view>
		            <text>提现状态</text>
		            <text class="orderPayStatus">{{info.recoStatus}}</text>
		        </view>
		    </view>
			

		    
		    <view class="payWrapper">
				<view class="pay" v-if="showWithdrawBtn">
					<view class="paidSucceed">
					    <button class="payButton" @click="startWithdraw" type="primary">申请转出</button>
					</view>
				</view>
		    </view>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {},
				showWithdrawBtn: false,//是否 显示 申请提现 btn
			};
		},
		onLoad(option) {
			if (option.orderId !== undefined) {
				this.getOne(option.orderId)
			}
		},
		methods: {
			// 获取订单信息
			async getOne(id) {
				//console.log(id)
				const queryObj = {
					orderId: id
				}
				const {data: result} = await uni.$http.get('/payment/order-info/getOrderInfoByOrderId', {orderId: id})
				this.info = result.data.one
				//console.log(this.info)
				// 判断支付状态
				if (this.info.status === '支付成功' && this.info.recoStatus === '未申请') {
					   this.showWithdrawBtn = true
				}
			},
			startWithdraw(){
				uni.$showMsg("正在申请 “商户向客户零钱包转帐的功能”，如急需转出，请联系在线客服处理，谢谢！",5000)
			}

		}
	}
</script>

<style lang="scss" scoped>
/* 设置全局边距 */
.orderWrapper{
    padding-left: 20rpx;
    /* background-color: yellowgreen; */
}

/* 头部区域 */
.orderHead{
    display: flex;
    position: relative;
    height: 200rpx;
    padding-top: 20rpx;
}

/* 头像 */
.headImg{
    width: 160rpx;
    height: 160rpx;
    border-radius: 30rpx;
    position: absolute;
    right: 30rpx;
}

.orderHeadTitle{
    display: flex;
    flex-direction: column;
    height: 80px;
    justify-content: space-around;
}

/* 设置内容样式 */
.orderDetail,
.courseNum,
.orderPayStatus{
    margin-left: 20rpx;
    font-weight: bold;
}

.courseNum{
    color: #00B0F0;
    //text-decoration: underline;
}

/* 支付状态字体样式 */
.orderPayStatus{
    color: red;
}

/* 中部区域 */
.orderMid{
   // height: 220rpx;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

/* 底部区域 */
.orderBottom{
    margin-top: 40rpx;
    height: 260rpx;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

/* 支付倒计时 */
.orderPay{
    margin-top: 40rpx;
    display: flex;
    align-items: baseline;
}
/* 倒计时时间格式 */
.orderPayTime{
    padding-left: 20rpx;
    font-weight: bold;
    font-size: 40rpx;
    color: red;    
}

/* 提醒信息 */
.warning{
    display: flex;
    justify-content: center;    
    margin-top: 60rpx;
}
/* 提醒信息详情 */
.warningDetail{
    width: 80%;
    display: flex;
    flex-direction: column;
    font-size: 44rpx;
    font-weight: bold;
    color: red;
}

/* 支付及查看信息按钮居中排列 */
.payWrapper{
	margin-top: 160rpx;
    display: flex;
    justify-content: center;
}

.paidSucceed{
    display: flex;
    width: 100%;
    justify-content: space-around;
}

.payButton{
	border-radius: 30rpx;
}

.pay{
    /* display: flex; */
    width: 100%;
}
</style>
