<template>
	<view class="content">
		<view class="contLineBox">
			<view class="contLine">
				<view class="lineTitle">手机号</view>
				<view class="lineRgiht">{{customerInfo.mobilePhone}}</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">手机号</view>
				<view class="lineRgiht2" @click="editIphone">请输入手机号，以获取更多信息
				
				</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">姓名</view>
				<view class="lineRgiht">{{customerInfo.customerName}}</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">客户来源</view>
				<view class="lineRgiht">{{customerInfo.name}}</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">客户等级</view>
				<view class="lineRgiht">{{customerInfo.levelName}}</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">客户标签</view>
				<view class="titleBox">
					<view class="title" v-for="(item,index) in customerInfo.lables">{{item.name}}</view>
					
				</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">客户类型</view>
				<view class="lineRgiht" v-if="customerInfo.CusromerType==1">个人</view>
				<view class="lineRgiht" v-if="customerInfo.CusromerType==2">单位</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">单位名称</view>
				<view class="lineRgiht">库里</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">服务顾问</view>
				<view class="lineRgiht">{{customerInfo.usersName}}</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">所属门店</view>
				<view class="lineRgiht">库里</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">创建时间</view>
				<view class="lineRgiht">{{customerInfo.createTime}}</view>
			</view>
		</view>
		<view class="box">
			<view class="boxTitle">信用额度</view>
			<view class="creditBox">
				<view class="creditLine">
					<view class="creditTitle">剩余记账：</view>
					<view class="creditNum">2299</view>
				</view>
				<view class="creditLine">
					<view class="creditTitle">超期账款：</view>
					<view class="creditNum">2299</view>
				</view>
				<view class="creditLine">
					<view class="creditTitle">最近到期日：</view>
					<view class="creditNum">2299</view>
				</view>
				<view class="creditLine">
					<view class="creditTitle">可用额度：</view>
					<view class="creditNum">2299</view>
				</view>
				<view class="creditLine">
					<view class="creditTitle">信用额度：</view>
					<view class="creditNum">{{customerInfo.creditMoney}}</view>
				</view>
			</view>
		</view>
		<view class="box">
			<view class="boxTitle2">信用额度
			   <image class="boxIcon" src="../../static/img/icon_arrow_up.png" mode=""></image>
			</view>
			<view class="contLine">
				<view class="lineTitle">证件类型</view>
				<view class="lineRgiht">{{customerInfo.idType}}</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">证件号码</view>
				<view class="lineRgiht">{{customerInfo.idCode}}</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">所在地区</view>
				<view class="lineRgiht">{{customerInfo.provinceName}}{{customerInfo.cityName}}{{customerInfo.areaName}}</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">详细地址</view>
				<view class="lineRgiht">{{customerInfo.address}}</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">推广员工</view>
				<view class="lineRgiht">身份证</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">推广客户</view>
				<view class="lineRgiht">身份证</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">生日</view>
				<view class="lineRgiht">{{customerInfo.birthday}}</view>
			</view>
			<view class="contLine">
				<view class="lineTitle">客户备注</view>
				<view class="lineRgiht">{{customerInfo.comment}}</view>
			</view>
		</view>

		<uni-popup ref="popup" type="bottom" >
			<view class="popupBox">
			  <view class="popupTitleBox">
				  <view class="popupTitle">修改手机号</view>
				  <image src="../../static/img/cha.png" mode="" @click="pBcancel" class="chaImg"></image>
			  </view>
			  <view class="popupMs">此处修改手机号后，将根据新手机号重新匹配客户信息</view>
			  <view class="inputBox">
				  <view class="inputMs">手机号</view>
				  <input type="text" v-model="extUserMobile" class="iphoneInput" placeholder="请输入" />
			  </view>
			  
			  <view class="pBottom">
				   <view class="pBcancel" @click="pBcancel">取消</view>
				   <view class="pBBtn" @click="extCustomerMobile">确定</view>
			  </view>
			</view>
			
		</uni-popup>
	</view>
</template>

