Commit fd538932 by cen

fix: 表单处理

1 parent 0616e6a5
......@@ -118,19 +118,19 @@ const signSecretKey = {
carBasrUrl: 'http://qcdidicb.glsx.com.cn/router'
},
beta: {
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
appKey: 'App_PromoteBusiness',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
carBasrUrl: 'http://didicb.glsx.com.cn/router'
},
prod: {
appKey: 'd7ffc3346fc9a45bccaaa35300d59022',
secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353',
appKey: 'App_PromoteBusiness',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
carBasrUrl: 'http://didicb.glsx.com.cn/router'
},
pet: {
appKey: 'd7ffc3346fc9a45bccaaa35300d59022',
secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353',
carBasrUrl: 'http://didicb.glsx.com.cn/router'
appKey: 'App_PromoteBusiness',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
carBasrUrl: 'http://qcdidicb.glsx.com.cn/router'
}
}[target[index]]
......
......@@ -190,7 +190,7 @@ export default {
const filteredValue = value.replace(/[^\d]/g, '')
console.log('filteredValue', filteredValue)
// 确保是正整数(大于0)
const positiveIntValue = filteredValue && parseInt(filteredValue, 10) > 0 ? filteredValue : ''
const positiveIntValue = filteredValue && parseInt(filteredValue, 10) >= 1 ? filteredValue : ''
console.log('positiveIntValue', positiveIntValue)
if (positiveIntValue !== value) {
if (field.targetObj) {
......@@ -231,6 +231,23 @@ export default {
handleBlur(e, field) {
console.log('handleBlur', e, field)
let value = e.target?._value?.trim() || e.target?.value?.trim()
if (field.key === 'depositPrice') {
// 过滤掉所有非数字字符
const filteredValue = value.replace(/[^\d]/g, '')
console.log('filteredValue', filteredValue)
// 确保是正整数(大于0)
const positiveIntValue = filteredValue && parseInt(filteredValue, 10) >= 1 ? filteredValue : ''
console.log('positiveIntValue', positiveIntValue)
if (positiveIntValue !== value) {
if (field.targetObj) {
this.formData[field.targetObj][field.targetKey] = positiveIntValue
} else {
this.formData[field.targetKey] = positiveIntValue
}
return
}
}
if (field.targetObj) {
if (this.formData[field.targetObj]) {
this.formData[field.targetObj][field.targetKey] = value
......
......@@ -1134,13 +1134,6 @@ export default {
if (finalPrice > 0) {
this.formData.finalPrice = finalPrice
} else {
// 定金不能大于评估价
this.formData.depositPrice = ''
this.formData.finalPrice = 0
uni.showToast({
title: '定金不能大于评估价',
icon: 'none'
})
}
},
......@@ -1152,7 +1145,7 @@ export default {
// 输入无效时,恢复原始值
this.$set(this.formData, field.targetKey, originalValue)
uni.showToast({
title: field.label + '只能输入数字',
title: field.label + '只能输入正整数',
icon: 'none'
})
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!