mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 21:49:18 +08:00
feat: 新增拼多多商品关联内部商品
This commit is contained in:
@@ -19,12 +19,14 @@ import { getPddShopPageApi } from '#/api/channel/pdd/shop';
|
||||
|
||||
import PddGoodsDetailDrawer from './components/PddGoodsDetailDrawer.vue';
|
||||
import PddShopDetailModal from '#/views/channel/pdd/shop/components/PddShopDetailModal.vue';
|
||||
import ProductDetailDrawer from '#/views/ec/product/list/components/ProductDetailDrawer.vue';
|
||||
|
||||
defineOptions({ name: 'PddGoodsManagement' });
|
||||
|
||||
const loading = ref(false);
|
||||
const detailDrawerRef = ref<InstanceType<typeof PddGoodsDetailDrawer>>();
|
||||
const shopDetailModalRef = ref<InstanceType<typeof PddShopDetailModal>>();
|
||||
const productDetailDrawerRef = ref<InstanceType<typeof ProductDetailDrawer>>();
|
||||
const shopOptions = ref<{ label: string; value: number }[]>([]);
|
||||
const shopNameById = ref<Record<number, string>>({});
|
||||
|
||||
@@ -88,6 +90,12 @@ const gridOptions: VxeGridProps<PddGoodsVO.Info> = {
|
||||
showOverflow: 'tooltip' as const,
|
||||
slots: { default: 'shop' },
|
||||
},
|
||||
{
|
||||
title: '内部商品',
|
||||
minWidth: 140,
|
||||
showOverflow: 'tooltip' as const,
|
||||
slots: { default: 'productName' },
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
width: 90,
|
||||
@@ -295,6 +303,14 @@ function openShopDetail(row: PddGoodsVO.Info) {
|
||||
shopDetailModalRef.value?.open(row.shopId);
|
||||
}
|
||||
|
||||
async function openInternalProduct(row: PddGoodsVO.Info) {
|
||||
if (!row.productId) {
|
||||
message.warning('未关联内部商品');
|
||||
return;
|
||||
}
|
||||
await productDetailDrawerRef.value?.openById(row.productId, row.productName);
|
||||
}
|
||||
|
||||
async function handleDelete(row: PddGoodsVO.Info) {
|
||||
try {
|
||||
await deletePddGoodsApi(row.id);
|
||||
@@ -330,6 +346,19 @@ onMounted(async () => {
|
||||
</Button>
|
||||
</template>
|
||||
|
||||
<template #productName="{ row }: { row: PddGoodsVO.Info }">
|
||||
<Button
|
||||
v-if="row.productId"
|
||||
type="link"
|
||||
size="small"
|
||||
class="!px-0"
|
||||
@click="openInternalProduct(row)"
|
||||
>
|
||||
{{ row.productName || `商品#${row.productId}` }}
|
||||
</Button>
|
||||
<span v-else class="text-slate-400">-</span>
|
||||
</template>
|
||||
|
||||
<template #shop="{ row }: { row: PddGoodsVO.Info }">
|
||||
<Button
|
||||
v-if="row.shopId"
|
||||
@@ -370,8 +399,12 @@ onMounted(async () => {
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
<PddGoodsDetailDrawer ref="detailDrawerRef" />
|
||||
<PddGoodsDetailDrawer
|
||||
ref="detailDrawerRef"
|
||||
@open-internal-product="openInternalProduct"
|
||||
/>
|
||||
<PddShopDetailModal ref="shopDetailModalRef" />
|
||||
<ProductDetailDrawer ref="productDetailDrawerRef" />
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user