diff --git a/apps/web-ele/src/api/mall/product/spu.ts b/apps/web-ele/src/api/mall/product/spu.ts index 3d9a15132..76ca7b55a 100644 --- a/apps/web-ele/src/api/mall/product/spu.ts +++ b/apps/web-ele/src/api/mall/product/spu.ts @@ -113,6 +113,8 @@ export namespace MallSpuApi { createTime?: Date; /** 商品状态 */ status?: number; + /** 浏览量 */ + browseCount?: number; } /** 商品状态更新 */ diff --git a/apps/web-ele/src/api/mall/promotion/reward/rewardActivity.ts b/apps/web-ele/src/api/mall/promotion/reward/rewardActivity.ts index e972daf2e..2f5cfb26d 100644 --- a/apps/web-ele/src/api/mall/promotion/reward/rewardActivity.ts +++ b/apps/web-ele/src/api/mall/promotion/reward/rewardActivity.ts @@ -45,6 +45,8 @@ export namespace MallRewardActivityApi { productCategoryIds?: number[]; /** 商品 SPU 编号列表(仅表单使用) */ productSpuIds?: number[]; + /** 状态 */ + status?: number; } } diff --git a/apps/web-ele/src/api/mall/promotion/seckill/seckillActivity.ts b/apps/web-ele/src/api/mall/promotion/seckill/seckillActivity.ts index 5159c90e1..e11e8828a 100644 --- a/apps/web-ele/src/api/mall/promotion/seckill/seckillActivity.ts +++ b/apps/web-ele/src/api/mall/promotion/seckill/seckillActivity.ts @@ -30,13 +30,13 @@ export namespace MallSeckillActivityApi { /** 备注 */ remark?: string; /** 开始时间 */ - startTime?: Date; + startTime: Date; /** 结束时间 */ - endTime?: Date; + endTime: Date; /** 排序 */ sort?: number; /** 配置编号 */ - configIds?: string; + configIds?: number[]; /** 订单数量 */ orderCount?: number; /** 用户数量 */ diff --git a/apps/web-ele/src/router/routes/modules/mall.ts b/apps/web-ele/src/router/routes/modules/mall.ts index d5d396462..809dc2e78 100644 --- a/apps/web-ele/src/router/routes/modules/mall.ts +++ b/apps/web-ele/src/router/routes/modules/mall.ts @@ -38,6 +38,15 @@ const routes: RouteRecordRaw[] = [ }, component: () => import('#/views/mall/product/spu/modules/detail.vue'), }, + { + path: '/product/spu', + name: 'ProductSpu', + meta: { + title: '商品列表', + activeMenu: '/mall/product/spu', + }, + component: () => import('#/views/mall/product/spu/index.vue'), + }, ], }, { diff --git a/apps/web-ele/src/views/infra/codegen/index.vue b/apps/web-ele/src/views/infra/codegen/index.vue index e116e0644..fc94fce44 100644 --- a/apps/web-ele/src/views/infra/codegen/index.vue +++ b/apps/web-ele/src/views/infra/codegen/index.vue @@ -9,10 +9,10 @@ import type { InfraDataSourceConfigApi } from '#/api/infra/data-source-config'; import { ref } from 'vue'; import { useRouter } from 'vue-router'; -import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; +import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { isEmpty } from '@vben/utils'; -import { ElLoading, ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -73,23 +73,22 @@ function onEdit(row: InfraCodegenApi.CodegenTable) { /** 删除代码生成配置 */ async function onDelete(row: InfraCodegenApi.CodegenTable) { - await ElMessageBox.confirm('确定要删除该代码生成配置吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.tableName]), + fullscreen: true, }); - await deleteCodegenTable(row.id); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.tableName])); - onRefresh(); + try { + await deleteCodegenTable(row.id); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.tableName])); + onRefresh(); + } finally { + loadingInstance.close(); + } } /** 批量删除代码生成配置 */ async function onDeleteBatch() { - await ElMessageBox.confirm('确定要删除该代码生成配置吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm('确定要批量删除该代码生成配置吗?'); await deleteCodegenTableList(checkedIds.value); ElMessage.success($t('ui.actionMessage.deleteSuccess')); onRefresh(); @@ -97,11 +96,7 @@ async function onDeleteBatch() { /** 同步数据库 */ async function onSync(row: InfraCodegenApi.CodegenTable) { - await ElMessageBox.confirm('确定要同步该代码生成配置吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm('确定要同步该代码生成配置吗?'); await syncCodegenFromDB(row.id); ElMessage.success($t('ui.actionMessage.updateSuccess', [row.tableName])); onRefresh(); diff --git a/apps/web-ele/src/views/infra/config/index.vue b/apps/web-ele/src/views/infra/config/index.vue index c77ce8ce3..5e1f63da1 100644 --- a/apps/web-ele/src/views/infra/config/index.vue +++ b/apps/web-ele/src/views/infra/config/index.vue @@ -7,10 +7,10 @@ import type { InfraConfigApi } from '#/api/infra/config'; import { ref } from 'vue'; -import { Page, useVbenModal } from '@vben/common-ui'; +import { confirm, Page, useVbenModal } from '@vben/common-ui'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -52,23 +52,22 @@ function onEdit(row: InfraConfigApi.Config) { /** 删除参数 */ async function onDelete(row: InfraConfigApi.Config) { - await ElMessageBox.confirm('确定要删除该参数吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - await deleteConfig(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deleteConfig(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + loadingInstance.close(); + } } /** 批量删除参数 */ async function onDeleteBatch() { - await ElMessageBox.confirm('确定要删除该参数吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm('确定要批量删除该参数吗?'); await deleteConfigList(checkedIds.value); ElMessage.success($t('ui.actionMessage.deleteSuccess')); onRefresh(); diff --git a/apps/web-ele/src/views/infra/dataSourceConfig/index.vue b/apps/web-ele/src/views/infra/dataSourceConfig/index.vue index f99b56538..43188b058 100644 --- a/apps/web-ele/src/views/infra/dataSourceConfig/index.vue +++ b/apps/web-ele/src/views/infra/dataSourceConfig/index.vue @@ -7,10 +7,10 @@ import type { InfraDataSourceConfigApi } from '#/api/infra/data-source-config'; import { onMounted, ref } from 'vue'; -import { Page, useVbenModal } from '@vben/common-ui'; +import { confirm, Page, useVbenModal } from '@vben/common-ui'; import { isEmpty } from '@vben/utils'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -40,23 +40,22 @@ function onEdit(row: InfraDataSourceConfigApi.DataSourceConfig) { /** 删除数据源 */ async function onDelete(row: InfraDataSourceConfigApi.DataSourceConfig) { - await ElMessageBox.confirm('确定要删除该数据源吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - await deleteDataSourceConfig(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deleteDataSourceConfig(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + loadingInstance.close(); + } } /** 批量删除数据源 */ async function onDeleteBatch() { - await ElMessageBox.confirm('确定要删除该数据源吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm('确定要批量删除该数据源吗?'); await deleteDataSourceConfigList(checkedIds.value); ElMessage.success($t('ui.actionMessage.deleteSuccess')); onRefresh(); diff --git a/apps/web-ele/src/views/infra/file/index.vue b/apps/web-ele/src/views/infra/file/index.vue index 37d40a212..0d2e87f29 100644 --- a/apps/web-ele/src/views/infra/file/index.vue +++ b/apps/web-ele/src/views/infra/file/index.vue @@ -7,11 +7,11 @@ import type { InfraFileApi } from '#/api/infra/file'; import { ref } from 'vue'; -import { Page, useVbenModal } from '@vben/common-ui'; +import { confirm, Page, useVbenModal } from '@vben/common-ui'; import { isEmpty, openWindow } from '@vben/utils'; import { useClipboard } from '@vueuse/core'; -import { ElButton, ElImage, ElMessage, ElMessageBox } from 'element-plus'; +import { ElButton, ElImage, ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { deleteFile, deleteFileList, getFilePage } from '#/api/infra/file'; @@ -60,25 +60,24 @@ function openUrl(url?: string) { /** 删除文件 */ async function onDelete(row: InfraFileApi.File) { - await ElMessageBox.confirm('确定要删除该文件吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name || row.path]), + fullscreen: true, }); - await deleteFile(row.id as number); - ElMessage.success( - $t('ui.actionMessage.deleteSuccess', [row.name || row.path]), - ); - onRefresh(); + try { + await deleteFile(row.id as number); + ElMessage.success( + $t('ui.actionMessage.deleteSuccess', [row.name || row.path]), + ); + onRefresh(); + } finally { + loadingInstance.close(); + } } /** 批量删除文件 */ async function onDeleteBatch() { - await ElMessageBox.confirm('确定要删除该文件吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm('确定要批量删除该文件吗?'); await deleteFileList(checkedIds.value); ElMessage.success($t('ui.actionMessage.deleteSuccess')); onRefresh(); diff --git a/apps/web-ele/src/views/infra/fileConfig/index.vue b/apps/web-ele/src/views/infra/fileConfig/index.vue index 8ab9d3519..21095febd 100644 --- a/apps/web-ele/src/views/infra/fileConfig/index.vue +++ b/apps/web-ele/src/views/infra/fileConfig/index.vue @@ -10,7 +10,7 @@ import { ref } from 'vue'; import { confirm, Page, useVbenModal } from '@vben/common-ui'; import { isEmpty, openWindow } from '@vben/utils'; -import { ElLoading, ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -86,23 +86,22 @@ async function onTest(row: InfraFileConfigApi.FileConfig) { /** 删除文件配置 */ async function onDelete(row: InfraFileConfigApi.FileConfig) { - await ElMessageBox.confirm('确定要删除该文件配置吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - await deleteFileConfig(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deleteFileConfig(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + loadingInstance.close(); + } } /** 批量删除文件配置 */ async function onDeleteBatch() { - await ElMessageBox.confirm('确定要删除该文件配置吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm('确定要批量删除该文件配置吗?'); await deleteFileConfigList(checkedIds.value); ElMessage.success($t('ui.actionMessage.deleteSuccess')); onRefresh(); diff --git a/apps/web-ele/src/views/infra/job/index.vue b/apps/web-ele/src/views/infra/job/index.vue index f631e944c..5bdb2aac8 100644 --- a/apps/web-ele/src/views/infra/job/index.vue +++ b/apps/web-ele/src/views/infra/job/index.vue @@ -11,7 +11,7 @@ import { useRouter } from 'vue-router'; import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -105,23 +105,22 @@ function onLog(row?: InfraJobApi.Job) { /** 删除任务 */ async function onDelete(row: InfraJobApi.Job) { - await ElMessageBox.confirm('确定要删除该任务吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - await deleteJob(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deleteJob(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + loadingInstance.close(); + } } /** 批量删除任务 */ async function onDeleteBatch() { - await ElMessageBox.confirm('确定要删除该任务吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm('确定要批量删除该任务吗?'); await deleteJobList(checkedIds.value); ElMessage.success($t('ui.actionMessage.deleteSuccess')); onRefresh(); diff --git a/apps/web-ele/src/views/mall/product/brand/index.vue b/apps/web-ele/src/views/mall/product/brand/index.vue index ef43eef47..709b2aeb9 100644 --- a/apps/web-ele/src/views/mall/product/brand/index.vue +++ b/apps/web-ele/src/views/mall/product/brand/index.vue @@ -4,7 +4,7 @@ import type { MallBrandApi } from '#/api/mall/product/brand'; import { Page, useVbenModal } from '@vben/common-ui'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { deleteBrand, getBrandPage } from '#/api/mall/product/brand'; @@ -35,15 +35,17 @@ function handleEdit(row: MallBrandApi.Brand) { /** 删除品牌 */ async function handleDelete(row: MallBrandApi.Brand) { - // 二次确认 - await ElMessageBox.confirm('确定删除该品牌吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - await deleteBrand(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deleteBrand(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + loadingInstance.close(); + } } const [Grid, gridApi] = useVbenVxeGrid({ diff --git a/apps/web-ele/src/views/mall/product/category/index.vue b/apps/web-ele/src/views/mall/product/category/index.vue index c71dc0ed0..2ea01f96e 100644 --- a/apps/web-ele/src/views/mall/product/category/index.vue +++ b/apps/web-ele/src/views/mall/product/category/index.vue @@ -7,7 +7,7 @@ import { useRouter } from 'vue-router'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { deleteCategory, getCategoryList } from '#/api/mall/product/category'; @@ -52,14 +52,17 @@ const handleViewSpu = (id: number) => { /** 删除分类 */ async function handleDelete(row: MallCategoryApi.Category) { - await ElMessageBox.confirm('确定删除该分类吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - await deleteCategory(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deleteCategory(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + loadingInstance.close(); + } } /** 切换树形展开/收缩状态 */ @@ -162,8 +165,8 @@ const [Grid, gridApi] = useVbenVxeGrid({ link: true, icon: ACTION_ICON.VIEW, auth: ['product:category:update'], - ifShow: row.parentId > 0, - onClick: handleViewSpu.bind(null, row), + ifShow: row.parentId !== undefined && row.parentId > 0, + onClick: handleViewSpu.bind(null, row.id || 0), }, { label: $t('common.delete'), diff --git a/apps/web-ele/src/views/mall/product/comment/data.ts b/apps/web-ele/src/views/mall/product/comment/data.ts index fb4d87cfd..54e1c58db 100644 --- a/apps/web-ele/src/views/mall/product/comment/data.ts +++ b/apps/web-ele/src/views/mall/product/comment/data.ts @@ -187,8 +187,8 @@ export function useGridColumns( attrs: { beforeChange: onStatusChange }, name: 'CellSwitch', props: { - checkedValue: true, - unCheckedValue: false, + activeValue: true, + inactiveValue: false, }, }, }, diff --git a/apps/web-ele/src/views/mall/product/property/modules/property-grid.vue b/apps/web-ele/src/views/mall/product/property/modules/property-grid.vue index 067fed48a..6aaea656e 100644 --- a/apps/web-ele/src/views/mall/product/property/modules/property-grid.vue +++ b/apps/web-ele/src/views/mall/product/property/modules/property-grid.vue @@ -7,7 +7,7 @@ import type { MallPropertyApi } from '#/api/mall/product/property'; import { useVbenModal } from '@vben/common-ui'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { deleteProperty, getPropertyPage } from '#/api/mall/product/property'; @@ -40,14 +40,17 @@ function handleEdit(row: any) { /** 删除属性 */ async function handleDelete(row: MallPropertyApi.Property) { - await ElMessageBox.confirm('确定删除该属性吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - await deleteProperty(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deleteProperty(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + loadingInstance.close(); + } } /** 表格事件 */ diff --git a/apps/web-ele/src/views/mall/product/property/modules/value-grid.vue b/apps/web-ele/src/views/mall/product/property/modules/value-grid.vue index 2f4d44240..c17eb3a90 100644 --- a/apps/web-ele/src/views/mall/product/property/modules/value-grid.vue +++ b/apps/web-ele/src/views/mall/product/property/modules/value-grid.vue @@ -6,7 +6,7 @@ import { watch } from 'vue'; import { useVbenModal } from '@vben/common-ui'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -47,14 +47,17 @@ function handleEdit(row: MallPropertyApi.PropertyValue) { /** 删除字典数据 */ async function handleDelete(row: MallPropertyApi.PropertyValue) { - await ElMessageBox.confirm('确定删除该属性值吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - await deletePropertyValue(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deletePropertyValue(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + loadingInstance.close(); + } } const [Grid, gridApi] = useVbenVxeGrid({ diff --git a/apps/web-ele/src/views/mall/product/spu/index.vue b/apps/web-ele/src/views/mall/product/spu/index.vue index e2ef9e8fc..b3224b67a 100644 --- a/apps/web-ele/src/views/mall/product/spu/index.vue +++ b/apps/web-ele/src/views/mall/product/spu/index.vue @@ -3,7 +3,7 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { MallSpuApi } from '#/api/mall/product/spu'; import { onMounted, ref } from 'vue'; -import { useRouter } from 'vue-router'; +import { useRoute, useRouter } from 'vue-router'; import { confirm, DocAlert, Page } from '@vben/common-ui'; import { @@ -13,7 +13,7 @@ import { treeToString, } from '@vben/utils'; -import { ElDescriptions, ElMessage, ElMessageBox, ElTabs } from 'element-plus'; +import { ElDescriptions, ElLoading, ElMessage, ElTabs } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { getCategoryList } from '#/api/mall/product/category'; @@ -31,7 +31,7 @@ import { useGridColumns, useGridFormSchema } from './data'; const { push } = useRouter(); const tabType = ref(0); - +const route = useRoute(); // 路由 const categoryList = ref(); // tabs 数据 @@ -64,8 +64,9 @@ const tabsData = ref([ ]); /** 刷新表格 */ -function onRefresh() { +async function onRefresh() { gridApi.query(); + await getTabCount(); } /** 获得每个 Tab 的数量 */ @@ -97,28 +98,27 @@ function handleEdit(row: MallSpuApi.Spu) { /** 删除商品 */ async function handleDelete(row: MallSpuApi.Spu) { - await ElMessageBox.confirm('确定删除该商品吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const hideLoading = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - await deleteSpu(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deleteSpu(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + hideLoading.close(); + } } /** 添加到仓库 / 回收站的状态 */ async function handleStatus02Change(row: MallSpuApi.Spu, newStatus: number) { + // 二次确认 const text = newStatus === ProductSpuStatusEnum.RECYCLE.status ? '加入到回收站' : '恢复到仓库'; - // 二次确认 - await ElMessageBox.confirm(`确认要jian"${row.name}"${text}吗?`, { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm(`确认要"${row.name}"${text}吗?`); await updateStatus({ id: row.id as number, status: newStatus }); ElMessage.success(`${text}成功`); onRefresh(); @@ -202,11 +202,16 @@ function onChangeTab(key: any) { gridApi.query(); } -onMounted(() => { - getTabCount(); - getCategoryList({}).then((res) => { - categoryList.value = handleTree(res, 'id', 'parentId', 'children'); - }); +onMounted(async () => { + // 解析路由的 categoryId + if (route.query.categoryId) { + gridApi.formApi.setValues({ + categoryId: Number(route.query.categoryId), + }); + } + await getTabCount(); + const res = await getCategoryList({}); + categoryList.value = handleTree(res, 'id', 'parentId', 'children'); }); @@ -221,11 +226,12 @@ onMounted(() => { @@ -261,23 +267,23 @@ onMounted(() => { :content-style="{ width: '100px', fontSize: '14px' }" > - {{ treeToString(categoryList, row.categoryId) }} + {{ treeToString(categoryList, row.categoryId || 0) }} {{ row.name }} - {{ fenToYuan(row.marketPrice) }} 元 + {{ fenToYuan(row.marketPrice || 0) }} 元 - {{ fenToYuan(row.costPrice) }} 元 + {{ fenToYuan(row.costPrice || 0) }} 元 - {{ row.browseCount }} + {{ row.browseCount || 0 }} - {{ row.virtualSalesCount }} + {{ row.virtualSalesCount || 0 }} @@ -305,7 +311,7 @@ onMounted(() => { link: true, icon: ACTION_ICON.DELETE, auth: ['product:spu:delete'], - ifShow: () => row.type === 4, + ifShow: () => tabType === 4, popConfirm: { title: $t('ui.actionMessage.deleteConfirm', [row.name]), confirm: handleDelete.bind(null, row), @@ -317,7 +323,7 @@ onMounted(() => { link: true, icon: ACTION_ICON.EDIT, auth: ['product:spu:update'], - ifShow: () => row.type === 4, + ifShow: () => tabType === 4, onClick: handleStatus02Change.bind( null, row, @@ -330,7 +336,7 @@ onMounted(() => { link: true, icon: ACTION_ICON.EDIT, auth: ['product:spu:update'], - ifShow: () => row.type !== 4, + ifShow: () => tabType !== 4, onClick: handleStatus02Change.bind( null, row, diff --git a/apps/web-ele/src/views/mall/promotion/article/index.vue b/apps/web-ele/src/views/mall/promotion/article/index.vue index ff3f370e7..b3f4ca8a6 100644 --- a/apps/web-ele/src/views/mall/promotion/article/index.vue +++ b/apps/web-ele/src/views/mall/promotion/article/index.vue @@ -4,7 +4,7 @@ import type { MallArticleApi } from '#/api/mall/promotion/article'; import { Page, useVbenModal } from '@vben/common-ui'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { deleteArticle, getArticlePage } from '#/api/mall/promotion/article'; @@ -35,14 +35,17 @@ function handleEdit(row: MallArticleApi.Article) { /** 删除品牌 */ async function handleDelete(row: MallArticleApi.Article) { - await ElMessageBox.confirm('确定删除该文章吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.title]), + fullscreen: true, }); - await deleteArticle(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.title])); - onRefresh(); + try { + await deleteArticle(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.title])); + onRefresh(); + } finally { + loadingInstance.close(); + } } const [Grid, gridApi] = useVbenVxeGrid({ diff --git a/apps/web-ele/src/views/mall/promotion/banner/index.vue b/apps/web-ele/src/views/mall/promotion/banner/index.vue index 669fa9f5b..cc6025d71 100644 --- a/apps/web-ele/src/views/mall/promotion/banner/index.vue +++ b/apps/web-ele/src/views/mall/promotion/banner/index.vue @@ -4,7 +4,7 @@ import type { MallBannerApi } from '#/api/mall/market/banner'; import { Page, useVbenModal } from '@vben/common-ui'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { deleteBanner, getBannerPage } from '#/api/mall/market/banner'; @@ -35,14 +35,17 @@ function handleEdit(row: MallBannerApi.Banner) { /** 删除Banner */ async function handleDelete(row: MallBannerApi.Banner) { - await ElMessageBox.confirm('确定删除该Banner吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.title]), + fullscreen: true, }); - await deleteBanner(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.title])); - onRefresh(); + try { + await deleteBanner(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.title])); + onRefresh(); + } finally { + loadingInstance.close(); + } } const [Grid, gridApi] = useVbenVxeGrid({ diff --git a/apps/web-ele/src/views/mall/promotion/bargain/activity/index.vue b/apps/web-ele/src/views/mall/promotion/bargain/activity/index.vue index 27043d5bc..23def9900 100644 --- a/apps/web-ele/src/views/mall/promotion/bargain/activity/index.vue +++ b/apps/web-ele/src/views/mall/promotion/bargain/activity/index.vue @@ -2,9 +2,9 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { MallBargainActivityApi } from '#/api/mall/promotion/bargain/bargainActivity'; -import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; +import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -41,11 +41,7 @@ function handleEdit(row: MallBargainActivityApi.BargainActivity) { /** 关闭砍价活动 */ async function handleClose(row: MallBargainActivityApi.BargainActivity) { - await ElMessageBox.confirm('确定关闭该砍价活动吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm('确定关闭该砍价活动吗?'); await closeBargainActivity(row.id as number); ElMessage.success('关闭成功'); onRefresh(); @@ -53,14 +49,17 @@ async function handleClose(row: MallBargainActivityApi.BargainActivity) { /** 删除砍价活动 */ async function handleDelete(row: MallBargainActivityApi.BargainActivity) { - await ElMessageBox.confirm('确定删除该砍价活动吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - await deleteBargainActivity(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deleteBargainActivity(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + loadingInstance.close(); + } } const [Grid, gridApi] = useVbenVxeGrid({ diff --git a/apps/web-ele/src/views/mall/promotion/combination/activity/index.vue b/apps/web-ele/src/views/mall/promotion/combination/activity/index.vue index 199f4ce26..4159858c3 100644 --- a/apps/web-ele/src/views/mall/promotion/combination/activity/index.vue +++ b/apps/web-ele/src/views/mall/promotion/combination/activity/index.vue @@ -2,9 +2,9 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { MallCombinationActivityApi } from '#/api/mall/promotion/combination/combinationActivity'; -import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; +import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -43,12 +43,7 @@ function handleEdit(row: MallCombinationActivityApi.CombinationActivity) { async function handleClose( row: MallCombinationActivityApi.CombinationActivity, ) { - await ElMessageBox.confirm('确定关闭该拼团活动吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); - + await confirm('确定关闭该拼团活动吗?'); await closeCombinationActivity(row.id as number); ElMessage.success('关闭成功'); onRefresh(); @@ -58,15 +53,17 @@ async function handleClose( async function handleDelete( row: MallCombinationActivityApi.CombinationActivity, ) { - await ElMessageBox.confirm('确定删除该拼团活动吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - - await deleteCombinationActivity(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deleteCombinationActivity(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + loadingInstance.close(); + } } const [Grid, gridApi] = useVbenVxeGrid({ diff --git a/apps/web-ele/src/views/mall/promotion/coupon/index.vue b/apps/web-ele/src/views/mall/promotion/coupon/index.vue index d1f7144d7..9ee685694 100644 --- a/apps/web-ele/src/views/mall/promotion/coupon/index.vue +++ b/apps/web-ele/src/views/mall/promotion/coupon/index.vue @@ -6,13 +6,14 @@ import { ref } from 'vue'; import { DocAlert, Page } from '@vben/common-ui'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { deleteCoupon, getCouponPage, } from '#/api/mall/promotion/coupon/coupon'; +import { $t } from '#/locales'; import { getStatusTabs, useGridColumns, useGridFormSchema } from './data'; @@ -23,14 +24,17 @@ const statusTabs = ref(getStatusTabs()); /** 删除优惠券 */ async function handleDelete(row: MallCouponApi.Coupon) { - await ElMessageBox.confirm('确定回收该优惠券吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - await deleteCoupon(row.id as number); - ElMessage.success('回收成功'); - onRefresh(); + try { + await deleteCoupon(row.id as number); + ElMessage.success('回收成功'); + onRefresh(); + } finally { + loadingInstance.close(); + } } /** 刷新表格 */ diff --git a/apps/web-ele/src/views/mall/promotion/discountActivity/index.vue b/apps/web-ele/src/views/mall/promotion/discountActivity/index.vue index 9e79871a4..7b8e09fc1 100644 --- a/apps/web-ele/src/views/mall/promotion/discountActivity/index.vue +++ b/apps/web-ele/src/views/mall/promotion/discountActivity/index.vue @@ -2,9 +2,9 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { MallDiscountActivityApi } from '#/api/mall/promotion/discount/discountActivity'; -import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; +import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -41,12 +41,7 @@ function handleEdit(row: MallDiscountActivityApi.DiscountActivity) { /** 关闭满减活动 */ async function handleClose(row: MallDiscountActivityApi.DiscountActivity) { - await ElMessageBox.confirm('确定关闭该限时折扣活动吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); - + await confirm('确定关闭该限时折扣活动吗?'); await closeDiscountActivity(row.id as number); ElMessage.success('关闭成功'); onRefresh(); @@ -54,15 +49,17 @@ async function handleClose(row: MallDiscountActivityApi.DiscountActivity) { /** 删除满减活动 */ async function handleDelete(row: MallDiscountActivityApi.DiscountActivity) { - await ElMessageBox.confirm('确定删除该限时折扣活动吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - - await deleteDiscountActivity(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deleteDiscountActivity(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + loadingInstance.close(); + } } const [Grid, gridApi] = useVbenVxeGrid({ diff --git a/apps/web-ele/src/views/mall/promotion/diy/page/index.vue b/apps/web-ele/src/views/mall/promotion/diy/page/index.vue index 76e0facf6..9dc80e5d0 100644 --- a/apps/web-ele/src/views/mall/promotion/diy/page/index.vue +++ b/apps/web-ele/src/views/mall/promotion/diy/page/index.vue @@ -6,7 +6,7 @@ import { useRouter } from 'vue-router'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { deleteDiyPage, getDiyPagePage } from '#/api/mall/promotion/diy/page'; @@ -47,14 +47,17 @@ function handleDecorate(row: MallDiyPageApi.DiyPage) { /** 删除DIY页面 */ async function handleDelete(row: MallDiyPageApi.DiyPage) { - await ElMessageBox.confirm('确定删除该装修页面吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - await deleteDiyPage(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deleteDiyPage(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + loadingInstance.close(); + } } const [Grid, gridApi] = useVbenVxeGrid({ diff --git a/apps/web-ele/src/views/mall/promotion/diy/template/index.vue b/apps/web-ele/src/views/mall/promotion/diy/template/index.vue index c35eb6279..2d43b97f5 100644 --- a/apps/web-ele/src/views/mall/promotion/diy/template/index.vue +++ b/apps/web-ele/src/views/mall/promotion/diy/template/index.vue @@ -4,9 +4,9 @@ import type { MallDiyTemplateApi } from '#/api/mall/promotion/diy/template'; import { useRouter } from 'vue-router'; -import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; +import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -51,11 +51,7 @@ function handleDecorate(row: MallDiyTemplateApi.DiyTemplate) { /** 使用模板 */ async function handleUse(row: MallDiyTemplateApi.DiyTemplate) { - await ElMessageBox.confirm(`是否使用模板"${row.name}"?`, { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm(`是否使用模板"${row.name}"?`); // 发起删除 await useDiyTemplate(row.id as number); ElMessage.success('使用成功'); @@ -64,14 +60,17 @@ async function handleUse(row: MallDiyTemplateApi.DiyTemplate) { /** 删除DIY模板 */ async function handleDelete(row: MallDiyTemplateApi.DiyTemplate) { - await ElMessageBox.confirm('确定删除该装修模板吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - await deleteDiyTemplate(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deleteDiyTemplate(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + loadingInstance.close(); + } } const [Grid, gridApi] = useVbenVxeGrid({ diff --git a/apps/web-ele/src/views/mall/promotion/point/activity/data.ts b/apps/web-ele/src/views/mall/promotion/point/activity/data.ts index 03a89bda5..c8768d7a8 100644 --- a/apps/web-ele/src/views/mall/promotion/point/activity/data.ts +++ b/apps/web-ele/src/views/mall/promotion/point/activity/data.ts @@ -1,7 +1,7 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; -import { DICT_TYPE } from '#/utils/dict'; +import { DICT_TYPE, getDictOptions } from '#/utils/dict'; /** 表单配置 */ export function useFormSchema(): VbenFormSchema[] { @@ -55,7 +55,7 @@ export function useGridFormSchema(): VbenFormSchema[] { componentProps: { placeholder: '请选择活动状态', clearable: true, - dictType: DICT_TYPE.COMMON_STATUS, + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), }, }, ]; diff --git a/apps/web-ele/src/views/mall/promotion/point/activity/index.vue b/apps/web-ele/src/views/mall/promotion/point/activity/index.vue index 4e4c7069f..dd39fe345 100644 --- a/apps/web-ele/src/views/mall/promotion/point/activity/index.vue +++ b/apps/web-ele/src/views/mall/promotion/point/activity/index.vue @@ -4,9 +4,9 @@ import type { MallPointActivityApi } from '#/api/mall/promotion/point'; import { computed } from 'vue'; -import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; +import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -49,11 +49,7 @@ function handleEdit(row: MallPointActivityApi.PointActivity) { /** 关闭积分活动 */ async function handleClose(row: MallPointActivityApi.PointActivity) { - await ElMessageBox.confirm('确认关闭该积分商城活动吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm('确认关闭该积分商城活动吗?'); await closePointActivity(row.id); ElMessage.success('关闭成功'); onRefresh(); @@ -61,13 +57,16 @@ async function handleClose(row: MallPointActivityApi.PointActivity) { /** 删除积分活动 */ async function handleDelete(row: MallPointActivityApi.PointActivity) { - await ElMessageBox.confirm('确定删除该积分商城活动吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.spuName]), + fullscreen: true, }); - await deletePointActivity(row.id); - onRefresh(); + try { + await deletePointActivity(row.id); + onRefresh(); + } finally { + loadingInstance.close(); + } } const [Grid, gridApi] = useVbenVxeGrid({ diff --git a/apps/web-ele/src/views/mall/promotion/rewardActivity/index.vue b/apps/web-ele/src/views/mall/promotion/rewardActivity/index.vue index 9b904e3de..a6a3d8172 100644 --- a/apps/web-ele/src/views/mall/promotion/rewardActivity/index.vue +++ b/apps/web-ele/src/views/mall/promotion/rewardActivity/index.vue @@ -2,9 +2,9 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { MallRewardActivityApi } from '#/api/mall/promotion/reward/rewardActivity'; -import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; +import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -41,12 +41,7 @@ function handleEdit(row: MallRewardActivityApi.RewardActivity) { /** 关闭活动 */ async function handleClose(row: MallRewardActivityApi.RewardActivity) { - await ElMessageBox.confirm('确认关闭该满减送活动吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); - + await confirm('确认关闭该满减送活动吗?'); await closeRewardActivity(row.id as number); ElMessage.success('关闭成功'); onRefresh(); @@ -54,14 +49,17 @@ async function handleClose(row: MallRewardActivityApi.RewardActivity) { /** 删除活动 */ async function handleDelete(row: MallRewardActivityApi.RewardActivity) { - await ElMessageBox.confirm('确定删除该满减送活动吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - await deleteRewardActivity(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deleteRewardActivity(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + loadingInstance.close(); + } } const [Grid, gridApi] = useVbenVxeGrid({ diff --git a/apps/web-ele/src/views/mall/promotion/seckill/activity/index.vue b/apps/web-ele/src/views/mall/promotion/seckill/activity/index.vue index 941adec9a..7ad535737 100644 --- a/apps/web-ele/src/views/mall/promotion/seckill/activity/index.vue +++ b/apps/web-ele/src/views/mall/promotion/seckill/activity/index.vue @@ -4,10 +4,10 @@ import type { MallSeckillActivityApi } from '#/api/mall/promotion/seckill/seckil import { onMounted } from 'vue'; -import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; +import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { $t } from '@vben/locales'; -import { ElMessage, ElMessageBox, ElTag } from 'element-plus'; +import { ElLoading, ElMessage, ElTag } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -45,11 +45,7 @@ function handleCreate() { /** 关闭活动 */ async function handleClose(row: MallSeckillActivityApi.SeckillActivity) { - await ElMessageBox.confirm('确认关闭该秒杀活动吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm('确认关闭该秒杀活动吗?'); await closeSeckillActivity(row.id as number); ElMessage.success('关闭成功'); onRefresh(); @@ -57,14 +53,17 @@ async function handleClose(row: MallSeckillActivityApi.SeckillActivity) { /** 删除活动 */ async function handleDelete(row: MallSeckillActivityApi.SeckillActivity) { - await ElMessageBox.confirm('确定删除该秒杀活动吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - await deleteSeckillActivity(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deleteSeckillActivity(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + loadingInstance.close(); + } } const [Grid, gridApi] = useVbenVxeGrid({ @@ -86,6 +85,9 @@ const [Grid, gridApi] = useVbenVxeGrid({ }, }, }, + cellConfig: { + height: 250, + }, rowConfig: { keyField: 'id', isHover: true, @@ -163,10 +165,7 @@ onMounted(async () => { link: true, auth: ['promotion:seckill-activity:close'], ifShow: row.status === 0, - popConfirm: { - title: '确认关闭该秒杀活动吗?', - confirm: handleClose.bind(null, row), - }, + onClick: handleClose.bind(null, row), }, { label: $t('common.delete'), diff --git a/apps/web-ele/src/views/mall/promotion/seckill/config/index.vue b/apps/web-ele/src/views/mall/promotion/seckill/config/index.vue index eb13c4425..934c1802f 100644 --- a/apps/web-ele/src/views/mall/promotion/seckill/config/index.vue +++ b/apps/web-ele/src/views/mall/promotion/seckill/config/index.vue @@ -4,7 +4,7 @@ import type { MallSeckillConfigApi } from '#/api/mall/promotion/seckill/seckillC import { confirm, Page, useVbenModal } from '@vben/common-ui'; -import { ElMessage, ElMessageBox } from 'element-plus'; +import { ElLoading, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -39,14 +39,17 @@ function handleEdit(row: MallSeckillConfigApi.SeckillConfig) { /** 删除秒杀时段 */ async function handleDelete(row: MallSeckillConfigApi.SeckillConfig) { - await ElMessageBox.confirm('确定删除该秒杀时段吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', + const loadingInstance = ElLoading.service({ + text: $t('ui.actionMessage.deleting', [row.name]), + fullscreen: true, }); - await deleteSeckillConfig(row.id as number); - ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); - onRefresh(); + try { + await deleteSeckillConfig(row.id as number); + ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); + onRefresh(); + } finally { + loadingInstance.close(); + } } /** 修改状态 */ diff --git a/apps/web-ele/src/views/mall/statistics/trade/components/trade-transaction-card.vue b/apps/web-ele/src/views/mall/statistics/trade/components/trade-transaction-card.vue index 9087e0ef2..2676dc588 100644 --- a/apps/web-ele/src/views/mall/statistics/trade/components/trade-transaction-card.vue +++ b/apps/web-ele/src/views/mall/statistics/trade/components/trade-transaction-card.vue @@ -7,6 +7,7 @@ import type { AnalysisOverviewIconItem } from '#/views/mall/home/components/data import { reactive, ref } from 'vue'; +import { confirm } from '@vben/common-ui'; import { EchartsUI, useEcharts } from '@vben/plugins/echarts'; import { calculateRelativeRate, @@ -17,7 +18,6 @@ import { } from '@vben/utils'; import dayjs from 'dayjs'; -import { ElMessageBox } from 'element-plus'; import * as TradeStatisticsApi from '#/api/mall/statistics/trade'; import AnalysisChartCard from '#/views/mall/home/components/analysis-chart-card.vue'; @@ -142,7 +142,7 @@ const loadOverview = () => { const handleExport = async () => { try { // 导出的二次确认 - await ElMessageBox.confirm('确定要导出交易状况吗?'); + await confirm('确定要导出交易状况吗?'); // 发起导出 exportLoading.value = true; const times = shortcutDateRangePicker.value.times; diff --git a/apps/web-ele/src/views/mall/trade/afterSale/modules/detail.vue b/apps/web-ele/src/views/mall/trade/afterSale/modules/detail.vue index 1c35bcef4..e721d761e 100644 --- a/apps/web-ele/src/views/mall/trade/afterSale/modules/detail.vue +++ b/apps/web-ele/src/views/mall/trade/afterSale/modules/detail.vue @@ -5,7 +5,7 @@ import type { MallOrderApi } from '#/api/mall/trade/order'; import { onMounted, ref } from 'vue'; import { useRoute, useRouter } from 'vue-router'; -import { Page } from '@vben/common-ui'; +import { confirm, Page } from '@vben/common-ui'; import { $t } from '@vben/locales'; import { fenToYuan, formatDate } from '@vben/utils'; @@ -14,7 +14,6 @@ import { ElDescriptionsItem, ElImage, ElMessage, - ElMessageBox, ElTimeline, ElTimelineItem, } from 'element-plus'; @@ -74,11 +73,7 @@ const getDetail = async () => { /** 同意售后 */ const agree = async () => { // 二次确认 - await ElMessageBox.confirm('是否同意售后?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm('是否同意售后?'); await AfterSaleApi.agree(formData.value.id!); // 提示成功 ElMessage.success($t('page.common.success')); @@ -93,11 +88,7 @@ const disagree = async () => { /** 确认收货 */ const receive = async () => { // 二次确认 - await ElMessageBox.confirm('是否确认收货?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm('是否确认收货?'); await AfterSaleApi.receive(formData.value.id!); // 提示成功 ElMessage.success($t('page.common.success')); @@ -107,11 +98,7 @@ const receive = async () => { /** 拒绝收货 */ const refuse = async () => { // 二次确认 - await ElMessageBox.confirm('是否拒绝收货?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm('是否拒绝收货?'); await AfterSaleApi.refuse(formData.value.id!); // 提示成功 ElMessage.success($t('page.common.success')); @@ -121,11 +108,7 @@ const refuse = async () => { /** 确认退款 */ const refund = async () => { // 二次确认 - await ElMessageBox.confirm('是否确认退款?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm('是否确认退款?'); await AfterSaleApi.refund(formData.value.id!); // 提示成功 ElMessage.success($t('page.common.success')); diff --git a/apps/web-ele/src/views/mall/trade/brokerage/user/index.vue b/apps/web-ele/src/views/mall/trade/brokerage/user/index.vue index 7841ac73b..003895c04 100644 --- a/apps/web-ele/src/views/mall/trade/brokerage/user/index.vue +++ b/apps/web-ele/src/views/mall/trade/brokerage/user/index.vue @@ -3,10 +3,10 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { MallBrokerageUserApi } from '#/api/mall/trade/brokerage/user'; import { useAccess } from '@vben/access'; -import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; +import { confirm, DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { $t } from '@vben/locales'; -import { ElLoading, ElMessage, ElMessageBox, ElSwitch } from 'element-plus'; +import { ElLoading, ElMessage, ElSwitch } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -68,11 +68,7 @@ function openCreateUserForm() { /** 清除上级推广人 */ async function handleClearBindUser(row: MallBrokerageUserApi.BrokerageUser) { - await ElMessageBox.confirm(`确定清除"${row.nickname}"的上级推广人吗?`, { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm(`确定清除"${row.nickname}"的上级推广人吗?`); await clearBindUser({ id: row.id as number }); ElMessage.success('清除成功'); onRefresh(); diff --git a/apps/web-ele/src/views/mall/trade/brokerage/withdraw/index.vue b/apps/web-ele/src/views/mall/trade/brokerage/withdraw/index.vue index 7fd2915f8..98d3d6d48 100644 --- a/apps/web-ele/src/views/mall/trade/brokerage/withdraw/index.vue +++ b/apps/web-ele/src/views/mall/trade/brokerage/withdraw/index.vue @@ -4,10 +4,10 @@ import type { MallBrokerageWithdrawApi } from '#/api/mall/trade/brokerage/withdr import { h } from 'vue'; -import { Page, prompt } from '@vben/common-ui'; +import { confirm, Page, prompt } from '@vben/common-ui'; import { formatDateTime } from '@vben/utils'; -import { ElInput, ElMessage, ElMessageBox } from 'element-plus'; +import { ElInput, ElMessage } from 'element-plus'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -35,11 +35,7 @@ function onRefresh() { /** 审核通过 */ async function handleApprove(row: MallBrokerageWithdrawApi.BrokerageWithdraw) { - await ElMessageBox.confirm('确定要审核通过吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm('确定要审核通过吗?'); await approveBrokerageWithdraw(row.id); ElMessage.success($t('ui.actionMessage.operationSuccess')); onRefresh(); @@ -73,11 +69,7 @@ function handleReject(row: MallBrokerageWithdrawApi.BrokerageWithdraw) { async function handleRetryTransfer( row: MallBrokerageWithdrawApi.BrokerageWithdraw, ) { - await ElMessageBox.confirm('确定要重新转账吗?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }); + await confirm('确定要重新转账吗?'); await approveBrokerageWithdraw(row.id); ElMessage.success($t('ui.actionMessage.operationSuccess')); onRefresh(); diff --git a/apps/web-ele/src/views/mall/trade/config/data.ts b/apps/web-ele/src/views/mall/trade/config/data.ts index 9c35219fc..a7bceff8f 100644 --- a/apps/web-ele/src/views/mall/trade/config/data.ts +++ b/apps/web-ele/src/views/mall/trade/config/data.ts @@ -26,9 +26,13 @@ export function useFormSchema(): VbenFormSchema[] { label: '退款理由', component: 'Select', componentProps: { - mode: 'tags', placeholder: '请直接输入退款理由', + multiple: true, + options: [], class: 'w-full', + allowCreate: true, + filterable: true, + reserveKeyword: false, }, dependencies: { triggerFields: ['type'], @@ -40,9 +44,13 @@ export function useFormSchema(): VbenFormSchema[] { label: '退货理由', component: 'Select', componentProps: { - mode: 'tags', placeholder: '请直接输入退货理由', + multiple: true, + options: [], class: 'w-full', + allowCreate: true, + filterable: true, + reserveKeyword: false, }, dependencies: { triggerFields: ['type'], diff --git a/apps/web-ele/src/views/mall/trade/config/index.vue b/apps/web-ele/src/views/mall/trade/config/index.vue index 9c1339d27..daf97f81a 100644 --- a/apps/web-ele/src/views/mall/trade/config/index.vue +++ b/apps/web-ele/src/views/mall/trade/config/index.vue @@ -59,10 +59,6 @@ onMounted(() => { }); const [Form, formApi] = useVbenForm({ - commonConfig: { - // 所有表单项 - labelClass: 'w-2/6', - }, wrapperClass: 'grid-cols-1', actionWrapperClass: 'text-center', handleSubmit: onSubmit, @@ -75,7 +71,7 @@ const [Form, formApi] = useVbenForm({