Commit fd538932 by cen

fix: 表单处理

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