emis-app/pages/tms/untruckingScanning.vue
2024-08-05 18:13:59 +08:00

139 lines
4.0 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="请输入或扫码"
@scanChange="handleScanValChange" :showConfirm="true" @confirmClick="handleScanValChange" iconPos="left"></tpx-scan-input>
</view>
</u-row>
<u-row custom-style="margin-top:20rpx;">
<view style="flex: 1;">
<tpx-select v-model:value="submitParam.carNo" v-model:resObject="carRes"
:getListFun="getCarNoList" :transKeyVal="{valKey: 'carNo',titleKey: 'carNo'}"
mode="drop"
>
<tpx-input v-model:value="submitParam.carNo" placeholder="车牌号" :isWhite="true"></tpx-input>
</tpx-select>
</view>
</u-row>
<view class="mt-20">
<bpe-goodphoto-tmp :title="`卸车图片`" :value="submitParam" filedName="picUrl"></bpe-goodphoto-tmp>
</view>
<view class="mt-10">
<u-textarea v-model="submitParam.remark" border="surround" height="120" placeholder="备注"
maxlength="300" count></u-textarea>
</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"></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 BpeGoodphotoTmp from "@/components/buns-post-edit-templates/bpe-goodphoto-tmp"
import * as apiService from "@/common/api"
import { scanTypeEnum, getScanParams, ansScanResponse } from "@/common/scanUtil"
import { checkParams } from "@/common/validate"
export default {
components:{ BoOperatorTmp, BoScanlistTmp, BpeGoodphotoTmp },
props: {
},
computed: {
},
data() {
return {
submitParam: {
billCode: '',
carNo: '',
picUrl: [],
remark: '',
},
submitValidConfig: {
carNo: { required: true, requiredMsg: '车牌号不能为空' },
picUrl: { required: true, requiredMsg: `图片不能为空` },
// remark: { required: true, requiredMsg: '备注不能为空' },
billCode: { required: true, requiredMsg: '运单号不能为空' },
},
queryOption: {
billCode: '', // 运单id
},
pageLoading: true,
resData: { list: [] },
carRes: { list: [] },
curScanItem: {},
}
},
onLoad(option) {
this.queryOption = option
this.initData();
},
methods: {
getCarNoList: apiService.getCarNoList,
initData() {
this.submitParam.billCode = this.queryOption.billCode
},
async handleSubmit() {
let extParam = {}
await checkParams(this.submitParam, this.submitValidConfig)
// 转换图片格式
extParam.picUrl = this.submitParam.picUrl.join(",")
let scnParam = getScanParams(scanTypeEnum.xieChe, { ...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){
this.handleSubmit()
}),
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>