fix layout

This commit is contained in:
Timi
2026-10-28 14:21:26 +08:00
parent 5609d2484e
commit adc6e38328
83 changed files with 5587 additions and 5386 deletions
+222 -218
View File
@@ -1,228 +1,232 @@
<template>
<t-navbar
fixed
:z-index="20"
title="销售订单详情"
left-arrow
@left-click="$router.back()"
/>
<div v-can="permissionCodes.salesOrder.read" class="sales-order-detail">
<template v-if="order">
<customer-profile-card
v-if="order.customer"
class="customer"
:customer="order.customer"
v-entrance-transition
@click="toCustomerDetail"
/>
<section class="hero" v-entrance-transition>
<div class="header">
<span class="eyebrow">销售订单</span>
<div class="tags">
<t-tag :content="getSalesOrderTypeText(order.orderType)" theme="primary" variant="light-outline" />
<t-tag :content="getSalesOrderStatusText(order.status)" variant="light-outline" :theme="getStatusTheme(order.status)" />
</div>
</div>
<h1 class="no selectable" v-text="order.orderNo" />
<div class="meta">
<time-label class="time" :timestamp="order.purchasedAt" underline />
<div class="amount red text-bold">
<span>¥</span>
<strong class="value" v-text="formatPackageAmount(order.saleAmount)" />
</div>
</div>
</section>
<t-form class="info form card" title="订单信息" @submit="saveEdit" v-entrance-transition>
<t-form-item v-if="order.sourceEventRecord?.id" label="来源登记记录" arrow @click="toEventRecord">
<span>查看来源记录</span>
</t-form-item>
<t-form-item label="备注">
<t-textarea v-if="isEditing" v-model.trim="editRemark" class="remark-editor" borderless autosize maxlength="500" placeholder="记录本单需要注意的内容" />
<span v-else v-text="Text.display(order.remark)" />
</t-form-item>
<t-form-item label-width="0">
<div class="photo-wrap" v-entrance-transition>
<attachment-selector :readonly="!isEditing"
v-model:items="photoItems"
:upload="isEditing ? uploadPhotoList : undefined"
title="订单照片"
/>
</div>
</t-form-item>
<t-form-item v-if="canUpdate" label-width="0">
<div class="edit-actions">
<t-button
v-if="!isEditing"
type="button"
size="extra-small"
theme="primary"
@click="toEdit"
>编辑</t-button>
<template v-else>
<t-button
type="button"
size="extra-small"
:disabled="isSaving"
@click="cancelEdit"
>取消</t-button>
<t-button
type="submit"
theme="primary"
size="extra-small"
:loading="isSaving"
:disabled="isSaving"
>保存</t-button>
</template>
</div>
</t-form-item>
</t-form>
<t-form
v-if="order.itemList?.length"
class="form card product"
title="订单明细"
theme="card"
label-width="0"
v-entrance-transition
>
<t-form-item class="form-item" v-for="item in order.itemList" :key="item.id">
<div class="item">
<div class="page-layout navbar">
<t-navbar
fixed
:z-index="20"
title="销售订单详情"
left-arrow
@left-click="$router.back()"
/>
<main class="page-content scroll column">
<div v-can="permissionCodes.salesOrder.read" class="sales-order-detail">
<template v-if="order">
<customer-profile-card
v-if="order.customer"
class="customer"
:customer="order.customer"
v-entrance-transition
@click="toCustomerDetail"
/>
<section class="hero" v-entrance-transition>
<div class="header">
<div class="left">
<t-image
v-if="getProductPhotoURL(item)"
:src="getProductPhotoURL(item)"
:alt="item.productNameSnapshot || '产品图片'"
fit="cover"
class="avatar"
/>
<div
v-else
class="avatar fallback"
v-text="(item.productNameSnapshot || '产').slice(0, 1)"
<span class="eyebrow">销售订单</span>
<div class="tags">
<t-tag :content="getSalesOrderTypeText(order.orderType)" theme="primary" variant="light-outline" />
<t-tag :content="getSalesOrderStatusText(order.status)" variant="light-outline" :theme="getStatusTheme(order.status)" />
</div>
</div>
<h1 class="no selectable" v-text="order.orderNo" />
<div class="meta">
<time-label class="time" :timestamp="order.purchasedAt" underline />
<div class="amount red text-bold">
<span>¥</span>
<strong class="value" v-text="formatPackageAmount(order.saleAmount)" />
</div>
</div>
</section>
<t-form class="info form card" title="订单信息" @submit="saveEdit" v-entrance-transition>
<t-form-item v-if="order.sourceEventRecord?.id" label="来源登记记录" arrow @click="toEventRecord">
<span>查看来源记录</span>
</t-form-item>
<t-form-item label="备注">
<t-textarea v-if="isEditing" v-model.trim="editRemark" class="remark-editor" borderless autosize maxlength="500" placeholder="记录本单需要注意的内容" />
<span v-else v-text="Text.display(order.remark)" />
</t-form-item>
<t-form-item label-width="0">
<div class="photo-wrap" v-entrance-transition>
<attachment-selector :readonly="!isEditing"
v-model:items="photoItems"
:upload="isEditing ? uploadPhotoList : undefined"
title="订单照片"
/>
</div>
<div class="main">
<div class="title">
<div class="name-gift">
<span class="name text-bold" v-text="item.productNameSnapshot || '未命名产品'" />
<t-tag v-if="item.gifted" size="small" theme="success" content="赠送" />
</t-form-item>
<t-form-item v-if="canUpdate" label-width="0">
<div class="edit-actions">
<t-button
v-if="!isEditing"
type="button"
size="extra-small"
theme="primary"
@click="toEdit"
>编辑</t-button>
<template v-else>
<t-button
type="button"
size="extra-small"
:disabled="isSaving"
@click="cancelEdit"
>取消</t-button>
<t-button
type="submit"
theme="primary"
size="extra-small"
:loading="isSaving"
:disabled="isSaving"
>保存</t-button>
</template>
</div>
</t-form-item>
</t-form>
<t-form
v-if="order.itemList?.length"
class="form card product"
title="订单明细"
theme="card"
label-width="0"
v-entrance-transition
>
<t-form-item class="form-item" v-for="item in order.itemList" :key="item.id">
<div class="item">
<div class="header">
<div class="left">
<t-image
v-if="getProductPhotoURL(item)"
:src="getProductPhotoURL(item)"
:alt="item.productNameSnapshot || '产品图片'"
fit="cover"
class="avatar"
/>
<div
v-else
class="avatar fallback"
v-text="(item.productNameSnapshot || '产').slice(0, 1)"
/>
</div>
<div class="main">
<div class="title">
<div class="name-gift">
<span class="name text-bold" v-text="item.productNameSnapshot || '未命名产品'" />
<t-tag v-if="item.gifted" size="small" theme="success" content="赠送" />
</div>
<t-tag
:content="getItemFulfillmentStatus(item).text"
:theme="getItemFulfillmentStatus(item).theme"
variant="light-outline"
/>
</div>
<div class="description">
<strong
v-if="item.lineAmount !== null && item.lineAmount !== undefined"
class="red"
v-text="`¥${formatPackageAmount(item.lineAmount)}`"
/>
<t-tag v-else size="small" content="套餐权益" />
<product-sku-tags
:product-name="item.productNameSnapshot"
:snapshot="item.skuSpecSnapshot"
:fallback="item.specSummarySnapshot || item.skuNameSnapshot"
:unit="item.unitSnapshot"
/>
</div>
</div>
<t-tag
:content="getItemFulfillmentStatus(item).text"
:theme="getItemFulfillmentStatus(item).theme"
variant="light-outline"
/>
</div>
<div class="description">
<strong
v-if="item.lineAmount !== null && item.lineAmount !== undefined"
class="red"
v-text="`¥${formatPackageAmount(item.lineAmount)}`"
/>
<t-tag v-else size="small" content="套餐权益" />
<product-sku-tags
:product-name="item.productNameSnapshot"
:snapshot="item.skuSpecSnapshot"
:fallback="item.specSummarySnapshot || item.skuNameSnapshot"
:unit="item.unitSnapshot"
/>
<div class="content">
<div class="metric">
<strong v-text="getPackageQuantityText(item.quantity)" />
<span>订单数量</span>
</div>
<div class="metric">
<strong :class="getAvailableQuantityClass(item)" v-text="getItemQuantityText(item, item.availableBaseQuantity)" />
<span>可履约</span>
</div>
<div class="metric">
<strong v-text="getItemQuantityText(item, item.pendingBaseQuantity)" />
<span>待核销</span>
</div>
<div class="metric">
<strong :class="getFulfilledQuantityClass(item)" v-text="getItemQuantityText(item, item.fulfilledBaseQuantity)" />
<span>已履约</span>
</div>
<div class="metric">
<strong :class="getRemainingQuantityClass(item)" v-text="getItemQuantityText(item, item.remainingBaseQuantity)" />
<span>剩余</span>
</div>
</div>
</div>
</div>
<div class="content">
<div class="metric">
<strong v-text="getPackageQuantityText(item.quantity)" />
<span>订单数量</span>
</div>
<div class="metric">
<strong :class="getAvailableQuantityClass(item)" v-text="getItemQuantityText(item, item.availableBaseQuantity)" />
<span>可履约</span>
</div>
<div class="metric">
<strong v-text="getItemQuantityText(item, item.pendingBaseQuantity)" />
<span>待核销</span>
</div>
<div class="metric">
<strong :class="getFulfilledQuantityClass(item)" v-text="getItemQuantityText(item, item.fulfilledBaseQuantity)" />
<span>已履约</span>
</div>
<div class="metric">
<strong :class="getRemainingQuantityClass(item)" v-text="getItemQuantityText(item, item.remainingBaseQuantity)" />
<span>剩余</span>
</div>
</div>
</div>
</t-form-item>
<t-form-item label="履约记录" arrow @click="toFulfillmentList">
查看本单所有履约单
</t-form-item>
</t-form>
<t-button
v-if="canCreateFulfillment && canFulfillByPayment && order.status === 'ACTIVE'"
class="cell-button"
theme="primary"
content="履约产品"
@click="toCreateFulfillment"
/>
<t-cell-group class="finance-panel" title="资金摘要" theme="card">
<t-cell title="成交金额">
<template #note><span :class="getPaymentAmountClass(order.paymentStatus)" v-text="formatPackageAmount(order.saleAmount)" /></template>
</t-cell>
<t-cell title="已生效收款">
<template #note><span :class="getAmountClass(order.paidAmount, 'green')" v-text="formatPackageAmount(order.paidAmount)" /></template>
</t-cell>
<t-cell title="待核销收款">
<template #note><span :class="getAmountClass(order.pendingPaidAmount, 'orange')" v-text="formatPackageAmount(order.pendingPaidAmount)" /></template>
</t-cell>
<t-cell title="剩余待收款">
<template #note><span :class="getRemainingAmountClass(order.unpaidAmount)" v-text="formatPackageAmount(order.unpaidAmount)" /></template>
</t-cell>
<t-cell title="有效退款">
<template #note><span :class="getAmountClass(order.refundedAmount, 'red')" v-text="formatPackageAmount(order.refundedAmount)" /></template>
</t-cell>
<t-cell title="收款状态" :note="getSalesPaymentStatusText(order.paymentStatus)" />
<t-cell v-if="order.paymentStatus === 'PAID'" title="全额实收时间" :note="getPaidAtText(order.paidAt)" />
<t-cell title="退款状态" :note="getSalesRefundStatusText(order.refundStatus)" />
<t-cell
v-if="canReadFund || canReadMyReceive"
:title="canReadFund ? '查看全部资金流水' : '查看我的收款申请'"
arrow
@click="toFundRecords"
/>
</t-cell-group>
<t-cell-group v-if="order.status === 'CANCELLED'" class="cancel-info" title="取消记录" theme="card">
<t-cell title="取消时间">
<template #note>
<time-label :timestamp="order.cancelledAt" underline />
</template>
</t-cell>
<t-cell title="取消人" :note="order.cancelOperator?.nick || order.cancelOperator?.name || order.cancelOperatorUserId || '未知'" />
<t-cell title="取消原因" :note="order.cancelReason || '未填写'" />
</t-cell-group>
<section class="actions" v-entrance-transition>
<t-button
v-if="canReceive"
theme="primary"
@click="toPayment"
>登记收款</t-button>
<t-button
v-if="canRefund"
theme="danger"
@click="toRefund"
>登记退款</t-button>
<t-button
v-if="canConfirmNoRefund"
theme="default"
@click="toNoRefund"
>确认无需退款</t-button>
<t-button
v-if="canCancel"
theme="danger"
@click="toCancel"
>取消订单</t-button>
</section>
</template>
<t-empty v-else :description="loading ? '正在加载订单' : '订单不存在'" />
</t-form-item>
<t-form-item label="履约记录" arrow @click="toFulfillmentList">
查看本单所有履约单
</t-form-item>
</t-form>
<t-button
v-if="canCreateFulfillment && canFulfillByPayment && order.status === 'ACTIVE'"
class="cell-button"
theme="primary"
content="履约产品"
@click="toCreateFulfillment"
/>
<t-cell-group class="finance-panel" title="资金摘要" theme="card">
<t-cell title="成交金额">
<template #note><span :class="getPaymentAmountClass(order.paymentStatus)" v-text="formatPackageAmount(order.saleAmount)" /></template>
</t-cell>
<t-cell title="已生效收款">
<template #note><span :class="getAmountClass(order.paidAmount, 'green')" v-text="formatPackageAmount(order.paidAmount)" /></template>
</t-cell>
<t-cell title="待核销收款">
<template #note><span :class="getAmountClass(order.pendingPaidAmount, 'orange')" v-text="formatPackageAmount(order.pendingPaidAmount)" /></template>
</t-cell>
<t-cell title="剩余待收款">
<template #note><span :class="getRemainingAmountClass(order.unpaidAmount)" v-text="formatPackageAmount(order.unpaidAmount)" /></template>
</t-cell>
<t-cell title="有效退款">
<template #note><span :class="getAmountClass(order.refundedAmount, 'red')" v-text="formatPackageAmount(order.refundedAmount)" /></template>
</t-cell>
<t-cell title="收款状态" :note="getSalesPaymentStatusText(order.paymentStatus)" />
<t-cell v-if="order.paymentStatus === 'PAID'" title="全额实收时间" :note="getPaidAtText(order.paidAt)" />
<t-cell title="退款状态" :note="getSalesRefundStatusText(order.refundStatus)" />
<t-cell
v-if="canReadFund || canReadMyReceive"
:title="canReadFund ? '查看全部资金流水' : '查看我的收款申请'"
arrow
@click="toFundRecords"
/>
</t-cell-group>
<t-cell-group v-if="order.status === 'CANCELLED'" class="cancel-info" title="取消记录" theme="card">
<t-cell title="取消时间">
<template #note>
<time-label :timestamp="order.cancelledAt" underline />
</template>
</t-cell>
<t-cell title="取消人" :note="order.cancelOperator?.nick || order.cancelOperator?.name || order.cancelOperatorUserId || '未知'" />
<t-cell title="取消原因" :note="order.cancelReason || '未填写'" />
</t-cell-group>
<section class="actions" v-entrance-transition>
<t-button
v-if="canReceive"
theme="primary"
@click="toPayment"
>登记收款</t-button>
<t-button
v-if="canRefund"
theme="danger"
@click="toRefund"
>登记退款</t-button>
<t-button
v-if="canConfirmNoRefund"
theme="default"
@click="toNoRefund"
>确认无需退款</t-button>
<t-button
v-if="canCancel"
theme="danger"
@click="toCancel"
>取消订单</t-button>
</section>
</template>
<t-empty v-else :description="loading ? '正在加载订单' : '订单不存在'" />
</div>
</main>
</div>
</template>
@@ -501,7 +505,7 @@ watch(() => route.params.id, loadData);
<style scoped lang="less">
.sales-order-detail {
gap: 1rem;
padding: calc(var(--app-nav-height) + 1rem) 0 2rem;
padding: 0 0 2rem;
display: flex;
flex-direction: column;