<template>
	<view class="page">
		<u-navbar title="客服列表" :border-bottom="false" :background="bgc" back-icon-color="#262B37" title-color='#262B37'
			title-size='36' height='46' id="navbar">
		</u-navbar>
        <view class="list">
        	<view class="list_item" v-for="(item,index) in kflist" :key="index">
        		<view class="top">
        			<view class="lt">
        				<image src="https://api.ccttiot.com/smartmeter/img/static/uVYKYUpBvTIv9Nu3nTL8" mode=""></image> {{item.name}} 
        			</view>
					<view class="rt" @click="btntel(item)">
						拨打电话
					</view>
        		</view>
				<view class="tel">
					<image src="https://api.ccttiot.com/smartmeter/img/static/uvuNCHW6DSkCDfYZ4wEX" mode=""></image> 客服电话：<text>{{item.contact}}</text>
				</view>
				<view class="tel">
					<image src="https://api.ccttiot.com/smartmeter/img/static/uahndvMg4kjVZlkFLJwp" mode=""></image> 工作时间：<text>{{item.startTime}}-{{item.endTime}}</text>
				</view>
				<view class="tishi">
					<text>温馨提示：</text> 非工作时间段，无人接听，感谢您的谅解~
				</view>
        	</view>
        </view>


	</view>
</template>

<script>
	export default {
		data() {
			return {
                bgc: {
                	backgroundColor: "#fff",
                },
				kflist:[],
			}
		},
		onLoad() {
            this.getlist()
		},
		methods: {
			// 获取所有的客服
			getlist(){
				this.$u.get(`/app/customerService/list?pageNum=1&pageSize=999`).then(res =>{
					if(res.code == 200){
					    this.kflist = res.rows
					}
				})
			},
			// 点击拨打电话
			btntel(item){
				uni.makePhoneCall({
					phoneNumber: item.contact,
					success: function(res) {
						console.log('拨打电话成功', res)
					},
					fail: function(err) {
						console.error('拨打电话失败', err)
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	::v-deep .u-icon__icon,
	::v-deep .u-title{
		padding-bottom: 22rpx !important;
	}
	page {
		background: #F6F6F6;
	}
    .list{
		margin-top: 22rpx;
		.list_item{
			width: 680rpx;
			height: 308rpx;
			background: #FFFFFF;
			border-radius: 14rpx 14rpx 14rpx 14rpx;
			margin: auto;
			padding: 34rpx 36rpx;
			box-sizing: border-box;
			margin-top: 20rpx;
			.top{
				display: flex;
				justify-content: space-between;
				align-items: center;
				.lt{
					font-size: 32rpx;
					color: #3D3D3D;
					display: flex;
					align-items: center;
					image{
						width: 70rpx;
						height: 70rpx;
						margin-right: 14rpx;
					}
				}
				.rt{
					width: 180rpx;
					height: 54rpx;
					border-radius: 27rpx 27rpx 27rpx 27rpx;
					border: 1rpx solid #1EC28B;
					font-size: 28rpx;
					color: #1EC28B;
					text-align: center;
					line-height: 54rpx;
				}
			}
			.tishi{
				font-size: 24rpx;
				color: #606060;
				margin-top: 26rpx;
				text{
					color: #1EC28B;
				}
			}
			.tel{
				color: #808080;
				font-size: 26rpx;
				display: flex;
				align-items: center;
				margin-top: 18rpx;
				text{
					color: #3D3D3D;
				}
				image{
					width: 28rpx;
					height: 28rpx;
					margin-right: 16rpx;
				}
			}
		}
	}
</style>