diff --git a/pages/index/index.vue b/pages/index/index.vue
index 59cef77..5699895 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -75,14 +75,14 @@
-
+ {{ removeActionIconGlyph }}
@@ -108,6 +108,7 @@
class="drag-preview"
:style="dragPreviewStyle"
>
+ {{ removeActionIconGlyph }}
@@ -257,6 +258,10 @@
return uviewIcons['uicon-grid'] || '\ue673';
},
+ removeActionIconGlyph() {
+ return uviewIcons['uicon-minus-circle-fill'] || '\ue652';
+ },
+
totalPages() {
return Math.ceil(this.displayQuickActions.length / this.pageSize) || 1;
},
@@ -461,7 +466,7 @@
const latestActions = this.processMenus(userMenus, null);
// 2. 从Vuex获取已固定的菜单
- const savedFixedMenus = await this.$store.dispatch('setting/getValue', this.FIXED_MENU_KEY) || [];
+ const savedFixedMenus = await this.$store.dispatch('setting/getValue', this.FIXED_MENU_KEY);
const hasSavedConfig = Array.isArray(savedFixedMenus);
// 3. 如果存在已保存的常用配置(包括空数组),优先按配置展示
@@ -476,8 +481,10 @@
// 4. 如果没有有效的固定菜单,检查用户菜单
if (userMenus && userMenus.length > 0) {
console.log('从用户菜单生成快捷入口:', userMenus);
- // 根据用户菜单生成快捷入口
- this.quickActions = this.processMenus(userMenus, 24).map(item => this.normalizeAction(item)).filter(Boolean);
+ // 首次登录默认带出前12个菜单,并将收货作业、商品查询前置
+ const defaultQuickActions = this.prioritizeDefaultQuickActions(latestActions, 12);
+ this.quickActions = defaultQuickActions.map(item => this.normalizeAction(item)).filter(Boolean);
+ await this.saveQuickActionsOrder();
} else {
// 5. 如果还是没有菜单,返回空数组
console.log('用户没有可用菜单');
@@ -494,6 +501,42 @@
}
},
+ prioritizeDefaultQuickActions(actions, limit = 12) {
+ const source = Array.isArray(actions) ? actions.filter(Boolean) : [];
+ if (!source.length) {
+ return [];
+ }
+
+ const priorities = [
+ (menuName) => menuName === '收货作业' || (menuName.includes('收货') && menuName.includes('作业')),
+ (menuName) => menuName === '商品查询' || (menuName.includes('商品') && menuName.includes('查询'))
+ ];
+
+ const selectedKeys = new Set();
+ const prioritized = [];
+
+ priorities.forEach((matcher) => {
+ const matched = source.find((item) => {
+ const menuName = this.sanitizeText(item?.name || item?.meta?.title);
+ const key = this.getMenuKey(item);
+ return key && !selectedKeys.has(key) && matcher(menuName);
+ });
+
+ if (matched) {
+ const key = this.getMenuKey(matched);
+ selectedKeys.add(key);
+ prioritized.push(matched);
+ }
+ });
+
+ const remaining = source.filter((item) => {
+ const key = this.getMenuKey(item);
+ return key && !selectedKeys.has(key);
+ });
+
+ return [...prioritized, ...remaining].slice(0, limit);
+ },
+
// 辅助方法:验证和过滤菜单权限
validateAndFilterMenus(fixedMenus, latestActions) {
if (!Array.isArray(fixedMenus) || !Array.isArray(latestActions)) return [];
@@ -1376,6 +1419,16 @@
display: flex;
align-items: center;
justify-content: center;
+
+ .remove-action-icon {
+ font-family: 'uicon-iconfont' !important;
+ font-size: 44rpx;
+ line-height: 1;
+ font-style: normal;
+ font-weight: normal;
+ color: #ff4d4f;
+ display: block;
+ }
}
.grid-item-content {
@@ -1387,6 +1440,7 @@
justify-content: center;
width: 100%;
height: 100%;
+ pointer-events: none;
}
.item-icon-box {
@@ -1480,6 +1534,19 @@
pointer-events: none;
transform: scale(1.05);
+ .preview-remove-action-icon {
+ position: absolute;
+ top: 8rpx;
+ right: 8rpx;
+ font-family: 'uicon-iconfont' !important;
+ font-size: 44rpx;
+ line-height: 1;
+ font-style: normal;
+ font-weight: normal;
+ color: #ff4d4f;
+ display: block;
+ }
+
.item-icon-box {
width: 100rpx;
height: 100rpx;
diff --git a/pages/work/storage/receiving/receivingCreate.vue b/pages/work/storage/receiving/receivingCreate.vue
index 5f16a96..31f3619 100644
--- a/pages/work/storage/receiving/receivingCreate.vue
+++ b/pages/work/storage/receiving/receivingCreate.vue
@@ -29,7 +29,12 @@
-
+
+
+
+
+
+
@@ -180,6 +185,64 @@
},
methods: {
+ normalizeUniScanResult(scanResult) {
+ if (!scanResult) {
+ return '';
+ }
+
+ if (typeof scanResult === 'string') {
+ return scanResult.trim();
+ }
+
+ if (typeof scanResult.result === 'string') {
+ return scanResult.result.trim();
+ }
+
+ if (Array.isArray(scanResult.result)) {
+ const firstResult = scanResult.result.find(item => item);
+ if (typeof firstResult === 'string') {
+ return firstResult.trim();
+ }
+ if (firstResult && typeof firstResult.data === 'string') {
+ return firstResult.data.trim();
+ }
+ }
+
+ if (typeof scanResult.data === 'string') {
+ return scanResult.data.trim();
+ }
+
+ return '';
+ },
+ handleTrackingScan() {
+ uni.scanCode({
+ onlyFromCamera: false,
+ scanType: ['qrCode', 'barCode', 'datamatrix', 'pdf417'],
+ success: (res) => {
+ const rawCode = this.normalizeUniScanResult(res);
+ if (!rawCode) {
+ uni.showToast({
+ title: '未识别到有效内容',
+ icon: 'none'
+ });
+ return;
+ }
+
+ this.formData.tracking_number = rawCode;
+ },
+ fail: (error) => {
+ const errMsg = String(error?.errMsg || '').toLowerCase();
+ if (errMsg.includes('cancel')) {
+ return;
+ }
+
+ uni.showToast({
+ title: '扫码失败,请重试',
+ icon: 'none'
+ });
+ }
+ });
+ },
async loadStore() {
try {
const res = await this.$http("common.store", {});
@@ -224,8 +287,12 @@
});
}
// 如果没有提取到设备编号,也直接忽略,不提示用户
+ return;
+ }
+
+ if (this.formData.delivery_method === 'express') {
+ this.formData.tracking_number = scanText;
}
- // 如果不是REC开头的扫描,直接忽略
}
},
async handleSubmit() {
@@ -335,6 +402,33 @@
}
}
+ .tracking-input-wrap {
+ display: flex;
+ align-items: center;
+ gap: 16rpx;
+ width: 100%;
+
+ ::v-deep .u-input {
+ flex: 1;
+ }
+
+ .scan-camera-btn {
+ width: 76rpx;
+ height: 76rpx;
+ border-radius: 38rpx;
+ background: #eef4ff;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-shrink: 0;
+ box-shadow: 0 4rpx 12rpx rgba(41, 121, 255, 0.12);
+
+ &:active {
+ opacity: 0.85;
+ }
+ }
+ }
+
.submit-area {
display: flex;
flex-direction: row;