emis-app/pages/deliveryDeal/arriveDeliveryScanning.vue
2024-08-06 22:51:46 +08:00

165 lines
4.9 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="getPreStationList" :transKeyVal="{valKey: 'startSite',titleKey: 'startSiteName'}"
v-model:value="submitParam.preOrNextStationCode" mode="drop" placeholder="请选择上一网点" :minChecked="0"
:searchParam="siteSearchParam"
></tpx-select>
</view>
</u-row> -->
<u-row custom-style="margin-top:20rpx;">
<view style="flex: 1;">
<tpx-select v-model:value="submitParam.dispatchOrSendManCode" v-model:resObject="paiRes" :getListFun="getRSDStaffList" :transKeyVal="{valKey: 'empCode',titleKey: 'empName'}" placeholder="请选择派件员" mode="drop"></tpx-select>
</view>
</u-row>
<!-- <view class="mt-20 clr-sub">
当前件: 重量 <text class="clr-prm pr-40">{{curScanItem.billWeight || 0}}KG</text>
数量: <text class="clr-prm">{{curScanItem.parcelQty || 0}}件</text>
</view> -->
<view class="mt-30">
<u-button @click="handleSubmit()" type="primary" size="large" shape="square"
custom-style="height:80rpx;font-size: 30rpx;border-radius: 14rpx;">确定</u-button>
</view>
</view>
<view class="blcok-white-noradius">
<bo-operator-tmp :list="resData.list">
<template v-slot:titleRight>
<button @click="goto(`deliveryDeal/arriveList`)" size="mini">查看历史到件</button>
</template>
</bo-operator-tmp>
</view>
<view class="blcok-white-noradius">
<bo-scanlist-tmp :resData="resData"></bo-scanlist-tmp>
</view>
</template>
<template v-slot:footer>
</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: {
},
computed: {
siteSearchParam(){
return { destSite: this.$store.getters.userInfo.ownerSiteCode }
}
},
data() {
return {
paiRes: { list: [] } ,
submitParam: {
billCode: '',
// preOrNextStationCode: '',
dispatchOrSendManCode: '',
},
submitValidConfig: {
dispatchOrSendManCode: { required: true, requiredMsg: '请选择派件员' },
billCode: { required: true, requiredMsg: '运单号不能为空' },
},
pageLoading: true,
queryOption: {
billCode: '', // 运单id
orderSn: '', // 订单id
},
siteRes: { list: [] },
resData: {
list: []
},
curScanItem: {},
}
},
onShareAppMessage() {
return {
}
},
onLoad(option) {
this.queryOption = option
this.initData();
},
onUnload() {
},
methods: {
getPreStationList: apiService.getPreStationList,
getRSDStaffList: apiService.getRSDStaffList,
initData() {
this.submitParam.billCode = this.queryOption.billCode
},
async handleSubmit(val) {
let extParam = {}
val && (extParam.billCode = val);
await checkParams(this.submitParam, this.submitValidConfig)
let daoParam = getScanParams(scanTypeEnum.daoJian, { ...this.submitParam, ...extParam })
let daoRes = await apiService.scanRecord({...daoParam, _loading: true})
let { bl: daoBl, resItem: daoResItem } = ansScanResponse({ res: daoRes })
if(daoBl) {
let paiParam = getScanParams(scanTypeEnum.paiJian, {
scanDate: dayjs().add(10, 'minute').format("YYYY-MM-DD HH:mm:ss"), // 自定义扫描时间 +10min
...this.submitParam,
...extParam
})
let paiRes = await apiService.scanRecord({...paiParam, _loading: true})
let { bl, resItem } = ansScanResponse({ res: paiRes, 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 = ''
}
}
}
</script>
<style lang="scss">
@import '@/common/uni-nvue.scss';
page {
background-color: #F6F6F6;
height: 100% !important;
}
</style>
<style scoped lang="scss">
.yditem{
padding: 20rpx 0;
border-top: 2px solid #F6F6F6;
}
</style>