<template>
	<view style="width: 100vw;height: auto;padding: 30rpx 20rpx;background-color: #f6f6f6;">
		<view style="width: 100%;height: 100%;">
			<text style="font-size: 30rpx;font-weight: bold;">官方套餐</text>
			<view v-for="(item,index) in serviceList" :key='index'>
				<view class="card">
					<view class="taocan" :data-id="item.id" @click="details">
						<view class="tc_left">
							<text>{{item.name}}</text>
						</view>
						<view class="tc_right">
							<view style="width: 100%;">
								<view class="text">{{item.intro}}</view>
								<view class="text">{{item.desc}}</view>
								<view class="text">
									<text style="text-align: left;">时长:{{item.effective_days}}天</text>
									<text style="float: right;color: #FF4F61;font-weight: bold;">¥{{item.price/100}}</text>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		mounted() {
			this.getservice()
		},
		data() {
			return {
				pageindex: 1,
				serviceList: []
			}
		},
		methods: {
			details(e) {
				uni.navigateTo({
					url: '/pages/service_packs/packs_details?id=' + e.currentTarget.dataset.id
				})
			},
			getservice: async function() {
				let res = await this.$request.post("/api/v1/ServicePack/servicePackList", {
					page: this.pageindex
				})
				console.log(res)
				if (res.status == 0) {
					if (this.pageindex > res.data.last_page) {
						uni.showToast({
							title: "没有更多了",
							icon: "none"
						})
					} else {
						this.serviceList = this.serviceList.concat(res.data.data)
						this.pageindex++
					}
				}
			}

		}
	}
</script>

<style lang="scss">
	.card {
		width: 100%;
		height: auto;
		margin-top: 20rpx;

		// background-image: url(../../static/服务包.png);
		.taocan {
			width: 710rpx;
			height: 230rpx;
			position: relative;
			display: flex;
			border-radius: 10rpx;
			background: radial-gradient(circle at right top, transparent 15rpx, #ffffff 0) top left / 152rpx 51% no-repeat,
				radial-gradient(circle at right bottom, transparent 15rpx, #ffffff 0) bottom left /152rpx 51% no-repeat,
				radial-gradient(circle at left top, transparent 15rpx, #ffffff 0) top right /560rpx 51% no-repeat,
				radial-gradient(circle at left bottom, transparent 15rpx, #ffffff 0) bottom right /560rpx 51% no-repeat;
			filter: drop-shadow(0rpx 2rpx 12rpx 0rpx rgba(0, 0, 0, 0.04));
		}
	}

	.tc_left {
		display: flex;

		justify-content: center;
		align-items: center;
		width: 152rpx;

		text {
			font-size: 30rpx;
			font-weight: bold;
		}
	}

	.tc_right {
		display: flex;
		align-items: center;
		width: 550rpx;
		padding: 0 20rpx;
		font-size: 26rpx;

		.text {
			padding: 10rpx 0rpx;
			width: 100%;
		}
	}
</style>
