ViewPreference.vue 8.1 KB
<template>
    <div>
        <div class="titleBox">
            {{ actionState == 'EDIT' ? '编辑收车偏好' : '收车偏好详情' }}
            <a-button style="float: right;" @click="handleCancelExit()">返回列表</a-button>
        </div>
        <div v-if="actionState == 'EDIT'" class="warning-box">
            <InfoCircleFilled color="#1956FE" font-size="14px" style="margin-left: 16px; color: #1956FE;" />
            <span style="padding-left: 8px;color: #777C85;">编辑完成所有偏好信息并保存后,车商小程序将不再展示收车偏好调研入口。仅编辑部分信息无法保存。</span>
        </div>
        <a-card :bordered="false" size="small">
            <a-descriptions :column="3" size="small" layout="vertical">
                <template #title>
                    <title-tip-icon></title-tip-icon>
                    车商基础信息
                    <div class="title-line"></div>
                </template>
                <a-descriptions-item label="车商ID">{{ pageData.accountId }}</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.accountName }}</a-descriptions-item>
                <a-descriptions-item label="调研状态">
                    <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.updateTime }}</a-descriptions-item>
                <a-descriptions-item label="编辑人">{{ pageData.updatedBy }}</a-descriptions-item>
            </a-descriptions>

            <div v-if="actionState == 'VIEW'" style="width: 100%;">
                <a-descriptions :column="3" size="small" layout="vertical">
                    <template #title>
                        <title-tip-icon></title-tip-icon>
                        经营信息
                        <div class="title-line"></div>
                    </template>
                    <a-descriptions-item label="经营模式">
                        {{ pageData.businessModel == '1' ? '批发' : pageData.businessModel == '2' ? '零售' : '--' }}
                    </a-descriptions-item>
                    <a-descriptions-item label="注册地区">
                        {{ pageData.provinceName }}-{{ pageData.cityName }}
                    </a-descriptions-item>
                </a-descriptions>
                <a-descriptions :column="3" size="small" layout="vertical">
                    <template #title>
                        <title-tip-icon></title-tip-icon>
                        收车偏好详情
                        <div class="title-line"></div>
                    </template>
                    <a-descriptions-item label="偏好车况">
                        <PageMultipleTag :listValue="'vehicleConditionList'" :tagValue="pageData.vehicleCondition" />
                    </a-descriptions-item>
                    <a-descriptions-item label="偏好车龄">
                        <PageMultipleTag :listValue="'vehicleAgeList'" :tagValue="pageData.vehicleAge" />
                    </a-descriptions-item>
                    <a-descriptions-item label="燃油类型">
                        <PageMultipleTag :listValue="'vehicleFuelTypeList'" :tagValue="pageData.vehicleFuelType" />
                    </a-descriptions-item>
                    <a-descriptions-item label="收车车型">
                        <PageMultipleTag :listValue="'vehicleTypeList'" :tagValue="pageData.vehicleType" />
                    </a-descriptions-item>
                    <a-descriptions-item label="品牌偏好">
                        <PageMultipleTag :listValue="pageData.brandList" :tagValue="pageData.brandList" />
                    </a-descriptions-item>
                </a-descriptions>
                <a-descriptions :column="1" size="small" layout="vertical">
                    <template #title>
                        <title-tip-icon></title-tip-icon>
                        操作日志
                        <div class="title-line"></div>
                    </template>
                    <a-descriptions-item label="">
                        <OperationLog ref="operationLogRef" :operationLogData="pageData" />
                    </a-descriptions-item>
                </a-descriptions>
            </div>
        </a-card>
        <div v-if="actionState == 'EDIT'" style="width: 100%;">
            <PreferenceForm ref="preferenceFormRef" :preferenceFormData="pageData" @cancelExit="handleCancelExit()" />
        </div>
        <!-- 退出提示弹窗 -->
        <a-modal v-model:open="exitVisible" title="提示" width="480px" @ok="handleExit">
            <p style="height: 32px;line-height: 32px;">本次编辑未保存,是否确定退出?</p>
        </a-modal>
    </div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-facing-decorator';
import { PreferenceController } from "@/api/PreferenceController";
import PageMultipleTag from "@/views/finance/preference/PageMultipleTag.vue";
import OperationLog from "@/views/finance/preference/OperationLog.vue";
import PreferenceForm from "@/views/finance/preference/PreferenceForm.vue";
import TitleDivider from "@/components/TitleDivider.vue";
import { DeleteOutlined, EditOutlined, PlusOutlined, InfoCircleFilled } from "@ant-design/icons-vue";
import TitleTipIcon from "@/components/icons/TitleTipIcon.vue";

@Component({
    components: { TitleDivider, EditOutlined, DeleteOutlined, PlusOutlined, TitleTipIcon, PageMultipleTag, OperationLog, PreferenceForm, InfoCircleFilled }
})

export default class ViewPreference extends Vue {
    actionState: string = 'VIEW'//VIEW查看状态 EDIT编辑状态
    pageData: object = {} //页面显示数据
    exitVisible: boolean = false //退出提示弹窗是否显示
    created() {
        const { preferenceId, action } = this.$route.query;
        this.actionState = action || 'VIEW';
        PreferenceController.getPreferenceDetail(this.axios, Number(preferenceId)).then(response => {
            this.pageData = response.data || {};
        })
    }

    handleCancelExit() {
        if (this.actionState == 'EDIT') {
            this.exitVisible = true;
        } else {
            this.$goBack()
        }
    }

    handleExit() {
        this.exitVisible = false;
        this.$goBack()
    }
}
</script>

<style scoped lang="less">
::v-deep(.ant-descriptions-item-label::after) {
    display: none;
}

::v-deep(.ant-descriptions-small .ant-descriptions-row >th) {
    padding-bottom: 0px !important;
}

::v-deep(.ant-descriptions-small .ant-descriptions-row >td) {
    padding-top: 6px !important;
    padding-bottom: 16px !important;
}

.titleBox {
    width: -webkit-calc(100% - 24px);
    width: -moz-calc(100% - 24px);
    width: calc(100% - 24px);
    height: 32px;
    line-height: 32px;
    margin-left: 12px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.warning-box {
    width: 100%;
    height: 36px;
    line-height: 36px;
    border-radius: 4px;
    background: #196dfe1a;
    color: #777c85;
    font-size: 14px;
    font-weight: 400;
    font-family: "HarmonyOSSansSC";
    margin-top: 8px;
}

.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;
}

.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>