<template>
	<view>
		<view class="nav_area"></view>
		<view v-for="(item,index) in serviceList" :key="index" class="record-item">
			<view class="line1">
				<image src="../../static/user/icon_manager2.png" mode=""></image>
				<view class="">客服名：<text style="color:#101010;">{{item.name}}</text></view>
			</view>
			<view class="line2">微信号码：<text style="color:#101010;">{{item.wx_number}}</text></view>
			<view class="btn" @click="copyNum(item.wx_number)">复制联系方式</view>
		</view>
		<view class="" v-if="serviceList.length===0" style="color: #999;text-align: center;padding: 40rpx;">
			- 暂无记录 -
		</view>
	</view>
</template>

<script>
	import API from '@/common/js/api.js'
	export default {
		data() {
			return {
				serviceList:[
					
				],
				page: 1,
				noMore: true,
			}
		},
		onLoad(e) {
			this.getList();
		},
		methods: {
			copyNum(num){
				uni.setClipboardData({
					data: num,
					success() {
						uni.showToast({
							title: '复制成功'
						})
					}
				})
			},
			getList(){
				let url = '';
				if(uni.getStorageSync('userType')=='user'){
					url = '/user/getCustomerServiceList'
				}
				if(uni.getStorageSync('userType')=='agent'){
					url = '/agentTeam/getCustomerServiceList'
				}
				API.request(url, {}, res=>{
					let list = res.data.list;
					if(this.page===1){
						list.length>0 ? this.noMore=false : false;
						this.serviceList = list;
					}else{
						if(res.data.list.length==0){
							uni.showToast({
								title: '没有更多了',
								icon: 'none'
							})
							this.noMore = true;
						}
						this.serviceList = this.serviceList.concat(list)
					}
				})
			},
			
		},
		onReachBottom() {
			if(this.noMore) return;
			this.page++;
			this.getList();
		}
	}
</script>

<style scoped lang="scss">
	.nav_area {
		position: fixed;
		top: 0px;
		left: 0px;
		z-index: 99;
		background-color: #fff;
		box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.05);
		width: 700rpx;
		height: 88rpx;
		padding: 0px 25rpx;
		padding-top: var(--status-bar-height);
		box-sizing: content-box;
		color: #b0b0b0;
		font-size: 14px;
	
	}
	.record-item{
		padding: 80rpx 88rpx 0px;
		
		.line1{
			width: 100%;
			display: flex;
			color: #999;
			
			image{
				width: 40rpx;
				height: 40rpx;
				margin-right: 20rpx;
			}
		}
		.line2{
			width: 100%;
			padding-left: 60rpx;
			color: #999;
			margin-top: 10px;
		}
		.btn{
			width: 226rpx;
			height: 68rpx;
			line-height: 68rpx;
			border: 1px solid #d6e6ff;
			border-radius: 10px;
			font-size: 12px;
			text-align: center;
			color: #6DA6FF;
			margin: 40rpx auto 0px;
		}
	}
	
</style>
