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

fix:贷款筛选输入限制

parent ca006bb0
......@@ -14,7 +14,7 @@
<div class="word24">
<input
v-model.number="min_"
@blur="checkMin1"
@blur="checkInterstValid"
type="number"
placeholder="最低利率"
class="bg-transparent w-full text-center"
......@@ -30,7 +30,7 @@
<input
type="number"
v-model.number="max_"
@blur="checkMax1"
@blur="checkInterstValid"
placeholder="最高利率"
class="bg-transparent w-full text-center"
/>
......@@ -46,7 +46,7 @@
<div class="word24">
<input
v-model.number="min_2"
@blur="checkMin2"
@blur="checkAmountValid"
type="number"
placeholder="0"
class="bg-transparent w-full text-center"
......@@ -61,7 +61,7 @@
<input
type="number"
v-model.number="max_2"
@blur="checkMax2"
@blur="checkAmountValid"
placeholder="9999"
class="bg-transparent w-full text-center"
/>
......@@ -89,9 +89,11 @@
<script lang="ts">
import { defineComponent } from "vue";
import SelectList from "@/components/SelectList/index.vue";
import { Toast } from "vant";
export default defineComponent({
components: {
SelectList,
Toast,
},
props: {
bankList: Array,
......@@ -123,17 +125,38 @@ export default defineComponent({
type: Function,
required: true,
},
checkInterstValid: {
type: Function,
required: true,
},
checkAmountValid: {
type: Function,
required: true,
},
},
methods:{
checkMin1(){
if(this.min_){
console.log('blur');
this.setMin(this.min);
console.log('blur',this.min,this.min_);
// this.min_ = +Number.parseFloat(this.min_ as string).toFixed(2)
}
}
methods: {
// 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;
// },
},
computed: {
min_: {
......
......@@ -50,13 +50,14 @@
:setSelectedTypes="(v) => (selectedTypes = v)"
:min="min"
:max="max"
:setMin="(v) => (min = +Number.parseFloat(v).toFixed(2))"
:setMax="(v) => (max = +Number.parseFloat(v).toFixed(2))"
:min2="min2"
:max2="max2"
:setMin2="(v) => (min2 = v)"
:setMax2="(v) => (max2 = v)"
:checkInterstValid="checkInterstValid"
:checkAmountValid="checkAmountValid"
/>
</PopUp>
</div>
......@@ -85,7 +86,7 @@ import {
} from "@/service/LoanProductService/index";
import { simpleItemInfo } from "@/views/withMenu/Loan/types";
import { iLoanProdcutItem } from "@/service/LoanProductService/type";
import { Skeleton } from "vant";
import { Skeleton,Toast } from "vant";
import {
loanSearchState,
setSearchResult,
......@@ -100,6 +101,7 @@ export default defineComponent({
LoanCard,
LoanFilter,
Skeleton,
Toast
},
setup() {
const mode = ref(+useRoute().params.mode);
......@@ -236,6 +238,28 @@ export default defineComponent({
setShow(v: boolean) {
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() {
this.show = true;
this.selectedBanks = this.reqParams.selectedBanks;
......@@ -281,8 +305,10 @@ export default defineComponent({
min2: this.min2,
max2: this.max2,
};
this.queryList();
this.show = false;
if(this.checkAmountValid() && this.checkInterstValid()){
this.queryList();
this.show = false;
}
},
queryList() {
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