<template>
	<view class="page">

		<!-- <navbar title="个人中心" /> -->

		<view class="head">
			<view class="headImage">
				<image :src="userInfo.headImage || '/static/image/center/headImage.png'" mode="aspectFill"></image>
			</view>
			<view class="info">
				<view v-if="isLogin">
                    
                    <view style="display: flex;gap: 20rpx;">
                        <view class="name">
                            {{userInfo.nickName || '未登录'}}
                        </view>
                        <view class="headBtn" @click="$utils.navigateTo('/pages_order/auth/wxUserInfo')">
                            修改资料
                            <uv-icon name="edit-pen-fill" size="26rpx" color="#fff"></uv-icon>
                        </view>
                    </view>

					<view class="tips">
						手机号：<text>{{userInfo.phone || '未绑定'}}</text>
					</view>
				</view>
				<view v-else>
					<view class="login-btn" @tap.stop="$utils.toLogin()">
						<text>立即登录</text>
					</view>
				</view>
			</view>
		</view>

		<!-- 酒店 -->
		<view class="user">
			<view class="line" @click="$utils.navigateTo('/pages_order/mine/purse')">
				<view class="item">
					<view class="image">
						<image src="/static/image/center/1.png" mode=""></image>
					</view>
					<view class="">
						累计提现
						<p style="color:#DC2828; font-weight: 700;">￥{{ userInfo.price || 0 }}</p>
					</view>
				</view>
				<view class="item">
					<view class="image">
						<image src="/static/image/center/4.png" mode=""></image>
					</view>
					<view class="">
						我的积分
						<p style="color:#DC2828;font-weight: 700">￥{{ userInfo.money || 0 }}</p>
					</view>
				</view>
			</view>
			<view class="line">
				<view class="image-home"
				@click="$utils.navigateTo('/pages_order/order/fastCreateOrder')">
					<uv-swiper 
						class="uv-swaip"
						height="240rpx"
						:list="[configList.banner_icon]" 
						circular 
						indicator="true"
						bgColor="#ffffff">
					</uv-swiper>
				</view>
			</view>
			<view class="line grid">
				<view class="title">
					我的服务
				</view>
				<uv-grid :col="4" :border="false">

					<uv-grid-item @click="$utils.navigateTo('/index/order')">
						<image class="image" src="/static/image/center/12.png" mode=""></image>
						<text class="grid-text">我的订单</text>
					</uv-grid-item>

					<uv-grid-item @click="$utils.navigateTo('/pages_order/mine/address')">
						<image class="image" src="/static/image/center/12.png" mode=""></image>
						<text class="grid-text">我的地址</text>
					</uv-grid-item>

					<uv-grid-item @click="$utils.navigateTo('/pages_order/mine/individualTeam')">
						<image class="image" src="/static/image/center/8.png" mode=""></image>
						<text class="grid-text">我的分享</text>
					</uv-grid-item>
					
					<uv-grid-item @click="$utils.navigateTo('/pages_order/order/fastOrderList')">
						<image class="image" src="/static/image/center/12.png" mode=""></image>
						<text class="grid-text">快捷订单</text>
					</uv-grid-item>
					
					<uv-grid-item @click="$utils.navigateTo('/pages_order/mine/promotion')">
						<image class="image" src="/static/image/center/9.png" mode=""></image>
						<text class="grid-text">邀请好友</text>
					</uv-grid-item>
				
					<!-- <uv-grid-item @click="$utils.navigateTo('/pages_order/center/systemSet')">
						<image class="image" src="/static/image/center/6.png" mode=""></image>
						<text class="grid-text">系统设置</text>
					</uv-grid-item> -->
				
					<uv-grid-item @click="$utils.navigateTo('/pages_order/mine/help')">
						<image class="image" src="/static/image/center/7.png" mode=""></image>
						<text class="grid-text">帮助与反馈</text>
					</uv-grid-item>
				
					<uv-grid-item
						@click="$utils.navigateTo('/pages_order/mine/about')">
						<image class="image" src="/static/image/center/7.png" mode=""></image>
						<text class="grid-text">关于本程序</text>
					</uv-grid-item>
					
					<uv-grid-item @click="$store.commit('logout')">
						<image class="image" src="/static/image/center/logout.png" mode=""></image>
						<text class="grid-text">退出登录</text>
					</uv-grid-item>
					
					<!-- <uv-grid-item>
						<button open-type="contact" class="share">
							<image class="image" src="/static/image/center/5.png" mode=""></image>
							<text class="grid-text">联系客服</text>
						</button>
					</uv-grid-item> -->
				</uv-grid>
			</view>
		</view>
		
		
		<quick-order-entry 
		ref="quickOrderEntry"
		bottom="50vh"
		/>
		
		<kefu/>

		<tabber select="center" />
	</view>
