feat(frontend): 订单与店铺商品交互完善
- 待审核订单增加「含未绑定」开关(默认只显示已绑定),列表与导出条件保持一致 - 店铺商品增加「只看有订单未绑定」筛选与「待处理订单」列;绑定弹窗改为左侧页签 + 右侧可搜索分页列表 - 订单切换仓库改为弹窗选择,新增通用 RecordPickerDialog 组件 - 订单与店铺商品表格改为表体内部滚动,筛选栏与分页固定 - 手工建单必须选择非平台店铺;平台订单编辑时店铺不可修改 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
ab630e7c01
commit
266c01538e
@ -74,3 +74,148 @@ export function loginExternalPrintAccount(id: number) {
|
||||
{ timeout: 60000 },
|
||||
)
|
||||
}
|
||||
|
||||
/** 平台侧店铺(商家)列表项:统一结构,不直接依赖具体平台字段 */
|
||||
export interface ExternalPrintMerchantItem {
|
||||
external_id: string
|
||||
name: string
|
||||
contact_name?: string
|
||||
contact_phone?: string
|
||||
/** 1 正常 0 停用 */
|
||||
status: number
|
||||
remark?: string
|
||||
/** 是否已创建到 OMS 店铺 */
|
||||
added?: boolean
|
||||
/** 平台返回的原始结构,创建店铺时原样保存 */
|
||||
raw?: unknown
|
||||
}
|
||||
|
||||
/** 拉取账号在外部打单平台的店铺(商家)列表(后端按平台分发,不直连平台) */
|
||||
export function getExternalPrintMerchants(id: number, params?: object) {
|
||||
return get<{ list: ExternalPrintMerchantItem[]; total: number; page: number; pageSize: number }>(
|
||||
`/external-print-accounts/${id}/merchants`,
|
||||
params,
|
||||
)
|
||||
}
|
||||
|
||||
/** 商品同步时单个分区的拉取明细(同一域名下可能有多套库,如「新系统区」) */
|
||||
export interface ExternalPrintShopProductSyncArea {
|
||||
dbname: string
|
||||
name: string
|
||||
total: number
|
||||
unique: number
|
||||
pages: number
|
||||
verified: boolean
|
||||
}
|
||||
|
||||
/** 商品同步时单个域名的拉取明细 */
|
||||
export interface ExternalPrintShopProductSyncHost {
|
||||
host: string
|
||||
total: number
|
||||
unique: number
|
||||
pages: number
|
||||
verified: boolean
|
||||
areas?: ExternalPrintShopProductSyncArea[]
|
||||
}
|
||||
|
||||
/** 商家店铺商品同步结果 */
|
||||
export interface ExternalPrintShopProductSyncResult {
|
||||
total: number
|
||||
unique: number
|
||||
created: number
|
||||
updated: number
|
||||
/** 平台已不存在、且未绑定未被订单引用 → 已删除的行数 */
|
||||
removed: number
|
||||
/** 平台已不存在、但已绑定或被订单引用 → 保留并标为下架的行数 */
|
||||
offline: number
|
||||
verified: boolean
|
||||
hosts: ExternalPrintShopProductSyncHost[]
|
||||
}
|
||||
|
||||
/** 同步外部打单平台商家的店铺商品(后端按商家分区逐域名拉取全量快照) */
|
||||
export function syncExternalPrintShopProducts(accountId: number, shopId: number) {
|
||||
return post<ExternalPrintShopProductSyncResult>(
|
||||
`/external-print-accounts/${accountId}/shops/${shopId}/sync-products`,
|
||||
undefined,
|
||||
{ timeout: 120000 },
|
||||
)
|
||||
}
|
||||
|
||||
/** 待补拉的商品(订单明细里的平台商品ID/规格ID) */
|
||||
export interface PullShopProductItem {
|
||||
outer_item_id: string
|
||||
outer_sku_id?: string
|
||||
}
|
||||
|
||||
/** 单品补拉结果里写入的店铺商品 */
|
||||
export interface PulledShopProductRow {
|
||||
id: number
|
||||
shop_id: number
|
||||
outer_item_id: string
|
||||
outer_sku_id: string | null
|
||||
title: string | null
|
||||
spec: string | null
|
||||
platform_type: string | null
|
||||
status: number
|
||||
bind_type: number
|
||||
product_id: number | null
|
||||
combo_product_id: number | null
|
||||
}
|
||||
|
||||
/** 单品补拉结果(未命中的商品带原因返回) */
|
||||
export interface PullShopProductsResult {
|
||||
requested: number
|
||||
matched: number
|
||||
created: number
|
||||
updated: number
|
||||
hosts: string[]
|
||||
missing: Array<{ outer_item_id: string; outer_sku_id: string; reason: string }>
|
||||
products: PulledShopProductRow[]
|
||||
}
|
||||
|
||||
/** 按平台商品ID单独补拉店铺商品(订单明细匹配不到店铺商品时使用) */
|
||||
export function pullExternalPrintShopProducts(
|
||||
accountId: number,
|
||||
shopId: number,
|
||||
items: PullShopProductItem[],
|
||||
) {
|
||||
return post<PullShopProductsResult>(
|
||||
`/external-print-accounts/${accountId}/shops/${shopId}/pull-products`,
|
||||
{ items },
|
||||
{ timeout: 120000 },
|
||||
)
|
||||
}
|
||||
|
||||
/** 拉取订单结果(手动与定时共用同一后端逻辑) */
|
||||
export interface SyncShopOrdersResult {
|
||||
start_time: string
|
||||
end_time: string
|
||||
orders: number
|
||||
created: number
|
||||
updated: number
|
||||
items: number
|
||||
items_bound: number
|
||||
items_unbound: number
|
||||
hosts: string[]
|
||||
}
|
||||
|
||||
/** 手动拉取外部打单平台商家订单(按天数或时间窗) */
|
||||
export function syncExternalPrintShopOrders(
|
||||
accountId: number,
|
||||
shopId: number,
|
||||
params: { days?: number; start_time?: string; end_time?: string } = {},
|
||||
) {
|
||||
return post<SyncShopOrdersResult>(
|
||||
`/external-print-accounts/${accountId}/shops/${shopId}/sync-orders`,
|
||||
params,
|
||||
{ timeout: 300000 },
|
||||
)
|
||||
}
|
||||
|
||||
/** 把选中的平台店铺(商家)创建到 OMS 店铺 */export function createShopsFromMerchants(id: number, merchants: ExternalPrintMerchantItem[]) {
|
||||
return post<{ created: number; skipped: number; shops: Array<{ id: number; code: string; name: string }> }>(
|
||||
`/external-print-accounts/${id}/shops`,
|
||||
{ merchants },
|
||||
{ timeout: 60000 },
|
||||
)
|
||||
}
|
||||
|
||||
@ -95,6 +95,8 @@ export interface OrderStatusItem {
|
||||
address: string | null
|
||||
status: OrderStage
|
||||
status_label?: string
|
||||
/** 是否外部打单平台拉取的订单(店铺由平台决定,不可修改) */
|
||||
is_external?: boolean
|
||||
remark: string | null
|
||||
/** —— 老发货单口径字段(为容纳老表而扩展) —— */
|
||||
order_type?: string | null
|
||||
@ -175,7 +177,7 @@ export interface OrderStatusFilters {
|
||||
archive_months: number
|
||||
/** 订单索引表名 */
|
||||
index_table?: string
|
||||
shops: { id: number; name: string }[]
|
||||
shops: { id: number; code?: string; name: string; type?: number }[]
|
||||
warehouses: { id: number; code: string; name: string }[]
|
||||
}
|
||||
|
||||
@ -386,11 +388,3 @@ export function changeOrdersWarehouse(ids: number[], warehouseId: number) {
|
||||
{ ids, warehouse_id: warehouseId },
|
||||
)
|
||||
}
|
||||
|
||||
/** 批量设置所属店铺(同步刷新 shop_nick 快照) */
|
||||
export function changeOrdersShop(ids: number[], shopId: number) {
|
||||
return post<{ updated: number; target: { id: number; name: string } }>('/order-status/change-shop', {
|
||||
ids,
|
||||
shop_id: shopId,
|
||||
})
|
||||
}
|
||||
|
||||
@ -9,6 +9,30 @@ export interface ShopItem {
|
||||
contact_name: string | null
|
||||
contact_phone: string | null
|
||||
status: number
|
||||
/** 店铺类型:1 平台店铺 2 外部打单平台商家 3 数据库模式(预留) */
|
||||
type?: number
|
||||
/** 来源外部打单账号ID(type=2 时有值) */
|
||||
external_print_account_id?: number | null
|
||||
/** 外部打单平台返回的商家原始结构 */
|
||||
external_data?: unknown | null
|
||||
/** 数据库地址(type=3 数据库模式店铺使用,预留) */
|
||||
db_host?: string | null
|
||||
/** 数据库端口(type=3 数据库模式店铺使用,预留) */
|
||||
db_port?: number | null
|
||||
/** 数据库名(type=3 数据库模式店铺使用,预留) */
|
||||
db_name?: string | null
|
||||
/** 数据库账号(type=3 数据库模式店铺使用,预留) */
|
||||
db_username?: string | null
|
||||
/** 是否已配置数据库密码(密码不回显) */
|
||||
has_db_password?: boolean
|
||||
/** 是否自动拉取订单:1 是 0 否 */
|
||||
auto_fetch_order: number
|
||||
/** 自动拉取订单间隔(分钟,最小 3) */
|
||||
auto_fetch_interval: number
|
||||
/** 最近一次拉取订单时间(手动/自动) */
|
||||
last_order_sync_at?: string | null
|
||||
/** 最近一次拉取订单结果/失败原因 */
|
||||
last_order_sync_msg?: string | null
|
||||
extra: unknown | null
|
||||
remark: string | null
|
||||
created_at?: string
|
||||
@ -23,6 +47,10 @@ export interface ShopPayload {
|
||||
contact_name?: string
|
||||
contact_phone?: string
|
||||
status?: number
|
||||
/** 是否自动拉取订单:1 是 0 否 */
|
||||
auto_fetch_order?: number
|
||||
/** 自动拉取订单间隔(分钟,最小 3) */
|
||||
auto_fetch_interval?: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { get, post, put, del } from '@/utils/request'
|
||||
import { get, post } from '@/utils/request'
|
||||
|
||||
/** 绑定类型:0未绑定 1系统商品 2组合商品 */
|
||||
export const BIND_TYPES = { none: 0, product: 1, combo: 2 } as const
|
||||
@ -16,6 +16,12 @@ export interface ShopProductItem {
|
||||
price: number | string | null
|
||||
stock: number
|
||||
status: number
|
||||
/** 外部平台类型:TouTiao/Taobao/Pinduoduo 等(外部平台采集时有值) */
|
||||
platform_type?: string | null
|
||||
/** 外部平台的店铺ID(如店管家 ShopId) */
|
||||
external_shop_id?: string | null
|
||||
/** 引用该商品但未绑定系统商品的订单数(列表接口回填) */
|
||||
unbound_order_count?: number
|
||||
bind_type: number
|
||||
product_id: number | null
|
||||
combo_product_id: number | null
|
||||
@ -27,19 +33,6 @@ export interface ShopProductItem {
|
||||
comboProduct?: { id: number; code: string; name: string } | null
|
||||
}
|
||||
|
||||
export interface ShopProductPayload {
|
||||
shop_id: number
|
||||
outer_item_id: string
|
||||
outer_sku_id?: string
|
||||
title?: string
|
||||
outer_code?: string
|
||||
spec?: string
|
||||
image?: string
|
||||
price?: number
|
||||
stock?: number
|
||||
status?: number
|
||||
}
|
||||
|
||||
export interface BindPayload {
|
||||
bind_type: number
|
||||
product_id?: number | null
|
||||
@ -54,17 +47,7 @@ export function getShopProducts(params?: object) {
|
||||
)
|
||||
}
|
||||
|
||||
/** 更新店铺商品采集信息 */
|
||||
export function updateShopProduct(id: number, data: Partial<ShopProductPayload>) {
|
||||
return put<{ id: number }>(`/shop-products/${id}`, data)
|
||||
}
|
||||
|
||||
/** 绑定系统商品 / 组合商品,bind_type=0 为解绑 */
|
||||
export function bindShopProduct(id: number, data: BindPayload) {
|
||||
return post<{ id: number }>(`/shop-products/${id}/bind`, data)
|
||||
}
|
||||
|
||||
/** 删除店铺商品 */
|
||||
export function deleteShopProduct(id: number) {
|
||||
return del<{ id: number }>(`/shop-products/${id}`)
|
||||
}
|
||||
|
||||
148
frontend/src/components/RecordPickerDialog.vue
Normal file
148
frontend/src/components/RecordPickerDialog.vue
Normal file
@ -0,0 +1,148 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* 通用「列表选择」弹窗
|
||||
*
|
||||
* 用于批量操作需要指定目标(仓库 / 店铺)的场景:
|
||||
* 打开后展示可选项列表(支持关键词过滤),选中一行后确认返回该行数据,
|
||||
* 避免之前用输入框让用户手输名称/编码的交互。
|
||||
*/
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import DataTable from '@/components/DataTable.vue'
|
||||
|
||||
export interface PickerColumn {
|
||||
prop: string
|
||||
label: string
|
||||
width?: number | string
|
||||
minWidth?: number | string
|
||||
}
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
modelValue: boolean
|
||||
title: string
|
||||
/** 可选项列表(任意对象,按 columns 展示) */
|
||||
options: Array<Record<string, unknown>>
|
||||
columns: PickerColumn[]
|
||||
/** 行唯一标识字段,默认 id */
|
||||
valueKey?: string
|
||||
/** 关键词过滤用字段,匹配任一即可 */
|
||||
searchProps?: string[]
|
||||
/** 当前已选中的值(打开时默认高亮) */
|
||||
current?: string | number | null
|
||||
confirmText?: string
|
||||
emptyText?: string
|
||||
}>(),
|
||||
{
|
||||
valueKey: 'id',
|
||||
searchProps: () => [],
|
||||
current: null,
|
||||
confirmText: '确定',
|
||||
emptyText: '暂无可选项',
|
||||
},
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: boolean]
|
||||
confirm: [row: Record<string, unknown>]
|
||||
}>()
|
||||
|
||||
const keyword = ref('')
|
||||
const selected = ref<string | number | null>(null)
|
||||
|
||||
/** 关键词过滤后的列表 */
|
||||
const filtered = computed(() => {
|
||||
const text = keyword.value.trim().toLowerCase()
|
||||
if (!text) return props.options
|
||||
const keys = props.searchProps.length ? props.searchProps : [ props.valueKey ]
|
||||
return props.options.filter(row =>
|
||||
keys.some(key => String(row[key] ?? '').toLowerCase().includes(text)),
|
||||
)
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(open) => {
|
||||
if (!open) return
|
||||
keyword.value = ''
|
||||
selected.value = props.current ?? null
|
||||
},
|
||||
)
|
||||
|
||||
function close() {
|
||||
emit('update:modelValue', false)
|
||||
}
|
||||
|
||||
function onRowClick(row: Record<string, unknown>) {
|
||||
selected.value = row[props.valueKey] as string | number
|
||||
}
|
||||
|
||||
function confirm() {
|
||||
if (selected.value == null) return
|
||||
const hit = props.options.find(row => row[props.valueKey] === selected.value)
|
||||
if (!hit) return
|
||||
emit('confirm', hit)
|
||||
close()
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
:model-value="modelValue"
|
||||
:title="title"
|
||||
width="640px"
|
||||
top="8vh"
|
||||
@update:model-value="emit('update:modelValue', $event)"
|
||||
>
|
||||
<div class="picker-toolbar">
|
||||
<el-input v-model="keyword" placeholder="输入关键词过滤" clearable style="width: 260px" />
|
||||
<span class="picker-tip">点击一行选择,或双击直接确认</span>
|
||||
</div>
|
||||
<DataTable
|
||||
:data="filtered"
|
||||
height="320"
|
||||
highlight-current-row
|
||||
@row-click="onRowClick"
|
||||
@row-dblclick="(_row: Record<string, unknown>) => { onRowClick(_row); confirm() }"
|
||||
>
|
||||
<el-table-column label="" width="48" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-radio :model-value="selected" :value="row[valueKey]" class="picker-radio">
|
||||
<span />
|
||||
</el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-for="col in columns"
|
||||
:key="col.prop"
|
||||
:prop="col.prop"
|
||||
:label="col.label"
|
||||
:width="col.width"
|
||||
:min-width="col.minWidth"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<template #empty>
|
||||
<span>{{ emptyText }}</span>
|
||||
</template>
|
||||
</DataTable>
|
||||
<template #footer>
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" :disabled="selected == null" @click="confirm">{{ confirmText }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.picker-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.picker-tip {
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
.picker-radio :deep(.el-radio__label) {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus'
|
||||
import {
|
||||
getExternalPrintPlatforms,
|
||||
@ -12,8 +12,11 @@ import {
|
||||
deleteExternalPrintAccount,
|
||||
checkExternalPrintAccount,
|
||||
loginExternalPrintAccount,
|
||||
getExternalPrintMerchants,
|
||||
createShopsFromMerchants,
|
||||
type ExternalPrintAccountItem,
|
||||
type ExternalPrintAccountPayload,
|
||||
type ExternalPrintMerchantItem,
|
||||
} from '@/api/externalPrintAccount'
|
||||
import DataTable from '@/components/DataTable.vue'
|
||||
import ListPager from '@/components/ListPager.vue'
|
||||
@ -205,6 +208,93 @@ async function handleLogin(row: ExternalPrintAccountItem) {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------- 平台店铺(商家) -------------------- */
|
||||
const shopsDialogVisible = ref(false)
|
||||
const shopsAccount = ref<ExternalPrintAccountItem | null>(null)
|
||||
const merchantLoading = ref(false)
|
||||
const merchantList = ref<ExternalPrintMerchantItem[]>([])
|
||||
const merchantTotal = ref(0)
|
||||
const merchantQuery = reactive({ page: 1, pageSize: 20, keyword: '' })
|
||||
const selectedMerchants = ref<ExternalPrintMerchantItem[]>([])
|
||||
const addingShops = ref(false)
|
||||
|
||||
/** 表格高度跟随视口:内容区固定高度、表格内部滚动,保证底部操作按钮始终可见 */
|
||||
const merchantTableHeight = ref(320)
|
||||
|
||||
function syncMerchantTableHeight() {
|
||||
merchantTableHeight.value = Math.min(520, Math.max(120, Math.floor(window.innerHeight * 0.6) - 220))
|
||||
}
|
||||
|
||||
async function fetchMerchants() {
|
||||
if (!shopsAccount.value) return
|
||||
merchantLoading.value = true
|
||||
try {
|
||||
const res = await getExternalPrintMerchants(shopsAccount.value.id, {
|
||||
page: merchantQuery.page,
|
||||
pageSize: merchantQuery.pageSize,
|
||||
keyword: merchantQuery.keyword || undefined,
|
||||
})
|
||||
merchantList.value = res.list || []
|
||||
merchantTotal.value = res.total || 0
|
||||
selectedMerchants.value = []
|
||||
} catch {
|
||||
merchantList.value = []
|
||||
merchantTotal.value = 0
|
||||
} finally {
|
||||
merchantLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function openMerchants(row: ExternalPrintAccountItem) {
|
||||
shopsAccount.value = row
|
||||
merchantQuery.page = 1
|
||||
merchantQuery.pageSize = 20
|
||||
merchantQuery.keyword = ''
|
||||
selectedMerchants.value = []
|
||||
syncMerchantTableHeight()
|
||||
shopsDialogVisible.value = true
|
||||
fetchMerchants()
|
||||
}
|
||||
|
||||
function searchMerchants() {
|
||||
merchantQuery.page = 1
|
||||
fetchMerchants()
|
||||
}
|
||||
|
||||
function handleMerchantPageChange(page: number) {
|
||||
merchantQuery.page = page
|
||||
fetchMerchants()
|
||||
}
|
||||
|
||||
function handleMerchantSizeChange(size: number) {
|
||||
merchantQuery.pageSize = size
|
||||
merchantQuery.page = 1
|
||||
fetchMerchants()
|
||||
}
|
||||
|
||||
function handleMerchantSelection(rows: ExternalPrintMerchantItem[]) {
|
||||
selectedMerchants.value = rows
|
||||
}
|
||||
|
||||
function canSelectMerchant(row: ExternalPrintMerchantItem) {
|
||||
return !row.added
|
||||
}
|
||||
|
||||
async function handleAddShops() {
|
||||
if (!shopsAccount.value || !selectedMerchants.value.length) return
|
||||
addingShops.value = true
|
||||
try {
|
||||
const res = await createShopsFromMerchants(shopsAccount.value.id, selectedMerchants.value)
|
||||
const extra = res.skipped ? `,跳过 ${res.skipped} 个(已添加或无效)` : ''
|
||||
ElMessage.success(`已添加 ${res.created} 个店铺${extra}`)
|
||||
await fetchMerchants()
|
||||
} catch {
|
||||
// 拦截器已提示
|
||||
} finally {
|
||||
addingShops.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 行登录状态:优先用本次检查/登录结果,否则用后端记录的最新状态 */
|
||||
function isRowLoggedIn(row: ExternalPrintAccountItem) {
|
||||
const local = loginStatus[row.id]
|
||||
@ -216,9 +306,15 @@ function rowStatusTitle(row: ExternalPrintAccountItem) {
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
syncMerchantTableHeight()
|
||||
window.addEventListener('resize', syncMerchantTableHeight)
|
||||
await fetchPlatforms()
|
||||
await fetchList()
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('resize', syncMerchantTableHeight)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -273,8 +369,9 @@ onMounted(async () => {
|
||||
<el-table-column label="创建时间" width="180">
|
||||
<template #default="{ row }">{{ formatDateTime(row.created_at) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="280" fixed="right">
|
||||
<el-table-column label="操作" width="340" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="openMerchants(row)">查看店铺</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@ -332,6 +429,65 @@ onMounted(async () => {
|
||||
<el-button type="primary" :loading="submitting" @click="submitForm">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
v-model="shopsDialogVisible"
|
||||
:title="shopsAccount ? `店铺列表 - ${shopsAccount.account}` : '店铺列表'"
|
||||
width="920px"
|
||||
top="6vh"
|
||||
>
|
||||
<el-form :inline="true" class="merchant-search">
|
||||
<el-form-item label="关键词">
|
||||
<el-input
|
||||
v-model="merchantQuery.keyword"
|
||||
placeholder="商家名称/手机号"
|
||||
clearable
|
||||
@keyup.enter="searchMerchants"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="searchMerchants">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<DataTable
|
||||
class="merchant-table"
|
||||
:height="merchantTableHeight"
|
||||
:loading="merchantLoading"
|
||||
:data="merchantList"
|
||||
@selection-change="handleMerchantSelection"
|
||||
>
|
||||
<el-table-column type="selection" width="45" :selectable="canSelectMerchant" />
|
||||
<el-table-column prop="name" label="商家名称" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column prop="contact_name" label="联系人" width="120" />
|
||||
<el-table-column prop="contact_phone" label="联系电话" width="130" />
|
||||
<el-table-column label="状态" width="80">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.status === 0 ? 'info' : 'success'">{{ row.status === 0 ? '停用' : '正常' }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否已添加" width="110">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.added ? 'success' : 'info'">{{ row.added ? '已添加' : '未添加' }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</DataTable>
|
||||
|
||||
<ListPager
|
||||
:total="merchantTotal"
|
||||
:page="merchantQuery.page"
|
||||
:page-size="merchantQuery.pageSize"
|
||||
@page-change="handleMerchantPageChange"
|
||||
@size-change="handleMerchantSizeChange"
|
||||
/>
|
||||
|
||||
<template #footer>
|
||||
<span class="merchant-selected">已选 {{ selectedMerchants.length }} 项</span>
|
||||
<el-button @click="shopsDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="addingShops" :disabled="!selectedMerchants.length" @click="handleAddShops">
|
||||
添加到店铺
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
@ -348,4 +504,15 @@ onMounted(async () => {
|
||||
.search-bar {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.merchant-search {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.merchant-table {
|
||||
width: 100%;
|
||||
}
|
||||
.merchant-selected {
|
||||
margin-right: 12px;
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -942,7 +942,7 @@ onMounted(async () => {
|
||||
<DataTable
|
||||
:loading="loading"
|
||||
:data="list"
|
||||
class="fill-table"
|
||||
height="100%"
|
||||
row-key="id"
|
||||
@row-click="openItems"
|
||||
@selection-change="onSelectionChange"
|
||||
@ -1451,7 +1451,4 @@ onMounted(async () => {
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.fill-table {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -127,13 +127,19 @@ function defaultWarehouseId(): number | null {
|
||||
return list.length ? list[0].id : null
|
||||
}
|
||||
|
||||
/** 默认店铺:优先父级入口指定的店铺,否则取店铺列表第一个 */
|
||||
/** 手工建单可选店铺:排除外部打单平台店铺(type=2,其订单只能由平台拉取) */
|
||||
const selectableShops = computed(() => (props.filters.shops || []).filter(shop => Number(shop.type ?? 1) !== 2))
|
||||
|
||||
/** 默认店铺:优先父级入口指定的店铺,否则取可选店铺列表第一个 */
|
||||
function defaultShopIdOf(): number | null {
|
||||
if (props.defaultShopId) return props.defaultShopId
|
||||
const list = props.filters.shops || []
|
||||
const list = selectableShops.value
|
||||
return list.length ? list[0].id : null
|
||||
}
|
||||
|
||||
/** 当前编辑的单据是否由外部打单平台拉取(店铺不可修改) */
|
||||
const isExternal = ref(false)
|
||||
|
||||
function reset() {
|
||||
Object.assign(form, {
|
||||
parent_order_no: '',
|
||||
@ -175,6 +181,8 @@ async function loadDetail(id: number) {
|
||||
loading.value = true
|
||||
try {
|
||||
const { order, items } = await getOrderStatusDetail(id)
|
||||
// 外部打单平台拉取的订单,店铺由平台决定,编辑时不允许修改
|
||||
isExternal.value = !!(order as { is_external?: boolean }).is_external
|
||||
Object.assign(form, {
|
||||
parent_order_no: order.parent_order_no || '',
|
||||
order_no: order.order_no,
|
||||
@ -543,9 +551,25 @@ async function submit() {
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="店铺" prop="shop_id">
|
||||
<el-select v-model="form.shop_id" placeholder="请选择店铺" clearable filterable style="width: 100%">
|
||||
<el-option v-for="shop in props.filters.shops" :key="shop.id" :label="shop.name" :value="shop.id" />
|
||||
<el-select
|
||||
v-model="form.shop_id"
|
||||
placeholder="请选择店铺"
|
||||
clearable
|
||||
filterable
|
||||
:disabled="isExternal"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="shop in selectableShops"
|
||||
:key="shop.id"
|
||||
:label="shop.code ? `${shop.name}(${shop.code})` : shop.name"
|
||||
:value="shop.id"
|
||||
/>
|
||||
</el-select>
|
||||
<div v-if="isExternal" class="form-tip">平台拉取的订单,店铺由平台决定,不可修改</div>
|
||||
<div v-else-if="!selectableShops.length" class="form-tip">
|
||||
当前主体下没有可用的平台店铺(外部打单平台店铺不可用于手工建单)
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@ -870,6 +894,13 @@ async function submit() {
|
||||
line-height: 16px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
.form-tip {
|
||||
display: block;
|
||||
margin-top: 2px;
|
||||
font-size: 12px;
|
||||
line-height: 16px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
:deep(.el-descriptions__label) {
|
||||
width: 110px;
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import DataTable from '@/components/DataTable.vue'
|
||||
import ExportButton from '@/components/ExportButton.vue'
|
||||
import ListPager from '@/components/ListPager.vue'
|
||||
import RecordPickerDialog from '@/components/RecordPickerDialog.vue'
|
||||
import OrderFormDialog from './OrderFormDialog.vue'
|
||||
import { DEFAULT_PAGE_SIZE, useListPage } from '@/composables/useListPage'
|
||||
import { formatDateTime } from '@/utils/datetime'
|
||||
@ -12,7 +13,6 @@ import {
|
||||
archiveOrders,
|
||||
auditOrders,
|
||||
cancelOrders,
|
||||
changeOrdersShop,
|
||||
changeOrdersWarehouse,
|
||||
getOrderStatusDetail,
|
||||
getOrderStatusFilters,
|
||||
@ -66,6 +66,14 @@ const query = reactive({
|
||||
archivedRange: [] as string[],
|
||||
})
|
||||
|
||||
/** 「含未绑定商品订单」开关(默认关闭:不显示含未绑定商品的订单) */
|
||||
const showUnboundOrders = ref(false)
|
||||
|
||||
function onUnboundSwitchChange() {
|
||||
query.page = 1
|
||||
search()
|
||||
}
|
||||
|
||||
const { loading, list, total, elapsed, fetchList, search, handlePageChange, handleSizeChange } =
|
||||
useListPage<OrderStatusItem, typeof query>({
|
||||
query,
|
||||
@ -89,6 +97,8 @@ const { loading, list, total, elapsed, fetchList, search, handlePageChange, hand
|
||||
params.archived_from = query.archivedRange[0]
|
||||
params.archived_to = query.archivedRange[1]
|
||||
}
|
||||
// 待审核默认只看「商品都已绑定」的订单,开关打开才包含未绑定商品的订单
|
||||
if (props.status === 'pending' && !showUnboundOrders.value) params.exclude_unbound = 1
|
||||
return getOrderStatusList(params as never)
|
||||
},
|
||||
})
|
||||
@ -119,6 +129,7 @@ const exportFilters = computed(() => ({
|
||||
created_to: query.createdRange[1],
|
||||
archived_from: query.archivedRange[0],
|
||||
archived_to: query.archivedRange[1],
|
||||
exclude_unbound: props.status === 'pending' && !showUnboundOrders.value ? 1 : '',
|
||||
}))
|
||||
|
||||
/* -------------------- 筛选项数据源(状态枚举 / 店铺 / 归档阈值) -------------------- */
|
||||
@ -155,14 +166,12 @@ type BatchKey =
|
||||
| 'void'
|
||||
| 'restore'
|
||||
| 'change_warehouse'
|
||||
| 'change_shop'
|
||||
|
||||
/** 批量操作按场景分布在各视图 */
|
||||
/** 批量操作按场景分布在各视图(店铺在创建时确定,不再提供批量设置店铺) */
|
||||
const BATCH_ACTIONS: Record<OrderStage, { key: BatchKey; label: string; type: string }[]> = {
|
||||
pending: [
|
||||
{ key: 'audit', label: '批量审核(→ 待推送)', type: 'primary' },
|
||||
{ key: 'change_warehouse', label: '切换仓库', type: 'default' },
|
||||
{ key: 'change_shop', label: '设置店铺', type: 'default' },
|
||||
{ key: 'cancel', label: '取消', type: 'warning' },
|
||||
{ key: 'void', label: '作废', type: 'danger' },
|
||||
],
|
||||
@ -170,7 +179,6 @@ const BATCH_ACTIONS: Record<OrderStage, { key: BatchKey; label: string; type: st
|
||||
{ key: 'push_wms', label: '推送仓库', type: 'success' },
|
||||
{ key: 'reject', label: '驳回(换号)', type: 'warning' },
|
||||
{ key: 'change_warehouse', label: '切换仓库', type: 'default' },
|
||||
{ key: 'change_shop', label: '设置店铺', type: 'default' },
|
||||
{ key: 'cancel', label: '取消', type: 'warning' },
|
||||
{ key: 'void', label: '作废', type: 'danger' },
|
||||
{ key: 'push_success', label: '手工标记推送成功', type: 'default' },
|
||||
@ -180,12 +188,10 @@ const BATCH_ACTIONS: Record<OrderStage, { key: BatchKey; label: string; type: st
|
||||
{ key: 'return', label: '批量转回待审核', type: 'warning' },
|
||||
{ key: 'audit', label: '批量审核(直接 → 待推送)', type: 'primary' },
|
||||
{ key: 'change_warehouse', label: '切换仓库', type: 'default' },
|
||||
{ key: 'change_shop', label: '设置店铺', type: 'default' },
|
||||
{ key: 'cancel', label: '取消', type: 'warning' },
|
||||
{ key: 'void', label: '作废', type: 'danger' },
|
||||
],
|
||||
outsourcing: [
|
||||
{ key: 'change_shop', label: '设置店铺', type: 'default' },
|
||||
{ key: 'cancel', label: '取消(同步取消仓库单)', type: 'warning' },
|
||||
],
|
||||
delivery: [],
|
||||
@ -208,60 +214,60 @@ function confirmText(key: BatchKey, count: number): string {
|
||||
void: `确认作废选中的 ${count} 条订单?作废记录人与原因、释放锁定库存,不可恢复也禁止删除。`,
|
||||
restore: '确认将选中的订单恢复到「待审核」?曾推送过的单据会自动换号。',
|
||||
change_warehouse: '确认切换选中订单的发货仓库?',
|
||||
change_shop: '确认设置选中订单的所属店铺?',
|
||||
}
|
||||
return map[key]
|
||||
}
|
||||
|
||||
/** 切换仓库/设置店铺使用的目标下拉(弹窗内选择) */
|
||||
async function pickWarehouse(current?: number | null): Promise<number | null> {
|
||||
const list = filters.value.warehouses || []
|
||||
if (!list.length) {
|
||||
/** 切换仓库使用的目标选择弹窗(列表选择,而非手输名称) */
|
||||
const picker = reactive({
|
||||
visible: false,
|
||||
title: '',
|
||||
})
|
||||
|
||||
const pickerOptions = computed<Array<Record<string, unknown>>>(() =>
|
||||
(filters.value.warehouses || []).map(item => ({ ...item })),
|
||||
)
|
||||
|
||||
const pickerColumns = [
|
||||
{ prop: 'code', label: '仓库编码', width: 180 },
|
||||
{ prop: 'name', label: '仓库名称', minWidth: 200 },
|
||||
]
|
||||
|
||||
/** 弹窗确认后的回调(由打开方注入) */
|
||||
let pickerResolve: ((row: Record<string, unknown> | null) => void) | null = null
|
||||
|
||||
/**
|
||||
* 打开仓库选择弹窗并等待结果
|
||||
* @return 选中的仓库行,取消返回 null
|
||||
*/
|
||||
function openPicker() {
|
||||
if (!(filters.value.warehouses || []).length) {
|
||||
ElMessage.warning('当前主体下没有仓库,请先到「仓库管理」创建')
|
||||
return null
|
||||
return Promise.resolve(null)
|
||||
}
|
||||
try {
|
||||
const { value } = await ElMessageBox.prompt('请输入目标仓库名称或编码关键词后选择', '切换仓库', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
inputPlaceholder: `可选:${list.map(w => `${w.name}(${w.code})`).join(' / ')}`,
|
||||
inputValidator: (text: string) => {
|
||||
const keyword = String(text || '').trim()
|
||||
return list.some(w => w.name.includes(keyword) || w.code.includes(keyword))
|
||||
? true
|
||||
: '请输入列表中的仓库名称或编码'
|
||||
},
|
||||
})
|
||||
const keyword = String(value).trim()
|
||||
const hit = list.find(w => w.name.includes(keyword) || w.code.includes(keyword))
|
||||
return hit ? hit.id : (current ?? null)
|
||||
} catch {
|
||||
return null
|
||||
picker.title = '切换仓库'
|
||||
picker.visible = true
|
||||
return new Promise<Record<string, unknown> | null>((resolve) => {
|
||||
pickerResolve = resolve
|
||||
})
|
||||
}
|
||||
|
||||
function onPickerConfirm(row: Record<string, unknown>) {
|
||||
if (pickerResolve) pickerResolve(row)
|
||||
pickerResolve = null
|
||||
}
|
||||
|
||||
function onPickerClose(visible: boolean) {
|
||||
picker.visible = visible
|
||||
if (!visible && pickerResolve) {
|
||||
pickerResolve(null)
|
||||
pickerResolve = null
|
||||
}
|
||||
}
|
||||
|
||||
async function pickShop(): Promise<number | null> {
|
||||
const list = filters.value.shops || []
|
||||
if (!list.length) {
|
||||
ElMessage.warning('当前主体下没有店铺,请先到「店铺管理」创建')
|
||||
return null
|
||||
}
|
||||
try {
|
||||
const { value } = await ElMessageBox.prompt('请输入目标店铺名称关键词', '设置所属店铺', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
inputPlaceholder: `可选:${list.map(s => s.name).join(' / ')}`,
|
||||
inputValidator: (text: string) => {
|
||||
const keyword = String(text || '').trim()
|
||||
return list.some(s => s.name.includes(keyword)) ? true : '请输入列表中的店铺名称'
|
||||
},
|
||||
})
|
||||
const keyword = String(value).trim()
|
||||
const hit = list.find(s => s.name.includes(keyword))
|
||||
return hit ? hit.id : null
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
async function pickWarehouse(): Promise<number | null> {
|
||||
const row = await openPicker()
|
||||
return row ? Number(row.id) : null
|
||||
}
|
||||
|
||||
/** 批量操作入口 */
|
||||
@ -282,15 +288,6 @@ async function handleBatch(key: BatchKey) {
|
||||
await fetchList()
|
||||
return
|
||||
}
|
||||
if (key === 'change_shop') {
|
||||
const shopId = await pickShop()
|
||||
if (!shopId) return
|
||||
const result = await changeOrdersShop(ids, shopId)
|
||||
ElMessage.success(`已设置店铺:${result.target.name}`)
|
||||
selectedIds.value = []
|
||||
await fetchList()
|
||||
return
|
||||
}
|
||||
|
||||
let tip = ''
|
||||
if (key === 'push_failed') {
|
||||
@ -598,6 +595,16 @@ onMounted(async () => {
|
||||
<span v-else-if="selectedIds.length" class="toolbar-hint">已选 {{ selectedIds.length }} 条</span>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<el-switch
|
||||
v-if="props.status === 'pending'"
|
||||
v-model="showUnboundOrders"
|
||||
size="small"
|
||||
inline-prompt
|
||||
active-text="含未绑定"
|
||||
inactive-text="仅已绑定"
|
||||
class="unbound-switch"
|
||||
@change="onUnboundSwitchChange"
|
||||
/>
|
||||
<ExportButton type="order" :filters="exportFilters" size="small" plain />
|
||||
<el-button v-if="props.status === 'pending'" type="primary" size="small" @click="openCreate">
|
||||
新建订单(发货单)
|
||||
@ -668,13 +675,13 @@ onMounted(async () => {
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 列表 -->
|
||||
<!-- 列表:高度铺满,表头与操作列固定,只有表体滚动 -->
|
||||
<div class="table-wrap">
|
||||
<DataTable
|
||||
:loading="loading"
|
||||
:data="list"
|
||||
row-key="id"
|
||||
class="fill-table"
|
||||
height="100%"
|
||||
@selection-change="onSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="42" :reserve-selection="false" />
|
||||
@ -853,6 +860,19 @@ onMounted(async () => {
|
||||
:filters="filters"
|
||||
@saved="handleFormSaved"
|
||||
/>
|
||||
|
||||
<!-- 切换仓库:列表选择(店铺在创建订单时确定,不再提供设置店铺) -->
|
||||
<RecordPickerDialog
|
||||
:model-value="picker.visible"
|
||||
:title="picker.title"
|
||||
:options="pickerOptions"
|
||||
:columns="pickerColumns"
|
||||
:search-props="['name', 'code']"
|
||||
confirm-text="切换仓库"
|
||||
empty-text="当前主体下没有仓库"
|
||||
@update:model-value="onPickerClose"
|
||||
@confirm="onPickerConfirm"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -877,6 +897,9 @@ onMounted(async () => {
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.unbound-switch {
|
||||
margin-right: 4px;
|
||||
}
|
||||
.toolbar-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@ -10,6 +10,7 @@ import {
|
||||
type ShopItem,
|
||||
type ShopDetail,
|
||||
} from '@/api/shop'
|
||||
import { syncExternalPrintShopProducts, syncExternalPrintShopOrders } from '@/api/externalPrintAccount'
|
||||
import SplitLayout from '@/components/SplitLayout.vue'
|
||||
import ExportButton from '@/components/ExportButton.vue'
|
||||
import DataTable from '@/components/DataTable.vue'
|
||||
@ -27,6 +28,9 @@ const PLATFORMS = [
|
||||
|
||||
const STATUS_LABELS: Record<number, string> = { 1: '启用', 0: '禁用' }
|
||||
|
||||
/** 店铺类型:1 平台店铺 2 外部打单平台商家 3 数据库模式(预留) */
|
||||
const TYPE_LABELS: Record<number, string> = { 1: '平台店铺', 2: '外部打单平台', 3: '数据库模式' }
|
||||
|
||||
function platformLabel(value?: string | null) {
|
||||
return PLATFORMS.find((p) => p.value === value)?.label || value || '-'
|
||||
}
|
||||
@ -97,12 +101,27 @@ const form = reactive({
|
||||
contact_name: '',
|
||||
contact_phone: '',
|
||||
status: 1,
|
||||
auto_fetch_order: 0,
|
||||
auto_fetch_interval: 3,
|
||||
remark: '',
|
||||
})
|
||||
// 新增时无需填编码(由后端生成 OMS 前缀编码),故 code 不做必填校验
|
||||
const rules: FormRules = {
|
||||
name: [{ required: true, message: '请输入店铺名称', trigger: 'blur' }],
|
||||
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
|
||||
auto_fetch_interval: [
|
||||
{
|
||||
validator: (_rule: unknown, value: unknown, callback: (e?: string | Error) => void) => {
|
||||
const interval = Number(value)
|
||||
if (!Number.isInteger(interval) || interval < 3) {
|
||||
callback(new Error('拉取间隔必须是不小于 3 的整数(分钟)'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
trigger: 'change',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
function openCreate() {
|
||||
@ -113,6 +132,8 @@ function openCreate() {
|
||||
form.contact_name = ''
|
||||
form.contact_phone = ''
|
||||
form.status = 1
|
||||
form.auto_fetch_order = 0
|
||||
form.auto_fetch_interval = 3
|
||||
form.remark = ''
|
||||
dialogVisible.value = true
|
||||
}
|
||||
@ -125,6 +146,8 @@ function openEdit(row: ShopItem) {
|
||||
form.contact_name = row.contact_name || ''
|
||||
form.contact_phone = row.contact_phone || ''
|
||||
form.status = row.status
|
||||
form.auto_fetch_order = Number(row.auto_fetch_order) === 1 ? 1 : 0
|
||||
form.auto_fetch_interval = Number(row.auto_fetch_interval) || 3
|
||||
form.remark = row.remark || ''
|
||||
dialogVisible.value = true
|
||||
}
|
||||
@ -157,6 +180,82 @@ async function submitForm() {
|
||||
})
|
||||
}
|
||||
|
||||
/** 正在拉取订单的店铺ID(防止重复点击) */
|
||||
const fetchingOrderId = ref<number | null>(null)
|
||||
/** 拉取订单弹窗 */
|
||||
const fetchOrderVisible = ref(false)
|
||||
const fetchOrderSubmitting = ref(false)
|
||||
const fetchOrderShop = ref<ShopItem | null>(null)
|
||||
const fetchOrderForm = reactive({ days: 1 })
|
||||
|
||||
const FETCH_ORDER_DAYS = [
|
||||
{ label: '最近 1 天', value: 1 },
|
||||
{ label: '最近 3 天', value: 3 },
|
||||
{ label: '最近 7 天', value: 7 },
|
||||
{ label: '最近 30 天', value: 30 },
|
||||
]
|
||||
|
||||
/** 打开手动拉单弹窗(外部打单平台店铺) */
|
||||
function openFetchOrder(row: ShopItem) {
|
||||
if (!row.external_print_account_id) {
|
||||
ElMessage.warning('该店铺未关联外部打单账号,无法拉取订单')
|
||||
return
|
||||
}
|
||||
fetchOrderShop.value = row
|
||||
fetchOrderForm.days = 1
|
||||
fetchOrderVisible.value = true
|
||||
}
|
||||
|
||||
/** 手动拉取订单:后端按店铺所属商家逐平台分区拉取并写入订单/明细 */
|
||||
async function submitFetchOrder() {
|
||||
const shop = fetchOrderShop.value
|
||||
if (!shop || !shop.external_print_account_id) return
|
||||
fetchOrderSubmitting.value = true
|
||||
fetchingOrderId.value = shop.id
|
||||
try {
|
||||
const res = await syncExternalPrintShopOrders(shop.external_print_account_id, shop.id, {
|
||||
days: fetchOrderForm.days,
|
||||
})
|
||||
ElMessage.success(
|
||||
`拉取完成:${res.orders} 单(新增 ${res.created},更新 ${res.updated}),明细 ${res.items} 条`,
|
||||
)
|
||||
fetchOrderVisible.value = false
|
||||
await fetchList()
|
||||
if (currentShop.value && currentShop.value.id === shop.id) await fetchDetail(shop.id)
|
||||
} catch {
|
||||
// 拦截器已提示
|
||||
} finally {
|
||||
fetchOrderSubmitting.value = false
|
||||
fetchingOrderId.value = null
|
||||
}
|
||||
}
|
||||
|
||||
/** 正在同步商品的店铺ID(防止重复点击) */
|
||||
const syncingId = ref<number | null>(null)
|
||||
|
||||
/** 同步外部打单平台商家的店铺商品(后端按商家分区逐域名拉取全量快照) */
|
||||
async function handleSyncProducts(row: ShopItem) {
|
||||
const accountId = row.external_print_account_id
|
||||
if (!accountId) {
|
||||
ElMessage.warning('该店铺未关联外部打单账号,无法同步商品')
|
||||
return
|
||||
}
|
||||
syncingId.value = row.id
|
||||
try {
|
||||
const res = await syncExternalPrintShopProducts(accountId, row.id)
|
||||
const parts = [ `新增 ${res.created}`, `更新 ${res.updated}` ]
|
||||
if (res.removed) parts.push(`移除 ${res.removed}`)
|
||||
if (res.offline) parts.push(`下架 ${res.offline}(已绑定或被订单引用,已保留)`)
|
||||
const suffix = res.verified ? '' : '(平台数据在拉取过程中有变动,本次未处理下架,建议重试)'
|
||||
ElMessage.success(`同步完成:${parts.join(',')},共 ${res.unique} 条${suffix}`)
|
||||
if (currentShop.value && currentShop.value.id === row.id) await fetchDetail(row.id)
|
||||
} catch {
|
||||
// 拦截器已提示
|
||||
} finally {
|
||||
syncingId.value = null
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDelete(row: ShopItem) {
|
||||
try {
|
||||
await ElMessageBox.confirm(`确认删除店铺「${row.name}」?`, '删除确认', {
|
||||
@ -225,7 +324,7 @@ onMounted(fetchList)
|
||||
:loading="loading"
|
||||
:data="list"
|
||||
highlight-current-row
|
||||
class="fill-table"
|
||||
height="100%"
|
||||
@row-click="handleRowClick"
|
||||
>
|
||||
<el-table-column prop="code" label="店铺编码" width="180" />
|
||||
@ -233,6 +332,24 @@ onMounted(fetchList)
|
||||
<el-table-column label="平台" width="110">
|
||||
<template #default="{ row }">{{ platformLabel(row.platform) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="类型" width="110">
|
||||
<template #default="{ row }">{{ TYPE_LABELS[row.type] || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="自动拉取" width="150">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.auto_fetch_order === 1" type="success">
|
||||
每 {{ row.auto_fetch_interval }} 分钟
|
||||
</el-tag>
|
||||
<el-tag v-else type="info">关闭</el-tag>
|
||||
<el-tooltip
|
||||
v-if="row.last_order_sync_at"
|
||||
:content="`${formatDateTime(row.last_order_sync_at)} ${row.last_order_sync_msg || ''}`"
|
||||
placement="top"
|
||||
>
|
||||
<div class="last-sync">最近拉单</div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="contact_name" label="联系人" width="100" />
|
||||
<el-table-column prop="contact_phone" label="联系电话" width="130" />
|
||||
<el-table-column label="状态" width="80">
|
||||
@ -242,9 +359,27 @@ onMounted(fetchList)
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="130" fixed="right">
|
||||
<el-table-column label="操作" width="290" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click.stop="openEdit(row)">编辑</el-button>
|
||||
<el-button
|
||||
v-if="row.type === 2"
|
||||
link
|
||||
type="primary"
|
||||
:loading="fetchingOrderId === row.id"
|
||||
@click.stop="openFetchOrder(row)"
|
||||
>
|
||||
拉取订单
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.type === 2"
|
||||
link
|
||||
type="primary"
|
||||
:loading="syncingId === row.id"
|
||||
@click.stop="handleSyncProducts(row)"
|
||||
>
|
||||
同步商品
|
||||
</el-button>
|
||||
<el-button link type="danger" @click.stop="handleDelete(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -274,6 +409,22 @@ onMounted(fetchList)
|
||||
<el-button size="small" class="detail-edit" @click="openEdit(currentShop)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="currentShop.type === 2"
|
||||
size="small"
|
||||
:loading="fetchingOrderId === currentShop.id"
|
||||
@click="openFetchOrder(currentShop)"
|
||||
>
|
||||
拉取订单
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="currentShop.type === 2"
|
||||
size="small"
|
||||
:loading="syncingId === currentShop.id"
|
||||
@click="handleSyncProducts(currentShop)"
|
||||
>
|
||||
同步商品
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-descriptions :column="3" border size="small" title="基本信息">
|
||||
@ -282,6 +433,16 @@ onMounted(fetchList)
|
||||
<el-descriptions-item label="所属平台">
|
||||
{{ platformLabel(currentShop.platform) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="自动拉取订单">
|
||||
{{ currentShop.auto_fetch_order === 1 ? `是(每 ${currentShop.auto_fetch_interval} 分钟)` : '否' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="最近拉单">
|
||||
<span v-if="currentShop.last_order_sync_at">
|
||||
{{ formatDateTime(currentShop.last_order_sync_at) }}
|
||||
<span class="sync-msg">{{ currentShop.last_order_sync_msg || '' }}</span>
|
||||
</span>
|
||||
<span v-else>-</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="联系人">
|
||||
{{ currentShop.contact_name || '-' }}
|
||||
</el-descriptions-item>
|
||||
@ -361,6 +522,19 @@ onMounted(fetchList)
|
||||
<el-option label="禁用" :value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="自动拉取订单" prop="auto_fetch_order">
|
||||
<el-switch v-model="form.auto_fetch_order" :active-value="1" :inactive-value="0" />
|
||||
<span class="form-tip">开启后按间隔自动拉取该店铺订单</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="拉取间隔" prop="auto_fetch_interval">
|
||||
<el-input-number
|
||||
v-model="form.auto_fetch_interval"
|
||||
:min="3"
|
||||
:step="1"
|
||||
:precision="0"
|
||||
/>
|
||||
<span class="form-tip">分钟(不小于 3 分钟,开启自动拉取后生效)</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" :rows="2" placeholder="选填" />
|
||||
</el-form-item>
|
||||
@ -370,6 +544,30 @@ onMounted(fetchList)
|
||||
<el-button type="primary" :loading="submitting" @click="submitForm">保存</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="fetchOrderVisible" title="拉取订单" width="480px">
|
||||
<el-alert
|
||||
type="info"
|
||||
:closable="false"
|
||||
show-icon
|
||||
title="按店铺所属商家逐平台分区拉取;下拉时间越长耗时越久。开启「自动拉取订单」后系统会按间隔定时拉取"
|
||||
class="fetch-order-tip"
|
||||
/>
|
||||
<el-form :model="fetchOrderForm" label-width="96px">
|
||||
<el-form-item label="店铺">
|
||||
<span>{{ fetchOrderShop?.name || '-' }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="拉取范围">
|
||||
<el-select v-model="fetchOrderForm.days" style="width: 100%">
|
||||
<el-option v-for="item in FETCH_ORDER_DAYS" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="fetchOrderVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="fetchOrderSubmitting" @click="submitFetchOrder">开始拉取</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
@ -394,6 +592,19 @@ onMounted(fetchList)
|
||||
justify-content: space-between;
|
||||
font-weight: 600;
|
||||
}
|
||||
.last-sync {
|
||||
margin-top: 2px;
|
||||
font-size: 11px;
|
||||
color: var(--el-text-color-secondary);
|
||||
cursor: default;
|
||||
}
|
||||
.fetch-order-tip {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.sync-msg {
|
||||
margin-left: 6px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
.search-bar {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
@ -402,12 +613,14 @@ onMounted(fetchList)
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.fill-table {
|
||||
height: 100%;
|
||||
}
|
||||
.code-tip {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.form-tip {
|
||||
margin-left: 8px;
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
.detail-tabs {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { QuestionFilled } from '@element-plus/icons-vue'
|
||||
import {
|
||||
getShopProducts,
|
||||
updateShopProduct,
|
||||
bindShopProduct,
|
||||
deleteShopProduct,
|
||||
BIND_TYPES,
|
||||
type ShopProductItem,
|
||||
} from '@/api/shopProduct'
|
||||
import { pullExternalPrintShopProducts } from '@/api/externalPrintAccount'
|
||||
import { getShops, type ShopItem } from '@/api/shop'
|
||||
import { getProducts, type ProductItem } from '@/api/product'
|
||||
import { getComboProducts, type ComboProductItem } from '@/api/comboProduct'
|
||||
@ -29,16 +29,30 @@ const query = reactive({
|
||||
bind_type: '' as string | number,
|
||||
status: '' as string | number,
|
||||
keyword: '',
|
||||
/** 快速筛选:只看有订单但未绑定系统商品的店铺商品 */
|
||||
has_unbound_order: false,
|
||||
})
|
||||
|
||||
const { loading, list, total, elapsed, fetchList, search, handlePageChange, handleSizeChange } = useListPage({
|
||||
query,
|
||||
fetcher: () => {
|
||||
const params: Record<string, unknown> = { ...query }
|
||||
const params: Record<string, unknown> = {
|
||||
page: query.page,
|
||||
pageSize: query.pageSize,
|
||||
shop_id: query.shop_id,
|
||||
bind_type: query.bind_type,
|
||||
status: query.status,
|
||||
keyword: query.keyword,
|
||||
}
|
||||
if (!params.keyword) delete params.keyword
|
||||
if (params.shop_id === '') delete params.shop_id
|
||||
if (params.bind_type === '') delete params.bind_type
|
||||
if (params.status === '') delete params.status
|
||||
// 只看有订单未绑定时,绑定状态必然是「未绑定」,避免两个条件互相打架
|
||||
if (query.has_unbound_order) {
|
||||
params.has_unbound_order = 1
|
||||
params.bind_type = 0
|
||||
}
|
||||
return getShopProducts(params)
|
||||
},
|
||||
})
|
||||
@ -57,145 +71,209 @@ function reset() {
|
||||
query.bind_type = ''
|
||||
query.status = ''
|
||||
query.keyword = ''
|
||||
query.has_unbound_order = false
|
||||
search()
|
||||
}
|
||||
|
||||
/** 切换「有订单未绑定」快速筛选后立即查询 */
|
||||
function toggleUnboundOrderFilter() {
|
||||
query.page = 1
|
||||
search()
|
||||
}
|
||||
|
||||
/** 导出筛选条件(与列表筛选同源) */
|
||||
const exportFilters = computed(() => ({
|
||||
shop_id: query.shop_id,
|
||||
bind_type: query.bind_type,
|
||||
bind_type: query.has_unbound_order ? 0 : query.bind_type,
|
||||
status: query.status,
|
||||
keyword: query.keyword.trim(),
|
||||
has_unbound_order: query.has_unbound_order ? 1 : '',
|
||||
}))
|
||||
|
||||
/* -------------------- 编辑 -------------------- */
|
||||
const dialogVisible = ref(false)
|
||||
const submitting = ref(false)
|
||||
const formRef = ref<FormInstance>()
|
||||
const editId = ref<number | null>(null)
|
||||
const form = reactive({
|
||||
shop_id: '' as string | number,
|
||||
outer_item_id: '',
|
||||
outer_sku_id: '',
|
||||
title: '',
|
||||
outer_code: '',
|
||||
spec: '',
|
||||
price: 0,
|
||||
stock: 0,
|
||||
status: 1,
|
||||
})
|
||||
const rules: FormRules = {
|
||||
shop_id: [{ required: true, message: '请选择店铺', trigger: 'change' }],
|
||||
outer_item_id: [{ required: true, message: '请输入平台商品ID', trigger: 'blur' }],
|
||||
}
|
||||
|
||||
function openEdit(row: ShopProductItem) {
|
||||
editId.value = row.id
|
||||
form.shop_id = row.shop_id
|
||||
form.outer_item_id = row.outer_item_id
|
||||
form.outer_sku_id = row.outer_sku_id || ''
|
||||
form.title = row.title || ''
|
||||
form.outer_code = row.outer_code || ''
|
||||
form.spec = row.spec || ''
|
||||
form.price = Number(row.price) || 0
|
||||
form.stock = Number(row.stock) || 0
|
||||
form.status = row.status
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
async function submitForm() {
|
||||
if (!formRef.value || editId.value == null) return
|
||||
// 提前取出 id:回调内无法沿用外层的 null 收窄
|
||||
const id = editId.value
|
||||
await formRef.value.validate(async (valid) => {
|
||||
if (!valid) return
|
||||
submitting.value = true
|
||||
try {
|
||||
const payload = {
|
||||
shop_id: Number(form.shop_id),
|
||||
outer_item_id: form.outer_item_id,
|
||||
outer_sku_id: form.outer_sku_id,
|
||||
title: form.title,
|
||||
outer_code: form.outer_code,
|
||||
spec: form.spec,
|
||||
price: form.price,
|
||||
stock: form.stock,
|
||||
status: form.status,
|
||||
}
|
||||
await updateShopProduct(id, payload)
|
||||
ElMessage.success('保存成功')
|
||||
dialogVisible.value = false
|
||||
await fetchList()
|
||||
} catch {
|
||||
// 拦截器已提示
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/* -------------------- 绑定商品 -------------------- */
|
||||
const bindVisible = ref(false)
|
||||
const bindSubmitting = ref(false)
|
||||
const bindId = ref<number | null>(null)
|
||||
const bindForm = reactive({
|
||||
bind_type: BIND_TYPES.none as number,
|
||||
product_id: null as number | null,
|
||||
combo_product_id: null as number | null,
|
||||
const bindRow = ref<ShopProductItem | null>(null)
|
||||
const bindTab = ref<'product' | 'combo'>('product')
|
||||
/** 弹窗内容区高度:按视口计算,保证表格内部滚动、底部按钮始终可见 */
|
||||
const bindBodyHeight = ref(420)
|
||||
|
||||
function updateBindBodyHeight() {
|
||||
bindBodyHeight.value = Math.min(560, Math.max(220, Math.round(window.innerHeight * 0.6)))
|
||||
}
|
||||
/** 正在绑定的行(`p<id>` / `c<id>`),用于展示行内 loading */
|
||||
const bindingKey = ref('')
|
||||
|
||||
const productQuery = reactive({ page: 1, pageSize: DEFAULT_PAGE_SIZE, keyword: '', status: '' as string | number })
|
||||
const productList = ref<ProductItem[]>([])
|
||||
const productTotal = ref(0)
|
||||
const productLoading = ref(false)
|
||||
const productElapsed = ref<number | null>(null)
|
||||
|
||||
const comboQuery = reactive({ page: 1, pageSize: DEFAULT_PAGE_SIZE, keyword: '', status: '' as string | number })
|
||||
const comboList = ref<ComboProductItem[]>([])
|
||||
const comboTotal = ref(0)
|
||||
const comboLoading = ref(false)
|
||||
const comboElapsed = ref<number | null>(null)
|
||||
|
||||
/** 当前店铺商品的绑定信息 */
|
||||
const currentBindLabel = computed(() => {
|
||||
const row = bindRow.value
|
||||
if (!row) return '-'
|
||||
if (row.bind_type === BIND_TYPES.product) return `系统商品:${row.product?.item_name || `#${row.product_id}`}`
|
||||
if (row.bind_type === BIND_TYPES.combo) return `组合商品:${row.comboProduct?.name || `#${row.combo_product_id}`}`
|
||||
return '未绑定'
|
||||
})
|
||||
const products = ref<ProductItem[]>([])
|
||||
const combos = ref<ComboProductItem[]>([])
|
||||
|
||||
/** 系统商品 / 组合商品下拉(几百条,虚拟滚动) */
|
||||
const productSelectOptions = computed(() =>
|
||||
products.value.map((p) => ({ label: `${p.item_code} ${p.item_name}`, value: p.id })),
|
||||
)
|
||||
const comboSelectOptions = computed(() =>
|
||||
combos.value.map((c) => ({ label: `${c.code} ${c.name}`, value: c.id })),
|
||||
)
|
||||
|
||||
async function loadOptions() {
|
||||
async function loadProducts() {
|
||||
productLoading.value = true
|
||||
const started = performance.now()
|
||||
try {
|
||||
const [p, c] = await Promise.all([
|
||||
getProducts({ page: 1, pageSize: 200 }),
|
||||
getComboProducts({ page: 1, pageSize: 200 }),
|
||||
])
|
||||
products.value = p.list
|
||||
combos.value = c.list
|
||||
const params: Record<string, unknown> = { page: productQuery.page, pageSize: productQuery.pageSize }
|
||||
const keyword = productQuery.keyword.trim()
|
||||
if (keyword) params.keyword = keyword
|
||||
if (productQuery.status !== '') params.status = productQuery.status
|
||||
const res = await getProducts(params)
|
||||
productList.value = res.list
|
||||
productTotal.value = res.total
|
||||
} catch {
|
||||
products.value = []
|
||||
combos.value = []
|
||||
productList.value = []
|
||||
productTotal.value = 0
|
||||
} finally {
|
||||
productElapsed.value = Math.round(performance.now() - started)
|
||||
productLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function loadCombos() {
|
||||
comboLoading.value = true
|
||||
const started = performance.now()
|
||||
try {
|
||||
const params: Record<string, unknown> = { page: comboQuery.page, pageSize: comboQuery.pageSize }
|
||||
const keyword = comboQuery.keyword.trim()
|
||||
if (keyword) params.keyword = keyword
|
||||
if (comboQuery.status !== '') params.status = comboQuery.status
|
||||
const res = await getComboProducts(params)
|
||||
comboList.value = res.list
|
||||
comboTotal.value = res.total
|
||||
} catch {
|
||||
comboList.value = []
|
||||
comboTotal.value = 0
|
||||
} finally {
|
||||
comboElapsed.value = Math.round(performance.now() - started)
|
||||
comboLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function searchProducts() {
|
||||
productQuery.page = 1
|
||||
loadProducts()
|
||||
}
|
||||
|
||||
function resetProductQuery() {
|
||||
productQuery.keyword = ''
|
||||
productQuery.status = ''
|
||||
productQuery.page = 1
|
||||
loadProducts()
|
||||
}
|
||||
|
||||
function searchCombos() {
|
||||
comboQuery.page = 1
|
||||
loadCombos()
|
||||
}
|
||||
|
||||
function resetComboQuery() {
|
||||
comboQuery.keyword = ''
|
||||
comboQuery.status = ''
|
||||
comboQuery.page = 1
|
||||
loadCombos()
|
||||
}
|
||||
|
||||
function onProductPageChange(page: number) {
|
||||
productQuery.page = page
|
||||
loadProducts()
|
||||
}
|
||||
|
||||
function onProductSizeChange(size: number) {
|
||||
productQuery.pageSize = size
|
||||
productQuery.page = 1
|
||||
loadProducts()
|
||||
}
|
||||
|
||||
function onComboPageChange(page: number) {
|
||||
comboQuery.page = page
|
||||
loadCombos()
|
||||
}
|
||||
|
||||
function onComboSizeChange(size: number) {
|
||||
comboQuery.pageSize = size
|
||||
comboQuery.page = 1
|
||||
loadCombos()
|
||||
}
|
||||
|
||||
function openBind(row: ShopProductItem) {
|
||||
bindId.value = row.id
|
||||
bindForm.bind_type = row.bind_type
|
||||
bindForm.product_id = row.product_id
|
||||
bindForm.combo_product_id = row.combo_product_id
|
||||
bindRow.value = row
|
||||
bindTab.value = row.bind_type === BIND_TYPES.combo ? 'combo' : 'product'
|
||||
productQuery.keyword = ''
|
||||
productQuery.status = ''
|
||||
productQuery.page = 1
|
||||
comboQuery.keyword = ''
|
||||
comboQuery.status = ''
|
||||
comboQuery.page = 1
|
||||
bindVisible.value = true
|
||||
loadOptions()
|
||||
loadProducts()
|
||||
loadCombos()
|
||||
}
|
||||
|
||||
async function submitBind() {
|
||||
if (bindId.value == null) return
|
||||
if (bindForm.bind_type === BIND_TYPES.product && !bindForm.product_id) {
|
||||
ElMessage.warning('请选择要绑定的系统商品')
|
||||
return
|
||||
/** 当前行是否已绑定该商品/组合商品 */
|
||||
function isBoundProduct(row: ProductItem) {
|
||||
return bindRow.value?.bind_type === BIND_TYPES.product && Number(bindRow.value.product_id) === Number(row.id)
|
||||
}
|
||||
|
||||
function isBoundCombo(row: ComboProductItem) {
|
||||
return bindRow.value?.bind_type === BIND_TYPES.combo && Number(bindRow.value.combo_product_id) === Number(row.id)
|
||||
}
|
||||
|
||||
/** 直接把店铺商品绑定到选中的系统商品 / 组合商品 */
|
||||
async function bindTo(targetType: number, targetId: number) {
|
||||
if (bindId.value == null || bindingKey.value) return
|
||||
bindingKey.value = `${targetType === BIND_TYPES.combo ? 'c' : 'p'}${targetId}`
|
||||
bindSubmitting.value = true
|
||||
try {
|
||||
await bindShopProduct(bindId.value, {
|
||||
bind_type: targetType,
|
||||
product_id: targetType === BIND_TYPES.product ? targetId : null,
|
||||
combo_product_id: targetType === BIND_TYPES.combo ? targetId : null,
|
||||
})
|
||||
ElMessage.success('绑定成功')
|
||||
bindVisible.value = false
|
||||
await fetchList()
|
||||
} catch {
|
||||
// 拦截器已提示
|
||||
} finally {
|
||||
bindingKey.value = ''
|
||||
bindSubmitting.value = false
|
||||
}
|
||||
if (bindForm.bind_type === BIND_TYPES.combo && !bindForm.combo_product_id) {
|
||||
ElMessage.warning('请选择要绑定的组合商品')
|
||||
}
|
||||
|
||||
/** 解除当前店铺商品的绑定 */
|
||||
async function unbind() {
|
||||
if (bindId.value == null) return
|
||||
try {
|
||||
await ElMessageBox.confirm('确认解除当前绑定?', '解绑确认', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '解绑',
|
||||
cancelButtonText: '取消',
|
||||
})
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
bindSubmitting.value = true
|
||||
try {
|
||||
const payload = {
|
||||
bind_type: bindForm.bind_type,
|
||||
product_id: bindForm.bind_type === BIND_TYPES.product ? bindForm.product_id : null,
|
||||
combo_product_id: bindForm.bind_type === BIND_TYPES.combo ? bindForm.combo_product_id : null,
|
||||
}
|
||||
await bindShopProduct(bindId.value, payload)
|
||||
ElMessage.success(bindForm.bind_type === BIND_TYPES.none ? '已解绑' : '绑定成功')
|
||||
await bindShopProduct(bindId.value, { bind_type: BIND_TYPES.none, product_id: null, combo_product_id: null })
|
||||
ElMessage.success('已解绑')
|
||||
bindVisible.value = false
|
||||
await fetchList()
|
||||
} catch {
|
||||
@ -205,25 +283,6 @@ async function submitBind() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDelete(row: ShopProductItem) {
|
||||
try {
|
||||
await ElMessageBox.confirm(`确认删除店铺商品「${row.title || row.outer_item_id}」?`, '删除确认', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '删除',
|
||||
cancelButtonText: '取消',
|
||||
})
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
try {
|
||||
await deleteShopProduct(row.id)
|
||||
ElMessage.success('已删除')
|
||||
await fetchList()
|
||||
} catch {
|
||||
// 拦截器已提示
|
||||
}
|
||||
}
|
||||
|
||||
/** 已绑定的商品名称 */
|
||||
function boundName(row: ShopProductItem) {
|
||||
if (row.bind_type === BIND_TYPES.product) return row.product?.item_name || `商品#${row.product_id}`
|
||||
@ -231,18 +290,80 @@ function boundName(row: ShopProductItem) {
|
||||
return '-'
|
||||
}
|
||||
|
||||
/* -------------------- 按平台商品ID补拉 -------------------- */
|
||||
const pullVisible = ref(false)
|
||||
const pullSubmitting = ref(false)
|
||||
const pullForm = reactive({
|
||||
shop_id: '' as string | number,
|
||||
outer_item_id: '',
|
||||
outer_sku_id: '',
|
||||
})
|
||||
|
||||
/** 只允许选择外部打单平台商家店铺(其它类型没有平台商品可拉) */
|
||||
const externalShops = computed(() => shops.value.filter((shop) => Number(shop.type) === 2))
|
||||
|
||||
function openPull() {
|
||||
pullForm.shop_id = query.shop_id !== '' ? query.shop_id : (externalShops.value[0]?.id ?? '')
|
||||
pullForm.outer_item_id = ''
|
||||
pullForm.outer_sku_id = ''
|
||||
pullVisible.value = true
|
||||
}
|
||||
|
||||
async function submitPull() {
|
||||
const shop = shops.value.find((item) => Number(item.id) === Number(pullForm.shop_id))
|
||||
const outerItemId = pullForm.outer_item_id.trim()
|
||||
if (!shop) {
|
||||
ElMessage.warning('请选择外部打单平台店铺')
|
||||
return
|
||||
}
|
||||
if (!shop.external_print_account_id) {
|
||||
ElMessage.warning('该店铺未关联外部打单账号,无法拉取商品')
|
||||
return
|
||||
}
|
||||
if (!outerItemId) {
|
||||
ElMessage.warning('请输入平台商品ID')
|
||||
return
|
||||
}
|
||||
|
||||
pullSubmitting.value = true
|
||||
try {
|
||||
const res = await pullExternalPrintShopProducts(shop.external_print_account_id, shop.id, [
|
||||
{ outer_item_id: outerItemId, outer_sku_id: pullForm.outer_sku_id.trim() },
|
||||
])
|
||||
if (!res.matched) {
|
||||
const reason = res.missing[0]?.reason || '平台未查询到该商品'
|
||||
ElMessage.warning(`未拉取到商品:${reason}`)
|
||||
return
|
||||
}
|
||||
ElMessage.success(`拉取成功:新增 ${res.created},更新 ${res.updated},来源 ${res.hosts.join('、')}`)
|
||||
pullVisible.value = false
|
||||
await fetchList()
|
||||
} catch {
|
||||
// 拦截器已提示
|
||||
} finally {
|
||||
pullSubmitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
updateBindBodyHeight()
|
||||
window.addEventListener('resize', updateBindBodyHeight)
|
||||
await fetchShops()
|
||||
await fetchList()
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('resize', updateBindBodyHeight)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-card>
|
||||
<el-card class="shop-product-card">
|
||||
<template #header>
|
||||
<div class="page-header">
|
||||
<span>店铺商品</span>
|
||||
<div class="header-actions">
|
||||
<el-button @click="openPull">按商品ID拉取</el-button>
|
||||
<ExportButton type="shop_product" :filters="exportFilters" />
|
||||
</div>
|
||||
</div>
|
||||
@ -269,7 +390,13 @@ onMounted(async () => {
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="绑定状态">
|
||||
<el-select v-model="query.bind_type" placeholder="全部" clearable style="width: 130px">
|
||||
<el-select
|
||||
v-model="query.bind_type"
|
||||
placeholder="全部"
|
||||
clearable
|
||||
:disabled="query.has_unbound_order"
|
||||
style="width: 130px"
|
||||
>
|
||||
<el-option label="未绑定" :value="0" />
|
||||
<el-option label="系统商品" :value="1" />
|
||||
<el-option label="组合商品" :value="2" />
|
||||
@ -285,12 +412,31 @@ onMounted(async () => {
|
||||
<el-button type="primary" @click="search">查询</el-button>
|
||||
<el-button @click="reset">重置</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-checkbox
|
||||
v-model="query.has_unbound_order"
|
||||
class="unbound-filter"
|
||||
@change="toggleUnboundOrderFilter"
|
||||
>
|
||||
只看有订单未绑定
|
||||
</el-checkbox>
|
||||
<el-tooltip
|
||||
content="商品的订单里还有未绑定系统商品的明细,绑定后订单明细会自动关联"
|
||||
placement="top"
|
||||
>
|
||||
<el-icon class="unbound-hint"><QuestionFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<DataTable :loading="loading" :data="list">
|
||||
<div class="list-table-wrap">
|
||||
<DataTable :loading="loading" :data="list" height="100%">
|
||||
<el-table-column label="店铺" width="140">
|
||||
<template #default="{ row }">{{ row.shop?.name || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="平台类型" width="110">
|
||||
<template #default="{ row }">{{ row.platform_type || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="outer_item_id" label="平台商品ID" width="140" />
|
||||
<el-table-column prop="outer_sku_id" label="规格ID" width="120">
|
||||
<template #default="{ row }">{{ row.outer_sku_id || '-' }}</template>
|
||||
@ -311,6 +457,14 @@ onMounted(async () => {
|
||||
<span v-if="row.bind_type !== 0" class="bound-name">{{ boundName(row) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="待处理订单" width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.unbound_order_count" type="danger" size="small">
|
||||
{{ row.unbound_order_count }} 单待绑定
|
||||
</el-tag>
|
||||
<span v-else class="muted">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" width="90">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.status === 1 ? 'success' : 'info'" size="small">
|
||||
@ -318,14 +472,13 @@ onMounted(async () => {
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="180" fixed="right">
|
||||
<el-table-column label="操作" width="100" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="openEdit(row)">编辑</el-button>
|
||||
<el-button link type="warning" @click="openBind(row)">绑定</el-button>
|
||||
<el-button link type="danger" @click="handleDelete(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</DataTable>
|
||||
</DataTable>
|
||||
</div>
|
||||
|
||||
<ListPager
|
||||
:total="total"
|
||||
@ -336,89 +489,204 @@ onMounted(async () => {
|
||||
@size-change="handleSizeChange"
|
||||
/>
|
||||
|
||||
<el-dialog v-model="dialogVisible" title="编辑店铺商品" width="560px">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="110px">
|
||||
<el-form-item label="店铺" prop="shop_id">
|
||||
<el-dialog v-model="pullVisible" title="按平台商品ID拉取" width="520px">
|
||||
<el-alert
|
||||
type="info"
|
||||
:closable="false"
|
||||
show-icon
|
||||
title="用于订单明细匹配不到店铺商品时补拉:填平台商品ID(可选规格ID),后端按店铺分区及其它域名查询后写入店铺商品"
|
||||
class="pull-tip"
|
||||
/>
|
||||
<el-form :model="pullForm" label-width="100px">
|
||||
<el-form-item label="店铺" required>
|
||||
<VirtualSelect
|
||||
v-model="form.shop_id"
|
||||
:options="shops"
|
||||
v-model="pullForm.shop_id"
|
||||
:options="externalShops"
|
||||
label-key="name"
|
||||
value-key="id"
|
||||
placeholder="请选择店铺"
|
||||
placeholder="请选择外部打单平台店铺"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="平台商品ID" prop="outer_item_id">
|
||||
<el-input v-model="form.outer_item_id" placeholder="平台侧商品ID" />
|
||||
<el-form-item label="平台商品ID" required>
|
||||
<el-input v-model="pullForm.outer_item_id" placeholder="订单明细的 outer_item_id" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="规格ID" prop="outer_sku_id">
|
||||
<el-input v-model="form.outer_sku_id" placeholder="无规格时留空" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商品标题" prop="title">
|
||||
<el-input v-model="form.title" placeholder="选填" />
|
||||
</el-form-item>
|
||||
<el-form-item label="商家编码" prop="outer_code">
|
||||
<el-input v-model="form.outer_code" placeholder="用于与系统商品匹配" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规格" prop="spec">
|
||||
<el-input v-model="form.spec" placeholder="选填" />
|
||||
</el-form-item>
|
||||
<el-form-item label="售价" prop="price">
|
||||
<el-input-number v-model="form.price" :min="0" :precision="2" style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="库存" prop="stock">
|
||||
<el-input-number v-model="form.stock" :min="0" :precision="0" style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="form.status" style="width: 100%">
|
||||
<el-option label="在售" :value="1" />
|
||||
<el-option label="下架" :value="0" />
|
||||
</el-select>
|
||||
<el-form-item label="平台规格ID">
|
||||
<el-input v-model="pullForm.outer_sku_id" placeholder="留空则拉取该商品的全部规格" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="submitting" @click="submitForm">保存</el-button>
|
||||
<el-button @click="pullVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="pullSubmitting" @click="submitPull">拉取</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="bindVisible" title="绑定商品" width="520px">
|
||||
<el-form :model="bindForm" label-width="110px">
|
||||
<el-form-item label="绑定类型">
|
||||
<el-select v-model="bindForm.bind_type" style="width: 100%">
|
||||
<el-option label="未绑定(解绑)" :value="0" />
|
||||
<el-option label="系统商品" :value="1" />
|
||||
<el-option label="组合商品" :value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="bindForm.bind_type === 1" label="系统商品">
|
||||
<VirtualSelect
|
||||
v-model="bindForm.product_id"
|
||||
:options="productSelectOptions"
|
||||
filterable
|
||||
placeholder="请选择系统商品"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="bindForm.bind_type === 2" label="组合商品">
|
||||
<VirtualSelect
|
||||
v-model="bindForm.combo_product_id"
|
||||
:options="comboSelectOptions"
|
||||
filterable
|
||||
placeholder="请选择组合商品"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-dialog
|
||||
v-model="bindVisible"
|
||||
title="绑定商品"
|
||||
width="min(1100px, 94vw)"
|
||||
top="5vh"
|
||||
class="bind-dialog"
|
||||
destroy-on-close
|
||||
>
|
||||
<div class="bind-layout" :style="{ height: `${bindBodyHeight}px` }">
|
||||
<el-tabs v-model="bindTab" tab-position="left" class="bind-tabs">
|
||||
<el-tab-pane label="系统商品" name="product">
|
||||
<div class="bind-pane">
|
||||
<div class="bind-filters">
|
||||
<el-input
|
||||
v-model="productQuery.keyword"
|
||||
placeholder="商品编码 / 名称"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter="searchProducts"
|
||||
/>
|
||||
<el-select v-model="productQuery.status" placeholder="状态" clearable style="width: 120px">
|
||||
<el-option label="上架" :value="1" />
|
||||
<el-option label="下架" :value="0" />
|
||||
</el-select>
|
||||
<el-button type="primary" @click="searchProducts">查询</el-button>
|
||||
<el-button @click="resetProductQuery">重置</el-button>
|
||||
</div>
|
||||
<div class="bind-table">
|
||||
<DataTable :loading="productLoading" :data="productList" height="100%">
|
||||
<el-table-column prop="item_code" label="商品编码" width="150" />
|
||||
<el-table-column prop="item_name" label="商品名称" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="sku_property" label="规格" width="140">
|
||||
<template #default="{ row }">{{ row.sku_property || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="stock_unit" label="单位" width="80">
|
||||
<template #default="{ row }">{{ row.stock_unit || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="零售价" width="100" align="right">
|
||||
<template #default="{ row }">{{ row.retail_price ?? '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" width="80">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.status === 1 ? 'success' : 'info'" size="small">
|
||||
{{ row.status === 1 ? '上架' : '下架' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
:disabled="isBoundProduct(row) || !!bindingKey"
|
||||
:loading="bindingKey === `p${row.id}`"
|
||||
@click="bindTo(BIND_TYPES.product, row.id)"
|
||||
>
|
||||
{{ isBoundProduct(row) ? '已绑定' : '绑定' }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</DataTable>
|
||||
</div>
|
||||
<ListPager
|
||||
:total="productTotal"
|
||||
:elapsed="productElapsed"
|
||||
:page="productQuery.page"
|
||||
:page-size="productQuery.pageSize"
|
||||
@page-change="onProductPageChange"
|
||||
@size-change="onProductSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="组合商品" name="combo">
|
||||
<div class="bind-pane">
|
||||
<div class="bind-filters">
|
||||
<el-input
|
||||
v-model="comboQuery.keyword"
|
||||
placeholder="组合编码 / 名称"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter="searchCombos"
|
||||
/>
|
||||
<el-select v-model="comboQuery.status" placeholder="状态" clearable style="width: 120px">
|
||||
<el-option label="上架" :value="1" />
|
||||
<el-option label="下架" :value="0" />
|
||||
</el-select>
|
||||
<el-button type="primary" @click="searchCombos">查询</el-button>
|
||||
<el-button @click="resetComboQuery">重置</el-button>
|
||||
</div>
|
||||
<div class="bind-table">
|
||||
<DataTable :loading="comboLoading" :data="comboList" height="100%">
|
||||
<el-table-column prop="code" label="组合编码" width="160" />
|
||||
<el-table-column prop="name" label="组合名称" min-width="220" show-overflow-tooltip />
|
||||
<el-table-column label="价格" width="110" align="right">
|
||||
<template #default="{ row }">{{ row.price }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" width="80">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.status === 1 ? 'success' : 'info'" size="small">
|
||||
{{ row.status === 1 ? '上架' : '下架' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
:disabled="isBoundCombo(row) || !!bindingKey"
|
||||
:loading="bindingKey === `c${row.id}`"
|
||||
@click="bindTo(BIND_TYPES.combo, row.id)"
|
||||
>
|
||||
{{ isBoundCombo(row) ? '已绑定' : '绑定' }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</DataTable>
|
||||
</div>
|
||||
<ListPager
|
||||
:total="comboTotal"
|
||||
:elapsed="comboElapsed"
|
||||
:page="comboQuery.page"
|
||||
:page-size="comboQuery.pageSize"
|
||||
@page-change="onComboPageChange"
|
||||
@size-change="onComboSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="bindVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="bindSubmitting" @click="submitBind">确定</el-button>
|
||||
<div class="bind-footer">
|
||||
<span class="bind-current">当前绑定:{{ currentBindLabel }}</span>
|
||||
<div>
|
||||
<el-button
|
||||
v-if="bindRow && bindRow.bind_type !== BIND_TYPES.none"
|
||||
:loading="bindSubmitting"
|
||||
@click="unbind"
|
||||
>
|
||||
解绑
|
||||
</el-button>
|
||||
<el-button @click="bindVisible = false">关闭</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 整页撑满可视区域:头部与筛选固定,只有表格主体滚动,分页固定在底部 */
|
||||
.shop-product-card {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.shop-product-card :deep(.el-card__body) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
.page-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -426,9 +694,75 @@ onMounted(async () => {
|
||||
font-weight: 600;
|
||||
}
|
||||
.search-bar {
|
||||
margin-bottom: 16px;
|
||||
flex: 0 0 auto;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.list-table-wrap {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
.bound-name {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.unbound-filter {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.unbound-hint {
|
||||
margin-left: 4px;
|
||||
font-size: 13px;
|
||||
color: var(--el-text-color-secondary);
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.muted {
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.pull-tip {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
/* 绑定弹窗:左侧页签 + 右侧列表(表格内部滚动,分页固定在底部) */
|
||||
.bind-layout {
|
||||
/* 高度由脚本按视口计算(bindBodyHeight),避免小屏溢出 */
|
||||
overflow: hidden;
|
||||
}
|
||||
.bind-tabs {
|
||||
height: 100%;
|
||||
}
|
||||
.bind-tabs :deep(.el-tabs__content) {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.bind-tabs :deep(.el-tab-pane) {
|
||||
height: 100%;
|
||||
}
|
||||
.bind-pane {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
padding-left: 12px;
|
||||
}
|
||||
.bind-filters {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-bottom: 10px;
|
||||
padding-right: 12px;
|
||||
}
|
||||
.bind-table {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
.bind-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.bind-current {
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user