-
{{ row.goodsName }}
+
+ 赠品
+ {{ row.goodsName }}
+
import { computed, nextTick, onMounted, reactive, ref, watch } from "vue";
import { onBeforeRouteLeave, useRoute, useRouter } from "vue-router";
+import { Box, DocumentCopy, Clock, Van } from "@element-plus/icons-vue";
import * as API_Order from "@/api/order";
import * as API_Logistics from "@/api/logistics";
import * as RegExp from "@/libs/RegExp.js";
@@ -1120,23 +1248,34 @@ onBeforeRouteLeave((to, from, next) => {
function lineCardKeyRows(line) {
return line.cardKeys || [];
}
-function copySn() {
- const text = orderInfo.value?.order?.sn || "";
+function copyText(text, label = "内容") {
if (!text) return;
if (navigator.clipboard && navigator.clipboard.writeText) {
- navigator.clipboard.writeText(text).then(() => {
- Message.success("订单号已复制");
+ navigator.clipboard.writeText(String(text)).then(() => {
+ Message.success(`${label}已复制`);
+ }).catch(() => {
+ fallbackCopyText(String(text), label);
});
} else {
- const ta = document.createElement("textarea");
- ta.value = text;
- document.body.appendChild(ta);
- ta.select();
- document.execCommand("copy");
- document.body.removeChild(ta);
- Message.success("订单号已复制");
+ fallbackCopyText(String(text), label);
}
}
+
+function fallbackCopyText(text, label = "内容") {
+ const ta = document.createElement("textarea");
+ ta.value = text;
+ ta.style.position = "fixed";
+ ta.style.opacity = "0";
+ document.body.appendChild(ta);
+ ta.select();
+ document.execCommand("copy");
+ document.body.removeChild(ta);
+ Message.success(`${label}已复制`);
+}
+
+function copySn() {
+ copyText(orderInfo.value?.order?.sn, "订单号");
+}
function copyCardKey(row) {
const text = `卡号:${row.cardNo || ""}\n卡密:${row.cardSecret || ""}`;
if (navigator.clipboard && navigator.clipboard.writeText) {
@@ -1153,10 +1292,15 @@ function copyCardKey(row) {
Message.success("已复制到剪贴板");
}
}
+function isGiftItem(row) {
+ if (!row) return false;
+ return row.promotionType === 'GIFT' || (Number(row.flowPrice) === 0 && row.promotionType === 'GIFT');
+}
function getPromotionText(row) {
let resultText = "";
if (row && row.promotionType) {
const type = row.promotionType.split(",");
+ if (type.indexOf("GIFT") != -1) resultText += "满赠赠品 ";
if (type.indexOf("PINTUAN") != -1) resultText += "拼团 ";
if (type.indexOf("SECKILL") != -1) resultText += "秒杀 ";
if (type.indexOf("COUPON") != -1) resultText += "优惠券 ";
@@ -1219,6 +1363,40 @@ function isPackageItemMatch(orderItem, pkgItem) {
.map(String);
return pkgKeys.some((key) => orderKeys.includes(key));
}
+function getPackageItemThumb(item) {
+ if (item && item.thumbnail) {
+ return item.thumbnail;
+ }
+ const match = (data.value || []).find((row) => isPackageItemMatch(row, item));
+ return match?.image || match?.goodsImage || "";
+}
+function getPackageItemSpecsText(item) {
+ const match = (data.value || []).find((row) => isPackageItemMatch(row, item));
+ if (!match || !match.specs) return "";
+ try {
+ const specsObj = parseOrderItemSpecs(match.specs);
+ if (!specsObj || typeof specsObj !== "object") return "";
+ return Object.entries(specsObj)
+ .filter(([k]) => k !== "images")
+ .map(([k, v]) => `${k}: ${v}`)
+ .join(" | ");
+ } catch (e) {
+ return "";
+ }
+}
+function getFulfillmentTagType(mode) {
+ if (mode === "NO_DELIVERY") return "info";
+ if (mode === "SPLIT") return "warning";
+ return "primary";
+}
+function hasPackageTraces(pkg) {
+ return Boolean(pkg && pkg.traces && Array.isArray(pkg.traces.traces) && pkg.traces.traces.length > 0);
+}
+function getLatestTrace(pkg) {
+ if (!hasPackageTraces(pkg)) return {};
+ const list = pkg.traces.traces;
+ return list[0] || {};
+}
function getRemainingDeliveryNum(item) {
if (item != null && item.remainDeliverNumber != null && item.remainDeliverNumber !== "") {
const remain = Number(item.remainDeliverNumber);
@@ -1968,6 +2146,324 @@ function editAddressSubmit () {
color: #606266;
}
+.delivery-record-card {
+ border-radius: 8px;
+ border: 1px solid #ebeef5;
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
+
+ :deep(.el-card__body) {
+ padding: 16px 20px 20px;
+ }
+}
+
+.delivery-section-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: 14px;
+ padding-bottom: 12px;
+ border-bottom: 1px solid #f0f2f5;
+
+ .delivery-section-title-wrap {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ }
+
+ .delivery-title-bar {
+ width: 3px;
+ height: 15px;
+ background: #409eff;
+ border-radius: 2px;
+ }
+
+ .delivery-section-title {
+ font-size: 15px;
+ font-weight: 600;
+ color: #1f2937;
+ line-height: 1;
+ }
+
+ .delivery-count-badge {
+ margin-left: 4px;
+ font-size: 12px;
+ height: 22px;
+ line-height: 20px;
+ }
+}
+
+.delivery-package-list {
+ display: flex;
+ flex-direction: column;
+ gap: 14px;
+}
+
+.delivery-package-item {
+ border: 1px solid #e5e7eb;
+ border-radius: 8px;
+ background: #ffffff;
+ overflow: hidden;
+ transition: all 0.2s ease;
+
+ &:hover {
+ border-color: #cbd5e1;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
+ }
+
+ .pkg-bar {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ flex-wrap: wrap;
+ gap: 10px;
+ padding: 10px 16px;
+ background: #f8fafc;
+ border-bottom: 1px solid #e5e7eb;
+
+ .pkg-bar-left {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 10px;
+ }
+
+ .pkg-index-tag {
+ display: inline-flex;
+ align-items: center;
+ gap: 5px;
+ font-size: 13px;
+ font-weight: 600;
+ color: #1e293b;
+
+ .pkg-icon {
+ font-size: 15px;
+ color: #3b82f6;
+ }
+ }
+
+ .pkg-mode-tag {
+ font-size: 12px;
+ height: 22px;
+ line-height: 20px;
+ padding: 0 8px;
+ }
+
+ .pkg-express-group {
+ display: inline-flex;
+ align-items: center;
+ font-size: 13px;
+ background: #f1f5f9;
+ padding: 3px 10px;
+ border-radius: 4px;
+ border: 1px solid #e2e8f0;
+
+ .express-name {
+ font-weight: 500;
+ color: #334155;
+ }
+
+ .express-divider {
+ margin: 0 6px;
+ color: #94a3b8;
+ }
+
+ .express-no-label {
+ color: #64748b;
+ }
+
+ .express-no {
+ font-family: Consolas, Monaco, "Courier New", monospace;
+ font-weight: 600;
+ color: #0284c7;
+ letter-spacing: 0.5px;
+ }
+
+ .copy-icon-btn {
+ margin-left: 6px;
+ cursor: pointer;
+ display: inline-flex;
+ align-items: center;
+ color: #3b82f6;
+ transition: transform 0.15s ease, color 0.15s ease;
+
+ &:hover {
+ color: #2563eb;
+ transform: scale(1.15);
+ }
+ }
+ }
+
+ .pkg-no-express-group {
+ display: inline-flex;
+ align-items: center;
+ font-size: 13px;
+ color: #64748b;
+
+ .no-express-text {
+ font-weight: 500;
+ color: #475569;
+ }
+
+ .no-express-remark {
+ color: #94a3b8;
+ margin-left: 4px;
+ }
+ }
+
+ .pkg-bar-right {
+ display: flex;
+ align-items: center;
+ gap: 16px;
+ font-size: 12px;
+
+ .pkg-time {
+ display: inline-flex;
+ align-items: center;
+ color: #64748b;
+
+ .clock-icon {
+ font-size: 13px;
+ }
+ }
+
+ .pkg-track-btn {
+ font-size: 12px;
+ display: inline-flex;
+ align-items: center;
+ padding: 0;
+ }
+ }
+ }
+
+ .pkg-goods-container {
+ padding: 6px 16px;
+ background: #ffffff;
+
+ .pkg-goods-row {
+ display: flex;
+ align-items: center;
+ padding: 10px 0;
+ border-bottom: 1px dashed #f1f5f9;
+
+ &:last-child {
+ border-bottom: none;
+ }
+
+ .pkg-goods-img-box {
+ width: 46px;
+ height: 46px;
+ flex-shrink: 0;
+ border-radius: 6px;
+ border: 1px solid #e2e8f0;
+ overflow: hidden;
+ background: #f8fafc;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+
+ .pkg-goods-img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ display: block;
+ }
+ }
+
+ .pkg-goods-detail {
+ flex: 1;
+ min-width: 0;
+ margin-left: 12px;
+ margin-right: 16px;
+
+ .pkg-goods-title {
+ font-size: 13px;
+ font-weight: 500;
+ color: #1e293b;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ line-height: 1.4;
+ }
+
+ .pkg-goods-specs {
+ margin-top: 3px;
+ font-size: 12px;
+ color: #64748b;
+ background: #f8fafc;
+ display: inline-block;
+ padding: 1px 6px;
+ border-radius: 3px;
+ border: 1px solid #edf2f7;
+ line-height: 1.4;
+ }
+ }
+
+ .pkg-goods-num-col {
+ flex-shrink: 0;
+ display: flex;
+ flex-direction: column;
+ align-items: flex-end;
+ gap: 2px;
+
+ .pkg-num-label {
+ font-size: 11px;
+ color: #94a3b8;
+ }
+
+ .pkg-num-val {
+ font-size: 14px;
+ font-weight: 600;
+ color: #0f172a;
+ letter-spacing: 0.5px;
+ }
+ }
+ }
+ }
+
+ .pkg-logistics-footer {
+ padding: 9px 16px;
+ background: #f8fafc;
+ border-top: 1px solid #f1f5f9;
+
+ .pkg-trace-content {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 10px;
+ font-size: 12px;
+ line-height: 1.5;
+
+ .trace-status-tag {
+ font-size: 11px;
+ height: 20px;
+ line-height: 18px;
+ padding: 0 6px;
+ }
+
+ .trace-time {
+ color: #64748b;
+ font-family: Consolas, Monaco, monospace;
+ }
+
+ .trace-desc {
+ color: #334155;
+ font-weight: 500;
+ flex: 1;
+ min-width: 160px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ .trace-more-btn {
+ font-size: 12px;
+ padding: 0;
+ margin-left: auto;
+ }
+ }
+ }
+}
+
.package-item-line {
line-height: 1.8;
}