Commit b02ae757 by 张立顺

fix bug

1 parent 68bf0df9
<template>
<d2-container v-loading="pageLoading" class="customer-group-rel-page">
<div class="page-content">
<CustomerBasicInfoCard
:customer-row="customerRow"
:basic-info="groupData.basicInfo"
/>
<d2-container v-loading="pageLoading" class="customer-group-rel-page">
<div class="page-content">
<CustomerBasicInfoCard :basic-info="groupData.basicInfo"
:customer-row="customerRow" />
<section class="detail-card">
<h3 class="detail-card__title">
群关联
</h3>
<div
v-for="item in groupFieldList"
:key="item.prop"
class="field-row"
>
<span class="field-label">{{ item.label }}:</span>
<span class="field-value">{{ displayGroupInfo[item.prop] || "-" }}</span>
</div>
</section>
<section class="detail-card">
<h3 class="detail-card__title">
群关联
</h3>
<div v-for="item in groupFieldList"
:key="item.prop"
class="field-row">
<span class="field-label">{{ item.label }}:</span>
<span class="field-value">{{ displayGroupInfo[item.prop] || "-" }}</span>
</div>
</section>
<div class="footer-actions">
<el-button type="primary" size="medium" @click="handleBack">
返回
</el-button>
</div>
</div>
</d2-container>
<div class="footer-actions">
<el-button size="medium"
type="primary"
@click="handleBack">
返回
</el-button>
</div>
</div>
</d2-container>
</template>
<script>
......@@ -75,7 +73,7 @@ export default {
}
this.customerRow = resolveCustomerRowFromRoute(
this.$route,
loadCustomerSnapshot()
loadCustomerSnapshot(),
);
this.loadGroupInfo();
},
......
......@@ -14,34 +14,36 @@
</div>
<p class="date-y-line" />
</template>
<el-button icon="el-icon-d-arrow-left"
<el-button class="arrow-left-icon"
icon="el-icon-d-arrow-left"
type="text"
class="arrow-left-icon"
:disabled="currentWeek === 1"
@click="handleWeek(false)" />
<template>
<div class="date-picker">
<div class="wrapper"
v-for="(item, index) in dateList.slice(currentWeek * 7 - 7, currentWeek * 7)"
:key="index">
<div v-for="(item, index) in dateList.slice(currentWeek * 7 - 7, currentWeek * 7)"
:key="index"
class="wrapper">
<span>
<p v-for="(info, infoIndex) in appointData[index].infoList"
:key="infoIndex">
<el-popover placement="bottom-start"
<el-popover open-delay="600"
placement="bottom-start"
title=""
width="200"
open-delay="600"
trigger="hover"
width="200"
:disabled="info.status === 0">
<div>
<p>1、客户姓名,时间,项目</p>
<p>2、客户姓名,时间,项目</p>
<p>余位数:8</p>
</div>
<el-button :class="{'col-width': true, 'hour-template': true, 'status-full': info.status === 2, 'status-remain': info.status === 1 }"
slot="reference"
<el-button slot="reference"
class="col-width hour-template"
:class="{ 'status-full': info.status === 2, 'status-remain': info.status === 1 }"
@click="handleAppoint(item, infoIndex)">
{{ appointStatusList[info.status] }}</el-button>
{{ appointStatusList[info.status] }}
</el-button>
</el-popover>
</p>
</span>
......@@ -49,13 +51,14 @@
</div>
<p class="date-x-line" />
<div class="date-picker">
<div class="wrapper"
v-for="(item, index) in dateList.slice(currentWeek * 7 - 7, currentWeek * 7)"
:key="index">
<el-button type="text"
:class="{'date-btn': true, 'col-width': true, 'active': item.active}"
<div v-for="(item, index) in dateList.slice(currentWeek * 7 - 7, currentWeek * 7)"
:key="index"
class="wrapper">
<el-button class="date-btn col-width"
type="text"
:class="{ active: item.active }"
@click="handleSelectDate(index)">
<p>{{ item.date.split('/')[1] + '.' + item.date.split('/')[2] }}</p>
<p>{{ `${item.date.split('/')[1]}.${item.date.split('/')[2]}` }}</p>
<p>{{ weekList[item.week] }}</p>
</el-button>
</div>
......@@ -70,59 +73,60 @@
</template>
<script>
import { appointDays } from '@/common/format'
export default {
name: 'TimeDate',
data() {
return {
// 7天为一个周期,预约时间为35天,一共5个周期,当前周期
currentWeek: 1,
// 日期
dateIndex: 0,
weekList: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
dateList: new Array(appointDays).fill(null).map((item, index) => {
var date = new Date(new Date().setDate(new Date().getDate() + index))
return {
date: date.toLocaleDateString(),
week: date.getDay(),
active: !index
}
}),
// 时间
appointStatusList: ['空', '余', '满']
}
},
import { appointDays } from "@/common/format";
props: {
appointData: {
type: Array,
default: () => []
},
hoursList: {
type: Array,
default: () => []
}
},
export default {
name: "TimeDate",
mounted() { },
props: {
appointData: {
type: Array,
default: () => [],
},
hoursList: {
type: Array,
default: () => [],
},
},
data() {
return {
// 7天为一个周期,预约时间为35天,一共5个周期,当前周期
currentWeek: 1,
// 日期
dateIndex: 0,
weekList: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
dateList: new Array(appointDays).fill(null).map((item, index) => {
let date = new Date(new Date().setDate(new Date().getDate() + index));
return {
date: date.toLocaleDateString(),
week: date.getDay(),
active: !index,
};
}),
// 时间
appointStatusList: ["空", "余", "满"],
};
},
methods: {
// 日期选择
handleSelectDate(currentIndex) {
// this.dateList[this.dateIndex].active = false
// this.dateIndex = currentIndex
// this.dateList[currentIndex].active = true
},
handleAppoint(date, hourIndex) {
// this.$emit('handleAppoint', { date: date.date, hour: this.hoursList[hourIndex].hour })
},
handleWeek(isAdd) {
isAdd ? this.currentWeek++ : this.currentWeek--
}
}
}
mounted() { },
methods: {
// 日期选择
handleSelectDate(currentIndex) {
// this.dateList[this.dateIndex].active = false
// this.dateIndex = currentIndex
// this.dateList[currentIndex].active = true
},
handleAppoint(date, hourIndex) {
// this.$emit('handleAppoint', { date: date.date, hour: this.hoursList[hourIndex].hour })
},
handleWeek(isAdd) {
isAdd ? this.currentWeek++ : this.currentWeek--;
},
},
};
</script>
<style lang="scss" scoped>
@import "./css/timeDateStyle.scss";
</style>
<template>
<d2-container v-loading="pageLoading" class="customer-portrait-page">
<div class="page-content">
<CustomerBasicInfoCard
:customer-row="customerRow"
:basic-info="portraitData.basicInfo"
/>
<d2-container v-loading="pageLoading" class="customer-portrait-page">
<div class="page-content">
<CustomerBasicInfoCard :basic-info="portraitData.basicInfo"
:customer-row="customerRow" />
<section class="detail-card">
<h3 class="detail-card__title">
消费力标签({{ consumptionScore }}分)
</h3>
<template v-if="consumptionDimensions.length">
<div
v-for="(dimension, index) in consumptionDimensions"
:key="`consumption-${index}`"
class="field-row"
>
<span class="field-label">{{ dimension.dimensionName }}:</span>
<div class="tag-list">
<template v-if="dimension.tags.length">
<el-tag
v-for="(tag, tagIndex) in dimension.tags"
:key="`consumption-tag-${index}-${tagIndex}`"
size="small"
class="tag-item"
>
{{ tag }}
</el-tag>
</template>
<span v-else class="empty-text">-</span>
</div>
</div>
</template>
<div v-else class="field-row">
<span class="empty-text">-</span>
</div>
</section>
<section class="detail-card">
<h3 class="detail-card__title">
消费力标签({{ consumptionScore }}分)
</h3>
<template v-if="consumptionDimensions.length">
<div v-for="(dimension, index) in consumptionDimensions"
:key="`consumption-${index}`"
class="field-row">
<span class="field-label">{{ dimension.dimensionName }}:</span>
<div class="tag-list">
<template v-if="dimension.tags.length">
<el-tag v-for="(tag, tagIndex) in dimension.tags"
:key="`consumption-tag-${index}-${tagIndex}`"
class="tag-item"
size="small">
{{ tag }}
</el-tag>
</template>
<span v-else class="empty-text">-</span>
</div>
</div>
</template>
<div v-else class="field-row">
<span class="empty-text">-</span>
</div>
</section>
<section class="detail-card">
<h3 class="detail-card__title">
产品标签({{ productScore }}分)
</h3>
<template v-if="productDimensions.length">
<div
v-for="(dimension, index) in productDimensions"
:key="`product-${index}`"
class="field-row"
>
<span class="field-label">{{ dimension.dimensionName }}:</span>
<div class="tag-list">
<template v-if="dimension.tags.length">
<el-tag
v-for="(tag, tagIndex) in dimension.tags"
:key="`product-tag-${index}-${tagIndex}`"
size="small"
class="tag-item"
>
{{ tag }}
</el-tag>
</template>
<span v-else class="empty-text">-</span>
</div>
</div>
</template>
<div v-else class="field-row">
<span class="empty-text">-</span>
</div>
</section>
<section class="detail-card">
<h3 class="detail-card__title">
产品标签({{ productScore }}分)
</h3>
<template v-if="productDimensions.length">
<div v-for="(dimension, index) in productDimensions"
:key="`product-${index}`"
class="field-row">
<span class="field-label">{{ dimension.dimensionName }}:</span>
<div class="tag-list">
<template v-if="dimension.tags.length">
<el-tag v-for="(tag, tagIndex) in dimension.tags"
:key="`product-tag-${index}-${tagIndex}`"
class="tag-item"
size="small">
{{ tag }}
</el-tag>
</template>
<span v-else class="empty-text">-</span>
</div>
</div>
</template>
<div v-else class="field-row">
<span class="empty-text">-</span>
</div>
</section>
<section class="detail-card">
<h3 class="detail-card__title">
行为标签({{ behaviorScore }}分)
</h3>
<el-table
:data="behaviorTagList"
border
size="small"
class="behavior-table"
>
<el-table-column
label="序号"
type="index"
width="60"
align="center"
/>
<el-table-column
label="标签维度"
prop="dimensionName"
min-width="200"
align="center"
/>
<el-table-column
label="枚举值"
min-width="120"
align="center"
>
<template slot-scope="scope">
<el-tag
v-if="scope.row.enumName"
size="small"
class="tag-item"
>
{{ scope.row.enumName }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column
label="依据"
prop="basis"
min-width="320"
align="left"
>
<template slot-scope="scope">
<span class="basis-text">{{ scope.row.basis || "-" }}</span>
</template>
</el-table-column>
</el-table>
</section>
<section class="detail-card">
<h3 class="detail-card__title">
行为标签({{ behaviorScore }}分)
</h3>
<el-table class="behavior-table"
size="small"
border
:data="behaviorTagList">
<el-table-column align="center"
label="序号"
type="index"
width="60" />
<el-table-column align="center"
label="标签维度"
min-width="200"
prop="dimensionName" />
<el-table-column align="center"
label="枚举值"
min-width="120">
<template #default="scope">
<el-tag v-if="scope.row.enumName"
class="tag-item"
size="small">
{{ scope.row.enumName }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column align="left"
label="依据"
min-width="320"
prop="basis">
<template #default="scope">
<span class="basis-text">{{ scope.row.basis || "-" }}</span>
</template>
</el-table-column>
</el-table>
</section>
<div class="footer-actions">
<el-button type="primary" size="medium" @click="handleBack">
返回
</el-button>
</div>
</div>
</d2-container>
<div class="footer-actions">
<el-button size="medium"
type="primary"
@click="handleBack">
返回
</el-button>
</div>
</div>
</d2-container>
</template>
<script>
......@@ -185,7 +165,7 @@ export default {
}
this.customerRow = resolveCustomerRowFromRoute(
this.$route,
loadCustomerSnapshot()
loadCustomerSnapshot(),
);
this.loadPortrait();
},
......@@ -197,12 +177,12 @@ export default {
id: this.customerId,
});
this.applyPortraitData(
mapProfileResponse(res || {}, this.customerRow)
mapProfileResponse(res || {}, this.customerRow),
);
} catch (err) {
this.$message.error(err.message || "加载客户画像失败");
this.applyPortraitData(
mapProfileResponse({}, this.customerRow)
mapProfileResponse({}, this.customerRow),
);
} finally {
this.pageLoading = false;
......
......@@ -211,34 +211,38 @@ export function mapProfileResponse(res = {}, snapshotRow = {}) {
};
const consumptionTag = res.consumptionTag || {};
// 接口字段名与 categoryName 语义对调:产品数据在 behaviorTag,行为数据在 productTag
const apiProductTag = res.behaviorTag || {};
const apiBehaviorTag = res.productTag || {};
const productTag = res.productTag || {};
const behaviorTag = res.behaviorTag || {};
const consumptionDimensions = (consumptionTag.dimensions || []).map((dimension) => ({
dimensionName: dimension.dimensionName || "-",
tags: (dimension.enumValues || []).map((item) => item.enumName).filter(Boolean),
}));
const productDimensions = (apiProductTag.dimensions || []).map((dimension) => ({
dimensionName: dimension.dimensionName || "-",
tags: (dimension.enumValues || []).map((item) => item.enumName).filter(Boolean),
}));
const productDimensions = [];
const dealTags = (productTag.dealEnumValues || [])
.map((item) => item.enumName)
.filter(Boolean);
if (dealTags.length) {
productDimensions.push({ dimensionName: "已成交品类", tags: dealTags });
}
const noDealTags = (productTag.noDealEnumValues || [])
.map((item) => item.enumName)
.filter(Boolean);
if (noDealTags.length) {
productDimensions.push({ dimensionName: "未成交品类", tags: noDealTags });
}
const behaviorTagList = [];
const behaviorCategory = apiBehaviorTag.categoryName || "行为标签";
(apiBehaviorTag.dealEnumValues || []).forEach((item) => {
behaviorTagList.push({
dimensionName: behaviorCategory,
enumName: item.enumName || "",
basis: item.scoreBasis || "",
});
});
(apiBehaviorTag.noDealEnumValues || []).forEach((item) => {
behaviorTagList.push({
dimensionName: behaviorCategory,
enumName: item.enumName || "",
basis: item.scoreBasis || "",
(behaviorTag.dimensions || []).forEach((dimension) => {
(dimension.enumValues || []).forEach((enumValue) => {
behaviorTagList.push({
dimensionName: dimension.dimensionName || "-",
enumName: enumValue.enumName || "",
basis: enumValue.scoreBasis || "",
});
});
});
......@@ -246,9 +250,9 @@ export function mapProfileResponse(res = {}, snapshotRow = {}) {
basicInfo,
consumptionScore: consumptionTag.totalScore || 0,
consumptionDimensions,
productScore: apiProductTag.totalScore || 0,
productScore: productTag.totalScore || 0,
productDimensions,
behaviorScore: apiBehaviorTag.totalScore || 0,
behaviorScore: behaviorTag.totalScore || 0,
behaviorTagList,
};
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!