Commit 8543d9e68bd23ad6cc2900924260ae3818c4f583

Authored by 史婷婷
1 parent 0e10e4d2

feat: 审核-运作科主管审核(yzkzg)-资信-授信额度可以填写0

Showing 1 changed file with 17 additions and 4 deletions
... ... @@ -93,8 +93,8 @@
93 93 </template>
94 94 <template v-slot:footer>
95 95 <view class="amount-row">
96   - <uni-easyinput type="digit" v-model="companyReview.companyCreditLimit"
97   - placeholder="请输入授信额度" :inputBorder="false" />
  96 + <uni-easyinput type="number" v-model="companyReview.companyCreditLimit"
  97 + placeholder="请输入授信额度" :inputBorder="false" @input="onCreditLimitInput" />
98 98 </view>
99 99 </template>
100 100 </uni-list-item>
... ... @@ -226,6 +226,19 @@ export default {
226 226 } catch (e) { }
227 227 },
228 228 methods: {
  229 + onCreditLimitInput(val) {
  230 + let value = String(val)
  231 + // 只允许数字和小数点
  232 + value = value.replace(/[^\d.]/g, '')
  233 + // 保证只有一个小数点
  234 + const parts = value.split('.')
  235 + if (parts.length > 2) {
  236 + value = parts[0] + '.' + parts.slice(1).join('')
  237 + }
  238 + this.$nextTick(() => {
  239 + this.companyReview.companyCreditLimit = value
  240 + })
  241 + },
229 242 async loadCategoryOptions() {
230 243 try {
231 244 const res = await getDicByCodeApi('CUSTOMER_CATEGORY')
... ... @@ -303,7 +316,7 @@ export default {
303 316 // 是否填写-公司评审信息
304 317 hsCompanyReview() {
305 318 // 结算期限 授信额度
306   - if (this.companyReview.companySettlementPeriod || this.companyReview.companyCreditLimit) {
  319 + if (this.companyReview.companySettlementPeriod || !['', null, undefined].includes(this.companyReview.companyCreditLimit)) {
307 320 return true
308 321 }
309 322 return false
... ... @@ -356,7 +369,7 @@ export default {
356 369 uni.showToast({ title: '请输入结算期限', icon: 'none' })
357 370 return
358 371 }
359   - if (!this.companyReview.companyCreditLimit) {
  372 + if (['', null, undefined].includes(this.companyReview.companyCreditLimit)) {
360 373 uni.showToast({ title: '请输入授信额度', icon: 'none' })
361 374 return
362 375 }
... ...