CustomerBasicInfoCard.vue 2.48 KB
<template>
	<section class="detail-card">
		<h3 class="detail-card__title">
			基础信息
		</h3>
		<el-row :gutter="16">
			<el-col
				v-for="item in fieldList"
				:key="item.prop"
				class="detail-row"
				:span="item.span || 8"
			>
				<span class="detail-label">{{ item.label }}:</span>
				<span class="detail-value">{{ displayInfo[item.prop] || "-" }}</span>
			</el-col>
		</el-row>
	</section>
</template>

<script>
import { CUSTOMER_STATUS_LIST, mapBasicInfoFromRow } from "../utils/customerSnapshot";

export default {
	name: "CustomerBasicInfoCard",
	props: {
		customerRow: {
			type: Object,
			default: () => ({}),
		},
		basicInfo: {
			type: Object,
			default: () => ({}),
		},
		statusList: {
			type: Array,
			default: () => CUSTOMER_STATUS_LIST,
		},
	},
	computed: {
		displayInfo() {
			const fromRow = mapBasicInfoFromRow(this.customerRow, this.statusList);
			if (this.basicInfo && Object.keys(this.basicInfo).length) {
				return {
					...fromRow,
					...this.basicInfo,
					// 客户分类、客户状态仅来自列表行数据,详情接口不返回
					customerCategory: fromRow.customerCategory,
					customerStatus: fromRow.customerStatus,
				};
			}
			return fromRow;
		},
		fieldList() {
			return [
				{ label: "客户姓名", prop: "customerName" },
				{ label: "手机号", prop: "mobile" },
				{ label: "客户分类", prop: "customerCategory" },
				{ label: "品牌车型", prop: "carModel" },
				{ label: "客户状态", prop: "customerStatus" },
				{ label: "服务时间", prop: "serviceTime" },
				{ label: "备注", prop: "remark", span: 24 },
				{ label: "流量来源", prop: "trafficSource" },
				{ label: "推荐人", prop: "referrer" },
				{ label: "园区店", prop: "parkStore" },
				{ label: "转化专员", prop: "conversionStaff" },
				{ label: "群关联信息", prop: "groupRelInfo" },
				{ label: "创建方式", prop: "createMethod" },
				{ label: "创建时间", prop: "createTime" },
				{ label: "交车时间", prop: "deliveryTime" },
			];
		},
	},
};
</script>

<style lang="scss" scoped>
.detail-card {
	background: #fff;
	border-radius: 4px;
	padding: 16px 20px 8px;
	margin-bottom: 12px;

	&__title {
		margin: 0 0 16px;
		padding-left: 10px;
		border-left: 3px solid #409eff;
		font-size: 14px;
		font-weight: 600;
		color: #303133;
		line-height: 20px;
	}
}

.detail-row {
	margin-bottom: 14px;
	font-size: 14px;
	line-height: 22px;
}

.detail-label {
	color: #606266;
}

.detail-value {
	color: #303133;
	word-break: break-all;
}
</style>