|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
<!--
|
|
|
|
|
* @Author: your name
|
|
|
|
|
* @Date: 2021-11-03 17:12:47
|
|
|
|
|
* @LastEditTime: 2021-11-05 14:32:56
|
|
|
|
|
* @LastEditTime: 2021-11-05 18:29:12
|
|
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
|
|
* @Description: In User Settings Editiv
|
|
|
|
|
* @FilePath: /data-show/src/views/MarketingComparison/mcBeginCompare.vue
|
|
|
|
@ -9,18 +9,18 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="d-container">
|
|
|
|
|
<div class="mbc-outter">
|
|
|
|
|
<mcChooseModel></mcChooseModel>
|
|
|
|
|
<mcChooseModel ref="modelRef" @del="handlerDel"></mcChooseModel>
|
|
|
|
|
<div class="mbc-inner">
|
|
|
|
|
<v-label-div title="车型推荐">
|
|
|
|
|
</v-label-div>
|
|
|
|
|
<div class="mbc-dd">
|
|
|
|
|
<ul class="mb-ul">
|
|
|
|
|
<li class="mbc-d-item" :class="chooseArr.includes(item) ? 'liActive': ''" v-for="(item,index) in models" :key="index" @click="handlerModel(item)">{{item}}</li>
|
|
|
|
|
<li class="mbc-d-item" :class="chooseArr.includes(item) ? 'liActive': ''" v-for="(item,index) in models" :key="index" @click="handlerModel(item)">{{item.seriesname}}</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<div style="clear: both"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="beCpm-footer">
|
|
|
|
|
<div class="beCpm-footer" @click="handlerSubmit">
|
|
|
|
|
开始对比
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -28,51 +28,74 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {getRecommendSeries} from "@/api/comm"
|
|
|
|
|
import mcChooseModel from "./mcChooseModel";
|
|
|
|
|
export default {
|
|
|
|
|
name: "mcBeginCompare",
|
|
|
|
|
components: {
|
|
|
|
|
mcChooseModel,
|
|
|
|
|
},
|
|
|
|
|
inject: ['reload'],
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
chooseArr: [],
|
|
|
|
|
form: {
|
|
|
|
|
token: ""
|
|
|
|
|
},
|
|
|
|
|
chooseArr: [null, null, null, null, null, null],
|
|
|
|
|
models: [
|
|
|
|
|
"奥迪A4",
|
|
|
|
|
"奥迪A6",
|
|
|
|
|
"奥迪S3",
|
|
|
|
|
"奥迪S4",
|
|
|
|
|
"奥迪RS3",
|
|
|
|
|
"奥迪RS4",
|
|
|
|
|
"宝马1系",
|
|
|
|
|
"宝马2系",
|
|
|
|
|
"宝马3系",
|
|
|
|
|
"宝马M5",
|
|
|
|
|
"宝马M4",
|
|
|
|
|
"宝马M3",
|
|
|
|
|
"本田凌派",
|
|
|
|
|
"本田雅阁",
|
|
|
|
|
"本田缤智",
|
|
|
|
|
"本田冠道",
|
|
|
|
|
"本田奥德赛",
|
|
|
|
|
"本田艾力绅",
|
|
|
|
|
"比亚迪宋PRO",
|
|
|
|
|
"比亚迪唐",
|
|
|
|
|
"比亚迪汉EV",
|
|
|
|
|
"比亚迪秦",
|
|
|
|
|
"比亚迪元",
|
|
|
|
|
"比亚迪宋Max",
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.form.token = this.getToken;
|
|
|
|
|
this.getData()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 选择默认的车型
|
|
|
|
|
handlerModel(ele) {
|
|
|
|
|
let n = this.chooseArr.findIndex((e) => e === ele);
|
|
|
|
|
if (n === -1 && this.chooseArr.length < 6) {
|
|
|
|
|
this.chooseArr.push(ele);
|
|
|
|
|
handlerModel(row) {
|
|
|
|
|
for(let i = 0; i < this.chooseArr.length; i++) {
|
|
|
|
|
if(!this.chooseArr[i]) {
|
|
|
|
|
this.chooseArr[i] = row;
|
|
|
|
|
let obj = this.$refs.modelRef.list[i]
|
|
|
|
|
obj.brand = row.brandname;
|
|
|
|
|
obj.model = row.seriesname;
|
|
|
|
|
obj.isDel = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
// 获取推荐车型
|
|
|
|
|
getData() {
|
|
|
|
|
let obj = Object.assign({}, this.form);
|
|
|
|
|
getRecommendSeries(obj).then(res => {
|
|
|
|
|
let data = res.data || [];
|
|
|
|
|
this.models = data;
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 删除
|
|
|
|
|
handlerDel(n) {
|
|
|
|
|
this.chooseArr[n] = null;
|
|
|
|
|
},
|
|
|
|
|
// 开始比对
|
|
|
|
|
handlerSubmit() {
|
|
|
|
|
let arr = this.$refs.modelRef.list || [];
|
|
|
|
|
let filterArr = arr.filter(ele => {
|
|
|
|
|
return ele.brand && ele.model
|
|
|
|
|
});
|
|
|
|
|
if(filterArr.length < 2) {
|
|
|
|
|
this.$message.warning('至少2个车型进行对比');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for(let i = 0; i < filterArr.length; i++) {
|
|
|
|
|
if(!filterArr[i].startTime || !filterArr[i].endTime) {
|
|
|
|
|
this.$message.warning('请选择时间');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.setSComparison(filterArr);
|
|
|
|
|
this.reload()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|