<template>
	<view class="content">
		<view class="info-detail" v-if="item!=null" >
			<view class="item">
				<text class="label">客户姓名</text>
				<text class="text">{{item.customerName}}</text>
			</view>
			<view class="item">
				<text class="label">创建时间</text>
				<text class="text">{{item.createTime}}</text>
			</view>
		 <view class="item">
		 	<text class="label">客户微信</text>
		 	<view class="right">
				<view class="text ellipsis" >{{item.weixin}}</view>
				<view class="btn" @click="sendMsg()">	
					自动获取
				</view>
			</view>
		 </view>
		</view>
	</view>
</template>

<script>
	import {getCustomerDetails} from '@/api/crm.js'
	export default {
		data() {
			return {
				id:null,
				item:null,
			}
		},
		onLoad(option) {
			
		},
		onShow() {
			 
		},
		methods: {
			sendMsg(){
				var that=this;
				var userId=uni.getStorageSync('companyUserId') ;
				var data={cmd:"getWeixinId", data:{},userId:"p-"+userId};
				uni.$emit('sendMsg',data); 
				
			},
			getCustomerDetails(customerId) {
				//联网加载数据
				var that = this;
				var data = {
					customerId: customerId
				};
				getCustomerDetails(data).then(res => {
					if(res.code==200){
						this.item=res.customer;
						 
					}else{
						uni.showToast({
							icon:'none',
							title: "请求失败",
						});
					}
				});
			},
			 
		}
	}
</script>

<style lang="scss">
	page{
		
		height: 100%;
		background: #f6f6f6;
	}
</style>
<style scoped lang="scss">
	.content{
		// 详细信息
		.info-detail{
			background-color: #fff;
			.item{
				height: 88rpx;
				border-bottom: 1rpx solid #f3f3f3;
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: flex-start;
				padding: 20upx 0;
				.label{
					min-width: 150rpx;
					flex: 1;
					font-size: 28upx;
					color: #999;
					margin-right: 20upx;
				}
				.right{
					
					flex: 1;
					display: flex;
					align-items: center;
					justify-content: flex-end;
					.text{
						max-width: 200rpx;
						font-size: 28upx;
						color: #333;
					}
					.btn{
						min-width: 150rpx;
						height: 66rpx;
						border-radius: 8rpx;
						padding: 5rpx 15rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						border: 1rpx solid #e9e9e9;
						font-size: 28rpx;
						color: #909399;
						
					}
				}
				.text{
					font-size: 28upx;
					color: #333;
				}
				 
			}
		}
	}
</style>
