style(product): popup style for stock calendar

This commit is contained in:
Timi
2026-11-14 15:31:20 +08:00
parent a69497d556
commit d9cebc4d66
@@ -4,85 +4,104 @@
:title="`${selectedDate} 库存流水`"
height="80vh"
left-button-text="关闭"
right-button-text=""
@left-button-click="visible = false"
>
<div class="records">
<template v-if="canReadRecords">
<div class="directions">
<t-segmented :value="direction" :options="directionOptions" @change="changeDirection" />
<div v-if="selection" class="summary">
<span v-if="summaryLoading">汇总加载中</span>
<span v-else :class="direction === 'IN' ? 'in' : 'out'"
v-text="`合计 ${formatQuantity(direction === 'IN' ? summary?.inQuantity : summary?.outQuantity)} ${currentUnit?.name || ''}`" />
<t-button v-if="1 < units.length" size="extra-small" variant="outline" :content="`单位:${currentUnit?.name}`" @click="nextUnit" />
</div>
<div v-if="canReadRecords" class="records">
<div class="filters glass-header">
<div v-if="selection" class="summary">
<span v-if="summaryLoading">汇总加载中</span>
<span
v-else
:class="direction === 'IN' ? 'in' : 'out'"
v-text="`合计 ${formatQuantity(direction === 'IN' ? summary?.inQuantity : summary?.outQuantity)} ${currentUnit?.name || ''}`"
/>
<t-button
v-if="1 < units.length"
size="extra-small"
variant="outline"
:content="`单位:${currentUnit?.name}`"
@click="nextUnit"
/>
</div>
<div class="record-list">
<t-cell-group v-if="records.length" class="list empty-cell-title-margin" theme="card">
<t-cell v-for="record in records" :key="record.id" class="item">
<template #leftIcon>
<t-image
v-if="getCustomerPhotoURL(record.customer, 64)"
:src="getCustomerPhotoURL(record.customer, 64)"
:alt="getCustomerText(record)"
fit="cover"
class="avatar"
/>
<div
v-else-if="record.customer"
class="avatar fallback"
v-text="getCustomerText(record).slice(0, 1)"
/>
<t-image
v-else-if="record.operator"
:src="getOperatorAvatar(record)"
:alt="getOperatorText(record)"
fit="cover"
class="avatar"
/>
<t-segmented :value="direction" :options="directionOptions" @change="changeDirection" />
</div>
<t-cell-group v-if="records.length" class="list empty-cell-title-margin" theme="card">
<t-cell v-for="record in records" :key="record.id" class="item">
<template #leftIcon>
<t-image
v-if="getCustomerPhotoURL(record.customer, 64)"
:src="getCustomerPhotoURL(record.customer, 64)"
:alt="getCustomerText(record)"
fit="cover"
class="avatar"
/>
<div
v-else-if="record.customer"
class="avatar fallback"
v-text="getCustomerText(record).slice(0, 1)"
/>
<t-image
v-else-if="record.operator"
:src="getOperatorAvatar(record)"
:alt="getOperatorText(record)"
fit="cover"
class="avatar"
/>
<span
v-else
class="icon"
:class="getDeltaClass(record.onHandDelta)"
>
<t-icon name="history" size="1.25rem" />
</span>
</template>
<template #title>
<div class="title">
<span v-if="record.customer" class="actor" v-text="getCustomerText(record)" />
<span
v-else-if="record.operator"
class="actor"
v-text="getOperatorText(record)"
/>
<strong
class="operation"
:class="getOperationClass(record.operationType)"
v-text="getStockOperationText(record.operationType)"
/>
<strong class="product-name" v-text="record.productNameSnapshot || '未命名产品'" />
<t-tag
v-if="record.skuNameSnapshot && record.productNameSnapshot !== record.skuNameSnapshot"
size="small"
:content="record.skuNameSnapshot"
/>
<span
v-if="record.quantity !== undefined && record.quantity !== null && record.quantity !== ''"
class="record-quantity"
v-text="`${getProductQuantityText(record.quantity)} ${record.unitSnapshot || ''}`"
/>
</div>
</template>
<template #description>
<div class="description">
<time-label :timestamp="record.occurredAt" underline />
<div>
<span
v-else
class="icon"
:class="getDeltaClass(record.onHandDelta)"
>
<t-icon name="history" size="1.25rem" />
</span>
</template>
<template #title>
<div class="record-title">
<span v-if="record.customer" class="actor" v-text="getCustomerText(record)" />
<span v-else-if="record.operator" class="actor"
v-text="getOperatorText(record)" />
<strong class="operation" :class="getOperationClass(record.operationType)"
v-text="getStockOperationText(record.operationType)" />
<strong class="product-name"
v-text="record.productNameSnapshot || '未命名产品'" />
<t-tag
v-if="record.skuNameSnapshot && record.productNameSnapshot !== record.skuNameSnapshot"
size="small" :content="record.skuNameSnapshot" />
<span
v-if="record.quantity !== undefined && record.quantity !== null && record.quantity !== ''"
class="record-quantity"
v-text="`${getProductQuantityText(record.quantity)} ${record.unitSnapshot || ''}`" />
</div>
</template>
<template #description>
<div class="description">
<time-label :timestamp="record.occurredAt" underline />
<div><span class="delta" :class="getDeltaClass(record.onHandDelta)"
v-text="getDeltaText(record.onHandDelta)" /></div>
</div>
</template>
</t-cell>
</t-cell-group>
<t-empty v-else-if="!recordsLoading" description="当天暂无流水" />
<t-button v-if="!noMore" block variant="text" :loading="recordsLoading" @click="loadRecords">
加载更多
</t-button>
</div>
</template>
<t-empty v-else description="暂无库存流水查看权限" />
class="delta"
:class="getDeltaClass(record.onHandDelta)"
v-text="getDeltaText(record.onHandDelta)"
/>
</div>
</div>
</template>
</t-cell>
</t-cell-group>
<t-empty v-else-if="!recordsLoading" description="当天暂无流水" />
<t-button v-if="!noMore" block variant="text" :loading="recordsLoading" @click="loadRecords">
加载更多
</t-button>
</div>
<t-empty v-else description="暂无库存流水查看权限" />
</bottom-popup>
</template>
@@ -236,160 +255,158 @@ defineExpose({ openDay });
<style scoped lang="less">
.records {
height: 60vh;
display: flex;
min-height: 0;
flex-direction: column;
height: 100%;
overflow-y: auto;
.directions {
.filters {
gap: .5rem;
top: 0;
display: flex;
padding: .75rem;
z-index: 1;
position: sticky;
min-width: 0;
flex-shrink: 0;
align-items: center;
justify-content: space-between;
}
justify-content: end;
.summary {
gap: .75rem;
display: flex;
min-width: 0;
font-size: .875rem;
align-items: center;
white-space: nowrap;
.summary {
gap: .75rem;
display: flex;
min-width: 0;
font-size: .875rem;
align-items: center;
white-space: nowrap;
.in { color: var(--td-success-color); }
.out { color: var(--td-error-color); }
}
.in {
color: var(--td-success-color);
}
.record-list {
overflow-x: hidden;
overflow-y: auto;
min-width: 0;
min-height: 0;
flex: 1;
}
.avatar {
width: 3.5rem;
height: 3.5rem;
.out {
color: var(--td-error-color);
}
}
}
.list {
margin: 0;
}
.item {
padding: .625rem;
min-width: 0;
}
.item {
padding: .625rem;
min-width: 0;
.icon {
width: 2.25rem;
height: 2.25rem;
display: inline-flex;
background: var(--td-bg-color-secondarycontainer);
align-items: center;
border-radius: 50%;
justify-content: center;
}
.record-title {
gap: .25rem;
display: flex;
min-width: 0;
max-width: 100%;
font-size: .75rem;
align-items: center;
white-space: nowrap;
.actor {
flex: 0 0 auto;
color: var(--td-text-color-brand);
}
.operation, .record-quantity {
flex: 0 0 auto;
}
.operation {
color: var(--operation-color, var(--td-text-color-secondary));
&.initial-in {
--operation-color: #2563eb;
.avatar {
width: 3.5rem;
height: 3.5rem;
}
&.manual-in {
--operation-color: #15803d;
.icon {
width: 2.25rem;
height: 2.25rem;
display: inline-flex;
background: var(--td-bg-color-secondarycontainer);
align-items: center;
border-radius: 50%;
justify-content: center;
}
&.manual-out {
--operation-color: #c2410c;
.title {
gap: .25rem;
display: flex;
min-width: 0;
max-width: 100%;
font-size: .75rem;
align-items: center;
white-space: nowrap;
.actor {
flex: 0 0 auto;
color: var(--td-text-color-brand);
}
.operation, .record-quantity {
flex: 0 0 auto;
}
.operation {
color: var(--operation-color, var(--td-text-color-secondary));
&.initial-in {
--operation-color: #2563eb;
}
&.manual-in {
--operation-color: #15803d;
}
&.manual-out {
--operation-color: #c2410c;
}
&.manual-revoke {
--operation-color: #be123c;
}
&.order-reserve {
--operation-color: #7c3aed;
}
&.order-release {
--operation-color: #0891b2;
}
&.order-out {
--operation-color: #dc2626;
}
&.order-revoke {
--operation-color: #4f46e5;
}
&.return-in {
--operation-color: #15803d;
}
&.stocktake-gain {
--operation-color: #0f766e;
}
&.stocktake-loss {
--operation-color: #a16207;
}
}
.product-name {
overflow: hidden;
flex: 0 1 auto;
text-overflow: ellipsis;
}
.record-quantity {
color: var(--td-text-color-secondary);
}
}
&.manual-revoke {
--operation-color: #be123c;
.description {
gap: .5rem;
display: flex;
font-size: .75rem;
align-items: center;
justify-content: space-between;
}
&.order-reserve {
--operation-color: #7c3aed;
.delta {
font-size: 1.25rem;
}
&.order-release {
--operation-color: #0891b2;
.positive {
color: var(--td-success-color);
}
&.order-out {
--operation-color: #dc2626;
}
&.order-revoke {
--operation-color: #4f46e5;
}
&.return-in {
--operation-color: #15803d;
}
&.stocktake-gain {
--operation-color: #0f766e;
}
&.stocktake-loss {
--operation-color: #a16207;
.negative {
color: var(--td-error-color);
}
}
.product-name {
overflow: hidden;
flex: 0 1 auto;
text-overflow: ellipsis;
}
.record-quantity {
color: var(--td-text-color-secondary);
}
}
.description {
gap: .5rem;
display: flex;
font-size: .75rem;
align-items: center;
justify-content: space-between;
}
.delta {
font-size: 1.25rem;
}
.positive {
color: var(--td-success-color);
}
.negative {
color: var(--td-error-color);
}
}