<style>
	.jz_SureOrder{
		position: relative;
	}
	.jz_SureTop{
		width: 100%;
		box-shadow: 0px 2px 15px 0px rgba(76, 76, 76, 0.13);
		background-color: #fff;
		border-bottom-left-radius: 60rpx;
		border-bottom-right-radius: 60rpx;
		padding: 40rpx;
	}
	.jz_SureDfk{
		color:#111111;
		font-size:40rpx;
		font-weight: bold;
		margin-left:26rpx;
	}
	.jz_SureContent{
		width:90%;
		margin:auto;
		min-height: 100px;
	}
	.jz_SureCommodity{
		padding:30rpx 0;
		display: flex;
		border-bottom:1px solid #E6E6E6;
	}
	.jzSureMoney{
		color:#333333;
		font-weight: bold;
		font-size:20rpx;
	}
	.jz_SuOrder_img{
		width: 100rpx;
		height: 100rpx;
		border-radius: 20rpx;
		overflow: hidden;
		flex-shrink: 0;
	}
	.jz_SuOrder_img img{
		width:100%;
		height:100%;
	}
	.jz_OrderNum{
		color:#8F8F90;
		font-size:24rpx;
		margin-right:50rpx;
	}
	.jz_GoodName{
		color:#333333;
		font-size:28rpx;
		width:70%;
		margin-left:15px;
		font-weight:bold;
	}
	.jz_OrderBold{
		color:#08090E;
		font-weight:bold;
	}
	.jz_PayDiv{
		position: absolute;
		width:90%;
		margin:auto;
		bottom:30rpx;
		display:flex;
		justify-content: space-between;
	}
	.jz_CancleBtn{
		width:310rpx;
		height:80rpx;
		border:1px solid #111111;
		border-radius: 16rpx;
		color:#111111;
		font-weight: bold;
		text-align: center;
		line-height: 80rpx;
		font-size: 28rpx;
	}
</style>
<template>
	<view class="jz_SureOrder" style="height:100vh;">
		<view class="jz_SureTop">
			<view style="display:flex;align-items: center;">
				<img style="width:53rpx;height:53rpx;" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/CustomizedCar/dfk.png" alt="" />
				<text class="jz_SureDfk">待付款</text>
			</view>
		</view>
		<view class="jz_SureContent">
			<view class="jz_SureCommodity">
				<view class="jz_SuOrder_img">
					<img mode="aspectFill" :src="orderData.CoverImg" alt="" />
				</view>
				<view style="display:flex;justify-content: space-between;">
					<view class="jz_GoodName">
						{{orderData.GoodsName}}
					</view>
					<view class="jzSureMoney">
						<text style="font-size:20rpx;margin-right:10rpx;">¥</text>
						<text style="font-size:28rpx;">{{orderData.PreferPrice}}</text>
					</view>
				</view>
				
			</view>
			<view class="jz_SureCommodity">
				<view class="jz_OrderNum">订单编号</view>
				<view class="jz_OrderBold">{{orderData.OrderNo}}</view>
			</view>
			<view class="jz_SureCommodity">
				<view class="jz_OrderNum">下单时间</view>
				<view class="jz_OrderBold">{{orderData.CreateDate}}</view>
			</view>
			<view class="jz_SureCommodity">
				<view class="jz_OrderNum">支付方式</view>
				<view class="jz_OrderBold">无</view>
			</view>
			<view class="jz_SureCommodity" style="justify-content: space-between;">
				<view class="jz_OrderNum">商品总额</view>
				<view><text style="margin-right:10rpx;">¥</text>{{orderData.PreferPrice}}</view>
			</view>
			<view class="jz_SureCommodity" style="justify-content: flex-end;">
				<view style="color:#08090E;font-size:28rpx;">实付款：</view>
				<view style="color:#F20707;font-weight: bold;">
					<text style="font-size:22rpx;margin-right:10rpx;">¥</text>
					<text style="font-size:28rpx;">{{orderData.PreferPrice}}</text>
				</view>
			</view>
			<view class="jz_PayDiv">
				<view class="jz_CancleBtn">取消</view>
				<view class="jz_CancleBtn" @click="goZhifu()" style="background-color: #111111;color:#fff;">去付款</view>
			</view>
		</view>
	</view>
</template>

<script>
</script>

<script>
	export default {
		components: {

		},
		data() {
			return {
				pageTitle: '订单详情',
				msg:{
					pageIndex:1,
					pageSize:15,
					MiniAppUserId:0
				},
				orderData:{}
				
			};
		},
		created() {
			
		},
		onLoad(option) {
			if(option.orderData){
				this.orderData= JSON.parse(decodeURIComponent(option.orderData))
			}
			console.log(this.orderData,'this.orderData');
		},
		methods: {
			//支付
			goZhifu(){
				let url='/api/WeChatPay/GetTravlePayInfo'
				let GoodsName = this.orderData.GoodsName;
					GoodsName = GoodsName.slice(0, 10)
				this.request2({
						url: url,
						data: {
							OrderId:this.orderData.OrderId,
							GoodsName:GoodsName,
							OrderPayType:1,
							OpenId:uni.getStorageSync('mall_UserInfo').OpenId,
						}
					},
					res => {
						let orderInfo = JSON.parse(res.data);
						console.log(orderInfo)
						this.goPay(orderInfo)
					}
				);
			},
			goPay(orderInfo){
				let that=this;
				uni.requestPayment({
					provider: 'wxpay',
					timeStamp: orderInfo.timeStamp,
					nonceStr: orderInfo.nonceStr,
					package: orderInfo.package,
					signType: orderInfo.signType,
					paySign: orderInfo.sign,
					success: function(res) {
						console.log('success', res);
						uni.showToast({
							title: "支付成功"
						})
						//todo
				
					},
					fail: function(err) {
						console.log('fail:', err);
						uni.showToast({
							title: "支付失败"
						})
					}
				});
			}
		}

	};
</script>
