<template>
	<view class="flex-col page">
		<view class="flex-row section">
			<image class="self-center image" :src="avator" />
			<view class="flex-col self-start group">
				<text class="self-start text">默认用户</text>
				<view class="flex-col justify-start items-center self-stretch text-wrapper mt-6">
					<text class="font text_2">剩余积分:0</text>
				</view>
			</view>
			<view class="flex-col justify-start items-center self-start text-wrapper_2">
				<text class="font text_3">优惠卷:0 张</text>
			</view>
		</view>
		<view class="flex-col relative group_2">
			<view class="flex-row equal-division">
				<view class="flex-col items-center group_3 group_1" @click="goto()">
					<image class="image_2" :src="dingdan" />
					<text class="font text_4">总订单</text>
				</view>
				<view class="flex-col items-center group_3 group_4">
					<image class="image_2" :src="qianbao" />
					<text class="font text_1">待付款</text>
				</view>
				<view class="flex-col items-center group_3 group_5">
					<image class="image_2" :src="daifahuo" />
					<text class="font">待发货</text>
				</view>
				<view class="flex-col items-start group_3 group_6">
					<image class="image_2" :src="daishouhuo" />
					<text class="font">待收货</text>
				</view>
				<view class="flex-col items-center group_3 group_7">
					<image class="image_2" :src="tuikuan" />
					<text class="font text_9">退款/售后</text>
				</view>
			</view>
			<view class="flex-col mt-37">
				<view class="flex-row justify-between items-center section_2">
					<view class="flex-row items-center">
						<image class="shrink-0 image_3" :src="address" />
						<text class="font_2 ml-5">地址列表</text>
					</view>
					<image class="image_4 image_5" :src="you" />
				</view>
				<view class="list-divider mt-5"></view>
				<view class="flex-row justify-between items-center section_4 mt-5" @click="goToText()">
					<view class="flex-row items-center">
						<image class="shrink-0 image_3" :src="lianxiren_s" />
						<text class="font_2 text_5 ml-5">联系人列表</text>
					</view>
					<image class="image_6" :src="you" />
				</view>
				<view class="list-divider mt-5"></view>
				<view class="flex-row justify-between items-center list-item_2 mt-5"  @click="goTo()">
					<view class="flex-row items-center">
						<image class="shrink-0 image_8" :src="setting_s" />
						<text class="font_2 text_6 ml-7">设置</text>
					</view>
					<image class="image_4 image_7" :src="you" />
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	const goto = () => {
		uni.navigateTo({
			url: "/pages/mine/mineorders/mineorders"
		})
	}

	const store = userStore()
	const login = () => {
		uni.getUserProfile({
			lang: 'zh_CN',
			desc: '用户登录', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,
			success: (res) => {
				console.log(res, 'resss')
				resolve(res.userInfo)
			},
			fail: (err) => {
				reject(err)
			}
		})

		// uni.login({
		// 	provider: 'weixin',
		// 	success: (loginRes) => {
		// 		if(loginRes.code !== null) {
		// 			console.log("获取code:" + loginRes.code)
		// 			loginUser(loginRes.code);
		// 		} else {
		// 			console.log("code为空");
		// 		}
		// 	}
		// })
	}
	const loginUser = (code) => {
		uni.request({
			url: apiImageUrl + 'user/login/wx_open',
			method: 'GET',
			data: {
				code: code
			},
			success: (res) => {
				console.log(res, "是否有code")
				uni.removeStorageSync('cookie'); // 保fCookie到Storage
				uni.setStorageSync("cookie", res.header['Set-Cookie']);
				if (res.data.code == 1) {
					uni.showToast({
						title: '登录成功',
						duration: 2000
					})

					//每次登录时清楚缓存
					uni.setStorageSync('userInfo', res.data.data)
					uni.switchTab({
						url: '/pages/index/index'
					})
				} else {
					uni.showToast({
						icon: 'error',
						title: "登录失败,请联系管理员"
					})
					return
				}

			}
		})
	}
	const goToText = () => {
		uni.navigateTo({
			url: '/pages/mine/Contact/Contact'
		})
	}
	const goTo = ()=>{
		uni.navigateTo({
			url: '/pages/mine/bookings/booking'
		})
	}
</script>

