From 495c4a855accf138066df32773dedac144bfd656 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期四, 23 十月 2025 17:22:18 +0800
Subject: [PATCH] 商户端统计

---
 seller/src/views/order/order/orderDetail.vue |   63 +++++++++++++++++++++++++++++--
 1 files changed, 58 insertions(+), 5 deletions(-)

diff --git a/seller/src/views/order/order/orderDetail.vue b/seller/src/views/order/order/orderDetail.vue
index 8c04378..15e21c4 100644
--- a/seller/src/views/order/order/orderDetail.vue
+++ b/seller/src/views/order/order/orderDetail.vue
@@ -18,8 +18,8 @@
           v-if="allowOperation.ship && logisticsType != 'SHUNFENG'">鎵撳嵃鐢靛瓙闈㈠崟</Button>
         <Button @click="modifyRemark" type="primary">娣诲姞澶囨敞</Button>
         <!-- 灏嗙紪杈戞ā鏉挎寜閽Щ鍒拌繖閲� -->
-        <Button v-if="orderInfo.userCheckTemplates && orderInfo.userCheckTemplates.length > 0" 
-                @click="editTemplateInfo(orderInfo.userCheckTemplates[0].templateId, sn)" 
+        <Button v-if="orderInfo.userCheckTemplates && orderInfo.userCheckTemplates.length > 0"
+                @click="editTemplateInfo(orderInfo.userCheckTemplates[0].templateId, sn)"
                 type="primary">缂栬緫妯℃澘</Button>
       </div>
     </Card>
@@ -169,7 +169,7 @@
                   <div class="div-item-right">
                     <img
                       v-if="item.chooseImg"
-                      :src="item.chooseImg"
+                      :src="getImageUrl(item.chooseImg)"
                       alt="閫夋嫨鐨勫浘鐗�"
                       class="selected-img"
                       style="max-width: 200px; max-height: 150px;"
@@ -192,7 +192,7 @@
                 <!-- 姝e垯鍒ゆ柇锛歝ontent 浠� http/https 寮�澶� 鈫� 娓叉煋鍥剧墖锛涘惁鍒欐覆鏌撴枃鏈� -->
                 <img
                   v-if="isUrl(item.content)"
-                  :src="item.content"
+                  :src="getImageUrl(item.content)"
                   alt="鍐呭鍥剧墖"
                   class="content-img"
                   style="max-width: 200px; max-height: 150px;"
@@ -648,6 +648,7 @@
       v-model="editTemplateModalVisible"
       :template-id="currentTemplateId"
       :order-sn="sn"
+      :user-check-templates="orderInfo.userCheckTemplates"
       @success="handleTemplateEditSuccess"
       @cancel="editTemplateModalVisible = false"
     />
@@ -658,6 +659,7 @@
 import * as API_Order from "@/api/order";
 import * as API_Logistics from "@/api/logistics";
 import * as RegExp from "@/libs/RegExp.js";
+import { getSts } from "@/api/file";
 
 import multipleMap from "@/views/my-components/map/multiple-map";
 import EditTemplateModal from "./editTemplateModal.vue";
@@ -685,6 +687,7 @@
       },
       submitLoading: false, // 娣诲姞鎴栫紪杈戞彁浜ょ姸鎬�
       logisticsType: 'KUAIDINIAO', //鐗╂祦绫诲瀷
