<template>
	<view class="content">
		<view class="cellModel" v-for="(item,index) in  pageList" :key="index">
			{{item.title}}：{{item.contact}}
			<view class="iconBtn-icon" v-show="item.is_type == 1" @click="copyCode(item.contact)">
				<image class="init_image" src="http://amy.yyinhong.cn/uploads/wximg/fz.png" mode=""></image>
			</view>
			<view class="iconBtn-icon" v-show="item.is_type != 1" @click="call(item.contact)">
				<image class="init_image" src="http://amy.yyinhong.cn/uploads/wximg/phone.png" mode=""></image>
			</view>
		</view>
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageList: []
			}
		},
		onShow() {
			this.getKefuLsit()
		},
		methods: {
			scrolltolower() {},
			//获取客服列表
			getKefuLsit(e) {
				this.$request('/get-kefu-list', 'GET', {}).then(res => {
					console.log(res.data)
					this.pageList = res.data;
				}).catch(err => {
					uni.showToast({

						icon: 'error',

						title: '' + err.message

					})
				})
			},
			//复制核销码
			copyCode(Code) {
				uni.setClipboardData({
					data: Code
				})
			},
			call(phone) {
				uni.makePhoneCall({
					phoneNumber: phone,
					success() {},
					fail() {}
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 100vw;
		height: 100vh;
		background: #F7F8FA;
	}

	.cellModel {
		width: calc(100% - 120rpx);
		padding: 30rpx;
		margin: 30rpx;
		margin-bottom: 0;
		font-size: 30rpx;
		color: #333333;
		height: 44rpx;
		line-height: 44rpx;
		background-color: #ffffff;
		border-radius: 20rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
	}

	.iconBtn-icon {
		height: 36rpx;
		width: 36rpx;
		margin-left: 20rpx;
	}
</style>