diff --git a/src/mixins/index.js b/src/mixins/index.js
index b3b678b..59cadca 100644
--- a/src/mixins/index.js
+++ b/src/mixins/index.js
@@ -8,13 +8,13 @@
*/
import { mapGetters, mapActions } from "vuex";
export default {
- nstall(Vue) {
+ install(Vue) {
Vue.mixin({
computed: {
...mapGetters(['getScoreData'])
},
methods: {
- ...mapActions(['setScoreData',]),
+ ...mapActions(['setScoreData'])
},
filters: {
diff --git a/src/views/Scoresituation/index.vue b/src/views/Scoresituation/index.vue
index ed248f1..b2bad34 100644
--- a/src/views/Scoresituation/index.vue
+++ b/src/views/Scoresituation/index.vue
@@ -9,19 +9,19 @@
{{initData.surface}}
{{initData.Sheet}}
{{initData.rePart}}
- {{initData.engine}}
- {{accident}}
+ {{initData.transmission}}
+ {{initData.accident|filterAccident}}
{{initData.maintain}}
- {{initData.total}}
- {{state}}{{numerical}}
+ {{initData.total.toFixed(1)}}
+ {{filterCarStatus(initData.total)}}
- 完成
+ 完成
@@ -35,40 +35,67 @@ export default {
surface: "",
Sheet: "",
rePart: "",
- engine: "",
+ transmission: "",
maintain: "",
total: "",
+ accident: "",
},
- accident: "",
state: "",
numerical: "",
+ warn: false,
};
},
methods: {
- onSubmit() {
- let state = state;
- // if (initData.total >= 80 && initData.total <= 100) {
- // state = "优秀";
- // } else if (initData.total >= 50 && initData.total <= 70) {
- // state = "良好";
- // } else if (initData.total >= 20 && initData.total <= 20) {
- // state = "一般";
- // }
- // let numerical = numerical;
- // if ((state = 100 && state >= 70 && state >= 40)) {
- // numerical = "最高值";
- // } else if (state > 90 && state >= 50 && state >= 30) {
- // numerical = "中间值";
- // } else if (state > 80 && state >= 50 && state >= 20) {
- // numerical = "最低值";
- // }
- console.log("submit!");
+ filterCarStatus(score) {
+ let numerical = null;
+ if (score >= 100) {
+ numerical = "优秀最高值";
+ } else if (score >= 90) {
+ numerical = "优秀中间值";
+ } else if (score >= 80) {
+ numerical = "优秀最低值";
+ } else if (score >= 70) {
+ numerical = "良好最高值";
+ } else if (score >= 60) {
+ numerical = "良好中间值";
+ } else if (score >= 50) {
+ numerical = "良好最低值";
+ } else if (score >= 40) {
+ numerical = "一般最高值";
+ } else if (score >= 30) {
+ numerical = "一般中间值";
+ } else {
+ numerical = "一般最低值";
+ }
+ return numerical;
+ },
+ // 处理重大事故
+ accidentChange(val) {
+ if (val.includes(1)) {
+ this.initData.total = 20;
+ } else {
+ this.warn = true;
+ }
},
},
created() {
- // this.initData = this.getScoreData;
- console.log(this.initData);
+ this.initData = this.getScoreData;
+ },
+ filters: {
+ filterAccident(val = []) {
+ let str = "";
+ if (val.includes(2)) {
+ str = "安全气囊弹出7折";
+ } else if (val.length === 0) {
+ str = "无";
+ } else {
+ str = "发生重大事故";
+ }
+ return str;
+ },
},
+
+
};
diff --git a/src/views/Vehicleevaluation/index.vue b/src/views/Vehicleevaluation/index.vue
index 7f1274b..38f1b41 100644
--- a/src/views/Vehicleevaluation/index.vue
+++ b/src/views/Vehicleevaluation/index.vue
@@ -4,7 +4,7 @@
-
+
@@ -16,7 +16,8 @@
- 万公里
+
+ 万公里
@@ -78,7 +79,7 @@
-
+
如有以下情况则视为重大事故:发生纵梁修复、安全气囊弹出、车子四梁六、柱发生修复、后翼子板切割直接扣80分
@@ -93,8 +94,8 @@
-
-
+ 是
+ 否
@@ -115,7 +116,7 @@ export default {
month: "",
name: "",
frequency: "",
- Kilometers: "",
+ Kilometers: undefined,
surface: "",
Sheet: "",
tick: [],
@@ -280,36 +281,40 @@ export default {
],
totalMonth: 0,
coefficient: "",
+ total: 0
};
},
methods: {
- accidentChange(val) {
- console.log(val);
- },
onSubmit() {
//过户得分
let frequency = 10 - this.form.frequency;
//油漆面得分
- let surface = 10 - this.form.surface;
+ let surface = (11 - this.form.surface) <=0 ? 0 : (11 - this.form.surface);
//钣金面得分
- let Sheet = 10 - this.form.Sheet;
+ let Sheet = (11 - this.form.Sheet*2) <= 0 ? 0 : (11 - this.form.Sheet*2);
//公里数得分
let Kilometers = 0;
if (this.form.Kilometers && this.form.month) {
const m1 = moment(moment().format("YYYY-MM-DD HH:mm:ss"));
const m2 = moment(this.form.month);
let { _data } = moment.duration(m1.diff(m2));
- this.totalMonth = _data.months;
- let k = (this.form.Kilometers * 10000) / _data.months;
- if (k === Infinity) {
- Kilometers = 15;
+ console.log(_data)
+ this.totalMonth = _data.years*12 + _data.months + 1;
+ console.log(this.totalMonth)
+ let k = (this.form.Kilometers * 10000) / this.totalMonth;
+ let x = (k - 1250) / 125;
+ let y = 0;
+ if(x > 0) {
+ y = Math.round(x);
} else {
- Kilometers = 15 - (k - 1250) / 125;
+ y = Math.floor(x*-1)*-1;
}
+ Kilometers = 15 - y;
Kilometers = Kilometers <= 0 ? 0 : Kilometers;
} else {
Kilometers = 0;
}
+ console.log(Kilometers)
// 更换件
let rePart = 13;
if (this.form.tick.length === 0) {
@@ -340,34 +345,28 @@ export default {
rePart = rePart <= 0 ? 0 : rePart;
}
//变速箱状态
- let engine = 40;
+ let transmission = 40;
if (this.form.transmission === 1) {
- engine -= 5;
+ transmission -= 5;
} else if (this.form.transmission === 2) {
- engine -= 20;
+ transmission -= 20;
+ } else if (this.form.transmission === 3) {
+ transmission -= 40;
} else {
- engine -= 40;
+ transmission = 40;
}
- engine = engine <= 0 ? 0 : engine;
+ transmission = transmission <= 0 ? 0 : transmission;
//保养
let maintain = 0;
if (this.form.maintain === 1) {
maintain = 5;
}
-
- //重大事故
- if (this.form.accident.findIndex(1) != -1) {
- total = 20;
- }
- if (this.form.accident.findIndex(2) != -1) {
- this.warn = true;
- }
//年份系数
let year = this.totalMonth / 12;
if (this.totalMonth / 12 != 0) {
year++;
}
- let coefficient = coefficient;
+ let coefficient = 0;
if (year <= 3) {
coefficient = 1;
} else if (year <= 8) {
@@ -378,29 +377,29 @@ export default {
coefficient = 0.7;
}
//总分
- let total =
+ this.total =
(frequency +
surface +
Sheet +
Kilometers +
rePart +
- engine +
+ transmission +
maintain) *
coefficient;
- console.log("total score = " + total);
+
let obj = {
frequency: frequency,
surface: surface,
Sheet: Sheet,
Kilometers: Kilometers,
rePart: rePart,
- engine: engine,
+ transmission: transmission,
maintain: maintain,
- total: total,
+ total: this.total,
+ accident: this.form.accident,
};
-
this.setScoreData(obj);
- this.elForm = this.$router.push("/Scoresituation");
+ this.$router.push("/Scoresituation");
},
},
};
diff --git a/vue.config.js b/vue.config.js
new file mode 100644
index 0000000..f75b613
--- /dev/null
+++ b/vue.config.js
@@ -0,0 +1,3 @@
+module.exports = {
+ lintOnSave: false, // 关闭 eslint 检查
+ }
\ No newline at end of file