<template>
	<view class="center">
		<view v-if="list.imgs != null">
			<swiper :autoplay="true" :interval="3000" :duration="1000" class="top" indicator-color="rgba(0, 0, 0, .2)" indicator-dots indicator-active-color="#fff">
				<swiper-item v-for="item in list.imgs.split(',')">
					<image :src="item" mode="">
				</swiper-item>
			</swiper>
		</view>
		<view class="top" v-else><image :src="list.logo" mode=""></image></view>
		<view class="name-box">
			<view class="price-box">
				兑换价：
				<text class="price">{{price * 1}}</text>
				<text class="unit">{{ list.cost_money_type}}</text>
				<!-- <text class="yuan">￥229</text> -->
			</view>
			<view class="name clamp">{{list.name}}</view>
		</view>
		<view class="tip-box">
			<view class="tip-titele">兑换须知</view>
			<view class="tip-main">兑换说明详细介绍兑换说明详细介绍兑换兑换说明详细介绍兑换说明详细介绍兑换说明详细介绍</view>
		</view>
		<view class="detail">
			<view class="detail-title">
				商品详情
			</view>
			<view class="systom" v-html="list.detail">
				
			</view>
		</view>
		<view class="btn" @click="buy()">
			立即兑换
		</view>
	</view>
</template>
<script>
import { miningDateils } from '@/api/market.js';
import uniNumberBox from '@/components/uni-number-box.vue';
export default {
	components: {
		uniNumberBox
	},
	data() {
		return {
			id: '',
			type: '',
			num: 1,
			step: 0,
			password: '',

			price: '',
			list: {},
			checked: false,
			current: 0
		};
	},
	onLoad(option) {
		this.id = option.id;
		this.type = option.type;
		this.loadData();
	},

	computed: {
		money() {
			return this.num * this.price * this.step;
		}
	},
	onShow() {},
	methods: {
		async loadData() {
			let obj = this;
			miningDateils({}, obj.id).then(({ data }) => {
				console.log(data,"123456789")
				obj.list = data;
				// obj.money = obj.list.cost_money;
				obj.price = obj.list.cost_money;
				obj.step = obj.list.step;
				console.log(obj.list);
			});
		},
		ToIndex() {
			uni.navigateTo({
				url: '/pages/finance/xieyi'
			});
		},
		numberChange(data) {
			let obj = this;
			obj.num = data.number;
		},
		buy() {
			// let list = JSON.stringify(this.list)
			uni.navigateTo({
				url: '/pages/market/pay?&id=' + this.id + '&type=' + this.type
			});
			// console.log(this.list,'--------------***********')
			// console.log('buy click')
		},
		changeCurrent(index) {
			this.current = index;
		},
		back() {
			uni.navigateTo({
				url: '/pages/market/pay?&id=' + this.id + '&type=' + this.type
			});
		}
	}
};
</script>

<style lang="scss" scoped>
page,
.center {
	background: #f8f6f6;
	height: 100%;
}
.top {
	width: 750rpx;
	height: 710rpx;
	image {
		width: 100%;
		height: 100%;
	}
}
.name-box {
	padding: 30rpx 26rpx;
	line-height: 1;
	background-color: #FFFFFF;
	.price-box {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #333333;
		.price {
			font-size: 48rpx;
			color: #E83F30;
		}
		.unit {
			display: inline-block;
			padding-left: 10rpx;
			color: #E83F30;
		}
		.yuan {
			
			padding-left: 10rpx;
			font-size: 30rpx;
			font-weight: 500;
			text-decoration: line-through;
			color: #999999;
		}
	}
	.name {
		font-size: 34rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #1D2023;
		margin-top: 30rpx;
	}
}
.tip-box {
	margin-top: 20rpx;
	padding: 34rpx 90rpx 50rpx 30rpx;
	display: flex;
	align-items: flex-start;
	background-color: #FFFFFF;
	.tip-titele {
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #3B3B3B;
	}
	.tip-main {
		margin-left: 30rpx;
		width: 467rpx;
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #8A8A8A;
	}
}
.detail {
	.detail-title{
		width: 750rpx;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		font-size: 28rpx;
		font-family: PingFangSC;
		font-weight: bold;
		color: #1D2023;
	}
}
.btn {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	width: 750rpx;
	height: 98rpx;
	background: linear-gradient(0deg, #2E58FF, #32C6FF);
	text-align: center;
	line-height: 98rpx;
	font-size: 36rpx;
	font-family: PingFang SC;
	font-weight: bold;
	color: #FFFFFF;
}
</style>
