<template>
	<view class="mg-lr-24">
		<view class="white-bg-wrap">
			<common-title :msg="'已选商品'"></common-title>
			<view class="mg-top-22">
				<view class="u-f u-f-jcfs u-f-aic mg-bot-24">
					<image
						:src="goodsInfo.goodsImage"
						style="width: 128rpx;height: 128rpx;"
						:mode="'widthFix'"
						class="mg-right-10"
					></image>
					<view class="u-f u-f-fdc">
						<view class="fs28 light-black fw400 mg-bot-10">{{goodsInfo.goodsName}}</view>
						<view class="mg-bot-10 u-f u-f-aic u-f-jcfs">
							<text class="light-gray fs24 mg-right-8">周一至周日 全天</text>
						</view>
						<view class="u-f u-f-aic u-f-jcsb">
							<view class="u-f u-f-jcsb u-f-aic" style="margin-right: 96rpx;">
								<view>
									<text class="fs24 main-color">￥</text>
									<text class="fs32 main-color">{{goodsInfo.goodsPrice}}</text>
								</view>
							</view>
							<view class="fs24 light-gray">x{{goodsInfo.goodsNum}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<view class="white-bg-wrap mg-top-20" style="padding-top: 16rpx;">
			<view class="u-f u-f-aic u-f-jcsb light-black fs28 fw400 mg-bot-40">
				<text>现价</text>
				<text>￥{{goodsInfo.goodsPrice}}</text>
			</view>
			<view class="u-f u-f-jcsb light-black fs28 fw400 mg-bot-42">
				<view>优惠券</view>
				<view class="u-f u-f-jcfs u-f-aic">
					<text>选择优惠券</text>
					<text class="main-color mg-right-10"> ￥0</text>
					<!-- <image src="/staic/common/small-gray-right-arrow.png" mode=""></image> -->
				</view>
			</view>
			<view class="u-f u-f-jcfe u-f-aic fs24">
				<view class="light-black mg-right-10">已优惠</view>
				<view class="main-color mg-right-20">￥0</view>
				<view class="light-black">合计</view>
				<view class="mg-right-6">
					<text class="fs24">￥</text>
					<text class="fw700 fs32 main-color">{{goodsInfo.goodsPrice}}</text>
				</view>
			</view>
		</view>
		
		<view class="fix-bot">
			<view class="content u-f u-f-jcsb u-f-aic">
				<view class="fs24 light-gray fw400 u-f u-f-jcfs">
					<view class="light-black mg-right-10">总优惠</view>
					<view class="main-color mg-right-20">￥0</view>
				</view>
				<view>
					<view class="u-f u-f-aic u-f-fdc">
						<view class="u-f u-f-aic u-f-jcfs">
							<text class="fs24 light-black mg-right-6">实付</text>
							<view class="main-color">
								<text class="fs24">￥</text>
								<text class="fs32">{{goodsInfo.goodsPrice}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="line-gradient-btn" @click="handlePay">
					立即购买
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	import commonTitle from "../.././components/common-title/common-title.vue"
	export default {
		components: {
			commonTitle
		},			
		data() {
				return {
					number: 1,
					goodsId:'',
					shopId:'',
					goodsInfo:{}
				}
		},
		onLoad(option) {
			console.log(option);
			this.shopId = option.id
			this.goodsId = option.goodsId
			this.getGoods();
		},
		methods: {
			handlePay() {
				var location = uni.getStorageSync('curcity')
				this.$http.post("/api/client/order/createOrder", {
					goodsId:this.goodsId,
					storeId: this.shopId,
					type: 1,
					userCarId: '',
					specificationsId: '',
					goodsNum: 1,
					lon: location.lng,
					lat: location.lat,
				}).then(res => {
					var orderInfo = res.data.data
					uni.redirectTo({
						url: "/pages/pay-success/pay-success?orderInfo="+encodeURIComponent(JSON.stringify(orderInfo))
					})
				})
			},
			enterMyGarage() {
				uni.navigateTo({
					url: "/pages/my-garage/my-garage"
				})
			},
			getGoods() {
				this.$http.get("/api/client/index/refuelGoodsDetails", {
					goodsId:this.goodsId
				}).then(res => {
					console.log(res.data.data)
					this.goodsInfo = res.data.data
				})
			},
		}
	}
</script>

<style>
	page {
		background-color: #F9F9F9;
	}
</style>

<style lang="scss" scoped>
	.gray-down-arrow {
		width: 16rpx;
		height: 16rpx;
		// background: url(../.././static/shop/bot-arrow.png) no-repeat center center;
		background-size: 100%;
	}
	
	.gray-right-arrow {
		width: 16rpx;
		height: 16rpx;
		// background: url(../.././static/right-arrow.png) no-repeat center center;
		background-size: 100%;
	}

	.check {
		width: 36rpx;
		height: 36rpx;
		background-color: red;
		// background: url(../.././static/common/check.png) no-repeat center center;
		background-size: 80%;
	}
	
	.province {
		padding: 12rpx 20rpx;
		color: #ffffff;
		background-color: #20CF55;
		border-radius: 8rpx 0rpx 0rpx 8rpx;
		border: 1rpx solid #0087EF;
	}
	
	.car-num {
		padding: 12rpx 20rpx;
		color: #20CF55;
		background: #E5EEF5;
		border-radius: 0 8rpx 8rpx 0;
		border: 1rpx solid #20CF55;
	}
	
	.fix-bot {
		width: 100%;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 333;
		.content {
			background-color: #ffffff;
			padding: 10rpx 24rpx;
		}
	}
	
	.line-gradient-btn {
		background: linear-gradient( 90deg, #FF4502 0%, #FF8903 100%);
		border-radius: 41rpx 41rpx 41rpx 41rpx;
		text-align: center;
		padding: 22rpx 120rpx;
		color: #ffffff;
	}
	
	.small-gray-right-arrow {
		width: 16rpx;
		height: 16rpx;
		// background: url(../.././static/common/gray_right_arrow.png) no-repeat center center;
		background-size: 100%;
	}
</style>
