<template>
	<view class="container cashier">
		<ws-custom :systeminfo='systeminfo' :navbar-data='nvabarData' :headerBtnPosi ="headerBtnPosi" :isBackType="true" :path="'/pages/user/cart/cart'"></ws-custom>
		<view class="container-cash clearfix" :style="{marginTop:CustomBar+'px'}">
			<view class="container-wrapper">
				<view class="cash-icon">
					<image src="../../../static/ws/dd_success.png" mode=""></image>
				</view>
				<view class="cash-text">
					<text>{{ successText }}</text>
				</view>
				<view class="cash-btn">
					<view class="btn btn-pay" @click="this.$api.switchTabTo('/pages/tabBar/home/index')">支付订单</view>
					<view class="btn btn-open" @click="this.$api.navigateTo('/pages/user/order/order-details?type=confim&orderID='+orderID)">查看订单</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				orderID:'',
				nvabarData: {		//顶部自定义导航
					haveBack:true,
					showCapsule:1, // 是否显示左上角图标  1表示显示  0表示不显示,
					showSearch: 0,
					title: '',  // 导航栏 中间的标题
					textLeft:this.$store.state.isIphone
				},
				headerBtnPosi:this.setHeaderBtnPosi(),//获取设备顶部胶囊高度
				systeminfo:this.setSysteminfo(),		 //获取设备信息
				isIphoneX:this.$store.state.isIphoneX,
				CustomBar:this.CustomBar,// 顶部导航栏高度
				successText:'订单提交成功~',
				
			}
		},
		onLoad(option) {
			if(option.type == 'deduction'){
				this.successText = '支付成功'
			}else{
				this.successText = '订单提交成功~'
			}
			// this.initData(option)
		},
		methods:{
			setHeaderBtnPosi(){
				// 获得胶囊按钮位置信息
				let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
				return headerBtnPosi
			},
			setSysteminfo(){
				let systeminfo;
				uni.getSystemInfo({ // 获取设备信息
					success: (res) => {
						systeminfo = res
					},
				})
				return systeminfo
			},
			initData(e){
				let data = JSON.parse(e.data);
				this.orderID = data.data.orderID
			}
		},
		onShow() {
			
		}
	}
</script>

<style lang="scss">
	page{
		height: auto !important;
	}
	.container-cash{
		width: 100%;
		.container-wrapper{
			width:662rpx;
			margin: 0 auto;
			margin-top: 120rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			.cash-icon{
				width: 332rpx;
				height: 269rpx;
				margin-top: 112rpx;
				image{
					width: 332rpx;
					height: 269rpx;
				}
			}
			.cash-text{
				font-size: $font-size-28;
				color:#666666;
				line-height: 104rpx;
			}
			.cash-btn{
				margin-top: 79rpx;
				.btn{
					width: 600rpx;
					height: 90rpx;
					border-radius: 45rpx;
					line-height: 90rpx;
					text-align: center;
					font-size: $font-size-26;
					color: #FFFFFF;
					box-sizing: border-box;
					border: 1px solid #333333;
					margin-bottom: 24rpx;
					&.btn-open{
						color: #333333;
					}
					&.btn-pay{
						background:#191919;
					}
				}
			}
		}
	}
</style>
