From 6e19fb9ba681721c9e827f079a2b38c4e3fb1288 Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期三, 29 十月 2025 14:30:09 +0800
Subject: [PATCH] 页面调整
---
seller/src/views/order/order/orderDetail.vue | 206 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 199 insertions(+), 7 deletions(-)
diff --git a/seller/src/views/order/order/orderDetail.vue b/seller/src/views/order/order/orderDetail.vue
index 8c04378..b67aa3b 100644
--- a/seller/src/views/order/order/orderDetail.vue
+++ b/seller/src/views/order/order/orderDetail.vue
@@ -5,6 +5,8 @@
<Button v-if="allowOperation.editPrice" @click="modifyPrice" type="primary">璋冩暣浠锋牸</Button>
<Button v-if="allowOperation.editConsignee" @click="editAddress" type="primary">淇敼鏀惰揣鍦板潃</Button>
<Button v-if="allowOperation.showLogistics || orderPackage.length > 0" @click="checkLogistics" type="primary">鏌ョ湅鐗╂祦</Button>
+ <!-- 娣诲姞淇敼鐗╂祦鍗曞彿鎸夐挳 -->
+ <Button v-if="allowOperation.showLogistics || orderPackage.length > 0" @click="modifyLogisticsNo" type="primary">淇敼鐗╂祦鍗曞彿</Button>
<Button @click="orderLogModal = true" type="primary">璁㈠崟鏃ュ織</Button>
<Button @click="printOrder" type="primary" ghost style="float:right;">鎵撳嵃鍙戣揣鍗�</Button>
<Button v-if="allowOperation.take" @click="orderTake" type="primary">璁㈠崟鏍搁攢</Button>
@@ -18,8 +20,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 +171,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 +194,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;"
@@ -439,6 +441,10 @@
<div v-if="packageTraceList.length > 0" v-for="(packageItem, packageIndex) in packageTraceList" :key="packageIndex">
<div class="layui-layer-wrap">
<dl>
+ <dt>鍖呰9缂栧彿锛�</dt>
+ <dd><div class="text-box">{{ packageItem.packageNo }}</div></dd>
+ </dl>
+ <dl>
<dt>鐗╂祦鍏徃锛�</dt>
<dd><div class="text-box">{{ packageItem.logisticsName }}</div></dd>
</dl>
@@ -464,6 +470,10 @@
</ul>
<ul class="express-log" v-else><li>鏆傛棤鐗╂祦淇℃伅</li></ul>
</div>
+ <!-- 娣诲姞淇敼鐗╂祦鍗曞彿鎸夐挳 -->
+ <div style="text-align: center; margin-top: 10px;">
+ <Button type="primary" @click="modifyPackageLogistics(packageItem)">淇敼鐗╂祦鍗曞彿</Button>
+ </div>
</div>
</div>
<div v-if = "packageTraceList.length == 0 && logisticsInfo">
@@ -485,6 +495,10 @@
</ul>
<ul class="express-log" v-else><li>鏆傛棤鐗╂祦淇℃伅</li></ul>
</div>
+ <!-- 娣诲姞淇敼鐗╂祦鍗曞彿鎸夐挳 -->
+ <div style="text-align: center; margin-top: 10px;">
+ <Button type="primary" @click="modifySingleLogistics">淇敼鐗╂祦鍗曞彿</Button>
+ </div>
</div>
</div>
<div slot="footer" style="text-align: right">
@@ -492,7 +506,38 @@
</div>
</Modal>
-
+ <!-- 淇敼鐗╂祦鍗曞彿寮圭獥 -->
+ <Modal v-model="modifyLogisticsModal" width="530">
+ <p slot="header">
+ <Icon type="edit"></Icon>
+ <span>淇敼鐗╂祦鍗曞彿</span>
+ </p>
+ <div>
+ <Form ref="modifyLogisticsForm" :model="modifyLogisticsForm" label-position="left" :label-width="100" :rules="modifyLogisticsValidate">
+ <FormItem label="鍖呰9缂栧彿" prop="packageNo">
+ <Input v-model="modifyLogisticsForm.packageNo" size="large" disabled></Input>
+ </FormItem>
+ <FormItem label="璁㈠崟缂栧彿" prop="orderSn">
+ <Input v-model="modifyLogisticsForm.orderSn" size="large" disabled></Input>
+ </FormItem>
+ <FormItem label="蹇�掑叕鍙�" prop="logisticsId">
+ <Select v-model="modifyLogisticsForm.logisticsId" placeholder="璇烽�夋嫨蹇�掑叕鍙�" style="width: 100%">
+ <Option v-for="(item, i) in checkedLogistics" :key="i" :value="item.logisticsId">{{ item.name }}</Option>
+ </Select>
+ </FormItem>
+ <FormItem label="蹇�掑崟鍙�" prop="logisticsNo">
+ <Input v-model="modifyLogisticsForm.logisticsNo" size="large"></Input>
+ </FormItem>
+ <FormItem label="蹇�掔紪鐮�" prop="logisticsCode">
+ <Input v-model="modifyLogisticsForm.logisticsCode" size="large"></Input>
+ </FormItem>
+ </Form>
+ </div>
+ <div slot="footer" style="text-align: right">
+ <Button @click="modifyLogisticsModal = false">鍏抽棴</Button>
+ <Button type="primary" @click="modifyLogisticsSubmit">纭淇敼</Button>
+ </div>
+ </Modal>
<!-- 璁㈠崟鍙戣揣 -->
<Modal v-model="orderDeliverModal" width="500px">
<p slot="header">
@@ -648,6 +693,7 @@
v-model="editTemplateModalVisible"
:template-id="currentTemplateId"
:order-sn="sn"
+ :user-check-templates="orderInfo.userCheckTemplates"
@success="handleTemplateEditSuccess"
@cancel="editTemplateModalVisible = false"
/>
@@ -658,6 +704,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 +732,7 @@
},
submitLoading: false, // 娣诲姞鎴栫紪杈戞彁浜ょ姸鎬�
logisticsType: 'KUAIDINIAO', //鐗╂祦绫诲瀷
+ endpoint: '', // 娣诲姞endpoint鍙橀噺鐢ㄤ簬瀛樺偍STS endpoint
someJSONdata: '',
faceSheetForm: {
@@ -1026,7 +1074,28 @@
packageTraceList: [],
// 娣诲姞妯℃澘缂栬緫寮圭獥鐩稿叧鏁版嵁
editTemplateModalVisible: false,
- currentTemplateId: ""
+ currentTemplateId: "",
+ // 鐢ㄤ簬浼犻�抲serCheckTemplates鏁版嵁缁欏瓙缁勪欢
+ userCheckTemplates: [],
+
+ // 娣诲姞淇敼鐗╂祦鍗曞彿鐩稿叧鏁版嵁
+ modifyLogisticsModal: false, // 寮瑰嚭淇敼鐗╂祦鍗曞彿妗�
+ modifyLogisticsForm: {
+ packageNo: "",
+ orderSn: "",
+ logisticsId: "",
+ logisticsNo: "",
+ logisticsCode: ""
+ },
+ modifyLogisticsValidate: {
+ logisticsId: [
+ { required: true, message: "璇烽�夋嫨蹇�掑叕鍙�", trigger: "change" }
+ ],
+ logisticsNo: [
+ { required: true, message: "璇疯緭鍏ュ揩閫掑崟鍙�", trigger: "blur" }
+ ]
+ },
+
};
},
methods: {
@@ -1040,6 +1109,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 +1530,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 +1549,8 @@
orderSn: orderSn
});
this.currentTemplateId = templateId;
+ // 鏇存柊userCheckTemplates鏁版嵁
+ this.userCheckTemplates = this.orderInfo.userCheckTemplates || [];
this.editTemplateModalVisible = true;
},
@@ -1453,13 +1561,97 @@
this.$Message.success("妯℃澘淇℃伅宸叉洿鏂�");
// 鍒锋柊璁㈠崟璇︽儏椤甸潰鏁版嵁
this.getDataDetail();
- }
+ },
+
+ getStsInfo() {
+ getSts().then(res => {
+ if (res.code==200) {
+ this.endpoint = res.data.endpoint;
+ }
+ });
+ },
+
+ // 娣诲姞淇敼鐗╂祦鍗曞彿鏂规硶
+ modifyLogisticsNo() {
+ // 鑾峰彇鐗╂祦鍏徃鍒楄〃
+ this.getLogisticsList();
+
+ // 鍒濆鍖栬〃鍗曟暟鎹�
+ this.modifyLogisticsForm.orderSn = this.sn;
+
+ // 濡傛灉鏈夊寘瑁逛俊鎭紝鍒濆鍖栫涓�涓寘瑁圭殑淇℃伅
+ if (this.orderPackage && this.orderPackage.length > 0) {
+ const firstPackage = this.orderPackage[0];
+ this.modifyLogisticsForm.packageNo = firstPackage.packageNo || "";
+ this.modifyLogisticsForm.logisticsId = firstPackage.logisticsId || "";
+ this.modifyLogisticsForm.logisticsNo = firstPackage.logisticsNo || "";
+ this.modifyLogisticsForm.logisticsCode = firstPackage.logisticsCode || "";
+ }
+
+ this.modifyLogisticsModal = true;
+ },
+
+ // 淇敼鎸囧畾鍖呰9鐨勭墿娴佸崟鍙�
+ modifyPackageLogistics(packageItem) {
+ // 鑾峰彇鐗╂祦鍏徃鍒楄〃
+ this.getLogisticsList();
+
+ // 鍒濆鍖栬〃鍗曟暟鎹�
+ this.modifyLogisticsForm.packageNo = packageItem.packageNo || "";
+ this.modifyLogisticsForm.orderSn = this.sn;
+ this.modifyLogisticsForm.logisticsId = packageItem.logisticsId || "";
+ this.modifyLogisticsForm.logisticsNo = packageItem.logisticsNo || "";
+ this.modifyLogisticsForm.logisticsCode = packageItem.logisticsCode || "";
+
+ // 鍏抽棴鏌ョ湅鐗╂祦寮圭獥锛屾墦寮�淇敼鐗╂祦寮圭獥
+ this.logisticsModal = false;
+ this.modifyLogisticsModal = true;
+ },
+
+ // 淇敼鍗曚釜鐗╂祦鍗曞彿锛堥潪鍒嗗寘瑁规儏鍐碉級
+ modifySingleLogistics() {
+ // 鑾峰彇鐗╂祦鍏徃鍒楄〃
+ this.getLogisticsList();
+
+ // 鍒濆鍖栬〃鍗曟暟鎹�
+ this.modifyLogisticsForm.orderSn = this.sn;
+ this.modifyLogisticsForm.logisticsId = "";
+ this.modifyLogisticsForm.logisticsNo = this.logisticsInfo.logisticCode || "";
+ this.modifyLogisticsForm.logisticsCode = "";
+
+ // 鍏抽棴鏌ョ湅鐗╂祦寮圭獥锛屾墦寮�淇敼鐗╂祦寮圭獥
+ this.logisticsModal = false;
+ this.modifyLogisticsModal = true;
+ },
+
+ // 淇敼鐗╂祦鍗曞彿鎻愪氦
+ modifyLogisticsSubmit() {
+ this.$refs.modifyLogisticsForm.validate((valid) => {
+ if (valid) {
+ API_Order.updateTraces(this.modifyLogisticsForm).then((res) => {
+ if (res.success) {
+ this.$Message.success("淇敼鐗╂祦鍗曞彿鎴愬姛");
+ this.modifyLogisticsModal = false;
+ // 閲嶆柊鑾峰彇璁㈠崟璇︽儏鍜屽寘瑁逛俊鎭�
+ this.getDataDetail();
+ this.getOrderPackage();
+ // 閲嶆柊鍔犺浇鐗╂祦淇℃伅
+ this.checkLogistics();
+ } else {
+ this.$Message.error(res.message || "淇敼鐗╂祦鍗曞彿澶辫触");
+ }
+ });
+ }
+ });
+ },
+
},
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