Commit fc1f6a4d by yancanhua

fix: 收车偏好接口联调

1 parent db71966b
...@@ -12,11 +12,11 @@ export class PreferenceController { ...@@ -12,11 +12,11 @@ export class PreferenceController {
static PAGE_PREFERENCE = 'account/preference/page'; static PAGE_PREFERENCE = 'account/preference/page';
static getPreferenceDetail(axios: AxiosStatic, id: number): Promise<AxiosResponse> { static getPreferenceDetail(axios: AxiosStatic, id: number): Promise<AxiosResponse> {
return axios.get('account/preference/detail', { params: { id: id } }); return axios.get('account/preference/detail/' + id, {});
} }
static updatePreference(axios: AxiosStatic, params: any): Promise<AxiosResponse> { static postPreference(axios: AxiosStatic, params: any): Promise<AxiosResponse> {
return axios.put('account/preference/update', params); return axios.post('account/preference/update', params);
} }
static exportPreference(axios: AxiosStatic, params: any, config?: any): Promise<AxiosResponse<void>> { static exportPreference(axios: AxiosStatic, params: any, config?: any): Promise<AxiosResponse<void>> {
......
<template> <template>
<div class="logBox"> <div class="logBox">
<div v-for="(item, index) in logList" :key="index" class="log-list">
<div class="log-list">
<div class="progressBox"> <div class="progressBox">
<div class="progressBox-point"></div> <div class="progressBox-point"></div>
<div class="progressBox-line"></div> <div class="progressBox-line"></div>
</div> </div>
<div class="log-title"> <div class="log-title">
<div class="logBox-content">偏好品牌:<span>新增“奔驰”,新增“宝马”</span></div> <div v-if="item.title || item.content" class="logBox-content">
{{ item.title }}:
<span>{{ item.content }}</span>
</div>
<div class="logBox-time"> <div class="logBox-time">
<div class="logBox-point">M</div> <div class="logBox-point">M</div>
<span class="p-l-4">方世盛</span> <span class="p-l-4">{{ item.opBy }}</span>
<span class="p-l-8">2026-01-20 14:32:05</span> <span class="p-l-8">{{ item.createTime }}</span>
</div> </div>
</div> </div>
</div> </div>
<div v-if="!isAllData" @click="handleMore()" class="moreBox">
<div class="moreBox">
查看更多 查看更多
<DoubleLeftOutlined color="#666666" font-size="16px;" style="transform: rotate(270deg);" /> <DoubleLeftOutlined color="#666666" font-size="16px;" style="transform: rotate(270deg);" />
</div> </div>
...@@ -24,17 +25,38 @@ ...@@ -24,17 +25,38 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Vue } from "vue-facing-decorator"; import { Component, Prop, Vue, Watch } from "vue-facing-decorator";
import { DoubleLeftOutlined } from '@ant-design/icons-vue'; import { DoubleLeftOutlined } from '@ant-design/icons-vue';
@Component({ components: { DoubleLeftOutlined } }) @Component({ components: { DoubleLeftOutlined } })
export default class OperationLog extends Vue { export default class OperationLog extends Vue {
@Prop({ type: Object, required: true })
operationLogData: any;
logList = []; logList = [];
//初始数据 isAllData = false;
init(data: any) { alllist = [];
this.logList = data.operationLogList || []; @Watch('operationLogData', { deep: true, immediate: true })
watchOperationLogData(newValue: any, oldValue: any): void {
const list = (newValue.logList || []).map((item: any) => {
const values = (item.opContent || '').split(':').filter(Boolean);
return { ...item, title: values[0] || '', content: values[1] || '' };
});
if (list.length > 5) {
this.isAllData = false;
this.alllist = list;
this.logList = list.slice(0, 5);
} else {
this.isAllData = true;
this.logList = list;
} }
}
handleMore() {
this.isAllData = true;
// this.logList = this.alllist.slice(0, 5);
this.logList = this.alllist
}
} }
</script> </script>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<div v-for="(item, index) in returnPageList()" :key="index" style="float: left;"> <div v-for="(item, index) in returnPageList()" :key="index" style="float: left;">
<div v-if="index < 2" class="tag-box tag-box-max">{{ item.label }}</div> <div v-if="index < 2" class="tag-box tag-box-max">{{ item.label }}</div>
</div> </div>
<div class="tag-box">+ {{ returnPageList().length - 2 }}</div> <div v-if="returnPageList().length > 2" class="tag-box">+ {{ returnPageList().length - 2 }}</div>
</div> </div>
</a-popover> </a-popover>
</div> </div>
...@@ -28,8 +28,8 @@ interface TagItem { ...@@ -28,8 +28,8 @@ interface TagItem {
export default class PageMultipleTag extends Vue { export default class PageMultipleTag extends Vue {
@Prop({ type: Array, required: true }) @Prop({ type: String, required: true })
listValue: any[]; listValue: String;
@Prop({ type: String, required: true }) @Prop({ type: String, required: true })
tagValue: string; tagValue: string;
...@@ -39,7 +39,12 @@ export default class PageMultipleTag extends Vue { ...@@ -39,7 +39,12 @@ export default class PageMultipleTag extends Vue {
@Watch('tagValue') @Watch('tagValue')
@Watch('listValue') @Watch('listValue')
updateTagList() { updateTagList() {
if (this.listValue == 'vehicleConditionList' || this.listValue == 'vehicleAgeList' || this.listValue == 'vehicleFuelTypeList' || this.listValue == 'vehicleTypeList') {
this.cachedTagList = this.generateTagList(); this.cachedTagList = this.generateTagList();
} else {
//自定义品牌标签
this.cachedTagList = JSON.parse(this.listValue || '[]').map((item: any) => ({ label: item.name, value: item.id }));
}
} }
private generateTagList(): TagItem[] { private generateTagList(): TagItem[] {
......
<template> <template>
<a-card title="收车偏好详情" :bordered="false" size="small"> <div>
<a-descriptions :column="3" size="small"> <div class="titleBox">
{{ actionState == 'EDIT' ? '编辑收车偏好' : '车商基础信息' }}
<a-button style="float: right;" @click="$goBack()">返回列表</a-button>
</div>
<a-card :bordered="false" size="small">
<a-descriptions :column="3" size="small" layout="vertical">
<template #title> <template #title>
<title-tip-icon></title-tip-icon> <title-tip-icon></title-tip-icon>
车商基础信息 车商基础信息
<div class="title-line"></div>
</template> </template>
<a-descriptions-item label="车商ID">{{ pageData.id }}</a-descriptions-item> <a-descriptions-item label="车商ID">{{ pageData.accountId }}</a-descriptions-item>
<a-descriptions-item label="车商手机号">{{ pageData.mobile }}</a-descriptions-item> <a-descriptions-item label="车商手机号">{{ pageData.mobile }}</a-descriptions-item>
<a-descriptions-item label="车商昵称">{{ pageData.nickName }}</a-descriptions-item> <a-descriptions-item label="车商昵称">{{ pageData.nickName }}</a-descriptions-item>
<a-descriptions-item label="真实姓名">{{ pageData.realName }}</a-descriptions-item> <a-descriptions-item label="真实姓名">{{ pageData.accountName }}</a-descriptions-item>
<a-descriptions-item label="调研状态">{{ pageData.researchStatus }}</a-descriptions-item> <a-descriptions-item label="调研状态">
<a-descriptions-item label="注册时间">{{ pageData.createTime }}</a-descriptions-item> <div v-if="pageData.status == '1'" class="tag1">已完成</div>
<div v-else class="tag2">未完成</div>
</a-descriptions-item>
<a-descriptions-item label="注册时间">{{ pageData.regTime }}</a-descriptions-item>
<a-descriptions-item label="首次填写时间">{{ pageData.createTime }}</a-descriptions-item> <a-descriptions-item label="首次填写时间">{{ pageData.createTime }}</a-descriptions-item>
<a-descriptions-item label="更新时间">{{ pageData.updateTime }}</a-descriptions-item> <a-descriptions-item label="更新时间">{{ pageData.updateTime }}</a-descriptions-item>
<a-descriptions-item label="编辑人">{{ pageData.upName }}</a-descriptions-item> <a-descriptions-item label="编辑人">{{ pageData.updatedBy }}</a-descriptions-item>
</a-descriptions> </a-descriptions>
<template v-if="pageState == 'VIEW'"> <div v-if="actionState == 'VIEW'" style="width: 100%;">
<a-descriptions :column="3" size="small"> <a-descriptions :column="3" size="small" layout="vertical">
<template #title> <template #title>
<title-tip-icon></title-tip-icon> <title-tip-icon></title-tip-icon>
经营信息 经营信息
<div class="title-line"></div>
</template> </template>
<a-descriptions-item label="经营模式">{{ pageData.businessModel }}</a-descriptions-item> <a-descriptions-item label="经营模式">
<a-descriptions-item label="注册地区">{{ pageData.cityCode }}</a-descriptions-item> {{ pageData.businessModel == '1' ? '批发' : pageData.businessModel == '2' ? '零售' : '--' }}
</a-descriptions-item>
<a-descriptions-item label="注册地区">
{{ pageData.cityName }}
</a-descriptions-item>
</a-descriptions> </a-descriptions>
<a-descriptions :column="3" size="small"> <a-descriptions :column="3" size="small" layout="vertical">
<template #title> <template #title>
<title-tip-icon></title-tip-icon> <title-tip-icon></title-tip-icon>
收车偏好详情 收车偏好详情
<div class="title-line"></div>
</template> </template>
<a-descriptions-item label="偏好车况"> <a-descriptions-item label="偏好车况">
{{ pageData.vehicleCondition }}
<PageMultipleTag :listValue="'vehicleConditionList'" :tagValue="pageData.vehicleCondition" /> <PageMultipleTag :listValue="'vehicleConditionList'" :tagValue="pageData.vehicleCondition" />
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="偏好车龄"> <a-descriptions-item label="偏好车龄">
{{ pageData.vehicleAge }}
<PageMultipleTag :listValue="'vehicleAgeList'" :tagValue="pageData.vehicleAge" /> <PageMultipleTag :listValue="'vehicleAgeList'" :tagValue="pageData.vehicleAge" />
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="燃油类型"> <a-descriptions-item label="燃油类型">
{{ pageData.vehicleFuelType }}
<PageMultipleTag :listValue="'vehicleFuelTypeList'" :tagValue="pageData.vehicleFuelType" /> <PageMultipleTag :listValue="'vehicleFuelTypeList'" :tagValue="pageData.vehicleFuelType" />
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="收车车型"> <a-descriptions-item label="收车车型">
{{ pageData.vehicleModel }} <PageMultipleTag :listValue="'vehicleTypeList'" :tagValue="pageData.vehicleType" />
<PageMultipleTag :listValue="'vehicleModelList'" :tagValue="pageData.vehicleModel" />
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="偏好品牌"> <a-descriptions-item label="偏好品牌">
{{ pageData.brand }} <PageMultipleTag :listValue="pageData.brandList" :tagValue="pageData.brandList" />
<!-- <PageMultipleTag :listValue="'brandList'" :tagValue="deposit.brand" /> -->
</a-descriptions-item> </a-descriptions-item>
</a-descriptions> </a-descriptions>
<a-descriptions :column="1" size="small"> <a-descriptions :column="1" size="small" layout="vertical">
<template #title> <template #title>
<title-tip-icon></title-tip-icon> <title-tip-icon></title-tip-icon>
操作日志 操作日志
<div class="title-line"></div>
</template> </template>
<OperationLog ref="operationLogRef" /> <a-descriptions-item label="">
<OperationLog ref="operationLogRef" :operationLogData="pageData" />
</a-descriptions-item>
</a-descriptions> </a-descriptions>
</template> </div>
<template v-if="pageState == 'EDIT'">
<PreferenceForm ref="PreferenceFormRef" />
</template>
</a-card> </a-card>
<div v-if="actionState == 'EDIT'" style="width: 100%;">
<PreferenceForm ref="preferenceFormRef" :preferenceFormData="pageData" />
</div>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Vue } from 'vue-facing-decorator'; import { Component, Vue } from 'vue-facing-decorator';
import { DepositController } from "@/api/DepositController"; import { PreferenceController } from "@/api/PreferenceController";
import PageMultipleTag from "@/views/finance/preference/PageMultipleTag.vue"; import PageMultipleTag from "@/views/finance/preference/PageMultipleTag.vue";
import OperationLog from "@/views/finance/preference/OperationLog.vue"; import OperationLog from "@/views/finance/preference/OperationLog.vue";
import PreferenceForm from "@/views/finance/preference/PreferenceForm.vue"; import PreferenceForm from "@/views/finance/preference/PreferenceForm.vue";
import TitleDivider from "@/components/TitleDivider.vue";
import { DeleteOutlined, EditOutlined, PlusOutlined } from "@ant-design/icons-vue";
import TitleTipIcon from "@/components/icons/TitleTipIcon.vue";
@Component({ @Component({
components: { PageMultipleTag, OperationLog, PreferenceForm } components: { TitleDivider, EditOutlined, DeleteOutlined, PlusOutlined, TitleTipIcon, PageMultipleTag, OperationLog, PreferenceForm }
}) })
export default class ViewPreference extends Vue {
pageState = 'VIEW'//VIEW查看状态 EDIT编辑状态
pageData: {}//页面数据
export default class ViewPreference extends Vue {
actionState: string = 'VIEW'//VIEW查看状态 EDIT编辑状态
pageData: object = {} //页面显示数据
created() { created() {
const { id, state } = this.$route.query; const { preferenceId, action } = this.$route.query;
this.pageState = state || 'VIEW'; this.actionState = action || 'VIEW';
DepositController.getDepositDetailById(this.axios, Number(id)).then(response => { PreferenceController.getPreferenceDetail(this.axios, Number(preferenceId)).then(response => {
this.pageData = response.data || {}; this.pageData = response.data || {};
this.$nextTick(() => {
if (state === 'EDIT') {
this.$refs.PreferenceFormRef.init(this.pageData);
} else {
this.$refs.operationLogRef.init(this.pageData);
}
});
}) })
} }
} }
</script> </script>
<style scoped lang="less">
.titleBox {
width: -webkit-calc(100% - 24px);
width: -moz-calc(100% - 24px);
width: calc(100% - 24px);
height: 32px;
line-height: 32px;
margin-left: 12px;
color: #2f3133;
font-size: 16px;
font-weight: 700;
margin-bottom: 4px;
}
.title-line {
width: 100%;
height: 1px;
background-color: #F2F4F7;
margin-top: 10px;
}
.tag1 {
width: 52px;
height: 24px;
border-radius: 3px;
border: 1px solid #e8f8f2;
background: #e8f8f2;
color: #00ad74;
font-size: 12px;
font-weight: 400;
text-align: center;
line-height: 24px;
}
<style scoped lang="less"></style> .tag2 {
width: 52px;
height: 24px;
border: 1px solid #f0f2f5;
border-radius: 3px;
background: #f0f2f5;
color: #777c85;
font-size: 12px;
font-weight: 400;
text-align: center;
line-height: 24px;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!