<template>
	<view>
		<z-navbar title="咨询详情" back>
			<view slot="right" class="iconfont iconjuxing13" @click="gotoPage(0)"></view>
		</z-navbar>

		<template>
			<z-cell label="客户姓名" :content="info.customName"></z-cell>
			<z-cell label="客户电话" :content="info.phone||'无'"></z-cell>
			<z-cell label="微信号" :content="info.wechatNo||'无'"></z-cell>
			<z-cell label="意向日期" :content="info.wantDate+' '+(info.wantBeginTime?(info.wantBeginTime+'-'+info.wantEndTime):'')"></z-cell>
			<z-cell label="意向数量" :content="info.userCount"></z-cell>
			<z-cell label="意向场地" :content="info.wantHouseInfo||'无'"></z-cell>
			<z-cell label="预算金额" :content="(info.budgetStart||'未填')+'~'+(info.budgetEnd||'未填')"></z-cell>
			<z-cell label="意向度" content="高"></z-cell>
			<z-cell label="客户来源" :content="info.customFromName"></z-cell>
			<z-cell label="提醒日期" :content="info.alertDate||'无'"></z-cell>
			<z-cell label="最后更新" :content="info.updateTime" hideline></z-cell>
		</template>

		<view class="common_handle_style_zw"></view>
		<view class="common_handle_style shadow-2 flex-n fac fja">
			<view class="common_handle_style_item " @click="gotoPage(1)" v-if="info.alertDate">
				<view class="common_handle_style_img iconfont iconjuxing26kaobei2"></view>
				<view class="common_handle_style_text">处理咨询</view>
			</view>
			<view class="common_handle_style_item " @click="gotoPage(2)">
				<view class="common_handle_style_img iconfont iconjuxing21"></view>
				<view class="common_handle_style_text">编辑咨询</view>
			</view>

			<view class="common_handle_style_item" @click="gotoPage(3)">
				<view class="common_handle_style_img iconfont iconjuxing23"></view>
				<view class="common_handle_style_text">转为预定</view>
			</view>
			<!-- 	<view class="common_handle_style_item" @click="gotoPage('share')">
				<view class="common_handle_style_img iconfont iconjuxing22kaobei"></view>
				<view class="common_handle_style_text">分享预定</view>
			</view> -->
		</view>
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:'',
			
				info:{},
				stateTab: 0,
				
				wantDate:''
			}
		},
		mounted() {

		},
		onLoad(option) {
			console.log(option)
			this.id=option.id;
		},
		onShow() {
			this.getData(this.id);
		},
		methods: {
			
			getData(askId){
				this.$axios.get('app/preUserAsk/findById/'+askId).then(res=>{
					console.log(res)
					this.info=res.data;
					var wantHouseInfo='';
					for(var i in res.data.wantHouse){
						if(res.data.wantHouse[i])
						wantHouseInfo += res.data.wantHouse[i].houseName+'、';
					}
					if(wantHouseInfo.length>0){
						wantHouseInfo=wantHouseInfo.substring(0,wantHouseInfo.length-1)
					}
					this.info.wantHouseInfo=wantHouseInfo;
				}).catch(err=>{
					console.log(err)
					this.$refs.uToast.error(err.msg);
				})
			},
			gotoPage(page) {
				console.log(page)
				switch (page) {
					case 0:
						uni.navigateTo({
							url: '../history/index?id='+this.id
						});
						break;
					case 1:
						uni.navigateTo({
							url: '../consultation/index?id='+this.id+'&wantDate='+this.info.wantDate
						});
						break;
					case 2:
						uni.navigateTo({
							url: '../manage/index?type=1&id='+this.id
						});
						break;
					case 3:
					uni.setStorage({
						key:'remindToOrder',
						data:this.info,
						success:()=>{
							uni.navigateTo({
								url: '../../book/manage/index?type=0&askId='+this.id
							});
							}	
					})
						
						
						break;
				}
			}
		},

	}
</script>

<style lang="scss" scoped>
	.iconjuxing13{
		font-size: 38rpx;
	}
	.remark {
		font-size: 28rpx;
		color: #555555;
	}

	.common_handle_style_zw {
		height: 139rpx;
	}

	.common_handle_style {
		position: fixed;
		background: white;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 119rpx;

		.common_handle_style_item{
			text-align: center;
			width: 200rpx;
			.common_handle_style_img{
				width:53rpx;
				height: 50rpx;
				font-size: 50rpx;
				color: #007AFF;
				margin: 0 auto;
			}
			.common_handle_style_text{
				color: #007AFF;
				font-size: 24rpx;
				line-height: 24rpx;
				margin-top: 10rpx;
			}
		}
	}
</style>
