修改订单复核页面
This commit is contained in:
parent
0d35987428
commit
2ba214dde3
@ -1,4 +1,4 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
const { app, BrowserWindow, session } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
const devServerUrl = process.env.ELECTRON_RENDERER_URL
|
||||
@ -29,7 +29,34 @@ function createWindow() {
|
||||
win.loadFile(rendererEntry)
|
||||
}
|
||||
|
||||
function setupMediaPermissions() {
|
||||
const ses = session.defaultSession
|
||||
if (!ses) {
|
||||
return
|
||||
}
|
||||
|
||||
const mediaPermissions = new Set(['media', 'videoCapture', 'audioCapture', 'camera', 'microphone'])
|
||||
|
||||
ses.setPermissionCheckHandler((webContents, permission) => {
|
||||
if (mediaPermissions.has(permission)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
ses.setPermissionRequestHandler((webContents, permission, callback) => {
|
||||
callback(mediaPermissions.has(permission))
|
||||
})
|
||||
|
||||
if (typeof ses.setDevicePermissionHandler === 'function') {
|
||||
ses.setDevicePermissionHandler((details) => {
|
||||
return details.deviceType === 'videoCapture' || details.deviceType === 'audioCapture'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
setupMediaPermissions()
|
||||
createWindow()
|
||||
|
||||
app.on('activate', () => {
|
||||
|
||||
@ -1,42 +1,46 @@
|
||||
<template>
|
||||
<view class="top-nav" @click="closeMinePopup">
|
||||
<image class="top-nav-logo" src="/static/images/1.png" mode="heightFix"></image>
|
||||
<view>
|
||||
<view class="top-nav" @click="closeMinePopup">
|
||||
<image class="top-nav-logo" src="/static/images/1.png" mode="heightFix"></image>
|
||||
|
||||
<view class="top-nav-menu-wrap">
|
||||
<view
|
||||
v-for="(item, index) in displayMenus"
|
||||
:key="item.key"
|
||||
:class="['top-nav-menu-item', activeIndex === index ? 'top-nav-menu-item--active' : '']"
|
||||
@click="handleMenuClick(item, index)"
|
||||
>
|
||||
<text class="top-nav-menu-text">{{ item.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="top-nav-right" @click.stop>
|
||||
<view class="top-nav-user" @click="openMinePopup">
|
||||
<view class="top-nav-mine-icon" aria-hidden="true">
|
||||
<view class="top-nav-mine-icon-head"></view>
|
||||
<view class="top-nav-mine-icon-body"></view>
|
||||
<view class="top-nav-menu-wrap">
|
||||
<view
|
||||
v-for="(item, index) in displayMenus"
|
||||
:key="item.key"
|
||||
:class="['top-nav-menu-item', activeIndex === index ? 'top-nav-menu-item--active' : '']"
|
||||
@click="handleMenuClick(item, index)"
|
||||
>
|
||||
<text class="top-nav-menu-text">{{ item.title }}</text>
|
||||
</view>
|
||||
<text class="top-nav-user-name">{{ getTopNavRealName() }}</text>
|
||||
</view>
|
||||
|
||||
<view v-if="showMinePopup" class="popup-card" @click.stop>
|
||||
<view class="popup-user-info" v-if="currentUser && currentUser.employees && currentUser.employees.length">
|
||||
<view
|
||||
v-for="employee in currentUser.employees"
|
||||
:key="employee.id"
|
||||
:class="['popup-user-item', isCurrentRole(employee) ? 'popup-user-item--current' : '']"
|
||||
@click="handleChangeRole(employee)"
|
||||
>
|
||||
<text class="popup-user-text">{{ employee.store_name }} | {{ employee.real_name }}</text>
|
||||
<view class="top-nav-right" @click.stop>
|
||||
<view class="top-nav-user" @click="openMinePopup">
|
||||
<view class="top-nav-mine-icon" aria-hidden="true">
|
||||
<view class="top-nav-mine-icon-head"></view>
|
||||
<view class="top-nav-mine-icon-body"></view>
|
||||
</view>
|
||||
<text class="top-nav-user-name">{{ getTopNavRealName() }}</text>
|
||||
</view>
|
||||
|
||||
<view v-if="showMinePopup" class="popup-card" @click.stop>
|
||||
<view class="popup-user-info" v-if="currentUser && currentUser.employees && currentUser.employees.length">
|
||||
<view
|
||||
v-for="employee in currentUser.employees"
|
||||
:key="employee.id"
|
||||
:class="['popup-user-item', isCurrentRole(employee) ? 'popup-user-item--current' : '']"
|
||||
@click="handleChangeRole(employee)"
|
||||
>
|
||||
<text class="popup-user-text">{{ employee.store_name }} | {{ employee.real_name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<button class="logout-btn" type="warn" @click="handleLogout">退出登录</button>
|
||||
<button class="close-btn" @click="closeMinePopup">关闭</button>
|
||||
</view>
|
||||
<button class="logout-btn" type="warn" @click="handleLogout">退出登录</button>
|
||||
<button class="close-btn" @click="closeMinePopup">关闭</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="showSwitchMask" class="switch-mask"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -67,6 +71,13 @@ export default {
|
||||
return {
|
||||
activeIndex: 0,
|
||||
showMinePopup: false,
|
||||
isNavigating: false,
|
||||
lastMenuClickAt: 0,
|
||||
routeSyncTimer: null,
|
||||
lastRoutePath: '',
|
||||
showSwitchMask: false,
|
||||
switchMaskTimer: null,
|
||||
switchMaskStartedAt: 0,
|
||||
currentUser: null,
|
||||
defaultMenus: [
|
||||
{
|
||||
@ -115,6 +126,29 @@ export default {
|
||||
this.syncActiveIndex()
|
||||
this.loadCurrentUserInfo()
|
||||
},
|
||||
mounted() {
|
||||
this.lastRoutePath = this.getCurrentRoutePath()
|
||||
if (this.useRedirect && !this.activePath) {
|
||||
this.routeSyncTimer = setInterval(() => {
|
||||
const currentPath = this.getCurrentRoutePath()
|
||||
if (!currentPath || currentPath === this.lastRoutePath) {
|
||||
return
|
||||
}
|
||||
this.lastRoutePath = currentPath
|
||||
this.syncActiveByRoute()
|
||||
}, 120)
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.routeSyncTimer) {
|
||||
clearInterval(this.routeSyncTimer)
|
||||
this.routeSyncTimer = null
|
||||
}
|
||||
if (this.switchMaskTimer) {
|
||||
clearTimeout(this.switchMaskTimer)
|
||||
this.switchMaskTimer = null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
normalizePath(path) {
|
||||
const raw = String(path || '').trim()
|
||||
@ -143,15 +177,100 @@ export default {
|
||||
const targetIndex = this.displayMenus.findIndex((item) => item.path === route)
|
||||
this.activeIndex = targetIndex >= 0 ? targetIndex : 0
|
||||
},
|
||||
getCurrentRoutePath() {
|
||||
const pages = getCurrentPages()
|
||||
const currentPage = pages[pages.length - 1]
|
||||
return currentPage?.route ? `/${currentPage.route}` : ''
|
||||
},
|
||||
showNavigationMask() {
|
||||
this.showSwitchMask = true
|
||||
this.switchMaskStartedAt = Date.now()
|
||||
if (this.switchMaskTimer) {
|
||||
clearTimeout(this.switchMaskTimer)
|
||||
this.switchMaskTimer = null
|
||||
}
|
||||
},
|
||||
hideNavigationMask() {
|
||||
const elapsed = Date.now() - this.switchMaskStartedAt
|
||||
const delay = elapsed >= 100 ? 0 : 100 - elapsed
|
||||
if (this.switchMaskTimer) {
|
||||
clearTimeout(this.switchMaskTimer)
|
||||
}
|
||||
this.switchMaskTimer = setTimeout(() => {
|
||||
this.showSwitchMask = false
|
||||
this.switchMaskTimer = null
|
||||
}, delay)
|
||||
},
|
||||
navigateToMenu(targetPath) {
|
||||
const pages = getCurrentPages()
|
||||
const currentIndex = pages.length - 1
|
||||
const targetRoute = targetPath.replace(/^\//, '')
|
||||
const targetIndex = pages.map((page) => page?.route).lastIndexOf(targetRoute)
|
||||
const finishNavigate = () => {
|
||||
this.hideNavigationMask()
|
||||
setTimeout(() => {
|
||||
this.isNavigating = false
|
||||
}, 60)
|
||||
}
|
||||
|
||||
if (targetIndex >= 0 && currentIndex > targetIndex) {
|
||||
uni.navigateBack({
|
||||
delta: currentIndex - targetIndex,
|
||||
animationType: 'none',
|
||||
animationDuration: 0,
|
||||
complete: finishNavigate,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
uni.navigateTo({
|
||||
url: targetPath,
|
||||
animationType: 'none',
|
||||
animationDuration: 0,
|
||||
success: finishNavigate,
|
||||
fail: () => {
|
||||
uni.redirectTo({
|
||||
url: targetPath,
|
||||
animationType: 'none',
|
||||
animationDuration: 0,
|
||||
complete: finishNavigate,
|
||||
})
|
||||
},
|
||||
})
|
||||
},
|
||||
handleMenuClick(item, index) {
|
||||
this.activeIndex = index
|
||||
const now = Date.now()
|
||||
if (now - this.lastMenuClickAt < 150) {
|
||||
return
|
||||
}
|
||||
this.lastMenuClickAt = now
|
||||
|
||||
if (this.isNavigating) {
|
||||
return
|
||||
}
|
||||
|
||||
const targetPath = this.normalizePath(item?.path)
|
||||
if (!targetPath) {
|
||||
return
|
||||
}
|
||||
|
||||
const currentPath = this.getCurrentRoutePath()
|
||||
if (this.useRedirect && currentPath === targetPath) {
|
||||
this.syncActiveByRoute()
|
||||
this.closeMinePopup()
|
||||
return
|
||||
}
|
||||
|
||||
if (!this.useRedirect) {
|
||||
this.activeIndex = index
|
||||
}
|
||||
|
||||
this.$emit('menu-click', item.raw)
|
||||
|
||||
if (this.useRedirect) {
|
||||
uni.redirectTo({
|
||||
url: item.path,
|
||||
})
|
||||
this.isNavigating = true
|
||||
this.showNavigationMask()
|
||||
this.navigateToMenu(targetPath)
|
||||
}
|
||||
|
||||
this.closeMinePopup()
|
||||
@ -255,6 +374,7 @@ export default {
|
||||
}
|
||||
|
||||
.top-nav-logo {
|
||||
width: 240rpx;
|
||||
height: 90rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
@ -381,4 +501,15 @@ export default {
|
||||
background-color: #f5f7fb;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.switch-mask {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(248, 248, 248, 0.96);
|
||||
z-index: 9999;
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -48,17 +48,18 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view v-if="activeLeftAction === 'currentWave'" class="left-reviewed-list left-reviewed-list--current-wave" scroll-y>
|
||||
<view class="table-wrap table-wrap--current-wave">
|
||||
<view class="table-header table-header--sticky">
|
||||
<text class="table-cell cell-index">序号</text>
|
||||
<text class="table-cell cell-pending-order">待处理订单号</text>
|
||||
</view>
|
||||
<view
|
||||
v-if="activeLeftAction === 'currentWave' && displayCurrentWaveOrders.length > 0"
|
||||
class="table-wrap table-wrap--current-wave table-wrap--current-wave-sticky"
|
||||
>
|
||||
<view class="table-header table-header--sticky">
|
||||
<text class="table-cell cell-index">序号</text>
|
||||
<text class="table-cell cell-pending-order">待处理订单号</text>
|
||||
</view>
|
||||
|
||||
<scroll-view class="left-reviewed-list left-reviewed-list--current-wave left-reviewed-list--current-wave-body" scroll-y>
|
||||
<view class="table-body">
|
||||
<view v-if="displayCurrentWaveOrders.length === 0" class="empty">暂无匹配数据</view>
|
||||
<view
|
||||
v-else
|
||||
v-for="(item, index) in displayCurrentWaveOrders"
|
||||
:key="`${item.pendingOrderNo}-${index}`"
|
||||
:class="[
|
||||
@ -72,8 +73,9 @@
|
||||
<text class="table-cell cell-pending-order">{{ item.pendingOrderNo }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view v-else-if="activeLeftAction === 'currentWave'" class="empty-panel empty-panel--left">暂无匹配数据</view>
|
||||
|
||||
<view v-if="activeLeftAction === 'currentWave'" class="pagination-bar pagination-bar--left">
|
||||
<text class="pagination-info">
|
||||
@ -85,18 +87,19 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view v-else-if="activeLeftAction === 'reviewedList'" class="left-reviewed-list" scroll-y>
|
||||
<view class="table-wrap table-wrap--reviewed">
|
||||
<view class="table-header table-header--sticky">
|
||||
<text class="table-cell cell-index">序号</text>
|
||||
<text class="table-cell cell-order-no">订单号</text>
|
||||
<text class="table-cell cell-wave-no">波次号</text>
|
||||
</view>
|
||||
<view
|
||||
v-else-if="activeLeftAction === 'reviewedList' && displayReviewedOrders.length > 0"
|
||||
class="table-wrap table-wrap--reviewed table-wrap--reviewed-sticky"
|
||||
>
|
||||
<view class="table-header table-header--sticky">
|
||||
<text class="table-cell cell-index">序号</text>
|
||||
<text class="table-cell cell-order-no">订单号</text>
|
||||
<text class="table-cell cell-wave-no">波次号</text>
|
||||
</view>
|
||||
|
||||
<scroll-view class="left-reviewed-list left-reviewed-list--reviewed" scroll-y>
|
||||
<view class="table-body">
|
||||
<view v-if="displayReviewedOrders.length === 0" class="empty">暂无匹配数据</view>
|
||||
<view
|
||||
v-else
|
||||
v-for="(item, index) in displayReviewedOrders"
|
||||
:key="`${item.orderNo}-${index}`"
|
||||
:class="['table-row', index % 2 === 1 ? 'table-row--alt' : '']"
|
||||
@ -106,8 +109,9 @@
|
||||
<text class="table-cell cell-wave-no">{{ item.waveNo }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view v-else-if="activeLeftAction === 'reviewedList'" class="empty-panel empty-panel--left">暂无匹配数据</view>
|
||||
|
||||
<view v-else-if="activeLeftAction === 'settings'" class="settings-panel">
|
||||
<view class="settings-row">
|
||||
@ -132,8 +136,16 @@
|
||||
</view>
|
||||
|
||||
<view class="panel-right">
|
||||
<scroll-view class="table-scroll table-scroll--detail" scroll-x scroll-y>
|
||||
<view class="table-wrap table-wrap--detail">
|
||||
<view class="camera-preview-panel">
|
||||
<view class="camera-preview-frame">
|
||||
<view ref="cameraHost" class="camera-preview-host"></view>
|
||||
<view v-if="!cameraReady" class="camera-preview-placeholder">
|
||||
<text class="camera-preview-text">{{ cameraLoading ? '摄像头启动中...' : cameraError || '暂无摄像头画面' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="table-wrap table-wrap--detail table-wrap--detail-sticky">
|
||||
<view class="table-header table-header--sticky">
|
||||
<text class="table-cell cell-blue-no">蓝号</text>
|
||||
<text class="table-cell cell-qty">数量</text>
|
||||
@ -144,10 +156,9 @@
|
||||
<text class="table-cell cell-spec">规格</text>
|
||||
</view>
|
||||
|
||||
<scroll-view v-if="selectedPendingOrderKey && displayOrders.length > 0" class="table-scroll table-scroll--detail table-scroll--detail-body" scroll-y>
|
||||
<view class="table-body">
|
||||
<view v-if="displayOrders.length === 0" class="empty">暂无匹配数据</view>
|
||||
<view
|
||||
v-else
|
||||
v-for="(order, index) in displayOrders"
|
||||
:key="order.barcode"
|
||||
:class="['table-row', index % 2 === 1 ? 'table-row--alt' : '']"
|
||||
@ -161,8 +172,9 @@
|
||||
<text class="table-cell cell-spec">{{ order.spec }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</scroll-view>
|
||||
<view v-else class="empty-panel empty-panel--right-inline">暂无匹配数据</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -218,6 +230,14 @@ export default {
|
||||
selectedPendingOrderKey: '',
|
||||
currentOrderHeader: null,
|
||||
currentWaybillInfo: null,
|
||||
cameraStream: null,
|
||||
cameraVideoElement: null,
|
||||
cameraLoading: false,
|
||||
cameraReady: false,
|
||||
cameraError: '',
|
||||
cameraInitializing: false,
|
||||
cameraInitToken: 0,
|
||||
cameraStartTimer: null,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -225,7 +245,35 @@ export default {
|
||||
this.displayCurrentWaveOrders = this.allCurrentWaveOrders
|
||||
this.displayReviewedOrders = this.allReviewedOrders
|
||||
},
|
||||
mounted() {
|
||||
this.requestCameraPreview()
|
||||
},
|
||||
onReady() {
|
||||
this.requestCameraPreview()
|
||||
},
|
||||
onShow() {
|
||||
this.requestCameraPreview()
|
||||
},
|
||||
beforeUnmount() {
|
||||
this.stopCameraPreview()
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.stopCameraPreview()
|
||||
},
|
||||
onUnload() {
|
||||
this.stopCameraPreview()
|
||||
},
|
||||
methods: {
|
||||
requestCameraPreview() {
|
||||
if (this.cameraInitializing || this.cameraLoading || this.cameraReady) {
|
||||
return
|
||||
}
|
||||
|
||||
clearTimeout(this.cameraStartTimer)
|
||||
this.cameraStartTimer = setTimeout(() => {
|
||||
this.initCameraPreview()
|
||||
}, 180)
|
||||
},
|
||||
handleLeftActionClick(action) {
|
||||
this.activeLeftAction = action
|
||||
this.handleSearch()
|
||||
@ -239,6 +287,186 @@ export default {
|
||||
icon: 'success',
|
||||
})
|
||||
},
|
||||
async initCameraPreview() {
|
||||
if (typeof navigator === 'undefined' || !navigator?.mediaDevices?.getUserMedia) {
|
||||
this.cameraError = '当前环境不支持摄像头预览'
|
||||
this.cameraReady = false
|
||||
return
|
||||
}
|
||||
|
||||
if (this.cameraInitializing) {
|
||||
return
|
||||
}
|
||||
|
||||
const currentToken = ++this.cameraInitToken
|
||||
this.cameraInitializing = true
|
||||
|
||||
await this.stopCameraPreview()
|
||||
await new Promise((resolve) => setTimeout(resolve, 200))
|
||||
|
||||
this.cameraLoading = true
|
||||
this.cameraError = ''
|
||||
|
||||
try {
|
||||
const getStream = async () => {
|
||||
try {
|
||||
return await navigator.mediaDevices.getUserMedia({
|
||||
video: {
|
||||
width: { ideal: 1280 },
|
||||
height: { ideal: 720 },
|
||||
},
|
||||
audio: false,
|
||||
})
|
||||
} catch (firstError) {
|
||||
return await navigator.mediaDevices.getUserMedia({
|
||||
video: true,
|
||||
audio: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
let stream = await getStream()
|
||||
|
||||
if (currentToken !== this.cameraInitToken) {
|
||||
stream.getTracks().forEach((track) => track.stop())
|
||||
return
|
||||
}
|
||||
|
||||
this.cameraStream = stream
|
||||
|
||||
await this.$nextTick()
|
||||
const hostRef = this.$refs.cameraHost
|
||||
const hostElement = Array.isArray(hostRef) ? hostRef[0] : hostRef
|
||||
const videoElement = this.ensureCameraVideoElement(hostElement)
|
||||
|
||||
if (videoElement) {
|
||||
if (!('srcObject' in videoElement)) {
|
||||
throw new Error('UNSUPPORTED_STREAM_SOURCE')
|
||||
}
|
||||
|
||||
videoElement.srcObject = stream
|
||||
|
||||
const playPromise = videoElement.play ? videoElement.play() : null
|
||||
if (playPromise && typeof playPromise.then === 'function') {
|
||||
await playPromise
|
||||
}
|
||||
} else {
|
||||
throw new Error('VIDEO_ELEMENT_NOT_FOUND')
|
||||
}
|
||||
|
||||
this.cameraReady = true
|
||||
} catch (error) {
|
||||
if (error?.name === 'NotReadableError') {
|
||||
try {
|
||||
await this.stopCameraPreview()
|
||||
await new Promise((resolve) => setTimeout(resolve, 500))
|
||||
|
||||
const retryStream = await navigator.mediaDevices.getUserMedia({
|
||||
video: true,
|
||||
audio: false,
|
||||
})
|
||||
|
||||
if (currentToken !== this.cameraInitToken) {
|
||||
retryStream.getTracks().forEach((track) => track.stop())
|
||||
return
|
||||
}
|
||||
|
||||
this.cameraStream = retryStream
|
||||
|
||||
await this.$nextTick()
|
||||
const hostRef = this.$refs.cameraHost
|
||||
const hostElement = Array.isArray(hostRef) ? hostRef[0] : hostRef
|
||||
const videoElement = this.ensureCameraVideoElement(hostElement)
|
||||
|
||||
if (!videoElement || !('srcObject' in videoElement)) {
|
||||
throw new Error('VIDEO_ELEMENT_NOT_FOUND')
|
||||
}
|
||||
|
||||
videoElement.srcObject = retryStream
|
||||
const playPromise = videoElement.play ? videoElement.play() : null
|
||||
if (playPromise && typeof playPromise.then === 'function') {
|
||||
await playPromise
|
||||
}
|
||||
|
||||
this.cameraReady = true
|
||||
this.cameraError = ''
|
||||
return
|
||||
} catch (retryError) {
|
||||
error = retryError
|
||||
}
|
||||
}
|
||||
|
||||
this.cameraReady = false
|
||||
if (error?.name === 'NotAllowedError' || error?.name === 'PermissionDeniedError') {
|
||||
this.cameraError = '摄像头权限被拒绝'
|
||||
} else if (error?.name === 'NotFoundError' || error?.name === 'DevicesNotFoundError') {
|
||||
this.cameraError = '未检测到可用摄像头设备'
|
||||
} else if (error?.name === 'NotReadableError') {
|
||||
this.cameraError = '摄像头正被其他程序占用,请关闭后重试'
|
||||
} else if (error?.name === 'NotSupportedError') {
|
||||
this.cameraError = '当前视频源格式不受支持'
|
||||
} else if (error?.message === 'UNSUPPORTED_STREAM_SOURCE' || error?.message === 'VIDEO_ELEMENT_NOT_FOUND') {
|
||||
this.cameraError = '当前视频组件不支持实时流预览'
|
||||
} else {
|
||||
this.cameraError = `摄像头启动失败(${error?.name || 'Unknown'}${error?.message ? `: ${error.message}` : ''})`
|
||||
}
|
||||
} finally {
|
||||
this.cameraLoading = false
|
||||
this.cameraInitializing = false
|
||||
}
|
||||
},
|
||||
async stopCameraPreview() {
|
||||
this.cameraInitToken += 1
|
||||
clearTimeout(this.cameraStartTimer)
|
||||
|
||||
const stream = this.cameraStream
|
||||
if (stream && typeof stream.getTracks === 'function') {
|
||||
stream.getTracks().forEach((track) => {
|
||||
if (track && typeof track.stop === 'function') {
|
||||
track.stop()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const videoElement = this.cameraVideoElement
|
||||
if (videoElement) {
|
||||
videoElement.srcObject = null
|
||||
videoElement.removeAttribute('src')
|
||||
if (typeof videoElement.load === 'function') {
|
||||
videoElement.load()
|
||||
}
|
||||
}
|
||||
|
||||
this.cameraStream = null
|
||||
this.cameraVideoElement = null
|
||||
this.cameraReady = false
|
||||
this.cameraLoading = false
|
||||
this.cameraInitializing = false
|
||||
this.cameraStartTimer = null
|
||||
},
|
||||
ensureCameraVideoElement(hostElement) {
|
||||
if (typeof document === 'undefined' || !hostElement) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (this.cameraVideoElement && hostElement.contains(this.cameraVideoElement)) {
|
||||
return this.cameraVideoElement
|
||||
}
|
||||
|
||||
hostElement.innerHTML = ''
|
||||
|
||||
const videoElement = document.createElement('video')
|
||||
videoElement.className = 'camera-preview-video'
|
||||
videoElement.muted = true
|
||||
videoElement.autoplay = false
|
||||
videoElement.playsInline = true
|
||||
videoElement.setAttribute('playsinline', 'true')
|
||||
videoElement.setAttribute('webkit-playsinline', 'true')
|
||||
|
||||
hostElement.appendChild(videoElement)
|
||||
this.cameraVideoElement = videoElement
|
||||
return videoElement
|
||||
},
|
||||
getRowValue(row, keys = []) {
|
||||
for (const key of keys) {
|
||||
const value = row?.[key]
|
||||
@ -325,7 +553,10 @@ export default {
|
||||
})
|
||||
.filter((item) => !!item.pendingOrderNo)
|
||||
|
||||
this.displayOrders = list.map((item) => this.normalizeOrderRow(item))
|
||||
this.displayOrders = []
|
||||
this.selectedPendingOrderKey = ''
|
||||
this.currentOrderHeader = null
|
||||
this.currentWaybillInfo = null
|
||||
this.allCurrentWaveOrders = pendingOrders
|
||||
this.displayCurrentWaveOrders = pendingOrders
|
||||
this.orderPagination = {
|
||||
@ -370,6 +601,12 @@ export default {
|
||||
this.displayCurrentWaveOrders = this.allCurrentWaveOrders.filter((order) => {
|
||||
return Object.values(order).some((value) => String(value || '').toLowerCase().includes(query))
|
||||
})
|
||||
if (this.displayCurrentWaveOrders.length === 0) {
|
||||
this.selectedPendingOrderKey = ''
|
||||
this.currentOrderHeader = null
|
||||
this.currentWaybillInfo = null
|
||||
this.displayOrders = []
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -419,12 +656,23 @@ export default {
|
||||
|
||||
<style>
|
||||
.page {
|
||||
height: 100vh;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
.page > .top-nav {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.page-main {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
padding: 8rpx 32rpx 32rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
@ -459,6 +707,55 @@ export default {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.camera-preview-panel {
|
||||
margin-bottom: 14rpx;
|
||||
border: 1rpx solid #e6ebf5;
|
||||
border-radius: 8rpx;
|
||||
background-color: #fff;
|
||||
padding: 12rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.camera-preview-frame {
|
||||
position: relative;
|
||||
height: 240rpx;
|
||||
border: 1rpx dashed #d9dde8;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
background-color: #f9fbff;
|
||||
}
|
||||
|
||||
.camera-preview-video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
object-fit: cover;
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
.camera-preview-host {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.camera-preview-placeholder {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #f9fbff;
|
||||
}
|
||||
|
||||
.camera-preview-text {
|
||||
font-size: 24rpx;
|
||||
color: #9098a4;
|
||||
line-height: 1.5;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.left-summary {
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
@ -482,7 +779,22 @@ export default {
|
||||
}
|
||||
|
||||
.left-reviewed-list--current-wave {
|
||||
max-height: 1100rpx;
|
||||
margin-top: 0;
|
||||
flex: 1;
|
||||
max-height: none;
|
||||
}
|
||||
|
||||
.left-reviewed-list--current-wave-body {
|
||||
width: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.left-reviewed-list--reviewed {
|
||||
margin-top: 0;
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
max-height: none;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.settings-panel {
|
||||
@ -599,7 +911,7 @@ export default {
|
||||
}
|
||||
|
||||
.table-scroll--detail {
|
||||
max-height: 520rpx;
|
||||
max-height: none;
|
||||
}
|
||||
|
||||
.pagination-bar {
|
||||
@ -644,6 +956,76 @@ export default {
|
||||
min-width: 620rpx;
|
||||
}
|
||||
|
||||
.table-wrap--current-wave-sticky {
|
||||
margin-top: 14rpx;
|
||||
height: 60vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.table-wrap--current-wave-sticky .table-header {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.table-wrap--reviewed-sticky {
|
||||
margin-top: 14rpx;
|
||||
height: 60vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.table-wrap--reviewed-sticky .table-header {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.table-wrap--detail-sticky {
|
||||
height: 520rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.empty-panel {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
border: 1rpx solid #e6ebf5;
|
||||
background-color: #fff;
|
||||
color: #999;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.empty-panel--left {
|
||||
margin-top: 14rpx;
|
||||
height: 60vh;
|
||||
}
|
||||
|
||||
.empty-panel--right {
|
||||
height: 520rpx;
|
||||
}
|
||||
|
||||
.empty-panel--right-inline {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
min-width: 980rpx;
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.table-wrap--detail-sticky .table-header,
|
||||
.table-wrap--detail-sticky .table-body {
|
||||
min-width: 980rpx;
|
||||
}
|
||||
|
||||
.table-wrap--detail-sticky .table-header {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.table-scroll--detail-body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.table-wrap--detail .table-cell {
|
||||
align-self: stretch;
|
||||
display: flex;
|
||||
@ -682,6 +1064,8 @@ export default {
|
||||
.table-row {
|
||||
min-height: 68rpx;
|
||||
border-top: 1rpx solid #eef2f8;
|
||||
border-left: 6rpx solid transparent;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.table-row:first-child {
|
||||
@ -693,8 +1077,9 @@ export default {
|
||||
}
|
||||
|
||||
.table-row--selected {
|
||||
background-color: #eaf3ff;
|
||||
border-left: 6rpx solid #2f7de1;
|
||||
background-color: #d6e8ff;
|
||||
border-left-color: #1f63d3;
|
||||
box-shadow: inset 0 0 0 2rpx rgba(31, 99, 211, 0.22);
|
||||
}
|
||||
|
||||
.table-cell {
|
||||
@ -786,8 +1171,12 @@ export default {
|
||||
margin-bottom: 18rpx;
|
||||
}
|
||||
|
||||
.table-scroll--detail {
|
||||
max-height: 460rpx;
|
||||
.table-wrap--detail-sticky {
|
||||
height: 460rpx;
|
||||
}
|
||||
|
||||
.empty-panel--right {
|
||||
height: 460rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -25,12 +25,23 @@ export default {
|
||||
|
||||
<style>
|
||||
.page {
|
||||
height: 100vh;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
.page > .top-nav {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.page-main {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
padding: 8rpx 32rpx 32rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@ -25,12 +25,23 @@ export default {
|
||||
|
||||
<style>
|
||||
.page {
|
||||
height: 100vh;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
.page > .top-nav {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.page-main {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
padding: 8rpx 32rpx 32rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user