From 796c6f914284aacd7b4abdaf50e6ff06df7faf71 Mon Sep 17 00:00:00 2001
From: ZN <zhang_12370@163.com>
Date: 星期二, 24 三月 2026 10:46:27 +0800
Subject: [PATCH] feat(扫码弹窗): 优化扫码列表显示并调整API调用

---
 src/pages/components/ScanListPopup.vue |  102 ++++++++++++++++++++++++++++++---------------------
 1 files changed, 60 insertions(+), 42 deletions(-)

diff --git a/src/pages/components/ScanListPopup.vue b/src/pages/components/ScanListPopup.vue
index 1d1a0eb..308b637 100644
--- a/src/pages/components/ScanListPopup.vue
+++ b/src/pages/components/ScanListPopup.vue
@@ -25,13 +25,13 @@
                 >
                     {{ isScanning ? '鎵爜涓�...' : '缁х画鎵爜' }}
                 </up-button>
-                <up-button 
-                    type="success" 
-                    size="small" 
-                    @click="exportToCSV"
-                >
-                    瀵煎嚭琛ㄦ牸
-                </up-button>
+<!--                <up-button -->
+<!--                    type="success" -->
+<!--                    size="small" -->
+<!--                    @click="exportToCSV"-->
+<!--                >-->
+<!--                    瀵煎嚭琛ㄦ牸-->
+<!--                </up-button>-->
                 <up-button 
                     type="error" 
                     size="small" 
@@ -56,7 +56,7 @@
                     >
                         <view class="item-header">
                             <text class="item-index">#{{ index + 1 }}</text>
-                            <text class="item-time">{{ item.scanTime }}</text>
+                            <text class="item-time">{{  formatTime(item.scanTime) }}</text>
                             <view class="item-delete" @click="deleteItem(index)">
                                 <up-icon name="trash" size="16" color="#f56c6c"></up-icon>
                             </view>
@@ -69,35 +69,43 @@
                             </view>
                             <view class="item-row">
                                 <text class="item-label">浜у搧鍚嶇О锛�</text>
-                                <text class="item-value">{{ item.productCategory || '-' }}</text>
+                                <text class="item-value">{{ item.productName || '-' }}</text>
                             </view>
+                          <view class="item-row">
+                            <text class="item-label">浜у搧楂樺害锛�</text>
+                            <text class="item-value">{{ item.height || '-' }}</text>
+                          </view>
+                          <view class="item-row">
+                            <text class="item-label">鍗曚綅锛�</text>
+                            <text class="item-value">{{ item.specificationModelUnit || '-' }}</text>
+                          </view>
                             <view class="item-row">
-                                <text class="item-label">浜у搧楂樺害锛�</text>
-                                <text class="item-value">{{ item.specificationModelUnit || '-' }}</text>
-                            </view>
-                            <view class="item-row">
-                                <text class="item-label">鍗曚环锛堢編鍏冿級/浠讹細</text>
+                                <text class="item-label">鍗曚环锛堜汉姘戝竵锛�/浠讹細</text>
                                 <text class="item-value">{{ item.taxInclusiveUnitPrice || '-' }}</text>
                             </view>
+                          <view class="item-row">
+                            <text class="item-label">鍗曚环锛堢編鍏冿級/浠讹細</text>
+                            <text class="item-value">{{ item.dollarPrice || '-' }}</text>
+                          </view>
                             <view class="item-row">
                                 <text class="item-label">鍏ュ簱鏁伴噺/浠讹細</text>
-                                <text class="item-value">{{ item.inboundNum || '-' }}</text>
+                                <text class="item-value">{{ item.qualitity || '-' }}</text>
                             </view>
                             <view class="item-row">
                                 <text class="item-label">姣忎欢鏁伴噺/鏀細</text>
                                 <text class="item-value">{{ item.boxNum || '-' }}</text>
                             </view>
                             <view class="item-row">
-                                <text class="item-label">绾哥瑙勬牸锛�</text>
-                                <text class="item-value">{{ item.cartonSpecifications || '-' }}</text>
+                                <text class="item-label">瑙勬牸鍨嬪彿锛�</text>
+                                <text class="item-value">{{ item.model || '-' }}</text>
                             </view>
                             <view class="item-row">
                                 <text class="item-label">鍏ュ簱浜猴細</text>
-                                <text class="item-value">{{ item.createBy || '-' }}</text>
+                                <text class="item-value">{{ item.createUserName || '-' }}</text>
                             </view>
                             <view class="item-row">
                                 <text class="item-label">鍏ュ簱鏃堕棿锛�</text>
-                                <text class="item-value">{{ item.inboundDate || '-' }}</text>
+                                <text class="item-value">{{ item.createTime || '-' }}</text>
                             </view>
                         </view>
                     </view>
