<template>
	<view class="echart-content"> 
		<view class="echart-title">
			<view class="e-icon e1"><text class="iconfont icon-gongsi"></text></view>
			<view class="e-name">{{ data.name }}</view>
			<view class="e-start">{{ data.status | statusFilters }}</view>
		</view>
		<view class="echart-main clearfix" @click="handleClubInfo">
			<view class="echart-text">
				<text class="label">机构ID：</text>{{ data.clubId ? data.clubId :'' }}
			</view>
			<view class="echart-text">
				<text class="label">联系人：</text>{{ data.linkMan ? data.linkMan :'无' }}
			</view>
			<view class="echart-text" v-if="data.customerGender">
				<text class="label">性别：</text>
				{{ data.customerGender === 0 ? '男' :'女' }}
			</view>
			<view class="echart-text" v-if="data.customerAge">
				<text class="label">年龄：</text>{{ data.customerAge}}
			</view>
			<view class="echart-text" v-if="data.contractMobile">
				<text class="label">手机号：</text>{{ data.contractMobile }}
			</view>
			<view class="echart-text" v-if="data.linkManIdentity">
				<text class="label">联系人身份：</text>{{ data.linkManIdentity | linkManFormat }}
			</view>
			<view class="echart-text" v-if="data.addTime">
				<text class="label">注册时间：</text> {{ data.addTime }}
			</view>
			<view class="echart-text" v-if="data.customerValue">
				<text class="label">客户价值：</text>
				{{ data.customerValue }}
			</view>
			<view class="echart-text"  v-if="data.activeState">
				<text class="label">活跃状态：</text>
				{{ data.activeState }}
			</view>
			<view class="echart-text"  v-if="data.number">
				<text class="label">资料完整度：</text>
				{{ data.number }}%
			</view>
			<view class="echart-text" v-if="data.customerSource">
				<text class="label">客户来源：</text>
				 {{ data.customerSource | sourceActionsFilters }}
			</view>
			<view class="echart-text">
				<text class="label">机构级别：</text>
				{{ useInfo.userIdentity === 2 ? '资质机构' : '普通机构' }}
			</view>
			<view class="echart-text" v-if="data.firstClubType">
				<text class="label">机构类型：</text>
				{{ data.firstClubType | FirstFormat }}-{{ data.secondClubType | TwoFormat }}
			</view>
			<view class="echart-text">
				<text class="label">入群状态：</text>
				{{ data.groupAddition === 0 ? '已入群' : '未入群' }}
			</view>
			<view class="echart-text" v-if="data.wx">
				<text class="label">微信触达：</text>
				 {{ data.wx}}
			</view>
			<view class="echart-text" v-if="data.mob">
				<text class="label">电话触达：</text>
				 {{ data.mob }}
			</view>
			<view class="echart-text" v-if="data.provincialAddress">
				<text class="label">地址：</text>{{ data.provincialAddress }}
			</view>
			<view class="echart-next">详情></view>
		</view>
	</view>
</template>

<script>
import { mapState, mapMutations } from 'vuex'
export default {
	props:{
		clubInfo:{
			type:Object,
			default:{}
		},
		clubUserInfo:{
			type:Object,
			default:{}
		}
	},
	data() {
		return {
			data:{},
			useInfo:{}
		}
	},
	created() {
		this.data = this.clubInfo
		this.useInfo = this.clubUserInfo
	},
	filters: {
		FirstFormat(value) {
			//处理格式
			const map = {
				1: '医美',
				2: '生美',
				3: '项目公司',
				4: '个人',
				5: '其他'
			}
			return map[value]
		},
		TwoFormat(value) {
			if(!value){  return ''}
			const map = {
				1: '诊所',
				2: '门诊',
				3: '医院',
				4: '其他',
				5: '美容院',
				6: '养生馆',
				7: '其他',
			}
			return map[value]
		},
		linkManFormat(value) {
			const map = {
				1: '老板',
				2: '采购',
				3: '运营',
				4: '其他'
			}
			return map[value]
		},
		statusFilters(value) {
			// 状态
			const map = {
				1: '待审核',
				90: '已上线',
				92: '审核未通过'
			}
			return map[value]
		},
		sourceActionsFilters(value) {
		  // 客户来源
		  const map = {
			0: '网站',
			1: '小程序',
			2: '公众号',
			3: '小红书',
			4: '微博',
			5: '搜狐',
			6: '其他'
		  }
		  return map[value]
		}
	},
	methods: {
		handleClubInfo(){
			this.$api.navigateTo(`/pages/seller/club/club-detail?userId=${this.data.userId}`)
		},
	},
	onShow() {}
}
</script>

<style lang="scss">

</style>
