From f1ec04c1029252d51b0ec90569328c5dd0bca698 Mon Sep 17 00:00:00 2001 From: zm2000 <18386612143@163.com> Date: Sat, 16 May 2026 17:59:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=94=A8=E6=88=B7=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E5=88=87=E6=8D=A2=E3=80=81=E8=AE=A2=E5=8D=95=E5=A4=8D?= =?UTF-8?q?=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages.json | 13 +- src/pages/index/index.vue | 410 +++++++++++++++++++++++++++++++++++++- src/pages/login/login.vue | 135 ++++++++----- src/pages/order/index.vue | 136 +++++++++++++ 4 files changed, 633 insertions(+), 61 deletions(-) create mode 100644 src/pages/order/index.vue diff --git a/src/pages.json b/src/pages.json index f605716..bc453bf 100644 --- a/src/pages.json +++ b/src/pages.json @@ -3,19 +3,26 @@ { "path": "pages/login/login", "style": { - "navigationBarTitleText": "登录" + "titleNView": false } }, { "path": "pages/index/index", "style": { - "navigationBarTitleText": "uni-app" + "titleNView": false + } + }, + { + "path": "pages/order/index", + "style": { + "titleNView": false, + "navigationBarTitleText": "订单复核1" } } ], "globalStyle": { "navigationBarTextStyle": "black", - "navigationBarTitleText": "uni-app", + "navigationBarTitleText": "wms_worker_station", "navigationBarBackgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8" } diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 31bc129..caa186b 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -2,15 +2,64 @@ + + + {{ getMenuTitle(menu) }} + + - 我的 + + + {{ getTopNavRealName() }} + + + + + + + + + + + 暂无匹配订单 + + 订单号:{{ order.orderNo }} + 客户:{{ order.customer }} + + + + + @@ -22,20 +71,190 @@ export default { uni.reLaunch({ url: '/pages/login/login', }) + return } + + this.loadCurrentUserInfo(token) }, data() { return { showMinePopup: false, + currentUser: null, + activeMenuPath: '', + orderKeyword: '', + displayOrders: [], + allOrders: [ + { orderNo: 'ORD20260516001', customer: '张三' }, + { orderNo: 'ORD20260516002', customer: '李四' }, + { orderNo: 'ORD20260516003', customer: '王五' }, + ], } }, methods: { + getTopMenus() { + const menus = this.currentUser?.menus + if (!Array.isArray(menus)) { + return [] + } + + return menus.filter((menu) => !menu?.hidden) + }, + getMenuTitle(menu) { + return menu?.meta?.title || menu?.name || '未命名菜单' + }, + normalizeMenuPath(menu) { + const rawPath = (menu?.path || '').trim() + if (!rawPath) { + return '' + } + + return rawPath.startsWith('/') ? rawPath : `/${rawPath}` + }, + isMenuActive(menu) { + const path = this.normalizeMenuPath(menu) + return !!path && this.activeMenuPath === path + }, + handleMenuClick(menu) { + const rawPath = (menu?.path || '').trim() + + if (!rawPath) { + uni.showToast({ + title: '菜单路径为空', + icon: 'none', + }) + return + } + + 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 + 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) + ) + }) + }, + getTopNavRealName() { + const employees = this.currentUser?.employees || [] + if (employees.length && employees[0]?.real_name) { + return employees[0].real_name + } + + return this.currentUser?.real_name || '未命名用户' + }, + isCurrentRole(employee) { + return Number(employee?.is_primary) === 1 + }, + handleChangeRole(employee) { + const employeeId = employee?.id + const token = uni.getStorageSync('token') + + if (!employeeId || !token) { + return + } + + uni.request({ + url: `http://192.168.11.56:6060/system?method=user.changeRole&v=1.0×tamp=${Date.now()}`, + method: 'POST', + header: { + accept: 'application/json, text/plain, */*', + 'content-type': 'application/json', + platform: 'workerstation', + project: 'warehouse', + token, + Authorization: `Bearer ${token}`, + }, + data: { + roleId: employeeId, + device: 'workerstation', + project: 'warehouse', + }, + success: (res) => { + const body = res?.data || {} + const isSuccess = body?.code === 0 || body?.success === true || body?.status === 1 + + if (!isSuccess && (body?.msg || body?.message)) { + uni.showToast({ + title: body?.msg || body?.message, + icon: 'none', + }) + return + } + + this.loadCurrentUserInfo(token) + uni.showToast({ + title: '角色切换成功', + icon: 'success', + }) + }, + fail: () => { + uni.showToast({ + title: '角色切换失败', + icon: 'none', + }) + }, + }) + }, openMinePopup() { this.showMinePopup = true }, closeMinePopup() { this.showMinePopup = false }, + loadCurrentUserInfo(token) { + uni.request({ + url: `http://192.168.11.56:6060/system?method=user.info&v=1.0×tamp=${Date.now()}`, + method: 'POST', + header: { + accept: 'application/json, text/plain, */*', + platform: 'workerstation', + project: 'warehouse', + token, + Authorization: `Bearer ${token}`, + }, + data: { + device: 'workerstation', + project: 'warehouse', + }, + success: (res) => { + const body = res?.data || {} + this.currentUser = body?.data || body?.result || body || null + }, + }) + }, finishLogout() { uni.removeStorageSync('token') uni.showToast({ @@ -81,11 +300,10 @@ export default { min-height: 100vh; min-width: 960px; box-sizing: border-box; - padding: 56rpx; - background-color: #2fbf71; + padding: 0; display: flex; flex-direction: column; - align-items: center; + align-items: stretch; justify-content: flex-start; } @@ -95,25 +313,89 @@ export default { margin: 0 0 24rpx; padding: 18rpx 28rpx; box-sizing: border-box; - border-radius: 16rpx; background-color: #2f7dff; display: flex; align-items: center; - justify-content: space-between; + justify-content: flex-start; position: relative; } .top-nav-right { position: relative; + margin-left: auto; } .top-nav-logo { height: 90rpx; } +.top-nav-menu-wrap { + display: flex; + align-items: center; + margin-left: 36rpx; + gap: 14rpx; + flex-wrap: wrap; +} + +.top-nav-menu-item { + padding: 10rpx 18rpx; +} + +.top-nav-menu-item--active { + box-shadow: inset 0 -4rpx 0 #fff; +} + +.top-nav-menu-text { + font-size: 32rpx; + color: #fff; + line-height: 1; +} + .top-nav-mine { - font-size: 30rpx; - font-weight: 600; + display: flex; + align-items: center; + gap: 10rpx; +} + +.top-nav-mine-icon { + width: 44rpx; + height: 44rpx; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + border-radius: 999rpx; + background-color: rgba(255, 255, 255, 0.2); + box-sizing: border-box; +} + +.top-nav-mine-icon-head { + width: 12rpx; + height: 12rpx; + border: 2rpx solid #fff; + border-radius: 50%; + box-sizing: border-box; +} + +.top-nav-mine-icon-body { + width: 20rpx; + height: 10rpx; + margin-top: 4rpx; + border: 2rpx solid #fff; + border-top: none; + border-radius: 0 0 12rpx 12rpx; + box-sizing: border-box; +} + +.top-nav-mine-icon, +.top-nav-mine-icon-head, +.top-nav-mine-icon-body { + color: #fff; +} + +.top-nav-mine-name { + font-size: 32rpx; + line-height: 1; color: #fff; } @@ -130,6 +412,39 @@ export default { box-shadow: 0 12rpx 30rpx rgba(0, 0, 0, 0.14); } +.popup-user-info { + margin-bottom: 18rpx; +} + +.popup-user-item { + padding: 12rpx 10rpx; + border-bottom: 1rpx solid #eef2f7; + display: flex; + align-items: center; + justify-content: space-between; + cursor: pointer; +} + +.popup-user-item:last-child { + border-bottom: none; +} + +.popup-user-item--current { + background-color: #eef5ff; + border-radius: 8rpx; +} + +.popup-user-text { + display: block; + font-size: 24rpx; + color: #333; + line-height: 1.5; +} + +.popup-user-item--current .popup-user-text { + color: #2f7dff; +} + .logout-btn, .close-btn { width: 100%; @@ -150,10 +465,70 @@ export default { color: #333; } +.content-wrap { + padding: 0 28rpx 24rpx; +} + +.order-module { + background-color: #fff; + border-radius: 16rpx; + padding: 24rpx; +} + +.order-search-bar { + display: flex; + align-items: center; + gap: 12rpx; + margin-bottom: 18rpx; +} + +.order-search-input { + flex: 1; + height: 72rpx; + border: 1rpx solid #e5e5e5; + border-radius: 10rpx; + padding: 0 18rpx; + font-size: 28rpx; +} + +.order-search-btn { + width: 150rpx; + height: 72rpx; + line-height: 72rpx; + font-size: 26rpx; +} + +.order-result-list { + display: flex; + flex-direction: column; + gap: 12rpx; +} + +.order-item { + background-color: #fafbfe; + border: 1rpx solid #edf0f5; + border-radius: 10rpx; + padding: 16rpx; +} + +.order-item-text { + display: block; + font-size: 26rpx; + color: #333; + line-height: 1.5; +} + +.order-empty { + text-align: center; + color: #999; + font-size: 26rpx; + padding: 20rpx 0; +} + @media screen and (max-width: 1024px) { .page { min-width: 760px; - padding: 36rpx; + padding: 0; } .top-nav { @@ -161,6 +536,19 @@ export default { padding: 16rpx 20rpx; } + .top-nav-menu-wrap { + margin-left: 24rpx; + gap: 10rpx; + } + + .top-nav-menu-item { + padding: 8rpx 14rpx; + } + + .top-nav-menu-text { + font-size: 22rpx; + } + .top-nav-logo { height: 78rpx; } @@ -177,5 +565,9 @@ export default { line-height: 58rpx; font-size: 24rpx; } + + .content-wrap { + padding: 0 20rpx 18rpx; + } } diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue index d67f4bb..7a769dc 100644 --- a/src/pages/login/login.vue +++ b/src/pages/login/login.vue @@ -22,54 +22,56 @@ - - 打开微信,扫描二维码登录 - - - {{ scanCode || '二维码区域' }} + + + 打开微信,扫描二维码登录 + + + {{ scanCode || '二维码区域' }} + + {{ scanStatus }} - {{ scanStatus }} - - - - - - × - - - - - - × - - - - - + - @@ -247,7 +249,6 @@ export default { const fallbackUrl = this.buildFallbackQrImageUrlByPageUrl(this.scanMiniProgramUrl) if (fallbackUrl && this.scanQrImage !== fallbackUrl) { this.scanQrImage = fallbackUrl - this.scanStatus = '主二维码通道受限,已切换备用通道' return } @@ -490,7 +491,6 @@ export default { .visual-side { width: 45%; - min-height: 720rpx; display: flex; flex-direction: column; align-items: center; @@ -520,6 +520,8 @@ export default { width: 55%; box-sizing: border-box; padding: 64rpx 56rpx; + display: flex; + flex-direction: column; } .header { @@ -575,14 +577,41 @@ export default { padding: 28rpx; } +.panel-stage { + position: relative; + min-height: 560rpx; +} + +.panel--mode { + position: static; +} + +.panel--scan { + padding: 20rpx; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.panel--account { + display: flex; + flex-direction: column; +} + +.panel--account .primary-btn { + margin-top: 86rpx; +} + .scan-box { - height: 360rpx; + width: 320rpx; + height: 320rpx; border: 2rpx dashed #d9d9d9; border-radius: 12rpx; display: flex; align-items: center; justify-content: center; - margin-bottom: 24rpx; + margin: 0 auto 16rpx; } .scan-image { @@ -648,6 +677,10 @@ export default { box-shadow: 0 0 0 4rpx rgba(0, 122, 255, 0.08); } +.password-wrap { + margin-top: 16rpx; +} + .password-input { margin-bottom: 0; padding-right: 156rpx; @@ -750,7 +783,8 @@ export default { } .primary-btn { - margin-top: 12rpx; + width: 100%; + margin-top: 24rpx; } .scan-login-btn { @@ -774,7 +808,6 @@ export default { .visual-side { width: 45%; - min-height: 660rpx; padding: 64rpx 40rpx; } @@ -782,5 +815,9 @@ export default { width: 55%; padding: 56rpx 40rpx; } + + .panel-stage { + min-height: 520rpx; + } } \ No newline at end of file diff --git a/src/pages/order/index.vue b/src/pages/order/index.vue new file mode 100644 index 0000000..d74c282 --- /dev/null +++ b/src/pages/order/index.vue @@ -0,0 +1,136 @@ + + + + +