mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 22:29:19 +08:00
最近一丢丢
This commit is contained in:
+9
-1
@@ -18,7 +18,7 @@ import java.util.List;
|
|||||||
* 订单状态控制器
|
* 订单状态控制器
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/ec/order-status")
|
@RequestMapping("/ec/order-status")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Tag(name = "电商-订单状态管理", description = "订单状态相关接口")
|
@Tag(name = "电商-订单状态管理", description = "订单状态相关接口")
|
||||||
public class OrderStatusController {
|
public class OrderStatusController {
|
||||||
@@ -68,4 +68,12 @@ public class OrderStatusController {
|
|||||||
List<OrderStatusVO> list = orderStatusService.getAllOrderStatusList();
|
List<OrderStatusVO> list = orderStatusService.getAllOrderStatusList();
|
||||||
return ApiResponse.success(list);
|
return ApiResponse.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/init")
|
||||||
|
@Operation(summary = "初始化订单状态数据", description = "为当前公司初始化默认的订单状态数据")
|
||||||
|
public ApiResponse<Void> initOrderStatus() {
|
||||||
|
// 这里需要从CurrentUserContext获取当前公司ID,但为了保持接口简洁,我们修改服务层方法
|
||||||
|
orderStatusService.initOrderStatusForCurrentCompany();
|
||||||
|
return ApiResponse.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ import top.xyquan.ecomdmbbackend.modules.ec.service.PromotionFeeService;
|
|||||||
* 推广费记录控制器
|
* 推广费记录控制器
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/ec/promotion-fee")
|
@RequestMapping("/ec/promotion-fee")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Tag(name = "电商-推广费记录管理", description = "推广费记录相关接口")
|
@Tag(name = "电商-推广费记录管理", description = "推广费记录相关接口")
|
||||||
public class PromotionFeeController {
|
public class PromotionFeeController {
|
||||||
|
|||||||
+8
-1
@@ -18,7 +18,7 @@ import java.util.List;
|
|||||||
* 推广费类型控制器
|
* 推广费类型控制器
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/ec/promotion-fee-type")
|
@RequestMapping("/ec/promotion-fee-type")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Tag(name = "电商-推广费类型管理", description = "推广费类型相关接口")
|
@Tag(name = "电商-推广费类型管理", description = "推广费类型相关接口")
|
||||||
public class PromotionFeeTypeController {
|
public class PromotionFeeTypeController {
|
||||||
@@ -68,4 +68,11 @@ public class PromotionFeeTypeController {
|
|||||||
List<PromotionFeeTypeVO> list = promotionFeeTypeService.getAllPromotionFeeTypeList();
|
List<PromotionFeeTypeVO> list = promotionFeeTypeService.getAllPromotionFeeTypeList();
|
||||||
return ApiResponse.success(list);
|
return ApiResponse.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/init")
|
||||||
|
@Operation(summary = "初始化推广费类型数据", description = "为当前公司初始化默认的推广费类型数据")
|
||||||
|
public ApiResponse<Void> initPromotionFeeType() {
|
||||||
|
promotionFeeTypeService.initPromotionFeeTypeForCurrentCompany();
|
||||||
|
return ApiResponse.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -20,6 +20,12 @@ public class OrderStatusPO {
|
|||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司ID
|
||||||
|
*/
|
||||||
|
@TableField("company_id")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态码
|
* 状态码
|
||||||
*/
|
*/
|
||||||
|
|||||||
+6
@@ -20,6 +20,12 @@ public class PromotionFeeTypePO {
|
|||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司ID
|
||||||
|
*/
|
||||||
|
@TableField("company_id")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类型编码
|
* 类型编码
|
||||||
*/
|
*/
|
||||||
|
|||||||
+6
@@ -18,6 +18,12 @@ public class OrderStatusVO {
|
|||||||
@Schema(description = "状态ID", example = "1")
|
@Schema(description = "状态ID", example = "1")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "公司ID", example = "1")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态码
|
* 状态码
|
||||||
*/
|
*/
|
||||||
|
|||||||
+6
@@ -18,6 +18,12 @@ public class PromotionFeeTypeVO {
|
|||||||
@Schema(description = "推广费类型ID", example = "1")
|
@Schema(description = "推广费类型ID", example = "1")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "公司ID", example = "1")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类型编码
|
* 类型编码
|
||||||
*/
|
*/
|
||||||
|
|||||||
+10
@@ -40,4 +40,14 @@ public interface OrderStatusService {
|
|||||||
* 查询所有订单状态列表
|
* 查询所有订单状态列表
|
||||||
*/
|
*/
|
||||||
List<OrderStatusVO> getAllOrderStatusList();
|
List<OrderStatusVO> getAllOrderStatusList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化公司订单状态数据
|
||||||
|
*/
|
||||||
|
void initOrderStatusForCompany(Long companyId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化当前公司订单状态数据
|
||||||
|
*/
|
||||||
|
void initOrderStatusForCurrentCompany();
|
||||||
}
|
}
|
||||||
|
|||||||
+10
@@ -40,4 +40,14 @@ public interface PromotionFeeTypeService {
|
|||||||
* 查询所有推广费类型列表
|
* 查询所有推广费类型列表
|
||||||
*/
|
*/
|
||||||
List<PromotionFeeTypeVO> getAllPromotionFeeTypeList();
|
List<PromotionFeeTypeVO> getAllPromotionFeeTypeList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化公司推广费类型数据
|
||||||
|
*/
|
||||||
|
void initPromotionFeeTypeForCompany(Long companyId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化当前公司推广费类型数据
|
||||||
|
*/
|
||||||
|
void initPromotionFeeTypeForCurrentCompany();
|
||||||
}
|
}
|
||||||
|
|||||||
+73
-2
@@ -29,8 +29,18 @@ public class OrderStatusServiceImpl implements OrderStatusService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long createOrderStatus(CreateOrderStatusDTO dto) {
|
public Long createOrderStatus(CreateOrderStatusDTO dto) {
|
||||||
|
// 检查状态码是否重复
|
||||||
|
LambdaQueryWrapper<OrderStatusPO> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(OrderStatusPO::getCompanyId, currentUserContext.getCurrentCompanyId())
|
||||||
|
.eq(OrderStatusPO::getStatusCode, dto.getStatusCode())
|
||||||
|
.isNull(OrderStatusPO::getDeleteTime);
|
||||||
|
if (orderStatusMapper.selectCount(wrapper) > 0) {
|
||||||
|
throw new RuntimeException("该状态码已存在");
|
||||||
|
}
|
||||||
|
|
||||||
OrderStatusPO po = new OrderStatusPO();
|
OrderStatusPO po = new OrderStatusPO();
|
||||||
BeanUtils.copyProperties(dto, po);
|
BeanUtils.copyProperties(dto, po);
|
||||||
|
po.setCompanyId(currentUserContext.getCurrentCompanyId());
|
||||||
po.setCreateBy(currentUserContext.getCurrentUserId());
|
po.setCreateBy(currentUserContext.getCurrentUserId());
|
||||||
po.setUpdateBy(currentUserContext.getCurrentUserId());
|
po.setUpdateBy(currentUserContext.getCurrentUserId());
|
||||||
|
|
||||||
@@ -74,7 +84,8 @@ public class OrderStatusServiceImpl implements OrderStatusService {
|
|||||||
@Override
|
@Override
|
||||||
public List<OrderStatusVO> getActiveOrderStatusList() {
|
public List<OrderStatusVO> getActiveOrderStatusList() {
|
||||||
LambdaQueryWrapper<OrderStatusPO> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<OrderStatusPO> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(OrderStatusPO::getIsActive, 1) // 1表示启用状态
|
wrapper.eq(OrderStatusPO::getCompanyId, currentUserContext.getCurrentCompanyId())
|
||||||
|
.eq(OrderStatusPO::getIsActive, 1) // 1表示启用状态
|
||||||
.isNull(OrderStatusPO::getDeleteTime)
|
.isNull(OrderStatusPO::getDeleteTime)
|
||||||
.orderByAsc(OrderStatusPO::getSortOrder);
|
.orderByAsc(OrderStatusPO::getSortOrder);
|
||||||
|
|
||||||
@@ -91,7 +102,8 @@ public class OrderStatusServiceImpl implements OrderStatusService {
|
|||||||
@Override
|
@Override
|
||||||
public List<OrderStatusVO> getAllOrderStatusList() {
|
public List<OrderStatusVO> getAllOrderStatusList() {
|
||||||
LambdaQueryWrapper<OrderStatusPO> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<OrderStatusPO> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.isNull(OrderStatusPO::getDeleteTime)
|
wrapper.eq(OrderStatusPO::getCompanyId, currentUserContext.getCurrentCompanyId())
|
||||||
|
.isNull(OrderStatusPO::getDeleteTime)
|
||||||
.orderByAsc(OrderStatusPO::getSortOrder);
|
.orderByAsc(OrderStatusPO::getSortOrder);
|
||||||
|
|
||||||
List<OrderStatusPO> poList = orderStatusMapper.selectList(wrapper);
|
List<OrderStatusPO> poList = orderStatusMapper.selectList(wrapper);
|
||||||
@@ -103,4 +115,63 @@ public class OrderStatusServiceImpl implements OrderStatusService {
|
|||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化公司订单状态数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void initOrderStatusForCompany(Long companyId) {
|
||||||
|
// 检查是否已经初始化过
|
||||||
|
LambdaQueryWrapper<OrderStatusPO> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(OrderStatusPO::getCompanyId, companyId)
|
||||||
|
.isNull(OrderStatusPO::getDeleteTime);
|
||||||
|
if (orderStatusMapper.selectCount(wrapper) > 0) {
|
||||||
|
return; // 已经初始化过,直接返回
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化订单状态数据
|
||||||
|
List<OrderStatusPO> initialStatuses = List.of(
|
||||||
|
createOrderStatusPO(companyId, 0, "待发货", "订单已创建,等待发货", 1),
|
||||||
|
createOrderStatusPO(companyId, 1, "已发货", "商品已发出,运输中", 2),
|
||||||
|
createOrderStatusPO(companyId, 2, "已完成", "订单已完成,交易成功", 3),
|
||||||
|
createOrderStatusPO(companyId, 3, "已取消", "订单已取消", 4),
|
||||||
|
createOrderStatusPO(companyId, 4, "退款中", "正在处理退款", 5),
|
||||||
|
createOrderStatusPO(companyId, 5, "已退款", "退款已完成", 6)
|
||||||
|
);
|
||||||
|
|
||||||
|
// 批量插入
|
||||||
|
for (OrderStatusPO status : initialStatuses) {
|
||||||
|
orderStatusMapper.insert(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化当前公司订单状态数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void initOrderStatusForCurrentCompany() {
|
||||||
|
Long companyId = currentUserContext.getCurrentCompanyId();
|
||||||
|
if (companyId == null) {
|
||||||
|
throw new RuntimeException("用户未关联公司");
|
||||||
|
}
|
||||||
|
initOrderStatusForCompany(companyId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建订单状态PO对象
|
||||||
|
*/
|
||||||
|
private OrderStatusPO createOrderStatusPO(Long companyId, Integer statusCode, String statusName, String description, Integer sortOrder) {
|
||||||
|
OrderStatusPO po = new OrderStatusPO();
|
||||||
|
po.setCompanyId(companyId);
|
||||||
|
po.setStatusCode(statusCode);
|
||||||
|
po.setStatusName(statusName);
|
||||||
|
po.setDescription(description);
|
||||||
|
po.setSortOrder(sortOrder);
|
||||||
|
po.setIsActive(1);
|
||||||
|
po.setCreateBy(1L); // 系统初始化
|
||||||
|
po.setUpdateBy(1L);
|
||||||
|
return po;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+81
-2
@@ -29,8 +29,18 @@ public class PromotionFeeTypeServiceImpl implements PromotionFeeTypeService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long createPromotionFeeType(CreatePromotionFeeTypeDTO dto) {
|
public Long createPromotionFeeType(CreatePromotionFeeTypeDTO dto) {
|
||||||
|
// 检查类型编码是否重复
|
||||||
|
LambdaQueryWrapper<PromotionFeeTypePO> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(PromotionFeeTypePO::getCompanyId, currentUserContext.getCurrentCompanyId())
|
||||||
|
.eq(PromotionFeeTypePO::getTypeCode, dto.getTypeCode())
|
||||||
|
.isNull(PromotionFeeTypePO::getDeleteTime);
|
||||||
|
if (promotionFeeTypeMapper.selectCount(wrapper) > 0) {
|
||||||
|
throw new RuntimeException("该类型编码已存在");
|
||||||
|
}
|
||||||
|
|
||||||
PromotionFeeTypePO po = new PromotionFeeTypePO();
|
PromotionFeeTypePO po = new PromotionFeeTypePO();
|
||||||
BeanUtils.copyProperties(dto, po);
|
BeanUtils.copyProperties(dto, po);
|
||||||
|
po.setCompanyId(currentUserContext.getCurrentCompanyId());
|
||||||
po.setCreateBy(currentUserContext.getCurrentUserId());
|
po.setCreateBy(currentUserContext.getCurrentUserId());
|
||||||
po.setUpdateBy(currentUserContext.getCurrentUserId());
|
po.setUpdateBy(currentUserContext.getCurrentUserId());
|
||||||
|
|
||||||
@@ -95,7 +105,13 @@ public class PromotionFeeTypeServiceImpl implements PromotionFeeTypeService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PromotionFeeTypeVO> getActivePromotionFeeTypeList() {
|
public List<PromotionFeeTypeVO> getActivePromotionFeeTypeList() {
|
||||||
List<PromotionFeeTypePO> poList = promotionFeeTypeMapper.selectActiveTypeList();
|
LambdaQueryWrapper<PromotionFeeTypePO> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(PromotionFeeTypePO::getCompanyId, currentUserContext.getCurrentCompanyId())
|
||||||
|
.eq(PromotionFeeTypePO::getIsActive, 1)
|
||||||
|
.isNull(PromotionFeeTypePO::getDeleteTime)
|
||||||
|
.orderByAsc(PromotionFeeTypePO::getSortOrder);
|
||||||
|
|
||||||
|
List<PromotionFeeTypePO> poList = promotionFeeTypeMapper.selectList(wrapper);
|
||||||
return poList.stream()
|
return poList.stream()
|
||||||
.map(po -> {
|
.map(po -> {
|
||||||
PromotionFeeTypeVO vo = new PromotionFeeTypeVO();
|
PromotionFeeTypeVO vo = new PromotionFeeTypeVO();
|
||||||
@@ -130,7 +146,8 @@ public class PromotionFeeTypeServiceImpl implements PromotionFeeTypeService {
|
|||||||
@Override
|
@Override
|
||||||
public List<PromotionFeeTypeVO> getAllPromotionFeeTypeList() {
|
public List<PromotionFeeTypeVO> getAllPromotionFeeTypeList() {
|
||||||
LambdaQueryWrapper<PromotionFeeTypePO> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<PromotionFeeTypePO> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(PromotionFeeTypePO::getDeleteTime, null)
|
wrapper.eq(PromotionFeeTypePO::getCompanyId, currentUserContext.getCurrentCompanyId())
|
||||||
|
.isNull(PromotionFeeTypePO::getDeleteTime)
|
||||||
.orderByAsc(PromotionFeeTypePO::getSortOrder);
|
.orderByAsc(PromotionFeeTypePO::getSortOrder);
|
||||||
|
|
||||||
List<PromotionFeeTypePO> poList = promotionFeeTypeMapper.selectList(wrapper);
|
List<PromotionFeeTypePO> poList = promotionFeeTypeMapper.selectList(wrapper);
|
||||||
@@ -164,4 +181,66 @@ public class PromotionFeeTypeServiceImpl implements PromotionFeeTypeService {
|
|||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化公司推广费类型数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void initPromotionFeeTypeForCompany(Long companyId) {
|
||||||
|
// 检查是否已经初始化过
|
||||||
|
LambdaQueryWrapper<PromotionFeeTypePO> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(PromotionFeeTypePO::getCompanyId, companyId)
|
||||||
|
.isNull(PromotionFeeTypePO::getDeleteTime);
|
||||||
|
if (promotionFeeTypeMapper.selectCount(wrapper) > 0) {
|
||||||
|
return; // 已经初始化过,直接返回
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化推广费类型数据
|
||||||
|
List<PromotionFeeTypePO> initialTypes = List.of(
|
||||||
|
createPromotionFeeTypePO(companyId, "DIRECT_TRAFFIC", "直通车", "淘宝直通车推广费用", 3, 1),
|
||||||
|
createPromotionFeeTypePO(companyId, "DIAMOND_DISPLAY", "钻展", "钻石展位推广费用", 4, 2),
|
||||||
|
createPromotionFeeTypePO(companyId, "SUPER_RECOMMEND", "超级推荐", "超级推荐推广费用", 3, 3),
|
||||||
|
createPromotionFeeTypePO(companyId, "PLATFORM_COMMISSION", "平台佣金", "平台交易佣金", 2, 4),
|
||||||
|
createPromotionFeeTypePO(companyId, "DISTRIBUTION_COMMISSION", "分销佣金", "分销商佣金", 2, 5),
|
||||||
|
createPromotionFeeTypePO(companyId, "ACTIVITY_FEE", "活动费用", "平台活动参与费用", 1, 6),
|
||||||
|
createPromotionFeeTypePO(companyId, "EXTERNAL_AD", "站外广告", "站外广告投放费用", 1, 7),
|
||||||
|
createPromotionFeeTypePO(companyId, "LIVE_STREAMING", "直播推广", "直播推广费用", 1, 8)
|
||||||
|
);
|
||||||
|
|
||||||
|
// 批量插入
|
||||||
|
for (PromotionFeeTypePO type : initialTypes) {
|
||||||
|
promotionFeeTypeMapper.insert(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化当前公司推广费类型数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void initPromotionFeeTypeForCurrentCompany() {
|
||||||
|
Long companyId = currentUserContext.getCurrentCompanyId();
|
||||||
|
if (companyId == null) {
|
||||||
|
throw new RuntimeException("用户未关联公司");
|
||||||
|
}
|
||||||
|
initPromotionFeeTypeForCompany(companyId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建推广费类型PO对象
|
||||||
|
*/
|
||||||
|
private PromotionFeeTypePO createPromotionFeeTypePO(Long companyId, String typeCode, String typeName, String description, Integer calculationMethod, Integer sortOrder) {
|
||||||
|
PromotionFeeTypePO po = new PromotionFeeTypePO();
|
||||||
|
po.setCompanyId(companyId);
|
||||||
|
po.setTypeCode(typeCode);
|
||||||
|
po.setTypeName(typeName);
|
||||||
|
po.setDescription(description);
|
||||||
|
po.setCalculationMethod(calculationMethod);
|
||||||
|
po.setSortOrder(sortOrder);
|
||||||
|
po.setIsActive(1);
|
||||||
|
po.setCreateBy(1L); // 系统初始化
|
||||||
|
po.setUpdateBy(1L);
|
||||||
|
return po;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-1
@@ -19,6 +19,8 @@ import top.xyquan.ecomdmbbackend.modules.org.model.vo.CompanyVO;
|
|||||||
import top.xyquan.ecomdmbbackend.modules.org.service.CompanyService;
|
import top.xyquan.ecomdmbbackend.modules.org.service.CompanyService;
|
||||||
import top.xyquan.ecomdmbbackend.modules.media.service.MediaImageService;
|
import top.xyquan.ecomdmbbackend.modules.media.service.MediaImageService;
|
||||||
import top.xyquan.ecomdmbbackend.modules.media.model.vo.MediaImageVO;
|
import top.xyquan.ecomdmbbackend.modules.media.model.vo.MediaImageVO;
|
||||||
|
import top.xyquan.ecomdmbbackend.modules.ec.service.OrderStatusService;
|
||||||
|
import top.xyquan.ecomdmbbackend.modules.ec.service.PromotionFeeTypeService;
|
||||||
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
|
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@@ -34,10 +36,14 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, CompanyPO> im
|
|||||||
|
|
||||||
private final CurrentUserContext currentUserContext;
|
private final CurrentUserContext currentUserContext;
|
||||||
private final MediaImageService mediaImageService;
|
private final MediaImageService mediaImageService;
|
||||||
|
private final OrderStatusService orderStatusService;
|
||||||
|
private final PromotionFeeTypeService promotionFeeTypeService;
|
||||||
|
|
||||||
public CompanyServiceImpl(CurrentUserContext currentUserContext, MediaImageService mediaImageService) {
|
public CompanyServiceImpl(CurrentUserContext currentUserContext, MediaImageService mediaImageService, OrderStatusService orderStatusService, PromotionFeeTypeService promotionFeeTypeService) {
|
||||||
this.currentUserContext = currentUserContext;
|
this.currentUserContext = currentUserContext;
|
||||||
this.mediaImageService = mediaImageService;
|
this.mediaImageService = mediaImageService;
|
||||||
|
this.orderStatusService = orderStatusService;
|
||||||
|
this.promotionFeeTypeService = promotionFeeTypeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -73,6 +79,12 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, CompanyPO> im
|
|||||||
// 保存公司
|
// 保存公司
|
||||||
this.save(company);
|
this.save(company);
|
||||||
|
|
||||||
|
// 初始化订单状态数据
|
||||||
|
orderStatusService.initOrderStatusForCompany(company.getId());
|
||||||
|
|
||||||
|
// 初始化推广费类型数据
|
||||||
|
promotionFeeTypeService.initPromotionFeeTypeForCompany(company.getId());
|
||||||
|
|
||||||
// 转换为VO并返回
|
// 转换为VO并返回
|
||||||
return convertToVO(company);
|
return convertToVO(company);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ CREATE TABLE `ec_product_spec` (
|
|||||||
-- 订单状态表
|
-- 订单状态表
|
||||||
CREATE TABLE `ec_order_status` (
|
CREATE TABLE `ec_order_status` (
|
||||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '状态ID',
|
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '状态ID',
|
||||||
|
`company_id` BIGINT UNSIGNED NOT NULL COMMENT '公司ID',
|
||||||
`status_code` TINYINT NOT NULL COMMENT '状态码',
|
`status_code` TINYINT NOT NULL COMMENT '状态码',
|
||||||
`status_name` VARCHAR(50) NOT NULL COMMENT '状态名称',
|
`status_name` VARCHAR(50) NOT NULL COMMENT '状态名称',
|
||||||
`description` VARCHAR(200) DEFAULT NULL COMMENT '状态描述',
|
`description` VARCHAR(200) DEFAULT NULL COMMENT '状态描述',
|
||||||
@@ -94,26 +95,19 @@ CREATE TABLE `ec_order_status` (
|
|||||||
`update_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '更新人ID',
|
`update_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '更新人ID',
|
||||||
`delete_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '删除人ID',
|
`delete_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '删除人ID',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `uk_status_code` (`status_code`),
|
KEY `idx_company_id` (`company_id`),
|
||||||
|
UNIQUE KEY `uk_company_status_code` (`company_id`, `status_code`),
|
||||||
KEY `idx_sort_order` (`sort_order`),
|
KEY `idx_sort_order` (`sort_order`),
|
||||||
KEY `idx_is_active` (`is_active`),
|
KEY `idx_is_active` (`is_active`),
|
||||||
KEY `fk_ec_order_status_creator` (`create_by`),
|
KEY `fk_ec_order_status_creator` (`create_by`),
|
||||||
KEY `fk_ec_order_status_updater` (`update_by`),
|
KEY `fk_ec_order_status_updater` (`update_by`),
|
||||||
KEY `fk_ec_order_status_deleter` (`delete_by`),
|
KEY `fk_ec_order_status_deleter` (`delete_by`),
|
||||||
|
CONSTRAINT `fk_ec_order_status_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
CONSTRAINT `fk_ec_order_status_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
CONSTRAINT `fk_ec_order_status_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||||
CONSTRAINT `fk_ec_order_status_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
CONSTRAINT `fk_ec_order_status_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||||
CONSTRAINT `fk_ec_order_status_deleter` FOREIGN KEY (`delete_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
CONSTRAINT `fk_ec_order_status_deleter` FOREIGN KEY (`delete_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='电商-订单状态表';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='电商-订单状态表';
|
||||||
|
|
||||||
-- 插入订单状态初始数据
|
|
||||||
INSERT INTO `ec_order_status` (`status_code`, `status_name`, `description`, `sort_order`, `is_active`) VALUES
|
|
||||||
(0, '待发货', '订单已创建,等待发货', 1, 1),
|
|
||||||
(1, '已发货', '商品已发出,运输中', 2, 1),
|
|
||||||
(2, '已完成', '订单已完成,交易成功', 3, 1),
|
|
||||||
(3, '已取消', '订单已取消', 4, 1),
|
|
||||||
(4, '退款中', '正在处理退款', 5, 1),
|
|
||||||
(5, '已退款', '退款已完成', 6, 1);
|
|
||||||
|
|
||||||
-- 订单表
|
-- 订单表
|
||||||
CREATE TABLE `ec_order` (
|
CREATE TABLE `ec_order` (
|
||||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '订单ID',
|
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '订单ID',
|
||||||
@@ -182,6 +176,7 @@ CREATE TABLE `ec_order_item` (
|
|||||||
-- 推广费类型表
|
-- 推广费类型表
|
||||||
CREATE TABLE `ec_promotion_fee_type` (
|
CREATE TABLE `ec_promotion_fee_type` (
|
||||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '推广费类型ID',
|
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '推广费类型ID',
|
||||||
|
`company_id` BIGINT UNSIGNED NOT NULL COMMENT '公司ID',
|
||||||
`type_code` VARCHAR(50) NOT NULL COMMENT '类型编码',
|
`type_code` VARCHAR(50) NOT NULL COMMENT '类型编码',
|
||||||
`type_name` VARCHAR(100) NOT NULL COMMENT '类型名称',
|
`type_name` VARCHAR(100) NOT NULL COMMENT '类型名称',
|
||||||
`description` VARCHAR(200) DEFAULT NULL COMMENT '类型描述',
|
`description` VARCHAR(200) DEFAULT NULL COMMENT '类型描述',
|
||||||
@@ -195,12 +190,14 @@ CREATE TABLE `ec_promotion_fee_type` (
|
|||||||
`update_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '更新人ID',
|
`update_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '更新人ID',
|
||||||
`delete_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '删除人ID',
|
`delete_by` BIGINT UNSIGNED DEFAULT NULL COMMENT '删除人ID',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `uk_type_code` (`type_code`),
|
KEY `idx_company_id` (`company_id`),
|
||||||
|
UNIQUE KEY `uk_company_type_code` (`company_id`, `type_code`),
|
||||||
KEY `idx_sort_order` (`sort_order`),
|
KEY `idx_sort_order` (`sort_order`),
|
||||||
KEY `idx_is_active` (`is_active`),
|
KEY `idx_is_active` (`is_active`),
|
||||||
KEY `fk_ec_promotion_fee_type_creator` (`create_by`),
|
KEY `fk_ec_promotion_fee_type_creator` (`create_by`),
|
||||||
KEY `fk_ec_promotion_fee_type_updater` (`update_by`),
|
KEY `fk_ec_promotion_fee_type_updater` (`update_by`),
|
||||||
KEY `fk_ec_promotion_fee_type_deleter` (`delete_by`),
|
KEY `fk_ec_promotion_fee_type_deleter` (`delete_by`),
|
||||||
|
CONSTRAINT `fk_ec_promotion_fee_type_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
CONSTRAINT `fk_ec_promotion_fee_type_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
CONSTRAINT `fk_ec_promotion_fee_type_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||||
CONSTRAINT `fk_ec_promotion_fee_type_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
CONSTRAINT `fk_ec_promotion_fee_type_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||||
CONSTRAINT `fk_ec_promotion_fee_type_deleter` FOREIGN KEY (`delete_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
CONSTRAINT `fk_ec_promotion_fee_type_deleter` FOREIGN KEY (`delete_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||||
@@ -246,13 +243,4 @@ CREATE TABLE `ec_promotion_fee` (
|
|||||||
CONSTRAINT `fk_ec_promotion_fee_deleter` FOREIGN KEY (`delete_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
CONSTRAINT `fk_ec_promotion_fee_deleter` FOREIGN KEY (`delete_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='电商-推广费记录表';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='电商-推广费记录表';
|
||||||
|
|
||||||
-- 插入推广费类型初始数据
|
-- 注意:推广费类型初始数据现在通过服务层方法按公司插入,不再在此处插入
|
||||||
INSERT INTO `ec_promotion_fee_type` (`type_code`, `type_name`, `description`, `calculation_method`, `sort_order`, `is_active`) VALUES
|
|
||||||
('DIRECT_TRAFFIC', '直通车', '淘宝直通车推广费用', 3, 1, 1),
|
|
||||||
('DIAMOND_DISPLAY', '钻展', '钻石展位推广费用', 4, 2, 1),
|
|
||||||
('SUPER_RECOMMEND', '超级推荐', '超级推荐推广费用', 3, 3, 1),
|
|
||||||
('PLATFORM_COMMISSION', '平台佣金', '平台交易佣金', 2, 4, 1),
|
|
||||||
('DISTRIBUTION_COMMISSION', '分销佣金', '分销商佣金', 2, 5, 1),
|
|
||||||
('ACTIVITY_FEE', '活动费用', '平台活动参与费用', 1, 6, 1),
|
|
||||||
('EXTERNAL_AD', '站外广告', '站外广告投放费用', 1, 7, 1),
|
|
||||||
('LIVE_STREAMING', '直播推广', '直播推广费用', 1, 8, 1);
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 304 KiB |
@@ -1,7 +1,7 @@
|
|||||||
import { requestClient } from '#/api/request';
|
import { requestClient } from '#/api/request';
|
||||||
|
|
||||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||||
import type { OrderDTO, OrderVO, BatchImportResultVO, OrderStatusDTO, OrderStatusVO } from './types';
|
import type { OrderDTO, OrderVO, BatchImportResultVO, OrderStatusDTO, OrderStatusVO, PromotionFeeTypeDTO, PromotionFeeTypeVO } from './types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单管理API
|
* 订单管理API
|
||||||
@@ -95,3 +95,49 @@ export async function getAllOrderStatusListApi() {
|
|||||||
return requestClient.get<OrderStatusVO.OrderStatusInfoVO[]>('/ec/order-status/all');
|
return requestClient.get<OrderStatusVO.OrderStatusInfoVO[]>('/ec/order-status/all');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推广费类型管理API
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建推广费类型
|
||||||
|
*/
|
||||||
|
export async function createPromotionFeeTypeApi(data: PromotionFeeTypeDTO.CreatePromotionFeeTypeDTO) {
|
||||||
|
return requestClient.post<number>('/ec/promotion-fee-type', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新推广费类型
|
||||||
|
*/
|
||||||
|
export async function updatePromotionFeeTypeApi(data: PromotionFeeTypeDTO.UpdatePromotionFeeTypeDTO) {
|
||||||
|
return requestClient.put<void>('/ec/promotion-fee-type', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除推广费类型
|
||||||
|
*/
|
||||||
|
export async function deletePromotionFeeTypeApi(id: number) {
|
||||||
|
return requestClient.delete<void>(`/ec/promotion-fee-type/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取推广费类型详情
|
||||||
|
*/
|
||||||
|
export async function getPromotionFeeTypeByIdApi(id: number) {
|
||||||
|
return requestClient.get<PromotionFeeTypeVO.PromotionFeeTypeInfoVO>(`/ec/promotion-fee-type/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取启用的推广费类型列表
|
||||||
|
*/
|
||||||
|
export async function getActivePromotionFeeTypeListApi() {
|
||||||
|
return requestClient.get<PromotionFeeTypeVO.PromotionFeeTypeInfoVO[]>('/ec/promotion-fee-type/active');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有推广费类型列表
|
||||||
|
*/
|
||||||
|
export async function getAllPromotionFeeTypeListApi() {
|
||||||
|
return requestClient.get<PromotionFeeTypeVO.PromotionFeeTypeInfoVO[]>('/ec/promotion-fee-type/all');
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,4 +88,40 @@ export namespace OrderStatusDTO {
|
|||||||
/** 排序 */
|
/** 排序 */
|
||||||
sortOrder?: number;
|
sortOrder?: number;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace PromotionFeeTypeDTO {
|
||||||
|
/** 创建推广费类型参数 */
|
||||||
|
export interface CreatePromotionFeeTypeDTO {
|
||||||
|
/** 类型编码 */
|
||||||
|
typeCode: string;
|
||||||
|
/** 类型名称 */
|
||||||
|
typeName: string;
|
||||||
|
/** 类型描述 */
|
||||||
|
description?: string;
|
||||||
|
/** 计算方式 1固定金额 2按比例 3按点击 4按展示 */
|
||||||
|
calculationMethod?: number;
|
||||||
|
/** 排序 */
|
||||||
|
sortOrder?: number;
|
||||||
|
/** 是否启用 0禁用 1启用 */
|
||||||
|
isActive?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 更新推广费类型参数 */
|
||||||
|
export interface UpdatePromotionFeeTypeDTO {
|
||||||
|
/** 推广费类型ID */
|
||||||
|
id: number;
|
||||||
|
/** 类型编码 */
|
||||||
|
typeCode: string;
|
||||||
|
/** 类型名称 */
|
||||||
|
typeName: string;
|
||||||
|
/** 类型描述 */
|
||||||
|
description?: string;
|
||||||
|
/** 计算方式 1固定金额 2按比例 3按点击 4按展示 */
|
||||||
|
calculationMethod?: number;
|
||||||
|
/** 排序 */
|
||||||
|
sortOrder?: number;
|
||||||
|
/** 是否启用 0禁用 1启用 */
|
||||||
|
isActive?: number;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -108,4 +108,36 @@ export namespace OrderStatusVO {
|
|||||||
/** 更新人ID */
|
/** 更新人ID */
|
||||||
updateBy?: number;
|
updateBy?: number;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace PromotionFeeTypeVO {
|
||||||
|
/** 推广费类型信息 */
|
||||||
|
export interface PromotionFeeTypeInfoVO {
|
||||||
|
/** 推广费类型ID */
|
||||||
|
id: number;
|
||||||
|
/** 公司ID */
|
||||||
|
companyId: number;
|
||||||
|
/** 类型编码 */
|
||||||
|
typeCode: string;
|
||||||
|
/** 类型名称 */
|
||||||
|
typeName: string;
|
||||||
|
/** 类型描述 */
|
||||||
|
description?: string;
|
||||||
|
/** 计算方式 1固定金额 2按比例 3按点击 4按展示 */
|
||||||
|
calculationMethod?: number;
|
||||||
|
/** 计算方式描述 */
|
||||||
|
calculationMethodDesc?: string;
|
||||||
|
/** 排序 */
|
||||||
|
sortOrder?: number;
|
||||||
|
/** 是否启用 0禁用 1启用 */
|
||||||
|
isActive?: number;
|
||||||
|
/** 创建时间 */
|
||||||
|
createTime: string;
|
||||||
|
/** 更新时间 */
|
||||||
|
updateTime: string;
|
||||||
|
/** 创建人ID */
|
||||||
|
createBy?: number;
|
||||||
|
/** 更新人ID */
|
||||||
|
updateBy?: number;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -38,13 +38,32 @@ const routes: RouteRecordRaw[] = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'OrderStatusManagement',
|
name: 'ConfigManagement',
|
||||||
path: '/shop/order-status-management',
|
path: '/shop/config-management',
|
||||||
component: () => import('#/views/shop/order-status-management/index.vue'),
|
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'lucide:list-checks',
|
icon: 'lucide:settings',
|
||||||
title: '订单状态管理',
|
title: '配置管理',
|
||||||
},
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: 'OrderStatusConfig',
|
||||||
|
path: '/shop/config-management/order-status',
|
||||||
|
component: () => import('#/views/shop/config-management/order-status-config/index.vue'),
|
||||||
|
meta: {
|
||||||
|
icon: 'lucide:list-checks',
|
||||||
|
title: '订单状态类型',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'PromotionFeeTypeConfig',
|
||||||
|
path: '/shop/config-management/promotion-fee-type',
|
||||||
|
component: () => import('#/views/shop/config-management/promotion-fee-type-config/index.vue'),
|
||||||
|
meta: {
|
||||||
|
icon: 'lucide:percent',
|
||||||
|
title: '推广费用类型',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { defineStore } from 'pinia';
|
|||||||
|
|
||||||
import { getAccessCodesApi, getUserInfoApi, loginApi, logoutApi, registerApi } from '#/api';
|
import { getAccessCodesApi, getUserInfoApi, loginApi, logoutApi, registerApi } from '#/api';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
import type { AuthApi } from '#/api/core/auth';
|
||||||
|
|
||||||
export const useAuthStore = defineStore('auth', () => {
|
export const useAuthStore = defineStore('auth', () => {
|
||||||
const accessStore = useAccessStore();
|
const accessStore = useAccessStore();
|
||||||
@@ -33,7 +34,12 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
let userInfo: null | UserInfo = null;
|
let userInfo: null | UserInfo = null;
|
||||||
try {
|
try {
|
||||||
loginLoading.value = true;
|
loginLoading.value = true;
|
||||||
const { token, user } = await loginApi(params as any);
|
// 只提取必要的登录字段
|
||||||
|
const loginParams: AuthApi.LoginParams = {
|
||||||
|
account: params.account,
|
||||||
|
password: params.password,
|
||||||
|
};
|
||||||
|
const { token, user } = await loginApi(loginParams);
|
||||||
|
|
||||||
// 如果成功获取到 token
|
// 如果成功获取到 token
|
||||||
if (token) {
|
if (token) {
|
||||||
|
|||||||
+232
@@ -0,0 +1,232 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
|
||||||
|
import { Page } from '@vben/common-ui';
|
||||||
|
import { Button, message, Space, Tag } from 'ant-design-vue';
|
||||||
|
import { createIconifyIcon } from '@vben/icons';
|
||||||
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
import {
|
||||||
|
deleteOrderStatusApi,
|
||||||
|
getAllOrderStatusListApi,
|
||||||
|
type OrderStatusVO
|
||||||
|
} from '#/api/ecommerce';
|
||||||
|
import OrderStatusFormModal from './components/OrderStatusFormModal.vue';
|
||||||
|
|
||||||
|
// 创建图标组件
|
||||||
|
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||||
|
|
||||||
|
defineOptions({ name: 'OrderStatusConfig' });
|
||||||
|
|
||||||
|
// 响应式数据
|
||||||
|
const loading = ref(false);
|
||||||
|
const orderStatusFormModalRef = ref();
|
||||||
|
|
||||||
|
// VbenVxeGrid 表格配置
|
||||||
|
const gridOptions: VxeGridProps<any> = {
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
type: 'seq' as const,
|
||||||
|
width: 80,
|
||||||
|
title: '序号',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'name',
|
||||||
|
title: '状态名称',
|
||||||
|
minWidth: 'auto',
|
||||||
|
showOverflow: 'tooltip' as const,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'description',
|
||||||
|
title: '状态描述',
|
||||||
|
minWidth: 'auto',
|
||||||
|
showOverflow: 'tooltip' as const,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'sortOrder',
|
||||||
|
title: '排序',
|
||||||
|
minWidth: 'auto',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
minWidth: 'auto',
|
||||||
|
slots: { default: 'status' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'createTime',
|
||||||
|
title: '创建时间',
|
||||||
|
minWidth: 'auto',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'updateTime',
|
||||||
|
title: '更新时间',
|
||||||
|
minWidth: 'auto',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
minWidth: 'auto',
|
||||||
|
fixed: 'right' as const,
|
||||||
|
slots: { default: 'action' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
height: 'auto',
|
||||||
|
border: true,
|
||||||
|
stripe: true,
|
||||||
|
showOverflow: true,
|
||||||
|
size: 'small',
|
||||||
|
toolbarConfig: {
|
||||||
|
custom: true,
|
||||||
|
refresh: true,
|
||||||
|
zoom: true,
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
pagerConfig: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
// 配置远程加载
|
||||||
|
proxyConfig: {
|
||||||
|
ajax: {
|
||||||
|
query: async () => {
|
||||||
|
try {
|
||||||
|
loading.value = true;
|
||||||
|
const data = await getAllOrderStatusListApi();
|
||||||
|
return {
|
||||||
|
items: data,
|
||||||
|
total: data.length,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取订单状态列表失败:', error);
|
||||||
|
message.error('获取订单状态列表失败');
|
||||||
|
return {
|
||||||
|
items: [],
|
||||||
|
total: 0,
|
||||||
|
};
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索表单配置
|
||||||
|
const formOptions = computed(() => ({
|
||||||
|
schema: [
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入状态名称',
|
||||||
|
},
|
||||||
|
fieldName: 'name',
|
||||||
|
label: '状态名称',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择状态',
|
||||||
|
options: [
|
||||||
|
{ label: '启用', value: 1 },
|
||||||
|
{ label: '禁用', value: 0 },
|
||||||
|
],
|
||||||
|
allowClear: true,
|
||||||
|
},
|
||||||
|
fieldName: 'enabled',
|
||||||
|
label: '状态',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
showDefaultActions: true,
|
||||||
|
collapsed: true,
|
||||||
|
collapsedRows: 1,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 创建 VbenVxeGrid 实例
|
||||||
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
|
gridOptions,
|
||||||
|
formOptions: formOptions.value,
|
||||||
|
showSearchForm: true,
|
||||||
|
tableTitle: '订单状态配置',
|
||||||
|
});
|
||||||
|
|
||||||
|
// 刷新表格数据
|
||||||
|
function refreshTable() {
|
||||||
|
if (gridApi) {
|
||||||
|
gridApi.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理添加订单状态
|
||||||
|
function handleAdd() {
|
||||||
|
orderStatusFormModalRef.value?.open(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理编辑订单状态
|
||||||
|
function handleEdit(record: OrderStatusVO.OrderStatusInfoVO) {
|
||||||
|
orderStatusFormModalRef.value?.open(true, record);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理删除订单状态
|
||||||
|
async function handleDelete(record: OrderStatusVO.OrderStatusInfoVO) {
|
||||||
|
try {
|
||||||
|
await deleteOrderStatusApi(record.id);
|
||||||
|
message.success('删除成功');
|
||||||
|
refreshTable();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('删除订单状态失败:', error);
|
||||||
|
message.error('删除订单状态失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理模态框成功
|
||||||
|
function handleModalSuccess() {
|
||||||
|
refreshTable();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Page title="订单状态配置" auto-content-height>
|
||||||
|
<template #description>
|
||||||
|
<div class="text-foreground/80 mt-2">
|
||||||
|
管理订单状态类型,包括状态名称、描述和启用状态
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- VbenVxeGrid 表格 -->
|
||||||
|
<Grid :loading="loading">
|
||||||
|
<!-- 工具栏工具 -->
|
||||||
|
<template #toolbar-tools>
|
||||||
|
<Space>
|
||||||
|
<Button type="primary" @click="handleAdd">
|
||||||
|
<PlusIcon />
|
||||||
|
添加状态
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 状态列 -->
|
||||||
|
<template #status="{ row }: { row: any }">
|
||||||
|
<Tag :color="row.enabled ? 'green' : 'red'">
|
||||||
|
{{ row.enabled ? '启用' : '禁用' }}
|
||||||
|
</Tag>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 操作列 -->
|
||||||
|
<template #action="{ row }: { row: any }">
|
||||||
|
<Space>
|
||||||
|
<Button size="small" @click="handleEdit(row)">
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
<Button size="small" danger @click="handleDelete(row)">
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- 订单状态表单模态框 -->
|
||||||
|
<OrderStatusFormModal
|
||||||
|
ref="orderStatusFormModalRef"
|
||||||
|
@success="handleModalSuccess"
|
||||||
|
/>
|
||||||
|
</Page>
|
||||||
|
</template>
|
||||||
+218
@@ -0,0 +1,218 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
|
||||||
|
import { Modal, Form, Input, InputNumber, Select, Switch, message } from 'ant-design-vue';
|
||||||
|
|
||||||
|
import {
|
||||||
|
createPromotionFeeTypeApi,
|
||||||
|
updatePromotionFeeTypeApi,
|
||||||
|
type PromotionFeeTypeDTO,
|
||||||
|
type PromotionFeeTypeVO
|
||||||
|
} from '#/api/ecommerce';
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
visible?: boolean;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
success: [];
|
||||||
|
cancel: [];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 响应式数据
|
||||||
|
const visible = ref(false);
|
||||||
|
const loading = ref(false);
|
||||||
|
const isEdit = ref(false);
|
||||||
|
const currentRecord = ref<PromotionFeeTypeVO.PromotionFeeTypeInfoVO | null>(null);
|
||||||
|
|
||||||
|
// 表单数据
|
||||||
|
const formData = ref<Partial<PromotionFeeTypeDTO.CreatePromotionFeeTypeDTO>>({
|
||||||
|
typeCode: '',
|
||||||
|
typeName: '',
|
||||||
|
description: '',
|
||||||
|
calculationMethod: 1,
|
||||||
|
sortOrder: 0,
|
||||||
|
isActive: 1,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 计算方式选项
|
||||||
|
const calculationMethodOptions = [
|
||||||
|
{ label: '固定金额', value: 1 },
|
||||||
|
{ label: '按比例', value: 2 },
|
||||||
|
{ label: '按点击', value: 3 },
|
||||||
|
{ label: '按展示', value: 4 },
|
||||||
|
];
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = {
|
||||||
|
typeCode: [{ required: true, message: '请输入类型编码', trigger: 'blur' }],
|
||||||
|
typeName: [{ required: true, message: '请输入类型名称', trigger: 'blur' }],
|
||||||
|
sortOrder: [{ required: true, message: '请输入排序', trigger: 'blur' }],
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表单引用
|
||||||
|
const formRef = ref();
|
||||||
|
|
||||||
|
// 打开模态框
|
||||||
|
function open(edit: boolean, record?: PromotionFeeTypeVO.PromotionFeeTypeInfoVO) {
|
||||||
|
isEdit.value = edit;
|
||||||
|
currentRecord.value = record || null;
|
||||||
|
visible.value = true;
|
||||||
|
|
||||||
|
if (edit && record) {
|
||||||
|
// 编辑模式,填充表单数据
|
||||||
|
formData.value = {
|
||||||
|
typeCode: record.typeCode,
|
||||||
|
typeName: record.typeName,
|
||||||
|
description: record.description || '',
|
||||||
|
calculationMethod: record.calculationMethod || 1,
|
||||||
|
sortOrder: record.sortOrder || 0,
|
||||||
|
isActive: record.isActive || 1,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// 新增模式,重置表单
|
||||||
|
formData.value = {
|
||||||
|
typeCode: '',
|
||||||
|
typeName: '',
|
||||||
|
description: '',
|
||||||
|
calculationMethod: 1,
|
||||||
|
sortOrder: 0,
|
||||||
|
isActive: 1,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭模态框
|
||||||
|
function close() {
|
||||||
|
visible.value = false;
|
||||||
|
formRef.value?.resetFields();
|
||||||
|
emit('cancel');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
|
async function handleSubmit() {
|
||||||
|
try {
|
||||||
|
await formRef.value?.validate();
|
||||||
|
loading.value = true;
|
||||||
|
|
||||||
|
if (isEdit.value && currentRecord.value) {
|
||||||
|
// 更新推广费类型
|
||||||
|
const updateData: PromotionFeeTypeDTO.UpdatePromotionFeeTypeDTO = {
|
||||||
|
id: currentRecord.value.id,
|
||||||
|
typeCode: formData.value.typeCode!,
|
||||||
|
typeName: formData.value.typeName!,
|
||||||
|
description: formData.value.description,
|
||||||
|
calculationMethod: formData.value.calculationMethod,
|
||||||
|
sortOrder: formData.value.sortOrder,
|
||||||
|
isActive: formData.value.isActive,
|
||||||
|
};
|
||||||
|
await updatePromotionFeeTypeApi(updateData);
|
||||||
|
message.success('更新推广费类型成功');
|
||||||
|
} else {
|
||||||
|
// 创建推广费类型
|
||||||
|
const createData: PromotionFeeTypeDTO.CreatePromotionFeeTypeDTO = {
|
||||||
|
typeCode: formData.value.typeCode!,
|
||||||
|
typeName: formData.value.typeName!,
|
||||||
|
description: formData.value.description,
|
||||||
|
calculationMethod: formData.value.calculationMethod,
|
||||||
|
sortOrder: formData.value.sortOrder,
|
||||||
|
isActive: formData.value.isActive,
|
||||||
|
};
|
||||||
|
await createPromotionFeeTypeApi(createData);
|
||||||
|
message.success('创建推广费类型成功');
|
||||||
|
}
|
||||||
|
|
||||||
|
close();
|
||||||
|
emit('success');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('提交推广费类型失败:', error);
|
||||||
|
message.error('提交推广费类型失败');
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听visible变化
|
||||||
|
watch(visible, (newVal) => {
|
||||||
|
if (!newVal) {
|
||||||
|
formRef.value?.resetFields();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 暴露方法
|
||||||
|
defineExpose({
|
||||||
|
open,
|
||||||
|
close,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Modal
|
||||||
|
v-model:open="visible"
|
||||||
|
:title="isEdit ? '编辑推广费类型' : '添加推广费类型'"
|
||||||
|
:confirm-loading="loading"
|
||||||
|
width="600px"
|
||||||
|
@ok="handleSubmit"
|
||||||
|
@cancel="close"
|
||||||
|
>
|
||||||
|
<Form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="rules as any"
|
||||||
|
layout="vertical"
|
||||||
|
>
|
||||||
|
<div class="grid grid-cols-2 gap-4">
|
||||||
|
<Form.Item label="类型编码" name="typeCode">
|
||||||
|
<Input
|
||||||
|
v-model:value="formData.typeCode"
|
||||||
|
placeholder="请输入类型编码"
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item label="类型名称" name="typeName">
|
||||||
|
<Input
|
||||||
|
v-model:value="formData.typeName"
|
||||||
|
placeholder="请输入类型名称"
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Form.Item label="类型描述" name="description">
|
||||||
|
<Input.TextArea
|
||||||
|
v-model:value="formData.description"
|
||||||
|
placeholder="请输入类型描述(可选)"
|
||||||
|
:rows="3"
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-3 gap-4">
|
||||||
|
<Form.Item label="计算方式" name="calculationMethod">
|
||||||
|
<Select
|
||||||
|
v-model:value="formData.calculationMethod"
|
||||||
|
placeholder="请选择计算方式"
|
||||||
|
:options="calculationMethodOptions"
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item label="排序" name="sortOrder">
|
||||||
|
<InputNumber
|
||||||
|
v-model:value="formData.sortOrder"
|
||||||
|
placeholder="请输入排序"
|
||||||
|
style="width: 100%"
|
||||||
|
:min="0"
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item label="启用状态" name="isActive">
|
||||||
|
<Switch
|
||||||
|
v-model:checked="formData.isActive"
|
||||||
|
:checked-value="1"
|
||||||
|
:un-checked-value="0"
|
||||||
|
checked-children="启用"
|
||||||
|
un-checked-children="禁用"
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
</Form>
|
||||||
|
</Modal>
|
||||||
|
</template>
|
||||||
+258
@@ -0,0 +1,258 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
|
||||||
|
import { Page } from '@vben/common-ui';
|
||||||
|
import { Button, message, Space, Tag } from 'ant-design-vue';
|
||||||
|
import { createIconifyIcon } from '@vben/icons';
|
||||||
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
import {
|
||||||
|
deletePromotionFeeTypeApi,
|
||||||
|
getAllPromotionFeeTypeListApi,
|
||||||
|
type PromotionFeeTypeVO
|
||||||
|
} from '#/api/ecommerce';
|
||||||
|
import PromotionFeeTypeFormModal from './components/PromotionFeeTypeFormModal.vue';
|
||||||
|
|
||||||
|
// 创建图标组件
|
||||||
|
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||||
|
|
||||||
|
defineOptions({ name: 'PromotionFeeTypeConfig' });
|
||||||
|
|
||||||
|
// 响应式数据
|
||||||
|
const loading = ref(false);
|
||||||
|
const promotionFeeTypeFormModalRef = ref();
|
||||||
|
|
||||||
|
// 计算方式选项
|
||||||
|
const calculationMethodOptions = [
|
||||||
|
{ label: '固定金额', value: 1 },
|
||||||
|
{ label: '按比例', value: 2 },
|
||||||
|
{ label: '按点击', value: 3 },
|
||||||
|
{ label: '按展示', value: 4 },
|
||||||
|
];
|
||||||
|
|
||||||
|
// VbenVxeGrid 表格配置
|
||||||
|
const gridOptions: VxeGridProps<any> = {
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
type: 'seq' as const,
|
||||||
|
width: 80,
|
||||||
|
title: '序号',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'typeCode',
|
||||||
|
title: '类型编码',
|
||||||
|
minWidth: 'auto',
|
||||||
|
showOverflow: 'tooltip' as const,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'typeName',
|
||||||
|
title: '类型名称',
|
||||||
|
minWidth: 'auto',
|
||||||
|
showOverflow: 'tooltip' as const,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'description',
|
||||||
|
title: '类型描述',
|
||||||
|
minWidth: 'auto',
|
||||||
|
showOverflow: 'tooltip' as const,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '计算方式',
|
||||||
|
minWidth: 'auto',
|
||||||
|
slots: { default: 'calculationMethod' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'sortOrder',
|
||||||
|
title: '排序',
|
||||||
|
minWidth: 'auto',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
minWidth: 'auto',
|
||||||
|
slots: { default: 'status' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'createTime',
|
||||||
|
title: '创建时间',
|
||||||
|
minWidth: 'auto',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'updateTime',
|
||||||
|
title: '更新时间',
|
||||||
|
minWidth: 'auto',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
minWidth: 'auto',
|
||||||
|
fixed: 'right' as const,
|
||||||
|
slots: { default: 'action' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
height: 'auto',
|
||||||
|
border: true,
|
||||||
|
stripe: true,
|
||||||
|
showOverflow: true,
|
||||||
|
size: 'small',
|
||||||
|
toolbarConfig: {
|
||||||
|
custom: true,
|
||||||
|
refresh: true,
|
||||||
|
zoom: true,
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
pagerConfig: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
// 配置远程加载
|
||||||
|
proxyConfig: {
|
||||||
|
ajax: {
|
||||||
|
query: async () => {
|
||||||
|
try {
|
||||||
|
loading.value = true;
|
||||||
|
const data = await getAllPromotionFeeTypeListApi();
|
||||||
|
return {
|
||||||
|
items: data,
|
||||||
|
total: data.length,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取推广费类型列表失败:', error);
|
||||||
|
message.error('获取推广费类型列表失败');
|
||||||
|
return {
|
||||||
|
items: [],
|
||||||
|
total: 0,
|
||||||
|
};
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索表单配置
|
||||||
|
const formOptions = computed(() => ({
|
||||||
|
schema: [
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入类型名称',
|
||||||
|
},
|
||||||
|
fieldName: 'typeName',
|
||||||
|
label: '类型名称',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择状态',
|
||||||
|
options: [
|
||||||
|
{ label: '启用', value: 1 },
|
||||||
|
{ label: '禁用', value: 0 },
|
||||||
|
],
|
||||||
|
allowClear: true,
|
||||||
|
},
|
||||||
|
fieldName: 'isActive',
|
||||||
|
label: '状态',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
showDefaultActions: true,
|
||||||
|
collapsed: true,
|
||||||
|
collapsedRows: 1,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 创建 VbenVxeGrid 实例
|
||||||
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
|
gridOptions,
|
||||||
|
formOptions: formOptions.value,
|
||||||
|
showSearchForm: true,
|
||||||
|
tableTitle: '推广费用类型配置',
|
||||||
|
});
|
||||||
|
|
||||||
|
// 刷新表格数据
|
||||||
|
function refreshTable() {
|
||||||
|
if (gridApi) {
|
||||||
|
gridApi.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理添加推广费类型
|
||||||
|
function handleAdd() {
|
||||||
|
promotionFeeTypeFormModalRef.value?.open(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理编辑推广费类型
|
||||||
|
function handleEdit(record: PromotionFeeTypeVO.PromotionFeeTypeInfoVO) {
|
||||||
|
promotionFeeTypeFormModalRef.value?.open(true, record);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理删除推广费类型
|
||||||
|
async function handleDelete(record: PromotionFeeTypeVO.PromotionFeeTypeInfoVO) {
|
||||||
|
try {
|
||||||
|
await deletePromotionFeeTypeApi(record.id);
|
||||||
|
message.success('删除成功');
|
||||||
|
refreshTable();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('删除推广费类型失败:', error);
|
||||||
|
message.error('删除推广费类型失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理模态框成功
|
||||||
|
function handleModalSuccess() {
|
||||||
|
refreshTable();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Page title="推广费用类型配置" auto-content-height>
|
||||||
|
<template #description>
|
||||||
|
<div class="text-foreground/80 mt-2">
|
||||||
|
管理推广费用类型,包括费用类型名称、描述、计算方式和启用状态
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- VbenVxeGrid 表格 -->
|
||||||
|
<Grid :loading="loading">
|
||||||
|
<!-- 工具栏工具 -->
|
||||||
|
<template #toolbar-tools>
|
||||||
|
<Space>
|
||||||
|
<Button type="primary" @click="handleAdd">
|
||||||
|
<PlusIcon />
|
||||||
|
添加类型
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 计算方式列 -->
|
||||||
|
<template #calculationMethod="{ row }: { row: any }">
|
||||||
|
<Tag color="blue">
|
||||||
|
{{ calculationMethodOptions.find(opt => opt.value === row.calculationMethod)?.label || '未设置' }}
|
||||||
|
</Tag>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 状态列 -->
|
||||||
|
<template #status="{ row }: { row: any }">
|
||||||
|
<Tag :color="row.isActive === 1 ? 'green' : 'red'">
|
||||||
|
{{ row.isActive === 1 ? '启用' : '禁用' }}
|
||||||
|
</Tag>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 操作列 -->
|
||||||
|
<template #action="{ row }: { row: any }">
|
||||||
|
<Space>
|
||||||
|
<Button size="small" @click="handleEdit(row)">
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
<Button size="small" danger @click="handleDelete(row)">
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- 推广费类型表单模态框 -->
|
||||||
|
<PromotionFeeTypeFormModal
|
||||||
|
ref="promotionFeeTypeFormModalRef"
|
||||||
|
@success="handleModalSuccess"
|
||||||
|
/>
|
||||||
|
</Page>
|
||||||
|
</template>
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { h, ref, onMounted } from 'vue';
|
import { ref, onMounted, computed } from 'vue';
|
||||||
|
|
||||||
import { Page } from '@vben/common-ui';
|
import { Page } from '@vben/common-ui';
|
||||||
import { Button, Input, Select, Table, message, Form, Space, Tag } from 'ant-design-vue';
|
import { Button, message, Space, Tag } from 'ant-design-vue';
|
||||||
import { createIconifyIcon } from '@vben/icons';
|
import { createIconifyIcon } from '@vben/icons';
|
||||||
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
deleteOrderApi,
|
deleteOrderApi,
|
||||||
@@ -25,10 +27,6 @@ defineOptions({ name: 'OrderManagement' });
|
|||||||
|
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const orderList = ref<OrderVO.OrderInfoVO[]>([]);
|
|
||||||
const total = ref(0);
|
|
||||||
const current = ref(1);
|
|
||||||
const pageSize = ref(10);
|
|
||||||
const orderFormModalRef = ref();
|
const orderFormModalRef = ref();
|
||||||
|
|
||||||
// 下拉选项数据
|
// 下拉选项数据
|
||||||
@@ -43,127 +41,169 @@ const searchForm = ref({
|
|||||||
statusId: undefined as number | undefined,
|
statusId: undefined as number | undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 表格列配置
|
// VbenVxeGrid 表格配置
|
||||||
const columns = [
|
const gridOptions: VxeGridProps<any> = {
|
||||||
{
|
columns: [
|
||||||
title: '平台订单号',
|
{
|
||||||
dataIndex: 'platformOrderNo',
|
type: 'seq' as const,
|
||||||
key: 'platformOrderNo',
|
minWidth: 'auto',
|
||||||
width: 150,
|
title: '序号',
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '店铺名称',
|
|
||||||
dataIndex: 'shopName',
|
|
||||||
key: 'shopName',
|
|
||||||
width: 120,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '商品信息',
|
|
||||||
key: 'productInfo',
|
|
||||||
width: 200,
|
|
||||||
customRender: ({ record }: { record: OrderVO.OrderInfoVO }) => {
|
|
||||||
if (record.orderItem) {
|
|
||||||
return h('div', [
|
|
||||||
h('div', { style: { fontWeight: 'bold' } }, record.orderItem.productName),
|
|
||||||
h('div', { style: { color: '#666', fontSize: '12px' } }, record.orderItem.specName),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return h('span', { style: { color: '#999' } }, '暂无商品信息');
|
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
field: 'platformOrderNo',
|
||||||
title: '数量',
|
title: '平台订单号',
|
||||||
key: 'quantity',
|
minWidth: 'auto',
|
||||||
width: 80,
|
showOverflow: 'tooltip' as const,
|
||||||
customRender: ({ record }: { record: OrderVO.OrderInfoVO }) => {
|
|
||||||
return record.orderItem?.quantity || 0;
|
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
field: 'shopName',
|
||||||
title: '实收金额',
|
title: '店铺名称',
|
||||||
dataIndex: 'receivedAmount',
|
minWidth: 'auto',
|
||||||
key: 'receivedAmount',
|
showOverflow: 'tooltip' as const,
|
||||||
width: 120,
|
|
||||||
customRender: ({ record }: { record: OrderVO.OrderInfoVO }) => {
|
|
||||||
const amount = record.receivedAmount || 0;
|
|
||||||
return h('span', { style: { color: '#52c41a', fontWeight: 'bold' } }, `¥${amount.toFixed(2)}`);
|
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
title: '商品信息',
|
||||||
title: '运费',
|
minWidth: 'auto',
|
||||||
dataIndex: 'shippingFee',
|
slots: { default: 'productInfo' },
|
||||||
key: 'shippingFee',
|
|
||||||
width: 100,
|
|
||||||
customRender: ({ record }: { record: OrderVO.OrderInfoVO }) => {
|
|
||||||
const fee = record.shippingFee || 0;
|
|
||||||
return h('span', { style: { color: '#666' } }, `¥${fee.toFixed(2)}`);
|
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
title: '数量',
|
||||||
title: '订单状态',
|
minWidth: 'auto',
|
||||||
dataIndex: 'statusId',
|
slots: { default: 'quantity' },
|
||||||
key: 'statusId',
|
|
||||||
width: 120,
|
|
||||||
customRender: ({ record }: { record: OrderVO.OrderInfoVO }) => {
|
|
||||||
const status = orderStatusOptions.value.find(s => s.value === record.statusId);
|
|
||||||
return h(Tag, { color: 'blue' }, () => status?.label || record.statusName || '未知状态');
|
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
title: '实收金额',
|
||||||
title: '下单时间',
|
minWidth: 'auto',
|
||||||
dataIndex: 'orderDate',
|
slots: { default: 'receivedAmount' },
|
||||||
key: 'orderDate',
|
|
||||||
width: 180,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '创建时间',
|
|
||||||
dataIndex: 'createTime',
|
|
||||||
key: 'createTime',
|
|
||||||
width: 180,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'action',
|
|
||||||
width: 200,
|
|
||||||
fixed: 'right' as const,
|
|
||||||
customRender: ({ record }: { record: OrderVO.OrderInfoVO }) => {
|
|
||||||
return h('div', { style: 'display: flex; gap: 8px;' }, [
|
|
||||||
h(Button, {
|
|
||||||
size: 'small',
|
|
||||||
onClick: () => handleEdit(record),
|
|
||||||
}, { default: () => '编辑' }),
|
|
||||||
h(Button, {
|
|
||||||
size: 'small',
|
|
||||||
danger: true,
|
|
||||||
onClick: () => handleDelete(record),
|
|
||||||
}, { default: () => '删除' }),
|
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '运费',
|
||||||
|
minWidth: 'auto',
|
||||||
|
slots: { default: 'shippingFee' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '订单状态',
|
||||||
|
minWidth: 'auto',
|
||||||
|
slots: { default: 'orderStatus' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'orderDate',
|
||||||
|
title: '下单时间',
|
||||||
|
minWidth: 'auto',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'createTime',
|
||||||
|
title: '创建时间',
|
||||||
|
minWidth: 'auto',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
minWidth: 'auto',
|
||||||
|
fixed: 'right' as const,
|
||||||
|
slots: { default: 'action' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
height: 'auto',
|
||||||
|
border: true,
|
||||||
|
stripe: true,
|
||||||
|
showOverflow: true,
|
||||||
|
size: 'small',
|
||||||
|
toolbarConfig: {
|
||||||
|
custom: true,
|
||||||
|
refresh: true,
|
||||||
|
zoom: true,
|
||||||
},
|
},
|
||||||
];
|
data: [],
|
||||||
|
pagerConfig: {
|
||||||
// 获取订单列表
|
enabled: true,
|
||||||
async function fetchOrderList() {
|
pageSizes: [10, 20, 50, 100],
|
||||||
try {
|
layouts: ['PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total'] as ('PrevJump' | 'PrevPage' | 'Number' | 'NextPage' | 'NextJump' | 'Sizes' | 'FullJump' | 'Total')[],
|
||||||
loading.value = true;
|
},
|
||||||
const params: PageQueryDTO<OrderDTO.OrderFilterDTO> = {
|
// 配置远程加载
|
||||||
page: current.value,
|
proxyConfig: {
|
||||||
pageSize: pageSize.value,
|
ajax: {
|
||||||
filters: {
|
query: async ({ page }) => {
|
||||||
orderNumber: searchForm.value.platformOrderNo || undefined,
|
try {
|
||||||
productName: searchForm.value.productName || undefined,
|
loading.value = true;
|
||||||
shopId: searchForm.value.shopId,
|
const params: PageQueryDTO<OrderDTO.OrderFilterDTO> = {
|
||||||
orderStatusId: searchForm.value.statusId,
|
page: page.currentPage,
|
||||||
|
pageSize: page.pageSize,
|
||||||
|
filters: {
|
||||||
|
orderNumber: searchForm.value.platformOrderNo || undefined,
|
||||||
|
productName: searchForm.value.productName || undefined,
|
||||||
|
shopId: searchForm.value.shopId,
|
||||||
|
orderStatusId: searchForm.value.statusId,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const data = await getOrderPageApi(params);
|
||||||
|
return {
|
||||||
|
items: data.records,
|
||||||
|
total: data.total,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取订单列表失败:', error);
|
||||||
|
message.error('获取订单列表失败');
|
||||||
|
return {
|
||||||
|
items: [],
|
||||||
|
total: 0,
|
||||||
|
};
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
const data = await getOrderPageApi(params);
|
},
|
||||||
orderList.value = data.records;
|
};
|
||||||
total.value = data.total;
|
|
||||||
} catch (error) {
|
// 搜索表单配置
|
||||||
console.error('获取订单列表失败:', error);
|
const formOptions = computed(() => ({
|
||||||
message.error('获取订单列表失败');
|
schema: [
|
||||||
} finally {
|
{
|
||||||
loading.value = false;
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入平台订单号',
|
||||||
|
},
|
||||||
|
fieldName: 'platformOrderNo',
|
||||||
|
label: '平台订单号',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入商品名称',
|
||||||
|
},
|
||||||
|
fieldName: 'productName',
|
||||||
|
label: '商品名称',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择店铺',
|
||||||
|
options: shopOptions.value,
|
||||||
|
allowClear: true,
|
||||||
|
},
|
||||||
|
fieldName: 'shopId',
|
||||||
|
label: '店铺',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择状态',
|
||||||
|
options: orderStatusOptions.value,
|
||||||
|
allowClear: true,
|
||||||
|
},
|
||||||
|
fieldName: 'statusId',
|
||||||
|
label: '订单状态',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
showDefaultActions: true,
|
||||||
|
collapsed: true,
|
||||||
|
collapsedRows: 1,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 刷新表格数据
|
||||||
|
function refreshTable() {
|
||||||
|
if (gridApi) {
|
||||||
|
gridApi.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,30 +238,18 @@ async function fetchOrderStatusOptions() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理搜索
|
|
||||||
function handleSearch() {
|
|
||||||
current.value = 1;
|
|
||||||
fetchOrderList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理重置
|
// 创建 VbenVxeGrid 实例
|
||||||
function handleReset() {
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
searchForm.value = {
|
gridOptions,
|
||||||
platformOrderNo: '',
|
formOptions: formOptions.value,
|
||||||
productName: '',
|
showSearchForm: true,
|
||||||
shopId: undefined,
|
tableTitle: '订单管理',
|
||||||
statusId: undefined,
|
});
|
||||||
};
|
|
||||||
current.value = 1;
|
|
||||||
fetchOrderList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理分页变化
|
|
||||||
function handleTableChange(pagination: any) {
|
|
||||||
current.value = pagination.current;
|
|
||||||
pageSize.value = pagination.pageSize;
|
|
||||||
fetchOrderList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理添加订单
|
// 处理添加订单
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
@@ -238,7 +266,7 @@ async function handleDelete(record: OrderVO.OrderInfoVO) {
|
|||||||
try {
|
try {
|
||||||
await deleteOrderApi(record.id);
|
await deleteOrderApi(record.id);
|
||||||
message.success('删除成功');
|
message.success('删除成功');
|
||||||
await fetchOrderList();
|
refreshTable();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('删除订单失败:', error);
|
console.error('删除订单失败:', error);
|
||||||
message.error('删除订单失败');
|
message.error('删除订单失败');
|
||||||
@@ -253,13 +281,13 @@ function handleBatchImport() {
|
|||||||
|
|
||||||
// 处理模态框成功
|
// 处理模态框成功
|
||||||
function handleModalSuccess() {
|
function handleModalSuccess() {
|
||||||
fetchOrderList();
|
refreshTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
fetchOrderList(),
|
|
||||||
fetchShopOptions(),
|
fetchShopOptions(),
|
||||||
fetchOrderStatusOptions(),
|
fetchOrderStatusOptions(),
|
||||||
]);
|
]);
|
||||||
@@ -267,88 +295,80 @@ onMounted(async () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page title="订单管理">
|
<Page title="订单管理" auto-content-height>
|
||||||
<template #description>
|
<template #description>
|
||||||
<div class="text-foreground/80 mt-2">
|
<div class="text-foreground/80 mt-2">
|
||||||
管理电商订单信息,包括订单创建、编辑、删除和状态管理
|
管理电商订单信息,包括订单创建、编辑、删除和状态管理
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #extra>
|
|
||||||
<Space>
|
|
||||||
<Button @click="handleBatchImport">
|
|
||||||
<UploadIcon class="w-4 h-4 mr-2" />
|
|
||||||
批量导入
|
|
||||||
</Button>
|
|
||||||
<Button type="primary" @click="handleAdd">
|
|
||||||
<PlusIcon class="w-4 h-4 mr-2" />
|
|
||||||
添加订单
|
|
||||||
</Button>
|
|
||||||
</Space>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- 搜索表单 -->
|
<!-- VbenVxeGrid 表格 -->
|
||||||
<div class="mb-4 p-4 bg-gray-50 rounded-lg">
|
<Grid
|
||||||
<Form :model="searchForm" layout="inline">
|
|
||||||
<Form.Item label="平台订单号">
|
|
||||||
<Input
|
|
||||||
v-model:value="searchForm.platformOrderNo"
|
|
||||||
placeholder="请输入平台订单号"
|
|
||||||
style="width: 200px;"
|
|
||||||
@press-enter="handleSearch"
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item label="商品名称">
|
|
||||||
<Input
|
|
||||||
v-model:value="searchForm.productName"
|
|
||||||
placeholder="请输入商品名称"
|
|
||||||
style="width: 200px;"
|
|
||||||
@press-enter="handleSearch"
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item label="店铺">
|
|
||||||
<Select
|
|
||||||
v-model:value="searchForm.shopId"
|
|
||||||
placeholder="请选择店铺"
|
|
||||||
style="width: 150px;"
|
|
||||||
:options="shopOptions"
|
|
||||||
allow-clear
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item label="订单状态">
|
|
||||||
<Select
|
|
||||||
v-model:value="searchForm.statusId"
|
|
||||||
placeholder="请选择状态"
|
|
||||||
style="width: 150px;"
|
|
||||||
:options="orderStatusOptions"
|
|
||||||
allow-clear
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item>
|
|
||||||
<Space>
|
|
||||||
<Button type="primary" @click="handleSearch">搜索</Button>
|
|
||||||
<Button @click="handleReset">重置</Button>
|
|
||||||
</Space>
|
|
||||||
</Form.Item>
|
|
||||||
</Form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 数据表格 -->
|
|
||||||
<Table
|
|
||||||
:columns="columns"
|
|
||||||
:data-source="orderList"
|
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:pagination="{
|
>
|
||||||
current: current,
|
<!-- 工具栏工具 -->
|
||||||
pageSize: pageSize,
|
<template #toolbar-tools>
|
||||||
total: total,
|
<Space>
|
||||||
showSizeChanger: true,
|
<Button @click="handleBatchImport">
|
||||||
showQuickJumper: true,
|
<UploadIcon />
|
||||||
showTotal: (total, range) => `第 ${range[0]}-${range[1]} 条/共 ${total} 条`,
|
批量导入
|
||||||
}"
|
</Button>
|
||||||
row-key="id"
|
<Button type="primary" @click="handleAdd">
|
||||||
@change="handleTableChange"
|
<PlusIcon />
|
||||||
/>
|
添加订单
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 商品信息列 -->
|
||||||
|
<template #productInfo="{ row }: { row: any }">
|
||||||
|
<div v-if="row.orderItem">
|
||||||
|
<div style="font-weight: bold;">{{ row.orderItem.productName }}</div>
|
||||||
|
<div style="color: #666; font-size: 12px;">{{ row.orderItem.specName }}</div>
|
||||||
|
</div>
|
||||||
|
<span v-else style="color: #999;">暂无商品信息</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 数量列 -->
|
||||||
|
<template #quantity="{ row }: { row: any }">
|
||||||
|
{{ row.orderItem?.quantity || 0 }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 实收金额列 -->
|
||||||
|
<template #receivedAmount="{ row }: { row: any }">
|
||||||
|
<span style="color: #52c41a; font-weight: bold;">
|
||||||
|
¥{{ (row.receivedAmount || 0).toFixed(2) }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 运费列 -->
|
||||||
|
<template #shippingFee="{ row }: { row: any }">
|
||||||
|
<span style="color: #666;">
|
||||||
|
¥{{ (row.shippingFee || 0).toFixed(2) }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 订单状态列 -->
|
||||||
|
<template #orderStatus="{ row }: { row: any }">
|
||||||
|
<Tag color="blue">
|
||||||
|
{{ orderStatusOptions.find(s => s.value === row.statusId)?.label || row.statusName || '未知状态' }}
|
||||||
|
</Tag>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 操作列 -->
|
||||||
|
<template #action="{ row }: { row: any }">
|
||||||
|
<Space>
|
||||||
|
<Button size="small" @click="handleEdit(row)">
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
<Button size="small" danger @click="handleDelete(row)">
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<!-- 订单表单模态框 -->
|
<!-- 订单表单模态框 -->
|
||||||
<OrderFormModal
|
<OrderFormModal
|
||||||
|
|||||||
@@ -1,172 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { h, ref, onMounted } from 'vue';
|
|
||||||
|
|
||||||
import { Page } from '@vben/common-ui';
|
|
||||||
import { Button, Table, message, Tag } from 'ant-design-vue';
|
|
||||||
import { createIconifyIcon } from '@vben/icons';
|
|
||||||
|
|
||||||
import {
|
|
||||||
deleteOrderStatusApi,
|
|
||||||
getAllOrderStatusListApi,
|
|
||||||
type OrderStatusVO
|
|
||||||
} from '#/api/ecommerce';
|
|
||||||
import OrderStatusFormModal from './components/OrderStatusFormModal.vue';
|
|
||||||
|
|
||||||
// 创建图标组件
|
|
||||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
|
||||||
|
|
||||||
defineOptions({ name: 'OrderStatusManagement' });
|
|
||||||
|
|
||||||
// 响应式数据
|
|
||||||
const loading = ref(false);
|
|
||||||
const orderStatusList = ref<OrderStatusVO.OrderStatusInfoVO[]>([]);
|
|
||||||
const orderStatusFormModalRef = ref();
|
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
const columns = [
|
|
||||||
{
|
|
||||||
title: '状态名称',
|
|
||||||
dataIndex: 'name',
|
|
||||||
key: 'name',
|
|
||||||
width: 150,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '状态描述',
|
|
||||||
dataIndex: 'description',
|
|
||||||
key: 'description',
|
|
||||||
width: 200,
|
|
||||||
customRender: ({ record }: { record: OrderStatusVO.OrderStatusInfoVO }) => {
|
|
||||||
return record.description || h('span', { style: { color: '#999' } }, '暂无描述');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '排序',
|
|
||||||
dataIndex: 'sortOrder',
|
|
||||||
key: 'sortOrder',
|
|
||||||
width: 80,
|
|
||||||
customRender: ({ record }: { record: OrderStatusVO.OrderStatusInfoVO }) => {
|
|
||||||
return record.sortOrder || 0;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '状态',
|
|
||||||
dataIndex: 'enabled',
|
|
||||||
key: 'enabled',
|
|
||||||
width: 100,
|
|
||||||
customRender: ({ record }: { record: OrderStatusVO.OrderStatusInfoVO }) => {
|
|
||||||
return h(Tag, {
|
|
||||||
color: record.enabled ? 'green' : 'red'
|
|
||||||
}, () => record.enabled ? '启用' : '禁用');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '创建时间',
|
|
||||||
dataIndex: 'createTime',
|
|
||||||
key: 'createTime',
|
|
||||||
width: 180,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '更新时间',
|
|
||||||
dataIndex: 'updateTime',
|
|
||||||
key: 'updateTime',
|
|
||||||
width: 180,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'action',
|
|
||||||
width: 200,
|
|
||||||
fixed: 'right' as const,
|
|
||||||
customRender: ({ record }: { record: OrderStatusVO.OrderStatusInfoVO }) => {
|
|
||||||
return h('div', { style: 'display: flex; gap: 8px;' }, [
|
|
||||||
h(Button, {
|
|
||||||
size: 'small',
|
|
||||||
onClick: () => handleEdit(record),
|
|
||||||
}, { default: () => '编辑' }),
|
|
||||||
h(Button, {
|
|
||||||
size: 'small',
|
|
||||||
danger: true,
|
|
||||||
onClick: () => handleDelete(record),
|
|
||||||
}, { default: () => '删除' }),
|
|
||||||
]);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
// 获取订单状态列表
|
|
||||||
async function fetchOrderStatusList() {
|
|
||||||
try {
|
|
||||||
loading.value = true;
|
|
||||||
const data = await getAllOrderStatusListApi();
|
|
||||||
orderStatusList.value = data;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('获取订单状态列表失败:', error);
|
|
||||||
message.error('获取订单状态列表失败');
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理添加订单状态
|
|
||||||
function handleAdd() {
|
|
||||||
orderStatusFormModalRef.value?.open(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理编辑订单状态
|
|
||||||
function handleEdit(record: OrderStatusVO.OrderStatusInfoVO) {
|
|
||||||
orderStatusFormModalRef.value?.open(true, record);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理删除订单状态
|
|
||||||
async function handleDelete(record: OrderStatusVO.OrderStatusInfoVO) {
|
|
||||||
try {
|
|
||||||
await deleteOrderStatusApi(record.id);
|
|
||||||
message.success('删除成功');
|
|
||||||
await fetchOrderStatusList();
|
|
||||||
} catch (error) {
|
|
||||||
console.error('删除订单状态失败:', error);
|
|
||||||
message.error('删除订单状态失败');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理模态框成功
|
|
||||||
function handleModalSuccess() {
|
|
||||||
fetchOrderStatusList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化
|
|
||||||
onMounted(() => {
|
|
||||||
fetchOrderStatusList();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Page title="订单状态管理">
|
|
||||||
<template #description>
|
|
||||||
<div class="text-foreground/80 mt-2">
|
|
||||||
管理订单状态信息,包括状态创建、编辑、删除和启用/禁用
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #extra>
|
|
||||||
<Button type="primary" @click="handleAdd">
|
|
||||||
<PlusIcon class="w-4 h-4 mr-2" />
|
|
||||||
添加状态
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- 数据表格 -->
|
|
||||||
<Table
|
|
||||||
:columns="columns"
|
|
||||||
:data-source="orderStatusList"
|
|
||||||
:loading="loading"
|
|
||||||
:pagination="false"
|
|
||||||
row-key="id"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 订单状态表单模态框 -->
|
|
||||||
<OrderStatusFormModal
|
|
||||||
ref="orderStatusFormModalRef"
|
|
||||||
@success="handleModalSuccess"
|
|
||||||
/>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { h, ref } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
|
|
||||||
import { Page } from '@vben/common-ui';
|
import { Page } from '@vben/common-ui';
|
||||||
import { Button, Input, Select, Table, message } from 'ant-design-vue';
|
import { Button, message, Space } from 'ant-design-vue';
|
||||||
|
import { createIconifyIcon } from '@vben/icons';
|
||||||
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
deleteShopApi,
|
deleteShopApi,
|
||||||
@@ -13,14 +16,13 @@ import {
|
|||||||
import type { PageQueryDTO } from '#/types/common';
|
import type { PageQueryDTO } from '#/types/common';
|
||||||
import ShopFormModal from './components/ShopFormModal.vue';
|
import ShopFormModal from './components/ShopFormModal.vue';
|
||||||
|
|
||||||
|
// 创建图标组件
|
||||||
|
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||||
|
|
||||||
defineOptions({ name: 'ShopManagement' });
|
defineOptions({ name: 'ShopManagement' });
|
||||||
|
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const shopList = ref<ShopVO.ShopInfoVO[]>([]);
|
|
||||||
const total = ref(0);
|
|
||||||
const current = ref(1);
|
|
||||||
const pageSize = ref(10);
|
|
||||||
const shopFormModalRef = ref();
|
const shopFormModalRef = ref();
|
||||||
|
|
||||||
// 搜索表单
|
// 搜索表单
|
||||||
@@ -39,114 +41,140 @@ const platformOptions = [
|
|||||||
{ label: '天猫', value: '天猫' },
|
{ label: '天猫', value: '天猫' },
|
||||||
];
|
];
|
||||||
|
|
||||||
// 表格列配置
|
// VbenVxeGrid 表格配置
|
||||||
const columns = [
|
const gridOptions: VxeGridProps<any> = {
|
||||||
{
|
columns: [
|
||||||
title: '店铺名称',
|
{
|
||||||
dataIndex: 'name',
|
type: 'seq' as const,
|
||||||
key: 'name',
|
width: 80,
|
||||||
width: 200,
|
title: '序号',
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '平台',
|
|
||||||
dataIndex: 'platform',
|
|
||||||
key: 'platform',
|
|
||||||
width: 120,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Logo',
|
|
||||||
dataIndex: 'logo',
|
|
||||||
key: 'logo',
|
|
||||||
width: 200,
|
|
||||||
customRender: ({ record }: { record: ShopVO.ShopInfoVO }) => {
|
|
||||||
if (record.logo) {
|
|
||||||
return h('img', {
|
|
||||||
src: record.logo,
|
|
||||||
alt: record.name,
|
|
||||||
style: { width: '40px', height: '40px', objectFit: 'cover', borderRadius: '4px' },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return h('span', { style: { color: '#999' } }, '暂无Logo');
|
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
field: 'name',
|
||||||
title: '创建时间',
|
title: '店铺名称',
|
||||||
dataIndex: 'createTime',
|
minWidth: 'auto',
|
||||||
key: 'createTime',
|
showOverflow: 'tooltip' as const,
|
||||||
width: 180,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '更新时间',
|
|
||||||
dataIndex: 'updateTime',
|
|
||||||
key: 'updateTime',
|
|
||||||
width: 180,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'action',
|
|
||||||
width: 200,
|
|
||||||
fixed: 'right' as const,
|
|
||||||
customRender: ({ record }: { record: ShopVO.ShopInfoVO }) => {
|
|
||||||
return h('div', { style: 'display: flex; gap: 8px;' }, [
|
|
||||||
h(Button, {
|
|
||||||
size: 'small',
|
|
||||||
onClick: () => handleEdit(record),
|
|
||||||
}, { default: () => '编辑' }),
|
|
||||||
h(Button, {
|
|
||||||
size: 'small',
|
|
||||||
danger: true,
|
|
||||||
onClick: () => handleDelete(record),
|
|
||||||
}, { default: () => '删除' }),
|
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'platform',
|
||||||
|
title: '平台',
|
||||||
|
minWidth: 'auto',
|
||||||
|
showOverflow: 'tooltip' as const,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Logo',
|
||||||
|
minWidth: 'auto',
|
||||||
|
slots: { default: 'logo' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'createTime',
|
||||||
|
title: '创建时间',
|
||||||
|
minWidth: 'auto',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'updateTime',
|
||||||
|
title: '更新时间',
|
||||||
|
minWidth: 'auto',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
minWidth: 'auto',
|
||||||
|
fixed: 'right' as const,
|
||||||
|
slots: { default: 'action' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
height: 'auto',
|
||||||
|
border: true,
|
||||||
|
stripe: true,
|
||||||
|
showOverflow: true,
|
||||||
|
size: 'small',
|
||||||
|
toolbarConfig: {
|
||||||
|
custom: true,
|
||||||
|
refresh: true,
|
||||||
|
zoom: true,
|
||||||
},
|
},
|
||||||
];
|
data: [],
|
||||||
|
pagerConfig: {
|
||||||
// 获取店铺列表
|
enabled: true,
|
||||||
async function fetchShopList() {
|
pageSizes: [10, 20, 50, 100],
|
||||||
try {
|
layouts: ['PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total'] as ('PrevJump' | 'PrevPage' | 'Number' | 'NextPage' | 'NextJump' | 'Sizes' | 'FullJump' | 'Total')[],
|
||||||
loading.value = true;
|
},
|
||||||
const params: PageQueryDTO<ShopDTO.ShopFiltersDTO> = {
|
// 配置远程加载
|
||||||
page: current.value,
|
proxyConfig: {
|
||||||
pageSize: pageSize.value,
|
ajax: {
|
||||||
filters: {
|
query: async ({ page }) => {
|
||||||
name: searchForm.value.name || undefined,
|
try {
|
||||||
platform: searchForm.value.platform,
|
loading.value = true;
|
||||||
|
const params: PageQueryDTO<ShopDTO.ShopFiltersDTO> = {
|
||||||
|
page: page.currentPage,
|
||||||
|
pageSize: page.pageSize,
|
||||||
|
filters: {
|
||||||
|
name: searchForm.value.name || undefined,
|
||||||
|
platform: searchForm.value.platform,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const data = await getShopPageApi(params);
|
||||||
|
return {
|
||||||
|
items: data.records,
|
||||||
|
total: data.total,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取店铺列表失败:', error);
|
||||||
|
message.error('获取店铺列表失败');
|
||||||
|
return {
|
||||||
|
items: [],
|
||||||
|
total: 0,
|
||||||
|
};
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
const data = await getShopPageApi(params);
|
},
|
||||||
shopList.value = data.records;
|
};
|
||||||
total.value = data.total;
|
|
||||||
} catch (error) {
|
// 搜索表单配置
|
||||||
console.error('获取店铺列表失败:', error);
|
const formOptions = computed(() => ({
|
||||||
message.error('获取店铺列表失败');
|
schema: [
|
||||||
} finally {
|
{
|
||||||
loading.value = false;
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入店铺名称',
|
||||||
|
},
|
||||||
|
fieldName: 'name',
|
||||||
|
label: '店铺名称',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择平台',
|
||||||
|
options: platformOptions,
|
||||||
|
allowClear: true,
|
||||||
|
},
|
||||||
|
fieldName: 'platform',
|
||||||
|
label: '平台',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
showDefaultActions: true,
|
||||||
|
collapsed: true,
|
||||||
|
collapsedRows: 1,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 创建 VbenVxeGrid 实例
|
||||||
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
|
gridOptions,
|
||||||
|
formOptions: formOptions.value,
|
||||||
|
showSearchForm: true,
|
||||||
|
tableTitle: '店铺管理',
|
||||||
|
});
|
||||||
|
|
||||||
|
// 刷新表格数据
|
||||||
|
function refreshTable() {
|
||||||
|
if (gridApi) {
|
||||||
|
gridApi.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理搜索
|
|
||||||
function handleSearch() {
|
|
||||||
current.value = 1;
|
|
||||||
fetchShopList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理重置
|
|
||||||
function handleReset() {
|
|
||||||
searchForm.value = {
|
|
||||||
name: '',
|
|
||||||
platform: undefined,
|
|
||||||
};
|
|
||||||
current.value = 1;
|
|
||||||
fetchShopList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理分页变化
|
|
||||||
function handleTableChange(pagination: any) {
|
|
||||||
current.value = pagination.current;
|
|
||||||
pageSize.value = pagination.pageSize;
|
|
||||||
fetchShopList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理添加店铺
|
// 处理添加店铺
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
@@ -163,7 +191,7 @@ async function handleDelete(record: ShopVO.ShopInfoVO) {
|
|||||||
try {
|
try {
|
||||||
await deleteShopApi(record.id);
|
await deleteShopApi(record.id);
|
||||||
message.success('删除成功');
|
message.success('删除成功');
|
||||||
await fetchShopList();
|
refreshTable();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('删除店铺失败:', error);
|
console.error('删除店铺失败:', error);
|
||||||
message.error('删除店铺失败');
|
message.error('删除店铺失败');
|
||||||
@@ -172,72 +200,56 @@ async function handleDelete(record: ShopVO.ShopInfoVO) {
|
|||||||
|
|
||||||
// 处理模态框成功
|
// 处理模态框成功
|
||||||
function handleModalSuccess() {
|
function handleModalSuccess() {
|
||||||
fetchShopList();
|
refreshTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化
|
|
||||||
fetchShopList();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page title="店铺管理">
|
<Page title="店铺管理" auto-content-height>
|
||||||
<template #description>
|
<template #description>
|
||||||
<div class="text-foreground/80 mt-2">
|
<div class="text-foreground/80 mt-2">
|
||||||
管理电商店铺信息,包括店铺基本信息、平台信息和Logo设置
|
管理电商店铺信息,包括店铺基本信息、平台信息和Logo设置
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #extra>
|
<!-- VbenVxeGrid 表格 -->
|
||||||
<Button type="primary" @click="handleAdd">
|
<Grid
|
||||||
添加店铺
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- 搜索表单 -->
|
|
||||||
<div class="mb-4 p-4 bg-gray-50 rounded-lg">
|
|
||||||
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
|
|
||||||
<div>
|
|
||||||
<label style="display: block; margin-bottom: 4px; font-weight: 500;">店铺名称</label>
|
|
||||||
<Input
|
|
||||||
v-model:value="searchForm.name"
|
|
||||||
placeholder="请输入店铺名称"
|
|
||||||
style="width: 200px;"
|
|
||||||
@press-enter="handleSearch"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label style="display: block; margin-bottom: 4px; font-weight: 500;">平台</label>
|
|
||||||
<Select
|
|
||||||
v-model:value="searchForm.platform"
|
|
||||||
placeholder="请选择平台"
|
|
||||||
style="width: 120px;"
|
|
||||||
:options="platformOptions"
|
|
||||||
allow-clear
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div style="display: flex; gap: 8px; align-items: end;">
|
|
||||||
<Button type="primary" @click="handleSearch">搜索</Button>
|
|
||||||
<Button @click="handleReset">重置</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 数据表格 -->
|
|
||||||
<Table
|
|
||||||
:columns="columns"
|
|
||||||
:data-source="shopList"
|
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:pagination="{
|
>
|
||||||
current: current,
|
<!-- 工具栏工具 -->
|
||||||
pageSize: pageSize,
|
<template #toolbar-tools>
|
||||||
total: total,
|
<Space>
|
||||||
showSizeChanger: true,
|
<Button type="primary" @click="handleAdd">
|
||||||
showQuickJumper: true,
|
<PlusIcon />
|
||||||
showTotal: (total, range) => `第 ${range[0]}-${range[1]} 条/共 ${total} 条`,
|
添加店铺
|
||||||
}"
|
</Button>
|
||||||
row-key="id"
|
</Space>
|
||||||
@change="handleTableChange"
|
</template>
|
||||||
/>
|
|
||||||
|
<!-- Logo列 -->
|
||||||
|
<template #logo="{ row }: { row: any }">
|
||||||
|
<div v-if="row.logo">
|
||||||
|
<img
|
||||||
|
:src="row.logo"
|
||||||
|
:alt="row.name"
|
||||||
|
style="width: 40px; height: 40px; object-fit: cover; border-radius: 4px;"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<span v-else style="color: #999;">暂无Logo</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 操作列 -->
|
||||||
|
<template #action="{ row }: { row: any }">
|
||||||
|
<Space>
|
||||||
|
<Button size="small" @click="handleEdit(row)">
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
<Button size="small" danger @click="handleDelete(row)">
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<!-- 店铺表单模态框 -->
|
<!-- 店铺表单模态框 -->
|
||||||
<ShopFormModal
|
<ShopFormModal
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
商品,订单编号,订单状态,商品数量(件),商品id,商品规格,店铺名称-店铺二维码,售后状态,店铺实际收入(元)
|
|
||||||
威露士消毒液,250909-020557402512836,已发货待确认收货,4,776809698859,威露士消毒液-500ml装,创意家居,无售后,119.6
|
|
||||||
威露士消毒液,250909-327860887132793,已发货待确认收货,2,776809698859,威露士消毒液-500ml装,创意家居,无售后,59.8
|
|
||||||
威露士消毒液,250909-191231444621615,已发货待确认收货,1,776809698859,威露士消毒液-500ml装,创意家居,无售后,29.9
|
|
||||||
|
@@ -1,58 +0,0 @@
|
|||||||
商品,订单号,订单状态,商品数量(件),商品id,商品规格,商家编码-规格维度,售后状态,商家实收金额(元)
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-020557402512836,已发货,待收货,"4 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,119.6
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-327860887132793,已发货,待收货,"2 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,59.8
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-191231444621615,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-032718200552900,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-263614635552343,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-142768873170631,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-630812905850513,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-419317685990247,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-274813427271655,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-003864072623620,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-540430866002738,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-065580572260452,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-247597657700311,未发货,退款成功,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,退款成功,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-645718423931113,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-017461429890914,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-571298311900778,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-278174133791638,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-630954443193163,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-049482351010760,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-339466001941552,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-251160236453630,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-353469754901552,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-527821771171956,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-137164296573058,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-637916956172581,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-647464251000050,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-603329676893861,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-409201579543689,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-374944570940057,未发货,退款成功,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,退款成功,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-261981478611311,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-076441208393837,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-307127938560182,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-456675857981095,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-130128289351297,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-569471189370198,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-578819202561596,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-089915430552824,未发货,退款成功,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,1斤(新客体验)试样补充液",SLJ0054,退款成功,6.8
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-343817654712968,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-631777554003451,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-285569205930995,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-081060217202353,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,4斤(初次品尝)多效净柔洗衣液*1",SLJ0039,无售后或售后取消,18.8
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-018607061430640,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,4斤(初次品尝)多效净柔洗衣液*1",SLJ0039,无售后或售后取消,18.8
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-526524096160724,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,4斤(初次品尝)多效净柔洗衣液*1",SLJ0039,无售后或售后取消,18.8
|
|
||||||
【山姆精选】家用多用途衣物消毒除螨除菌液玩具内衣裤洗衣消毒水,250909-620885450263895,已发货,待收货,"1 ","809507961075 ","【远离细菌螨虫困扰/专业级消毒防护】,1大瓶【整整2斤】99.99%消毒抑味",SLJ0031,无售后或售后取消,18.8
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-205342687673192,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,4斤(初次品尝)多效净柔洗衣液*1",SLJ0039,无售后或售后取消,18.8
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-278963177031461,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,4斤(初次品尝)多效净柔洗衣液*1",SLJ0039,无售后或售后取消,18.8
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-598527209040569,未发货,退款成功,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,退款成功,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-519488151111080,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,4斤(初次品尝)多效净柔洗衣液*1",SLJ0039,无售后或售后取消,18.8
|
|
||||||
【山姆精选】家用多用途衣物消毒除螨除菌液玩具内衣裤洗衣消毒水,250909-420924628702930,已发货,待收货,"1 ","809507961075 ","【远离细菌螨虫困扰/专业级消毒防护】,1大瓶【整整2斤】99.99%消毒抑味",SLJ0031,无售后或售后取消,18.8
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-564909862493868,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,4斤(初次品尝)多效净柔洗衣液*1",SLJ0039,无售后或售后取消,18.8
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-479639703941185,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,4斤(初次品尝)多效净柔洗衣液*1",SLJ0039,无售后或售后取消,18.8
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-364736756152968,已取消,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,无售后或售后取消,29.9
|
|
||||||
【商超爆款】多效净柔洗衣液持久留香抑菌除螨去污渍母婴学生家用,250909-524403381981816,已发货,待收货,"1 ","804654320839 ","花香四溢*留香持久*洁净无忧,到手4斤【天然洁净因子丨去黄亮白】",SLJ008,无售后或售后取消,18.8
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-566314933990350,未发货,退款成功,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,1斤(新客体验)试样补充液",SLJ0054,退款成功,6.8
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-507521329583297,未发货,退款成功,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力",SLJ123,退款成功,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-185212608060224,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,1斤(新客体验)试样补充液",SLJ0054,无售后或售后取消,6.8
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250909-450138028441003,已发货,待收货,"1 ","776809698859 ","【72小时留香丨强效去渍丨99.99除菌】,1斤(新客体验)试样补充液",SLJ0054,无售后或售后取消,6.8
|
|
||||||
|
@@ -1,4 +0,0 @@
|
|||||||
商品,订单号,订单状态,商品数量(件),商品id,商品规格,商家编码-规格维度,售后状态,商家实收金额(元)
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250913-047002457780454,已发货,待收货,1,776809698859,【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力,SLJ123,无售后或售后取消,29.9
|
|
||||||
【山姆特惠选】花香洗衣液持久留香深层洁净去污去渍除螨抑菌大桶,250913-166938549771506,已发货,待收货,1,776809698859,【72小时留香丨强效去渍丨99.99除菌】,10斤(小店爆款)洁净护色丨8倍洁净力,SLJ123,无售后或售后取消,29.9
|
|
||||||
【爆香除臭】香氛洗衣消毒液衣物杀菌留香植源温和消毒水公共环境【9月15日发完】,250913-341248633251447,未发货,退款成功,1,806892003345,全新香氛体验【48h满屋西柚味/好闻不刺激】,99.99%有效杀菌丨消菌杀毒【到手2瓶】,YQ395,退款成功,32.8
|
|
||||||
|
@@ -62,15 +62,19 @@ const REMEMBER_ME_KEY = `REMEMBER_ME_USERNAME_${location.hostname}`;
|
|||||||
|
|
||||||
const localUsername = localStorage.getItem(REMEMBER_ME_KEY) || '';
|
const localUsername = localStorage.getItem(REMEMBER_ME_KEY) || '';
|
||||||
|
|
||||||
const rememberMe = ref(!!localUsername);
|
// 清理可能存在的 undefined 值
|
||||||
|
const cleanLocalUsername = localUsername === 'undefined' ? '' : localUsername;
|
||||||
|
|
||||||
|
const rememberMe = ref(!!cleanLocalUsername);
|
||||||
|
|
||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
const { valid } = await formApi.validate();
|
const { valid } = await formApi.validate();
|
||||||
const values = await formApi.getValues();
|
const values = await formApi.getValues();
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
const username = values?.account || values?.username;
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
REMEMBER_ME_KEY,
|
REMEMBER_ME_KEY,
|
||||||
rememberMe.value ? values?.username : '',
|
rememberMe.value && username && username !== 'undefined' ? username : '',
|
||||||
);
|
);
|
||||||
emit('submit', values);
|
emit('submit', values);
|
||||||
}
|
}
|
||||||
@@ -81,8 +85,13 @@ function handleGo(path: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (localUsername) {
|
// 清理 localStorage 中可能存在的 undefined 值
|
||||||
formApi.setFieldValue('username', localUsername);
|
if (localUsername === 'undefined') {
|
||||||
|
localStorage.removeItem(REMEMBER_ME_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cleanLocalUsername) {
|
||||||
|
formApi.setFieldValue('account', cleanLocalUsername);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user