1. 删除判断金额精度的冗余代码

This commit is contained in:
ssyang1993 2021-06-18 14:32:38 +08:00
parent 5fcfe4003f
commit 469840e5e9
1 changed files with 3 additions and 13 deletions

View File

@ -38,10 +38,10 @@
</a-col>
</a-row>
<a-form-model :rules="rules" :model="refund" ref="refundInfo" :layout="horizontal">
<a-form-model :rules="rules" :model="refund" ref="refundInfo" >
<a-form-model-item label="退款金额" prop="refundAmount">
<a-input v-model="refund.refundAmount" type="number" @keyup="handleInput2" style="flex-grow:1" />
<a-input-number v-model="refund.refundAmount" :precision="2" style="width:100%"/>
</a-form-model-item>
<a-form-model-item label="退款原因" prop="refundReason">
@ -59,7 +59,6 @@ export default {
data () {
return {
horizontal: 'horizontal',
recordId: '',
labelCol: { span: 4 },
wrapperCol: { span: 16 },
@ -91,16 +90,6 @@ export default {
}
},
methods: {
handleInput2 (e) {
// 0
e.target.value = e.target.value.replace(/\.{2,}/g, '.') // .
e.target.value = e.target.value.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')
e.target.value = e.target.value.replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3')//
if (e.target.value.indexOf('.') < 0 && e.target.value !== '') { // 0102
e.target.value = parseFloat(e.target.value)
}
this.refund.refundAmount = e.target.value // refundAmount
},
show (recordId) {
if (this.$refs.refundInfo !== undefined) {
this.$refs.refundInfo.resetFields()
@ -127,6 +116,7 @@ export default {
}).catch(err => {
console.log(err)
that.confirmLoading = false //
console.log(that.refund.refundAmount)
})
}
})