<style lang="scss" scoped>
	.mt-37 {
		margin-top: 69.38rpx;
	}

	.ml-5 {
		margin-left: 9.38rpx;
	}

	.mt-5 {
		margin-top: 9.38rpx;
	}

	.ml-7 {
		margin-left: 13.13rpx;
	}

	.page {
		// padding-bottom: 564.38rpx;
		background-color: #ffffff;
		// height: 100%;
		width: 100%;
		overflow-y: auto;
		overflow-x: hidden;
		overflow: hidden;
	}

	.section {
		padding: 213.75rpx 0 105rpx;
		background-image: url('https://ide.code.fun/api/image?token=6711ccc71511d900114adddf&name=608ce961205c6b6c4a5f231d50bcfd3e.png');
		background-size: 100% 100%;
		background-repeat: no-repeat;
	}

	.image {
		border-radius: 50%;
		width: 150rpx;
		height: 151.88rpx;
	}

	.group {
		margin-left: 34.67rpx;
		margin-top: 32.06rpx;
	}

	.text {
		color: #000000;
		font-size: 37.5rpx;
		font-family: Open Sans;
		line-height: 34.91rpx;
	}

	.text-wrapper {
		padding: 23.34rpx 0 23.85rpx;
		background-color: #fbdab4;
		border-radius: 18.75rpx;
		width: 222.34rpx;
	}

	.font {
		font-size: 26.25rpx;
		font-family: Open Sans;
		line-height: 24.34rpx;
		color: #000000;
	}

	.text_2 {
		font-size: 28.13rpx;
		line-height: 25.93rpx;
	}

	.text-wrapper_2 {
		margin-left: 24.49rpx;
		margin-top: 78.75rpx;
		padding: 23.27rpx 0 23.85rpx;
		background-color: #ffdab1;
		border-radius: 18.75rpx;
		width: 222.34rpx;
		height: 73.13rpx;
	}

	.text_3 {
		font-size: 28.13rpx;
		line-height: 26.03rpx;
	}

	.group_2 {
		margin-top: -48.75rpx;
		padding-left: 26.25rpx;
		padding-right: 26.23rpx;
	}

	.equal-division {
		padding: 14.38rpx 18.92rpx 31.05rpx;
		background-color: #fff1e2;
		border-radius: 9.38rpx;
	}

	.group_3 {
		flex: 1 1 131.93rpx;
	}

	.group_1 {
		padding: 9.99rpx 0 9.99rpx;
	}

	.image_2 {
		width: 95.63rpx;
		height: 95.63rpx;
	}

	.text_4 {
		line-height: 24.07rpx;
	}

	.group_4 {
		padding: 9.99rpx 0 11.79rpx;
	}

	.text_1 {
		line-height: 24.23rpx;
	}

	.group_5 {
		padding: 9.99rpx 0 11.76rpx;
	}

	.group_6 {
		padding: 9.99rpx 6.64rpx 11.76rpx 29.66rpx;
	}

	.group_7 {
		padding: 10.01rpx 0 11.94rpx;
	}

	.text_9 {
		font-size: 24.38rpx;
		line-height: 22.52rpx;
	}

	.section_2 {
		padding: 22.5rpx 26.61rpx;
		background-color: #fffef8;
		border-radius: 18.75rpx;
	}

	.image_3 {
		width: 43.13rpx;
		height: 43.13rpx;
	}

	.font_2 {
		font-size: 30rpx;
		font-family: Open Sans;
		line-height: 27.69rpx;
		color: #000000;
	}

	.image_4 {
		width: 48.75rpx;
		height: 48.75rpx;
	}

	.image_5 {
		margin-right: 6.38rpx;
	}

	.list-divider {
		background-color: #0000002e;
		height: 1.89rpx;
	}

	.section_4 {
		padding: 22.95rpx 26.61rpx 22.05rpx;
		background-color: #fffef8;
		border-radius: 18.75rpx;
	}

	.text_5 {
		line-height: 27.86rpx;
	}

	.image_6 {
		margin-right: 6.38rpx;
		width: 48.75rpx;
		height: 50.63rpx;
	}

	.list-item_2 {
		padding: 22.5rpx;
		background-color: #fffef8;
		border-radius: 18.75rpx;
	}

	.image_8 {
		filter: drop-shadow(0rpx 7.5rpx 3.75rpx #00000040);
		width: 43.13rpx;
		height: 43.13rpx;
	}

	.text_6 {
		line-height: 27.11rpx;
	}

	.image_7 {
		margin-right: 10.48rpx;
	}

	@import url(../../../common/css/global.css);
</style>