<template>
	<view>
		<block v-if="type=='point'">
			<view class="top">
				<image style="border-radius: 50%;" :src="item.channelLogo" mode=""></image>
				<text class="title">{{item.channelName}}</text>
				<view class="data text-center center">
					<view style="padding: 0;" v-if="price(item)">
						<text class="price plus" style="margin-left: -10rpx;">{{item.price}}</text>
					</view>
					<view v-else style="padding: 0;">
						<text class="price reduce"
							style="padding: 0;color: #F39248;margin-left: -10rpx;">{{item.totalPrice}}</text>
					</view>
				</view>
			</view>
			<view class="card">
				<block v-if="item.type!=4">
					<view class="item">
						<text>交易状态</text>
						<text>{{item.payStatus}}</text>
					</view>
					<view class="item">
						<text>交易金额</text>
						<text>{{item.price || 0.00}}</text>
					</view>
					<view class="item">
						<text>交易手续费</text>
						<text>{{item.fee || 0.00}}</text>
					</view>
					<view class="item">
						<text>交易描述</text>
						<text>{{item.title}}</text>
					</view>
					<view class="item">
						<text>交易时间</text>
						<text>{{item.createTime}}</text>
					</view>
				</block>
				<view class="item">
					<text>交易单号</text>
					<text>{{item.id}}</text>
				</view>
			</view>
		</block>
		<block v-if="type=='balance'">
			<view class="top">
				<image style="border-radius: 50%;" :src="item.logo" mode=""></image>
				<text class="title">{{item.name}}</text>
				<view class="data text-center center">
					<view  style="padding: 0;" v-if="price(item)">
						<text class="price plus" style="margin-left: -10rpx;">{{item.price}}</text>
					</view>
					<view v-else>
						<text class="price reduce"
							style="padding: 0;color: #F39248;margin-left: -10rpx;">{{item.totalPrice}}</text>
					</view>
				</view>
			</view>
			<view class="card">
				<view class="item">
					<text>交易标题</text>
					<text>{{item.title}}</text>
				</view>
				<view class="item">
					<text>交易状态</text>
					<text>{{item.payStatus}}</text>
				</view>
				<view class="item">
					<text>交易金额</text>
					<text class="price">{{item.price || 0.00}}</text>
				</view>
				<view class="item" v-if="item.type=='PAY_CONSUMER'">
					<text>积分手续费</text>
					<text class="price">{{item.fee || 0.00}}</text>
				</view>
				<view class="item">
					<text>交易类型</text>
					<text v-if="item.type=='PAY_CONSUMER'">用户消费</text>
					<text v-else>赠送积分</text>
				</view>
				<view class="item">
					<text>交易时间</text>
					<text>{{item.createTime}}</text>
				</view>
				<view class="item">
					<text>交易单号</text>
					<text>{{item.id}}</text>
				</view>
			</view>
		</block>

		<block v-if="type=='all'">
			<view class="top">
				<block v-if="item.type=='AGENT_CHARGE'">
					<image style="border-radius: 50%;" src="../../../static/logo.png" mode=""></image>
					<text class="title">联兑通</text>
				</block>
				<block v-else>
					<image style="border-radius: 50%;" :src="item.receiverLogo" mode=""></image>
					<text class="title">{{item.receiverName}}</text>
				</block>

				<view class="data text-center center">
					<view style="padding: 0;" v-if="price(item)">
						<text class="price plus"
							style="padding: 0;color: #F39248;margin-left: -10rpx;">{{item.totalPrice}}</text>
					</view>
					<view style="padding: 0;" v-else>
						<text class="price reduce"
							style="padding: 0;color: #F39248;margin-left: -10rpx;">{{item.totalPrice}}</text>
					</view>
				</view>
			</view>
			<view class="card">
				<view class="item">
					<text>交易标题</text>
					<text>{{item.title}}</text>
				</view>
				<view class="item">
					<text>交易状态</text>
					<text>{{item.payStatus}}</text>
				</view>
				<view class="item" v-if="$isNotEmpty(item.pointNum) && item.pointNum != -1">
					<text>积分支付</text>
					<text class="price">{{item.pointNum || 0.00}}</text>
				</view>
				<view class="item">
					<text>余额支付</text>
					<text class="price">{{item.balanceNum || 0.00}}</text>
				</view>
				<view class="item">
					<text>现金支付</text>
					<text class="price">{{item.price || 0.00}}</text>
				</view>
				<view class="item" v-if="$isNotEmpty(item.pointFee) && item.pointFee != -1">
					<text>积分手续费</text>
					<text class="price">{{item.pointFee || 0.00}}</text>
				</view>
				<view class="item" v-if="$isNotEmpty(item.fee) && item.fee != -1">
					<text>交易手续费</text>
					<text class="price">{{item.fee || 0.00}}</text>
				</view>
				<view class="item">
					<text>交易时间</text>
					<text>{{item.createTime}}</text>
				</view>
				<view class="item">
					<text>交易单号</text>
					<text>{{item.id}}</text>
				</view>
			</view>
		</block>


		<button open-type="contact" class="question" style="height: 86rpx;font-size: 28rpx;">
			<text class="center">对订单有疑问</text>
			<text class="cuIcon-right center" style="margin-top: 5rpx;"></text>
		</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				item: null,
				type: ''
			}
		},
		computed: {
			price() {
				return item => {
					if (item.type=='MALL_SEND'||item.type=='SHOP_SEND'||item.type=='MALL_RECHARGE') {
						return true
					}
					return false
				}
			},
		},
		onLoad(options) {
			if (options.billDetail) {
				this.item = JSON.parse(options.billDetail)
			}
			if (options.type) {
				this.type = options.type
			}
		},
		methods: {

		}
	}
</script>

<style lang="scss" scoped>
	.top {
		padding: 50rpx 0 0;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;

		image {
			width: 140rpx;
			height: 140rpx;
		}

		.title {
			color: #000;
			padding-top: 15rpx;
			font-size: 32rpx;
		}

		.data {
			padding-top: 30rpx;
			display: flex;

			image {
				width: 40rpx;
				height: 40rpx;
			}

			view {
				padding-left: 20rpx;

				text:first-child {
					color: #000;
					font-size: 38rpx;
				}

				text:last-child {
					font-size: 32rpx;
					padding-left: 20rpx;
				}
			}
		}
	}

	.card {
		margin-top: 50rpx;
		padding: 20rpx 30rpx;
		background-color: #FFFFFF;

		.item {
			padding: 20rpx 0;
			font-size: 28rpx;
			color: #888888;
			margin: 0 20rpx;
			display: flex;
			justify-content: space-between;
		}
	}

	.question {
		color: #888888;
		background-color: #FFFFFF;
		margin-top: 20rpx;
		padding: 20rpx 50rpx;
		display: flex;
		justify-content: space-between;
	}
</style>
