<template>
	<view>
		<block v-if="current==0">
			<view class="top">
				<image style="border-radius: 50%;" :src="billDetail.avatar?billDetail.avatar:'/static/icon/avatar.png'" mode="aspectFit"></image>
				<text class="title">{{billDetail.nickName?billDetail.nickName:'微信用户'}}</text>
				<view class="data">
					<view class="mainColor" style="padding: 0;">
						+{{billDetail.cost}}
					</view>
				</view>
			</view>
			<view class="card">
				<view class="item">
					<text>订单标题</text>
					<text class="strong">{{billDetail.title}}</text>
				</view>
				<view class="item">
					<text>商品原价</text>
					<text class="strong">{{billDetail.cost}}</text>
				</view>
				<view class="item">
					<text>现金支付</text>
					<text class="strong">+{{billDetail.price}}</text>
				</view>
				<view class="item">
					<text>积分余额支付</text>
					<text class="strong">+{{billDetail.balanceNum}}</text>
				</view>
				<view class="item">
					<text>渠道积分支付</text>
					<text class="strong">+{{billDetail.pointNum}}</text>
				</view>
				<view class="item">
					<text>积分服务费</text>
					<text class="strong">{{billDetail.pointFee}}</text>
				</view>
<!-- 				<view class="item">
					<text>积分成本</text>
					<view class="u-flex">
						<image style="width: 26rpx;height: 26rpx;" src="@/static/icon/points-value.png" mode="aspectFit"></image>
						<text class="mainColor margin-left-10">{{billDetail.point?billDetail.point:0}}</text>
						<text class="strong" style="margin-left: 50rpx;">￥ {{billDetail.pointValue?billDetail.pointValue:0}}</text>
					</view>
				</view> -->
				
				<view class="item">
					<text>联营折扣</text>
					<text style="color: #000;">{{billDetail.discount==-1 || billDetail.discount==0 || billDetail.discount==1?'无折扣': $digital.floatMul(billDetail.discount , 10) +'折'}}</text>
				</view>
				<view class="item">
					<text>交易状态</text>
					<text>{{billDetail.payStatus}}</text>
				</view>
				<view class="item">
					<text>交易时间</text>
					<text>{{billDetail.createTime}}</text>
				</view>
				<view class="item">
					<text>支付方式</text>
					<text v-if="billDetail.payWay=='WECHAT'">微信支付</text>
					<text v-if="billDetail.payWay=='ALIPAY'">支付宝支付</text>
					<text v-if="billDetail.payWay=='APPLEPAY'">银联支付</text>
				</view>
				<view class="item">
					<text>交易单号</text>
					<text>{{billDetail.id}}</text>
				</view>
			</view>
		</block>
		
		<block v-if="current==1">
			<view class="top">
				<image :src="billDetail.channelLogo?billDetail.channelLogo:'/static/icon/avatar.png'" mode="aspectFit"></image>
				<text class="title">{{billDetail.channelName}}</text>
				<view class="data">
					<image src="@/static/icon/points-value.png" mode="aspectFit"></image>
					<view>
						<text>-{{billDetail.point}}</text>
						<text>(价值 ￥ {{billDetail.pointValue}})</text>
					</view>
				</view>
			</view>
			<view class="card">
				<view class="item">
					<text>交易状态</text>
					<text>交易成功</text>
				</view>
				<view class="item" v-if="billDetail.jsStatus">
					<text>结算时间</text>
					<text>{{billDetail.jsStatus}}</text>
				</view>
				<view class="item">
					<text>账期</text>
					<text>{{billDetail.paymentDays}}</text>
				</view>
				<view class="item">
					<text>产生时间</text>
					<text>{{billDetail.updateTime}}</text>
				</view>
				<view class="item">
					<text>交易时间</text>
					<text>{{billDetail.jsTime}}</text>
				</view>
				<view class="item">
					<text>交易单号</text>
					<text>{{billDetail.billRecordId}}</text>
				</view>
				<view class="item">
					<text>商户单号</text>
					<text>{{billDetail.billRecordId}}</text>
				</view>
			</view>
		</block>
		
		<view class="question">
			<text>对订单有疑问</text>
			<text class="cuIcon-right" style="margin-top: 5rpx;"></text>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				billDetail:{},
				current:0
			}
		},
		onLoad(option) {
			if(option.billDetail){
				this.billDetail = JSON.parse(option.billDetail)
			}
			if(option.current){
				this.current = option.current
			}
		}
	}
</script>

<style scoped lang="scss">
	.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;
	}
	.mainColor{
		font-weight: bold;
		color: $color;
	}
	.strong{
		font-weight: bold;
		color: #000;
	}
</style>
