feat(orders): redesign detail modal — hero pill, no duplicate close

- Remove bottom "关闭" button so the top-right ✕ is the single dismiss.
- Drop redundant 订单类型 row from modal body (already shown as card chip).
- Add hero strip with status pill + amount; unify dt/dd rows into a
  bordered card; tighten items list and add timeline rail.
- Refresh modal styling: rounded dialog, gradient header, hover-lift
  buttons, mobile-friendly rows.
This commit is contained in:
2026-07-27 13:34:30 +08:00
parent a1e35a4499
commit e47a3958fb
2 changed files with 287 additions and 38 deletions
+255 -24
View File
@@ -524,20 +524,135 @@
/* Order detail modal content */ /* Order detail modal content */
.aksrt-order-detail-dialog { .aksrt-order-detail-dialog {
width: min(560px, 100%); width: min(560px, 100%);
border-radius: 18px;
overflow: hidden;
background:
linear-gradient(180deg, color-mix(in srgb, var(--color-primary, #3b82f6) 6%, var(--surface-1, #fff)) 0%, var(--surface-1, #fff) 64px);
}
.aksrt-order-detail-dialog .aksrt-modal__header {
background: transparent;
border-bottom: none;
padding: 18px 20px 12px;
}
.aksrt-order-detail-dialog .aksrt-modal__header h3 {
font-size: 17px;
letter-spacing: 0.01em;
}
.aksrt-order-detail-dialog .aksrt-modal__close {
background: color-mix(in srgb, var(--surface-2, #f3f4f6) 70%, transparent);
}
.aksrt-order-detail-dialog .aksrt-modal__body {
padding: 0 20px 18px;
gap: 18px;
}
.aksrt-order-detail__hero {
position: relative;
margin: 0 -20px 0;
padding: 14px 20px 18px;
background:
radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--color-primary, #3b82f6) 12%, transparent) 0%, transparent 60%),
linear-gradient(180deg, color-mix(in srgb, var(--color-primary, #3b82f6) 8%, var(--surface-1, #fff)) 0%, transparent 100%);
border-bottom: 1px solid color-mix(in srgb, var(--color-line, #e5e7eb) 70%, transparent);
}
.aksrt-order-detail__hero-main {
display: grid;
grid-template-columns: auto 1fr;
grid-template-rows: auto auto;
column-gap: 12px;
row-gap: 2px;
align-items: center;
}
.aksrt-order-detail__status-pill {
grid-column: 1;
grid-row: 1;
justify-self: start;
display: inline-flex;
align-items: center;
padding: 4px 12px;
border-radius: 999px;
font-size: 12px;
font-weight: 700;
letter-spacing: 0.02em;
background: color-mix(in srgb, var(--color-primary, #3b82f6) 14%, transparent);
color: var(--color-primary, #3b82f6);
}
.aksrt-order-detail__status-pill.is-pending,
.aksrt-order-detail__status-pill.is-created {
background: color-mix(in srgb, var(--color-warning, #d97706) 14%, transparent);
color: var(--color-warning, #d97706);
}
.aksrt-order-detail__status-pill.is-paid,
.aksrt-order-detail__status-pill.is-delivered,
.aksrt-order-detail__status-pill.is-completed {
background: color-mix(in srgb, var(--color-success, #16a34a) 14%, transparent);
color: var(--color-success, #16a34a);
}
.aksrt-order-detail__status-pill.is-cancelled,
.aksrt-order-detail__status-pill.is-expired,
.aksrt-order-detail__status-pill.is-refunded,
.aksrt-order-detail__status-pill.is-refunding {
background: color-mix(in srgb, var(--color-ink-3, #8b8f97) 14%, transparent);
color: var(--color-ink-3, #8b8f97);
}
.aksrt-order-detail__status-pill.is-pending-review {
background: color-mix(in srgb, var(--color-warning, #d97706) 14%, transparent);
color: var(--color-warning, #d97706);
}
.aksrt-order-detail__hero-amount {
grid-column: 2;
grid-row: 1;
text-align: right;
font-size: 22px;
font-weight: 800;
color: var(--color-error, #ef4444);
font-variant-numeric: tabular-nums;
letter-spacing: -0.01em;
}
.aksrt-order-detail__hero-label {
grid-column: 1 / -1;
grid-row: 2;
font-size: 12px;
color: var(--color-ink-3, #8b8f97);
margin-top: 8px;
letter-spacing: 0.02em;
} }
.aksrt-order-detail__list { .aksrt-order-detail__list {
margin: 0; margin: 0;
padding: 4px 0 0;
display: grid; display: grid;
gap: 10px; gap: 0;
border-radius: 12px;
background: var(--surface-1, #fff);
border: 1px solid color-mix(in srgb, var(--color-line, #e5e7eb) 88%, transparent);
overflow: hidden;
} }
.aksrt-order-detail__row { .aksrt-order-detail__row {
display: grid; display: grid;
grid-template-columns: 96px minmax(0, 1fr); grid-template-columns: 96px minmax(0, 1fr);
gap: 10px 14px; gap: 10px 14px;
align-items: start; align-items: center;
padding: 12px 14px;
font-size: 13.5px; font-size: 13.5px;
border-bottom: 1px solid color-mix(in srgb, var(--color-line, #e5e7eb) 70%, transparent);
}
.aksrt-order-detail__row:last-child {
border-bottom: none;
} }
.aksrt-order-detail__row dt { .aksrt-order-detail__row dt {
@@ -552,21 +667,35 @@
font-weight: 600; font-weight: 600;
word-break: break-all; word-break: break-all;
font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums;
text-align: right;
} }
.aksrt-order-detail__items, .aksrt-order-detail__items,
.aksrt-order-detail__timeline { .aksrt-order-detail__timeline {
margin-top: 16px; margin: 0;
padding-top: 14px; padding: 0;
border-top: 1px dashed color-mix(in srgb, var(--color-line, #e5e7eb) 85%, transparent); border: none;
} }
.aksrt-order-detail__items h4, .aksrt-order-detail__items h4,
.aksrt-order-detail__timeline h4 { .aksrt-order-detail__timeline h4 {
margin: 0 0 10px; margin: 0 0 10px;
font-size: 13.5px; font-size: 13px;
font-weight: 700; font-weight: 700;
color: var(--color-ink, #1f2329); color: var(--color-ink, #1f2329);
display: flex;
align-items: center;
gap: 6px;
}
.aksrt-order-detail__items h4::before,
.aksrt-order-detail__timeline h4::before {
content: "";
width: 3px;
height: 14px;
border-radius: 2px;
background: var(--color-primary, #3b82f6);
display: inline-block;
} }
.aksrt-order-detail__items ul, .aksrt-order-detail__items ul,
@@ -578,37 +707,110 @@
gap: 8px; gap: 8px;
} }
.aksrt-order-detail__items ul {
border-radius: 12px;
background: var(--surface-1, #fff);
border: 1px solid color-mix(in srgb, var(--color-line, #e5e7eb) 88%, transparent);
overflow: hidden;
}
.aksrt-order-detail__items li { .aksrt-order-detail__items li {
display: grid; display: grid;
grid-template-columns: minmax(0, 1fr) auto auto; grid-template-columns: minmax(0, 1fr) auto auto;
gap: 10px; gap: 10px;
align-items: center; align-items: center;
padding: 10px 14px;
font-size: 13px; font-size: 13px;
color: var(--color-ink-2, #4b5563); color: var(--color-ink-2, #4b5563);
border-bottom: 1px solid color-mix(in srgb, var(--color-line, #e5e7eb) 70%, transparent);
} }
.aksrt-order-detail__items li em { .aksrt-order-detail__items li:last-child {
border-bottom: none;
}
.aksrt-order-detail__item-title {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.aksrt-order-detail__item-qty {
font-style: normal; font-style: normal;
color: var(--color-ink-3, #8b8f97); color: var(--color-ink-3, #8b8f97);
}
.aksrt-order-detail__items li strong {
font-weight: 700;
color: var(--color-ink, #1f2329);
font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums;
} }
.aksrt-order-detail__item-price {
font-weight: 700;
color: var(--color-ink, #1f2329);
font-variant-numeric: tabular-nums;
min-width: 72px;
text-align: right;
}
.aksrt-order-detail__timeline ol {
position: relative;
padding-left: 16px;
gap: 10px;
}
.aksrt-order-detail__timeline ol::before {
content: "";
position: absolute;
left: 5px;
top: 6px;
bottom: 6px;
width: 2px;
border-radius: 2px;
background: color-mix(in srgb, var(--color-line, #e5e7eb) 90%, transparent);
}
.aksrt-order-detail__timeline li { .aksrt-order-detail__timeline li {
position: relative;
display: grid;
grid-template-columns: 1fr;
gap: 2px;
font-size: 13px;
color: var(--color-ink-2, #4b5563);
padding: 2px 0;
}
.aksrt-order-detail__timeline-dot {
position: absolute;
left: -16px;
top: 7px;
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--color-primary, #3b82f6);
box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary, #3b82f6) 14%, transparent);
}
.aksrt-order-detail__timeline li:first-child .aksrt-order-detail__timeline-dot {
background: var(--color-success, #16a34a);
box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-success, #16a34a) 14%, transparent);
}
.aksrt-order-detail__timeline-body {
display: grid; display: grid;
grid-template-columns: 140px minmax(0, 1fr); grid-template-columns: 140px minmax(0, 1fr);
gap: 10px; gap: 10px;
font-size: 12.5px; align-items: baseline;
color: var(--color-ink-2, #4b5563);
} }
.aksrt-order-detail__timeline time { .aksrt-order-detail__timeline time {
color: var(--color-ink-3, #8b8f97); color: var(--color-ink-3, #8b8f97);
font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums;
font-size: 12.5px;
}
.aksrt-order-detail-dialog .aksrt-modal__footer {
padding: 16px 20px 18px;
background: color-mix(in srgb, var(--surface-2, #f6f7f9) 65%, transparent);
border-top: 1px solid color-mix(in srgb, var(--color-line, #e5e7eb) 70%, transparent);
gap: 8px;
} }
.aksrt-modal__footer .btn-primary, .aksrt-modal__footer .btn-primary,
@@ -616,27 +818,35 @@
.aksrt-modal__footer .btn-ghost, .aksrt-modal__footer .btn-ghost,
.aksrt-modal__footer a.btn-ghost, .aksrt-modal__footer a.btn-ghost,
.aksrt-modal__footer a.btn-outline { .aksrt-modal__footer a.btn-outline {
min-height: 34px; min-height: 36px;
padding: 0 14px; padding: 0 18px;
border-radius: 999px; border-radius: 10px;
font-size: 13px; font-size: 13.5px;
font-weight: 600; font-weight: 600;
line-height: 32px; line-height: 34px;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
text-decoration: none; text-decoration: none;
cursor: pointer; cursor: pointer;
transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
} }
.aksrt-modal__footer .btn-primary { .aksrt-modal__footer .btn-primary {
border: 1px solid transparent; border: 1px solid transparent;
background: var(--color-primary, #3b82f6); background: var(--color-primary, #3b82f6);
color: var(--color-on-primary, #fff); color: var(--color-on-primary, #fff);
box-shadow: 0 6px 16px color-mix(in srgb, var(--color-primary, #3b82f6) 30%, transparent);
}
.aksrt-modal__footer .btn-primary:hover {
filter: brightness(1.05);
transform: translateY(-1px);
} }
.aksrt-modal__footer .btn-primary.c-green { .aksrt-modal__footer .btn-primary.c-green {
background: var(--color-success, #16a34a); background: var(--color-success, #16a34a);
box-shadow: 0 6px 16px color-mix(in srgb, var(--color-success, #16a34a) 30%, transparent);
} }
.aksrt-modal__footer .btn-outline { .aksrt-modal__footer .btn-outline {
@@ -645,19 +855,39 @@
color: var(--color-ink-2, #4b5563); color: var(--color-ink-2, #4b5563);
} }
.aksrt-modal__footer .btn-outline:hover {
border-color: var(--color-primary, #3b82f6);
color: var(--color-primary, #3b82f6);
transform: translateY(-1px);
}
.aksrt-modal__footer .btn-ghost { .aksrt-modal__footer .btn-ghost {
border: 1px solid transparent; border: 1px solid transparent;
background: transparent; background: transparent;
color: var(--color-ink-3, #8b8f97); color: var(--color-ink-3, #8b8f97);
} }
.aksrt-modal__footer .btn-ghost:hover {
color: var(--color-ink, #1f2329);
background: color-mix(in srgb, var(--surface-2, #f3f4f6) 80%, transparent);
}
@media (max-width: 767px) { @media (max-width: 767px) {
.aksrt-order-detail__row { .aksrt-order-detail-dialog {
grid-template-columns: 1fr; border-radius: 16px 16px 0 0;
gap: 2px; margin-top: auto;
} }
.aksrt-order-detail__timeline li { .aksrt-order-detail__row {
grid-template-columns: 1fr 1fr;
gap: 2px 12px;
}
.aksrt-order-detail__row dt {
text-align: left;
}
.aksrt-order-detail__timeline-body {
grid-template-columns: 1fr; grid-template-columns: 1fr;
gap: 2px; gap: 2px;
} }
@@ -670,7 +900,8 @@
.aksrt-modal__footer .btn-outline, .aksrt-modal__footer .btn-outline,
.aksrt-modal__footer .btn-ghost, .aksrt-modal__footer .btn-ghost,
.aksrt-modal__footer a { .aksrt-modal__footer a {
flex: 1 1 auto; flex: 1 1 calc(50% - 8px);
min-width: 0;
} }
} }
+32 -14
View File
@@ -511,10 +511,12 @@
} }
if (!qty || qty < 1) qty = 1; if (!qty || qty < 1) qty = 1;
var status = order.status || "";
var statusLabel = order.status_label || status || "—";
var statusClass = "is-" + String(status).replace(/[^a-z0-9_-]/gi, "-");
var rows = [ var rows = [
["订单状态", order.status_label || order.status || "—"],
["订单名称", order.product_name || (order.product && order.product.title) || "—"], ["订单名称", order.product_name || (order.product && order.product.title) || "—"],
["订单类型", order.product_type_label || order.product_type || "—"],
["订单数量", String(qty)], ["订单数量", String(qty)],
["应付金额", formatMoneyText(order)], ["应付金额", formatMoneyText(order)],
["订单编号", order.order_number || "—"], ["订单编号", order.order_number || "—"],
@@ -533,11 +535,19 @@
rows.push(["备注", order.customer_note]); rows.push(["备注", order.customer_note]);
} }
var html = '<dl class="aksrt-order-detail__list">'; var html = "";
html += '<div class="aksrt-order-detail__hero">';
html += ' <div class="aksrt-order-detail__hero-main">';
html += ' <span class="aksrt-order-detail__status-pill ' + escapeHtml(statusClass) + '">' + escapeHtml(statusLabel) + "</span>";
html += ' <strong class="aksrt-order-detail__hero-amount">' + escapeHtml(formatMoneyText(order)) + "</strong>";
html += ' <span class="aksrt-order-detail__hero-label">应付金额</span>';
html += " </div>";
html += "</div>";
html += '<dl class="aksrt-order-detail__list">';
rows.forEach(function (row) { rows.forEach(function (row) {
html += '<div class="aksrt-order-detail__row">'; html += '<div class="aksrt-order-detail__row">';
html += '<dt>' + escapeHtml(row[0]) + '</dt>'; html += '<dt>' + escapeHtml(row[0]) + '</dt>';
// Money strings already composed; still escape all cells for safety.
html += '<dd>' + escapeHtml(row[1]) + '</dd>'; html += '<dd>' + escapeHtml(row[1]) + '</dd>';
html += '</div>'; html += '</div>';
}); });
@@ -549,12 +559,13 @@
var title = item.product_title || item.title || order.product_name || "商品"; var title = item.product_title || item.title || order.product_name || "商品";
var itemQty = item.quantity || item.qty || 1; var itemQty = item.quantity || item.qty || 1;
var price = item.pay_price != null ? item.pay_price : (item.unit_price || 0); var price = item.pay_price != null ? item.pay_price : (item.unit_price || 0);
html += '<li><span>' + escapeHtml(title) + '</span>'; html += '<li>';
html += '<em>×' + escapeHtml(String(itemQty)) + '</em>'; html += ' <span class="aksrt-order-detail__item-title">' + escapeHtml(title) + "</span>";
html += ' <em class="aksrt-order-detail__item-qty">×' + escapeHtml(String(itemQty)) + '</em>';
if (order.is_points) { if (order.is_points) {
html += '<strong>' + escapeHtml(order.currency_symbol || "积分") + " " + Math.round(Number(price || 0)) + "</strong>"; html += '<strong class="aksrt-order-detail__item-price">' + escapeHtml(order.currency_symbol || "积分") + " " + Math.round(Number(price || 0)) + "</strong>";
} else { } else {
html += '<strong>¥' + Number(price || 0).toFixed(2) + "</strong>"; html += '<strong class="aksrt-order-detail__item-price">¥' + Number(price || 0).toFixed(2) + "</strong>";
} }
html += "</li>"; html += "</li>";
}); });
@@ -564,7 +575,11 @@
if (order.timeline && order.timeline.length) { if (order.timeline && order.timeline.length) {
html += '<div class="aksrt-order-detail__timeline"><h4>订单进度</h4><ol>'; html += '<div class="aksrt-order-detail__timeline"><h4>订单进度</h4><ol>';
order.timeline.forEach(function (tl) { order.timeline.forEach(function (tl) {
html += '<li><time>' + escapeHtml(tl.time || "") + "</time><span>" + escapeHtml(tl.label || "") + "</span></li>"; html += '<li><span class="aksrt-order-detail__timeline-dot"></span>';
html += '<div class="aksrt-order-detail__timeline-body">';
html += '<time>' + escapeHtml(tl.time || "") + "</time>";
html += "<span>" + escapeHtml(tl.label || "") + "</span>";
html += "</div></li>";
}); });
html += "</ol></div>"; html += "</ol></div>";
} }
@@ -572,19 +587,20 @@
detailBody.innerHTML = html; detailBody.innerHTML = html;
var footer = ""; var footer = "";
// Status-aware footer actions. // Status-aware footer actions. The modal's own ✕ button (top-right) is the only
// dismiss control, so do not add a duplicate "关闭" button here.
if (actions.can_cancel) { if (actions.can_cancel) {
footer += '<button type="button" class="btn-ghost" data-aksrt-order-cancel="' + escapeHtml(order.order_number) + '">关闭订单</button>'; footer += '<button type="button" class="btn-ghost" data-aksrt-order-cancel="' + escapeHtml(order.order_number) + '">关闭订单</button>';
} }
if (actions.can_pay) {
footer += '<button type="button" class="btn-primary" data-aksrt-order-pay="' + escapeHtml(order.order_number) + '" data-aksrt-order-method="' + escapeHtml((payment && payment.value) || "") + '">立即支付</button>';
}
if (actions.can_receipt) { if (actions.can_receipt) {
footer += '<button type="button" class="btn-primary" data-aksrt-order-receipt="' + escapeHtml(order.order_number) + '">确认收货</button>'; footer += '<button type="button" class="btn-primary" data-aksrt-order-receipt="' + escapeHtml(order.order_number) + '">确认收货</button>';
} }
if (actions.can_review) { if (actions.can_review) {
footer += '<button type="button" class="btn-primary c-green" data-aksrt-order-review="' + escapeHtml(order.order_number) + '">评价</button>'; footer += '<button type="button" class="btn-primary c-green" data-aksrt-order-review="' + escapeHtml(order.order_number) + '">评价</button>';
} }
if (actions.can_pay) {
footer += '<button type="button" class="btn-primary" data-aksrt-order-pay="' + escapeHtml(order.order_number) + '" data-aksrt-order-method="' + escapeHtml((payment && payment.value) || "") + '">立即支付</button>';
}
if (actions.can_after_sale) { if (actions.can_after_sale) {
footer += '<button type="button" class="btn-outline" data-aksrt-order-after-sale="' + escapeHtml(order.order_number) + '">申请售后</button>'; footer += '<button type="button" class="btn-outline" data-aksrt-order-after-sale="' + escapeHtml(order.order_number) + '">申请售后</button>';
} }
@@ -597,7 +613,9 @@
if (order.secondary_url && order.secondary_label) { if (order.secondary_url && order.secondary_label) {
footer += '<a class="btn-ghost" href="' + escapeHtml(order.secondary_url) + '">' + escapeHtml(order.secondary_label) + "</a>"; footer += '<a class="btn-ghost" href="' + escapeHtml(order.secondary_url) + '">' + escapeHtml(order.secondary_label) + "</a>";
} }
footer += '<button type="button" class="btn-outline" data-aksrt-order-detail-close>关闭</button>'; if (footer === "") {
footer = '<button type="button" class="btn-outline" data-aksrt-order-detail-close>关闭</button>';
}
detailFooter.innerHTML = footer; detailFooter.innerHTML = footer;
} }