<script>
	export default {
		props:['token'],
		data() {
			return {
				extUserMobile:'',
				customerInfo:'',
			}
		},
		onLoad() {
		 
		},
		
		methods: {
			getdata(){
				this.extCustomerInfo()
			},
			extCustomerInfo(){
				var that=this;
				this.$http('enterprise/wechat/extCustomerInfo', {
				   corpID:'wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g',
				   extUserId:'wmMGjbBgAA0JAbGD5Vu8BzEuYgZhvhOA',
				   token:this.token
				}, 'GET').then(res => {
				    this.customerInfo=res.data.data.customerInfo
					this.customerId=this.customerInfo.id
					uni.setStorage({
						key: 'customerId',
						data: that.customerId,
						 success: function () {	 }
					});
				})
			},
		  extCustomerMobile(){
			  var that=this;
			  uni.showLoading({
			   	title: '加载中'
			  }); 
			  this.$http('enterprise/wechat/extCustomerMobile', {
			     corpID:'wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g',
			     extUserId:'wmMGjbBgAA0JAbGD5Vu8BzEuYgZhvhOA',
			     extUserMobile:this.extUserMobile
			  }, 'POST').then(res => {
			      uni.hideLoading();
				  uni.showToast({
					title: res.data,
					icon: 'none',
					duration: 3000
				  });
				  this.pBcancel()
				  this.extCustomerInfo()
			  	
			  }).catch(err=>{
				  
			  })
		  },
		  
          editIphone(){
			  console.log(this.token)
			   this.$refs.popup.open('bottom')
		  },
		  pBcancel(){
			  this.$refs.popup.close()
		  }
		}
	}
</script>

<style scoped>
	.contLineBox{
		background: #fff;
	}
	.contLine{
		display: flex;
		justify-content: space-between;
		border-bottom: 1px solid #F6F6F6;
		padding: 28rpx 24rpx;
		font-size: 28rpx;
	}
	.lineTitle{
		color: #666666;
	}
	.lineRgiht{
		color: #3C3C3C;
	}
	.lineRgiht2{
		color: #FF8113;
	}
	.titleBox{
		display: flex;    flex-wrap: wrap;
width: 500rpx;
		
	}
	.title{
		height: 36rpx;
		border-radius: 4rpx;
		border: 1px solid #FF8113;
		line-height: 34rpx;
		font-size: 24rpx;
		color: #FF8113;
		padding: 0 8rpx;
		margin-right: 10rpx;
		
	}
	.box{
		margin-top: 20rpx;background: #fff;
	}
	.boxTitle{
		font-weight: 500;
		font-size: 28rpx;
		color: #3C3C3C;
		padding: 28rpx 24rpx;
		border-bottom: 1px solid #EEEEEE;
	}
	.creditBox{
		display: flex;
		flex-wrap: wrap;
		padding-top: 16rpx;
		padding-bottom: 16rpx;
	}
	.creditLine{
		width: 50%;display: flex;
	
		padding-top: 8rpx;
		padding-bottom: 8rpx;
		font-size: 26rpx;
		color: #666666;
	}
	.creditNum{
		color: #3C3C3C;
	}
	.creditTitle{
			padding-left: 24rpx;
	}
	.boxTitle2{
		display: flex;
		justify-content: space-between;
		font-weight: 500;
		font-size: 28rpx;
		color: #3C3C3C;
		padding: 28rpx 24rpx;
		border-bottom: 1px solid #EEEEEE;
	}
	.boxIcon{
		width: 26rpx;height: 16rpx;
		margin-top: 6rpx;
	}
	.popupBox{
		width: 750rpx;
		height: 809rpx;
		background: #FFFFFF;
		border-radius: 32rpx 32rpx 0rpx 0rpx;
		position: relative;
	}
	.popupTitleBox{
		display: flex;
		justify-content: space-between;
		padding: 30rpx;
	}
	.popupTitle{
		font-size: 30rpx;
		color: #3C3C3C;
		line-height: 42rpx;
	}
	.chaImg{
		width: 27rpx;height: 27rpx;margin-top: 9rpx;
	}
	.popupMs{
		font-size: 26rpx;
		color: #FF8113;
		padding-left: 24rpx;
		padding-bottom: 20rpx;
		border-bottom: 1px solid #EEEEEE;
	}
	.inputBox{
		display: flex;
		padding: 0 24rpx;
		line-height: 98rpx;
		border-bottom: 1px solid #EEEEEE;
	}
	.iphoneInput{
		line-height: 98rpx;
		height: 98rpx;
		padding-left: 40rpx;
	}
	.pBottom{
		position: absolute;
		left: 0;
		bottom: 0;
		width: 750rpx;
		padding: 24rpx 0rpx;
		background: #FFFFFF;
		box-shadow: 0rpx -2rpx 20rpx 0rpx rgba(153,153,153,0.2);
		display: flex;
		justify-content: space-around;
	}
	.pBcancel{
		width: 331rpx;
		height: 74rpx;
		border-radius: 37rpx;
		border: 2rpx solid #DDDDDD;
		line-height: 74rpx;
		text-align: center;
		font-weight: 500;
		font-size: 28rpx;
		color: #3C3C3C;
	}
	.pBBtn{
		width: 331rpx;
		height: 74rpx;
		background: #FF8113;
		border-radius: 37rpx;
		line-height: 74rpx;
		text-align: center;
		font-weight: 500;
		font-size: 28rpx;
		color: #FEFFFE;
	}
</style>