+      endpoint: '', // 娣诲姞endpoint鍙橀噺鐢ㄤ簬瀛樺偍STS endpoint
 
       someJSONdata: '',
       faceSheetForm: {
@@ -1026,7 +1029,9 @@
       packageTraceList: [],
       // 娣诲姞妯℃澘缂栬緫寮圭獥鐩稿叧鏁版嵁
       editTemplateModalVisible: false,
-      currentTemplateId: ""
+      currentTemplateId: "",
+      // 鐢ㄤ簬浼犻�抲serCheckTemplates鏁版嵁缁欏瓙缁勪欢
+      userCheckTemplates: []
     };
   },
   methods: {
@@ -1040,6 +1045,31 @@
       // 5. \.(jpg|jpeg|png|gif|bmp|webp)$ 锛氫粎鍖归厤甯歌鍥剧墖鍚庣紑锛屽拷鐣ュぇ灏忓啓锛坕鏍囧織锛�
       const imgReg = /^https?:\/\/([\w-]+\.)+[a-zA-Z]{2,}(\/[\w-./?%&=]*)*\.(jpg|jpeg|png|gif|bmp|webp)$/i;
       return imgReg.test(str);
+    },
+    // 鑾峰彇鍥剧墖URL锛堜娇鐢⊿TS鑾峰彇鐨別ndpoint锛�
+    getImageUrl(fileKey) {
+      // 纭繚fileKey鏄瓧绗︿覆绫诲瀷
+      if (!fileKey || typeof fileKey !== 'string') {
+        console.warn('fileKey is not a valid string:', fileKey);
+        return ''; // 杩斿洖绌哄瓧绗︿覆鎴栭粯璁ゅ浘鐗�
+      }
+
+      // 瀹夊叏妫�鏌tartsWith鏂规硶鏄惁瀛樺湪
+      if (fileKey.startsWith && typeof fileKey.startsWith === 'function' &&
+          (fileKey.startsWith("http://") || fileKey.startsWith("https://"))) {
+        return fileKey;
+      }
+
+      // 濡傛灉鏈塭ndpoint閰嶇疆锛屼娇鐢╡ndpoint鎷兼帴URL
+      if (this.endpoint) {
+        // 纭繚fileKey涓嶄互/寮�澶达紝endpoint涓嶄互/缁撳熬
+        const cleanEndpoint = this.endpoint.replace(/\/$/, '');
+        const cleanFileKey = fileKey.replace(/^\//, '');
+        return `${cleanEndpoint}/${cleanFileKey}`;
+      }
+
+      // 鍚﹀垯杩斿洖fileKey锛岃缁勪欢鑷繁澶勭悊
+      return fileKey;
     },
     // 閫変腑
     selectGroupShipGoodsMethods (selected) {
@@ -1436,6 +1466,18 @@
       })
     },
 
+    // 鑾峰彇STS淇℃伅
+    // async getStsInfo() {
+    //   try {
+    //     const stsRes = await getSts();
+    //     if (stsRes.success) {
+    //       this.endpoint = stsRes.data.endpoint;
+    //     }
+    //   } catch (error) {
+    //     console.error('鑾峰彇STS淇℃伅澶辫触:', error);
+    //   }
+    // },
+
     // 缂栬緫妯℃澘淇℃伅
     editTemplateInfo(templateId, orderSn) {
       console.log("璋冪敤editTemplateInfo锛屽弬鏁�:", {
@@ -1443,6 +1485,8 @@
         orderSn: orderSn
       });
       this.currentTemplateId = templateId;
+      // 鏇存柊userCheckTemplates鏁版嵁
+      this.userCheckTemplates = this.orderInfo.userCheckTemplates || [];
       this.editTemplateModalVisible = true;
     },
 
@@ -1453,6 +1497,14 @@
       this.$Message.success("妯℃澘淇℃伅宸叉洿鏂�");
       // 鍒锋柊璁㈠崟璇︽儏椤甸潰鏁版嵁
       this.getDataDetail();
+    },
+
+    getStsInfo() {
+      getSts().then(res => {
+        if (res.code==200) {
+          this.endpoint = res.data.endpoint;
+        }
+      });
     }
   },
   mounted () {
@@ -1460,6 +1512,7 @@
     this.getDataDetail();
     this.getLogisticsSetting();
     this.getOrderPackage();
+    this.getStsInfo(); // 娣诲姞杩欒鏉ヨ幏鍙朣TS淇℃伅
   },
   // 濡傛灉鏄粠璇︽儏椤佃繑鍥炲垪琛ㄩ〉锛屼慨鏀瑰垪琛ㄩ〉keepAlive涓簍rue锛岀‘淇濅笉鍒锋柊椤甸潰
   beforeRouteLeave (to, from, next) {

--
Gitblit v1.8.0