From b7e2ab9df65e13c6b9f24a6e57f4501967568edc Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期四, 23 十月 2025 17:45:55 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/send_coupon' into send_coupon
---
seller/src/views/order/order/orderDetail.vue | 142 ++++++++++++++++++++++++++++++++++++++---------
1 files changed, 114 insertions(+), 28 deletions(-)
diff --git a/seller/src/views/order/order/orderDetail.vue b/seller/src/views/order/order/orderDetail.vue
index 0bfc463..15e21c4 100644
--- a/seller/src/views/order/order/orderDetail.vue
+++ b/seller/src/views/order/order/orderDetail.vue
@@ -17,6 +17,10 @@
<Button @click="toPrint" type="primary" ghost
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)"
+ type="primary">缂栬緫妯℃澘</Button>
</div>
</Card>
@@ -152,50 +156,48 @@
<!-- 澶栧眰瀹瑰櫒锛氬惊鐜亶鍘� userCheckTemplates 闆嗗悎 -->
<div class="check-template-list">
<div class="template-item" v-for="(item, index) in orderInfo.userCheckTemplates" :key="item.id">
+ <!-- 2. 妯℃澘鏍囬锛氫粎绗竴涓惊鐜」鏄剧ず templateName锛坕ndex===0 鎺у埗锛� -->
+ <div class="div-item" > <!-- 鍏抽敭锛氫粎棣栭」娓叉煋 -->
+ <div class="div-item-left">鍟嗗搧妯℃澘锛�</div>
+ <div class="div-item-right">
+ {{ item.templateName || '鏃犳ā鏉挎爣棰�' }} <!-- 澶勭悊绌哄�奸粯璁ゆ樉绀� -->
+ </div>
+ </div>
+ <!-- 4. 閫夋嫨鍥剧墖锛氭覆鏌� chooseImg 瀛楁锛堝鐞� null/绌哄�硷級 -->
+ <div class="div-item">
+ <div class="div-item-left">妯℃澘鍥剧墖锛�</div>
+ <div class="div-item-right">
+ <img
+ v-if="item.chooseImg"
+ :src="getImageUrl(item.chooseImg)"
+ alt="閫夋嫨鐨勫浘鐗�"
+ class="selected-img"
+ style="max-width: 200px; max-height: 150px;"
+ >
+ <span v-else>鏃犻�夋嫨鍥剧墖</span> <!-- 鏃犲浘鐗囨椂榛樿鏂囨湰 -->
+ </div>
+ </div>
<!-- 1. 鍟嗗搧妯℃澘锛氭瘡涓惊鐜」閮芥樉绀� subName -->
<div class="div-item">
- <div class="div-item-left">鍟嗗搧妯℃澘锛�</div>
+ <div class="div-item-left">妯℃澘鏍囬锛�</div>
<div class="div-item-right">
{{ item.subName || '鏃犲晢鍝佹ā鏉垮悕绉�' }} <!-- 澶勭悊绌哄�奸粯璁ゆ樉绀� -->
</div>
</div>
- <!-- 2. 妯℃澘鏍囬锛氫粎绗竴涓惊鐜」鏄剧ず templateName锛坕ndex===0 鎺у埗锛� -->
- <div class="div-item" v-if="index === 0"> <!-- 鍏抽敭锛氫粎棣栭」娓叉煋 -->
- <div class="div-item-left">妯℃澘鏍囬锛�</div>
- <div class="div-item-right">
- {{ item.templateName || '鏃犳ā鏉挎爣棰�' }} <!-- 澶勭悊绌哄�奸粯璁ゆ樉绀� -->
- </div>
- </div>
-
<!-- 3. 鏂囨湰鍐呭锛氬垽鏂� content 鏄�屽浘鐗嘦RL銆嶈繕鏄�岀函鏂囨湰銆� -->
<div class="div-item">
- <div class="div-item-left">鏂囨湰鍐呭锛�</div>
+ <div class="div-item-left">{{isUrl(item.content)? '鍥剧墖锛�':'鏂囨湰鍐呭'}}</div>
<div class="div-item-right">
<!-- 姝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;"
>
<span v-else>{{ item.content || '鏃犳枃鏈唴瀹�' }}</span> <!-- 绾枃鏈�/绌哄�煎鐞� -->
- </div>
- </div>
-
- <!-- 4. 閫夋嫨鍥剧墖锛氭覆鏌� chooseImg 瀛楁锛堝鐞� null/绌哄�硷級 -->
- <div class="div-item">
- <div class="div-item-left">閫夋嫨鍥剧墖锛�</div>
- <div class="div-item-right">
- <img
- v-if="item.chooseImg"
- :src="item.chooseImg"
- alt="閫夋嫨鐨勫浘鐗�"
- class="selected-img"
- style="max-width: 200px; max-height: 150px;"
- >
- <span v-else>鏃犻�夋嫨鍥剧墖</span> <!-- 鏃犲浘鐗囨椂榛樿鏂囨湰 -->
</div>
</div>
@@ -640,6 +642,16 @@
</Modal>
<multipleMap ref="map" @callback="getAddress"></multipleMap>
+
+ <!-- 娣诲姞妯℃澘缂栬緫寮圭獥 -->
+ <EditTemplateModal
+ v-model="editTemplateModalVisible"
+ :template-id="currentTemplateId"
+ :order-sn="sn"
+ :user-check-templates="orderInfo.userCheckTemplates"
+ @success="handleTemplateEditSuccess"
+ @cancel="editTemplateModalVisible = false"
+ />
</div>
</template>
@@ -647,14 +659,16 @@
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";
export default {
name: "orderDetail",
components: {
multipleMap,
+ EditTemplateModal
},
data () {
return {
@@ -673,6 +687,7 @@
},
submitLoading: false, // 娣诲姞鎴栫紪杈戞彁浜ょ姸鎬�
logisticsType: 'KUAIDINIAO', //鐗╂祦绫诲瀷
+ endpoint: '', // 娣诲姞endpoint鍙橀噺鐢ㄤ簬瀛樺偍STS endpoint
someJSONdata: '',
faceSheetForm: {
@@ -1011,7 +1026,12 @@
},
],
orderPackage: [],
- packageTraceList: []
+ packageTraceList: [],
+ // 娣诲姞妯℃澘缂栬緫寮圭獥鐩稿叧鏁版嵁
+ editTemplateModalVisible: false,
+ currentTemplateId: "",
+ // 鐢ㄤ簬浼犻�抲serCheckTemplates鏁版嵁缁欏瓙缁勪欢
+ userCheckTemplates: []
};
},
methods: {
@@ -1025,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) {
@@ -1421,12 +1466,53 @@
})
},
+ // 鑾峰彇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锛屽弬鏁�:", {
+ templateId: templateId,
+ orderSn: orderSn
+ });
+ this.currentTemplateId = templateId;
+ // 鏇存柊userCheckTemplates鏁版嵁
+ this.userCheckTemplates = this.orderInfo.userCheckTemplates || [];
+ this.editTemplateModalVisible = true;
+ },
+
+ // 妯℃澘缂栬緫鎴愬姛鍥炶皟
+ handleTemplateEditSuccess() {
+ this.editTemplateModalVisible = false;
+ // 鍙互鍦ㄨ繖閲屽埛鏂版暟鎹垨鎻愮ず鐢ㄦ埛
+ this.$Message.success("妯℃澘淇℃伅宸叉洿鏂�");
+ // 鍒锋柊璁㈠崟璇︽儏椤甸潰鏁版嵁
+ this.getDataDetail();
+ },
+
+ getStsInfo() {
+ getSts().then(res => {
+ if (res.code==200) {
+ this.endpoint = res.data.endpoint;
+ }
+ });
+ }
},
mounted () {
this.sn = this.$route.query.sn;
this.getDataDetail();
this.getLogisticsSetting();
this.getOrderPackage();
+ this.getStsInfo(); // 娣诲姞杩欒鏉ヨ幏鍙朣TS淇℃伅
},
// 濡傛灉鏄粠璇︽儏椤佃繑鍥炲垪琛ㄩ〉锛屼慨鏀瑰垪琛ㄩ〉keepAlive涓簍rue锛岀‘淇濅笉鍒锋柊椤甸潰
beforeRouteLeave (to, from, next) {
--
Gitblit v1.8.0