<template>
	<view class="content">
		<view class="topbox">
			<view class="" style="display: flex;justify-content: space-between;">
				<view class="">
					<image @click="$refs.shuoming.open()" class="wugz" :src="z_imgPath + 'mjl_gz.png?1'"></image>
				</view>
				<view class="time">{{datas.time}}</view>
			</view>
			<view class="flex_center" style="justify-content: space-between;">
				<view class="leiji">
					当前累计消费：<text style="color: #F37400;">{{datas.money}}</text>
				</view>
				<view class="btns" @click="ling()"
					:style="'background: url('+ z_imgPath + 'yijian.png'+ ') no-repeat 0 0 / 100% 100%;'"></view>
			</view>
		</view>

		<view class="items" v-for="(item,index) in lists" :key="index">
			<view class="flex_center" style="display: flex;justify-content: start;">
				<image class="jingbi" :src="z_imgPath + 'jinbi.png'"></image>
				<view class="leixiao">累计消费满{{item.give_money}}</view>
			</view>
			<view class="heiline"></view>
			<view class="jp_box">
				<view class="imgbox" v-for="(a,b) in item.give_list" :key="b">
					<image class="spimg" :src="a.imgurl" mode="aspectFill"></image>
					<view class="zhaozi" v-if="item.give_is == 1">
						<image class="lq" :src="z_imgPath+'zhaozi.png'"></image>
					</view>
					<view class="btext hang1">{{a.title}}</view>
				</view>
			</view>
		</view>
		<uni-popup ref="shuoming" type="center">
			<view class="pop" :style="'background: url('+ z_imgPath + 'gz_bg.png'+ ') no-repeat 0 0 / 100% 100%;'">
				<view class="pop_con">
					<scroll-view scroll-y="true" style="height: 440rpx;">
						<view v-html="news"></view>
					</scroll-view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				z_imgPath: this.$z_img + 'shouye/wuxian/',
				lists: "",
				datas: "",
				show: false,
				news: ""
			}
		},
		onLoad() {
			this.getData()
			this.getDanye(5)
		},
		methods: {
			getData() {
				let that = this;
				that.req({
					url: 'infinite_give_list',
					Loading: true,
					success(res) {
						// console.log(res);
						that.lists = res.data.data;
						that.datas = res.data.other_data;
					}
				})
			},
			getDanye(e) {
				let that = this;
				that.req({
					url: 'danye',
					data: {
						type: e
					},
					success(res) {
						if (res.status == 1) {
							that.news = res.data
						}
					}
				})
			},
			ling() {
				let that = this;
				that.req({
					url: 'infinite_give_goods',
					data: {},
					success(res) {
						if (res.status == 1) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							})
						}
						setTimeout(() => {
							that.getData()
						}, 500)
					}
				})


			}
		},

	}
</script>

<style>
	.jp_box {
		display: flex;
		overflow-x: scroll;
	}

	.pop_con {
		height: 440rpx;
		margin: auto;
		padding: 0rpx 36rpx;
		font-size: 24rpx;
		line-height: 36rpx;
		color: #FFFFFF;
		box-sizing: border-box;
		overflow-y: scroll;
	}


	.pop {
		width: 543rpx;
		height: 801rpx;
		padding-top: 192rpx;
		box-sizing: border-box;
		/* background: #FFFFFF; */
		/* border-radius: 20rpx; */
	}


	.btns {
		width: 141rpx;
		height: 45rpx;
		margin-top: 28rpx;
	}

	.imgbox:nth-child(1) {
		margin-left: 0rpx;
	}

	.imgbox {
		border-radius: 10rpx;
		margin-top: 20rpx;
		margin-left: 30rpx;
		position: relative;
	}

	.zhaozi {
		width: 140rpx;
		height: 140rpx;
		border-radius: 10rpx;
		position: absolute;
		left: 14rpx;
		top: 14rpx;
		background-color: rgba(0, 0, 0, 0.2);
	}

	.lq {
		width: 80rpx;
		height: 80rpx;
		border-radius: 10rpx;
		margin-left: 30rpx;
		margin-top: 30rpx;
	}

	.spimg {
		width: 140rpx;
		height: 140rpx;
		border-radius: 10rpx;
	}

	.heiline {
		width: 630rpx;
		height: 1rpx;
		background: #333333;
		border-radius: 1rpx;
		margin-top: 16rpx;
	}

	.btext {
		font-size: 24rpx;
		/* background: #000000; */
		color: rgba(255, 255, 255, 0.7);
		/* width: 650rpx; */
		padding: 4rpx 10rpx;
		box-sizing: border-box;
		margin-top: 10rpx;
	}

	.leixiao {
		font-size: 30rpx;
		/* text-shadow: 0px 0px 12rpx rgba(150, 255, 254, 0.8); */
		color: #FFFFFF;
	}

	.jingbi {
		width: 42rpx;
		height: 42rpx;
		margin-right: 10rpx;
	}

	.items {
		width: 690rpx;
		/* background: #11141D; */
		border: 2rpx solid #FFFFFF;
		border-radius: 10rpx;
		margin: 20rpx auto 0;
		padding: 20rpx;
		box-sizing: border-box;
		/* box-shadow: 0px 0px 10rpx 0px rgba(150, 255, 254, 0.7); */
	}

	.leiji {
		font-size: 32rpx;
		font-weight: 400;
		color: #FFFFFF;
		margin-top: 30rpx;
	}

	.topbox {
		width: 694rpx;
		/* background: #FFFFFF; */
		padding: 24rpx 28rpx;
	}

	.time {
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #FFFFFF;
		margin-top: 4rpx;
		opacity: .7;
	}

	.wugz {
		width: 177rpx;
		height: 39rpx;
	}

	.content {
		width: 100vw;
		min-height: 100vh;
		padding-bottom: 50rpx;
		box-sizing: border-box;
	}
</style>
