<template>
	<view class="cardCss" v-if="swipers.length">
			<swiper class="uni-swiper-wrapper" active-class="swiperCss" indicator-active-color="#EA5604" indicator-dots
				circular interval="3000">
				<swiper-item v-for="(item,index) in swipers" :key="item.id+item.fZt">
					<view class="cardItemCss">
						<view class="flex">
							<view class="iconCss">
								<u-image src="/static/images/gas-icon/gas-bottle.png" mode="heightFix" width="50px" height="50px"></u-image>
							</view>
							<view class="topBodyCss flex justify-between">
								<view
									class="flex flex-direction justify-center align-start margin-top-sm margin-left-xl">
									<view class="flex text-lg" @click="goToGasBottlePage(item)">
										{{item.fQpgg || ""}} {{item.fCzjz || ""}}
										<u-icon class="margin-left-xs" name="arrow-right"></u-icon>
									</view>
									<view class="text-gray margin-top-sm">
										{{item.fQptm || ""}}
									</view>

								</view>
								<view
									class="flex flex-direction justify-start align-center margin-top-sm margin-right-sm">
									<view class="flex">
										<u-tag color="#0CB6C3" borderColor="#fff" :text="item.fZt || ''" size="mini"
											bgColor="#E6F7F7"></u-tag>
									</view>
									<!-- <view class="text-orange margin-top-sm">
										2/99
									</view> -->
								</view>
							</view>
						</view>
						<u-divider></u-divider>

						<view class="flex justify-around align-center  margin-tb">
							<view class="flex flex-direction align-center">
								<view class="flex align-center" style="height: 30px;">
									<text class="text-xxl text-bold">{{item.fQpgg || ""}}</text>
									<!-- <text>(L)</text> -->
								</view>
								<view class="margin-top-sm flex justify-end text-gray">
									预计气量
								</view>
							</view>
							<view class="flex flex-direction" @click="goToGasBottlePage(item)">
								<view class="flex justify-center">
									<u-image src="/static/images/home/qpxx.png" mode="heightFix" width="30px" height="30px"></u-image>
								</view>
								<view class="margin-top-sm text-gray">
									气瓶信息
								</view>
							</view>
							<view class="flex flex-direction" @click="goTohomeSecurityCheckPage(item)">
								<view class="flex justify-center">
									<u-image src="/static/images/home/rhaj.png" mode="heightFix" width="30px" height="30px"></u-image>
								</view>
								<view class="margin-top-sm text-gray">
									入户安检
								</view>
							</view>
						</view>
					</view>
				</swiper-item>
			</swiper>
			<view class="flex bomTextCss justify-center text-orange text-lg" @click="goToMyGasBottle">
				查看其他气瓶状态
			</view>
		</view>
</template>

<script>
	export default {
		name: "gasSwiper",
		data() {
			return {
				parmas: {
					current: 1,
					size: 10,
					zt:'使用中'
				},
				swipers: []
			};
		},
		mounted() {
			this.getwQpssxxList()
		},
		methods: {
			async getwQpssxxList() {
				const result = await this.$api.memberApi.getwQpssxxList(this.parmas);
				let {code,value} = result;
				if (code === 200) {
					this.swipers = value.records
				}
				console.log("在用气瓶列表",this.swipers);
			},
			goToGasBottlePage(val) {
				console.log('打印val',val);
				let itemId = val.id;
				// if(val.ajid){
				// 	itemId = val.ajid
				// }
				uni.navigateTo({
					url: `/pages/home/gasBottle?qpid=${itemId}`
				})
			},
			goToMyGasBottle() {
				uni.navigateTo({
					url: '/pages/mine/myGasBottle'
				})
			},
			goTohomeSecurityCheckPage(val) {
        console.log('打印val',val);
        uni.navigateTo({
          url:`/pages/mine/appList/homeSecurity/checkDetail?id=${val.fAjid}`
        })
				// uni.navigateTo({
				// 	url: '/pages/mine/appList/homeSecurity/homeSecurityCheck'
				// })
			},
		}
	}
</script>

<style lang="scss">
	.cardCss {
		border-radius: 15px;
		background: #fff;
		padding: 10px;
		overflow: hidden;

		.cardItemCss {
			// height: 350px;
			position: relative;

			.iconCss {
				padding: 10px 0 0 25px;
			}

			.topBodyCss {
				width: 100%;
			}
		}

		.bomTextCss {
			padding-top: 30px;
		}
	}

	/deep/.uni-swiper-dots {
		bottom: -20px;
	}

	/deep/.uni-swiper-wrapper {
		overflow: visible;
	}
</style>