From f3867fda6adc7d5ab6b32f61981d87e080a39f8c Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期六, 28 三月 2026 13:44:32 +0800
Subject: [PATCH] Merge branch 'dev_HXSJ' of http://114.132.189.42:9002/r/product-inventory-management into dev_HXSJ

---
 src/views/procurementManagement/procurementLedger/index.vue |  128 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 128 insertions(+), 0 deletions(-)

diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index e4117b4..400f061 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -552,6 +552,11 @@
 							</el-select>
 						</el-form-item>
 					</el-col>
+          <el-col :span="24">
+            <el-form-item label=" ">
+              <el-button type="warning" :disabled="!(productForm.productId && productForm.productModelId && productForm.taxRate)" @click="showPriceReference" icon="Search">鏌ョ湅鍘嗗彶閲囪喘浠锋牸鍙傝��</el-button>
+            </el-form-item>
+          </el-col>
         </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
@@ -636,6 +641,62 @@
           <el-button type="primary" @click="submitProduct">纭</el-button>
           <el-button @click="closeProductDia">鍙栨秷</el-button>
         </div>
+      </template>
+    </el-dialog>
+
+    <!-- 鍘嗗彶閲囪喘浠锋牸鍙傝�冨脊绐� -->
+    <el-dialog
+      v-model="priceReferenceVisible"
+      title="鍘嗗彶閲囪喘浠锋牸鍙傝��"
+      width="1000px"
+      append-to-body
+    >
+      <el-table 
+        v-loading="priceReferenceLoading"
+        :data="priceReferenceData" 
+        border 
+        style="width: 100%"
+      >
+        <el-table-column label="鍟嗗搧鍚嶇О" prop="productName" min-width="150" show-overflow-tooltip />
+        <el-table-column label="瑙勬牸鍨嬪彿" prop="specification" width="150" show-overflow-tooltip />
+        <el-table-column label="渚涘簲鍟�" prop="supplierName" width="200" show-overflow-tooltip />
+        <el-table-column label="鍩虹浠锋牸" width="120" align="right">
+          <template #default="{ row }">
+            <span style="color: #f56c6c; font-weight: bold;">楼{{ row.basePrice }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="鎶樻墸淇℃伅" width="120" align="center">
+          <template #default="{ row }">
+            <el-tag v-if="row.discountType === 'percentage'" type="success">
+              {{ row.discountValue }}%
+            </el-tag>
+            <el-tag v-else-if="row.discountType === 'fixed'" type="warning">
+              -楼{{ row.discountValue }}
+            </el-tag>
+            <span v-else>鏃犳姌鎵�</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="鐢熸晥鏃堕棿" prop="effectiveTime" width="180" align="center" />
+        <el-table-column label="鎿嶄綔" width="100" align="center" fixed="right">
+          <template #default="{ row }">
+            <el-button type="primary" link @click="selectPriceReference(row)">閫夋嫨</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <div class="pagination-container" style="margin-top: 20px; display: flex; justify-content: flex-end;">
+        <el-pagination
+          v-model:current-page="priceReferencePagination.current"
+          v-model:page-size="priceReferencePagination.size"
+          :page-sizes="[10, 20, 50]"
+          :total="priceReferenceTotal"
+          layout="total, sizes, prev, pager, next"
+          @size-change="handlePriceReferenceSizeChange"
+          @current-change="handlePriceReferenceCurrentChange"
+        />
+      </div>
+      <template #footer>
+        <el-button @click="priceReferenceVisible = false">鍏抽棴</el-button>
       </template>
     </el-dialog>
 
@@ -903,6 +964,7 @@
 let nextApproverId = 2;
 import useUserStore from "@/store/modules/user";
 import { modelList, productTreeList } from "@/api/basicData/product.js";
+import { listPage as listAdvancedPrice } from "@/api/procurementManagement/advancedPriceManagement.js";
 import dayjs from "dayjs";
 
 const userStore = useUserStore();
@@ -996,6 +1058,72 @@
   },
 });
 const { productForm, productRules } = toRefs(productFormData);
+
+// 閲囪喘浠锋牸绠$悊鍙傝�冨脊绐�
+const priceReferenceVisible = ref(false);
+const priceReferenceLoading = ref(false);
+const priceReferenceData = ref([]);
+const priceReferenceTotal = ref(0);
+const priceReferencePagination = reactive({
+  current: 1,
+  size: 10
+});
+
+const showPriceReference = () => {
+  priceReferenceVisible.value = true;
+  handlePriceReferenceSearch();
+};
+
+const handlePriceReferenceSearch = () => {
+  priceReferenceLoading.value = true;
+  // 妯℃嫙鎼滅储鍙傛暟锛歱roductId 鏄犲皠涓� productName 鎴� ID锛岃繖閲屾牴鎹� advancedPriceManagement 鐨� API 纭畾鍙傛暟
+  // 鍋囪楂樼骇浠锋牸绠$悊鐨� listPage 鎺ユ敹 productId
+  const query = {
+    productId: productForm.value.productId,
+    specificationId: productForm.value.productModelId,
+    current: priceReferencePagination.current,
+    size: priceReferencePagination.size
+  };
+  listAdvancedPrice(query).then(res => {
+    priceReferenceData.value = res.data.records;
+    priceReferenceTotal.value = res.data.total;
+    priceReferenceLoading.value = false;
+  }).catch(() => {
+    priceReferenceLoading.value = false;
+  });
+};
+
+const handlePriceReferenceSizeChange = (size) => {
+  priceReferencePagination.size = size;
+  handlePriceReferenceSearch();
+};
+
+const handlePriceReferenceCurrentChange = (page) => {
+  priceReferencePagination.current = page;
+  handlePriceReferenceSearch();
+};
+
+const selectPriceReference = (row) => {
+   // 璁$畻瀹為檯浠锋牸锛氬熀纭�浠锋牸 - 鎶樻墸
+   let actualPrice = row.basePrice;
+   if (row.discountType === 'percentage') {
+     actualPrice = row.basePrice * (1 - row.discountValue / 100);
+   } else if (row.discountType === 'fixed') {
+     actualPrice = row.basePrice - row.discountValue;
+   }
+   
+   // 濉厖鍚◣鍗曚环锛屼繚鐣欎袱浣嶅皬鏁�
+   productForm.value.taxInclusiveUnitPrice = Number(Math.max(actualPrice, 0)).toFixed(2);
+   
+   // 濡傛灉宸茬粡杈撳叆浜嗘暟閲忥紝鍒欒嚜鍔ㄨ绠楁�讳环
+   if (productForm.value.quantity) {
+     mathNum();
+   }
+   
+   priceReferenceVisible.value = false;
+   proxy.$modal.msgSuccess("宸插紩鐢ㄥ巻鍙蹭环鏍�");
+ };
+
 const upload = reactive({
   // 涓婁紶鐨勫湴鍧�
   url: import.meta.env.VITE_APP_BASE_API + "/file/upload",

--
Gitblit v1.9.3