review:【antd/ele】【mall】商品模块的迁移

This commit is contained in:
YunaiV
2025-12-15 19:44:11 +08:00
parent 4ec82f0fd0
commit e3c1676523
12 changed files with 32 additions and 23 deletions

View File

@@ -110,7 +110,7 @@ function emitSpuChange() {
class="h-full w-full rounded-lg object-cover"
/>
<!-- 删除按钮 -->
<!-- TODO @AI还是使用 IconifyIcon使用自己的 + 图标 -->
<!-- TODO @puhui999还是使用 IconifyIcon使用自己的中立的图标方便 antd ele 共享 -->
<CloseCircleFilled
v-if="!disabled"
class="absolute -right-2 -top-2 cursor-pointer text-xl text-red-500 opacity-0 transition-opacity hover:text-red-600 group-hover:opacity-100"
@@ -126,7 +126,7 @@ function emitSpuChange() {
class="flex h-[60px] w-[60px] cursor-pointer items-center justify-center rounded-lg border-2 border-dashed transition-colors hover:border-primary hover:bg-primary/5"
@click="handleOpenSpuSelect"
>
<!-- TODO @AI还是使用 IconifyIcon使用自己的 + 图标 -->
<!-- TODO @puhui999还是使用 IconifyIcon使用自己的中立的图标方便 antd ele 共享 -->
<PlusOutlined class="text-xl text-gray-400" />
</div>
</Tooltip>

View File

@@ -32,6 +32,7 @@ const spuId = ref<number>();
const { params, name } = useRoute();
const { closeCurrentTab } = useTabs();
const activeTabName = ref('info');
// TODO @puhui999这个要不要类似 ele 里,直接写到 html 里?
const tabList = ref([
{
key: 'info',

View File

@@ -130,7 +130,6 @@ const [Modal, modalApi] = useVbenModal({
await modalApi.close();
emit('success');
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
return;

View File

@@ -62,13 +62,6 @@ export namespace MallSpuApi {
valueName?: string; // 属性值名称
}
// TODO @puhui999这个还要么
/** 优惠券模板 */
export interface GiveCouponTemplate {
id?: number; // 优惠券编号
name?: string; // 优惠券名称
}
/** 商品状态更新请求 */
export interface SpuStatusUpdateReqVO {
id: number; // 商品编号

View File

@@ -5,7 +5,10 @@ import { isEmpty } from '@vben/utils';
import { acceptHMRUpdate, defineStore } from 'pinia';
import * as KeFuConversationApi from '#/api/mall/promotion/kefu/conversation';
import {
getConversation,
getConversationList,
} from '#/api/mall/promotion/kefu/conversation';
interface MallKefuInfoVO {
conversationList: MallKefuConversationApi.Conversation[]; // 会话列表
@@ -41,9 +44,7 @@ export const useMallKefuStore = defineStore('mall-kefu', {
// ======================= 会话相关 =======================
/** 加载会话缓存列表 */
async setConversationList() {
// TODO @javeidea linter 告警,修复下;
// TODO @jave不使用 KeFuConversationApi.,直接用 getConversationList
this.conversationList = await KeFuConversationApi.getConversationList();
this.conversationList = await getConversationList();
this.conversationSort();
},
/** 更新会话缓存已读 */
@@ -51,8 +52,11 @@ export const useMallKefuStore = defineStore('mall-kefu', {
if (isEmpty(this.conversationList)) {
return;
}
const conversation = this.conversationList.find(
(item) => item.id === conversationId,
const conversationList = this
.conversationList as MallKefuConversationApi.Conversation[];
const conversation = conversationList.find(
(item: MallKefuConversationApi.Conversation) =>
item.id === conversationId,
);
conversation && (conversation.adminUnreadMessageCount = 0);
},
@@ -62,10 +66,16 @@ export const useMallKefuStore = defineStore('mall-kefu', {
return;
}
const conversation =
await KeFuConversationApi.getConversation(conversationId);
const conversation = await getConversation(conversationId);
this.deleteConversation(conversationId);
conversation && this.conversationList.push(conversation);
if (conversation && this.conversationList) {
const conversationList = this
.conversationList as MallKefuConversationApi.Conversation[];
this.conversationList = [
...conversationList,
conversation as MallKefuConversationApi.Conversation,
];
}
this.conversationSort();
},
/** 删除会话缓存 */

View File

@@ -31,6 +31,7 @@ function handleRadioChange() {
}
}
// TODO @puhui999这里的代码风格对齐 antd 的;可以使用 idea 对比两个文件哈;
const [Grid, gridApi] = useVbenVxeGrid({
gridOptions: {
columns: useSkuGridColumns(),

View File

@@ -127,7 +127,7 @@ watch(
</SkuList>
</template>
</VxeColumn>
<VxeColumn field="id" align="center" title="商品编号" />
<VxeColumn field="id" align="center" title="商品编号" min-width="30" />
<VxeColumn title="商品图" min-width="80">
<template #default="{ row }">
<ElImage

View File

@@ -112,6 +112,7 @@ function emitSpuChange() {
fit="cover"
/>
<!-- 删除按钮 -->
<!-- TODO @puhui999还是使用 IconifyIcon使用自己的中立的图标方便 antd ele 共享 -->
<IconifyIcon
v-if="!disabled"
icon="ep:circle-close-filled"
@@ -128,6 +129,7 @@ function emitSpuChange() {
class="flex h-[60px] w-[60px] cursor-pointer items-center justify-center rounded-lg border-2 border-dashed transition-colors hover:border-primary hover:bg-primary/5"
@click="handleOpenSpuSelect"
>
<!-- TODO @puhui999还是使用 IconifyIcon使用自己的中立的图标方便 antd ele 共享 -->
<IconifyIcon icon="ep:plus" class="text-xl text-gray-400" />
</div>
</ElTooltip>

View File

@@ -70,6 +70,7 @@ const formData = ref<MallSpuApi.Spu>({
}); // spu 表单数据
const propertyList = ref<PropertyAndValues[]>([]); // 商品属性列表
const ruleConfig: RuleConfig[] = [
// TODO @puhui999ele 这里都有 :numberantd 要不要加?
{
name: 'stock',
rule: (arg: number) => arg >= 0,
@@ -199,7 +200,7 @@ async function handleSubmit() {
item.secondBrokeragePrice = convertToInteger(item.secondBrokeragePrice);
});
}
// 处理轮播图列表
// 处理轮播图列表 TODO @puhui999这个是必须的哇
const newSliderPicUrls: any[] = [];
values.sliderPicUrls!.forEach((item: any) => {
// 如果是前端选的图

View File

@@ -130,7 +130,6 @@ const [Modal, modalApi] = useVbenModal({
await modalApi.close();
emit('success');
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
return;

View File

@@ -12,7 +12,9 @@ import { getRangePickerDefaultProps } from '#/utils';
/** 关联数据 */
const userStore = useUserStore();
const pickUpStoreList = ref<MallDeliveryPickUpStoreApi.PickUpStore[]>([]);
const pickUpStoreList = ref<MallDeliveryPickUpStoreApi.DeliveryPickUpStore[]>(
[],
);
getSimpleDeliveryPickUpStoreList().then((res) => {
pickUpStoreList.value = res;
// 移除自己无法核销的门店

View File

@@ -20,6 +20,7 @@ import {
import { useGridColumns, useGridFormSchema } from './data';
// TODO @芋艿:风格和 antd 不一致;
const summary = ref<MallOrderApi.OrderSummary>();
/** 刷新表格 */