<template>
	<view class="content">
		<view class="top-status">
			{{chooseItem.status | statusTitle}}
		</view>
		<view class="good-info">
			<view class="good-img-tit flex">
				<image :src="chooseItem.whole.image" mode="" class="good-img"></image>
				<view class="good-tit ">
					<view class="clamp2">
						{{chooseItem.whole.title}}
					</view>
					<view class="good-time">
						{{chooseItem.whole.add_time}}
					</view>
				</view>
			</view>
			<view class="flex good-price">
				<view class="">
					订单总价
				</view>
				<view class="">
					￥{{chooseItem.price}}
				</view>
			</view>
		</view>
		<view class="user-info">
			<view class="top-tit">
				<view class="tit-t"></view>
				<view class="" style="display: inline-block;">
					订单信息
				</view>
			</view>
			<view class="info-wrap">
				<view class="info-tit">
					订单编号:
				</view>
				<view class="info-val">{{chooseItem.order_id}}</view>
			</view>
			<view class="info-wrap">
				<view class="info-tit">
					所属支行:
				</view>
				<view class="info-val">{{chooseItem.touser.bank_branch}}</view>
			</view>
			<view class="info-wrap">
				<view class="info-tit">
					开户行:
				</view>
				<view class="info-val">{{chooseItem.touser.account_Bank}}</view>
			</view>
			<view class="info-wrap">
				<view class="info-tit">
					开户名:
				</view>
				<view class="info-val">{{chooseItem.touser.bank_name}}</view>
				<view class="fz" @click="fz()">
					复制
				</view>
			</view>
			<view class="info-wrap">
				<view class="info-tit">
					银行卡号:
				</view>
				<view class="info-val">45875487854</view>
				<view class="fz" @click="fz()">
					复制
				</view>
			</view>
			<view class="info-wrap">
				<view class="info-tit">
					支付宝账号:
				</view>
				<view class="info-val">{{chooseItem.touser.alipay_no}}</view>
				<view class="fz" @click="fz()">
					复制
				</view>
			</view>
			<view class="info-wrap">
				<view class="info-tit">
					微信收款码:
				</view>
				<image :src="chooseItem.touser.wx_qr" mode="" class="info-img" @click="lookimg(chooseItem.touser.wx_qr)"></image>
			</view>
			<view class="info-wrap">
				<view class="info-tit">
					卖家电话:
				</view>
				<view class="info-val">{{chooseItem.touser.bank_card}}</view>
				<view class="fz" @click="fz()">
					复制
				</view>
			</view>
		</view>
		<view class="up-wrap" v-if="can_addit">
			<view class="up-tit">
				上传凭证
			</view>
			<image src="../../static/img/upimg.png" mode="" class="upimg" v-if="upimg == ''" @click="imgsub()"></image>
			<image :src="upimg" mode="" class="upimg" v-else @click="imgsub()"></image>
		</view>
		<view class="apply-wrap" v-if="can_addit">
			<view class="apply-btn" @click="upnew">
				立即支付
			</view>
		</view>
		<uni-popup ref="lookimg" type="center">
			<view class="pop-wrap" style="position: relative;" >
				<movable-area class="popup-box">
					<movable-view class="popup-item" :scale="true" direction="all">
						<image :src="chooseImg" mode="aspectFit"></image>
					</movable-view>
				</movable-area>
				<image src="../../static/icon/close.png" mode="" class="close" style="width: 80rpx;height: 80rpx;" @click="closePup"></image>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import { upload} from '@/api/order.js';
	import { upEvaluation } from '@/api/whole.js'
	export default {
		data() {
			return {
				chooseImg: '',
				upimg: '',
				chooseItem: '',
				can_addit: false
			}
		},
		onLoad(opt) {
			if(opt.type == 'look') {
				this.can_addit = false
			}
			if(opt.type == 'up') {
				this.can_addit = true
			}
			this.chooseItem = this.$api.prePage().chooseItem
		},
		filters: {
			statusTitle(val) {
				let str = ''
				switch (val) {
					case -2:
						str = '支付超时'
						break;
					case -1:
						str = '待支付'
						break;
					case 0:
						str = '待支付'
						break;
					case 1:
						str = '待审核'
						break;
					case 2:
						str = '收款'
						break;
					case 3:
						str = '重新发放'
						break;
					case 4:
						str = '完成'
						break;
					default:
						str = ''
						break
				}
		
				return str
		
			}
		},
		methods: {
			imgsub() {
				console.log('imgsub');
				upload({
					filename: ''
				}).then(data => {
					this.upimg = data[0].url;
					// this.$set(this, text, data[0].url)
				});
			},
			upnew() {
				let obj = this
				if(obj.upimg == '') {
					return obj.$api.msg('请上传凭证')
				}
				upEvaluation({
					id: obj.chooseItem.id,
					pay_evaluation: obj.upimg
				}).then(res => {
					obj.$api.prePage().refreshList();
					uni.showToast({
						title:'支付成功',
						duration:2000
					});
					setTimeout(function() {
						uni.navigateBack();
					}, 800);
				})
			},
			closePup() {
				this.chooseImg = ''
				this.$refs.lookimg.close()
			},
			// 查看大图
			lookimg(src) {
				console.log(src,'chooseImg++++++')
				this.chooseImg = src
				this.$refs.lookimg.open()
			},
		}
	}
