mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 03:49:19 +08:00
feat: 授权店铺内部店铺无logo自动同步
This commit is contained in:
@@ -20,10 +20,10 @@ export const overridesPreferences = defineOverridesPreferences({
|
||||
mode: 'light',
|
||||
},
|
||||
transition: {
|
||||
enable: false,
|
||||
name: 'fade',
|
||||
loading: false,
|
||||
progress: false,
|
||||
},
|
||||
logo: {
|
||||
source: '/cd-logo.png',
|
||||
},
|
||||
});
|
||||
});
|
||||
+123
-93
@@ -6,17 +6,22 @@ import type { Dayjs } from 'dayjs';
|
||||
import { computed, onBeforeUnmount, ref } from 'vue';
|
||||
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
Card,
|
||||
DatePicker,
|
||||
Descriptions,
|
||||
Drawer,
|
||||
Empty,
|
||||
Form,
|
||||
List,
|
||||
Modal,
|
||||
Progress,
|
||||
Radio,
|
||||
Space,
|
||||
Switch,
|
||||
Tag,
|
||||
Typography,
|
||||
message,
|
||||
} from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
@@ -414,53 +419,61 @@ defineExpose({ open, close: handleClose });
|
||||
:mask-closable="!hasActiveFullTask"
|
||||
@close="handleClose"
|
||||
>
|
||||
<div class="space-y-4">
|
||||
<!-- 增量 -->
|
||||
<div
|
||||
class="rounded border border-slate-200 p-3 dark:border-[hsl(240deg_3.7%_22%)]"
|
||||
>
|
||||
<div class="mb-2 flex items-center justify-between">
|
||||
<span class="text-sm font-medium">增量同步</span>
|
||||
<Tag :color="incHealthColor">{{ incHealthLabel }}</Tag>
|
||||
</div>
|
||||
<div class="mb-2 flex flex-wrap items-center gap-3">
|
||||
<Switch
|
||||
:checked="!!incremental?.enabled"
|
||||
checked-children="开"
|
||||
un-checked-children="关"
|
||||
@change="handleToggleIncremental"
|
||||
/>
|
||||
<span class="text-xs text-slate-500">开启后定时 Job 拉取增量并转换</span>
|
||||
<Button
|
||||
size="small"
|
||||
type="primary"
|
||||
ghost
|
||||
:loading="incSubmitting"
|
||||
@click="handleManualIncremental"
|
||||
>
|
||||
手动增量一次
|
||||
</Button>
|
||||
</div>
|
||||
<div
|
||||
class="grid grid-cols-1 gap-1 text-xs text-slate-600 sm:grid-cols-2 dark:text-slate-300"
|
||||
>
|
||||
<div>游标:{{ formatTime(incremental?.lastCursorAt) }}</div>
|
||||
<div>上次成功:{{ formatTime(incremental?.lastSuccessTime) }}</div>
|
||||
</div>
|
||||
<p v-if="incremental?.lastError" class="mt-2 text-xs text-red-500">
|
||||
{{ incremental.lastError }}
|
||||
</p>
|
||||
<p class="mt-2 text-xs text-slate-500">
|
||||
手动增量按订单更新时间拉取自上次游标以来的变更,用于发货/售后等状态同步。
|
||||
</p>
|
||||
</div>
|
||||
<Space direction="vertical" :size="16" class="w-full">
|
||||
<Card size="small">
|
||||
<template #title>
|
||||
<Space>
|
||||
<span>增量同步</span>
|
||||
<Tag :color="incHealthColor">{{ incHealthLabel }}</Tag>
|
||||
</Space>
|
||||
</template>
|
||||
<Space direction="vertical" :size="12" class="w-full">
|
||||
<Space wrap align="center">
|
||||
<Switch
|
||||
:checked="!!incremental?.enabled"
|
||||
checked-children="开"
|
||||
un-checked-children="关"
|
||||
@change="handleToggleIncremental"
|
||||
/>
|
||||
<Typography.Text type="secondary">
|
||||
开启后定时 Job 拉取增量并转换
|
||||
</Typography.Text>
|
||||
<Button
|
||||
size="small"
|
||||
type="primary"
|
||||
ghost
|
||||
:loading="incSubmitting"
|
||||
@click="handleManualIncremental"
|
||||
>
|
||||
手动增量一次
|
||||
</Button>
|
||||
</Space>
|
||||
|
||||
<!-- 全量任务列表 -->
|
||||
<div
|
||||
class="rounded border border-slate-200 p-3 dark:border-[hsl(240deg_3.7%_22%)]"
|
||||
>
|
||||
<div class="mb-3 flex items-center justify-between gap-2">
|
||||
<span class="text-sm font-medium">全量同步任务</span>
|
||||
<Descriptions bordered size="small" :column="1">
|
||||
<Descriptions.Item label="游标">
|
||||
{{ formatTime(incremental?.lastCursorAt) }}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="上次成功">
|
||||
{{ formatTime(incremental?.lastSuccessTime) }}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
|
||||
<Alert
|
||||
v-if="incremental?.lastError"
|
||||
type="error"
|
||||
show-icon
|
||||
:message="incremental.lastError"
|
||||
/>
|
||||
<Alert
|
||||
type="info"
|
||||
show-icon
|
||||
message="手动增量按订单更新时间拉取自上次游标以来的变更,用于发货/售后等状态同步。"
|
||||
/>
|
||||
</Space>
|
||||
</Card>
|
||||
|
||||
<Card size="small" title="全量同步任务">
|
||||
<template #extra>
|
||||
<Space size="small">
|
||||
<Button size="small" :loading="listLoading" @click="loadFullTasks">
|
||||
刷新
|
||||
@@ -474,28 +487,19 @@ defineExpose({ open, close: handleClose });
|
||||
创建全量任务
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div v-if="fullTasks.length > 0" class="max-h-[52vh] space-y-3 overflow-y-auto pr-1">
|
||||
<div
|
||||
v-for="task in fullTasks"
|
||||
:key="task.id"
|
||||
class="rounded border border-slate-100 p-3 dark:border-[hsl(240deg_3.7%_18%)]"
|
||||
>
|
||||
<div class="mb-2 flex flex-wrap items-center justify-between gap-2">
|
||||
<div class="flex flex-wrap items-center gap-2 text-sm">
|
||||
<span class="font-medium">#{{ task.id }}</span>
|
||||
<Tag :color="statusTag(task.status).color">
|
||||
{{ statusTag(task.status).text }}
|
||||
</Tag>
|
||||
<span class="text-xs text-slate-500">
|
||||
{{ task.doneDays }}/{{ task.totalDays }} 天
|
||||
<template v-if="task.failedDays">
|
||||
· 失败日 {{ task.failedDays }}
|
||||
</template>
|
||||
</span>
|
||||
</div>
|
||||
<Space size="small">
|
||||
<List
|
||||
v-if="fullTasks.length > 0"
|
||||
:data-source="fullTasks"
|
||||
:loading="listLoading"
|
||||
item-layout="vertical"
|
||||
size="small"
|
||||
class="max-h-[52vh] overflow-y-auto"
|
||||
>
|
||||
<template #renderItem="{ item: task }">
|
||||
<List.Item>
|
||||
<template #actions>
|
||||
<Button
|
||||
v-if="isTaskActive(task)"
|
||||
size="small"
|
||||
@@ -515,41 +519,67 @@ defineExpose({ open, close: handleClose });
|
||||
>
|
||||
续跑
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
<div class="mb-2 text-xs text-slate-500">
|
||||
区间 {{ task.dateFrom }} ~ {{ task.dateTo }}
|
||||
<span v-if="task.currentDate"> · 当前 {{ task.currentDate }}</span>
|
||||
</div>
|
||||
<div class="mb-1 text-xs text-slate-400">
|
||||
创建 {{ formatTime(task.createTime) }}
|
||||
<template v-if="task.finishTime">
|
||||
· 结束 {{ formatTime(task.finishTime) }}
|
||||
</template>
|
||||
</div>
|
||||
<Progress
|
||||
v-if="isTaskActive(task) || task.status === 'SUCCESS'"
|
||||
:percent="taskProgressPercent(task)"
|
||||
size="small"
|
||||
:status="task.status === 'FAILED' ? 'exception' : undefined"
|
||||
/>
|
||||
<p v-if="task.lastError" class="mt-2 text-xs text-red-500">
|
||||
{{ task.lastError }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<List.Item.Meta>
|
||||
<template #title>
|
||||
<Space wrap>
|
||||
<span>#{{ task.id }}</span>
|
||||
<Tag :color="statusTag(task.status).color">
|
||||
{{ statusTag(task.status).text }}
|
||||
</Tag>
|
||||
<Typography.Text type="secondary">
|
||||
{{ task.doneDays }}/{{ task.totalDays }} 天
|
||||
<template v-if="task.failedDays">
|
||||
· 失败日 {{ task.failedDays }}
|
||||
</template>
|
||||
</Typography.Text>
|
||||
</Space>
|
||||
</template>
|
||||
<template #description>
|
||||
<div>
|
||||
区间 {{ task.dateFrom }} ~ {{ task.dateTo }}
|
||||
<template v-if="task.currentDate">
|
||||
· 当前 {{ task.currentDate }}
|
||||
</template>
|
||||
</div>
|
||||
<div>
|
||||
创建 {{ formatTime(task.createTime) }}
|
||||
<template v-if="task.finishTime">
|
||||
· 结束 {{ formatTime(task.finishTime) }}
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</List.Item.Meta>
|
||||
|
||||
<Progress
|
||||
v-if="isTaskActive(task) || task.status === 'SUCCESS'"
|
||||
:percent="taskProgressPercent(task)"
|
||||
size="small"
|
||||
:status="task.status === 'FAILED' ? 'exception' : undefined"
|
||||
/>
|
||||
<Alert
|
||||
v-if="task.lastError"
|
||||
class="mt-2"
|
||||
type="error"
|
||||
show-icon
|
||||
:message="task.lastError"
|
||||
/>
|
||||
</List.Item>
|
||||
</template>
|
||||
</List>
|
||||
<Empty
|
||||
v-else
|
||||
:image="Empty.PRESENTED_IMAGE_SIMPLE"
|
||||
description="暂无全量任务"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</Space>
|
||||
|
||||
<template #footer>
|
||||
<div class="flex justify-end">
|
||||
<Space class="w-full justify-end">
|
||||
<Button @click="handleClose">关闭</Button>
|
||||
</div>
|
||||
</Space>
|
||||
</template>
|
||||
</Drawer>
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import { getPddAuthorizeUrlApi } from '#/api/ecommerce/pdd/auth';
|
||||
import { batchPddOrderSyncStatusApi } from '#/api/ecommerce/pdd/order-sync';
|
||||
import { getPlatformListApi } from '#/api/ecommerce/platform';
|
||||
import { deleteShopApi, getShopPageApi } from '#/api/ecommerce/shop';
|
||||
import {
|
||||
getPlatformLabel,
|
||||
getPlatformTagColor,
|
||||
} from '#/utils/platform-display';
|
||||
|
||||
import PddOrderSyncDrawer from './components/PddOrderSyncDrawer.vue';
|
||||
import PddShopDetailModal from './components/PddShopDetailModal.vue';
|
||||
@@ -77,12 +81,14 @@ const gridOptions: VxeGridProps<any> = {
|
||||
{
|
||||
title: '外部店铺',
|
||||
minWidth: 180,
|
||||
align: 'center' as const,
|
||||
showOverflow: false,
|
||||
slots: { default: 'externalShop' },
|
||||
},
|
||||
{
|
||||
title: '订单同步',
|
||||
minWidth: 200,
|
||||
align: 'center' as const,
|
||||
showOverflow: false,
|
||||
slots: { default: 'orderSync' },
|
||||
},
|
||||
@@ -98,8 +104,9 @@ const gridOptions: VxeGridProps<any> = {
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 360,
|
||||
minWidth: 320,
|
||||
fixed: 'right' as const,
|
||||
showOverflow: false,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
@@ -450,21 +457,25 @@ onUnmounted(() => {
|
||||
</template>
|
||||
|
||||
<template #externalShop="{ row }: { row: ShopVO.Info }">
|
||||
<div v-if="isPddShop(row)" class="flex flex-col gap-1">
|
||||
<Tag v-if="hasExternalShop(row)" color="success" class="!mr-0 w-fit">
|
||||
已绑定
|
||||
<div v-if="isPddShop(row)" class="flex flex-col items-center gap-1">
|
||||
<Tag
|
||||
v-if="hasExternalShop(row)"
|
||||
:color="getPlatformTagColor(row.platformCode)"
|
||||
class="!mr-0 w-fit"
|
||||
>
|
||||
{{ getPlatformLabel(row.platformCode, row.platformName) }}
|
||||
</Tag>
|
||||
<Tag v-else color="default" class="!mr-0 w-fit">未授权</Tag>
|
||||
<span
|
||||
v-if="row.pddShop?.mallName"
|
||||
class="text-primary cursor-pointer text-xs hover:underline"
|
||||
class="text-primary cursor-pointer text-center text-xs hover:underline"
|
||||
@click="handleViewExternalShop(row)"
|
||||
>
|
||||
{{ row.pddShop.mallName }}
|
||||
</span>
|
||||
<span
|
||||
v-else-if="row.externalShopId"
|
||||
class="text-xs text-slate-500"
|
||||
class="text-center text-xs text-slate-500"
|
||||
>
|
||||
mall_id: {{ row.externalShopId }}
|
||||
</span>
|
||||
@@ -475,7 +486,7 @@ onUnmounted(() => {
|
||||
<template #orderSync="{ row }: { row: ShopVO.Info }">
|
||||
<div
|
||||
v-if="isPddShop(row) && hasExternalShop(row)"
|
||||
class="flex cursor-pointer flex-col gap-1"
|
||||
class="inline-flex cursor-pointer flex-col items-center gap-1"
|
||||
@click="handleSyncPddOrders(row)"
|
||||
>
|
||||
<div class="flex items-center gap-1 text-xs">
|
||||
@@ -495,7 +506,7 @@ onUnmounted(() => {
|
||||
</template>
|
||||
|
||||
<template #action="{ row }: { row: ShopVO.Info }">
|
||||
<Space wrap>
|
||||
<Space>
|
||||
<Button
|
||||
v-if="isPddShop(row) && hasExternalShop(row)"
|
||||
size="small"
|
||||
|
||||
Reference in New Issue
Block a user