From 36c8ae70cae3de90e642b080553abe70d3345c74 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 27 四月 2026 13:20:16 +0800
Subject: [PATCH] 天津宝东app 1.部署修改 2.按照web端逻辑修改销售报价和客户档案的逻辑

---
 src/pages/sales/salesQuotation/detail.vue |  176 +++++++++++++++++++++++++---------------------------------
 1 files changed, 77 insertions(+), 99 deletions(-)

diff --git a/src/pages/sales/salesQuotation/detail.vue b/src/pages/sales/salesQuotation/detail.vue
index a273974..0eb5bf0 100644
--- a/src/pages/sales/salesQuotation/detail.vue
+++ b/src/pages/sales/salesQuotation/detail.vue
@@ -6,142 +6,109 @@
       <view class="section">
         <view class="section-title">鍩虹淇℃伅</view>
         <view class="info-list">
-          <view class="info-item">
-            <text class="info-label">鎶ヤ环鍗曞彿</text>
-            <text class="info-value">{{ detailData.quotationNo || "-" }}</text>
-          </view>
-          <view class="info-item">
-            <text class="info-label">瀹㈡埛鍚嶇О</text>
-            <text class="info-value">{{ detailData.customer || "-" }}</text>
-          </view>
-          <view class="info-item">
-            <text class="info-label">涓氬姟鍛�</text>
-            <text class="info-value">{{ detailData.salesperson || "-" }}</text>
-          </view>
-          <view class="info-item">
-            <text class="info-label">鎶ヤ环鏃ユ湡</text>
-            <text class="info-value">{{ detailData.quotationDate || "-" }}</text>
-          </view>
-          <view class="info-item">
-            <text class="info-label">鏈夋晥鏈熻嚦</text>
-            <text class="info-value">{{ detailData.validDate || "-" }}</text>
-          </view>
-          <view class="info-item">
-            <text class="info-label">浠樻鏂瑰紡</text>
-            <text class="info-value">{{ detailData.paymentMethod || "-" }}</text>
-          </view>
-          <view class="info-item">
-            <text class="info-label">瀹℃壒鐘舵��</text>
-            <text class="info-value">{{ detailData.status || "-" }}</text>
-          </view>
-          <view class="info-item">
-            <text class="info-label">鎶ヤ环鎬婚</text>
-            <text class="info-value highlight">{{ formatAmount(detailData.totalAmount) }}</text>
-          </view>
-          <view class="info-item">
-            <text class="info-label">澶囨敞</text>
-            <text class="info-value">{{ detailData.remark || "-" }}</text>
-          </view>
-        </view>
-      </view>
-
-      <view class="section">
-        <view class="section-title">瀹℃壒鑺傜偣</view>
-        <view v-if="approverNames.length" class="info-list">
-          <view v-for="(name, index) in approverNames" :key="index" class="info-item">
-            <text class="info-label">瀹℃壒鑺傜偣 {{ index + 1 }}</text>
-            <text class="info-value">{{ name }}</text>
-          </view>
-        </view>
-        <view v-else class="empty-box">
-          <text>鏆傛棤瀹℃壒鑺傜偣</text>
+          <view class="info-item"><text class="info-label">鎶ヤ环鍗曞彿</text><text class="info-value">{{ detailData.quotationNo || "-" }}</text></view>
+          <view class="info-item"><text class="info-label">瀹㈡埛</text><text class="info-value">{{ detailData.customer || "-" }}</text></view>
+          <view class="info-item"><text class="info-label">涓氬姟鍛�</text><text class="info-value">{{ detailData.salesperson || "-" }}</text></view>
+          <view class="info-item"><text class="info-label">鎶ヤ环鏃ユ湡</text><text class="info-value">{{ detailData.quotationDate || "-" }}</text></view>
+          <view class="info-item"><text class="info-label">鏈夋晥鏈熻嚦</text><text class="info-value">{{ detailData.validDate || "-" }}</text></view>
+          <view class="info-item"><text class="info-label">浠樻鏂瑰紡</text><text class="info-value">{{ detailData.paymentMethod || "-" }}</text></view>
+          <view class="info-item"><text class="info-label">鎬婚</text><text class="info-value highlight">{{ formatAmount(totalAmount) }}</text></view>
+          <view class="info-item"><text class="info-label">澶囨敞</text><text class="info-value">{{ detailData.remark || "-" }}</text></view>
         </view>
       </view>
 
       <view class="section">
         <view class="section-title">浜у搧鏄庣粏</view>
-        <view v-if="detailData.products && detailData.products.length > 0" class="product-list">
-          <view v-for="(item, index) in detailData.products" :key="index" class="product-card">
+        <view v-if="products.length" class="product-list">
+          <view v-for="(item, index) in products" :key="index" class="product-card">
             <view class="product-head">浜у搧 {{ index + 1 }}</view>