</script>

<style lang='scss' scoped>
	.top-status {
		width: 750rpx;
		height: 89rpx;
		line-height: 89rpx;
		padding-left: 20rpx;
		background: #FFFFFF;
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #FF4C4C;
		line-height: 56rpx;
	}

	.good-info {
		width: 750rpx;
		height: 253rpx;
		padding: 30rpx;
		background: #FFFFFF;
		margin: 20rpx 0;
		.good-price {
			font-size: 26rpx;
			font-family: PingFangSC;
			font-weight: 500;
			color: #333333;
			padding-top: 10rpx;
		}
		.good-img-tit {
			justify-content: flex-start;
			.good-img {
				width: 160rpx;
				height: 160rpx;
				flex-shrink: 0;
				background-color: #eee;
			}
			.good-tit {
				height: 160rpx;
				padding: 20rpx 0 0;
				flex-shrink: 0;
				padding-left: 20rpx;
				width: 450rpx;
				font-size: 26rpx;
				font-family: PingFang SC;
				font-weight: 400;
				color: #1D2023;
				line-height: 40rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				.good-time {
					font-size: 22rpx;
					font-family: PingFang SC;
					font-weight: 400;
					color: #999999;
				}
			}
		}
	}

	.user-info {
		padding: 20rpx 30rpx;
		background-color: #fff;
		margin: 20rpx 0;

		.top-tit {
			padding-bottom: 20rpx;

			.tit-t {

				margin-right: 8rpx;
				display: inline-block;
				width: 3rpx;
				height: 25rpx;
				background: linear-gradient(0deg, #FA2740, #FE5544);
				border-radius: 2rpx;
				font-size: 30rpx;
				font-family: PingFangSC;
				font-weight: 500;
				color: #333333;
			}

		}
	}

	.info-wrap {
		display: flex;
		justify-content: flex-start;
		align-items: flex-start;
		/* text-align: 80rpx; */
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #666666;
		line-height: 56rpx;

		.info-img {
			width: 144rpx;
			height: 147rpx;
			background-color: #eee;
		}

		.info-tit {
			flex-shrink: 0;
			margin-right: 10rpx;
		}

		.fz {
			margin-left: 10rpx;
			text-align: center;
			width: 88rpx;
			height: 45rpx;
			line-height: 45rpx;
			background: #FFFFFF;
			border: 1px solid #DDDDDD;
			border-radius: 23rpx;
		}
	}

	.up-wrap {
		width: 750rpx;
		/* height: 229rpx; */
		background: #FFFFFF;
		padding: 20rpx 30rpx;

		.up-tit {
			font-size: 26rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #666666;
			line-height: 56rpx;
		}

		.upimg {
			display: block;
			width: 150rpx;
			height: 150rpx;
			margin: auto;
		}

	}

	.apply-wrap {
		height: 200rpx;
		padding-top: 62rpx;

		.apply-btn {
			text-align: center;
			width: 560rpx;
			height: 80rpx;
			line-height: 80rpx;
			background: #E62129;
			border-radius: 40rpx;
			margin: auto;
			font-size: 30rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
		}

	}
	.pop-wrap {
		width: 522rpx;
		height: 800rpx;
		// background-color: red;
	}
	.popup-box {
		width: 522rpx;
		height: 800rpx;
		border-radius: 20rpx;
		position: relative;
		overflow: hidden;
		background-color: #fff;
		.popup-item {
			width: 100%;
			height: 100%;
			
			
			image {
				width: 100%;
				// height: 100%;
			}
		}
		
	}
	.close {
		display: block;
		width: 40rpx;
		height: 40rpx;
		border: 50%;
		position: absolute;
		// background-color: red;
		bottom: -100rpx;
		left: 0;
		right: 0;
		margin: 0 auto;
	}
</style>
