<template>
	<view>
		<uni-nav-bar title="门店" backgroundColor='#03803B' color="#fff" fixed statusBar
			@clickRight="inSetting">
			<block slot="right">
				<view>
					<image class="nav-right" src="@/static/images/home/setting.png" />
				</view>
			</block>
		</uni-nav-bar>
		<view class="home-card">
			<view class="home-card-title">
				保险
			</view>
			<uni-grid :column="4" :showBorder="false">
				<uni-grid-item>
					<view class="grid-item-box"  @click="allClick('轮胎保注册')">
						<view class="grid-item-box-img">
							<image style="width: 45rpx;height: 45rpx;" src="@/static/images/home/home (15).png" />
						</view>
						<view class="grid-item-box-text">
							轮胎保
						</view>
					</view>
				</uni-grid-item>
			</uni-grid>
		</view>
	</view>
</template>

<script>
	import {
		getAddress
	} from '@/api/home/index.js'
	export default {
		data() {
			return {

			}
		},
		onLoad() {
			if (uni.getStorageSync('accessToken')) {
				this.getAddressdata()
			}
		},
		methods: {
			inSetting() {
				uni.navigateTo({
					url: '/pages/home/setting'
				});
			},
			getAddressdata() {
				if (!uni.getStorageSync("addressData")) {
					getAddress().then(res => {
						uni.setStorageSync('addressData', JSON.stringify(res.data));
					})
				}
			},
			allClick(name) {
				if (name == '轮胎保注册') {
					uni.navigateTo({
						url: '/pages/home/insurance/index'
					});
				}
				if (name == '轮胎保理赔') {
					uni.navigateTo({
						url: '/pages/home/claim/index'
					});
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.nav-right {
		width: 32rpx;
		height: 30rpx;
	}

	.home-card {
		margin-top: 30rpx;
		background: #FFFFFF;
		padding: 40rpx 40rpx 10rpx 40rpx;

		.home-card-title {
			font-weight: 500;
			font-size: 34rpx;
			color: #0F0D0D;
			margin-left: 20rpx;
			margin-bottom: 10rpx;
		}

		.grid-item-box {
			display: flex;
			flex-direction: column;
			align-items: center;
			
			.uni-grid-item__box{
				justify-content: center;
			}
			.grid-item-box-img {
				display: flex;
				justify-content: center;
				align-items: center;
				width: 100rpx;
				height: 100rpx;
			}

			.grid-item-box-text {
				width: 100rpx;
				text-align: center;
				font-weight: 500;
				font-size: 26rpx;
				color: #6A6A6A;
			}
		}

	}
</style>