106 lines
3.3 KiB
Vue
106 lines
3.3 KiB
Vue
<template>
|
|
<bottom-popup
|
|
:model-value="props.modelValue"
|
|
title="履约单详情"
|
|
height="70vh"
|
|
left-button-text="关闭"
|
|
right-button-text=""
|
|
:z-index="props.zIndex"
|
|
:overlay-props="overlayProps"
|
|
@update:model-value="updateVisible"
|
|
@left-button-click="updateVisible(false)"
|
|
>
|
|
<div v-if="props.fulfillment" class="detail-popup">
|
|
<t-cell title="发起时间">
|
|
<template #note>
|
|
<time-label v-if="props.fulfillment.createdAt" :timestamp="props.fulfillment.createdAt" underline />
|
|
<span v-else>未知</span></template>
|
|
</t-cell>
|
|
<t-cell title="提交人" :note="props.fulfillment.operator?.nick || props.fulfillment.operator?.name" />
|
|
<t-cell title="处理人" :note="props.fulfillment.verifier?.nick || props.fulfillment.verifier?.name" />
|
|
<t-cell title="备注" :note="props.fulfillment.remark || '无'" />
|
|
<t-cell class="product" title="产品明细">
|
|
<template #description>
|
|
<div class="description">
|
|
<t-cell-group>
|
|
<t-cell v-for="item in props.fulfillment.itemList || []" :key="item.id" :note="getQuantityText(item)">
|
|
<template #title>
|
|
<div class="title">
|
|
<span v-text="item.productNameSnapshot || '未命名产品'" />
|
|
<product-sku-tags
|
|
:product-name="item.productNameSnapshot"
|
|
:snapshot="item.skuSpecSnapshot"
|
|
:fallback="item.specSummarySnapshot || item.skuNameSnapshot || '默认 SKU'" />
|
|
</div>
|
|
</template>
|
|
</t-cell>
|
|
<t-cell v-if="!props.fulfillment.itemList?.length" title="暂无产品明细" />
|
|
</t-cell-group>
|
|
</div>
|
|
</template>
|
|
</t-cell>
|
|
<div class="photos">
|
|
<attachment-selector :items="photoItems" title="履约照片" readonly />
|
|
</div>
|
|
</div>
|
|
</bottom-popup>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { BottomPopup } from "timi-tdesign-mobile";
|
|
import { TimeLabel } from "timi-web";
|
|
import AttachmentSelector from "@/components/attachmentSelector/AttachmentSelector.vue";
|
|
import ProductSkuTags from "@/components/ProductSkuTags.vue";
|
|
import type { OrderFulfillment, OrderFulfillmentItem } from "@/types/Fulfillment";
|
|
import type { PhotoItem } from "@/types/Photo";
|
|
import { getAttachmentReadURL } from "@/utils/attachment";
|
|
import { getPackageQuantityText } from "@/utils/package";
|
|
|
|
const props = defineProps<{ modelValue: boolean; fulfillment?: OrderFulfillment; zIndex?: number }>();
|
|
const emit = defineEmits<{ "update:modelValue": [visible: boolean] }>();
|
|
const overlayProps = computed(() => undefined === props.zIndex ? undefined : { zIndex: props.zIndex - 1 });
|
|
const photoItems = computed<PhotoItem[]>(() => (props.fulfillment?.attachmentList || [])
|
|
.filter(item => !!item.id)
|
|
.map(item => ({
|
|
attachment: item,
|
|
attachType: item.attachType || "PHOTO",
|
|
url: getAttachmentReadURL(item.id || "")
|
|
})));
|
|
|
|
function updateVisible(visible: boolean): void {
|
|
emit("update:modelValue", visible);
|
|
}
|
|
|
|
function getQuantityText(item: OrderFulfillmentItem): string {
|
|
return `${getPackageQuantityText(item.quantity)} ${item.unitSnapshot || "单位"}`;
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
.detail-popup {
|
|
|
|
.product {
|
|
padding-right: 0;
|
|
|
|
:deep(.t-cell__title) {
|
|
margin-right: 0;
|
|
}
|
|
|
|
.description {
|
|
padding-left: 1rem;
|
|
|
|
.title {
|
|
gap: .5rem;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
align-items: center;
|
|
}
|
|
}
|
|
}
|
|
|
|
.photos {
|
|
padding: 1rem;
|
|
}
|
|
}
|
|
</style>
|