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} 库存流水`" :title="`${selectedDate} 库存流水`"
height="80vh" height="80vh"
left-button-text="关闭" left-button-text="关闭"
right-button-text=""
@left-button-click="visible = false" @left-button-click="visible = false"
> >
<div class="records"> <div v-if="canReadRecords" class="records">
<template v-if="canReadRecords"> <div class="filters glass-header">
<div class="directions"> <div v-if="selection" class="summary">
<t-segmented :value="direction" :options="directionOptions" @change="changeDirection" /> <span v-if="summaryLoading">汇总加载中</span>
<div v-if="selection" class="summary"> <span
<span v-if="summaryLoading">汇总加载中</span> v-else
<span v-else :class="direction === 'IN' ? 'in' : 'out'" :class="direction === 'IN' ? 'in' : 'out'"
v-text="`合计 ${formatQuantity(direction === 'IN' ? summary?.inQuantity : summary?.outQuantity)} ${currentUnit?.name || ''}`" /> 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> <t-button
v-if="1 < units.length"
size="extra-small"
variant="outline"
:content="`单位:${currentUnit?.name}`"
@click="nextUnit"
/>
</div> </div>
<div class="record-list"> <t-segmented :value="direction" :options="directionOptions" @change="changeDirection" />
<t-cell-group v-if="records.length" class="list empty-cell-title-margin" theme="card"> </div>
<t-cell v-for="record in records" :key="record.id" class="item"> <t-cell-group v-if="records.length" class="list empty-cell-title-margin" theme="card">
<template #leftIcon> <t-cell v-for="record in records" :key="record.id" class="item">
<t-image <template #leftIcon>
v-if="getCustomerPhotoURL(record.customer, 64)" <t-image
:src="getCustomerPhotoURL(record.customer, 64)" v-if="getCustomerPhotoURL(record.customer, 64)"
:alt="getCustomerText(record)" :src="getCustomerPhotoURL(record.customer, 64)"
fit="cover" :alt="getCustomerText(record)"
class="avatar" fit="cover"
/> class="avatar"
<div />
v-else-if="record.customer" <div
class="avatar fallback" v-else-if="record.customer"
v-text="getCustomerText(record).slice(0, 1)" class="avatar fallback"
/> v-text="getCustomerText(record).slice(0, 1)"
<t-image />
v-else-if="record.operator" <t-image
:src="getOperatorAvatar(record)" v-else-if="record.operator"
:alt="getOperatorText(record)" :src="getOperatorAvatar(record)"
fit="cover" :alt="getOperatorText(record)"
class="avatar" 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 <span
v-else class="delta"
class="icon" :class="getDeltaClass(record.onHandDelta)"
:class="getDeltaClass(record.onHandDelta)" v-text="getDeltaText(record.onHandDelta)"
> />
<t-icon name="history" size="1.25rem" /> </div>
</span> </div>
</template> </template>
<template #title> </t-cell>
<div class="record-title"> </t-cell-group>
<span v-if="record.customer" class="actor" v-text="getCustomerText(record)" /> <t-empty v-else-if="!recordsLoading" description="当天暂无流水" />
<span v-else-if="record.operator" class="actor" <t-button v-if="!noMore" block variant="text" :loading="recordsLoading" @click="loadRecords">
v-text="getOperatorText(record)" /> 加载更多
<strong class="operation" :class="getOperationClass(record.operationType)" </t-button>
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="暂无库存流水查看权限" />
</div> </div>
<t-empty v-else description="暂无库存流水查看权限" />
</bottom-popup> </bottom-popup>
</template> </template>
@@ -236,160 +255,158 @@ defineExpose({ openDay });
<style scoped lang="less"> <style scoped lang="less">
.records { .records {
height: 60vh; height: 100%;
display: flex; overflow-y: auto;
min-height: 0;
flex-direction: column;
.directions { .filters {
gap: .5rem; gap: .5rem;
top: 0;
display: flex; display: flex;
padding: .75rem; padding: .75rem;
z-index: 1;
position: sticky;
min-width: 0; min-width: 0;
flex-shrink: 0; flex-shrink: 0;
align-items: center; align-items: center;
justify-content: space-between; justify-content: end;
}
.summary { .summary {
gap: .75rem; gap: .75rem;
display: flex; display: flex;
min-width: 0; min-width: 0;
font-size: .875rem; font-size: .875rem;
align-items: center; align-items: center;
white-space: nowrap; white-space: nowrap;
.in { color: var(--td-success-color); } .in {
.out { color: var(--td-error-color); } color: var(--td-success-color);
} }
.record-list { .out {
overflow-x: hidden; color: var(--td-error-color);
overflow-y: auto; }
min-width: 0; }
min-height: 0;
flex: 1;
}
.avatar {
width: 3.5rem;
height: 3.5rem;
} }
.list { .list {
margin: 0; margin: 0;
}
.item { .item {
padding: .625rem; padding: .625rem;
min-width: 0; min-width: 0;
}
.icon { .avatar {
width: 2.25rem; width: 3.5rem;
height: 2.25rem; height: 3.5rem;
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;
} }
&.manual-in { .icon {
--operation-color: #15803d; 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 { .title {
--operation-color: #c2410c; 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 { .description {
--operation-color: #be123c; gap: .5rem;
display: flex;
font-size: .75rem;
align-items: center;
justify-content: space-between;
} }
&.order-reserve { .delta {
--operation-color: #7c3aed; font-size: 1.25rem;
} }
&.order-release { .positive {
--operation-color: #0891b2; color: var(--td-success-color);
} }
&.order-out { .negative {
--operation-color: #dc2626; color: var(--td-error-color);
}
&.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);
}
}
.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);
} }
} }