<template>
	<view class="almanac flex">
		<view class="a_main">
			<!-- 头部 -->
			<view class="flex fix head_list" :style="`background:${calendarData[turnPage].bgColor}`">
				<view class="head_list_left flex">
					<picker mode="date" :value="date" @click="bindDateChange">
						<view class="picker flex date_select">{{currentDate}}
							<image src="https://weiapi.youbeiw.top/images/customizate/down_icon.png" mode="widthFix"
								class="down_icon"></image>
						</view>
					</picker>
				</view>
				<view :class="`item ${currentTab == item.id?'active':''}`" v-for="(item,index) in tabs" :key="index">
					{{item.tab}}
					<!-- <view class="line"></view> -->
				</view>
			</view>
			<!-- 日历 -->
			<swiper style="height: 87vh;" @change="bindchangeTag" vertical="true">
				<swiper-item v-for="(item,index) in calendarData" :key="item.id">
					<view class="section">
					</view>
					<view class="calendar">
						<view class="calendar_top">
							<view class="flex date_top">
								<view class="gregorian_calendar"><text class="txt"
										v-for="(da,i) in calendarData[turnPage].gregorian_calendar"
										:key="i">{{da}}</text></view>
								<view class="current" :hidden="!calendarData[turnPage].isToday"
									:style="`background:${calendarData[turnPage].bgColor}`">今</view>
							</view>
							<view class="flex date_bottom" :style="`color:${calendarData[turnPage].bgColor}`">"
								<view class="flex date-info">
									<view class="date">{{calendarData[turnPage].day}}</view>
									<view class="lunar_date">{{calendarData[turnPage].lunar_date}}</view>
								</view>
								<view class="festival">{{calendarData[turnPage].festival}}</view>
							</view>
							<view class="calendar_bottom">
								<view class="flex dharma_list">
									<view :class="`flex item ${index==0?'left':index==1?'center':'right'}`"
										v-for="(dharmaList,index) in calendarData[turnPage].dharma_list" :key="index">
										<view class="title" :style="`color:${calendarData[turnPage].bgColor}`">
											{{dharmaList.title}}
										</view>
										<view class="name" v-for="(it,i) in dharmaList.names" :key="i">{{it}}</view>
									</view>
								</view>
								<view class="lucky_days flex">
									<view class="lucky_days_list">
										<view :class="`flex item ${index==0?'suitable':'unsuited'}`"
											v-for="(luckyDays,luckyDaysIndex) in calendarData[turnPage].lucky_days"
											:key="luckyDaysIndex">
											<image class="icon"
												:src="index==0?'https://weiapi.youbeiw.top/images/almanac/good.png':'https://weiapi.youbeiw.top/images/almanac/bad.png'"
												mode="widthFix"></image>
											<view class="list">
												<text class="list_item" v-for="(li,i) in luckyDays.list"
													:key="i">{{li}}</text>
											</view>
										</view>
									</view>
									<image class="lucky_days_icon"
										src="https://weiapi.youbeiw.top/images/almanac/book.png" mode="widthFix">
									</image>
								</view>
								<view class="flex constellation_list">
									<view class="constellation left">
										<view class="flex item">
											<view class="title" :style="`color:${calendarData[turnPage].bgColor}`">建星
											</view>
											<view class="name-list"><text class="name">满</text></view>
										</view>
										<view class="flex item">
											<view class="title" :style="`color:${calendarData[turnPage].bgColor}`">吉神
											</view>
											<view class="name-list"><text class="name">满</text><text
													class="name">月德</text><text class="name">时德</text></view>
										</view>
									</view>
									<view class="flex constellation center">
										<image src="../../static/bagua_img.jpg" mode="widthFix"></image>
									</view>
									<view class="constellation right">
										<view class="flex item">
											<view class="title" :style="`color:${calendarData[turnPage].bgColor}`">星宿
											</view>
											<view class="name-list"><text class="name">星</text><text
													class="name">日</text><text class="name">马</text></view>
										</view>
										<view class="flex item">
											<view class="title" :style="`color:${calendarData[turnPage].bgColor}`">凶煞
											</view>
											<view class="name-list"><text class="name">五虚</text><text
													class="name">归嫉</text><text class="name">白虎</text></view>
										</view>
									</view>
								</view>
								<view class="flex taboo_bearing">
									<view class="taboo_bearing_view taboo">
										<view class="title" :style="`color:${calendarData[turnPage].bgColor}`">彭祖百忌
										</view>
										<view class="item" v-for="(taboo,i) in calendarData[turnPage].taboo" :key="i">
											{{taboo}}
										</view>
									</view>
									<view class=" flex taboo_bearing_view auspicious_bearing">
										<view class="title" :style="`color:${calendarData[turnPage].bgColor}`">吉神方位
										</view>
										<view class="flex list">
											<text class="item"
												v-for="(auspicious,i) in calendarData[turnPage].auspicious"
												:key="i">{{auspicious}}</text>
										</view>
									</view>
								</view>
								<!-- <view class="flex time_list">
									<view class="flex item" v-for="(timeList,i) in calendarData[turnPage].time_list"
										:key="i">{{timeList}}</view>
								</view> -->
								<view class="flex look_more"
									:style="`background-color:${calendarData[turnPage].bgColor};`"
									v-if="turnPage < calendarData.length - 1" @click="tapName">查看更多</view>
							</view>
						</view>
					</view>
				</swiper-item>
			</swiper>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabs: [{
					id: 1,
					tab: '黄历'
				}, ],
				currentTab: 1,
				calendarData: [{
						id: 1,
						day: 10,
						isToday: true,
						bgColor: "#d65044",
						gregorian_calendar: ["癸卯年", "甲子月", "十月廿九", "兔年", "星期天"],
						lunar_date: "农历十月二十八",
						festival: "世界人权日",
						dharma_list: [{
							id: 1,
							title: "五行",
							names: ["金箔金"]
						}, {
							id: 1,
							title: "冲煞",
							names: ["虎日冲猴", "煞北"]
						}, {
							id: 1,
							title: "值神",
							names: ["白虎"]
						}],
						lucky_days: [{
								list: [
									'赏赐受封', '赏赐受封', '赏赐受封', '赏赐受封', '赏赐受封'
								]
							},
							{
								list: [
									'祭祀', '远途',
								]
							}
						],
						taboo: [
							"壬不积水更难提防",
							"壬不积水更难提防"
						],
						auspicious: [
							"财神", "财神", "财神", "财神", "财神", "财神"
						],
						time_list: [
							"壬子吉", "癸丑凶", "甲寅吉", "乙卯吉", "丙辰凶", "丁巳凶", "戊午吉", "庚申凶", "辛酉吉", "壬戌凶", "癸亥凶"
						]
					},
					{
						id: 2,
						day: 11,
						isToday: false,
						bgColor: "#d65044",
						gregorian_calendar: ["癸卯年", "甲子月", "十月廿九", "兔年", "星期天"],
						lunar_date: "农历十月二十八",
						festival: "世界人权日",
						dharma_list: [{
							id: 1,
							title: "五行",
							names: ["金箔金"]
						}, {
							id: 1,
							title: "冲煞",
							names: ["虎日冲猴", "煞北"]
						}, {
							id: 1,
							title: "值神",
							names: ["白虎"]
						}],
						lucky_days: [{
								list: [
									'赏赐受封', '赏赐受封', '赏赐受封', '赏赐受封', '赏赐受封'
								]
							},
							{
								list: [
									'祭祀', '远途',
								]
							}
						],
						taboo: [
							"壬不积水更难提防",
							"壬不积水更难提防"
						],
						auspicious: [
							"财神", "财神", "财神", "财神", "财神", "财神"
						],
						time_list: [
							"壬子吉", "癸丑凶", "甲寅吉", "乙卯吉", "丙辰凶", "丁巳凶", "戊午吉", "庚申凶", "辛酉吉", "壬戌凶", "癸亥凶"
						]
					},
					{
						id: 3,
						day: 12,
						isToday: false,
						bgColor: "#0e6241",
						gregorian_calendar: ["癸卯年", "甲子月", "十月廿九", "兔年", "星期天"],
						lunar_date: "农历十月二十八",
						festival: "世界人权日世界人权日世界人权日",
						dharma_list: [{
							id: 1,
							title: "五行",
							names: ["金箔金"]
						}, {
							id: 1,
							title: "冲煞",
							names: ["虎日冲猴", "煞北"]
						}, {
							id: 1,
							title: "值神",
							names: ["白虎"]
						}],
						lucky_days: [{
								list: [
									'赏赐受封', '赏赐受封', '赏赐受封', '赏赐受封', '赏赐受封'
								]
							},
							{
								list: [
									'祭祀', '远途',
								]
							}
						],
						taboo: [
							"壬不积水更难提防",
							"壬不积水更难提防"
						],
						auspicious: [
							"财神", "财神", "财神", "财神", "财神", "财神"
						],
						time_list: [
							"壬子吉", "癸丑凶", "甲寅吉", "乙卯吉", "丙辰凶", "丁巳凶", "戊午吉", "庚申凶", "辛酉吉", "壬戌凶", "癸亥凶"
						]
					},
					{
						id: 4,
						day: 13,
						isToday: false,
						bgColor: "#d65044",
						gregorian_calendar: ["癸卯年", "甲子月", "十月廿九", "兔年", "星期天"],
						lunar_date: "农历十月二十八",
						festival: "世界人权日",
						dharma_list: [{
							id: 1,
							title: "五行",
							names: ["金箔金"]
						}, {
							id: 1,
							title: "冲煞",
							names: ["虎日冲猴", "煞北"]
						}, {
							id: 1,
							title: "值神",
							names: ["白虎"]
						}],
						lucky_days: [{
								list: [
									'赏赐受封', '赏赐受封', '赏赐受封', '赏赐受封', '赏赐受封'
								]
							},
							{
								list: [
									'祭祀', '远途',
								]
							}
						],
						taboo: [
							"壬不积水更难提防",
							"壬不积水更难提防"
						],
						auspicious: [
							"财神", "财神", "财神", "财神", "财神", "财神"
						],
						time_list: [
							"壬子吉", "癸丑凶", "甲寅吉", "乙卯吉", "丙辰凶", "丁巳凶", "戊午吉", "庚申凶", "辛酉吉", "壬戌凶", "癸亥凶"
						]
					}
				],
				windowWidth: uni.getSystemInfoSync().windowWidth, //单位px
				windowHeight: uni.getSystemInfoSync().windowHeight, //单位px
				turnPage: 0, //翻转页面
				date: "2016-09-01",
				currentDate: "2016年09月",
				day: "10"
			}
		},
		onLaunch: function() {},
		onLoad() {},
		methods: {
			tapName() {
				var turnPage = this.turnPage
				turnPage = Number(turnPage) + 1;
				this.isFanye = false;
				this.turnPage = turnPage;
			},
			bindDateChange(e) {
				this.date = e.detail.value;
				this.currentDate = new Date(e.detail.value).getFullYear() + '年' + (new Date(e.detail.value).getMonth() +
					1) + "月"
			},
			bindchangeTag(event) {
				this.isFanye = false;
				this.turnPage = event;
			}
		},
		onShow: function() {

		},
		onHide: function() {}
	}
