<template>
	<view class="center">
		<view class="main">
			<view class="main-font">购买价格(元)</view>
			<view class="main-input">{{ (buy * 1).toFixed(2) * 1 }}</view>
		</view>
		<view class="center"><calendar class="sign-date-box" :checks="signList" checksClass="" :checkTextShow="true" :nextMounth="next"></calendar></view>
		<view class="title">今日最高限价{{ (price * 1).toFixed(2) * 1 }}</view>
		<view class="main">
			<view class="main-font">挂售日期</view>
			<view class="main-input">{{ deta }}</view>
		</view>
		<view class="main">
			<view class="main-font">挂售价格(元)</view>
			<view class="main-input">{{ (price * 1).toFixed(2) * 1 }}</view>
		</view>
		<view class="money">服务费{{ (fwprice * 1).toFixed(2) * 1 }}广告值</view>
		<view class="btn" @click="sall()">确定</view>
	</view>
</template>

<script>
import { gsxq, hanging_sale } from '@/api/hall.js';
import calendar from '../../components/ss-calendar/ss-calendar.vue';
export default {
	components: {
		calendar
	},
	data() {
		return {
			signList: [],
			id: '',
			price: '', //挂售价格
			buy: '', //购买价格
			deta: '', //挂售日期
			fwprice: '', //服务费
			next: false
		};
	},
	onLoad(option) {
		this.id = option.id;
		this.loadData();
	},
	methods: {
		loadData() {
			gsxq({ id: this.id }).then(e => {
				console.log(e);
				this.buy = e.data.price;
				this.price = e.data.hanging_price;
				this.fwprice = e.data.anticipate;
				let arr = e.data.gs_time.split(' ');
				let brr = arr[0].split('-');
				// this.signList.push(brr[2] * 1)
				this.signList.push(brr[2] * 1);
				let month = new Date().getMonth() + 1;
				console.log(month, '1234568797321896');
				if (brr[1] * 1 == month) {
					this.next = false;
				} else {
					this.next = true;
				}
				console.log(this.signList);
				this.deta = brr[1] + '月' + brr[2] + '日';
				console.log(brr);
			});
		},
		sall() {
			hanging_sale({ id: this.id }).then(e => {
				uni.navigateTo({
					url: '/pages/money/success?type=2'
				});
			});
		}
	}
};
</script>

<style lang="scss">
.center,
page {
	height: auto;
	background: #ffffff;
	min-height: 100%;
}
.title {
	margin-top: 50rpx;
	text-align: center;
	font-size: 30rpx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #fd3b39;
	margin-bottom: 60rpx;
}
.main {
	margin-top: 40rpx;
	padding: 0 66rpx 0 60rpx;
	display: flex;
	justify-content: space-between;
	align-items: center;
	.main-font {
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #333333;
	}
	.main-input {
		width: 404rpx;
		height: 88rpx;
		background: #f4f4f4;
		border-radius: 10rpx;
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #333333;
		line-height: 88rpx;
		text-align: center;
	}
}
.money {
	margin-top: 74rpx;
	text-align: center;
	font-size: 32rpx;
	font-family: PingFang SC;
	font-weight: bold;
	color: #fd3b39;
}
.btn {
	width: 560rpx;
	height: 80rpx;
	background: #fc5b62;
	border-radius: 40rpx;
	margin: 96rpx auto 0;
	font-size: 30rpx;
	font-family: PingFangSC;
	font-weight: 500;
	color: #ffffff;
	line-height: 80rpx;
	text-align: center;
}
</style>
