Files
hht-tongbo/pages/WarehouseManage/InStoreConfirm.vue
2022-11-09 13:30:32 +08:00

158 lines
3.8 KiB
Vue

<template>
<view class="zd_container">
<nav-bar title="生产入库"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">木箱</span>
</view>
<view class="filter_input_wraper">
<search-box
v-model="val1"
@handleChange="handleChange"
/>
</view>
</view>
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">点位</span>
</view>
<view class="filter_input_wraper">
<search-box
v-model="val2"
/>
</view>
</view>
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label filter_label_1"></span>
</view>
<view class="filter_input_wraper filter_input_wraper_1">
<view class="iconfont icon_unchecked" :class="{'icon_checked': isV === '1'}" @tap="isVirtual">&#xe66b;</view>
<view class="filter_input_wraper_inn_text">虚拟库</view>
</view>
</view>
</view>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>木箱码</th>
<th>子卷号</th>
<th>物料编码</th>
<th>物料名称</th>
<th>重量KG</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.package_box_SN === pkId}">
<td>{{e.package_box_SN}}</td>
<td>{{e.container_name}}</td>
<td>{{e.product_name}}</td>
<td>{{e.product_description}}</td>
<td>{{e.net_weight}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="submit-bar">
<button class="submit-button" :class="{'btn-disabled': !pkId}" :disabled="disabled" @tap="_stConfirm">入库确认</button>
<button class="submit-button" :class="{'btn-disabled': !pkId}" :disabled="disabled1" @tap="_stPrint">补码</button>
<button class="submit-button" @tap="_boxQuery(val1)">查询</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {boxQuery, stConfirm, stPrint} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
val1: '',
val2: '',
isV: '0',
dataList: [],
pkId: '',
pkObj: {},
disabled: false,
disabled1: false
};
},
methods: {
/** 虚拟库 */
isVirtual () {
this.isV = this.isV === '0' ? '1' : '0'
},
handleChange (e) {
this._boxQuery(e)
},
/** 初始化查询 */
async _boxQuery (e) {
let res = await boxQuery(e, '2')
this.dataList = [...res.data]
},
/** 确认 */
async _stConfirm () {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
try {
let res = await stConfirm(this.pkObj, this.val2, '2', this.isV)
uni.showToast({
title: res.message,
icon: 'none'
})
this.pkId = ''
this.pkObj = {}
this.disabled = false
this._boxQuery(this.val1)
} catch (e) {
this.disabled = false
}
},
/** 补码 */
async _stPrint () {
this.disabled1 = true
if (!this.pkId) {
this.disabled1 = false
return
}
try {
let res = await stPrint(this.pkObj)
uni.showToast({
title: res.message,
icon: 'none'
})
this.pkId = ''
this.pkObj = {}
this.disabled1 = false
this._boxQuery()
} catch (e) {
this.disabled1 = false
}
},
toCheck (e) {
this.pkId = this.pkId === e.package_box_SN ? '' : e.package_box_SN
this.pkObj = this.pkId === e.package_box_SN ? e : {}
}
}
}
</script>
<style lang="stylus">
</style>