重量限制

This commit is contained in:
2025-11-13 09:52:06 +08:00
parent 6c635dd712
commit e8a2cf10fa
6 changed files with 89 additions and 9 deletions

View File

@@ -32,7 +32,7 @@
</view>
<view class="zd-row submit-bar">
<button class="zd-col-6 button-default" @tap="clearUp">清空</button>
<button class="zd-col-16 button-primary" :class="{'button-info': !index2 || (!qty && index4 === '1') || !index4}" :disabled="disabled" @tap="_checkoutbillBackMaterial">确认</button>
<button class="zd-col-16 button-primary" :class="{'button-info': !index2 || (!qty && index4 === '1') || !index4}" :disabled="disabled" @tap="toSure">确认</button>
</view>
</view>
</template>
@@ -104,12 +104,54 @@
} catch (e) {
}
},
async _checkoutbillBackMaterial () {
// async _checkoutbillBackMaterial () {
// this.disabled = true
// if (!this.index2 || (!this.qty && this.index4 === '1') || !this.index4) {
// this.disabled = false
// return
// }
// try {
// const qty = this.index4 !== '2' ? this.qty : null
// let res = await checkoutbillBackMaterial(this.index2, this.index4, qty)
// if (res.code === '200') {
// uni.showToast({
// title: res.message,
// icon: 'none'
// })
// this.clearUp()
// } else {
// uni.showToast({
// title: res.message,
// icon: 'none'
// })
// this.disabled = false
// }
// } catch (e) {
// this.disabled = false
// }
// }
toSure () {
this.disabled = true
if (!this.index2 || (!this.qty && this.index4 === '1') || !this.index4) {
this.disabled = false
return
}
if (Number(this.qty) > 2000) {
uni.showModal({
title: '提示',
content: '输入的重量'+ Number(this.qty) +'过大,是否继续?',
confirmColor: '#ff6a00',
success: (res) => {
if (res.confirm) {
this._checkoutbillBackMaterial()
} else if (res.cancel) {
this.disabled = false
}
}
})
}
},
async _checkoutbillBackMaterial () {
try {
const qty = this.index4 !== '2' ? this.qty : null
let res = await checkoutbillBackMaterial(this.index2, this.index4, qty)