<template>
	<view >
		<view class="center info" style="padding: 50rpx;">
			<image v-if="paySuccess" src="/static/icon/pay-success.png" mode=""></image>
			<image v-else :src="info.shop.cover" mode=""></image>
			<text v-text="paySuccess?'支付成功':info.shop.name" class="text-lg"
				style="color: #1C1C1C;font-size: 30rpx;"></text>
		</view>

		<view class="card" >
			<view class="flex flex-direction margin-bottom-40">
				<text class="text-lg text-bold" v-text="paySuccess?'支付成功':'支付确认'"></text>
				<text v-if="paySuccess" class=" text-sm margin-top-10"
					style="color: #999999;">您本次交易使用积分抵扣情况，具体如下：</text>
				<text v-else class=" text-sm margin-top-10" style="color: #999999;">您本次交易可使用积分抵扣，具体如下：</text>
			</view>
			<view class="item ">
				<view class="left">商品价格</view>
				<view class="right price">{{info.bills.cost}}</view>
			</view>
			<view class="item">
				<view class="left">商家活动抵扣</view>
				<view class="right "  >
					<text class="price reduce" :class="paySuccess?'text-color':'text-base'">{{info.bills.discount || 0}}</text>
				</view>
			</view>
			<view class="item">
				<view class="left">渠道积分抵扣</view>
				<view class="right" >
					<text class="price reduce" :class="paySuccess?'text-color':'text-base'">{{info.bills.pointNum || 0}}</text></view>
			</view>
			<view class="item">
				<view class="left">积分余额抵扣</view>
				<view class="right" >
					<text class="price reduce" :class="paySuccess?'text-color':'text-base'">{{info.bills.balanceNum || 0}}</text>
				</view>
			</view>
			<view class="item">
				<view class="left">平台交易服务费</view>
				<view class="right"><text class="price reduce" >{{info.bills.fee || 0}}</text></view>
			</view>
			<view class="item">
				<view class="left">积分交易手续费</view>
				<view class="right"><text class="price reduce" >{{info.bills.pointFee || 0}}</text></view>
			</view>
			<view class="item u-border-top" style="margin-top: 10rpx;padding-top: 40rpx;padding-bottom: 0;">
				<view class="left" style="font-size: 30rpx;" v-text="paySuccess?'现金交易':'您仍需支付'"></view>
				<view class="right text-bold" style="font-size: 40rpx;"><text class="price">{{info.bills.price || 0}}</text>
				</view>
			</view>
		</view>

		<view class="center flex-direction " style="padding: 70rpx 0;" >
			<text class="text-gray text-sm margin-bottom-20">感谢使用联兑通，越用越优惠</text>
			<view @click="confirm" :class="paySuccess?'bg-green':'btn-bg-color'" class="cu-btn  flex  text-lg  round"
				style="padding: 42rpx 0;width: 90%;">
				<text v-text="paySuccess&&confirmText?confirmText:'确认支付'"></text>
			</view>
			<view @click="cancel" :class="paySuccess?'text-gray':'text-base'" class=" payConfirm"
				style="margin-top: 30rpx;font-size: 30rpx;text-decoration: underline;">
				<text v-text="paySuccess&&cancelText?cancelText:'暂不支付'"></text>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		props: {
			info: Object,
			type: String,
			confirmText: String,
			cancelText: String,
		},
		computed: {
			paySuccess: {
				get() {
					if (this.$isNotEmpty(this.type)) {
						return true
					}
					return false
				}
			},

		},
		data() {
			return {

			}
		},
		created() {
		},
		methods: {
			confirm() {
				this.$emit('confirm')
			},
			cancel() {
				this.$emit('cancel')
			}
		}
	}
</script>

<style lang="scss">
	.bg-green{
		background-color: #19be6b;
		color: #FFFFFF;
	}
	
	.info {
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;

		image {
			width: 120rpx;
			height: 120rpx;
			border-radius: 50%;
			margin-bottom: 20rpx;
		}
	}

	.text-color {
		color: #353535;
	}

	.card {
		margin: 0 40rpx;
		padding: 40rpx;
		border-radius: 20rpx;
		background-color: #FFFFFF;

		.item {
			padding: 15rpx 0;
			display: flex;
			justify-content: space-between;
			font-size: 28rpx;

			.left {
				color: #353535;
				font-weight: 300;
			}

			.right {
				font-size: 30rpx;
				color: #353535;
			}
		}
	}

	.price::after {
		content: '元';
		margin-left: 6rpx;
		font-size: 0.8em;
	}

	.reduce::before {
		content: '-';
		margin-right: 10rpx;
	}
</style>
