From 03a05815d7ea5612206b6cfe5d6537b4d4cedc0a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 15 九月 2026 11:41:32 +0800
Subject: [PATCH] 天津潜宇塑胶app 1.添加采购需求、库存盘点、计件单价配置、产量统计、材料消耗核算、成本核算分析页面
---
src/pages/procurementManagement/procurementLedger/detail.vue | 68 ++++++++++++++++++++++++++++++++--
1 files changed, 64 insertions(+), 4 deletions(-)
diff --git a/src/pages/procurementManagement/procurementLedger/detail.vue b/src/pages/procurementManagement/procurementLedger/detail.vue
index 397d863..72cfc73 100644
--- a/src/pages/procurementManagement/procurementLedger/detail.vue
+++ b/src/pages/procurementManagement/procurementLedger/detail.vue
@@ -204,6 +204,14 @@
:disabled="!canEditProducts"
@click="openSpecificationPicker(idx)" />
<template #right>
+ <view v-if="canEditProducts"
+ class="scan-entry"
+ @click.stop="scanBarcode(idx)">
+ <up-icon name="scan"
+ size="18"
+ color="#3c9cff"></up-icon>
+ <text class="scan-entry-text">鎵爜</text>
+ </view>
<up-icon name="arrow-right"
v-if="canEditProducts"
@click="openSpecificationPicker(idx)"></up-icon>
@@ -338,7 +346,11 @@
<script setup>
import { onMounted, ref, computed } from "vue";
- import { modelList, productTreeList } from "@/api/basicData/product.js";
+ import {
+ modelList,
+ productTreeList,
+ modelByBarcode,
+ } from "@/api/basicData/product.js";
import useUserStore from "@/store/modules/user";
import { calculateTaxExclusiveTotalPrice } from "@/utils/summarizeTable";
import { formatDateToYMD } from "@/utils/ruoyi";
@@ -447,6 +459,7 @@
name: model.text,
value: model.value,
unit: model.unit,
+ subname: model.barcode ? `鏉$爜锛�${model.barcode}` : "",
}));
});
@@ -670,14 +683,48 @@
showCategoryPicker.value = false;
};
- // 鑾峰彇瑙勬牸鍨嬪彿
+ // 鑾峰彇瑙勬牸鍨嬪彿锛堣繑鍥� Promise锛屼究浜庢壂鐮佸悗椤哄簭鍥炲~锛�
const getModels = value => {
- modelList({ id: value }).then(res => {
- modelOptions.value = res.map(user => ({
+ return modelList({ id: value }).then(res => {
+ const list = res?.data || res || [];
+ modelOptions.value = list.map(user => ({
text: user.model,
value: user.id,
unit: user.unit,
+ barcode: user.barcode,
}));
+ });
+ };
+
+ // 鎵爜鎸夋潯鐮佺簿纭洖濉骇鍝佸ぇ绫�+瑙勬牸鍨嬪彿
+ const scanBarcode = idx => {
+ if (!canEditProducts.value) return;
+ uni.scanCode({
+ scanType: ["barCode", "qrCode"],
+ success: async res => {
+ const barcode = (res.result || "").trim();
+ if (!barcode) return;
+ uni.showLoading({ title: "鍖归厤涓�...", mask: true });
+ try {
+ const resp = await modelByBarcode({ barcode });
+ const info = resp?.data || resp;
+ if (info && info.productId) {
+ currentProductIndex.value = idx;
+ // 鍏堝姞杞借浜у搧涓嬬殑瑙勬牸鍒楄〃锛屼繚璇佷笌鎵嬪姩閫夋嫨鏃剁殑 UI 鐘舵�佷竴鑷�
+ await getModels(info.productId);
+ const row = productData.value[idx];
+ row.productCategory = info.productName || row.productCategory;
+ row.specificationModel = info.model || "";
+ row.productModelId = info.id || "";
+ row.unit = info.unit || "";
+ }
+ uni.hideLoading();
+ uni.showToast({ title: "宸插尮閰嶈鏍�", icon: "success" });
+ } catch (e) {
+ // 鏈尮閰嶇瓑閿欒宸叉湁鍏ㄥ眬 toast锛岃繖閲屽彧鎭㈠ loading
+ uni.hideLoading();
+ }
+ },
});
};
@@ -1119,6 +1166,19 @@
<style scoped lang="scss">
@import "@/static/scss/form-common.scss";
+ // 瑙勬牸琛屾壂鐮佸叆鍙�
+ .scan-entry {
+ display: flex;
+ align-items: center;
+ margin-right: 8px;
+
+ .scan-entry-text {
+ font-size: 13px;
+ color: #3c9cff;
+ margin-left: 2px;
+ }
+ }
+
.approval-process {
background: #fff;
margin: 16px;
--
Gitblit v1.9.3