Files
hht-longdianningxin-uni/pages/manage/tube-core-storage.vue

116 lines
2.8 KiB
Vue
Raw Normal View History

<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>
2024-09-13 15:31:19 +08:00
<view class="zd-row">
<view class="zd-col-5">
<span class="filter_label">管芯数量</span>
</view>
<view class="zd-col-19">
2024-09-13 15:31:19 +08:00
<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>
2024-09-13 15:31:19 +08:00
<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
2024-09-13 15:31:19 +08:00
if (Number(this.val1) > Number(this.qty)) {
uni.showToast({
title: '管芯库空位不足!',
icon: 'none'
})
2024-09-13 15:31:19 +08:00
this.val1 = ''
}
},
handleBlur () {
2024-09-13 15:31:19 +08:00
if (this.val1 !== '') {
this._gxremainingQty()
2024-09-13 15:31:19 +08:00
} else if (Number(this.val1) > 5) {
uni.showToast({
title: '一次性最多只能入5根管芯',
icon: 'none'
})
2024-09-13 15:31:19 +08:00
this.val1 = ''
}
},
clearUp () {
this.val1 = ''
this.index = ''
this.qty = ''
this.disabled = false
},
async _gxconfirmedInStorage () {
this.disabled = true
2024-09-13 15:31:19 +08:00
if (!this.val1 || this.index === '') {
this.disabled = false
return
}
2024-09-13 15:31:19 +08:00
let material_spec = ''
this.options.map(el => {
if (el.value === this.index) {
material_spec = el.text
}
})
try {
2024-09-13 15:31:19 +08:00
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>