<template>
	<view class="customer-service">
		
		<navbar leftClick @leftClick="$utils.navigateBack" title="客服中心" />
        
		<view class="content">
			<!-- 客服介绍 -->
			<view class="intro">
				<view class="title">我们为您提供贴心服务</view>
				<view class="desc">如有任何问题，请随时联系我们的客服团队</view>
			</view>
			
			<!-- 客服列表 -->
			<view class="service-list">
				<view 
					class="service-item" 
					v-for="(item, index) in list" 
					:key="index"
					@click="showQRCode(item)"
				>
					<image class="avatar" :src="item.headImage" mode="aspectFill"></image>
					<view class="info">
						<view class="name">{{ item.nickName }}</view>
						<view class="contact">{{ item.phone }}</view>
					</view>
					<uv-icon name="arrow-right" 
					v-if="item.wxCode"
					size="24rpx" color="#999"></uv-icon>
				</view>
			</view>
			
		</view>
		
		<!-- 微信二维码弹窗 -->
		<uv-popup ref="qrPopup" :round="20" bgColor="#fff">
			<view class="qr-popup">
				<view class="qr-header">
					<view class="title">{{ currentService.nickName }}</view>
					<view class="subtitle">扫码添加微信</view>
				</view>
				<view class="qr-content">
					<image class="qr-code" :src="currentService.wxCode" mode="aspectFit"></image>
					<view class="qr-tips">长按保存二维码，微信扫码添加</view>
				</view>
				<view class="qr-actions">
					<uv-button type="primary" @click="$refs.qrPopup.close()">知道了</uv-button>
				</view>
			</view>
		</uv-popup>
	</view>
</template>

<script>
import mixinsList from '@/mixins/list.js'
export default {
	mixins: [mixinsList],
	data() {
		return {
			mixinsListApi: 'getMyService',
			currentService: {},
		}
	},
	methods: {
		// 显示二维码弹窗
		showQRCode(service) {
			if(service.wxCode){
				this.currentService = service
				this.$refs.qrPopup.open('center')
			}
		}
	}
}
</script>

<style scoped lang="scss">
.customer-service {
	background-color: #f5f5f5;
	min-height: 100vh;
	
	.content {
		padding: 20rpx;
	}
	
	.intro {
		background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
		padding: 40rpx;
		border-radius: 20rpx;
		margin-bottom: 30rpx;
		
		.title {
			color: #fff;
			font-size: 36rpx;
			font-weight: bold;
			margin-bottom: 10rpx;
		}
		
		.desc {
			color: rgba(255, 255, 255, 0.8);
			font-size: 28rpx;
		}
	}
	
	.service-list {
		background-color: #fff;
		border-radius: 20rpx;
		padding: 20rpx;
		margin-bottom: 30rpx;
		
		.service-item {
			display: flex;
			align-items: center;
			padding: 30rpx 20rpx;
			border-bottom: 1rpx solid #f0f0f0;
			
			&:last-child {
				border-bottom: none;
			}
			
			.avatar {
				width: 80rpx;
				height: 80rpx;
				border-radius: 50%;
				margin-right: 20rpx;
			}
			
			.info {
				flex: 1;
				
				.name {
					font-size: 32rpx;
					font-weight: bold;
					color: #333;
					margin-bottom: 8rpx;
				}
				
				.contact {
					font-size: 26rpx;
					color: #666;
				}
			}
		}
	}
	
	.qr-popup {
		padding: 40rpx;
		text-align: center;
		width: 600rpx;
		
		.qr-header {
			margin-bottom: 30rpx;
			
			.title {
				font-size: 36rpx;
				font-weight: bold;
				color: #333;
				margin-bottom: 10rpx;
			}
			
			.subtitle {
				font-size: 28rpx;
				color: #666;
			}
		}
		
		.qr-content {
			margin-bottom: 30rpx;
			
			.qr-code {
				width: 400rpx;
				height: 400rpx;
				border-radius: 20rpx;
				margin-bottom: 20rpx;
			}
			
			.qr-tips {
				font-size: 24rpx;
				color: #999;
				line-height: 1.5;
			}
		}
		
		.qr-actions {
			display: flex;
			justify-content: center;
		}
	}
}
</style> 