</template>

<script>
	import tabber from '@/components/base/tabbar.vue'
	import QuickOrderEntry from '@/components/QuickOrderEntry.vue'
	export default {
		components: {
			tabber,
			QuickOrderEntry,
		},
		computed: {
			isLogin(){
				return this.userInfo && this.userInfo.id
			}
		},
		data() {
			return {
				list: [],
			}
		},
		onShow() {
			if(uni.getStorageSync('token')){
				// 刷新快捷下单信息
                this.$store.commit('getUserInfo')
				this.$refs.quickOrderEntry.refresh()
            }
		},
		methods: {
			// 显示快捷订单菜单
			showQuickOrderMenu() {
				uni.showActionSheet({
					itemList: ['快捷下单', '我的快捷订单'],
					success: (res) => {
						if (res.tapIndex === 0) {
							// 跳转到快捷下单页面
							this.$utils.navigateTo('/pages_order/order/fastCreateOrder');
						} else if (res.tapIndex === 1) {
							// 跳转到快捷订单列表
							this.$utils.navigateTo('/pages_order/order/fastOrderList');
						}
					}
				});
			}
		}
	}
</script>

<style scoped lang="scss">
	.page {

		.warp {
			display: flex;
			align-items: center;
			justify-content: center;
			height: 100%;

		}

		.rect {
			width: 600rpx;
			height: 300rpx;
			background-color: #fff;
			border-radius: 20rpx;
			overflow: hidden;

			.title {
				padding: 10rpx 0 0 15rpx;
				background-color: #fd5100;
				color: #FFF;
				text-align: left;
				width: 100%;
				height: 18%;
				font-size: 36rpx;
			}

			.center {
				height: 40%;
				display: flex;
				justify-content: center;
				align-items: center;
				font-size: 36rpx;
			}

			.bottom {
				display: flex;
				justify-content: center;
				gap: 50rpx;
			}
		}
	}



	image {
		width: 100%;
		height: 100%;
	}

	.head {
		display: flex;
		background-color: #DC2828;
		padding: 0rpx 20rpx;
		align-items: center;
		position: relative;
		height: 300rpx;
		padding-top: 60rpx;
		.headImage {
			width: 120rpx;
			height: 120rpx;
			background-image: url(/static/image/center/3.png);
			background-size: 100% 100%;
			overflow: hidden;
			border-radius: 50%;
			margin-right: 40rpx;
		}

		.info {
			font-size: 28rpx;
			.vip {
				background-color: #FCCC92;
				color: #FA6239;
				width: 100rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				height: 40rpx;
				border-radius: 20rpx;
				margin-top: 20rpx;
			}

			.name {
				font-size: 36rpx;
				color: #fff;
                margin-right: 20rpx;
                width: 240rpx;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
			}

			.tips {
				font-size: 26rpx;
				color: #fff;
				margin-top: 10rpx;
			}

			.login-btn {
				margin-top: 20rpx;
				background-color: #fff;
				color: #DC2828;
				padding: 10rpx 30rpx;
				border-radius: 30rpx;
				font-size: 28rpx;
				display: inline-block;
				width: 160rpx;
				text-align: center;
			}
		}

		.headBtn {
			color: #FFF;
			font-size: 26rpx;
            display: flex;
            align-items: center;
		}
	}

	.user {
        position: relative;
		z-index: 9;
		margin: 0 30rpx;
		margin-top: -60rpx;
		.line {
			display: flex;
			background-color: #fff;
			padding: 20rpx 0;
			align-content: center;
			margin-top: 20rpx;
			border-radius: 15rpx;
			.item {
				flex: 1;
				display: flex;
				justify-content: center;
				align-items: center;
				padding: 20rpx 0;

				&:nth-child(1) {
					border-right: 1px dotted #00000013;
				}

				.image {
					width: 150rpx;
					height: 135rpx;
					margin-right: 20rpx;
				}
			}
			.image-home{
				z-index: 1;
				width: 100%;
			}
		}

		.grid {
			flex-direction: column;
			font-size: 26rpx;
			padding: 20rpx;

			.title {
				margin-bottom: 30rpx;
				font-size: 28rpx;
				font-weight: 600;
			}

			.image {
				width: 50rpx;
				height: 50rpx;
				margin: 20rpx 0;
			}

			text {
				text-align: center;
				width: 120rpx;
				font-size: 24rpx;
			}

			.share {
				background: none;
				padding: 0;
				margin: 0;
				line-height: normal;
				border: none;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				
				&::after {
					border: none;
				}
				
				.image {
					width: 50rpx;
					height: 50rpx;
					margin: 20rpx 0;
				}
				
				.grid-text {
					text-align: center;
					width: 120rpx;
					font-size: 24rpx;
				}
			}
		}
	}
</style>