From 5392dc649209ff372ec276aa6cbf86b16b12a375 Mon Sep 17 00:00:00 2001
From: 周宾 <2802492122@qq.com>
Date: 星期五, 26 十二月 2025 16:41:16 +0800
Subject: [PATCH] 天津双奇点-仓储物流板块开发

---
 src/pages/index.vue |   77 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 77 insertions(+), 0 deletions(-)

diff --git a/src/pages/index.vue b/src/pages/index.vue
index 47eee18..c71cd5e 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -209,14 +209,17 @@
 				</up-grid>
 			</view>
 		</view>
+		<GoodsDetailPopup ref="refGoodsDetailPopup"></GoodsDetailPopup>
 	</view>
 </template>
 
 <script setup>
 import {ref, onMounted, nextTick, reactive} from 'vue';
 import {userLoginFacotryList} from "@/api/login";
+import { stockinDetail, detailManagementByCustom } from '@/api/inventoryManagement/receiptManagement'
 import modal from "@/plugins/modal";
 import useUserStore from "@/store/modules/user";
+import GoodsDetailPopup from './components/GoodsDetailPopup.vue';
 
 const userStore = useUserStore()
 const factoryId = ref('');
@@ -259,6 +262,10 @@
 	{
 		icon: '/static/images/icon/huikuandengji@2x.png',
 		label: '搴撳瓨绠$悊',
+	},
+	{
+		icon: '/static/images/icon/huikuandengji@2x.png',
+		label: '浜у搧鎵爜',
 	}
 ]);
 
@@ -558,6 +565,9 @@
 				url: '/pages/inventoryManagement/stockManagement/index'
 			});
 			break
+		case '浜у搧鎵爜':
+			scanQRCode()
+			break
 		default:
 			uni.showToast({
 				title: `鐐瑰嚮浜�${item.label}`,
@@ -612,6 +622,73 @@
 	});
 }
 
+
+//寮�濮嬫壂鐮�
+const scanQRCode = ()=>{
+	uni.scanCode({
+		onlyFromCamera:true,
+		scanType:['barCode','qrCode'],
+		success(res) {
+			searchDetail(res.result||'')
+		},
+		fail(res) {
+			uni.showToast({
+				title: res.errMsg||'鎵爜澶辫触',
+				icon: 'none',
+				duration: 1500
+			})
+		}
+	})
+}
+
+//璋堟鐩稿叧
+const refGoodsDetailPopup = ref(null)
+
+
+//鏌ョ湅璇︽儏
+const searchDetail = (barcode)=>{
+	if(!barcode||barcode.indexOf(',')==-1){
+		uni.showToast({
+			title:"璇锋壂鎻忔纭殑浜岀淮鐮�",
+			icon: 'none',
+			duration: 1500
+		})
+		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
+	}
+	
+	if(!detailApi){
+		uni.showToast({
+			title:"璇锋壂鎻忔纭殑浜岀淮鐮�",
+			icon: 'none',
+			duration: 1500
+		})
+		return
+	}
+	detailApi({id:barcodeId}).then((resp) => {
+		if(resp.code!=200||!resp.data)return
+		// barcodeDetail.value = resp.data
+		refGoodsDetailPopup.value.open({
+			type: type,
+			...resp.data
+		})
+	}).catch(() => {
+		uni.showToast({
+			title: "鑾峰彇鏁版嵁澶辫触",
+			icon: 'none',
+			duration: 1500
+		});
+	})
+}
+
 // 瀹氫箟鏂规硶
 const click = (name) => {
 	if (uToastRef.value) {

--
Gitblit v1.9.3