新增订单复核功能

This commit is contained in:
zm2000 2026-05-19 18:01:39 +08:00
parent f1ec04c102
commit b7b9bd8d42
5 changed files with 536 additions and 187 deletions

View File

@ -1,7 +1,12 @@
const { app, BrowserWindow } = require('electron')
const path = require('path')
const devServerUrl = process.env.ELECTRON_RENDERER_URL || 'http://localhost:5173'
const devServerUrl = process.env.ELECTRON_RENDERER_URL
const rendererEntry = path.join(__dirname, '..', 'dist', 'build', 'h5', 'index.html')
if (devServerUrl) {
app.commandLine.appendSwitch('disable-http-cache')
}
function createWindow() {
const win = new BrowserWindow({
@ -14,8 +19,14 @@ function createWindow() {
},
})
win.loadURL(devServerUrl)
win.webContents.openDevTools({ mode: 'detach' })
if (devServerUrl) {
win.webContents.session.clearCache().catch(() => {})
win.loadURL(devServerUrl)
win.webContents.openDevTools({ mode: 'detach' })
return
}
win.loadFile(rendererEntry)
}
app.whenReady().then(() => {

View File

@ -2,7 +2,8 @@ const { spawn } = require('child_process')
const http = require('http')
const path = require('path')
const devServerUrl = process.env.ELECTRON_RENDERER_URL || 'http://localhost:5173'
const rendererPort = process.env.ELECTRON_RENDERER_PORT || '5188'
const devServerUrl = process.env.ELECTRON_RENDERER_URL || `http://localhost:${rendererPort}`
function waitForServer(url, timeout = 90000) {
const startedAt = Date.now()
@ -35,7 +36,7 @@ const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm'
const npxCmd = process.platform === 'win32' ? 'npx.cmd' : 'npx'
const useShell = process.platform === 'win32'
const devProcess = spawn(npmCmd, ['run', 'dev:h5:electron'], {
const devProcess = spawn(npmCmd, ['run', 'dev:h5:electron', '--', '--port', rendererPort, '--strictPort'], {
stdio: 'inherit',
shell: useShell,
})

View File

@ -0,0 +1,446 @@
<template>
<view class="order-review-one">
<view :class="['container', compactTop ? 'container--compact-top' : '']">
<view class="search-bar">
<input
class="search-input"
v-model="keyword"
placeholder="请输入快递号/商品条码/拣货车/数量等关键词搜索订单"
confirm-type="search"
@confirm="handleSearch"
/>
<button class="search-btn" type="primary" @click="handleSearch">搜索</button>
</view>
<view class="content-panel">
<view class="panel-left">
<view class="left-summary">
<text class="left-summary-text">待处理:{{ pendingCount }};当前波次:{{ currentWaveCount }}</text>
</view>
<view class="left-header-actions">
<view
:class="['header-action-btn', activeLeftAction === 'currentWave' ? 'header-action-btn--active' : '']"
@click="handleLeftActionClick('currentWave')"
>
<text class="header-action-text">当前波次</text>
</view>
<view
:class="['header-action-btn', activeLeftAction === 'settings' ? 'header-action-btn--active' : '']"
@click="handleLeftActionClick('settings')"
>
<text class="header-action-text">设置</text>
</view>
<view
:class="['header-action-btn', activeLeftAction === 'printInfo' ? 'header-action-btn--active' : '']"
@click="handleLeftActionClick('printInfo')"
>
<text class="header-action-text">打印信息</text>
</view>
<view
:class="['header-action-btn', 'header-action-btn--reviewed', activeLeftAction === 'reviewedList' ? 'header-action-btn--active' : '']"
@click="handleLeftActionClick('reviewedList')"
>
<text class="header-action-text">已复核列表</text>
</view>
</view>
<scroll-view v-if="activeLeftAction === 'currentWave'" class="left-reviewed-list" scroll-y>
<view class="table-wrap table-wrap--current-wave">
<view class="table-header">
<text class="table-cell cell-pending-order">待处理订单号</text>
</view>
<view class="table-body">
<view v-if="displayCurrentWaveOrders.length === 0" class="empty">暂无匹配数据</view>
<view
v-else
v-for="(item, index) in displayCurrentWaveOrders"
:key="`${item.waveNo}-${item.pendingOrderNo}-${index}`"
class="table-row"
>
<text class="table-cell cell-pending-order">{{ item.pendingOrderNo }}</text>
</view>
</view>
</view>
</scroll-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">
<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 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">
<text class="table-cell cell-index">{{ index + 1 }}</text>
<text class="table-cell cell-order-no">{{ item.orderNo }}</text>
<text class="table-cell cell-wave-no">{{ item.waveNo }}</text>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="panel-right">
<scroll-view class="table-scroll" scroll-x>
<view class="table-wrap">
<view class="table-header">
<text class="table-cell cell-blue-no">蓝号</text>
<text class="table-cell cell-qty">数量</text>
<text class="table-cell cell-scan">扫描记</text>
<text class="table-cell cell-barcode">条码</text>
<text class="table-cell cell-name">商品名称</text>
<text class="table-cell cell-color">颜色</text>
<text class="table-cell cell-spec">规格</text>
</view>
<view class="table-body">
<view v-if="displayOrders.length === 0" class="empty">暂无匹配数据</view>
<view v-else v-for="order in displayOrders" :key="order.barcode" class="table-row">
<text class="table-cell cell-blue-no">{{ order.blueNo }}</text>
<text class="table-cell cell-qty">{{ order.quantity }}</text>
<text class="table-cell cell-scan">{{ order.scanMark }}</text>
<text class="table-cell cell-barcode">{{ order.barcode }}</text>
<text class="table-cell cell-name">{{ order.productName }}</text>
<text class="table-cell cell-color">{{ order.color }}</text>
<text class="table-cell cell-spec">{{ order.spec }}</text>
</view>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'OrderReviewOne',
props: {
compactTop: {
type: Boolean,
default: false,
},
},
data() {
return {
pendingCount: 134,
currentWaveCount: 0,
activeLeftAction: 'currentWave',
keyword: '',
displayOrders: [],
displayCurrentWaveOrders: [],
displayReviewedOrders: [],
allOrders: [
{
blueNo: 'L001',
quantity: 2,
scanMark: '已扫',
barcode: '6901234567001',
productName: '工装短袖',
color: '黑色',
spec: 'L',
},
{
blueNo: 'L002',
quantity: 1,
scanMark: '未扫',
barcode: '6901234567002',
productName: '防滑手套',
color: '灰色',
spec: '均码',
},
{
blueNo: 'L003',
quantity: 3,
scanMark: '已扫',
barcode: '6901234567003',
productName: '安全帽',
color: '黄色',
spec: 'M',
},
],
allReviewedOrders: [
{ orderNo: 'DD202605190001', waveNo: 'WC001' },
{ orderNo: 'DD202605190002', waveNo: 'WC001' },
{ orderNo: 'DD202605190003', waveNo: 'WC002' },
],
allCurrentWaveOrders: [
{ waveNo: 'WC001', pendingOrderNo: 'DD202605190101' },
{ waveNo: 'WC001', pendingOrderNo: 'DD202605190102' },
{ waveNo: 'WC002', pendingOrderNo: 'DD202605190103' },
],
}
},
created() {
this.displayOrders = this.allOrders
this.displayCurrentWaveOrders = this.allCurrentWaveOrders
this.displayReviewedOrders = this.allReviewedOrders
},
methods: {
handleLeftActionClick(action) {
this.activeLeftAction = action
this.handleSearch()
},
handleSearch() {
const query = this.keyword.trim().toLowerCase()
if (this.activeLeftAction === 'currentWave') {
if (!query) {
this.displayCurrentWaveOrders = this.allCurrentWaveOrders
return
}
this.displayCurrentWaveOrders = this.allCurrentWaveOrders.filter((order) => {
return Object.values(order).some((value) => String(value || '').toLowerCase().includes(query))
})
return
}
if (this.activeLeftAction === 'reviewedList') {
if (!query) {
this.displayReviewedOrders = this.allReviewedOrders
return
}
this.displayReviewedOrders = this.allReviewedOrders.filter((order) => {
return Object.values(order).some((value) => String(value || '').toLowerCase().includes(query))
})
return
}
if (!query) {
this.displayOrders = this.allOrders
return
}
this.displayOrders = this.allOrders.filter((order) => {
return Object.values(order).some((value) => String(value || '').toLowerCase().includes(query))
})
},
},
}
</script>
<style>
.order-review-one {
width: 100%;
}
.container {
background: #fff;
border-radius: 16rpx;
padding: 28rpx;
}
.container--compact-top {
padding-top: 0;
}
.content-panel {
display: flex;
align-items: flex-start;
gap: 20rpx;
}
.panel-left {
width: 700rpx;
flex-shrink: 0;
}
.panel-right {
flex: 1;
min-width: 0;
}
.left-summary {
margin-bottom: 12rpx;
}
.left-summary-text {
font-size: 30rpx;
color: #333;
line-height: 1.4;
}
.left-header-actions {
display: flex;
align-items: center;
flex-wrap: nowrap;
gap: 12rpx;
}
.left-reviewed-list {
margin-top: 14rpx;
max-height: 520rpx;
}
.header-action-btn {
flex: 1;
min-width: 0;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
height: 60rpx;
border-radius: 8rpx;
border: 1rpx solid #d9dde8;
background-color: #fff;
padding: 0 8rpx;
white-space: nowrap;
}
.header-action-btn--active {
background-color: #34c759;
border-color: #34c759;
}
.header-action-text {
width: 100%;
text-align: center;
font-size: 22rpx;
line-height: 1;
color: #333;
}
.header-action-btn--active .header-action-text {
color: #fff;
}
.header-action-btn--reviewed {
letter-spacing: 0;
}
.search-bar {
display: flex;
align-items: center;
gap: 16rpx;
margin-bottom: 24rpx;
}
.search-input {
flex: 1;
height: 72rpx;
border: 1rpx solid #e5e5e5;
border-radius: 10rpx;
padding: 0 20rpx;
font-size: 28rpx;
background-color: #fff;
}
.search-btn {
width: 160rpx;
height: 72rpx;
line-height: 72rpx;
font-size: 28rpx;
}
.table-scroll {
width: 100%;
}
.table-wrap {
min-width: 980rpx;
}
.table-wrap--reviewed {
min-width: 620rpx;
}
.table-wrap--current-wave {
min-width: 620rpx;
}
.table-header,
.table-row {
display: flex;
align-items: center;
}
.table-header {
height: 64rpx;
border: 1rpx solid #e6ebf5;
border-bottom: none;
background-color: #f6f8fc;
}
.table-body {
border: 1rpx solid #e6ebf5;
}
.table-row {
min-height: 68rpx;
border-top: 1rpx solid #eef2f8;
}
.table-row:first-child {
border-top: none;
}
.table-cell {
padding: 0 12rpx;
font-size: 24rpx;
color: #333;
line-height: 1.4;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.cell-blue-no {
width: 110rpx;
}
.cell-qty {
width: 90rpx;
}
.cell-scan {
width: 110rpx;
}
.cell-barcode {
width: 200rpx;
}
.cell-name {
flex: 1;
min-width: 180rpx;
}
.cell-color {
width: 110rpx;
}
.cell-spec {
width: 110rpx;
}
.cell-index {
width: 120rpx;
}
.cell-order-no {
flex: 1;
min-width: 280rpx;
}
.cell-wave-no {
width: 180rpx;
}
.cell-pending-order {
width: 100%;
}
.empty {
text-align: center;
color: #999;
font-size: 26rpx;
padding: 24rpx 0;
}
</style>

View File

@ -37,26 +37,10 @@
</view>
</view>
<view class="content-wrap" v-if="activeMenuPath === '/order'">
<view class="order-module">
<view class="order-search-bar">
<input
class="order-search-input"
v-model="orderKeyword"
placeholder="请输入订单号/客户名"
confirm-type="search"
@confirm="handleOrderSearch"
/>
<button class="order-search-btn" type="primary" @click="handleOrderSearch">搜索</button>
</view>
<view class="order-result-list">
<view v-if="displayOrders.length === 0" class="order-empty">暂无匹配订单</view>
<view v-else v-for="order in displayOrders" :key="order.orderNo" class="order-item">
<text class="order-item-text">订单号:{{ order.orderNo }}</text>
<text class="order-item-text">客户:{{ order.customer }}</text>
</view>
</view>
<view class="content-wrap">
<order-review-one v-if="activeMenuPath === '/order'" compact-top />
<view v-else class="module-placeholder">
<text class="module-placeholder-title">{{ getActiveMenuTitle() || '请选择功能菜单' }}</text>
</view>
</view>
@ -64,8 +48,13 @@
</template>
<script>
import OrderReviewOne from '@/components/order-review-one/index.vue'
export default {
onLoad() {
components: {
OrderReviewOne,
},
onLoad(options) {
const token = uni.getStorageSync('token')
if (!token) {
uni.reLaunch({
@ -74,6 +63,8 @@ export default {
return
}
this.activeMenuPath = this.normalizeRawPath(options?.menu)
this.loadCurrentUserInfo(token)
},
data() {
@ -81,13 +72,6 @@ export default {
showMinePopup: false,
currentUser: null,
activeMenuPath: '',
orderKeyword: '',
displayOrders: [],
allOrders: [
{ orderNo: 'ORD20260516001', customer: '张三' },
{ orderNo: 'ORD20260516002', customer: '李四' },
{ orderNo: 'ORD20260516003', customer: '王五' },
],
}
},
methods: {
@ -110,10 +94,41 @@ export default {
return rawPath.startsWith('/') ? rawPath : `/${rawPath}`
},
normalizeRawPath(rawPath) {
const raw = String(rawPath || '').trim()
if (!raw) {
return ''
}
return raw.startsWith('/') ? raw : `/${raw}`
},
isMenuActive(menu) {
const path = this.normalizeMenuPath(menu)
return !!path && this.activeMenuPath === path
},
getActiveMenuTitle() {
const activeMenu = this.getTopMenus().find((menu) => this.normalizeMenuPath(menu) === this.activeMenuPath)
return this.getMenuTitle(activeMenu)
},
updateUrlByActiveMenu(menuPath) {
const normalizedPath = this.normalizeRawPath(menuPath)
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
const currentMenu = this.normalizeRawPath(currentPage?.options?.menu)
if (currentPage?.route !== 'pages/index/index' || currentMenu !== normalizedPath) {
const query = normalizedPath ? `?menu=${encodeURIComponent(normalizedPath)}` : ''
uni.redirectTo({
url: `/pages/index/index${query}`,
fail: () => {
uni.showToast({
title: '页面切换失败',
icon: 'none',
})
},
})
}
},
handleMenuClick(menu) {
const rawPath = (menu?.path || '').trim()
@ -126,46 +141,12 @@ export default {
}
const normalizedPath = this.normalizeMenuPath(menu)
const routeMap = {
'/order': '/pages/order/index',
}
const url = routeMap[normalizedPath] || normalizedPath
if (normalizedPath === '/order') {
this.activeMenuPath = '/order'
this.orderKeyword = ''
this.displayOrders = this.allOrders
if (!normalizedPath) {
return
}
this.activeMenuPath = ''
if (url === '/pages/index/index') {
return
}
uni.navigateTo({
url,
fail: () => {
uni.showToast({
title: '页面跳转失败',
icon: 'none',
})
},
})
},
handleOrderSearch() {
const query = this.orderKeyword.trim().toLowerCase()
if (!query) {
this.displayOrders = this.allOrders
return
}
this.displayOrders = this.allOrders.filter((order) => {
return (
String(order.orderNo || '').toLowerCase().includes(query) ||
String(order.customer || '').toLowerCase().includes(query)
)
})
this.activeMenuPath = normalizedPath
this.updateUrlByActiveMenu(normalizedPath)
},
getTopNavRealName() {
const employees = this.currentUser?.employees || []
@ -252,6 +233,14 @@ export default {
success: (res) => {
const body = res?.data || {}
this.currentUser = body?.data || body?.result || body || null
if (!this.activeMenuPath) {
const firstMenuPath = this.normalizeMenuPath(this.getTopMenus()[0])
this.activeMenuPath = firstMenuPath
if (firstMenuPath) {
this.updateUrlByActiveMenu(firstMenuPath)
}
}
},
})
},
@ -525,6 +514,18 @@ export default {
padding: 20rpx 0;
}
.module-placeholder {
background-color: #fff;
border-radius: 16rpx;
padding: 28rpx;
}
.module-placeholder-title {
display: block;
font-size: 30rpx;
color: #333;
}
@media screen and (max-width: 1024px) {
.page {
min-width: 760px;

View File

@ -1,62 +1,16 @@
<template>
<view class="page">
<view class="container">
<text class="title">订单复核1</text>
<view class="search-bar">
<input
class="search-input"
v-model="keyword"
placeholder="请输入快递号/商品条码/拣货车/数量等关键词搜索订单"
confirm-type="search"
@confirm="handleSearch"
/>
<button class="search-btn" type="primary" @click="handleSearch">搜索</button>
</view>
<view class="result-list">
<view v-if="displayOrders.length === 0" class="empty">暂无匹配订单</view>
<view v-else v-for="order in displayOrders" :key="order.orderNo" class="order-item">
<text class="order-no">订单号:{{ order.orderNo }}</text>
<text class="order-user">客户:{{ order.customer }}</text>
</view>
</view>
</view>
<order-review-one compact-top />
</view>
</template>
<script>
export default {
name: 'OrderReviewOne',
data() {
return {
keyword: '',
displayOrders: [],
allOrders: [
{ orderNo: 'ORD20260516001', customer: '张三' },
{ orderNo: 'ORD20260516002', customer: '李四' },
{ orderNo: 'ORD20260516003', customer: '王五' },
],
}
},
onLoad() {
this.displayOrders = this.allOrders
},
methods: {
handleSearch() {
const query = this.keyword.trim().toLowerCase()
if (!query) {
this.displayOrders = this.allOrders
return
}
import OrderReviewOne from '@/components/order-review-one/index.vue'
this.displayOrders = this.allOrders.filter((order) => {
return (
String(order.orderNo || '').toLowerCase().includes(query) ||
String(order.customer || '').toLowerCase().includes(query)
)
})
},
export default {
name: 'OrderReviewOnePage',
components: {
OrderReviewOne,
},
}
</script>
@ -64,73 +18,9 @@ export default {
<style>
.page {
min-height: 100vh;
padding: 32rpx;
padding: 8rpx 32rpx 32rpx;
box-sizing: border-box;
background-color: #f8f8f8;
}
.container {
background: #fff;
border-radius: 16rpx;
padding: 28rpx;
}
.title {
font-size: 36rpx;
color: #333;
font-weight: 600;
margin-bottom: 24rpx;
}
.search-bar {
display: flex;
align-items: center;
gap: 16rpx;
margin-bottom: 24rpx;
}
.search-input {
flex: 1;
height: 72rpx;
border: 1rpx solid #e5e5e5;
border-radius: 10rpx;
padding: 0 20rpx;
font-size: 28rpx;
background-color: #fff;
}
.search-btn {
width: 160rpx;
height: 72rpx;
line-height: 72rpx;
font-size: 28rpx;
}
.result-list {
display: flex;
flex-direction: column;
gap: 12rpx;
}
.order-item {
padding: 20rpx;
border: 1rpx solid #edf0f5;
border-radius: 10rpx;
background-color: #fafbfe;
}
.order-no,
.order-user {
display: block;
font-size: 26rpx;
color: #333;
line-height: 1.5;
}
.empty {
text-align: center;
color: #999;
font-size: 26rpx;
padding: 24rpx 0;
}
</style>