This commit is contained in:
2025-08-08 14:48:28 +08:00
parent ac754eb113
commit 631502f610
6 changed files with 45 additions and 11 deletions

View File

@@ -26,7 +26,7 @@
</view>
<view class="zd-col-12">
<!-- <search-box v-model="code" @handleChange="handleChange1" @handleDel="handleDel1" /> -->
<input type="text" class="filter_input" v-model="val3" disabled>
<input type="number" class="filter_input" v-model="val3" @blur="handleBlur(e)">
</view>
<button class="mini-btn" type="primary" size="mini" @tap="_getWeight">获取重量</button>
</view>
@@ -82,7 +82,7 @@
</table>
</view>
</view>
<uni-load-more color="#007AFF" iconType="circle" :status="status" :icon-size="14" :content-text="contentText" v-if="dataList.length > 0"/>
<!-- <uni-load-more color="#007AFF" iconType="circle" :status="status" :icon-size="14" :content-text="contentText" v-if="dataList.length > 0"/> -->
</view>
<view class="zd-row submit-bar">
<button class="zd-col-11 button-primary" :class="{'button-info': !this.index2}" @tap="seachList">查询工单</button>
@@ -145,6 +145,34 @@
this._regionList()
},
methods: {
handleBlur (e) {
if (this.val3) {
if (this.val3 < 0) {
this.val3 = 0
} else {
// 1. 过滤非法字符
// this.val3 = this.val3.replace(/[^0-9]/g, '')
// this.val3 = this.val3.replace(/^0+/, '') || '0'
// this.val3 = this.val3.replace(/^0+/, '')
// 4. 处理多个0开头的情况
if (/^0+[1-9]/.test(this.val3)) {
// 如果0后面跟着非零数字去掉前导零
this.val3 = this.val3.replace(/^0+/, '');
} else if (/^0+$/.test(this.val3)) {
// 如果全是0只保留一个0
this.val3 = '0';
} else if (/^0+\./.test(this.val3)) {
// 处理0.xxx的情况去掉整数部分多余的0
this.val3 = '0.' + this.val3.replace(/^0+\./, '');
}
}
} else {
// uni.showToast({
// title: '数量必填',
// icon: 'none'
// })
}
},
async _regionList () {
try {
let res = await regionList()
@@ -238,7 +266,10 @@
}
let res = await getWeight(this.index2, this.pkId)
if (res.code === '200') {
console.log(11111)
uni.showToast({
title: res.message,
icon: 'none'
})
this.val3 = res.data.weight
this.flag = res.data.flag
this.dupWeight = res.data.weight