diff --git a/pages.json b/pages.json index 58d103f..6a3517f 100644 --- a/pages.json +++ b/pages.json @@ -141,6 +141,20 @@ { "titleNView": false } + }, + { + "path" : "pages/work/order/picking", + "style" : + { + "titleNView": false + } + }, + { + "path" : "pages/work/order/detail", + "style" : + { + "titleNView": false + } } ], diff --git a/pages/home/edit-quick-actions.vue b/pages/home/edit-quick-actions.vue index dcb7c96..19c4a26 100644 --- a/pages/home/edit-quick-actions.vue +++ b/pages/home/edit-quick-actions.vue @@ -313,6 +313,7 @@ toPath(item) { const menuName = String(item?.name || '').trim(); const isGoodsQuery = menuName === '商品查询' || (menuName.includes('商品') && menuName.includes('查询')); + const isOrderPicking = menuName === '订单拣货' || (menuName.includes('订单') && menuName.includes('拣货')); const rawPath = item?.component || item?.path || ''; const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : ''; const isRelocation = menuName === '移库作业' || normalizedPath === '/pages/work/storage/relocation'; @@ -326,7 +327,7 @@ } const targetPath = isGoodsQuery ? '/pages/work/product/query' - : normalizedPath; + : (isOrderPicking ? '/pages/work/order/picking' : normalizedPath); if (!targetPath) { uni.showToast({ diff --git a/pages/index/index.vue b/pages/index/index.vue index a3e9b99..c7ff6c2 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -289,6 +289,26 @@ }, methods: { + async getLatestUserInfo() { + try { + const latestUser = await this.$store.dispatch('getUserInfo'); + if (latestUser && typeof latestUser === 'object') { + this.userInfo = latestUser; + return latestUser; + } + } catch (error) { + console.warn('拉取最新用户信息失败,回退本地用户缓存:', error); + } + + const fallbackUser = this.$store.getters.user || this.userInfo || null; + if (fallbackUser && typeof fallbackUser === 'object') { + this.userInfo = fallbackUser; + return fallbackUser; + } + + return null; + }, + createDefaultDragPreviewSnapshot() { return { name: '未命名菜单', @@ -439,21 +459,7 @@ }, async loadUserInfo() { - // 等待用户信息加载 - await new Promise(resolve => setTimeout(resolve, 100)); - - if (!this.$store.getters.user) { - console.log('等待用户信息...'); - setTimeout(() => this.loadUserInfo(), 100); - return; - } - - const userData = this.$store.getters.user; - if (userData) { - this.isLoading = false; - this.userInfo = userData; - await this.refreshQuickActions(); - } + await this.refreshQuickActions(); }, // 刷新快捷入口 @@ -461,8 +467,16 @@ this.isLoading = true; try { + const latestUser = await this.getLatestUserInfo(); + if (!latestUser) { + console.log('用户信息不可用,快捷入口置空'); + this.quickActions = []; + this.ensureCurrentPageInRange(); + return; + } + // 1. 获取用户当前可用的菜单 - const userMenus = this.getUserMenus(); + const userMenus = this.getUserMenus(latestUser); const latestActions = this.processMenus(userMenus, null); // 2. 从Vuex获取已固定的菜单 @@ -1040,8 +1054,8 @@ }, // 获取用户菜单 - getUserMenus() { - const user = this.$store.getters.user; + getUserMenus(userData = null) { + const user = userData || this.userInfo || this.$store.getters.user; if (!user) return []; // 从用户信息中获取菜单 @@ -1133,6 +1147,7 @@ toPath(item) { const menuName = String(item?.name || '').trim(); const isGoodsQuery = menuName === '商品查询' || (menuName.includes('商品') && menuName.includes('查询')); + const isOrderPicking = menuName === '订单拣货' || (menuName.includes('订单') && menuName.includes('拣货')); const rawPath = item?.component || item?.path || ''; const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : ''; const isRelocation = menuName === '移库作业' || normalizedPath === '/pages/work/storage/relocation'; @@ -1146,7 +1161,7 @@ } const targetPath = isGoodsQuery ? '/pages/work/product/query' - : normalizedPath; + : (isOrderPicking ? '/pages/work/order/picking' : normalizedPath); if (!targetPath) { uni.showToast({ diff --git a/pages/work/order/detail.vue b/pages/work/order/detail.vue new file mode 100644 index 0000000..22c63c5 --- /dev/null +++ b/pages/work/order/detail.vue @@ -0,0 +1,288 @@ + + + + + \ No newline at end of file diff --git a/pages/work/order/picking.vue b/pages/work/order/picking.vue new file mode 100644 index 0000000..b37622e --- /dev/null +++ b/pages/work/order/picking.vue @@ -0,0 +1,479 @@ + + + + + \ No newline at end of file