<template>
	<view class="my-page">
		<scroll-view class="my-scroll" scroll-y refresher-enabled :refresher-triggered="refreshing"
			@refresherrefresh="onRefresh">
			<view class="my-content" :style="contentStyle">
				<view class="top-zone fade-up" style="animation-delay: 0ms;">
					<view class="profile-row">
						<view class="avatar-card">
							<image class="avatar-img" :src="getMyCenterImage('avatar')" mode="aspectFill"></image>
						</view>
						<view class="profile-main">
							<view class="name-row">
								<text class="user-name">{{(userName == null || userName == undefined) ? '半径同学' : userName}}</text>
								<text class="verify-dot"></text>
							</view>
							<view class="school-row" hover-class="tap-soft" hover-stay-time="80"
								@tap.stop="navigatorTo('qiehuan')">{{schoolName}} ›</view>
							<view class="identity-pill" @tap.stop="navigatorTo('qiehuan')">切换校区</view>
						</view>
					</view>
					<!-- <view class="ticket-card" hover-class="tap-soft" hover-stay-time="80" @tap="navigatorTo('blindBox')">
						<view>
							<view class="ticket-label">我的星球券</view>
							<view class="ticket-value">{{blindBoxCount}}张</view>
						</view>
						<image class="ticket-icon" src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/194d0696160f4b60a2c6889584639934.png" mode="aspectFit"></image>
					</view> -->
				</view>

				<view class="saving-hero fade-up" hover-class="tap-soft" hover-stay-time="80"
					style="animation-delay: 50ms;" @tap="navigatorTo('qianbao')">
					<image class="saving-bg" :src="getMyCenterImage('savingHero')" mode="aspectFit"></image>
					<view class="saved-badge">已经帮你省下</view>
					<view class="saved-main">
						<view class="saved-money money-roll">¥{{savedMoney}}</view>
						<view class="saved-desc">{{savedDescText}}</view>
						<!-- <view class="saved-week" v-if="savedAmountValue > 0">订单完成后自动累计</view> -->
					</view>
				</view>
				
				<view class="quick-card fade-up" style="animation-delay: 200ms;">
					<view class="quick-item" hover-class="tap-soft" hover-stay-time="80"
						v-for="(item,index) in quickItems" :key="index" @tap="navigatorTo(item.action)">
						<view class="quick-icon-wrap">
							<image class="quick-icon" :class="'quick-icon--' + item.type" :src="item.icon"
								mode="aspectFit"></image>
						</view>
						<view class="quick-title" :class="'quick-title--' + item.type">{{item.title}}</view>
						<view class="quick-tip" :class="'quick-tip--' + item.type">{{item.tip}}</view>
					</view>
				</view>

				<view class="section-card earn-section fade-up" style="animation-delay: 100ms;">
					<view class="section-head">
						<view class="head-main">
							<image class="title-icon" :src="getMyCenterImage('earnTitle')" mode="aspectFit"></image>
							<view>
								<view class="section-title">今天还能省钱又赚钱</view>
								<!-- <view class="section-desc">每日都有新机会，省钱又赚钱</view> -->
							</view>
						</view>
						<!-- <view class="text-link" @tap="showComingSoon('全部任务')">查看全部 ›</view> -->
					</view>
					<view class="task-row">
						<view class="task-card" hover-class="tap-soft" hover-stay-time="80"
							v-for="(item,index) in taskCards" :key="index" :class="'task-card--' + item.type"
							@tap="navigatorTo(item.action)">
							<view class="task-title">{{item.title}}</view>
							<view class="task-sub">
								<text>{{item.subPre}}</text>
								<text class="task-sub-em">{{item.subEm}}</text>
								<text>{{item.subPost}}</text>
							</view>
							<view class="task-visual">
								<image class="task-asset" :class="'task-asset--' + item.type" :src="item.icon"
									mode="aspectFit"></image>
							</view>
							<view class="task-btn">{{item.cta}}</view>
						</view>
					</view>
				</view>

				<view class="section-card identity-section fade-up" style="animation-delay: 150ms;">
					<view class="section-head section-head--inline">
						<view class="head-inline">
							<text class="section-title">我的身份</text>
							<text class="head-sub">多重身份，都能赚钱</text>
						</view>
						<!-- <view class="text-link" @tap="showComingSoon('切换身份')">切换身份</view> -->
					</view>
					<view class="identity-row">
						<view class="identity-card" hover-class="tap-soft" hover-stay-time="80"
							v-for="(item,index) in identityCards" :key="index" :class="'identity-card--' + item.type"
							@tap="navigatorTo(item.action)">
							<view class="identity-badge" v-if="item.count">{{formatBadgeCount(item.count)}}</view>
							<view class="identity-tag" v-else-if="item.tag">{{item.tag}}</view>
							<view class="identity-dot" v-else></view>
							<view class="identity-title">{{item.title}}</view>
							<view class="identity-desc">{{item.desc}}</view>
							<view class="identity-foot">
								<image class="identity-icon" :class="'identity-icon--' + item.type" :src="item.icon"
									mode="aspectFit"></image>
								<!-- <view class="identity-go">›</view> -->
							</view>
						</view>
					</view>
				</view>

				<!-- <view class="section-card life-section fade-up" style="animation-delay: 250ms;">
					<view class="section-head section-head--inline">
						<view class="head-inline">
							<text class="section-title">校园生活</text>
							<text class="head-sub">发现更多有趣的校园生活</text>
						</view>
						<view class="text-link" @tap="showComingSoon('全部服务')">全部服务 ›</view>
					</view>
					<view class="life-grid">
						<view class="life-card" hover-class="tap-soft" hover-stay-time="80"
							v-for="(item,index) in lifeCards" :key="index" :class="'life-card--' + item.type"
							@tap="navigatorTo(item.action)">
							<view class="life-title">{{item.title}}</view>
							<view class="life-desc">{{item.desc}}</view>
							<view class="life-visual">
								<image class="life-asset" :class="'life-asset--' + item.type" :src="item.icon"
									mode="aspectFit"></image>
							</view>
						</view>
					</view> 
				</view>-->

				<view class="logout-btn fade-up" hover-class="logout-active" hover-stay-time="80"
					style="animation-delay: 300ms;" @tap="navigatorTo('tuichu')">
					<text class="logout-power"></text>
					<text>退出登录</text>
				</view>
			</view>
		</scroll-view>

		<!-- 未注册兼职弹窗 -->
		<uni-popup ref="jianzhiPopup" background-color="rgba(2, 171, 255, 1)" borderRadius="40px 40px 40px 40px">
			<view class="jianzhi-content" @tap="navigatorTo('partTimeReg')">
				<img :src="getMyCenterImage('jianzhiPopup')" alt=""
					style="width: 100%;height: 100%;">
				<view style="position: absolute;bottom: -50px;left: 130px;" @tap.stop="$refs.jianzhiPopup.close()">
					<uni-icons type="close" size="40" color="#fff"></uni-icons>
				</view>
			</view>
		</uni-popup>
		<!-- 多个商家选择弹窗 -->
		<uni-popup ref="shopPopup" background-color="transparent" borderRadius="40px 40px 40px 40px">
			<view class="shop-content">
				<view class="popup-pay-title">
					<text>选择要进入的店铺</text>
				</view>
				<view class="popup-list" hover-class="tap-soft" hover-stay-time="80" @tap="clickShop(item)"
					v-for="(item,index) in schoolShop" :key="index">
					{{item.shopName}}
				</view>
			</view>
		</uni-popup>
		<!-- 弹出区域选择 -->
		<uni-popup ref="areaPopup" background-color="transparent">
			<view class="campus-area-popup">
				<view class="area-popup-glow area-popup-glow-a"></view>
				<view class="area-popup-glow area-popup-glow-b"></view>
				<view class="campus-area-header">
					<view class="campus-area-kicker">选择你的校园半径</view>
					<view class="campus-area-title">你现在在哪个校区？</view>
					<view class="campus-area-subtitle">选定后，会优先展示附近同学正在拼的内容。</view>
				</view>
				<view class="campus-area-search">
					<text class="area-search-icon">⌕</text>
					<input v-model="areaKeyword" confirm-type="search" placeholder="搜索学校 / 校区 / 区域"
						placeholder-class="area-search-placeholder" />
				</view>
				<scroll-view scroll-y class="campus-area-list">
					<view class="campus-area-item" v-for="(item,index) in filteredAreaList" :key="index"
						@tap="onClickArea(item)">
						<view class="area-item-main">
							<view class="area-item-dot"></view>
							<text>{{item.title}}</text>
						</view>
						<view class="area-item-action">进入</view>
					</view>
					<view class="campus-area-empty" v-if="filteredAreaList.length === 0">
						<view class="area-empty-title">没找到这个校区</view>
						<view class="area-empty-desc">换个关键词试试，比如学校简称或区域名</view>
					</view>
				</scroll-view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	const MY_CENTER_IMAGE_CACHE_KEY = 'my_center_image_cache_v1'
	const MY_CENTER_IMAGE_CACHE_TTL = 30 * 24 * 60 * 60 * 1000
	const MY_CENTER_IMAGE_CACHE_LIMIT = 30
	const myCenterImageDownloading = {}
	const MY_CENTER_IMAGE_URLS = {
		avatar: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/1575f2987ee8435c88cabc1c1fcfde0e.png',
		savingHero: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/d59656fe69e6455093123ed769850403.png',
		earnTitle: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/c2e8e71e51e24ad4b717c405b5e8bb22.png',
		taskGroup: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/7c183db1b23c4beab01548ceb1e9b009.png',
		taskCash: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/99b4e791056f45dfbea2941127ee406f.png',
		taskSchool: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/2e7e3d41d2964bb694f1a89e3f159927.png',
		taskWallet: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/8be6d13d974346498390fd4509f392be.png',
		identityMerchant: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/8953e4af95944d7c94936efaffe155c6.png',
		identityShop: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/f19689fe650a4a439f7d9096d354b47e.png',
		identityDelivery: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/bca3af00ef5c4d68baa19ff79246f8d2.png',
		identityRule: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/93dfc625782a4a64927d862ec655bca3.png',
		quickOrder: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/4b5151ee6d804b2db41f7235ed63b04a.png',
		quickCoupon: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/9f48dc7d60a8481abd06b5a7e46487d8.png',
		quickAddress: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/6857012140ad41238cfdec20953f4444.png',
		quickCollect: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/9098995c67ae4271b23e0ac90c3abcad.png',
		quickAgent: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/8493b053a0164882b20f6d4019de3a77.png',
		jianzhiPopup: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/faf25c687bc1417282ebac719fd1bfba.png'
	}

	export default {
		data() {
			return {
				areaList: [],
				schoolShop: [],
				workerCounts: 0,
				shopCounts: 0,
				areaKeyword: '',
				balance: '0.00',
				worker: uni.getStorageSync('worker'),
				balanceRefreshId: 0,
				refreshing: false,
				couponCount: Number(uni.getStorageSync('couponCount')) || 8,
				blindBoxCount: Number(uni.getStorageSync('blindBoxCount')) || 8,
				orderCounts: {
					pay: Number(uni.getStorageSync('orderPayCount')) || 2,
					delivery: Number(uni.getStorageSync('orderDeliveryCount')) || 1,
					evaluate: Number(uni.getStorageSync('orderEvaluateCount')) || 3,
					refund: Number(uni.getStorageSync('orderRefundCount')) || 1
				},
				savedMoney: uni.getStorageSync('savedMoney') || '0.00',
				rewardMoney: uni.getStorageSync('rewardMoney') || '58.6',
				deliveryIncome: uni.getStorageSync('deliveryIncome') || '86',
				deliveryDoneCount: Number(uni.getStorageSync('deliveryDoneCount')) || 123,
				collegeRank: Number(uni.getStorageSync('collegeRank')) || 18,
				menuButtonInfo: {},
				statusBarHeight: 0,
				myCenterImages: {}
			}
		},
		computed: {
			contentStyle() {
				// 顶部与微信胶囊平齐：以胶囊 top 作为内容起点
				const top = this.menuButtonInfo && this.menuButtonInfo.top ? this.menuButtonInfo.top : 0
				if (top) {
					return {
						paddingTop: top + 'px'
					}
				}
				return {
					paddingTop: this.statusBarHeight ? (this.statusBarHeight + 16) + 'px' : '98rpx'
				}
			},
			hasWorker() {
				return !!this.worker
			},
			hasShop() {
				const shopId = uni.getStorageSync('shopId')
				const shops = this.normalizeShopList(this.schoolShop.length ? this.schoolShop : uni.getStorageSync('schoolShop'))
				return !!shopId || shops.length > 0
			},
			filteredAreaList() {
				const keyword = (this.areaKeyword || '').trim().toLowerCase()
				if (!keyword) return this.areaList
				return this.areaList.filter((item) => {
					return String(item.title || '').toLowerCase().indexOf(keyword) !== -1
				})
			},
			userName() {
				return uni.getStorageSync('nickName') || uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '半径同学'
			},
			avatarText() {
				return (this.userName || '张').slice(0, 1)
			},
			schoolName() {
				const area = this.getArea()
				return uni.getStorageSync('schoolName') || area.title || '沧州师范学院'
			},
			milkTeaCount() {
				return Math.max(1, Math.round((Number(this.savedMoney) || 0) / 5))
			},
			savedAmountValue() {
				return Number(this.savedMoney) || 0
			},
			savedDescText() {
				return '大家都在半径里拼团省钱哦'
			},
			userOrderTotal() {
				return this.orderCounts.pay + this.orderCounts.delivery + this.orderCounts.evaluate + this.orderCounts.refund
			},
			taskCards() {
				return [{
					type: 'group',
					title: '参与拼团',
					subPre: '',
					subEm: '省钱没有商量',
					subPost: '',
					icon: this.getMyCenterImage('taskGroup'),
					cta: '去拼团',
					action: 'groupPending'
				}, {
					type: 'cash',
					title: '白嫖现金',
					subPre: '',
					subEm: '22:00',
					subPost: ' 开奖',
					icon: this.getMyCenterImage('taskCash'),
					cta: '去参与',
					action: 'planet'
				}, {
					type: 'school',
					title: '学院奖金',
					subPre: '',
					subEm: '有现金奖励哦',
					subPost: '',
					icon: this.getMyCenterImage('taskSchool'),
					cta: '去排位',
					action: 'planetPK'
				}, {
					type: 'wallet',
					title: '我的钱包',
					subPre: '',
					subEm: '¥' + this.balance,
					subPost: '',
					icon: this.getMyCenterImage('taskWallet'),
					cta: '去提现',
					action: 'qianbao'
				}]
			},
			identityCards() {
				return [{
					type: 'merchant',
					title: '商家入驻',
					desc: '开店赚钱',
					icon: this.getMyCenterImage('identityMerchant'),
					action: 'merchant'
				}, {
					type: 'shop',
					title: '商家中心',
					desc: '待处理订单',
					icon: this.getMyCenterImage('identityShop'),
					count: this.shopCounts,
					action: this.hasShop ? 'merchantCenter' : 'merchant'
				}, {
					type: 'delivery',
					title: '兼职主页',
					desc: '待处理订单',
					icon: this.getMyCenterImage('identityDelivery'),
					count: this.workerCounts,
					action: this.hasWorker ? 'jianzhizhuye' : 'jianzhizhuce'
				}, {
					type: 'rule',
					title: '接单规则',
					desc: '设置接单范围',
					icon: this.getMyCenterImage('identityRule'),
					action: 'partTimeReg'
				}]
			},
			quickItems() {
				return [{
					type: 'order',
					title: '我的订单',
					tip: '',
					icon: this.getMyCenterImage('quickOrder'),
					action: 'dingdan'
				}, {
					type: 'coupon',
					title: '优惠券',
					tip: '',
					icon: this.getMyCenterImage('quickCoupon'),
					action: 'youhui'
				}, {
					type: 'address',
					title: '收货地址',
					tip: '',
					icon: this.getMyCenterImage('quickAddress'),
					action: 'address'
				}, {
					type: 'collect',
					title: '投诉吐槽',
					tip: '',
					icon: this.getMyCenterImage('quickCollect'),
					action: 'collect'
				}, {
					type: 'agent',
					title: '成为代理',
					tip: '',
					icon: this.getMyCenterImage('quickAgent'),
					action: 'agent'
				}]
			}
		},
		created() {
			this.applyCachedMyCenterImages()
			this.setMenuButtonInfo()
		},
		mounted() {
			this.setMenuButtonInfo()
			uni.$on('myCenterCountsChange', this.setPendingCounts)
		},
		beforeDestroy() {
			uni.$off('myCenterCountsChange', this.setPendingCounts)
		},
		methods: {
			getMyCenterImage(key) {
				return this.myCenterImages[key] || MY_CENTER_IMAGE_URLS[key] || ''
			},
			getMyCenterImageCache() {
				const cache = uni.getStorageSync(MY_CENTER_IMAGE_CACHE_KEY)
				return cache && typeof cache === 'object' ? cache : {}
			},
			saveMyCenterImageCache(cache) {
				uni.setStorageSync(MY_CENTER_IMAGE_CACHE_KEY, cache)
			},
			isSavedFileExists(filePath) {
				if (!filePath || filePath.indexOf('__tmp__') !== -1) return false
				try {
					const fs = (uni.getFileSystemManager && uni.getFileSystemManager())
						|| (typeof wx !== 'undefined' && wx.getFileSystemManager ? wx.getFileSystemManager() : null)
					if (fs && fs.accessSync) {
						fs.accessSync(filePath)
						return true
					}
				} catch (e) {
					return false
				}
				return true
			},
			isMyCenterImageCacheValid(cacheItem) {
				return !!(cacheItem
					&& Date.now() - Number(cacheItem.savedAt || 0) < MY_CENTER_IMAGE_CACHE_TTL
					&& this.isSavedFileExists(cacheItem.path))
			},
			applyCachedMyCenterImages() {
				const cache = this.getMyCenterImageCache()
				Object.keys(MY_CENTER_IMAGE_URLS).forEach((key) => {
					const imageUrl = MY_CENTER_IMAGE_URLS[key]
					const cacheItem = cache[imageUrl]
					if (this.isMyCenterImageCacheValid(cacheItem)) {
						this.$set(this.myCenterImages, key, cacheItem.path)
						return
					}
					if (cacheItem && cacheItem.path) {
						delete cache[imageUrl]
					}
					this.$set(this.myCenterImages, key, imageUrl)
					this.cacheMyCenterImage(key, imageUrl)
				})
				this.pruneMyCenterImageCache(cache, Object.keys(MY_CENTER_IMAGE_URLS).map(key => MY_CENTER_IMAGE_URLS[key]))
			},
			cacheMyCenterImage(key, imageUrl) {
				if (myCenterImageDownloading[imageUrl]) return
				myCenterImageDownloading[imageUrl] = true
				uni.downloadFile({
					url: imageUrl,
					success: (downloadRes) => {
						if (downloadRes.statusCode !== 200 || !downloadRes.tempFilePath) {
							this.$set(this.myCenterImages, key, imageUrl)
							delete myCenterImageDownloading[imageUrl]
							return
						}
						uni.saveFile({
							tempFilePath: downloadRes.tempFilePath,
							success: (saveRes) => {
								const cache = this.getMyCenterImageCache()
								const oldCacheItem = cache[imageUrl]
								if (oldCacheItem && oldCacheItem.path && oldCacheItem.path !== saveRes.savedFilePath) {
									uni.removeSavedFile({
										filePath: oldCacheItem.path,
										fail: () => {}
									})
								}
								cache[imageUrl] = {
									path: saveRes.savedFilePath,
									savedAt: Date.now()
								}
								this.saveMyCenterImageCache(cache)
								this.$set(this.myCenterImages, key, saveRes.savedFilePath)
							},
							fail: () => {
								this.$set(this.myCenterImages, key, imageUrl)
							},
							complete: () => {
								delete myCenterImageDownloading[imageUrl]
							}
						})
					},
					fail: () => {
						this.$set(this.myCenterImages, key, imageUrl)
						delete myCenterImageDownloading[imageUrl]
					},
					complete: (downloadRes) => {
						if (!downloadRes || downloadRes.statusCode !== 200) {
							this.$set(this.myCenterImages, key, imageUrl)
							delete myCenterImageDownloading[imageUrl]
						}
					}
				})
			},
			pruneMyCenterImageCache(cache, activeUrls) {
				const activeUrlMap = activeUrls.reduce((result, url) => {
					result[url] = true
					return result
				}, {})
				const now = Date.now()
				Object.keys(cache).forEach((url) => {
					const item = cache[url]
					const isExpired = !this.isMyCenterImageCacheValid(item)
					if (isExpired && !activeUrlMap[url]) {
						item && item.path && uni.removeSavedFile({
							filePath: item.path,
							fail: () => {}
						})
						delete cache[url]
					}
				})
				const urls = Object.keys(cache).sort((a, b) => Number(cache[a].savedAt || now) - Number(cache[b].savedAt || now))
				while (urls.length > MY_CENTER_IMAGE_CACHE_LIMIT) {
					const url = urls.shift()
					if (activeUrlMap[url]) {
						urls.push(url)
						if (urls.every(itemUrl => activeUrlMap[itemUrl])) break
						continue
					}
					const item = cache[url]
					item && item.path && uni.removeSavedFile({
						filePath: item.path,
						fail: () => {}
					})
					delete cache[url]
				}
				this.saveMyCenterImageCache(cache)
			},
			setMenuButtonInfo() {
				try {
					if (uni.getMenuButtonBoundingClientRect) {
						this.menuButtonInfo = uni.getMenuButtonBoundingClientRect() || {}
					}
					const sys = uni.getSystemInfoSync ? uni.getSystemInfoSync() : null
					this.statusBarHeight = (sys && sys.statusBarHeight) || 0
				} catch (e) {}
			},
			getArea() {
				try {
					return uni.getStorageSync('area') ? JSON.parse(uni.getStorageSync('area')) : {}
				} catch (e) {
					return {}
				}
			},
			normalizeShopList(list) {
				if (Array.isArray(list)) return list
				if (!list) return []
				if (typeof list == 'string') {
					try {
						const parsed = JSON.parse(list)
						return Array.isArray(parsed) ? parsed : []
					} catch (e) {
						return []
					}
				}
				return typeof list == 'object' ? [list] : []
			},
			showComingSoon(title) {
				this.tui.toast(title + '即将开放')
			},
			formatBadgeCount(count) {
				const num = Number(count) || 0
				return num > 99 ? '99+' : num
			},
			setPendingCounts(counts) {
				this.workerCounts = Number(counts.workerCounts) || 0
				this.shopCounts = Number(counts.shopCounts) || 0
				this.$forceUpdate()
			},
			onRefresh() {
				this.refreshing = true
				Promise.resolve(this.init()).then(() => {
					this.refreshing = false
				}).catch(() => {
					this.refreshing = false
				})
			},
			init() {
				this.applyCachedMyCenterImages()
				this.schoolShop = this.normalizeShopList(uni.getStorageSync('schoolShop'))
				this.worker = uni.getStorageSync('worker')
				let shopId = uni.getStorageSync('shopId')
				let worker = uni.getStorageSync('worker')
				this.workerCounts = 0
				this.shopCounts = 0
				if (worker) {
					this.workerCounts = Number(uni.getStorageSync('workerCounts')) || 0
				}
				if (shopId) {
					this.shopCounts = Number(uni.getStorageSync('shopCounts')) || 0
				}
				this.balance = '0.00'
				const refreshId = ++this.balanceRefreshId
				return this.tui.request("/worker/getAllDepo/", "GET", {
					userId: uni.getStorageSync('id')
				}, false, true).then((res) => {
					if (refreshId != this.balanceRefreshId) return
					if (res.code == 200) {
						let balance = 0
						if (res.result.user) {
							balance += Number(res.result.user.depoBal) || 0
							const savedAmount = Number(res.result.user.savedAmount) || 0
							this.savedMoney = savedAmount.toFixed(2)
							uni.setStorageSync('savedMoney', this.savedMoney)
						}
						if (res.result.worker) {
							balance += Number(res.result.worker.depoBal) || 0
							balance += Number(res.result.worker.depoBalRel) || 0
						}
						if (res.result.shop) {
							for (let i = 0; i < res.result.shop.length; i++) {
								balance += Number(res.result.shop[i].balance) || 0
							}
						}
						this.balance = balance.toFixed(2)
						this.$forceUpdate()
					} else {
						this.tui.toast(res.message)
					}
					uni.hideLoading()
				}).catch((res) => {
					uni.hideLoading()
				})
			},
			clickShop(item) {
				uni.setStorageSync('shopId', item.id)
				uni.setStorageSync('shopName', item.shopName)
				uni.setStorageSync('shopIcon', item.shopIcon)
				uni.setStorageSync('shopScore', item.shopScore)
				uni.setStorageSync('shopTakeaway', item.shopTakeaway)
				uni.setStorageSync('attrId', item.attrId)
				this.$refs.shopPopup.close()
				uni.navigateTo({
					url: '/package2/shop/merchantCenter'
				})
			},
			checkArea() {
				this.tui.request("/app/shopArea/getByParentId/0", "get", {}, false, false).then((res) => {
					if (res.code == 200) {
						this.areaList = res.result
						this.areaKeyword = ''
						this.$refs.areaPopup.open()
					} else {
						this.tui.toast(res.message)
					}
				})
			},
			onClickArea(item) {
				uni.setStorageSync('area', JSON.stringify(item))
				this.areaKeyword = ''
				this.tui.toast('切换成功')
				this.$refs.areaPopup.close()
				this.$forceUpdate()
			},
			navigatorTo(e, index) {
				let url = ""
				if (e == 'addgoods') {
					url = '/package2/myCenter/addGoods'
				} else if (e == 'merchantCenter') {
					this.schoolShop = this.normalizeShopList(this.schoolShop.length ? this.schoolShop : uni.getStorageSync('schoolShop'))
					if (this.schoolShop && this.schoolShop.length) {
						let shopItem = []
						const area = this.getArea()
						for (let aa = 0; aa < this.schoolShop.length; aa++) {
							if (!area.id || this.schoolShop[aa].regionId == area.id) {
								shopItem.push(this.schoolShop[aa])
							}
						}
						this.schoolShop = shopItem
						if (this.schoolShop.length > 1) {
							this.$refs.shopPopup.open()
							return
						} else if (this.schoolShop.length == 1) {
							uni.setStorageSync('shopId', this.schoolShop[0].id)
							uni.setStorageSync('attrId', this.schoolShop[0].attrId)
							uni.setStorageSync('shopName', this.schoolShop[0].shopName)
							uni.setStorageSync('shopIcon', this.schoolShop[0].shopIcon)
							uni.setStorageSync('shopScore', this.schoolShop[0].shopScore)
							uni.setStorageSync('shopTakeaway', this.schoolShop[0].shopTakeaway)
							url = '/package2/shop/merchantCenter'
						}
					} else {
						uni.showModal({
							title: '提示',
							content: '您还没有注册成为商家，要去注册吗？',
							cancelText: '暂时不了',
							confirmText: '去注册',
							success: function(res) {
								if (res.confirm) {
									uni.navigateTo({
										url: '/package2/shop/merchantRegister'
									})
								}
							}
						})
						return
					}
				} else if (e == 'dingdan') {
					url = '/package1/order/orderList'
				} else if (e == 'groupPending') {
					url = '/package2/group/groupPendingList'
				} else if (e == 'addType') {
					url = '/package2/myCenter/addType'
				} else if (e == 'qianbao') {
					url = '/package2/myCenter/wallet'
				} else if (e == 'youhui') {
					url = '/package2/myCenter/couponList'
				} else if (e == 'goodsList') {
					url = '/package2/myCenter/goodsList'
				} else if (e == 'merchant') {
					url = '/package2/shop/merchantRegister'
				} else if (e == 'tuichu') {
					uni.clearStorageSync()
					uni.reLaunch({
						url: '/package2/login/login'
					})
					return
				} else if (e == 'qiehuan') {
					this.checkArea()
					return
				} else if (e == 'address') {
					url = '/package1/address/addressPage'
				} else if (e == 'collect') {
					url = '/package2/myCenter/problemFeedback'
				} else if (e == 'evaluate') {
					this.showComingSoon('我的评价')
					return
				} else if (e == 'feedback') {
					this.showComingSoon('意见反馈')
					return
				} else if (e == 'blindBox') {
					this.showComingSoon('星球券')
					return
				} else if (e == 'fishRelease') {
					url = '/package1/tabbar/release'
				} else if (e == 'myPost') {
					url = '/package2/myCenter/myPost'
				} else if (e == 'idleTrad') {
					url = '/package2/IdleTrad/detail'
				} else if (e == 'agent') {
					this.showComingSoon('成为代理')
					return
				} else if (e == 'ie') {
					url = '/package1/ieBrowser/index'
				} else if (e == 'planet') {
					url = '/package1/planet/index'
				}  else if (e == 'planetPK') {
					url = '/package1/planet/adventure'
				} else if (e == 'deliveryRank') {
					url = '/package2/shop/ranking'
				} else if (e == 'shopData') {
					url = '/package2/myCenter/dataStatistics'
				} else if (e == 'jianzhichaping') {
					let item = {
						shopScore: uni.getStorageSync('worker').score,
						id: uni.getStorageSync('worker').workerId
					}
					url = '/package2/group/shopEvaluate?item=' + JSON.stringify(item) + '&isMerchant=2&isCha=' + (index ==
						'cha' ? 1 : 0)
				} else if (e == 'partTimeReg') {
					let worker = uni.getStorageSync('worker')
					let that = this
					if (worker == undefined || worker == '' || worker == null) {
						const area = this.getArea()
						that.tui.request("/worker/admin/add", "POST", {
							userId: uni.getStorageSync('id'),
							isChangeArea: 1,
							region: area.id
						}, false, true).then((res) => {
							if (res.code == 200) {
								if (res.result != null) {
									uni.setStorageSync('worker', res.result)
								}
								this.$refs.jianzhiPopup.close()
								uni.navigateTo({
									url: '/package2/myCenter/partTimeJobRegister'
								})
							} else {
								that.tui.toast(res.message)
								return
							}
							uni.hideLoading()
						}).catch((res) => {})
						return
					} else {
						url = '/package2/myCenter/partTimeJobRegister'
						this.$refs.jianzhiPopup.close()
					}
				} else if (e == 'jianzhizhuce') {
					if (uni.getStorageSync('worker')) {
						url = '/package2/myCenter/partTimeJobRegister'
					} else {
						this.$refs.jianzhiPopup.open()
						return
					}
				} else if (e == 'jianzhizhuye') {
					url = '/package2/partTimeJob/partTimeJobCenter'
				}
				if (!url) return
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style>
	page {
		width: 100%;
		height: 100%;
		font-size: 28rpx;
		background: #F8FCFA;
	}

	.my-page {
		width: 100%;
		height: 100%;
		color: #202124;
		background:
			radial-gradient(circle at 8% 0%, rgba(52, 200, 160, .12) 0, rgba(52, 200, 160, 0) 320rpx),
			radial-gradient(circle at 94% 32%, rgba(255, 166, 61, .1) 0, rgba(255, 166, 61, 0) 360rpx),
			#F8FCFA;
	}

	.my-scroll {
		width: 100%;
		height: 100%;
	}

	.my-content {
		/* 顶部留白由 contentStyle 动态设置（与胶囊平齐） */
		padding: 108rpx 32rpx 300rpx;
		box-sizing: border-box;
	}

	.fade-up {
		opacity: 0;
		transform: translateY(28rpx);
		animation: fadeUp .48s ease forwards;
	}

	.top-zone {
		position: relative;
		z-index: 5;
	}

	.profile-row {
		display: flex;
		align-items: center;
		min-height: 64rpx;
		/* 右侧预留原生胶囊宽度，避免昵称被盖住 */
		padding-right: 210rpx;
	}

	.avatar-card {
		position: relative;
		flex-shrink: 0;
		width: 84rpx;
		height: 84rpx;
		margin-right: 16rpx;
		border-radius: 24rpx;
		background: linear-gradient(145deg, #EAFBF4, #B7F3D5);
		box-shadow: 0 12rpx 40rpx rgba(30, 80, 60, .06);
		overflow: hidden;
	}

	.avatar-img {
		width: 100%;
		height: 100%;
		display: block;
	}

	.level-chip,
	.identity-pill,
	.saved-badge,
	.task-btn,
	.identity-tag {
		border-radius: 999rpx;
	}

	.level-chip {
		position: absolute;
		right: -8rpx;
		bottom: -2rpx;
		height: 32rpx;
		padding: 0 12rpx;
		background: #FFF2D8;
		color: #9A5C11;
		font-size: 22rpx;
		font-weight: 900;
		line-height: 32rpx;
	}

	.profile-main {
		flex: 1;
		min-width: 0;
		text-align: left;
	}

	.name-row {
		display: flex;
		align-items: center;
	}

	.user-name {
		max-width: 230rpx;
		color: #202124;
		font-size: 32rpx;
		font-weight: 900;
		line-height: 36rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.verify-dot {
		width: 18rpx;
		height: 18rpx;
		margin-left: 12rpx;
		border-radius: 50%;
		background: #34C8A0;
		box-shadow: inset 0 0 0 4rpx rgba(255, 255, 255, .68);
	}

	.school-row {
		display: inline-flex;
		align-items: center;
		margin-top: 2rpx;
		color: #70757A;
		font-size: 22rpx;
		line-height: 24rpx;
	}

	.identity-pill {
		display: inline-flex;
		height: 30rpx;
		margin-top: 4rpx;
		padding: 0 14rpx;
		align-items: center;
		background: rgba(52, 200, 160, .12);
		color: #34C8A0;
		font-size: 22rpx;
		font-weight: 900;
		line-height: 30rpx;
	}

	.ticket-card {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 166rpx;
		height: 64rpx;
		margin: 16rpx 0 0 auto;
		padding: 8rpx 14rpx;
		border-radius: 24rpx;
		background: rgba(255, 255, 255, .72);
		box-shadow: 0 12rpx 40rpx rgba(30, 80, 60, .06);
		box-sizing: border-box;
		transition: transform .16s ease;
	}

	.ticket-label {
		color: #34C8A0;
		font-size: 22rpx;
		font-weight: 900;
		line-height: 26rpx;
	}

	.ticket-value {
		margin-top: 4rpx;
		color: #202124;
		font-size: 28rpx;
		font-weight: 900;
		line-height: 32rpx;
	}

	.ticket-icon {
		width: 42rpx;
		height: 42rpx;
	}

	.saving-hero,
	.section-card,
	.quick-card,
	.logout-btn,
	.shop-content,
	.popup-area-content {
		margin-top: 28rpx;
		border-radius: 32rpx;
		box-shadow: 0 12rpx 40rpx rgba(30, 80, 60, .06);
		box-sizing: border-box;
	}

	.saving-hero {
		position: relative;
		height: 278rpx;
		padding: 24rpx;
		/* 不裁切：插画顶部的星球要探出卡片外 */
		overflow: visible;
		background: linear-gradient(135deg, rgba(227, 255, 243, .96), rgba(244, 255, 250, .88) 48%, rgba(255, 244, 224, .8));
		transition: transform .16s ease;
	}

	.saving-bg {
		position: absolute;
		left: 0;
		bottom: 0;
		width: 100%;
		/* 图片原始比例 792x382，686rpx 宽对应 331rpx 高，写死避免安卓 widthFix 计算异常 */
		height: 331rpx;
		z-index: 0;
	}

	.saved-badge {
		position: relative;
		z-index: 2;
		display: inline-flex;
		height: 44rpx;
		padding: 0 18rpx;
		align-items: center;
		background: rgba(255, 255, 255, .72);
		color: #202124;
		font-size: 22rpx;
		font-weight: 900;
	}

	.saved-main {
		position: relative;
		z-index: 2;
		margin-top: 8rpx;
		text-align: left;
	}

	.saved-money {
		color: #10231E;
		font-size: 96rpx;
		font-weight: 900;
		line-height: 104rpx;
		letter-spacing: -4rpx;
	}

	.saved-desc,
	.saved-week {
		color: #34C8A0;
		font-size: 22rpx;
		font-weight: 900;
		line-height: 30rpx;
	}

	.saved-week {
		margin-top: 4rpx;
		color: #70757A;
	}

	.section-card {
		padding: 28rpx 24rpx;
		background: rgba(255, 255, 255, .9);
	}

	.earn-section,
	.identity-section {
		padding-top: 20rpx;
		padding-bottom: 18rpx;
	}

	.section-head {
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
		gap: 24rpx;
		margin-bottom: 20rpx;
	}

	.earn-section .section-head,
	.identity-section .section-head {
		margin-bottom: 8rpx;
	}

	.section-head--inline {
		align-items: center;
	}

	.head-inline {
		display: flex;
		align-items: baseline;
		min-width: 0;
	}

	.head-sub {
		margin-left: 16rpx;
		color: #9AA0A6;
		font-size: 22rpx;
		font-weight: 400;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.section-title {
		display: flex;
		align-items: center;
		color: #202124;
		font-size: 32rpx;
		font-weight: 900;
		line-height: 44rpx;
		text-align: left;
	}

	.head-main {
		display: flex;
		align-items: center;
		min-width: 0;
	}

	.title-icon {
		flex-shrink: 0;
		width: 110rpx;
		height: 110rpx;
		/* 原图四周有大片透明边距，用负 margin 裁掉：视觉上图标约 45rpx、贴左、行高与标题一致 */
		margin: -28rpx -16rpx -26rpx -34rpx;
	}

	.section-desc {
		margin-top: 4rpx;
		color: #70757A;
		font-size: 22rpx;
		line-height: 30rpx;
		text-align: left;
	}

	.text-link {
		flex-shrink: 0;
		color: #34C8A0;
		font-size: 22rpx;
		font-weight: 900;
		line-height: 36rpx;
	}

	.task-row {
		display: flex;
		gap: 16rpx;
	}

	.task-card {
		flex: 1;
		min-width: 0;
		padding: 12rpx 10rpx 8rpx;
		border-radius: 24rpx;
		box-sizing: border-box;
		text-align: center;
		transition: transform .16s ease;
	}

	.task-card--group {
		background: linear-gradient(180deg, #F1FEF8, #E0F8EC);
	}

	.task-card--cash {
		background: linear-gradient(180deg, #FFF4E6, #FFEBD4);
	}

	.task-card--school {
		background: linear-gradient(180deg, #EAF6FF, #DCEEFF);
	}

	.task-card--wallet {
		background: linear-gradient(180deg, #FFF4DE, #FFEAC4);
	}

	.task-title {
		color: #202124;
		font-size: 26rpx;
		font-weight: 900;
		margin-bottom: 6rpx;
		line-height: 30rpx;
		white-space: nowrap;
	}

	.task-card--cash .task-title {
		color: #FF5A2C;
	}

	.task-card--school .task-title {
		color: #3D7FFF;
	}

	.task-card--wallet .task-title {
		color: #FF9500;
	}

	.task-sub {
		margin-top: 0;
		color: #70757A;
		font-size: 20rpx;
		line-height: 24rpx;
		white-space: nowrap;
	}

	.task-sub-em {
		font-weight: 900;
	}

	.task-card--group .task-sub-em {
		color: #34C8A0;
	}

	.task-card--cash .task-sub {
		color: #FF7A3D;
	}

	.task-card--cash .task-sub-em {
		color: #FF7A3D;
	}

	.task-card--school .task-sub-em {
		color: #4A9FFF;
	}

	.task-card--wallet .task-sub-em {
		color: #FFA63D;
	}

	.task-visual {
		display: flex;
		justify-content: center;
		margin-top: 0;
	}

	.task-asset,
	.identity-icon,
	.quick-icon,
	.life-asset {
		display: block;
	}

	.task-asset {
		width: 96rpx;
		height: 96rpx;
	}

	.task-btn {
		height: 52rpx;
		margin: 0 6rpx;
		background: #34C8A0;
		color: #FFFFFF;
		font-size: 24rpx;
		font-weight: 900;
		line-height: 52rpx;
	}

	.task-card--cash .task-btn,
	.task-card--wallet .task-btn {
		background: #FFA63D;
	}

	.task-card--school .task-btn {
		background: #4A9FFF;
	}

	.identity-row {
		display: flex;
		gap: 12rpx;
	}

	.identity-card {
		position: relative;
		flex: 1;
		min-width: 0;
		height: 170rpx;
		padding: 14rpx 10rpx 10rpx;
		border-radius: 24rpx;
		box-sizing: border-box;
		transition: transform .16s ease;
	}

	.identity-card--merchant {
		background: #FBE9E7;
	}

	.identity-card--delivery {
		background: #E3F0FE;
	}

	.identity-card--shop {
		background: #FBEDDF;
	}

	.identity-card--rule {
		background: #E8EDFA;
	}

	.identity-badge {
		position: absolute;
		right: -6rpx;
		top: -10rpx;
		z-index: 2;
		min-width: 34rpx;
		height: 34rpx;
		padding: 0 8rpx;
		border: 3rpx solid #FFFFFF;
		border-radius: 999rpx;
		background: #FF5A4F;
		color: #FFFFFF;
		font-size: 20rpx;
		font-weight: 900;
		line-height: 34rpx;
		text-align: center;
		box-shadow: 0 8rpx 18rpx rgba(255, 90, 79, .28);
		box-sizing: border-box;
	}

	.identity-tag {
		position: absolute;
		right: 8rpx;
		top: -10rpx;
		height: 32rpx;
		padding: 0 12rpx;
		background: #34C8A0;
		color: #FFFFFF;
		font-size: 20rpx;
		font-weight: 900;
		line-height: 36rpx;
		box-shadow: 0 6rpx 16rpx rgba(52, 200, 160, .3);
	}

	.identity-dot {
		position: absolute;
		right: 12rpx;
		top: 12rpx;
		width: 24rpx;
		height: 24rpx;
		border-radius: 50%;
		background: rgba(255, 255, 255, .8);
		box-shadow: inset 0 0 0 6rpx rgba(52, 200, 160, .4);
	}

	.identity-card--merchant .identity-dot,
	.identity-card--shop .identity-dot {
		box-shadow: inset 0 0 0 6rpx rgba(255, 166, 61, .5);
	}

	.identity-title {
		color: #1E8A5E;
		font-size: 26rpx;
		font-weight: 900;
		line-height: 32rpx;
		text-align: left;
		white-space: nowrap;
	}

	.identity-card--merchant .identity-title {
		color: #E5432E;
	}

	.identity-card--delivery .identity-title {
		color: #3D7FFF;
	}

	.identity-card--shop .identity-title {
		color: #E5432E;
	}

	.identity-card--rule .identity-title {
		color: #5B6EE1;
	}

	.identity-desc {
		margin-top: 2rpx;
		width: 116%;
		color: #6FBF97;
		font-size: 20rpx;
		line-height: 26rpx;
		text-align: left;
		white-space: nowrap;
		transform: scale(.86);
		transform-origin: left top;
	}

	.identity-card--merchant .identity-desc {
		color: #E09A66;
	}

	.identity-card--delivery .identity-desc {
		color: #7FA9E8;
	}

	.identity-card--shop .identity-desc {
		color: #E09A66;
	}

	.identity-card--rule .identity-desc {
		color: #8D96D8;
	}

	.identity-foot {
		position: absolute;
		left: 10rpx;
		right: 10rpx;
		display: flex;
		align-items: flex-end;
		justify-content: space-between;
	}

	.identity-icon {
		width: 94rpx;
		height: 94rpx;
	}
	
	.identity-icon--delivery {
		width: 70rpx;
		height: 70rpx;
		margin-top: 8rpx;
	}
	
	.identity-icon--rule {
		width: 94rpx;
		height: 94rpx;
		margin-top: 4rpx;
	}

	.identity-go {
		width: 34rpx;
		height: 34rpx;
		border-radius: 50%;
		background: rgba(255, 255, 255, .9);
		color: #2B3A33;
		font-size: 26rpx;
		font-weight: 900;
		line-height: 31rpx;
		text-align: center;
		box-shadow: 0 6rpx 16rpx rgba(30, 80, 60, .08);
	}

	.quick-card {
		display: flex;
		justify-content: space-between;
		padding: 12rpx 18rpx 8rpx;
		background: rgba(255, 255, 255, .9);
	}

	.quick-item {
		flex: 1;
		min-width: 0;
		text-align: center;
		transition: transform .16s ease;
	}

	.quick-icon-wrap {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 86rpx;
		margin-bottom: 14rpx;
		overflow: visible;
	}

	.quick-icon {
		width: 80rpx;
		height: 80rpx;
		margin: 0 auto;
	}
	
	.quick-icon--address {
		width: 76rpx;
		height: 76rpx;
	}
	
	.quick-icon--collect {
		width: 166rpx;
		padding-left: 16rpx;
		height: 166rpx;
		transform: scale(1.33);
	}
	
	.quick-icon--agent {
		width: 122rpx;
		height: 122rpx;
	}

	.quick-title {
		color: #202124;
		font-size: 24rpx;
		font-weight: 900;
		line-height: 32rpx;
		white-space: nowrap;
	}

	.quick-tip {
		margin-top: 6rpx;
		color: #70757A;
		font-size: 20rpx;
		line-height: 26rpx;
		white-space: nowrap;
	}

	.quick-tip--order {
		color: #34C8A0;
	}

	.quick-tip--wallet {
		color: #4A9FFF;
	}

	.quick-tip--coupon {
		color: #FF6B5A;
	}

	.quick-tip--address {
		color: #8E7CF0;
	}

	.quick-tip--collect {
		color: #FFA63D;
	}

	.life-grid {
		display: grid;
		grid-template-columns: repeat(4, 1fr);
		gap: 14rpx;
	}

	.life-card {
		position: relative;
		height: 188rpx;
		padding: 14rpx 12rpx 10rpx;
		border-radius: 24rpx;
		box-sizing: border-box;
		overflow: hidden;
		transition: transform .16s ease;
	}

	.life-card--ie {
		background: #E8F6EC;
	}

	.life-card--fish {
		background: #E1EFF6;
	}

	.life-card--secret {
		background: #E8EDFA;
	}

	.life-card--agent {
		background: #FBE9E7;
	}

	.life-title {
		color: #202124;
		font-size: 24rpx;
		font-weight: 900;
		line-height: 32rpx;
		text-align: left;
		white-space: nowrap;
	}

	.life-desc {
		margin-top: 2rpx;
		/* 占位宽度放大到 1/0.76，配合缩放后正好铺满卡片宽度，安卓上不再被截断 */
		width: 131%;
		color: #8A9199;
		font-size: 20rpx;
		line-height: 26rpx;
		text-align: left;
		white-space: nowrap;
		transform: scale(.76);
		transform-origin: left top;
	}

	.life-visual {
		position: absolute;
		left: 2rpx;
		right: 10rpx;
		/* bottom: 10rpx; */
		display: flex;
		align-items: flex-end;
		justify-content: space-between;
	}

	.life-asset {
		/* 图标框不能超过卡片宽度（约157rpx），否则 aspectFit 会把画面裁到卡片外 */
		flex-shrink: 0;
		width: 124rpx;
		height: 124rpx;
	}

	.life-go {
		flex-shrink: 0;
		width: 34rpx;
		height: 34rpx;
		margin-bottom: 2rpx;
		border-radius: 50%;
		background: rgba(255, 255, 255, .92);
		color: #2B3A33;
		font-size: 26rpx;
		font-weight: 900;
		line-height: 31rpx;
		text-align: center;
		box-shadow: 0 6rpx 16rpx rgba(30, 80, 60, .08);
	}

	.logout-btn {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 88rpx;
		border-radius: 999rpx;
		background: #FFFFFF;
		color: #FF4D4D;
		font-size: 28rpx;
		font-weight: 900;
		line-height: 88rpx;
		transition: transform .16s ease;
	}

	.logout-power {
		position: relative;
		width: 26rpx;
		height: 26rpx;
		margin-right: 12rpx;
		border-radius: 50%;
		box-shadow: inset 0 0 0 4rpx #FF4D4D;
	}

	.logout-power:before {
		content: '';
		position: absolute;
		left: 11rpx;
		top: -4rpx;
		width: 4rpx;
		height: 16rpx;
		border-radius: 999rpx;
		background: #FF4D4D;
	}

	.tap-soft,
	.logout-active {
		transform: scale(.98);
	}

	.jianzhi-content {
		width: 300px;
		height: 350px;
		position: relative;
	}

	.shop-content,
	.popup-area-content {
		width: 600rpx;
		padding: 24rpx;
		background: rgba(255, 255, 255, .92);
	}

	.popup-pay-title,
	.popup-area-title {
		margin-bottom: 24rpx;
		color: #202124;
		font-size: 36rpx;
		font-weight: 900;
		text-align: left;
	}

	.popup-list,
	.popup-area-container {
		min-height: 88rpx;
		margin-top: 16rpx;
		padding: 0 24rpx;
		border-radius: 24rpx;
		background: #F8FCFA;
		color: #202124;
		font-size: 28rpx;
		font-weight: 900;
		line-height: 88rpx;
		text-align: left;
		box-shadow: 0 12rpx 40rpx rgba(30, 80, 60, .06);
		box-sizing: border-box;
	}

	.campus-area-popup {
		position: relative;
		box-sizing: border-box;
		width: 650rpx;
		min-height: 620rpx;
		max-height: 78vh;
		overflow: hidden;
		padding: 38rpx 30rpx 30rpx;
		border: 1rpx solid rgba(255, 255, 255, .78);
		border-radius: 42rpx;
		background:
			radial-gradient(circle at 16% 8%, rgba(227, 255, 150, .34), rgba(227, 255, 150, 0) 220rpx),
			radial-gradient(circle at 92% 18%, rgba(166, 255, 234, .44), rgba(166, 255, 234, 0) 260rpx),
			rgba(255, 255, 255, .92);
		box-shadow: 0 30rpx 86rpx rgba(7, 61, 51, .18);
		backdrop-filter: blur(24rpx);
	}

	.area-popup-glow {
		position: absolute;
		border-radius: 999rpx;
		pointer-events: none;
	}

	.area-popup-glow-a {
		top: -82rpx;
		right: -68rpx;
		width: 230rpx;
		height: 230rpx;
		background: rgba(166, 255, 234, .46);
		filter: blur(10rpx);
	}

	.area-popup-glow-b {
		left: -56rpx;
		bottom: 82rpx;
		width: 180rpx;
		height: 180rpx;
		background: rgba(227, 255, 150, .34);
		filter: blur(14rpx);
	}

	.campus-area-header {
		position: relative;
		z-index: 1;
		text-align: center;
	}

	.campus-area-kicker {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		height: 44rpx;
		padding: 0 22rpx;
		border: 1rpx solid rgba(255, 255, 255, .82);
		border-radius: 999rpx;
		background: linear-gradient(90deg, rgba(227, 255, 150, .72), rgba(166, 255, 234, .72));
		box-shadow: 0 10rpx 26rpx rgba(13, 114, 82, .1);
		color: #073D33;
		font-size: 22rpx;
		font-weight: 700;
	}

	.campus-area-title {
		margin-top: 22rpx;
		color: #073D33;
		font-size: 38rpx;
		font-weight: 900;
		line-height: 1.25;
	}

	.campus-area-subtitle {
		width: 500rpx;
		margin: 12rpx auto 0;
		color: rgba(7, 61, 51, .52);
		font-size: 23rpx;
		line-height: 1.5;
	}

	.campus-area-search {
		position: relative;
		z-index: 1;
		display: flex;
		align-items: center;
		height: 82rpx;
		margin-top: 30rpx;
		padding: 0 26rpx;
		border: 1rpx solid rgba(7, 61, 51, .06);
		border-radius: 999rpx;
		background: rgba(255, 255, 255, .72);
		box-shadow: inset 0 1rpx 0 rgba(255, 255, 255, .92), 0 14rpx 34rpx rgba(7, 61, 51, .08);
	}

	.area-search-icon {
		margin-right: 14rpx;
		color: rgba(7, 61, 51, .5);
		font-size: 34rpx;
		font-weight: 700;
	}

	.campus-area-search input {
		flex: 1;
		height: 82rpx;
		color: #073D33;
		font-size: 27rpx;
	}

	.area-search-placeholder {
		color: rgba(7, 61, 51, .34);
	}

	.campus-area-list {
		position: relative;
		z-index: 1;
		height: 360rpx;
		max-height: 610rpx;
		margin-top: 24rpx;
	}

	.campus-area-item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		min-height: 92rpx;
		margin-bottom: 16rpx;
		padding: 0 18rpx 0 24rpx;
		border: 1rpx solid rgba(255, 255, 255, .78);
		border-radius: 28rpx;
		background: rgba(255, 255, 255, .66);
		box-shadow: 0 12rpx 30rpx rgba(7, 61, 51, .07);
		color: #073D33;
	}

	.campus-area-item:active {
		transform: scale(.985);
		opacity: .9;
	}

	.area-item-main {
		display: flex;
		align-items: center;
		min-width: 0;
		font-size: 28rpx;
		font-weight: 800;
	}

	.area-item-main text {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.area-item-dot {
		flex-shrink: 0;
		width: 16rpx;
		height: 16rpx;
		margin-right: 16rpx;
		border-radius: 50%;
		background: linear-gradient(135deg, #E3FF96, #A6FFEA);
		box-shadow: 0 0 18rpx rgba(13, 114, 82, .22);
	}

	.area-item-action {
		flex-shrink: 0;
		height: 50rpx;
		margin-left: 18rpx;
		padding: 0 22rpx;
		border-radius: 999rpx;
		background: linear-gradient(90deg, rgba(227, 255, 150, .95), rgba(166, 255, 234, .95));
		box-shadow: 0 10rpx 24rpx rgba(13, 114, 82, .14), 0 0 22rpx rgba(166, 255, 234, .42);
		color: #073D33;
		font-size: 22rpx;
		font-weight: 900;
		line-height: 50rpx;
	}

	.campus-area-empty {
		padding: 70rpx 0 56rpx;
		text-align: center;
	}

	.area-empty-title {
		color: #073D33;
		font-size: 28rpx;
		font-weight: 800;
	}

	.area-empty-desc {
		margin-top: 12rpx;
		color: rgba(7, 61, 51, .45);
		font-size: 23rpx;
	}

	@keyframes fadeUp {
		from {
			opacity: 0;
			transform: translateY(28rpx);
		}

		to {
			opacity: 1;
			transform: translateY(0);
		}
	}

	@keyframes moneyRoll {
		0% {
			opacity: 0;
			transform: translateY(24rpx) scale(.96);
		}

		70% {
			opacity: 1;
			transform: translateY(-4rpx) scale(1.02);
		}

		100% {
			opacity: 1;
			transform: translateY(0) scale(1);
		}
	}
</style>
