mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 04:29:20 +08:00
feat: 删除商品增加友好提示
This commit is contained in:
+7
@@ -12,6 +12,7 @@ import top.xyquan.ecomdmbbackend.modules.ec.shop.model.dto.ShopFilterDTO;
|
|||||||
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.dto.ShopProductPageFilterDTO;
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.dto.ShopProductPageFilterDTO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.dto.UpdateShopDTO;
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.dto.UpdateShopDTO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.product.model.vo.ProductVO;
|
import top.xyquan.ecomdmbbackend.modules.ec.product.model.vo.ProductVO;
|
||||||
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.vo.ShopDeleteImpactVO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.vo.ShopVO;
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.vo.ShopVO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.shop.service.ShopService;
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.service.ShopService;
|
||||||
|
|
||||||
@@ -51,6 +52,12 @@ public class ShopController {
|
|||||||
return ApiResponse.success("店铺删除成功");
|
return ApiResponse.success("店铺删除成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/delete-impact/{id}")
|
||||||
|
@RequirePermission(value = "ec:shop:delete", description = "查看删除店铺影响", allowSuper = true)
|
||||||
|
public ApiResponse<ShopDeleteImpactVO> getDeleteImpact(@PathVariable Long id) {
|
||||||
|
return ApiResponse.success("获取删除影响成功", shopService.getDeleteImpact(id));
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@RequirePermission(value = "ec:shop:read", description = "查询店铺列表", allowSuper = true)
|
@RequirePermission(value = "ec:shop:read", description = "查询店铺列表", allowSuper = true)
|
||||||
public ApiResponse<PageResultVO<ShopVO>> getShopPage(
|
public ApiResponse<PageResultVO<ShopVO>> getShopPage(
|
||||||
|
|||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
package top.xyquan.ecomdmbbackend.modules.ec.shop.model.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除店铺前的影响预览(级联将清除的数据量)。
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ShopDeleteImpactVO {
|
||||||
|
|
||||||
|
private Long shopId;
|
||||||
|
private String shopName;
|
||||||
|
/** 订单数 */
|
||||||
|
private long orderCount;
|
||||||
|
/** 商品广告费条数 */
|
||||||
|
private long adFeeCount;
|
||||||
|
/** 刷单费条数 */
|
||||||
|
private long fakeOrdersFeeCount;
|
||||||
|
/** 月销量目标条数 */
|
||||||
|
private long monthlyTargetCount;
|
||||||
|
}
|
||||||
+9
@@ -9,6 +9,7 @@ import top.xyquan.ecomdmbbackend.modules.ec.shop.model.dto.ShopProductPageFilter
|
|||||||
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.dto.UpdateShopDTO;
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.dto.UpdateShopDTO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.po.ShopPO;
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.po.ShopPO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.product.model.vo.ProductVO;
|
import top.xyquan.ecomdmbbackend.modules.ec.product.model.vo.ProductVO;
|
||||||
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.vo.ShopDeleteImpactVO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.vo.ShopVO;
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.vo.ShopVO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,6 +41,14 @@ public interface ShopService extends IService<ShopPO> {
|
|||||||
*/
|
*/
|
||||||
void deleteShop(Long id);
|
void deleteShop(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除前影响预览(级联将清除的业务数据量)
|
||||||
|
*
|
||||||
|
* @param id 店铺ID
|
||||||
|
* @return 影响计数
|
||||||
|
*/
|
||||||
|
ShopDeleteImpactVO getDeleteImpact(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页获取店铺列表
|
* 分页获取店铺列表
|
||||||
*
|
*
|
||||||
|
|||||||
+47
-1
@@ -14,8 +14,14 @@ import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.mapper.PddShopMapper;
|
|||||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.po.PddShopPO;
|
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.po.PddShopPO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.vo.PddShopVO;
|
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.model.vo.PddShopVO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.service.PddShopService;
|
import top.xyquan.ecomdmbbackend.modules.channel.pdd.shop.service.PddShopService;
|
||||||
|
import top.xyquan.ecomdmbbackend.modules.ec.order.mapper.OrderMapper;
|
||||||
|
import top.xyquan.ecomdmbbackend.modules.ec.order.model.po.OrderPO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.product.mapper.ProductMapper;
|
import top.xyquan.ecomdmbbackend.modules.ec.product.mapper.ProductMapper;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.platform.model.enums.PlatformCode;
|
import top.xyquan.ecomdmbbackend.modules.ec.platform.model.enums.PlatformCode;
|
||||||
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.adfee.mapper.AdFeeMapper;
|
||||||
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.adfee.model.po.AdFeePO;
|
||||||
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.fakeordersfee.mapper.FakeOrdersFeeMapper;
|
||||||
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.fakeordersfee.model.po.FakeOrdersFeePO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.shop.mapper.ShopMapper;
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.mapper.ShopMapper;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.shop.mapper.ShopProductRelationMapper;
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.mapper.ShopProductRelationMapper;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.dto.CreateShopDTO;
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.dto.CreateShopDTO;
|
||||||
@@ -28,8 +34,11 @@ import top.xyquan.ecomdmbbackend.modules.ec.shop.model.po.ShopPO;
|
|||||||
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.po.ShopProductRelationPO;
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.po.ShopProductRelationPO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.product.model.vo.ProductSkuVO;
|
import top.xyquan.ecomdmbbackend.modules.ec.product.model.vo.ProductSkuVO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.product.model.vo.ProductVO;
|
import top.xyquan.ecomdmbbackend.modules.ec.product.model.vo.ProductVO;
|
||||||
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.vo.ShopDeleteImpactVO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.vo.ShopVO;
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.model.vo.ShopVO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.product.service.ProductSkuService;
|
import top.xyquan.ecomdmbbackend.modules.ec.product.service.ProductSkuService;
|
||||||
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.monthlytarget.mapper.ShopMonthlyTargetMapper;
|
||||||
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.monthlytarget.model.po.ShopMonthlyTargetPO;
|
||||||
import top.xyquan.ecomdmbbackend.modules.ec.shop.service.ShopService;
|
import top.xyquan.ecomdmbbackend.modules.ec.shop.service.ShopService;
|
||||||
import top.xyquan.ecomdmbbackend.modules.sys.file.service.SysFileService;
|
import top.xyquan.ecomdmbbackend.modules.sys.file.service.SysFileService;
|
||||||
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
|
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
|
||||||
@@ -56,11 +65,18 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopPO> implements
|
|||||||
private final ProductSkuService productSkuService;
|
private final ProductSkuService productSkuService;
|
||||||
private final PddShopMapper pddShopMapper;
|
private final PddShopMapper pddShopMapper;
|
||||||
private final PddShopService pddShopService;
|
private final PddShopService pddShopService;
|
||||||
|
private final OrderMapper orderMapper;
|
||||||
|
private final AdFeeMapper adFeeMapper;
|
||||||
|
private final FakeOrdersFeeMapper fakeOrdersFeeMapper;
|
||||||
|
private final ShopMonthlyTargetMapper shopMonthlyTargetMapper;
|
||||||
|
|
||||||
public ShopServiceImpl(CurrentUserContext currentUserContext, SysFileService sysFileService,
|
public ShopServiceImpl(CurrentUserContext currentUserContext, SysFileService sysFileService,
|
||||||
ProductMapper productMapper,
|
ProductMapper productMapper,
|
||||||
ShopProductRelationMapper shopProductRelationMapper, ProductSkuService productSkuService,
|
ShopProductRelationMapper shopProductRelationMapper, ProductSkuService productSkuService,
|
||||||
PddShopMapper pddShopMapper, PddShopService pddShopService) {
|
PddShopMapper pddShopMapper, PddShopService pddShopService,
|
||||||
|
OrderMapper orderMapper, AdFeeMapper adFeeMapper,
|
||||||
|
FakeOrdersFeeMapper fakeOrdersFeeMapper,
|
||||||
|
ShopMonthlyTargetMapper shopMonthlyTargetMapper) {
|
||||||
this.currentUserContext = currentUserContext;
|
this.currentUserContext = currentUserContext;
|
||||||
this.sysFileService = sysFileService;
|
this.sysFileService = sysFileService;
|
||||||
this.productMapper = productMapper;
|
this.productMapper = productMapper;
|
||||||
@@ -68,6 +84,10 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopPO> implements
|
|||||||
this.productSkuService = productSkuService;
|
this.productSkuService = productSkuService;
|
||||||
this.pddShopMapper = pddShopMapper;
|
this.pddShopMapper = pddShopMapper;
|
||||||
this.pddShopService = pddShopService;
|
this.pddShopService = pddShopService;
|
||||||
|
this.orderMapper = orderMapper;
|
||||||
|
this.adFeeMapper = adFeeMapper;
|
||||||
|
this.fakeOrdersFeeMapper = fakeOrdersFeeMapper;
|
||||||
|
this.shopMonthlyTargetMapper = shopMonthlyTargetMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -176,6 +196,32 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopPO> implements
|
|||||||
this.removeById(id);
|
this.removeById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ShopDeleteImpactVO getDeleteImpact(Long id) {
|
||||||
|
Long companyId = currentUserContext.getCurrentCompanyId();
|
||||||
|
ShopPO shop = this.getById(id);
|
||||||
|
if (shop == null || !shop.getCompanyId().equals(companyId)) {
|
||||||
|
throw new BusinessException("店铺不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
ShopDeleteImpactVO vo = new ShopDeleteImpactVO();
|
||||||
|
vo.setShopId(shop.getId());
|
||||||
|
vo.setShopName(shop.getName());
|
||||||
|
vo.setOrderCount(orderMapper.selectCount(new LambdaQueryWrapper<OrderPO>()
|
||||||
|
.eq(OrderPO::getShopId, id)
|
||||||
|
.eq(OrderPO::getCompanyId, companyId)));
|
||||||
|
vo.setAdFeeCount(adFeeMapper.selectCount(new LambdaQueryWrapper<AdFeePO>()
|
||||||
|
.eq(AdFeePO::getShopId, id)
|
||||||
|
.eq(AdFeePO::getCompanyId, companyId)));
|
||||||
|
vo.setFakeOrdersFeeCount(fakeOrdersFeeMapper.selectCount(new LambdaQueryWrapper<FakeOrdersFeePO>()
|
||||||
|
.eq(FakeOrdersFeePO::getShopId, id)
|
||||||
|
.eq(FakeOrdersFeePO::getCompanyId, companyId)));
|
||||||
|
vo.setMonthlyTargetCount(shopMonthlyTargetMapper.selectCount(new LambdaQueryWrapper<ShopMonthlyTargetPO>()
|
||||||
|
.eq(ShopMonthlyTargetPO::getShopId, id)
|
||||||
|
.eq(ShopMonthlyTargetPO::getCompanyId, companyId)));
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取店铺分页列表
|
* 获取店铺分页列表
|
||||||
* @param pageQueryDTO 分页查询DTO
|
* @param pageQueryDTO 分页查询DTO
|
||||||
|
|||||||
@@ -37,6 +37,13 @@ export async function deleteShopApi(id: number) {
|
|||||||
return requestClient.delete(`/ec/shop/delete/${id}`);
|
return requestClient.delete(`/ec/shop/delete/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除店铺前影响预览
|
||||||
|
*/
|
||||||
|
export async function getShopDeleteImpactApi(id: number) {
|
||||||
|
return requestClient.get<ShopVO.DeleteImpact>(`/ec/shop/delete-impact/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店铺详情(含平台店铺及授权信息)
|
* 店铺详情(含平台店铺及授权信息)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -55,6 +55,16 @@ export interface PddShopInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export namespace ShopVO {
|
export namespace ShopVO {
|
||||||
|
/** 删除店铺影响预览 */
|
||||||
|
export interface DeleteImpact {
|
||||||
|
shopId: number;
|
||||||
|
shopName: string;
|
||||||
|
orderCount: number;
|
||||||
|
adFeeCount: number;
|
||||||
|
fakeOrdersFeeCount: number;
|
||||||
|
monthlyTargetCount: number;
|
||||||
|
}
|
||||||
|
|
||||||
/** 店铺信息 */
|
/** 店铺信息 */
|
||||||
export interface Info {
|
export interface Info {
|
||||||
/** 店铺ID */
|
/** 店铺ID */
|
||||||
|
|||||||
+128
@@ -0,0 +1,128 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import type { ShopVO } from '#/api/ec/shop/types';
|
||||||
|
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
|
import { Alert, Input, Modal, Spin, message } from 'ant-design-vue';
|
||||||
|
|
||||||
|
import {
|
||||||
|
deleteShopApi,
|
||||||
|
getShopDeleteImpactApi,
|
||||||
|
} from '#/api/ec/shop';
|
||||||
|
|
||||||
|
defineOptions({ name: 'ShopDeleteConfirmModal' });
|
||||||
|
|
||||||
|
const CONFIRM_TEXT = '确认删除';
|
||||||
|
|
||||||
|
const open = ref(false);
|
||||||
|
const loadingImpact = ref(false);
|
||||||
|
const deleting = ref(false);
|
||||||
|
const confirmInput = ref('');
|
||||||
|
const shopId = ref<number>();
|
||||||
|
const shopName = ref('');
|
||||||
|
const impact = ref<null | ShopVO.DeleteImpact>(null);
|
||||||
|
|
||||||
|
const canConfirm = computed(
|
||||||
|
() => confirmInput.value.trim() === CONFIRM_TEXT && !deleting.value,
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
success: [];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
async function openModal(shop: { id: number; name: string }) {
|
||||||
|
shopId.value = shop.id;
|
||||||
|
shopName.value = shop.name;
|
||||||
|
confirmInput.value = '';
|
||||||
|
impact.value = null;
|
||||||
|
open.value = true;
|
||||||
|
loadingImpact.value = true;
|
||||||
|
try {
|
||||||
|
impact.value = await getShopDeleteImpactApi(shop.id);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取删除影响失败:', error);
|
||||||
|
message.error('获取删除影响失败');
|
||||||
|
open.value = false;
|
||||||
|
} finally {
|
||||||
|
loadingImpact.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCancel() {
|
||||||
|
if (deleting.value) return;
|
||||||
|
open.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleOk() {
|
||||||
|
if (!canConfirm.value || shopId.value == null) {
|
||||||
|
return Promise.reject(new Error('confirm required'));
|
||||||
|
}
|
||||||
|
deleting.value = true;
|
||||||
|
try {
|
||||||
|
await deleteShopApi(shopId.value);
|
||||||
|
message.success('删除成功');
|
||||||
|
open.value = false;
|
||||||
|
emit('success');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('删除店铺失败:', error);
|
||||||
|
message.error('删除店铺失败');
|
||||||
|
return Promise.reject(error);
|
||||||
|
} finally {
|
||||||
|
deleting.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ open: openModal });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Modal
|
||||||
|
v-model:open="open"
|
||||||
|
title="删除店铺"
|
||||||
|
ok-text="永久删除"
|
||||||
|
ok-type="danger"
|
||||||
|
:ok-button-props="{ disabled: !canConfirm, loading: deleting }"
|
||||||
|
:cancel-button-props="{ disabled: deleting }"
|
||||||
|
:mask-closable="!deleting"
|
||||||
|
destroy-on-close
|
||||||
|
@ok="handleOk"
|
||||||
|
@cancel="handleCancel"
|
||||||
|
>
|
||||||
|
<Spin :spinning="loadingImpact">
|
||||||
|
<Alert
|
||||||
|
type="error"
|
||||||
|
show-icon
|
||||||
|
class="mb-4"
|
||||||
|
message="此操作不可恢复"
|
||||||
|
description="将永久删除该店铺及其下业务数据(订单明细随订单一并清除)。"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<p class="mb-2 text-sm">
|
||||||
|
即将删除店铺
|
||||||
|
<strong>{{ shopName || impact?.shopName }}</strong>
|
||||||
|
(ID: {{ shopId }})
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul class="mb-4 list-disc space-y-1 pl-5 text-sm text-muted-foreground">
|
||||||
|
<li>订单:{{ impact?.orderCount ?? '—' }} 条(含订单明细)</li>
|
||||||
|
<li>商品广告费:{{ impact?.adFeeCount ?? '—' }} 条</li>
|
||||||
|
<li>刷单费:{{ impact?.fakeOrdersFeeCount ?? '—' }} 条</li>
|
||||||
|
<li>月销量目标:{{ impact?.monthlyTargetCount ?? '—' }} 条</li>
|
||||||
|
<li>相关同步 / 计算任务等也会级联清除</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p class="mb-2 text-sm">
|
||||||
|
请在下方输入框中输入
|
||||||
|
<span class="font-semibold text-red-500">{{ CONFIRM_TEXT }}</span>
|
||||||
|
以确认删除:
|
||||||
|
</p>
|
||||||
|
<Input
|
||||||
|
v-model:value="confirmInput"
|
||||||
|
:placeholder="`请输入 ${CONFIRM_TEXT}`"
|
||||||
|
:disabled="deleting || loadingImpact"
|
||||||
|
allow-clear
|
||||||
|
@press-enter="handleOk"
|
||||||
|
/>
|
||||||
|
</Spin>
|
||||||
|
</Modal>
|
||||||
|
</template>
|
||||||
@@ -10,7 +10,7 @@ import { computed, onMounted, onUnmounted, ref } from 'vue';
|
|||||||
import { Page } from '@vben/common-ui';
|
import { Page } from '@vben/common-ui';
|
||||||
import { createIconifyIcon } from '@vben/icons';
|
import { createIconifyIcon } from '@vben/icons';
|
||||||
|
|
||||||
import { Button, message, Popconfirm, Space, Steps, Tag } from 'ant-design-vue';
|
import { Button, message, Space, Steps, Tag } from 'ant-design-vue';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
@@ -19,7 +19,7 @@ import { batchPddOrderSyncStatusApi } from '#/api/channel/pdd/order-sync';
|
|||||||
import { batchPddAdFeePipelineStatusApi } from '#/api/channel/pdd/goods-ad-fee-import';
|
import { batchPddAdFeePipelineStatusApi } from '#/api/channel/pdd/goods-ad-fee-import';
|
||||||
import type { PddGoodsAdFeeImportVO } from '#/api/channel/pdd/goods-ad-fee-import';
|
import type { PddGoodsAdFeeImportVO } from '#/api/channel/pdd/goods-ad-fee-import';
|
||||||
import { getPlatformListApi } from '#/api/ec/platform';
|
import { getPlatformListApi } from '#/api/ec/platform';
|
||||||
import { deleteShopApi, getShopPageApi } from '#/api/ec/shop';
|
import { getShopPageApi } from '#/api/ec/shop';
|
||||||
import { PermissionGate } from '#/components/permission';
|
import { PermissionGate } from '#/components/permission';
|
||||||
import {
|
import {
|
||||||
syncVxeGridColumns,
|
syncVxeGridColumns,
|
||||||
@@ -30,6 +30,7 @@ import {
|
|||||||
getPlatformTagColor,
|
getPlatformTagColor,
|
||||||
} from '#/utils/platform-display';
|
} from '#/utils/platform-display';
|
||||||
|
|
||||||
|
import ShopDeleteConfirmModal from '../components/ShopDeleteConfirmModal.vue';
|
||||||
import ShopFormModal from './components/ShopFormModal.vue';
|
import ShopFormModal from './components/ShopFormModal.vue';
|
||||||
import ShopOrderPipelineDrawer from './components/ShopOrderPipelineDrawer.vue';
|
import ShopOrderPipelineDrawer from './components/ShopOrderPipelineDrawer.vue';
|
||||||
import ShopAdFeePipelineDrawer from './components/ShopAdFeePipelineDrawer.vue';
|
import ShopAdFeePipelineDrawer from './components/ShopAdFeePipelineDrawer.vue';
|
||||||
@@ -44,6 +45,7 @@ const PlusIcon = createIconifyIcon('lucide:plus');
|
|||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const authorizing = ref(false);
|
const authorizing = ref(false);
|
||||||
const shopFormModalRef = ref();
|
const shopFormModalRef = ref();
|
||||||
|
const shopDeleteModalRef = ref<InstanceType<typeof ShopDeleteConfirmModal>>();
|
||||||
const pddShopDetailModalRef = ref();
|
const pddShopDetailModalRef = ref();
|
||||||
const pipelineDrawerRef = ref<InstanceType<typeof ShopOrderPipelineDrawer>>();
|
const pipelineDrawerRef = ref<InstanceType<typeof ShopOrderPipelineDrawer>>();
|
||||||
const adFeePipelineDrawerRef = ref<InstanceType<typeof ShopAdFeePipelineDrawer>>();
|
const adFeePipelineDrawerRef = ref<InstanceType<typeof ShopAdFeePipelineDrawer>>();
|
||||||
@@ -612,15 +614,8 @@ function handleEdit(record: ShopListRow) {
|
|||||||
shopFormModalRef.value?.open(true, asShopInfo(record));
|
shopFormModalRef.value?.open(true, asShopInfo(record));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleDelete(record: ShopListRow) {
|
function handleDelete(record: ShopListRow) {
|
||||||
try {
|
shopDeleteModalRef.value?.open({ id: record.id, name: record.name });
|
||||||
await deleteShopApi(record.id);
|
|
||||||
message.success('删除成功');
|
|
||||||
refreshTable();
|
|
||||||
} catch (error) {
|
|
||||||
console.error('删除店铺失败:', error);
|
|
||||||
message.error('删除店铺失败');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleModalSuccess() {
|
function handleModalSuccess() {
|
||||||
@@ -865,18 +860,17 @@ onUnmounted(() => {
|
|||||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||||
</PermissionGate>
|
</PermissionGate>
|
||||||
<PermissionGate code="ec:shop:delete">
|
<PermissionGate code="ec:shop:delete">
|
||||||
<Popconfirm
|
<Button size="small" danger @click="handleDelete(row)">删除</Button>
|
||||||
title="确定要删除这个店铺吗?"
|
|
||||||
@confirm="handleDelete(row)"
|
|
||||||
>
|
|
||||||
<Button size="small" danger>删除</Button>
|
|
||||||
</Popconfirm>
|
|
||||||
</PermissionGate>
|
</PermissionGate>
|
||||||
</Space>
|
</Space>
|
||||||
</template>
|
</template>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<ShopFormModal ref="shopFormModalRef" @success="handleModalSuccess" />
|
<ShopFormModal ref="shopFormModalRef" @success="handleModalSuccess" />
|
||||||
|
<ShopDeleteConfirmModal
|
||||||
|
ref="shopDeleteModalRef"
|
||||||
|
@success="handleModalSuccess"
|
||||||
|
/>
|
||||||
<PddShopDetailModal ref="pddShopDetailModalRef" />
|
<PddShopDetailModal ref="pddShopDetailModalRef" />
|
||||||
<ShopOrderPipelineDrawer
|
<ShopOrderPipelineDrawer
|
||||||
ref="pipelineDrawerRef"
|
ref="pipelineDrawerRef"
|
||||||
|
|||||||
@@ -14,15 +14,15 @@ import {
|
|||||||
Input,
|
Input,
|
||||||
message,
|
message,
|
||||||
Pagination,
|
Pagination,
|
||||||
Popconfirm,
|
|
||||||
Spin,
|
Spin,
|
||||||
Tag,
|
Tag,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
|
|
||||||
import { deleteShopApi, getShopPageApi } from '#/api/ec/shop';
|
import { getShopPageApi } from '#/api/ec/shop';
|
||||||
import { getPlatformListApi } from '#/api/ec/platform/apis';
|
import { getPlatformListApi } from '#/api/ec/platform/apis';
|
||||||
import type { PlatformVO } from '#/api/ec/platform/types';
|
import type { PlatformVO } from '#/api/ec/platform/types';
|
||||||
|
|
||||||
|
import ShopDeleteConfirmModal from '../components/ShopDeleteConfirmModal.vue';
|
||||||
import ShopFormModal from '../list/components/ShopFormModal.vue';
|
import ShopFormModal from '../list/components/ShopFormModal.vue';
|
||||||
|
|
||||||
defineOptions({ name: 'ShopManagement' });
|
defineOptions({ name: 'ShopManagement' });
|
||||||
@@ -41,6 +41,7 @@ const searchName = ref('');
|
|||||||
const platformOptions = ref<{ label: string; value: string }[]>([]);
|
const platformOptions = ref<{ label: string; value: string }[]>([]);
|
||||||
|
|
||||||
const shopFormModalRef = ref();
|
const shopFormModalRef = ref();
|
||||||
|
const shopDeleteModalRef = ref<InstanceType<typeof ShopDeleteConfirmModal>>();
|
||||||
|
|
||||||
async function fetchShops() {
|
async function fetchShops() {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
@@ -71,14 +72,8 @@ function handleEdit(record: ShopVO.Info) {
|
|||||||
shopFormModalRef.value?.open(true, record);
|
shopFormModalRef.value?.open(true, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleDelete(record: ShopVO.Info) {
|
function handleDelete(record: ShopVO.Info) {
|
||||||
try {
|
shopDeleteModalRef.value?.open({ id: record.id, name: record.name });
|
||||||
await deleteShopApi(record.id);
|
|
||||||
message.success('删除成功');
|
|
||||||
void fetchShops();
|
|
||||||
} catch {
|
|
||||||
message.error('删除失败');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleModalSuccess() {
|
function handleModalSuccess() {
|
||||||
@@ -199,12 +194,9 @@ onMounted(async () => {
|
|||||||
<Button size="small" type="link" @click="handleEdit(shop)">
|
<Button size="small" type="link" @click="handleEdit(shop)">
|
||||||
编辑
|
编辑
|
||||||
</Button>
|
</Button>
|
||||||
<Popconfirm
|
<Button size="small" type="link" danger @click="handleDelete(shop)">
|
||||||
title="确定删除这个店铺?"
|
删除
|
||||||
@confirm="handleDelete(shop)"
|
</Button>
|
||||||
>
|
|
||||||
<Button size="small" type="link" danger>删除</Button>
|
|
||||||
</Popconfirm>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -230,5 +222,9 @@ onMounted(async () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ShopFormModal ref="shopFormModalRef" @success="handleModalSuccess" />
|
<ShopFormModal ref="shopFormModalRef" @success="handleModalSuccess" />
|
||||||
|
<ShopDeleteConfirmModal
|
||||||
|
ref="shopDeleteModalRef"
|
||||||
|
@success="handleModalSuccess"
|
||||||
|
/>
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user