Files
hht-hdyy-uni/pages/hdyy/scgl/md-xialiao.vue
2026-02-01 09:49:01 +08:00

104 lines
2.6 KiB
Vue

<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-6">
<span class="filter_label">物料编码</span>
</view>
<view class="zd-col-13">
<search-box v-model="materialData.material_code"/>
</view>
<button class="mini-btn" type="primary" @tap="toJump('material?title=物料维护')">查询</button>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">盒数</span>
</view>
<view class="zd-col-24">
<input type="number" v-model="num" class="filter_input">
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">当前点位</span>
</view>
<view class="zd-col-24 filter_select">
<search-box
v-model="val1"
/>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-5 button-default" @tap="toEmpty">清空</button>
<button class="zd-col-18 button-primary" :class="{'button-info': !val1 || !materialData.material_code || !num}" :disabled="disabled" @tap="_palletizingDown">下料</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {palletizingDown} from '@/utils/getData3.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
val1: '',
materialData: {},
num: null,
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
onShow () {
if (this.$store.getters.publicObj !== '') {
this.materialData = this.$store.getters.publicObj
this.$store.dispatch('setPublicObj', '')
}
},
methods: {
toJump (name) {
uni.navigateTo({
url: `/pages/hdyy/wbc/${name}`
})
},
toEmpty () {
this.val1 = ''
this.num = null
this.materialData = {}
this.disabled = false
},
async _palletizingDown () {
this.disabled = true
if (!this.val1 || !this.materialData.material_code || !this.num) {
this.disabled = false
return
}
try {
let res = await palletizingDown(this.val1, this.materialData.material_code, this.num)
if (res) {
uni.showToast({
title: res.message,
icon: 'none'
})
}
this.toEmpty()
this.disabled = false
} catch (e) {
this.disabled = false
}
}
}
}
</script>