<template>
	<view class="main-content">
		<view class="title">请选择您的知识店铺</view>
		<view v-if="hasShop" class="shop-card">
			<view class="shop-info" @click="jump()">
				<image class="shop-icon" src="/static/shop.png" />
				<view class="shop-name">知识店铺_WVV350567 <text class="shop-tag">试用版</text></view>
				<view class="shop-status">最近访问</view>
			</view>
			<view class="shop-detail">
				<view>试用期至：2025-05-10（已过期）</view>
				<view>访问身份：创建者</view>
			</view>
		</view>
		<view v-else class="no-shop">
			<image class="no-shop-img" src="/static/no_shop.png" />
			<view class="no-shop-text">暂无知识店铺，请创建</view>
		</view>
		<button class="create-btn" @click="goToShopHome">创建知识店铺</button>
		<view class="kefu-btn" @click="onKefu">
			<image class="kefu-img" src="/static/kefu.png" />
			<text>开店咨询</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				hasShop: true // 模拟有无店铺
			}
		},
		onLoad() {

		},
		methods: {
			jump(){
				console.log("123123")
				wx.navigateToMiniProgram({
						  appId: 'wx3d250e9c83ec74ee', // 必填，未发布小程序的AppID（开发版/体验版均可）
						  path: 'pages/index/index', // 选填，如：'pages/index/index'
						  envVersion: 'develop', // 选填，指定跳转环境：develop（开发版）、trial（体验版）、release（正式版），未发布时用'develop'
						  success(res) {
						    // 跳转成功回调
						  },
						  fail(res) {
						    // 跳转失败回调（常见原因：AppID错误、未关联、环境不正确）
						  }
				});
			},
			goToShopHome() {
				// 跳转到店铺首页
				uni.switchTab({
					url: '/pages/index/shopHome',
					
				})
			},
			onKefu() {
				uni.showToast({ title: '客服功能待接入', icon: 'none' })
			}
		}
	}
</script>

<style>
	.main-content {
		padding: 40rpx 30rpx 120rpx 30rpx;
	}

	.title {
		font-size: 44rpx;
		font-weight: bold;
		margin-bottom: 40rpx;
	}

	.shop-card {
		background: #f8fafd;
		border-radius: 20rpx;
		padding: 36rpx 30rpx;
		margin-bottom: 40rpx;
		box-shadow: 0 2rpx 8rpx #f0f1f2;
	}

	.shop-info {
		display: flex;
		align-items: center;
		margin-bottom: 16rpx;
	}

	.shop-icon {
		width: 60rpx;
		height: 60rpx;
		margin-right: 20rpx;
	}

	.shop-name {
		font-size: 32rpx;
		font-weight: 500;
		margin-right: 16rpx;
	}

	.shop-tag {
		font-size: 22rpx;
		color: #fff;
		background: #b3c6ff;
		border-radius: 8rpx;
		padding: 2rpx 10rpx;
		margin-left: 8rpx;
	}

	.shop-status {
		margin-left: auto;
		color: #b3b3b3;
		font-size: 26rpx;
	}

	.shop-detail {
		color: #888;
		font-size: 26rpx;
	}

	.no-shop {
		display: flex;
		flex-direction: column;
		align-items: center;
		margin-bottom: 40rpx;
	}

	.no-shop-img {
		width: 180rpx;
		height: 180rpx;
		margin-bottom: 20rpx;
	}

	.no-shop-text {
		color: #b3b3b3;
		font-size: 30rpx;
	}

	.create-btn {
		width: 90%;
		margin: 0 auto 40rpx auto;
		background: #1880ff;
		color: #fff;
		font-size: 36rpx;
		border-radius: 50rpx;
		height: 90rpx;
		line-height: 90rpx;
	}

	.kefu-btn {
		position: fixed;
		right: 40rpx;
		bottom: 180rpx;
		display: flex;
		align-items: center;
		background: #eaf3ff;
		border-radius: 50rpx;
		padding: 10rpx 30rpx;
		box-shadow: 0 2rpx 8rpx #eaf3ff;
	}

	.kefu-img {
		width: 60rpx;
		height: 60rpx;
		margin-right: 10rpx;
	}
</style>
