This commit is contained in:
aihe 2024-06-15 14:53:59 +08:00
parent 6a608adb00
commit 565f82069d
4 changed files with 30 additions and 11 deletions

View File

@ -19,12 +19,13 @@ export const scanTypeEnum = {
} }
export const getScanParams = (type, model = {})=> { export const getScanParams = (type, model = {})=> {
let scanDate = dayjs().format("YYYY-MM-DD HH:mm:ss")
return { return {
scanType: type, // 扫描类型 scanType: type, // 扫描类型
opType: 2, // 确认 动作 opType: model._opType || 2, // 动作, 1 检查; 2 确认
scanData: [{ scanData: [{
scanDate,
...model, ...model,
scanDate: dayjs().format("YYYY-MM-DD HH:mm:ss")
}] }]
} }
} }
@ -36,8 +37,10 @@ export const ansScanResponse = ({ res, title })=> {
let bl = false let bl = false
if(result == "success") { if(result == "success") {
bl = true bl = true
playAudio(audioTypeEnum.correct) if(title) {
title && showToast(`${title}成功`) playAudio(audioTypeEnum.correct)
showToast(`${title}成功`)
}
} else { } else {
switch (resItem?.message){ switch (resItem?.message){
case '重复扫描': case '重复扫描':
@ -47,7 +50,7 @@ export const ansScanResponse = ({ res, title })=> {
playAudio(audioTypeEnum.dotexist) playAudio(audioTypeEnum.dotexist)
break; break;
default: default:
playAudio(audioTypeEnum.networkError) // playAudio(audioTypeEnum.networkError)
break; break;
} }
showToast(resItem?.message || `${title}失败`) showToast(resItem?.message || `${title}失败`)

View File

@ -110,7 +110,11 @@
let daoRes = await apiService.scanRecord({...daoParam, _loading: true}) let daoRes = await apiService.scanRecord({...daoParam, _loading: true})
let { bl: daoBl, resItem: daoResItem } = ansScanResponse({ res: daoRes }) let { bl: daoBl, resItem: daoResItem } = ansScanResponse({ res: daoRes })
if(daoBl) { if(daoBl) {
let paiParam = getScanParams(scanTypeEnum.paiJian, { ...this.submitParam, ...extParam }) 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 paiRes = await apiService.scanRecord({...paiParam, _loading: true})
let { bl, resItem } = ansScanResponse({ res: paiRes, title: "到派件" }) let { bl, resItem } = ansScanResponse({ res: paiRes, title: "到派件" })
if(bl) { if(bl) {

View File

@ -105,8 +105,10 @@
initData() { initData() {
this.submitParam.billCode = this.queryOption.billCode || this.queryOption.orderSn this.submitParam.billCode = this.queryOption.billCode || this.queryOption.orderSn
}, },
handleScanValChange: debounce(function(val){ handleScanValChange: debounce(async function(val){
let scnParam = getScanParams(scanTypeEnum.qianShou, { ...this.submitParam, _opType: 1 })
let res = await apiService.scanRecord({...scnParam, _loading: true})
let { bl, resItem } = ansScanResponse({ res })
}), }),
async handleSubmit() { async handleSubmit() {
await checkParams(this.submitParam, this.submitValidConfig) await checkParams(this.submitParam, this.submitValidConfig)

View File

@ -5,7 +5,7 @@
<view class="blcok-white-noradius" style="margin-top: 0;"> <view class="blcok-white-noradius" style="margin-top: 0;">
<u-row justify="between"> <u-row justify="between">
<view style="flex:1;"> <view style="flex:1;">
<tpx-scan-input v-model:value="submitParam.billCode" placeholder="请输入或扫码" <tpx-scan-input v-model:value="submitParam.billCode" placeholder="运单号, 请输入或扫码"
@change="handleScanValChange" iconPos="left"></tpx-scan-input> @change="handleScanValChange" iconPos="left"></tpx-scan-input>
</view> </view>
</u-row> </u-row>
@ -16,9 +16,16 @@
</u-row> </u-row>
<u-row custom-style="margin-top:20rpx;"> <u-row custom-style="margin-top:20rpx;">
<view style="flex: 1;"> <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> <tpx-scan-input v-model:value="submitParam.bagNo" placeholder="合包号, 请输入或扫码"
iconPos="left"></tpx-scan-input>
</view>
<view class="pl-10">
<u-button @click="handleCreatePaNo()"
custom-style="font-size: 28rpx;padding:0 10rpx;height: 74rpx;" :plain="true" >系统生成</u-button>
</view> </view>
</u-row> </u-row>
<u-button custom-style="height:74rpx;font-size: 28rpx;margin-top: 30rpx;" type="primary">合包完成</u-button>
</view> </view>
<view class="blcok-white-noradius"> <view class="blcok-white-noradius">
@ -100,6 +107,9 @@
getPackCodeList: apiService.getPackCodeList, getPackCodeList: apiService.getPackCodeList,
initData() { initData() {
this.submitParam.billCode = this.queryOption.billCode this.submitParam.billCode = this.queryOption.billCode
},
async handleCreatePaNo() {
}, },
async handleSubmit(val) { async handleSubmit(val) {
let extParam = {} let extParam = {}
@ -115,7 +125,7 @@
} }
}, },
handleScanValChange: debounce(function(val){ handleScanValChange: debounce(function(val){
val && (this.handleSubmit(val))
}), }),
resetForm() { resetForm() {
this.submitParam.billCode = '' this.submitParam.billCode = ''