-            <view class="info-item">
-              <text class="info-label">浜у搧鍚嶇О</text>
-              <text class="info-value">{{ item.product || item.productName || "-" }}</text>
-            </view>
-            <view class="info-item">
-              <text class="info-label">瑙勬牸鍨嬪彿</text>
-              <text class="info-value">{{ item.specification || "-" }}</text>
-            </view>
-            <view class="info-item">
-              <text class="info-label">鍗曚綅</text>
-              <text class="info-value">{{ item.unit || "-" }}</text>
-            </view>
-            <view class="info-item">
-              <text class="info-label">鏁伴噺</text>
-              <text class="info-value">{{ item.quantity || "-" }}</text>
-            </view>
-            <view class="info-item">
-              <text class="info-label">鍗曚环</text>
-              <text class="info-value">{{ formatAmount(item.unitPrice) }}</text>
-            </view>
-            <view class="info-item">
-              <text class="info-label">閲戦</text>
-              <text class="info-value highlight">{{ formatAmount(item.amount) }}</text>
-            </view>
+            <view class="info-item"><text class="info-label">浜у搧</text><text class="info-value">{{ item.product || item.productName || "-" }}</text></view>
+            <view class="info-item"><text class="info-label">瑙勬牸</text><text class="info-value">{{ item.specification || "-" }}</text></view>
+            <view class="info-item"><text class="info-label">鍗曚綅</text><text class="info-value">{{ item.unit || "-" }}</text></view>
+            <view class="info-item"><text class="info-label">绾稿紶</text><text class="info-value">{{ item.paper || "-" }}</text></view>
+            <view class="info-item"><text class="info-label">瀹氶噺</text><text class="info-value">{{ item.paperWeight || "-" }}</text></view>
+            <view class="info-item"><text class="info-label">鏁伴噺</text><text class="info-value">{{ Number(item.quantity || 0) }}</text></view>
+            <view class="info-item"><text class="info-label">鍗曚环</text><text class="info-value">{{ formatAmount(item.unitPrice) }}</text></view>
+            <view class="info-item"><text class="info-label">鍗扮増璐�</text><text class="info-value">{{ formatAmount(item.printingFee) }}</text></view>
+            <view class="info-item"><text class="info-label">鍒�鐗堣垂</text><text class="info-value">{{ formatAmount(item.dieCuttingFee) }}</text></view>
+            <view class="info-item"><text class="info-label">纾ㄥ叿璐�</text><text class="info-value">{{ formatAmount(item.grindingFee) }}</text></view>
+            <view class="info-item"><text class="info-label">閲戦</text><text class="info-value highlight">{{ formatAmount(item.amount) }}</text></view>
           </view>
         </view>
-        <view v-else class="empty-box">
-          <text>鏆傛棤浜у搧鏄庣粏</text>
-        </view>
+        <view v-else class="empty-box"><text>鏆傛棤浜у搧鏄庣粏</text></view>
       </view>
     </view>
 
-    <FooterButtons cancelText="杩斿洖" confirmText="缂栬緫" @cancel="goBack" @confirm="goEdit" />
+    <view class="detail-footer">
+      <up-button type="primary" @click="goBack">杩斿洖</up-button>
+    </view>
   </view>
 </template>
 
 <script setup>
   import { computed, ref } from "vue";
   import { onLoad, onShow } from "@dcloudio/uni-app";
-  import FooterButtons from "@/components/FooterButtons.vue";
   import PageHeader from "@/components/PageHeader.vue";
+  import { getQuotationDetail } from "@/api/salesManagement/salesQuotation";
 
   const quotationId = ref("");
   const detailData = ref({});
 
-  const approverNames = computed(() => {
-    const approverText = detailData.value.approveUserNames || detailData.value.approverNames || detailData.value.approveUserIds || "";
-    if (Array.isArray(approverText)) return approverText.filter(Boolean);
-    return String(approverText)
-      .split(",")
-      .map(item => item.trim())
-      .filter(Boolean);
+  const products = computed(() => {
+    const rows = detailData.value?.products;
+    if (Array.isArray(rows) && rows.length) return rows;
+    if (detailData.value?.product || detailData.value?.productName) return [detailData.value];
+    return [];
   });
 
-  const goBack = () => {
-    uni.navigateBack();
-  };
+  const totalAmount = computed(() => {
+    const backendTotal = Number(detailData.value?.totalAmount || 0);
+    if (backendTotal > 0) return backendTotal;
+    return Number(
+      products.value
+        .reduce((sum, item) => {
+          const unitPrice = Number(item?.unitPrice || 0);
+          const printingFee = Number(item?.printingFee || 0);
+          const dieCuttingFee = Number(item?.dieCuttingFee || 0);
+          const grindingFee = Number(item?.grindingFee || 0);
+          return sum + unitPrice + printingFee + dieCuttingFee + grindingFee;
+        }, 0)
+        .toFixed(2)
+    );
+  });
 
-  const goEdit = () => {
-    if (!quotationId.value) return;
-    uni.navigateTo({ url: `/pages/sales/salesQuotation/edit?id=${quotationId.value}` });
-  };
-
+  const goBack = () => uni.navigateBack();
   const formatAmount = amount => `楼${Number(amount || 0).toFixed(2)}`;
 
   const loadDetailFromStorage = () => {
     const cachedData = uni.getStorageSync("salesQuotationDetail");
-    detailData.value = cachedData || {};
+    if (cachedData && typeof cachedData === "object") detailData.value = cachedData;
+  };
+
+  const loadDetailFromApi = () => {
+    if (!quotationId.value) return Promise.resolve();
+    uni.showLoading({ title: "鍔犺浇涓�...", mask: true });
+    return getQuotationDetail({ id: quotationId.value })
+      .then(res => {
+        detailData.value = res?.data || detailData.value || {};
+      })
+      .catch(() => {
+        uni.showToast({ title: "鍔犺浇璇︽儏澶辫触", icon: "error" });
+      })
+      .finally(() => {
+        uni.hideLoading();
+      });
   };
 
   onLoad(options => {
-    if (options?.id) {
-      quotationId.value = options.id;
-    }
+    if (options?.id) quotationId.value = options.id;
     loadDetailFromStorage();
+    loadDetailFromApi();
   });
 
   onShow(() => {
     loadDetailFromStorage();
+    loadDetailFromApi();
   });
 </script>
 
@@ -232,4 +199,15 @@
     color: #22324d;
     border-bottom: 1px solid #eef2f7;
   }
+
+  .detail-footer {
+    position: fixed;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
+    background: #fff;
+    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
+    z-index: 10;
+  }
 </style>

--
Gitblit v1.9.3