review:【antd/ele】【mall】商品模块的迁移
This commit is contained in:
@@ -110,7 +110,7 @@ function emitSpuChange() {
|
|||||||
class="h-full w-full rounded-lg object-cover"
|
class="h-full w-full rounded-lg object-cover"
|
||||||
/>
|
/>
|
||||||
<!-- 删除按钮 -->
|
<!-- 删除按钮 -->
|
||||||
<!-- TODO @AI:还是使用 IconifyIcon:使用自己的 + 图标 -->
|
<!-- TODO @puhui999:还是使用 IconifyIcon:使用自己的中立的图标,方便 antd 和 ele 共享 -->
|
||||||
<CloseCircleFilled
|
<CloseCircleFilled
|
||||||
v-if="!disabled"
|
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"
|
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"
|
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"
|
@click="handleOpenSpuSelect"
|
||||||
>
|
>
|
||||||
<!-- TODO @AI:还是使用 IconifyIcon:使用自己的 + 图标 -->
|
<!-- TODO @puhui999:还是使用 IconifyIcon:使用自己的中立的图标,方便 antd 和 ele 共享 -->
|
||||||
<PlusOutlined class="text-xl text-gray-400" />
|
<PlusOutlined class="text-xl text-gray-400" />
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ const spuId = ref<number>();
|
|||||||
const { params, name } = useRoute();
|
const { params, name } = useRoute();
|
||||||
const { closeCurrentTab } = useTabs();
|
const { closeCurrentTab } = useTabs();
|
||||||
const activeTabName = ref('info');
|
const activeTabName = ref('info');
|
||||||
|
// TODO @puhui999:这个要不要类似 ele 里,直接写到 html 里?
|
||||||
const tabList = ref([
|
const tabList = ref([
|
||||||
{
|
{
|
||||||
key: 'info',
|
key: 'info',
|
||||||
|
|||||||
@@ -130,7 +130,6 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
await modalApi.close();
|
await modalApi.close();
|
||||||
emit('success');
|
emit('success');
|
||||||
},
|
},
|
||||||
|
|
||||||
async onOpenChange(isOpen: boolean) {
|
async onOpenChange(isOpen: boolean) {
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -62,13 +62,6 @@ export namespace MallSpuApi {
|
|||||||
valueName?: string; // 属性值名称
|
valueName?: string; // 属性值名称
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @puhui999:这个还要么?
|
|
||||||
/** 优惠券模板 */
|
|
||||||
export interface GiveCouponTemplate {
|
|
||||||
id?: number; // 优惠券编号
|
|
||||||
name?: string; // 优惠券名称
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 商品状态更新请求 */
|
/** 商品状态更新请求 */
|
||||||
export interface SpuStatusUpdateReqVO {
|
export interface SpuStatusUpdateReqVO {
|
||||||
id: number; // 商品编号
|
id: number; // 商品编号
|
||||||
|
|||||||
@@ -5,7 +5,10 @@ import { isEmpty } from '@vben/utils';
|
|||||||
|
|
||||||
import { acceptHMRUpdate, defineStore } from 'pinia';
|
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 {
|
interface MallKefuInfoVO {
|
||||||
conversationList: MallKefuConversationApi.Conversation[]; // 会话列表
|
conversationList: MallKefuConversationApi.Conversation[]; // 会话列表
|
||||||
@@ -41,9 +44,7 @@ export const useMallKefuStore = defineStore('mall-kefu', {
|
|||||||
// ======================= 会话相关 =======================
|
// ======================= 会话相关 =======================
|
||||||
/** 加载会话缓存列表 */
|
/** 加载会话缓存列表 */
|
||||||
async setConversationList() {
|
async setConversationList() {
|
||||||
// TODO @jave:idea linter 告警,修复下;
|
this.conversationList = await getConversationList();
|
||||||
// TODO @jave:不使用 KeFuConversationApi.,直接用 getConversationList
|
|
||||||
this.conversationList = await KeFuConversationApi.getConversationList();
|
|
||||||
this.conversationSort();
|
this.conversationSort();
|
||||||
},
|
},
|
||||||
/** 更新会话缓存已读 */
|
/** 更新会话缓存已读 */
|
||||||
@@ -51,8 +52,11 @@ export const useMallKefuStore = defineStore('mall-kefu', {
|
|||||||
if (isEmpty(this.conversationList)) {
|
if (isEmpty(this.conversationList)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const conversation = this.conversationList.find(
|
const conversationList = this
|
||||||
(item) => item.id === conversationId,
|
.conversationList as MallKefuConversationApi.Conversation[];
|
||||||
|
const conversation = conversationList.find(
|
||||||
|
(item: MallKefuConversationApi.Conversation) =>
|
||||||
|
item.id === conversationId,
|
||||||
);
|
);
|
||||||
conversation && (conversation.adminUnreadMessageCount = 0);
|
conversation && (conversation.adminUnreadMessageCount = 0);
|
||||||
},
|
},
|
||||||
@@ -62,10 +66,16 @@ export const useMallKefuStore = defineStore('mall-kefu', {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const conversation =
|
const conversation = await getConversation(conversationId);
|
||||||
await KeFuConversationApi.getConversation(conversationId);
|
|
||||||
this.deleteConversation(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();
|
this.conversationSort();
|
||||||
},
|
},
|
||||||
/** 删除会话缓存 */
|
/** 删除会话缓存 */
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ function handleRadioChange() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO @puhui999:这里的代码风格,对齐 antd 的;可以使用 idea 对比两个文件哈;
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
gridOptions: {
|
gridOptions: {
|
||||||
columns: useSkuGridColumns(),
|
columns: useSkuGridColumns(),
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ watch(
|
|||||||
</SkuList>
|
</SkuList>
|
||||||
</template>
|
</template>
|
||||||
</VxeColumn>
|
</VxeColumn>
|
||||||
<VxeColumn field="id" align="center" title="商品编号" />
|
<VxeColumn field="id" align="center" title="商品编号" min-width="30" />
|
||||||
<VxeColumn title="商品图" min-width="80">
|
<VxeColumn title="商品图" min-width="80">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<ElImage
|
<ElImage
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ function emitSpuChange() {
|
|||||||
fit="cover"
|
fit="cover"
|
||||||
/>
|
/>
|
||||||
<!-- 删除按钮 -->
|
<!-- 删除按钮 -->
|
||||||
|
<!-- TODO @puhui999:还是使用 IconifyIcon:使用自己的中立的图标,方便 antd 和 ele 共享 -->
|
||||||
<IconifyIcon
|
<IconifyIcon
|
||||||
v-if="!disabled"
|
v-if="!disabled"
|
||||||
icon="ep:circle-close-filled"
|
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"
|
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"
|
@click="handleOpenSpuSelect"
|
||||||
>
|
>
|
||||||
|
<!-- TODO @puhui999:还是使用 IconifyIcon:使用自己的中立的图标,方便 antd 和 ele 共享 -->
|
||||||
<IconifyIcon icon="ep:plus" class="text-xl text-gray-400" />
|
<IconifyIcon icon="ep:plus" class="text-xl text-gray-400" />
|
||||||
</div>
|
</div>
|
||||||
</ElTooltip>
|
</ElTooltip>
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ const formData = ref<MallSpuApi.Spu>({
|
|||||||
}); // spu 表单数据
|
}); // spu 表单数据
|
||||||
const propertyList = ref<PropertyAndValues[]>([]); // 商品属性列表
|
const propertyList = ref<PropertyAndValues[]>([]); // 商品属性列表
|
||||||
const ruleConfig: RuleConfig[] = [
|
const ruleConfig: RuleConfig[] = [
|
||||||
|
// TODO @puhui999:ele 这里都有 :number,antd 要不要加?
|
||||||
{
|
{
|
||||||
name: 'stock',
|
name: 'stock',
|
||||||
rule: (arg: number) => arg >= 0,
|
rule: (arg: number) => arg >= 0,
|
||||||
@@ -199,7 +200,7 @@ async function handleSubmit() {
|
|||||||
item.secondBrokeragePrice = convertToInteger(item.secondBrokeragePrice);
|
item.secondBrokeragePrice = convertToInteger(item.secondBrokeragePrice);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 处理轮播图列表
|
// 处理轮播图列表 TODO @puhui999:这个是必须的哇?
|
||||||
const newSliderPicUrls: any[] = [];
|
const newSliderPicUrls: any[] = [];
|
||||||
values.sliderPicUrls!.forEach((item: any) => {
|
values.sliderPicUrls!.forEach((item: any) => {
|
||||||
// 如果是前端选的图
|
// 如果是前端选的图
|
||||||
|
|||||||
@@ -130,7 +130,6 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
await modalApi.close();
|
await modalApi.close();
|
||||||
emit('success');
|
emit('success');
|
||||||
},
|
},
|
||||||
|
|
||||||
async onOpenChange(isOpen: boolean) {
|
async onOpenChange(isOpen: boolean) {
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ import { getRangePickerDefaultProps } from '#/utils';
|
|||||||
|
|
||||||
/** 关联数据 */
|
/** 关联数据 */
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const pickUpStoreList = ref<MallDeliveryPickUpStoreApi.PickUpStore[]>([]);
|
const pickUpStoreList = ref<MallDeliveryPickUpStoreApi.DeliveryPickUpStore[]>(
|
||||||
|
[],
|
||||||
|
);
|
||||||
getSimpleDeliveryPickUpStoreList().then((res) => {
|
getSimpleDeliveryPickUpStoreList().then((res) => {
|
||||||
pickUpStoreList.value = res;
|
pickUpStoreList.value = res;
|
||||||
// 移除自己无法核销的门店
|
// 移除自己无法核销的门店
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import {
|
|||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
import { useGridColumns, useGridFormSchema } from './data';
|
||||||
|
|
||||||
|
// TODO @芋艿:风格和 antd 不一致;
|
||||||
const summary = ref<MallOrderApi.OrderSummary>();
|
const summary = ref<MallOrderApi.OrderSummary>();
|
||||||
|
|
||||||
/** 刷新表格 */
|
/** 刷新表格 */
|
||||||
|
|||||||
Reference in New Issue
Block a user