Commit b02ae757 by 张立顺

fix bug

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