emis-app/pages/tms/coPackingScanning.vue
2024-06-14 16:50:18 +08:00

150 lines
4.2 KiB
Vue

<template>
<tpx-page>
<tpx-layout>
<template v-slot:body>
<view class="blcok-white-noradius" style="margin-top: 0;">
<u-row justify="between">
<view style="flex:1;">
<tpx-scan-input v-model:value="submitParam.billCode" placeholder="请输入或扫码"
@change="handleScanValChange" iconPos="left"></tpx-scan-input>
</view>
</u-row>
<u-row custom-style="margin-top:20rpx;">
<view style="flex: 1;">
<tpx-select v-model:resObject="siteRes" :getListFun="getNextStationList" :transKeyVal="{valKey: 'destSite',titleKey: 'destSiteName'}" v-model:value="submitParam.preOrNextStationCode" mode="drop" placeholder="请选择下一网点"></tpx-select>
</view>
</u-row>
<u-row custom-style="margin-top:20rpx;">
<view style="flex: 1;">
<tpx-select v-model:resObject="cpackRes" :getListFun="getPackCodeList" :transKeyVal="{valKey: 'packNo',titleKey: 'packNo'}" v-model:value="submitParam.bagNo" mode="drop" placeholder="请选择合包号"></tpx-select>
</view>
</u-row>
</view>
<view class="blcok-white-noradius">
<bo-operator-tmp :list="resData.list">
<template v-slot:titleRight>
</template>
</bo-operator-tmp>
</view>
<view class="blcok-white-noradius">
<bo-scanlist-tmp :resData="resData"></bo-scanlist-tmp>
</view>
</template>
<!-- <template v-slot:footer>
<view class="pos-rlt blcok-white" style="border-radius: 0;margin-top: 0;">
<u-row>
<u-button size="large" shape="circle"
custom-style="width: 500rpx;height:80rpx;font-size: 30rpx;" type="primary">打印合包条码</u-button>
</u-row>
</view>
</template> -->
</tpx-layout>
</tpx-page>
</template>
<script>
import { debounce } from "@/common/util"
import dayjs from "dayjs"
import BoOperatorTmp from "@/components/buns-order-templates/bo-operator-tmp"
import BoScanlistTmp from "@/components/buns-order-templates/bo-scanlist-tmp"
import * as apiService from "@/common/api"
import { scanTypeEnum, getScanParams, ansScanResponse } from "@/common/scanUtil"
import { checkParams } from "@/common/validate"
export default {
components:{ BoOperatorTmp, BoScanlistTmp },
props: {
// hasLeftWin: {
// type: Boolean
// }
},
computed: {
},
data() {
return {
queryOption: {
billCode: '', // 运单id
},
resData: { list: [] },
siteRes: { list: [] },
cpackRes: { list: [] },
submitParam: {
billCode: '',
preOrNextStationCode: '',
},
submitValidConfig: {
preOrNextStationCode: { required: true, requiredMsg: '请选择下一网点' },
bagNo: { required: true, requiredMsg: '请选择合包号' },
billCode: { required: true, requiredMsg: '运单号不能为空' },
},
}
},
onShareAppMessage() {
return {
}
},
onLoad(option) {
this.queryOption = option
this.initData();
},
onUnload() {
},
methods: {
getNextStationList: apiService.getNextStationList,
getPackCodeList: apiService.getPackCodeList,
initData() {
this.submitParam.billCode = this.queryOption.billCode
},
async handleSubmit(val) {
let extParam = {}
val && (extParam.billCode = val);
await checkParams(this.submitParam, this.submitValidConfig)
let scnParam = getScanParams(scanTypeEnum.heBao, { ...this.submitParam, ...extParam })
let res = await apiService.scanRecord({...scnParam, _loading: true})
let { bl, resItem } = ansScanResponse({ res, title: "合包" })
if(bl) {
this.curScanItem = resItem
this.resData.list.unshift({ ...resItem })
this.resetForm()
}
},
handleScanValChange: debounce(function(val){
val && (this.handleSubmit(val))
}),
resetForm() {
this.submitParam.billCode = ''
this.submitParam.preOrNextStationCode = ''
}
}
}
</script>
<style lang="scss">
@import '@/common/uni-nvue.scss';
page {
background-color: #F6F6F6;
height: 100% !important;
}
</style>
<style scoped lang="scss">
.yditem{
margin-top: 20rpx;
padding: 20rpx;
border-radius: 20rpx;
background-color: #F6F6F6;
&:first-child{
margin-top: 0;
}
.lbwth{
display: inline-block;
width: 120rpx;
}
}
</style>