@@ -106,17 +114,17 @@
         </view>
     </uni-popup>
 </template>
- 
+
 <script setup>
 import { ref, reactive } from 'vue';
-import { stockinDetail, detailManagementByCustom, exportScanList } from '@/api/inventoryManagement/receiptManagement'
+import { stockinDetail, detailManagementByCustom,detailManagement, exportScanList } from '@/api/inventoryManagement/receiptManagement'
 import config from '@/config'
 import { getToken } from '@/utils/auth'
 import request from '@/utils/request'
 
 const baseUrl = config.imgUrl
 const emit = defineEmits(['scan', 'close']);
- 
+
 // 寮圭獥鏄剧ず鐘舵��
 const popupRef = ref();
 const isScanning = ref(false);
@@ -165,18 +173,17 @@
         });
         return;
     }
-    
+
     let barcodeList = barcode.split(",");
     let barcodeId = barcodeList[0];
     let type = barcodeList[1];
     let detailApi = null;
-    
+
     if (type == 1) {
         detailApi = stockinDetail;
     } else if (type == 2) {
-        detailApi = detailManagementByCustom;
+        detailApi = detailManagement;
     }
-    
     if (!detailApi) {
         uni.showToast({
             title: "璇锋壂鎻忔纭殑浜岀淮鐮�",
@@ -185,8 +192,9 @@
         });
         return;
     }
-    
+
     // 妫�鏌ユ槸鍚﹀凡瀛樺湪
+  console.log("scanList",scanList)
     const existingIndex = scanList.findIndex(item => item.barcodeId === barcodeId && item.type === type);
     if (existingIndex !== -1) {
         uni.showToast({
@@ -196,17 +204,18 @@
         });
         return;
     }
-    
+
     try {
         uni.showLoading({
             title: '鑾峰彇浜у搧淇℃伅涓�...',
             mask: true
         });
-        
+        console.log('barcodeId',barcodeId);
         const resp = await detailApi({ id: barcodeId });
-        
+        console.log('resp',resp );
+
         uni.hideLoading();
-        
+
         if (resp.code != 200) {
             uni.showToast({
                 title: resp.msg,
@@ -215,7 +224,7 @@
             });
             return;
         }
-        
+
         if (!resp.data) {
             uni.showToast({
                 title: '鍟嗗搧涓嶅瓨鍦�',
@@ -224,7 +233,7 @@
             });
             return;
         }
-        
+
         // 娣诲姞鍒板垪琛�
         const scanTime = new Date().toLocaleString('zh-CN', {
             year: 'numeric',
@@ -234,7 +243,7 @@
             minute: '2-digit',
             second: '2-digit'
         });
-        
+
         scanList.push({
             barcodeId: barcodeId,
             type: type,
@@ -242,16 +251,16 @@
             ...resp.data,
             specificationModelUnit: (resp.data.specificationModel || '') + (resp.data.unit || '')
         });
-        
+
         uni.showToast({
             title: '鎵爜鎴愬姛',
             icon: 'success',
             duration: 1500
         });
-        
+
         // 瑙﹀彂鎵爜浜嬩欢
         emit('scan', resp.data);
-        
+
     } catch (error) {
         uni.hideLoading();
         uni.showToast({
@@ -320,16 +329,16 @@
             barcodeId: item.barcodeId,
             type: item.type,
             scanTime: item.scanTime,
-            productCategory: item.productCategory,
+          productName: item.productName,
             specificationModel: item.specificationModel,
             unit: item.unit,
             specificationModelUnit: item.specificationModelUnit,
             taxInclusiveUnitPrice: item.taxInclusiveUnitPrice,
-            inboundNum: item.inboundNum,
+            qualitity: item.qualitity,
             boxNum: item.boxNum,
-            cartonSpecifications: item.cartonSpecifications,
-            createBy: item.createBy,
-            inboundDate: item.inboundDate,
+            model: item.model,
+            createUserName: item.createUserName,
+            createTime: item.createTime,
             url: item.url
         }));
 
@@ -443,6 +452,15 @@
     }
 };
 
+// 鏃堕棿鏍煎紡鍖栧嚱鏁�
+// 鏃堕棿鏍煎紡鍖栧嚱鏁�
+const formatTime = (timestamp) => {
+  if (!timestamp) return '';
+  const time = timestamp.toString().length === 10 ? timestamp * 1000 : timestamp;
+  const date = new Date(time);
+  return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')} ${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}:${String(date.getSeconds()).padStart(2, '0')}`;
+};
+
 // 寮圭獥鎵撳紑浜嬩欢
 const handleOpen = () => {
     // 寮圭獥鎵撳紑鏃剁殑澶勭悊

--
Gitblit v1.9.3