</script>

<style lang="scss" scoped>
	/* page{
	  width:100%;
	  height:100%;
	  display: flex;
	  overflow-y: scroll;
	  background-color: #EDEDED;
	} */
	.almanac {
		display: flex;
		width: 100%;
		height: auto;
		min-height: 100vh;
		background-color: #EDEDED;
	}

	.almanac .flex {
		display: flex;
		align-items: center;
	}

	.almanac .pd {
		padding: 0px 30rpx;
		box-sizing: border-box;
	}

	.almanac .mb {
		margin-bottom: 20rpx;
	}

	.almanac .a_main {
		width: 100%;
		height: 100%;
		position: relative;
		overflow-y: scroll;
	}

	.almanac .a_main .head_list {
		z-index: 10000;
		align-items: center;
		justify-content: center;
		padding: 20rpx 30rpx;
		// padding-top: 113rpx;
		background-color: #E75C5B;
		position: relative;
	}

	.almanac .a_main .head_list .head_list_left {
		left: 20rpx;
		position: absolute;
	}

	.almanac .a_main .head_list .date_select {
		font-size: 30rpx;
		font-family: FZRUIZH_CUJW;
		color: #fff;
	}

	.almanac .a_main .head_list .down_icon {
		width: 16rpx;
		margin-left: 10rpx;
		margin-top: 10rpx
	}

	.almanac .a_main .head_list .item {
		font-size: 34rpx;
		font-family: FZRUIZH_CUJW;
		font-weight: normal;
		color: #E98F8F;
		margin: 0px 40rpx;
		z-index: 10000;
		position: relative;
	}

	.almanac .a_main .head_list .item .line {
		width: 0;
		height: 5rpx;
		margin-top: 6rpx;
		background: #fff;
		position: absolute;
		border-radius: 10rpx;
	}

	.almanac .a_main .head_list .item.active {
		font-size: 34rpx;
		font-family: SourceHanSansCN;
		font-weight: 500;
		font-style: normal;
		color: #EDEDED;
		position: relative;
		text-shadow: 0rpx 2rpx 2rpx rgba(255, 234, 199, 0.75);
	}

	.almanac .a_main .head_list .item.active .line {
		width: 64rpx;
	}

	.almanac .calendar {
		position: relative;
		width: 100%;
		z-index: 1;
		left: 0%;
		background-color: #EDEDED;
	}

	.almanac .an_fanye {
		position: absolute;
		width: 100%;
		height: calc(100% - 78rpx);
		top: 78rpx;
		z-index: 1;
	}

	.almanac .calendar .calendar_top .date_top {
		padding: 10rpx 0;
		position: relative;
		justify-content: center;
	}

	.almanac .calendar .calendar_top .date_top .txt {
		padding: 20rpx 2px;
		position: relative;
		justify-content: center;
		font-size: 28rpx;
	}

	.almanac .calendar .calendar_top .date_top .current {
		width: 50rpx;
		height: 50rpx;
		font-size: 26rpx;
		border-radius: 50%;
		background-color: #E75C5B;
		text-align: center;
		line-height: 50rpx;
		color: #fff;
		position: absolute;
		right: 30rpx;
	}

	.almanac .calendar .calendar_top .date_bottom {
		position: relative;
		color: #E75C5B;
		font-size: 32rpx;
		justify-content: center;
		padding-bottom: 20rpx;
	}

	.almanac .calendar .calendar_top .date_bottom .date-info {
		flex-direction: column;

	}

	.almanac .calendar .calendar_top .date_bottom .date-info .date {
		font-size: 200rpx;
		font-weight: bolder;
		line-height: 200rpx;
	}

	.almanac .calendar .calendar_top .date_bottom .festival {
		position: absolute;
		width: 160rpx;
		right: 30rpx;
		bottom: 20rpx;
	}

	.almanac .calendar .calendar_bottom {
		margin: 0 20rpx;
		background-color: #fff;
		border-radius: 20rpx;
	}

	.almanac .calendar .calendar_bottom .dharma_list {
		width: 100%;
		justify-content: space-between;
		border-bottom: 1px solid #f6f6f6;
	}

	.almanac .calendar .calendar_bottom .dharma_list .item {
		padding: 20rpx;
		font-size: 28rpx;
		justify-items: center;
		text-align: center;
		justify-content: center;
		width: 25%;
	}

	.almanac .calendar .calendar_bottom .dharma_list .item .title {
		color: #E75C5B;
		margin-right: 10rpx;
		white-space: nowrap;
	}

	.almanac .calendar .calendar_bottom .dharma_list .item .name {
		margin-left: 15rpx;
	}

	.almanac .calendar .calendar_bottom .dharma_list .left {
		border-right: 1px solid #f6f6f6;
		white-space: nowrap;
	}

	.almanac .calendar .calendar_bottom .dharma_list .center {
		border-right: 1px solid #f6f6f6;
		width: 50%;
	}

	.almanac .calendar .calendar_bottom .dharma_list .right {
		white-space: nowrap;
	}

	.almanac .calendar .calendar_bottom .lucky_days {
		border-bottom: 1px solid #f6f6f6;
	}

	.almanac .calendar .calendar_bottom .lucky_days .lucky_days_list .item {
		padding: 20rpx 0;
	}

	.almanac .calendar .calendar_bottom .lucky_days .lucky_days_list .item .icon {
		width: 50rpx;
		height: 50rpx;
		margin-right: 20rpx;
		// padding: 0 30rpx;
	}

	.almanac .calendar .calendar_bottom .lucky_days .lucky_days_list .item .list {
		width: 460rpx;
		line-height: 34rpx;
	}

	.almanac .calendar .calendar_bottom .lucky_days .lucky_days_list .item .list .list_item {
		font-size: 28rpx;
		margin-right: 15rpx;
	}

	.almanac .calendar .calendar_bottom .lucky_days .lucky_days_icon {
		width: 100rpx;
		height: auto;
		// padding: 0 30rpx
	}

	.almanac .calendar .calendar_bottom .constellation_list {
		width: 100%;
		border-bottom: 1px solid #f6f6f6;
	}

	.almanac .calendar .calendar_bottom .constellation_list .constellation.left {
		flex: 1;
		border-right: 1px solid #f6f6f6;
	}

	.almanac .calendar .calendar_bottom .constellation_list .constellation.right {
		flex: 1;
		border-left: 1px solid #f6f6f6;
	}

	.almanac .calendar .calendar_bottom .constellation_list .constellation.center {
		display: flex;
		width: 200rpx;
		flex-shrink: 0;
		padding: 0 10rpx;
		box-sizing: border-box;
		border-left: 1px solid #f6f6f6;
		border-right: 1px solid #f6f6f6;

	}

	.almanac .calendar .calendar_bottom .constellation_list .constellation .item {
		flex-direction: column;
		padding: 10rpx 0;
		box-sizing: border-box;
		font-size: 30rpx;
	}

	.almanac .calendar .calendar_bottom .constellation_list .constellation .item:nth-child(2) {
		border-top: 1px solid #f6f6f6;
	}

	.almanac .calendar .calendar_bottom .constellation_list .constellation .item .title {
		color: #E75C5B;
		font-size: 32rpx;
	}

	.almanac .calendar .calendar_bottom .constellation_list .constellation .item .name-list .name {
		margin: 0 4rpx;
		font-size: 28rpx;
	}

	.almanac .calendar .calendar_bottom .taboo_bearing {
		justify-content: space-between;
		align-items: flex-start;
		border-bottom: 1px solid #f6f6f6;
		padding-bottom: 10rpx;
	}

	.almanac .calendar .calendar_bottom .taboo_bearing .taboo_bearing_view {
		width: 50%;
		padding: 0 10rpx;
		box-sizing: border-box;
		justify-content: center;
		flex-direction: column;
		font-size: 30rpx;
	}

	.almanac .calendar .calendar_bottom .taboo_bearing .taboo_bearing_view .title {
		color: #E75C5B;
		text-align: center;
		line-height: 60rpx;
		font-size: 32rpx;
	}

	.almanac .calendar .calendar_bottom .taboo_bearing .taboo {
		border-right: 1px solid #f6f6f6;
	}

	.almanac .calendar .calendar_bottom .taboo .item {
		text-align: center;
		padding: 5rpx 0;
	}

	.almanac .calendar .calendar_bottom .auspicious_bearing .list {
		flex-wrap: wrap;
	}

	.almanac .calendar .calendar_bottom .auspicious_bearing .item {
		white-space: nowrap;
		margin: 5rpx 5rpx;
	}

	.almanac .calendar .calendar_bottom .time_list {
		padding: 16rpx 0;
	}

	.almanac .calendar .calendar_bottom .time_list .item {
		flex: 1;
		writing-mode: vertical-rl;
		text-orientation: upright;
		text-align: center;
		font-size: 26rpx;
		letter-spacing: 10rpx;
	}

	.almanac .calendar .calendar_bottom .look_more {
		width: 100%;
		height: 60rpx;
		background-color: #E75C5B;
		border-radius: 0 0 20rpx 20rpx;
		color: #e9e9df;
		font-size: 26rpx;
		text-align: center;
		justify-content: center;
		margin-bottom: 30rpx;
	}
</style>