Commit 27e1dbfb authored by Zhang Xiaojie's avatar Zhang Xiaojie

fix:贷款筛选输入限制

parent ca006bb0
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<div class="word24"> <div class="word24">
<input <input
v-model.number="min_" v-model.number="min_"
@blur="checkMin1" @blur="checkInterstValid"
type="number" type="number"
placeholder="最低利率" placeholder="最低利率"
class="bg-transparent w-full text-center" class="bg-transparent w-full text-center"
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<input <input
type="number" type="number"
v-model.number="max_" v-model.number="max_"
@blur="checkMax1" @blur="checkInterstValid"
placeholder="最高利率" placeholder="最高利率"
class="bg-transparent w-full text-center" class="bg-transparent w-full text-center"
/> />
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<div class="word24"> <div class="word24">
<input <input
v-model.number="min_2" v-model.number="min_2"
@blur="checkMin2" @blur="checkAmountValid"
type="number" type="number"
placeholder="0" placeholder="0"
class="bg-transparent w-full text-center" class="bg-transparent w-full text-center"
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
<input <input
type="number" type="number"
v-model.number="max_2" v-model.number="max_2"
@blur="checkMax2" @blur="checkAmountValid"
placeholder="9999" placeholder="9999"
class="bg-transparent w-full text-center" class="bg-transparent w-full text-center"
/> />
...@@ -89,9 +89,11 @@ ...@@ -89,9 +89,11 @@
<script lang="ts"> <script lang="ts">
import { defineComponent } from "vue"; import { defineComponent } from "vue";
import SelectList from "@/components/SelectList/index.vue"; import SelectList from "@/components/SelectList/index.vue";
import { Toast } from "vant";
export default defineComponent({ export default defineComponent({
components: { components: {
SelectList, SelectList,
Toast,
}, },
props: { props: {
bankList: Array, bankList: Array,
...@@ -123,17 +125,38 @@ export default defineComponent({ ...@@ -123,17 +125,38 @@ export default defineComponent({
type: Function, type: Function,
required: true, required: true,
}, },
checkInterstValid: {
type: Function,
required: true,
},
checkAmountValid: {
type: Function,
required: true,
},
}, },
methods:{ methods: {
checkMin1(){ // checkInterstValid(): boolean {
if(this.min_){ // let isValid = false;
console.log('blur'); // if (this.max && this.min) {
this.setMin(this.min); // isValid = false;
console.log('blur',this.min,this.min_); // if (this.max <= this.min) Toast.fail("最高利率必须大于最低利率");
// } else {
// this.min_ = +Number.parseFloat(this.min_ as string).toFixed(2) // isValid = true;
} // }
} // return isValid;
// },
// checkAmountValid(): boolean {
// let isValid = false;
// if (this.max2 && this.min2) {
// if (this.max2 <= this.min2) {
// isValid = false;
// Toast.fail("最高额度必须大于最低额度");
// } else {
// isValid = true;
// }
// }
// return isValid;
// },
}, },
computed: { computed: {
min_: { min_: {
......
...@@ -50,13 +50,14 @@ ...@@ -50,13 +50,14 @@
:setSelectedTypes="(v) => (selectedTypes = v)" :setSelectedTypes="(v) => (selectedTypes = v)"
:min="min" :min="min"
:max="max" :max="max"
:setMin="(v) => (min = +Number.parseFloat(v).toFixed(2))" :setMin="(v) => (min = +Number.parseFloat(v).toFixed(2))"
:setMax="(v) => (max = +Number.parseFloat(v).toFixed(2))" :setMax="(v) => (max = +Number.parseFloat(v).toFixed(2))"
:min2="min2" :min2="min2"
:max2="max2" :max2="max2"
:setMin2="(v) => (min2 = v)" :setMin2="(v) => (min2 = v)"
:setMax2="(v) => (max2 = v)" :setMax2="(v) => (max2 = v)"
:checkInterstValid="checkInterstValid"
:checkAmountValid="checkAmountValid"
/> />
</PopUp> </PopUp>
</div> </div>
...@@ -85,7 +86,7 @@ import { ...@@ -85,7 +86,7 @@ import {
} from "@/service/LoanProductService/index"; } from "@/service/LoanProductService/index";
import { simpleItemInfo } from "@/views/withMenu/Loan/types"; import { simpleItemInfo } from "@/views/withMenu/Loan/types";
import { iLoanProdcutItem } from "@/service/LoanProductService/type"; import { iLoanProdcutItem } from "@/service/LoanProductService/type";
import { Skeleton } from "vant"; import { Skeleton,Toast } from "vant";
import { import {
loanSearchState, loanSearchState,
setSearchResult, setSearchResult,
...@@ -100,6 +101,7 @@ export default defineComponent({ ...@@ -100,6 +101,7 @@ export default defineComponent({
LoanCard, LoanCard,
LoanFilter, LoanFilter,
Skeleton, Skeleton,
Toast
}, },
setup() { setup() {
const mode = ref(+useRoute().params.mode); const mode = ref(+useRoute().params.mode);
...@@ -236,6 +238,28 @@ export default defineComponent({ ...@@ -236,6 +238,28 @@ export default defineComponent({
setShow(v: boolean) { setShow(v: boolean) {
this.show = v; this.show = v;
}, },
checkInterstValid(): boolean {
let isValid = false;
if (this.max && this.min) {
isValid = false;
if (this.max <= this.min) Toast.fail("最高利率必须大于最低利率");
} else {
isValid = true;
}
return isValid;
},
checkAmountValid(): boolean {
let isValid = false;
if (this.max2 && this.min2) {
if (this.max2 <= this.min2) {
isValid = false;
Toast.fail("最高额度必须大于最低额度");
} else {
isValid = true;
}
}
return isValid;
},
showFilter() { showFilter() {
this.show = true; this.show = true;
this.selectedBanks = this.reqParams.selectedBanks; this.selectedBanks = this.reqParams.selectedBanks;
...@@ -281,8 +305,10 @@ export default defineComponent({ ...@@ -281,8 +305,10 @@ export default defineComponent({
min2: this.min2, min2: this.min2,
max2: this.max2, max2: this.max2,
}; };
this.queryList(); if(this.checkAmountValid() && this.checkInterstValid()){
this.show = false; this.queryList();
this.show = false;
}
}, },
queryList() { queryList() {
this.loading = true; this.loading = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment