Files
hht-longdianningxin-uni/pages/manage/tube-core-storage.vue
2024-09-13 15:31:19 +08:00

116 lines
2.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="zd_container">
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">管芯规格</span>
</view>
<view class="zd-col-17 filter_select">
<zxz-uni-data-select v-model="index" filterable :localdata="options"></zxz-uni-data-select>
</view>
</view>
<view class="zd-row">
<view class="zd-col-5">
<span class="filter_label">管芯数量</span>
</view>
<view class="zd-col-19">
<input v-model=" val1" type="number" class="filter_input" @blur="handleBlur">
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-7 button-default" @tap="clearUp">清空</button>
<button class="zd-col-15 button-primary" :class="{'button-info': !val1 || index === ''}" :disabled="disabled" @tap="_gxconfirmedInStorage">确认入库</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {gxgetGxSpecification, gxremainingQty, gxconfirmedInStorage} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
index: '',
options: [],
val1: '',
qty: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
this._gxgetGxSpecification()
},
methods: {
async _gxgetGxSpecification () {
let res = await gxgetGxSpecification()
this.options = [...res]
},
async _gxremainingQty () {
let res = await gxremainingQty()
this.qty = res.qty
if (Number(this.val1) > Number(this.qty)) {
uni.showToast({
title: '管芯库空位不足!',
icon: 'none'
})
this.val1 = ''
}
},
handleBlur () {
if (this.val1 !== '') {
this._gxremainingQty()
} else if (Number(this.val1) > 5) {
uni.showToast({
title: '一次性最多只能入5根管芯',
icon: 'none'
})
this.val1 = ''
}
},
clearUp () {
this.val1 = ''
this.index = ''
this.qty = ''
this.disabled = false
},
async _gxconfirmedInStorage () {
this.disabled = true
if (!this.val1 || this.index === '') {
this.disabled = false
return
}
let material_spec = ''
this.options.map(el => {
if (el.value === this.index) {
material_spec = el.text
}
})
try {
let res = await gxconfirmedInStorage(this.val1, this.index, material_spec)
this.clearUp()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus">
</style>