fix layout
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<navbar-actions :actions="actionList" :visible="canShowActionMenu" />
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main v-can="permissionCodes.productCategory.read" class="page-content scroll list">
|
||||
<main v-can="permissionCodes.productCategory.read" class="page-content scroll column list">
|
||||
<t-pull-down-refresh
|
||||
class="pull-refresh"
|
||||
v-model="isRefreshing"
|
||||
|
||||
+124
-120
@@ -1,127 +1,131 @@
|
||||
<template>
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="产品详情"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<template #right>
|
||||
<navbar-actions :actions="actionList" />
|
||||
</template>
|
||||
</t-navbar>
|
||||
<div v-can="permissionCodes.product.read" class="product-detail">
|
||||
<t-loading v-if="isLoading" class="loading" size="32px" />
|
||||
<template v-if="product">
|
||||
<product-profile :product="product" v-entrance-transition />
|
||||
<t-cell-group title="基本信息" theme="card" v-entrance-transition>
|
||||
<t-cell title="产品分类" :note="product.category?.name || '未分类'" />
|
||||
<t-cell title="库存管理" :note="product.stockEnabled ? '启用' : '关闭'" />
|
||||
<t-cell title="状态" :note="getProductStatusText(product.status)" />
|
||||
<t-cell title="备注" :note="Text.display(product.remark)"></t-cell>
|
||||
<t-cell>
|
||||
<attachment-selector :items="attachmentItemList" readonly />
|
||||
</t-cell>
|
||||
</t-cell-group>
|
||||
<t-cell-group theme="card" v-entrance-transition>
|
||||
<t-cell
|
||||
v-if="product.stockEnabled && userStore.hasPermissions(permissionCodes.productStock.read)"
|
||||
title="库存"
|
||||
:note="product.skuList?.length === 1 ? '查看 SKU 库存详情' : '查看全部 SKU 库存'"
|
||||
arrow
|
||||
@click="viewStock"
|
||||
/>
|
||||
</t-cell-group>
|
||||
<t-cell-group title="SKU 列表" theme="card" class="skus" v-entrance-transition>
|
||||
<t-cell
|
||||
class="sku"
|
||||
v-for="sku in product.skuList || []"
|
||||
:key="sku.id || sku.code"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
arrow
|
||||
hover
|
||||
@click="openSkuDetail(sku)"
|
||||
>
|
||||
<template #leftIcon>
|
||||
<t-image
|
||||
v-if="getProductPhotoURL(sku)"
|
||||
:src="getProductPhotoURL(sku)"
|
||||
:alt="getSkuTitle(sku)"
|
||||
fit="cover"
|
||||
class="avatar"
|
||||
<div class="page-layout navbar">
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="产品详情"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<template #right>
|
||||
<navbar-actions :actions="actionList" />
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main class="page-content scroll column">
|
||||
<div v-can="permissionCodes.product.read" class="product-detail">
|
||||
<t-loading v-if="isLoading" class="loading" size="32px" />
|
||||
<template v-if="product">
|
||||
<product-profile :product="product" v-entrance-transition />
|
||||
<t-cell-group title="基本信息" theme="card" v-entrance-transition>
|
||||
<t-cell title="产品分类" :note="product.category?.name || '未分类'" />
|
||||
<t-cell title="库存管理" :note="product.stockEnabled ? '启用' : '关闭'" />
|
||||
<t-cell title="状态" :note="getProductStatusText(product.status)" />
|
||||
<t-cell title="备注" :note="Text.display(product.remark)"></t-cell>
|
||||
<t-cell>
|
||||
<attachment-selector :items="attachmentItemList" readonly />
|
||||
</t-cell>
|
||||
</t-cell-group>
|
||||
<t-cell-group theme="card" v-entrance-transition>
|
||||
<t-cell
|
||||
v-if="product.stockEnabled && userStore.hasPermissions(permissionCodes.productStock.read)"
|
||||
title="库存"
|
||||
:note="product.skuList?.length === 1 ? '查看 SKU 库存详情' : '查看全部 SKU 库存'"
|
||||
arrow
|
||||
@click="viewStock"
|
||||
/>
|
||||
<div v-else class="avatar fallback" v-text="getSkuTitle(sku).slice(0, 1)" />
|
||||
</template>
|
||||
<template #title>
|
||||
<div class="title">
|
||||
<h5 class="name" v-text="getSkuTitle(sku)" />
|
||||
</div>
|
||||
</template>
|
||||
<template #note>
|
||||
<t-tag
|
||||
size="small"
|
||||
variant="light-outline"
|
||||
:theme="sku.status === 'ACTIVE' ? 'success' : 'warning'"
|
||||
:content="sku.status === 'ACTIVE' ? '启用' : '停用'"
|
||||
/>
|
||||
</template>
|
||||
<template #description>
|
||||
<div class="tags">
|
||||
<t-tag
|
||||
v-for="unit in sku.unitList || []"
|
||||
:key="unit.id || unit.name"
|
||||
size="small"
|
||||
theme="primary"
|
||||
variant="light-outline"
|
||||
:content="`${unit.name}${unit.isBase ? '(基础)' : ''}`"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</t-cell>
|
||||
<center-tips v-if="!product.skuList?.length" :content="'暂无 SKU'" />
|
||||
</t-cell-group>
|
||||
</template>
|
||||
</div>
|
||||
</t-cell-group>
|
||||
<t-cell-group title="SKU 列表" theme="card" class="skus" v-entrance-transition>
|
||||
<t-cell
|
||||
class="sku"
|
||||
v-for="sku in product.skuList || []"
|
||||
:key="sku.id || sku.code"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
arrow
|
||||
hover
|
||||
@click="openSkuDetail(sku)"
|
||||
>
|
||||
<template #leftIcon>
|
||||
<t-image
|
||||
v-if="getProductPhotoURL(sku)"
|
||||
:src="getProductPhotoURL(sku)"
|
||||
:alt="getSkuTitle(sku)"
|
||||
fit="cover"
|
||||
class="avatar"
|
||||
/>
|
||||
<div v-else class="avatar fallback" v-text="getSkuTitle(sku).slice(0, 1)" />
|
||||
</template>
|
||||
<template #title>
|
||||
<div class="title">
|
||||
<h5 class="name" v-text="getSkuTitle(sku)" />
|
||||
</div>
|
||||
</template>
|
||||
<template #note>
|
||||
<t-tag
|
||||
size="small"
|
||||
variant="light-outline"
|
||||
:theme="sku.status === 'ACTIVE' ? 'success' : 'warning'"
|
||||
:content="sku.status === 'ACTIVE' ? '启用' : '停用'"
|
||||
/>
|
||||
</template>
|
||||
<template #description>
|
||||
<div class="tags">
|
||||
<t-tag
|
||||
v-for="unit in sku.unitList || []"
|
||||
:key="unit.id || unit.name"
|
||||
size="small"
|
||||
theme="primary"
|
||||
variant="light-outline"
|
||||
:content="`${unit.name}${unit.isBase ? '(基础)' : ''}`"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</t-cell>
|
||||
<center-tips v-if="!product.skuList?.length" :content="'暂无 SKU'" />
|
||||
</t-cell-group>
|
||||
</template>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<bottom-popup
|
||||
v-model="skuDetailVisible"
|
||||
title="SKU 详情"
|
||||
height="min(80vh, 48rem)"
|
||||
left-button-text="关闭"
|
||||
right-button-text=""
|
||||
:z-index="skuDetailPopupZIndex"
|
||||
:overlay-props="{ zIndex: skuDetailPopupZIndex - 1 }"
|
||||
@left-button-click="closeSkuDetail"
|
||||
>
|
||||
<div v-if="selectedSku" class="sku-popup">
|
||||
<t-cell-group>
|
||||
<t-cell title="明细名称" :note="selectedSku.name || '未命名 SKU'" />
|
||||
<t-cell title="SKU 编码" :note="selectedSku.code || '无编码'" />
|
||||
<t-cell v-if="selectedSku.barcode" title="SKU 条码" :note="selectedSku.barcode" />
|
||||
<t-cell title="库存管理" :note="selectedSku.stockEnabled ? '启用' : '关闭'" />
|
||||
<t-cell title="允许小数数量" :note="selectedSku.allowDecimalQuantity ? '允许' : '不允许'" />
|
||||
<t-cell v-if="selectedSku.stockEnabled" title="最低库存" :note="`${getProductQuantityText(selectedSku.minStockQuantity)} 基础单位`" />
|
||||
<t-cell v-if="selectedSku.remark" title="备注" :note="Text.display(selectedSku.remark)" />
|
||||
</t-cell-group>
|
||||
<div class="media-wrap">
|
||||
<attachment-selector
|
||||
v-if="skuPhotoItemList.length"
|
||||
:items="skuPhotoItemList"
|
||||
title="SKU 图片"
|
||||
readonly
|
||||
/>
|
||||
</div>
|
||||
<div class="unit">
|
||||
<div class="header">
|
||||
<strong>销售单位</strong>
|
||||
<span>采购、销售和库存操作共用</span>
|
||||
<bottom-popup
|
||||
v-model="skuDetailVisible"
|
||||
title="SKU 详情"
|
||||
height="min(80vh, 48rem)"
|
||||
left-button-text="关闭"
|
||||
right-button-text=""
|
||||
:z-index="skuDetailPopupZIndex"
|
||||
:overlay-props="{ zIndex: skuDetailPopupZIndex - 1 }"
|
||||
@left-button-click="closeSkuDetail"
|
||||
>
|
||||
<div v-if="selectedSku" class="sku-popup">
|
||||
<t-cell-group>
|
||||
<t-cell title="明细名称" :note="selectedSku.name || '未命名 SKU'" />
|
||||
<t-cell title="SKU 编码" :note="selectedSku.code || '无编码'" />
|
||||
<t-cell v-if="selectedSku.barcode" title="SKU 条码" :note="selectedSku.barcode" />
|
||||
<t-cell title="库存管理" :note="selectedSku.stockEnabled ? '启用' : '关闭'" />
|
||||
<t-cell title="允许小数数量" :note="selectedSku.allowDecimalQuantity ? '允许' : '不允许'" />
|
||||
<t-cell v-if="selectedSku.stockEnabled" title="最低库存" :note="`${getProductQuantityText(selectedSku.minStockQuantity)} 基础单位`" />
|
||||
<t-cell v-if="selectedSku.remark" title="备注" :note="Text.display(selectedSku.remark)" />
|
||||
</t-cell-group>
|
||||
<div class="media-wrap">
|
||||
<attachment-selector
|
||||
v-if="skuPhotoItemList.length"
|
||||
:items="skuPhotoItemList"
|
||||
title="SKU 图片"
|
||||
readonly
|
||||
/>
|
||||
</div>
|
||||
<div class="unit">
|
||||
<div class="header">
|
||||
<strong>销售单位</strong>
|
||||
<span>采购、销售和库存操作共用</span>
|
||||
</div>
|
||||
<product-sku-unit-list v-if="selectedSku.unitList?.length" :unit-list="selectedSku.unitList" />
|
||||
<center-tips v-else :content="'暂无销售单位'" />
|
||||
</div>
|
||||
<product-sku-unit-list v-if="selectedSku.unitList?.length" :unit-list="selectedSku.unitList" />
|
||||
<center-tips v-else :content="'暂无销售单位'" />
|
||||
</div>
|
||||
</div>
|
||||
</bottom-popup>
|
||||
</bottom-popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -311,7 +315,7 @@ onMounted(async () => {
|
||||
.product-detail {
|
||||
gap: 1rem;
|
||||
display: flex;
|
||||
padding: calc(var(--app-nav-height) + 1rem) 0 1rem 0;
|
||||
padding: 0 0 1rem 0;
|
||||
flex-direction: column;
|
||||
|
||||
.skus {
|
||||
|
||||
+207
-203
@@ -1,216 +1,220 @@
|
||||
<template>
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
:title="routeNavBarTitle"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<template #right>
|
||||
<t-button
|
||||
v-if="userStore.hasPermissions(savePermissionCode)"
|
||||
@click="save"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="small"
|
||||
content="保存"
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<div v-can="savePermissionCode" class="product-edit">
|
||||
<t-form class="form card" label-width="6rem" v-entrance-transition>
|
||||
<t-form-item label="产品编码" required-mark help="使用英语、拼音或唯一数字">
|
||||
<t-input v-model="form.code" borderless maxlength="64" placeholder="门店内唯一编码" />
|
||||
</t-form-item>
|
||||
<t-form-item label="产品名称" required-mark>
|
||||
<t-input v-model="form.name" borderless maxlength="128" placeholder="请输入产品名称" />
|
||||
</t-form-item>
|
||||
<t-form-item label="产品类型" arrow content-align="right" @click="openTypePicker">
|
||||
<span class="picker-text" v-text="getProductTypeText(form.productType)" />
|
||||
</t-form-item>
|
||||
<t-form-item label="产品分类" arrow content-align="right" @click="openCategoryPicker">
|
||||
<span class="picker-text" v-text="selectedCategoryName" />
|
||||
</t-form-item>
|
||||
<t-form-item label="库存管理" content-align="right">
|
||||
<t-switch v-model="form.stockEnabled" size="small" :disabled="form.productType === 'SERVICE'" />
|
||||
</t-form-item>
|
||||
<t-form-item label="状态" arrow content-align="right" @click="openStatusPicker">
|
||||
<span class="picker-text" v-text="getProductStatusText(form.status)" />
|
||||
</t-form-item>
|
||||
<t-form-item label="备注">
|
||||
<t-textarea v-model="form.remark" borderless maxlength="255" autosize placeholder="可填写产品说明" />
|
||||
</t-form-item>
|
||||
<t-form-item label-width="0">
|
||||
<attachment-selector
|
||||
v-model:items="attachmentItemList"
|
||||
title="产品公共图片及附件"
|
||||
:busy="isAttachmentUploading"
|
||||
@select="handleAttachmentSelected($event.files, $event.source)"
|
||||
/>
|
||||
</t-form-item>
|
||||
<t-form-item label="纯色封面" label-width="8rem" content-align="right">
|
||||
<div class="page-layout navbar">
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
:title="routeNavBarTitle"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<template #right>
|
||||
<t-button
|
||||
size="extra-small"
|
||||
variant="outline"
|
||||
class="color-trigger"
|
||||
:disabled="isAttachmentUploading"
|
||||
@click="openCoverColorPicker"
|
||||
>
|
||||
<div class="content">
|
||||
<span
|
||||
class="swatch"
|
||||
:class="{ 'no-color': !solidColorCoverColor }"
|
||||
:style="{ background: solidColorCoverColor || undefined }"
|
||||
/>
|
||||
<span v-text="solidColorCoverColor || '选择颜色'" />
|
||||
</div>
|
||||
</t-button>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
|
||||
<card-container title="产品规格" description="无多规格产品无需配置规格;有规格时每条 SKU 明细必须覆盖全部规格项" v-entrance-transition>
|
||||
<div class="spec-list">
|
||||
<t-form v-for="(spec, specIndex) in form.specList" :key="spec.clientKey" class="form spec">
|
||||
<t-form-item label="名称" label-width="2.5rem">
|
||||
<t-input
|
||||
class="name"
|
||||
v-model="spec.name"
|
||||
borderless
|
||||
maxlength="32"
|
||||
placeholder="如 颜色、尺寸"
|
||||
v-if="userStore.hasPermissions(savePermissionCode)"
|
||||
@click="save"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="small"
|
||||
content="保存"
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main class="page-content scroll column">
|
||||
<div v-can="savePermissionCode" class="product-edit">
|
||||
<t-form class="form card" label-width="6rem" v-entrance-transition>
|
||||
<t-form-item label="产品编码" required-mark help="使用英语、拼音或唯一数字">
|
||||
<t-input v-model="form.code" borderless maxlength="64" placeholder="门店内唯一编码" />
|
||||
</t-form-item>
|
||||
<t-form-item label="产品名称" required-mark>
|
||||
<t-input v-model="form.name" borderless maxlength="128" placeholder="请输入产品名称" />
|
||||
</t-form-item>
|
||||
<t-form-item label="产品类型" arrow content-align="right" @click="openTypePicker">
|
||||
<span class="picker-text" v-text="getProductTypeText(form.productType)" />
|
||||
</t-form-item>
|
||||
<t-form-item label="产品分类" arrow content-align="right" @click="openCategoryPicker">
|
||||
<span class="picker-text" v-text="selectedCategoryName" />
|
||||
</t-form-item>
|
||||
<t-form-item label="库存管理" content-align="right">
|
||||
<t-switch v-model="form.stockEnabled" size="small" :disabled="form.productType === 'SERVICE'" />
|
||||
</t-form-item>
|
||||
<t-form-item label="状态" arrow content-align="right" @click="openStatusPicker">
|
||||
<span class="picker-text" v-text="getProductStatusText(form.status)" />
|
||||
</t-form-item>
|
||||
<t-form-item label="备注">
|
||||
<t-textarea v-model="form.remark" borderless maxlength="255" autosize placeholder="可填写产品说明" />
|
||||
</t-form-item>
|
||||
<t-form-item label-width="0">
|
||||
<attachment-selector
|
||||
v-model:items="attachmentItemList"
|
||||
title="产品公共图片及附件"
|
||||
:busy="isAttachmentUploading"
|
||||
@select="handleAttachmentSelected($event.files, $event.source)"
|
||||
/>
|
||||
</t-form-item>
|
||||
<t-form-item label="纯色封面" label-width="8rem" content-align="right">
|
||||
<t-button
|
||||
v-if="!spec.id"
|
||||
theme="danger"
|
||||
variant="text"
|
||||
size="extra-small"
|
||||
content="删除"
|
||||
@click="removeSpec(specIndex)"
|
||||
/>
|
||||
</t-form-item>
|
||||
<t-form-item v-if="getNamedSpecValues(spec).length" label-width="0">
|
||||
<div class="tags">
|
||||
<t-tag
|
||||
v-for="value in getNamedSpecValues(spec)"
|
||||
:key="value.clientKey"
|
||||
class="tag"
|
||||
variant="light-outline"
|
||||
closable
|
||||
@close="removeSpecValue(spec, spec.valueList.indexOf(value))"
|
||||
>
|
||||
<t-input v-model.trim="value.name" class="value-name" borderless maxlength="32" />
|
||||
</t-tag>
|
||||
</div>
|
||||
</t-form-item>
|
||||
<t-form-item label="规格值" label-width="3.5rem">
|
||||
<t-input
|
||||
v-model.trim="specValueDraftMap[spec.clientKey]"
|
||||
borderless
|
||||
maxlength="32"
|
||||
placeholder="输入规格值"
|
||||
variant="outline"
|
||||
class="color-trigger"
|
||||
:disabled="isAttachmentUploading"
|
||||
@click="openCoverColorPicker"
|
||||
>
|
||||
<template #suffix-icon>
|
||||
<t-button
|
||||
size="extra-small"
|
||||
theme="light"
|
||||
content="添加"
|
||||
@click="addSpecValue(spec)"
|
||||
<div class="content">
|
||||
<span
|
||||
class="swatch"
|
||||
:class="{ 'no-color': !solidColorCoverColor }"
|
||||
:style="{ background: solidColorCoverColor || undefined }"
|
||||
/>
|
||||
</template>
|
||||
</t-input>
|
||||
<span v-text="solidColorCoverColor || '选择颜色'" />
|
||||
</div>
|
||||
</t-button>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
<t-button
|
||||
class="add"
|
||||
size="small"
|
||||
theme="primary"
|
||||
variant="dashed"
|
||||
content="添加规格项"
|
||||
@click="addSpec"
|
||||
|
||||
<card-container title="产品规格" description="无多规格产品无需配置规格;有规格时每条 SKU 明细必须覆盖全部规格项" v-entrance-transition>
|
||||
<div class="spec-list">
|
||||
<t-form v-for="(spec, specIndex) in form.specList" :key="spec.clientKey" class="form spec">
|
||||
<t-form-item label="名称" label-width="2.5rem">
|
||||
<t-input
|
||||
class="name"
|
||||
v-model="spec.name"
|
||||
borderless
|
||||
maxlength="32"
|
||||
placeholder="如 颜色、尺寸"
|
||||
/>
|
||||
<t-button
|
||||
v-if="!spec.id"
|
||||
theme="danger"
|
||||
variant="text"
|
||||
size="extra-small"
|
||||
content="删除"
|
||||
@click="removeSpec(specIndex)"
|
||||
/>
|
||||
</t-form-item>
|
||||
<t-form-item v-if="getNamedSpecValues(spec).length" label-width="0">
|
||||
<div class="tags">
|
||||
<t-tag
|
||||
v-for="value in getNamedSpecValues(spec)"
|
||||
:key="value.clientKey"
|
||||
class="tag"
|
||||
variant="light-outline"
|
||||
closable
|
||||
@close="removeSpecValue(spec, spec.valueList.indexOf(value))"
|
||||
>
|
||||
<t-input v-model.trim="value.name" class="value-name" borderless maxlength="32" />
|
||||
</t-tag>
|
||||
</div>
|
||||
</t-form-item>
|
||||
<t-form-item label="规格值" label-width="3.5rem">
|
||||
<t-input
|
||||
v-model.trim="specValueDraftMap[spec.clientKey]"
|
||||
borderless
|
||||
maxlength="32"
|
||||
placeholder="输入规格值"
|
||||
>
|
||||
<template #suffix-icon>
|
||||
<t-button
|
||||
size="extra-small"
|
||||
theme="light"
|
||||
content="添加"
|
||||
@click="addSpecValue(spec)"
|
||||
/>
|
||||
</template>
|
||||
</t-input>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
<t-button
|
||||
class="add"
|
||||
size="small"
|
||||
theme="primary"
|
||||
variant="dashed"
|
||||
content="添加规格项"
|
||||
@click="addSpec"
|
||||
/>
|
||||
</div>
|
||||
</card-container>
|
||||
<card-container
|
||||
class="sku-wrap"
|
||||
title="SKU 明细"
|
||||
description="每条 SKU 明细都是独立的销售、库存和履约单元;生成后可移除不需要的组合,点列表项配置具体内容"
|
||||
v-entrance-transition
|
||||
>
|
||||
<div class="content-wrap">
|
||||
<t-cell-group theme="card">
|
||||
<t-cell title="销售单位">
|
||||
<template #note>
|
||||
<t-button
|
||||
variant="outline"
|
||||
size="extra-small"
|
||||
content="统一配置销售单位"
|
||||
:disabled="!form.skuList.length"
|
||||
@click="openBatchUnitEditor"
|
||||
/>
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell title="生成 SKU">
|
||||
<template #note>
|
||||
<t-button
|
||||
theme="primary"
|
||||
size="extra-small"
|
||||
:content="generateSkuButtonText"
|
||||
:disabled="!canGenerateSku"
|
||||
@click="regenerateSkuList"
|
||||
/>
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell title="当前 SKU" :note="`${form.skuList.length} 个`" />
|
||||
</t-cell-group>
|
||||
<t-cell-group v-if="form.skuList.length" theme="card" class="sku-list fix-last-cell-line">
|
||||
<product-sku-editor
|
||||
v-for="(sku, skuIndex) in form.skuList"
|
||||
:key="sku.clientKey"
|
||||
:product-type="form.productType"
|
||||
v-model:sku="form.skuList[skuIndex]"
|
||||
:sku-index="skuIndex"
|
||||
:spec-list="form.specList"
|
||||
@configure-units="openUnitEditor(sku)"
|
||||
@remove="removeSku(skuIndex)"
|
||||
/>
|
||||
</t-cell-group>
|
||||
<div v-else class="load-state" v-text="form.specList.length ? '请先添加规格值,再生成 SKU 组合' : '正在准备默认 SKU'" />
|
||||
</div>
|
||||
</card-container>
|
||||
<t-popup v-model="typePickerVisible" placement="bottom">
|
||||
<t-picker v-model="typeDraft" :columns="productTypeOptions" title="产品类型" @cancel="typePickerVisible = false" @confirm="confirmType" />
|
||||
</t-popup>
|
||||
<t-popup v-model="categoryPickerVisible" placement="bottom">
|
||||
<t-picker v-model="categoryDraft" :columns="categoryOptions" title="产品分类" @cancel="categoryPickerVisible = false" @confirm="confirmCategory" />
|
||||
</t-popup>
|
||||
<t-popup v-model="statusPickerVisible" placement="bottom">
|
||||
<t-picker v-model="statusDraft" :columns="statusOptions" title="产品状态" @cancel="statusPickerVisible = false" @confirm="confirmStatus" />
|
||||
</t-popup>
|
||||
<product-sku-unit-editor
|
||||
v-model="unitEditorVisible"
|
||||
:product-type="form.productType"
|
||||
v-model:sku="editingSku"
|
||||
:spec-list="form.specList"
|
||||
@close="closeUnitEditor"
|
||||
/>
|
||||
<product-sku-unit-batch-editor
|
||||
v-model="batchUnitEditorVisible"
|
||||
v-model:unit-list="batchUnitList"
|
||||
v-model:base-unit-migration-ratio-text="batchBaseUnitMigrationRatioText"
|
||||
:product-type="form.productType"
|
||||
:sku-count="form.skuList.length"
|
||||
@apply="applyBatchUnitTemplate"
|
||||
@close="closeBatchUnitEditor"
|
||||
/>
|
||||
<bottom-popup
|
||||
v-model="coverColorPickerVisible"
|
||||
title="颜色选择"
|
||||
:right-button-text="isAttachmentUploading ? '上传中' : '确定'"
|
||||
@left-button-click="cancelCoverColorPicker"
|
||||
@right-button-click="confirmCoverColorPicker"
|
||||
>
|
||||
<t-color-picker v-if="coverColorPickerVisible" v-model="coverColorDraft" format="HEX" type="multiple" :swatch-colors="colorSwatchList" @palette-bar-change="updateCoverColorDraftFromPalette" />
|
||||
</bottom-popup>
|
||||
</div>
|
||||
</card-container>
|
||||
<card-container
|
||||
class="sku-wrap"
|
||||
title="SKU 明细"
|
||||
description="每条 SKU 明细都是独立的销售、库存和履约单元;生成后可移除不需要的组合,点列表项配置具体内容"
|
||||
v-entrance-transition
|
||||
>
|
||||
<div class="content-wrap">
|
||||
<t-cell-group theme="card">
|
||||
<t-cell title="销售单位">
|
||||
<template #note>
|
||||
<t-button
|
||||
variant="outline"
|
||||
size="extra-small"
|
||||
content="统一配置销售单位"
|
||||
:disabled="!form.skuList.length"
|
||||
@click="openBatchUnitEditor"
|
||||
/>
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell title="生成 SKU">
|
||||
<template #note>
|
||||
<t-button
|
||||
theme="primary"
|
||||
size="extra-small"
|
||||
:content="generateSkuButtonText"
|
||||
:disabled="!canGenerateSku"
|
||||
@click="regenerateSkuList"
|
||||
/>
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell title="当前 SKU" :note="`${form.skuList.length} 个`" />
|
||||
</t-cell-group>
|
||||
<t-cell-group v-if="form.skuList.length" theme="card" class="sku-list fix-last-cell-line">
|
||||
<product-sku-editor
|
||||
v-for="(sku, skuIndex) in form.skuList"
|
||||
:key="sku.clientKey"
|
||||
:product-type="form.productType"
|
||||
v-model:sku="form.skuList[skuIndex]"
|
||||
:sku-index="skuIndex"
|
||||
:spec-list="form.specList"
|
||||
@configure-units="openUnitEditor(sku)"
|
||||
@remove="removeSku(skuIndex)"
|
||||
/>
|
||||
</t-cell-group>
|
||||
<div v-else class="load-state" v-text="form.specList.length ? '请先添加规格值,再生成 SKU 组合' : '正在准备默认 SKU'" />
|
||||
</div>
|
||||
</card-container>
|
||||
<t-popup v-model="typePickerVisible" placement="bottom">
|
||||
<t-picker v-model="typeDraft" :columns="productTypeOptions" title="产品类型" @cancel="typePickerVisible = false" @confirm="confirmType" />
|
||||
</t-popup>
|
||||
<t-popup v-model="categoryPickerVisible" placement="bottom">
|
||||
<t-picker v-model="categoryDraft" :columns="categoryOptions" title="产品分类" @cancel="categoryPickerVisible = false" @confirm="confirmCategory" />
|
||||
</t-popup>
|
||||
<t-popup v-model="statusPickerVisible" placement="bottom">
|
||||
<t-picker v-model="statusDraft" :columns="statusOptions" title="产品状态" @cancel="statusPickerVisible = false" @confirm="confirmStatus" />
|
||||
</t-popup>
|
||||
<product-sku-unit-editor
|
||||
v-model="unitEditorVisible"
|
||||
:product-type="form.productType"
|
||||
v-model:sku="editingSku"
|
||||
:spec-list="form.specList"
|
||||
@close="closeUnitEditor"
|
||||
/>
|
||||
<product-sku-unit-batch-editor
|
||||
v-model="batchUnitEditorVisible"
|
||||
v-model:unit-list="batchUnitList"
|
||||
v-model:base-unit-migration-ratio-text="batchBaseUnitMigrationRatioText"
|
||||
:product-type="form.productType"
|
||||
:sku-count="form.skuList.length"
|
||||
@apply="applyBatchUnitTemplate"
|
||||
@close="closeBatchUnitEditor"
|
||||
/>
|
||||
<bottom-popup
|
||||
v-model="coverColorPickerVisible"
|
||||
title="颜色选择"
|
||||
:right-button-text="isAttachmentUploading ? '上传中' : '确定'"
|
||||
@left-button-click="cancelCoverColorPicker"
|
||||
@right-button-click="confirmCoverColorPicker"
|
||||
>
|
||||
<t-color-picker v-if="coverColorPickerVisible" v-model="coverColorDraft" format="HEX" type="multiple" :swatch-colors="colorSwatchList" @palette-bar-change="updateCoverColorDraftFromPalette" />
|
||||
</bottom-popup>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1131,7 +1135,7 @@ onMounted(async () => {
|
||||
.product-edit {
|
||||
gap: 1rem;
|
||||
display: flex;
|
||||
padding: calc(var(--app-nav-height) + 1rem) 0 1rem;
|
||||
padding: 0 0 1rem;
|
||||
flex-direction: column;
|
||||
|
||||
.form {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main ref="productListRef" v-can="permissionCodes.product.read" class="page-content scroll list">
|
||||
<main ref="productListRef" v-can="permissionCodes.product.read" class="page-content scroll column list">
|
||||
<t-pull-down-refresh
|
||||
class="pull-refresh"
|
||||
v-model="isRefreshing"
|
||||
|
||||
@@ -1,151 +1,155 @@
|
||||
<template>
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="批量入库"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<template #right>
|
||||
<t-button
|
||||
v-if="userStore.hasPermissions(permissionCodes.productStock.create)"
|
||||
:disabled="!canSubmit"
|
||||
@click="submit"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="small"
|
||||
:content="isSaving ? '提交中' : '提交'"
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<div v-can="permissionCodes.productStock.create" class="product-stock-batch-configure">
|
||||
<t-form class="form card" label-width="5rem" v-entrance-transition>
|
||||
<t-form-item label="入库备注" required-mark>
|
||||
<div class="remark-wrap">
|
||||
<t-input
|
||||
v-model="productStockBatchStore.remark"
|
||||
:disabled="isSaving"
|
||||
borderless
|
||||
maxlength="500"
|
||||
autosize
|
||||
placeholder="本批次入库备注"
|
||||
@update:model-value="invalidateRequestNo"
|
||||
/>
|
||||
<t-button
|
||||
type="button"
|
||||
size="extra-small"
|
||||
variant="outline"
|
||||
:content="quickRemarkText"
|
||||
:disabled="isSaving"
|
||||
@click="applyQuickRemark"
|
||||
/>
|
||||
</div>
|
||||
</t-form-item>
|
||||
<t-form-item label-width="0">
|
||||
<attachment-selector
|
||||
v-model:items="productStockBatchStore.attachmentItems"
|
||||
:upload="uploadPhotos"
|
||||
:busy="isSaving"
|
||||
title="共有入库记录(无专有记录时使用)"
|
||||
@update:items="invalidateRequestNo"
|
||||
/>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
<t-form
|
||||
v-if="productStockBatchStore.selectedItemList.length"
|
||||
class="items form"
|
||||
label-width="0"
|
||||
v-entrance-transition
|
||||
<div class="page-layout navbar">
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="批量入库"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<t-form-item
|
||||
v-for="item in productStockBatchStore.selectedItemList"
|
||||
:key="item.sku.id"
|
||||
class="item"
|
||||
label-width="0"
|
||||
>
|
||||
<div class="content">
|
||||
<div class="main">
|
||||
<div class="left">
|
||||
<t-image
|
||||
v-if="getProductPhotoURL(item.sku)"
|
||||
:src="getProductPhotoURL(item.sku)"
|
||||
:alt="item.productName || '产品图片'"
|
||||
fit="cover"
|
||||
class="avatar"
|
||||
<template #right>
|
||||
<t-button
|
||||
v-if="userStore.hasPermissions(permissionCodes.productStock.create)"
|
||||
:disabled="!canSubmit"
|
||||
@click="submit"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="small"
|
||||
:content="isSaving ? '提交中' : '提交'"
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main class="page-content scroll column">
|
||||
<div v-can="permissionCodes.productStock.create" class="product-stock-batch-configure">
|
||||
<t-form class="form card" label-width="5rem" v-entrance-transition>
|
||||
<t-form-item label="入库备注" required-mark>
|
||||
<div class="remark-wrap">
|
||||
<t-input
|
||||
v-model="productStockBatchStore.remark"
|
||||
:disabled="isSaving"
|
||||
borderless
|
||||
maxlength="500"
|
||||
autosize
|
||||
placeholder="本批次入库备注"
|
||||
@update:model-value="invalidateRequestNo"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
class="avatar fallback"
|
||||
v-text="(item.productName || item.sku.name || '产').slice(0, 1)"
|
||||
<t-button
|
||||
type="button"
|
||||
size="extra-small"
|
||||
variant="outline"
|
||||
:content="quickRemarkText"
|
||||
:disabled="isSaving"
|
||||
@click="applyQuickRemark"
|
||||
/>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<div class="name clip-text" v-text="item.productName || '未命名产品'" />
|
||||
<t-tag
|
||||
v-if="!isDefaultSku(item) && item.sku.name"
|
||||
size="small"
|
||||
theme="primary"
|
||||
variant="light-outline"
|
||||
:content="item.sku.name"
|
||||
</t-form-item>
|
||||
<t-form-item label-width="0">
|
||||
<attachment-selector
|
||||
v-model:items="productStockBatchStore.attachmentItems"
|
||||
:upload="uploadPhotos"
|
||||
:busy="isSaving"
|
||||
title="共有入库记录(无专有记录时使用)"
|
||||
@update:items="invalidateRequestNo"
|
||||
/>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
<t-form
|
||||
v-if="productStockBatchStore.selectedItemList.length"
|
||||
class="items form"
|
||||
label-width="0"
|
||||
v-entrance-transition
|
||||
>
|
||||
<t-form-item
|
||||
v-for="item in productStockBatchStore.selectedItemList"
|
||||
:key="item.sku.id"
|
||||
class="item"
|
||||
label-width="0"
|
||||
>
|
||||
<div class="content">
|
||||
<div class="main">
|
||||
<div class="left">
|
||||
<t-image
|
||||
v-if="getProductPhotoURL(item.sku)"
|
||||
:src="getProductPhotoURL(item.sku)"
|
||||
:alt="item.productName || '产品图片'"
|
||||
fit="cover"
|
||||
class="avatar"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
class="avatar fallback"
|
||||
v-text="(item.productName || item.sku.name || '产').slice(0, 1)"
|
||||
/>
|
||||
</div>
|
||||
<t-button
|
||||
theme="danger"
|
||||
variant="text"
|
||||
size="extra-small"
|
||||
content="移除"
|
||||
:disabled="isSaving"
|
||||
@click.stop="removeItem(item.sku.id || '')"
|
||||
/>
|
||||
</div>
|
||||
<div class="input">
|
||||
<t-stepper
|
||||
v-model="item.quantity"
|
||||
class="quantity"
|
||||
:max="Number.MAX_SAFE_INTEGER"
|
||||
:min="0"
|
||||
size="large"
|
||||
:step="getProductQuantityStep(item.sku)"
|
||||
:integer="!item.sku.allowDecimalQuantity"
|
||||
:disabled="isSaving"
|
||||
theme="outline"
|
||||
@change="invalidateRequestNo"
|
||||
/>
|
||||
<t-button
|
||||
size="extra-small"
|
||||
variant="outline"
|
||||
:content="getSelectedUnitName(item)"
|
||||
:disabled="isSaving"
|
||||
@click.stop="openUnitPicker(item)"
|
||||
/>
|
||||
<t-button
|
||||
size="extra-small"
|
||||
variant="outline"
|
||||
content="专有入库记录"
|
||||
:disabled="isSaving"
|
||||
:aria-expanded="isAttachmentVisible(item.sku.id || '')"
|
||||
@click.stop="toggleAttachmentVisibility(item.sku.id || '')"
|
||||
/>
|
||||
<div class="right">
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<div class="name clip-text" v-text="item.productName || '未命名产品'" />
|
||||
<t-tag
|
||||
v-if="!isDefaultSku(item) && item.sku.name"
|
||||
size="small"
|
||||
theme="primary"
|
||||
variant="light-outline"
|
||||
:content="item.sku.name"
|
||||
/>
|
||||
</div>
|
||||
<t-button
|
||||
theme="danger"
|
||||
variant="text"
|
||||
size="extra-small"
|
||||
content="移除"
|
||||
:disabled="isSaving"
|
||||
@click.stop="removeItem(item.sku.id || '')"
|
||||
/>
|
||||
</div>
|
||||
<div class="input">
|
||||
<t-stepper
|
||||
v-model="item.quantity"
|
||||
class="quantity"
|
||||
:max="Number.MAX_SAFE_INTEGER"
|
||||
:min="0"
|
||||
size="large"
|
||||
:step="getProductQuantityStep(item.sku)"
|
||||
:integer="!item.sku.allowDecimalQuantity"
|
||||
:disabled="isSaving"
|
||||
theme="outline"
|
||||
@change="invalidateRequestNo"
|
||||
/>
|
||||
<t-button
|
||||
size="extra-small"
|
||||
variant="outline"
|
||||
:content="getSelectedUnitName(item)"
|
||||
:disabled="isSaving"
|
||||
@click.stop="openUnitPicker(item)"
|
||||
/>
|
||||
<t-button
|
||||
size="extra-small"
|
||||
variant="outline"
|
||||
content="专有入库记录"
|
||||
:disabled="isSaving"
|
||||
:aria-expanded="isAttachmentVisible(item.sku.id || '')"
|
||||
@click.stop="toggleAttachmentVisibility(item.sku.id || '')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<attachment-selector
|
||||
v-if="isAttachmentVisible(item.sku.id || '')"
|
||||
v-model:items="item.attachmentItems"
|
||||
:upload="uploadPhotos"
|
||||
title=""
|
||||
:busy="isSaving"
|
||||
@update:items="invalidateRequestNo"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<attachment-selector
|
||||
v-if="isAttachmentVisible(item.sku.id || '')"
|
||||
v-model:items="item.attachmentItems"
|
||||
:upload="uploadPhotos"
|
||||
title=""
|
||||
:busy="isSaving"
|
||||
@update:items="invalidateRequestNo"
|
||||
/>
|
||||
</div>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
<t-empty v-else description="没有已选 SKU,请返回重新选择" />
|
||||
<t-popup v-model="unitPickerVisible" placement="bottom">
|
||||
<t-picker v-model="unitPickerDraft" :columns="unitPickerOptions" title="选择入库单位" @cancel="unitPickerVisible = false" @confirm="confirmUnitPicker" />
|
||||
</t-popup>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
<t-empty v-else description="没有已选 SKU,请返回重新选择" />
|
||||
<t-popup v-model="unitPickerVisible" placement="bottom">
|
||||
<t-picker v-model="unitPickerDraft" :columns="unitPickerOptions" title="选择入库单位" @cancel="unitPickerVisible = false" @confirm="confirmUnitPicker" />
|
||||
</t-popup>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -444,7 +448,7 @@ onActivated(() => {
|
||||
<style scoped lang="less">
|
||||
.product-stock-batch-configure {
|
||||
gap: 1rem;
|
||||
padding: calc(var(--app-nav-height) + 1rem) 0 1rem 0;
|
||||
padding: 0 0 1rem 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main v-can="permissionCodes.productStock.create" class="page-content scroll list">
|
||||
<main v-can="permissionCodes.productStock.create" class="page-content scroll column list">
|
||||
<t-pull-down-refresh
|
||||
class="list-wrap empty-cell-title-margin pull-refresh"
|
||||
v-model="isRefreshing"
|
||||
|
||||
@@ -1,105 +1,109 @@
|
||||
<template>
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="库存详情"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
/>
|
||||
<div v-can="permissionCodes.productStock.read" class="product-stock-detail">
|
||||
<t-loading v-if="isLoading" class="loading" size="32px" />
|
||||
<template v-else-if="product && sku && stock">
|
||||
<product-profile :product="product" v-entrance-transition>
|
||||
<template #tags>
|
||||
<t-tag :content="sku?.specSummary || sku?.name || '默认 SKU'" variant="light-outline" theme="primary" />
|
||||
<t-tag :content="getStockStatusText(stock)" variant="light-outline" :theme="getStockTheme(stock)" />
|
||||
</template>
|
||||
</product-profile>
|
||||
<t-cell-group theme="card" title="库存" v-entrance-transition>
|
||||
<t-cell v-if="1 < unitList.length" class="units" title="显示单位">
|
||||
<template #note>
|
||||
<div class="options" role="group" aria-label="选择库存展示单位">
|
||||
<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.productStock.read" class="product-stock-detail">
|
||||
<t-loading v-if="isLoading" class="loading" size="32px" />
|
||||
<template v-else-if="product && sku && stock">
|
||||
<product-profile :product="product" v-entrance-transition>
|
||||
<template #tags>
|
||||
<t-tag :content="sku?.specSummary || sku?.name || '默认 SKU'" variant="light-outline" theme="primary" />
|
||||
<t-tag :content="getStockStatusText(stock)" variant="light-outline" :theme="getStockTheme(stock)" />
|
||||
</template>
|
||||
</product-profile>
|
||||
<t-cell-group theme="card" title="库存" v-entrance-transition>
|
||||
<t-cell v-if="1 < unitList.length" class="units" title="显示单位">
|
||||
<template #note>
|
||||
<div class="options" role="group" aria-label="选择库存展示单位">
|
||||
<t-button
|
||||
v-for="item in unitList"
|
||||
:key="item.id"
|
||||
size="extra-small"
|
||||
:theme="selectedUnit?.id === item.id ? 'primary' : 'default'"
|
||||
:variant="selectedUnit?.id === item.id ? 'base' : 'outline'"
|
||||
:aria-label="`切换到${item.name || '未命名单位'}`"
|
||||
:aria-pressed="selectedUnit?.id === item.id"
|
||||
@click="selectUnit(item.id || '')"
|
||||
>
|
||||
<span v-text="item.name || '未命名单位'" />
|
||||
</t-button>
|
||||
</div>
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell class="empty-cell-title-margin">
|
||||
<template #title>
|
||||
<span></span>
|
||||
</template>
|
||||
<template #description>
|
||||
<div class="stock">
|
||||
<div class="main">
|
||||
<span class="label">库存</span>
|
||||
<div class="value">
|
||||
<strong class="text" v-text="displayStock.onHandQuantity" />
|
||||
<span class="unit" v-text="selectedUnitName" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="available">
|
||||
<span class="label">可用</span>
|
||||
<strong class="value" v-text="displayStock.availableQuantity" />
|
||||
<span class="unit" v-text="selectedUnitName" />
|
||||
</div>
|
||||
<div class="reserved">
|
||||
<span class="label">预占</span>
|
||||
<strong class="value" v-text="displayStock.reservedQuantity" />
|
||||
<span class="unit" v-text="selectedUnitName" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</t-cell>
|
||||
<product-stock-package-summary :sku="sku" :stock="stock" />
|
||||
<t-cell title="查看库存流水" arrow @click="openRecordList" />
|
||||
<t-cell v-if="0 < Number(stock.reservedQuantity || 0)" title="查看库存预占流水" arrow @click="openReservedRecordList" />
|
||||
</t-cell-group>
|
||||
<card-container
|
||||
v-if="canOperate && sku?.status === 'ACTIVE' && sku.stockEnabled"
|
||||
class="actions-wrap"
|
||||
title="库存操作"
|
||||
description="所有操作必须选择业务单位、上传照片并填写备注"
|
||||
v-entrance-transition
|
||||
>
|
||||
<div class="actions">
|
||||
<t-button
|
||||
v-for="item in unitList"
|
||||
:key="item.id"
|
||||
size="extra-small"
|
||||
:theme="selectedUnit?.id === item.id ? 'primary' : 'default'"
|
||||
:variant="selectedUnit?.id === item.id ? 'base' : 'outline'"
|
||||
:aria-label="`切换到${item.name || '未命名单位'}`"
|
||||
:aria-pressed="selectedUnit?.id === item.id"
|
||||
@click="selectUnit(item.id || '')"
|
||||
v-for="item in operationList"
|
||||
:key="item.type"
|
||||
class="action"
|
||||
:theme="item.theme"
|
||||
block
|
||||
@click="openOperation(item.type)"
|
||||
>
|
||||
<span v-text="item.name || '未命名单位'" />
|
||||
<template #icon>
|
||||
<t-icon :name="item.icon" size="1.25rem" />
|
||||
</template>
|
||||
<span v-text="item.text" />
|
||||
</t-button>
|
||||
</div>
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell class="empty-cell-title-margin">
|
||||
<template #title>
|
||||
<span></span>
|
||||
</template>
|
||||
<template #description>
|
||||
<div class="stock">
|
||||
<div class="main">
|
||||
<span class="label">库存</span>
|
||||
<div class="value">
|
||||
<strong class="text" v-text="displayStock.onHandQuantity" />
|
||||
<span class="unit" v-text="selectedUnitName" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="available">
|
||||
<span class="label">可用</span>
|
||||
<strong class="value" v-text="displayStock.availableQuantity" />
|
||||
<span class="unit" v-text="selectedUnitName" />
|
||||
</div>
|
||||
<div class="reserved">
|
||||
<span class="label">预占</span>
|
||||
<strong class="value" v-text="displayStock.reservedQuantity" />
|
||||
<span class="unit" v-text="selectedUnitName" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</t-cell>
|
||||
<product-stock-package-summary :sku="sku" :stock="stock" />
|
||||
<t-cell title="查看库存流水" arrow @click="openRecordList" />
|
||||
<t-cell v-if="0 < Number(stock.reservedQuantity || 0)" title="查看库存预占流水" arrow @click="openReservedRecordList" />
|
||||
</t-cell-group>
|
||||
<card-container
|
||||
v-if="canOperate && sku?.status === 'ACTIVE' && sku.stockEnabled"
|
||||
class="actions-wrap"
|
||||
title="库存操作"
|
||||
description="所有操作必须选择业务单位、上传照片并填写备注"
|
||||
v-entrance-transition
|
||||
>
|
||||
<div class="actions">
|
||||
<t-button
|
||||
v-for="item in operationList"
|
||||
:key="item.type"
|
||||
class="action"
|
||||
:theme="item.theme"
|
||||
block
|
||||
@click="openOperation(item.type)"
|
||||
>
|
||||
<template #icon>
|
||||
<t-icon :name="item.icon" size="1.25rem" />
|
||||
</template>
|
||||
<span v-text="item.text" />
|
||||
</t-button>
|
||||
</div>
|
||||
</card-container>
|
||||
</template>
|
||||
<t-empty v-else description="库存或产品不存在" />
|
||||
<product-stock-operation-popup
|
||||
v-if="product && sku && stock"
|
||||
v-model:visible="operationVisible"
|
||||
:product="product"
|
||||
:sku="sku"
|
||||
:stock="stock"
|
||||
:operation="operationType"
|
||||
@success="loadAll"
|
||||
/>
|
||||
</card-container>
|
||||
</template>
|
||||
<t-empty v-else description="库存或产品不存在" />
|
||||
<product-stock-operation-popup
|
||||
v-if="product && sku && stock"
|
||||
v-model:visible="operationVisible"
|
||||
:product="product"
|
||||
:sku="sku"
|
||||
:stock="stock"
|
||||
:operation="operationType"
|
||||
@success="loadAll"
|
||||
/>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -264,7 +268,7 @@ onMounted(async () => {
|
||||
.product-stock-detail {
|
||||
gap: 1rem;
|
||||
display: flex;
|
||||
padding: calc(var(--app-nav-height) + 1rem) 0 1rem;
|
||||
padding: 0 0 1rem;
|
||||
flex-direction: column;
|
||||
|
||||
.loading {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main ref="productStockListRef" v-can="permissionCodes.productStock.read" class="page-content scroll list">
|
||||
<main ref="productStockListRef" v-can="permissionCodes.productStock.read" class="page-content scroll column list">
|
||||
<t-pull-down-refresh
|
||||
class="list-wrap empty-cell-title-margin pull-refresh"
|
||||
v-model="isRefreshing"
|
||||
|
||||
@@ -1,132 +1,136 @@
|
||||
<template>
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="库存流水详情"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
/>
|
||||
<div v-can="permissionCodes.productStock.read" class="product-stock-record-detail">
|
||||
<t-loading v-if="isLoading" class="loading" size="32px" />
|
||||
<template v-else-if="record">
|
||||
<section class="snapshot-head" v-entrance-transition>
|
||||
<div class="eyebrow">库存 SKU 快照</div>
|
||||
<h2 v-text="record.productNameSnapshot || '未命名产品'" />
|
||||
<product-sku-tags
|
||||
class="sku"
|
||||
:product-name="record.productNameSnapshot"
|
||||
:snapshot="record.skuSpecSnapshot"
|
||||
:fallback="record.specSummarySnapshot || record.skuNameSnapshot || '默认 SKU'"
|
||||
:unit="record.unitSnapshot"
|
||||
/>
|
||||
<div class="meta">
|
||||
<span v-text="record.skuCodeSnapshot || '无 SKU 编码'" />
|
||||
<t-tag size="small" variant="light-outline" :theme="getOperationTheme(record.onHandDelta)" :content="getStockOperationText(record.operationType)" />
|
||||
</div>
|
||||
</section>
|
||||
<card-container description="库存变动信息" v-entrance-transition>
|
||||
<div class="data">
|
||||
<div class="card">
|
||||
<span class="label">业务数量</span>
|
||||
<strong :class="getDeltaClass(record.quantity)" v-text="getQuantityText(record)" />
|
||||
<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.productStock.read" class="product-stock-record-detail">
|
||||
<t-loading v-if="isLoading" class="loading" size="32px" />
|
||||
<template v-else-if="record">
|
||||
<section class="snapshot-head" v-entrance-transition>
|
||||
<div class="eyebrow">库存 SKU 快照</div>
|
||||
<h2 v-text="record.productNameSnapshot || '未命名产品'" />
|
||||
<product-sku-tags
|
||||
class="sku"
|
||||
:product-name="record.productNameSnapshot"
|
||||
:snapshot="record.skuSpecSnapshot"
|
||||
:fallback="record.specSummarySnapshot || record.skuNameSnapshot || '默认 SKU'"
|
||||
:unit="record.unitSnapshot"
|
||||
/>
|
||||
<div class="meta">
|
||||
<span v-text="record.skuCodeSnapshot || '无 SKU 编码'" />
|
||||
<t-tag size="small" variant="light-outline" :theme="getOperationTheme(record.onHandDelta)" :content="getStockOperationText(record.operationType)" />
|
||||
</div>
|
||||
</section>
|
||||
<card-container description="库存变动信息" v-entrance-transition>
|
||||
<div class="data">
|
||||
<div class="card">
|
||||
<span class="label">业务数量</span>
|
||||
<strong :class="getDeltaClass(record.quantity)" v-text="getQuantityText(record)" />
|
||||
</div>
|
||||
<div class="card">
|
||||
<span class="label">基础单位数量</span>
|
||||
<strong :class="getDeltaClass(record.baseQuantity)" v-text="getSignedQuantityText(record.baseQuantity)" />
|
||||
</div>
|
||||
<div class="card">
|
||||
<span class="label">实际库存变动</span>
|
||||
<strong :class="getDeltaClass(record.onHandDelta)" v-text="getDeltaText(record.onHandDelta)" />
|
||||
</div>
|
||||
<div class="card">
|
||||
<span class="label">预占库存变动</span>
|
||||
<strong :class="getDeltaClass(record.reservedDelta)" v-text="getDeltaText(record.reservedDelta)" />
|
||||
</div>
|
||||
</div>
|
||||
</card-container>
|
||||
<t-cell-group title="库存快照" theme="card" v-entrance-transition>
|
||||
<t-cell title="实际库存">
|
||||
<template #note>
|
||||
<span class="balance">
|
||||
<span v-text="getProductQuantityText(record.onHandBefore)" />
|
||||
<t-icon name="arrow-right" />
|
||||
<span :class="getDeltaClass(record.onHandDelta)" v-text="getProductQuantityText(record.onHandAfter)" />
|
||||
<span class="unit" v-text="baseUnitName || '基础单位'" />
|
||||
</span>
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell title="预占库存">
|
||||
<template #note>
|
||||
<span class="balance">
|
||||
<span v-text="getProductQuantityText(record.reservedBefore)" />
|
||||
<t-icon name="arrow-right" />
|
||||
<span :class="getDeltaClass(record.reservedDelta)" v-text="getProductQuantityText(record.reservedAfter)" />
|
||||
<span class="unit" v-text="baseUnitName || '基础单位'" />
|
||||
</span>
|
||||
</template>
|
||||
</t-cell>
|
||||
</t-cell-group>
|
||||
<t-cell-group title="库存流水" theme="card" v-entrance-transition>
|
||||
<t-cell title="操作类型" :note="getStockOperationText(record.operationType)" />
|
||||
<t-cell title="业务类型" :note="getBizTypeText(record.bizType)" />
|
||||
<t-cell
|
||||
v-if="relatedFulfillmentId && canReadFulfillment"
|
||||
title="关联履约单"
|
||||
note="查看履约详情"
|
||||
arrow
|
||||
@click="toFulfillment"
|
||||
/>
|
||||
<t-cell title="发生时间">
|
||||
<template #note>
|
||||
<time-label :timestamp="record.occurredAt" underline />
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell title="操作人" :note="record.operator?.nick || record.operator?.name || record.operatorUserId || '未知操作人'" />
|
||||
<t-cell v-if="record.sourceRecordId" title="原库存流水" :note="record.sourceRecordId" arrow @click="openRelatedRecord(record.sourceRecordId)" />
|
||||
<t-cell v-if="record.revokeRecordId" title="冲正流水" :note="record.revokeRecordId" arrow @click="openRelatedRecord(record.revokeRecordId)" />
|
||||
<t-cell v-if="record.remark" title="备注" :note="record.remark" />
|
||||
<t-cell class="empty-cell-title-margin">
|
||||
<template #title>
|
||||
<span></span>
|
||||
</template>
|
||||
<template #description>
|
||||
<attachment-selector :items="photoItemList" title="操作照片" readonly />
|
||||
</template>
|
||||
</t-cell>
|
||||
</t-cell-group>
|
||||
<t-button
|
||||
v-if="canManualRevoke"
|
||||
class="cell-button"
|
||||
theme="danger"
|
||||
@click="openManualRevoke"
|
||||
v-entrance-transition
|
||||
content="手工流水冲正"
|
||||
/>
|
||||
</template>
|
||||
<t-empty v-else :description="isLoading ? '正在加载库存流水' : '库存流水不存在'" />
|
||||
<bottom-popup
|
||||
v-model="revokeVisible"
|
||||
title="手工流水冲正"
|
||||
left-button-text="取消"
|
||||
:right-button-text="isOperating ? '提交中' : '提交'"
|
||||
@left-button-click="revokeVisible = false"
|
||||
@right-button-click="submitManualRevoke"
|
||||
>
|
||||
<div class="revoke-popup">
|
||||
<p class="tip">将新增一条反向库存流水,原流水不会被修改或删除。</p>
|
||||
<t-form>
|
||||
<t-form-item label="冲正备注" required-mark>
|
||||
<t-textarea v-model="revokeRemark" borderless autosize maxlength="500" placeholder="请输入冲正备注" />
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
<attachment-selector
|
||||
v-model:items="revokePhotoItems"
|
||||
:upload="uploadPhotoList"
|
||||
required
|
||||
title="冲正凭证照片"
|
||||
/>
|
||||
</div>
|
||||
<div class="card">
|
||||
<span class="label">基础单位数量</span>
|
||||
<strong :class="getDeltaClass(record.baseQuantity)" v-text="getSignedQuantityText(record.baseQuantity)" />
|
||||
</div>
|
||||
<div class="card">
|
||||
<span class="label">实际库存变动</span>
|
||||
<strong :class="getDeltaClass(record.onHandDelta)" v-text="getDeltaText(record.onHandDelta)" />
|
||||
</div>
|
||||
<div class="card">
|
||||
<span class="label">预占库存变动</span>
|
||||
<strong :class="getDeltaClass(record.reservedDelta)" v-text="getDeltaText(record.reservedDelta)" />
|
||||
</div>
|
||||
</div>
|
||||
</card-container>
|
||||
<t-cell-group title="库存快照" theme="card" v-entrance-transition>
|
||||
<t-cell title="实际库存">
|
||||
<template #note>
|
||||
<span class="balance">
|
||||
<span v-text="getProductQuantityText(record.onHandBefore)" />
|
||||
<t-icon name="arrow-right" />
|
||||
<span :class="getDeltaClass(record.onHandDelta)" v-text="getProductQuantityText(record.onHandAfter)" />
|
||||
<span class="unit" v-text="baseUnitName || '基础单位'" />
|
||||
</span>
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell title="预占库存">
|
||||
<template #note>
|
||||
<span class="balance">
|
||||
<span v-text="getProductQuantityText(record.reservedBefore)" />
|
||||
<t-icon name="arrow-right" />
|
||||
<span :class="getDeltaClass(record.reservedDelta)" v-text="getProductQuantityText(record.reservedAfter)" />
|
||||
<span class="unit" v-text="baseUnitName || '基础单位'" />
|
||||
</span>
|
||||
</template>
|
||||
</t-cell>
|
||||
</t-cell-group>
|
||||
<t-cell-group title="库存流水" theme="card" v-entrance-transition>
|
||||
<t-cell title="操作类型" :note="getStockOperationText(record.operationType)" />
|
||||
<t-cell title="业务类型" :note="getBizTypeText(record.bizType)" />
|
||||
<t-cell
|
||||
v-if="relatedFulfillmentId && canReadFulfillment"
|
||||
title="关联履约单"
|
||||
note="查看履约详情"
|
||||
arrow
|
||||
@click="toFulfillment"
|
||||
/>
|
||||
<t-cell title="发生时间">
|
||||
<template #note>
|
||||
<time-label :timestamp="record.occurredAt" underline />
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell title="操作人" :note="record.operator?.nick || record.operator?.name || record.operatorUserId || '未知操作人'" />
|
||||
<t-cell v-if="record.sourceRecordId" title="原库存流水" :note="record.sourceRecordId" arrow @click="openRelatedRecord(record.sourceRecordId)" />
|
||||
<t-cell v-if="record.revokeRecordId" title="冲正流水" :note="record.revokeRecordId" arrow @click="openRelatedRecord(record.revokeRecordId)" />
|
||||
<t-cell v-if="record.remark" title="备注" :note="record.remark" />
|
||||
<t-cell class="empty-cell-title-margin">
|
||||
<template #title>
|
||||
<span></span>
|
||||
</template>
|
||||
<template #description>
|
||||
<attachment-selector :items="photoItemList" title="操作照片" readonly />
|
||||
</template>
|
||||
</t-cell>
|
||||
</t-cell-group>
|
||||
<t-button
|
||||
v-if="canManualRevoke"
|
||||
class="cell-button"
|
||||
theme="danger"
|
||||
@click="openManualRevoke"
|
||||
v-entrance-transition
|
||||
content="手工流水冲正"
|
||||
/>
|
||||
</template>
|
||||
<t-empty v-else :description="isLoading ? '正在加载库存流水' : '库存流水不存在'" />
|
||||
<bottom-popup
|
||||
v-model="revokeVisible"
|
||||
title="手工流水冲正"
|
||||
left-button-text="取消"
|
||||
:right-button-text="isOperating ? '提交中' : '提交'"
|
||||
@left-button-click="revokeVisible = false"
|
||||
@right-button-click="submitManualRevoke"
|
||||
>
|
||||
<div class="revoke-popup">
|
||||
<p class="tip">将新增一条反向库存流水,原流水不会被修改或删除。</p>
|
||||
<t-form>
|
||||
<t-form-item label="冲正备注" required-mark>
|
||||
<t-textarea v-model="revokeRemark" borderless autosize maxlength="500" placeholder="请输入冲正备注" />
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
<attachment-selector
|
||||
v-model:items="revokePhotoItems"
|
||||
:upload="uploadPhotoList"
|
||||
required
|
||||
title="冲正凭证照片"
|
||||
/>
|
||||
</bottom-popup>
|
||||
</div>
|
||||
</bottom-popup>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -327,7 +331,7 @@ watch(() => String(route.params.id || ""), async (id, previousId) => {
|
||||
.product-stock-record-detail {
|
||||
gap: 1rem;
|
||||
display: flex;
|
||||
padding: calc(var(--app-nav-height) + 1rem) 0 2rem;
|
||||
padding: 0 0 2rem;
|
||||
flex-direction: column;
|
||||
|
||||
.loading {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
left-arrow
|
||||
@left-click="handleNavBarBack"
|
||||
/>
|
||||
<main v-can="permissionCodes.productStock.read" class="page-content scroll list">
|
||||
<main v-can="permissionCodes.productStock.read" class="page-content scroll column list">
|
||||
<t-pull-down-refresh
|
||||
class="pull-refresh has-dropdown-menu-navbar"
|
||||
v-model="isRefreshing"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
/>
|
||||
<main v-can="permissionCodes.productStock.read" class="page-content scroll list">
|
||||
<main v-can="permissionCodes.productStock.read" class="page-content scroll column list">
|
||||
<t-pull-down-refresh
|
||||
class="list-wrap empty-cell-title-margin pull-refresh"
|
||||
v-model="isRefreshing"
|
||||
|
||||
Reference in New Issue
Block a user