下单页面 接口对接
This commit is contained in:
parent
a12b47aeac
commit
7b3e0d944a
|
|
@ -3,6 +3,8 @@ package cn.hangtag.framework.common.util;
|
|||
import cn.hangtag.framework.common.util.json.JsonUtils;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.crypto.digest.DigestUtil;
|
||||
|
||||
|
|
@ -18,6 +20,7 @@ import java.math.BigDecimal;
|
|||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.SecureRandom;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
|
|
@ -573,4 +576,17 @@ public class FuncUtil extends StringUtils {
|
|||
RequestAttributes requestAttributes =((ServletRequestAttributes) RequestContextHolder.getRequestAttributes());
|
||||
return requestAttributes == null ? null : ((ServletRequestAttributes) requestAttributes).getRequest();
|
||||
}
|
||||
|
||||
public static LocalDateTime parseDate(Long timestamp) {
|
||||
if(isEmpty(timestamp)){
|
||||
return null;
|
||||
}
|
||||
Instant instant = Instant.ofEpochMilli(timestamp);
|
||||
// 将 Instant 转换为 LocalDateTime
|
||||
return LocalDateTime.ofInstant(instant, java.time.ZoneId.systemDefault());
|
||||
}
|
||||
private static final Snowflake snowflake = IdUtil.getSnowflake();
|
||||
public static long getNextId() {
|
||||
return snowflake.nextId();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
package cn.hangtag.framework.common.util.validation;
|
||||
|
||||
import cn.hangtag.framework.common.exception.ServiceException;
|
||||
import cn.hangtag.framework.common.util.FuncUtil;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* 断言实用程序
|
||||
*
|
||||
* @author YuanFeng
|
||||
* @date 2024/09/23
|
||||
*/
|
||||
public class AssertUtil {
|
||||
public static void isEmpty(Object field, String errorMessage) {
|
||||
if (FuncUtil.isEmpty(field)) {
|
||||
throw new ServiceException(600, errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public static void isTrue(boolean b, String errorMessage) {
|
||||
if (b) {
|
||||
throw new ServiceException(600, errorMessage);
|
||||
}
|
||||
}
|
||||
public static void isFalse(boolean b, String errorMessage) {
|
||||
if (!b) {
|
||||
throw new ServiceException(600, errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ public interface ErrorCodeConstants extends cn.hangtag.module.system.enums.Erro
|
|||
ErrorCode SALE_ORDER_NOT_EXISTS = new ErrorCode(3600, "OMS销售订单不存在");
|
||||
ErrorCode SALE_ORDER_ENTRY_NOT_EXISTS = new ErrorCode(3700, "OMS销售订单明细不存在");
|
||||
ErrorCode SALE_ORDER_ENTRY_PRICE_NOT_NULL= new ErrorCode(3701, "单价不允许为空");
|
||||
ErrorCode SALE_ORDER_SKU_NOT_EXISTS = new ErrorCode(3702, "产品单价记录不存在");
|
||||
ErrorCode CUSTOMER_BRAND_NOT_EXISTS = new ErrorCode(3800, "客户和品牌关联不存在");
|
||||
ErrorCode PRODUCT_CARE_ITEM_NOT_EXISTS = new ErrorCode(3900, "产品保养项 不存在");
|
||||
ErrorCode PRODUCE_ORDER_NOT_EXISTS = new ErrorCode(4000, "生产制单不存在");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package cn.hangtag.module.oms.enums.saleorder;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum SaleOrderTypeEnum {
|
||||
|
||||
// 普通
|
||||
NORMAL("NORMAL", "普通"),
|
||||
// 加急
|
||||
URGENT("URGENT", "加急"),
|
||||
|
||||
;
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final String type;
|
||||
/**
|
||||
* 类型名
|
||||
*/
|
||||
private final String remark;
|
||||
|
||||
public static SaleOrderTypeEnum getByType(String type) {
|
||||
for (SaleOrderTypeEnum item : values()) {
|
||||
if (item.getType().equals(type)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package cn.hangtag.module.oms.controller.admin.saleorder;
|
||||
|
||||
import cn.hangtag.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.hangtag.framework.common.pojo.CommonResult;
|
||||
import cn.hangtag.framework.common.pojo.PageParam;
|
||||
import cn.hangtag.framework.common.pojo.PageResult;
|
||||
import cn.hangtag.framework.common.util.number.NumberUtils;
|
||||
import cn.hangtag.framework.common.util.object.BeanUtils;
|
||||
import cn.hangtag.framework.excel.core.util.ExcelUtils;
|
||||
import cn.hangtag.module.oms.controller.admin.saleorder.dto.CreateSaleOrderDTO;
|
||||
import cn.hangtag.module.oms.controller.admin.saleorder.vo.SaleOrderPageReqVO;
|
||||
import cn.hangtag.module.oms.controller.admin.saleorder.vo.SaleOrderRemarkReqVO;
|
||||
import cn.hangtag.module.oms.controller.admin.saleorder.vo.SaleOrderRespVO;
|
||||
import cn.hangtag.module.oms.controller.admin.saleorder.vo.SaleOrderSaveReqVO;
|
||||
import cn.hangtag.module.oms.convert.saleorder.SaleOrderConvert;
|
||||
import cn.hangtag.module.oms.dal.dataobject.customer.CustomerDO;
|
||||
import cn.hangtag.module.oms.dal.dataobject.saleorder.SaleOrderDO;
|
||||
import cn.hangtag.module.oms.dal.dataobject.saleorderentry.SaleOrderEntryDO;
|
||||
import cn.hangtag.module.oms.service.customer.CustomerService;
|
||||
import cn.hangtag.module.oms.service.saleorder.SaleOrderService;
|
||||
import cn.hangtag.module.system.api.user.AdminUserApi;
|
||||
import cn.hangtag.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.hangtag.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.hangtag.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "销售订单")
|
||||
@RestController
|
||||
@RequestMapping("/front/oms/sale-order")
|
||||
@Validated
|
||||
public class SaleOrderFrontController {
|
||||
|
||||
@Resource
|
||||
private SaleOrderService saleOrderService;
|
||||
@Resource
|
||||
private CustomerService customerService;
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
|
||||
@PostMapping("/placeOrder")
|
||||
@Operation(summary = "下单")
|
||||
public CommonResult<Long> placeOrder(@Valid @RequestBody CreateSaleOrderDTO dto) {
|
||||
return success(saleOrderService.placeOrder(dto));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,52 +1,90 @@
|
|||
package cn.hangtag.module.oms.controller.admin.saleorder.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CreateSaleOrderDTO implements Serializable {
|
||||
|
||||
private String name;
|
||||
|
||||
private String email;
|
||||
|
||||
private String contacts;
|
||||
|
||||
/**
|
||||
* 联系人信息
|
||||
*/
|
||||
@Schema(description = "联系人名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "啊三")
|
||||
private String contactName;
|
||||
/**
|
||||
* 联系人电话
|
||||
*/
|
||||
@Schema(description = "联系人电话", requiredMode = Schema.RequiredMode.REQUIRED, example = "0755-523127")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "固定电话", example = "0755-523127")
|
||||
private String tel;
|
||||
|
||||
@Schema(description = "传真号码", example = "0755-523127")
|
||||
private String fax;
|
||||
|
||||
@Schema(description = "合同编码", example = "123456")
|
||||
private String contractCode;
|
||||
|
||||
@Schema(description = "零售商编码", example = "123456")
|
||||
private String retailerCode;
|
||||
|
||||
@Schema(description = "发票代码")
|
||||
private String invoiceCode;
|
||||
|
||||
@Schema(description = "发票名称")
|
||||
private String invoiceName;
|
||||
|
||||
@Schema(description = "发票地址")
|
||||
private String invoiceAddress;
|
||||
|
||||
private Long areaId;
|
||||
@Schema(description = "发票备注")
|
||||
private String invoiceRemarks;
|
||||
|
||||
private Integer status;
|
||||
/**
|
||||
* 客户id
|
||||
*/
|
||||
private Long customerId;
|
||||
/**
|
||||
* 品牌id
|
||||
*/
|
||||
private Long brandId;
|
||||
|
||||
private Integer type;
|
||||
/**
|
||||
* 订单状态
|
||||
*/
|
||||
private Integer orderStatus;
|
||||
|
||||
@Schema(description = "备注", example = "备注信息")
|
||||
private String remarks;
|
||||
|
||||
private String orderNo;
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String orderCode;
|
||||
|
||||
|
||||
|
||||
|
||||
private String newEmail;
|
||||
|
||||
private String[] newEmails;
|
||||
@Schema(description = "联系邮箱")
|
||||
private String emails;
|
||||
|
||||
/**
|
||||
* 订单创建日期
|
||||
* 订单创建时间戳
|
||||
*/
|
||||
private String bizdate;
|
||||
private Long bizdate;
|
||||
|
||||
/**
|
||||
* 交货日期
|
||||
* 交货日期 时间戳
|
||||
*/
|
||||
private String plansenddate;
|
||||
private Long plansenddate;
|
||||
|
||||
private SaleOrderEntryItemDTO[] saleOrderEntry;
|
||||
/**
|
||||
* 是否分批交货
|
||||
*/
|
||||
private Boolean isBatch;
|
||||
|
||||
private List<SaleOrderEntryItemDTO> saleOrderEntry;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class SaleOrderEntryItemDTO implements Serializable {
|
|||
/**
|
||||
* 产品id
|
||||
*/
|
||||
private Long productId;
|
||||
private Integer productId;
|
||||
|
||||
/**
|
||||
* 产品编码
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||
@Data
|
||||
public class SaleOrderSkuDTO implements Serializable {
|
||||
|
||||
private String key;
|
||||
private String itemKey;
|
||||
|
||||
/**
|
||||
* 产品id
|
||||
|
|
@ -35,12 +35,12 @@ public class SaleOrderSkuDTO implements Serializable {
|
|||
/**
|
||||
* 设计稿内容宽度
|
||||
*/
|
||||
private Integer width;
|
||||
private Double width;
|
||||
|
||||
/**
|
||||
* 设计稿内容高度
|
||||
*/
|
||||
private Integer height;
|
||||
private Double height;
|
||||
|
||||
/**
|
||||
* 最终稿件 base64编码数据
|
||||
|
|
|
|||
|
|
@ -0,0 +1,95 @@
|
|||
package cn.hangtag.module.oms.controller.admin.saleordersku;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.hangtag.framework.common.pojo.PageParam;
|
||||
import cn.hangtag.framework.common.pojo.PageResult;
|
||||
import cn.hangtag.framework.common.pojo.CommonResult;
|
||||
import cn.hangtag.framework.common.util.object.BeanUtils;
|
||||
import static cn.hangtag.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.hangtag.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.hangtag.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.hangtag.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.hangtag.module.oms.controller.admin.saleordersku.vo.*;
|
||||
import cn.hangtag.module.oms.dal.dataobject.saleordersku.SaleOrderSkuDO;
|
||||
import cn.hangtag.module.oms.service.saleordersku.SaleOrderSkuService;
|
||||
|
||||
@Tag(name = "管理后台 - 销售订单产品属性表 ")
|
||||
@RestController
|
||||
@RequestMapping("/oms/sale-order-sku")
|
||||
@Validated
|
||||
public class SaleOrderSkuController {
|
||||
|
||||
@Resource
|
||||
private SaleOrderSkuService saleOrderSkuService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建销售订单产品属性表 ")
|
||||
@PreAuthorize("@ss.hasPermission('oms:sale-order-sku:create')")
|
||||
public CommonResult<Long> createSaleOrderSku(@Valid @RequestBody SaleOrderSkuSaveReqVO createReqVO) {
|
||||
return success(saleOrderSkuService.createSaleOrderSku(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新销售订单产品属性表 ")
|
||||
@PreAuthorize("@ss.hasPermission('oms:sale-order-sku:update')")
|
||||
public CommonResult<Boolean> updateSaleOrderSku(@Valid @RequestBody SaleOrderSkuSaveReqVO updateReqVO) {
|
||||
saleOrderSkuService.updateSaleOrderSku(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除销售订单产品属性表 ")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('oms:sale-order-sku:delete')")
|
||||
public CommonResult<Boolean> deleteSaleOrderSku(@RequestParam("id") Long id) {
|
||||
saleOrderSkuService.deleteSaleOrderSku(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得销售订单产品属性表 ")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('oms:sale-order-sku:query')")
|
||||
public CommonResult<SaleOrderSkuRespVO> getSaleOrderSku(@RequestParam("id") Long id) {
|
||||
SaleOrderSkuDO saleOrderSku = saleOrderSkuService.getSaleOrderSku(id);
|
||||
return success(BeanUtils.toBean(saleOrderSku, SaleOrderSkuRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得销售订单产品属性表 分页")
|
||||
@PreAuthorize("@ss.hasPermission('oms:sale-order-sku:query')")
|
||||
public CommonResult<PageResult<SaleOrderSkuRespVO>> getSaleOrderSkuPage(@Valid SaleOrderSkuPageReqVO pageReqVO) {
|
||||
PageResult<SaleOrderSkuDO> pageResult = saleOrderSkuService.getSaleOrderSkuPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, SaleOrderSkuRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出销售订单产品属性表 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('oms:sale-order-sku:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportSaleOrderSkuExcel(@Valid SaleOrderSkuPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<SaleOrderSkuDO> list = saleOrderSkuService.getSaleOrderSkuPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "销售订单产品属性表 .xls", "数据", SaleOrderSkuRespVO.class,
|
||||
BeanUtils.toBean(list, SaleOrderSkuRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package cn.hangtag.module.oms.controller.admin.saleordersku.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.hangtag.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.hangtag.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 销售订单产品属性表 分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SaleOrderSkuPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "销售订单分表id oms_saleorder_entry", example = "26754")
|
||||
private String entryId;
|
||||
|
||||
@Schema(description = "数据key")
|
||||
private String itemKey;
|
||||
|
||||
@Schema(description = "销售订单id oms_saleorder", example = "32307")
|
||||
private String saleOrderId;
|
||||
|
||||
@Schema(description = "产品id oms_product_info", example = "17865")
|
||||
private String productId;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer orderQty;
|
||||
|
||||
@Schema(description = "设计稿id oms_draft_design_data", example = "1282")
|
||||
private Long draftDesignId;
|
||||
|
||||
@Schema(description = "设计稿宽")
|
||||
private BigDecimal width;
|
||||
|
||||
@Schema(description = "设计稿高")
|
||||
private BigDecimal height;
|
||||
|
||||
@Schema(description = "预览图")
|
||||
private String previewImage;
|
||||
|
||||
@Schema(description = "动态属性 json动态属性")
|
||||
private String propInfo;
|
||||
|
||||
@Schema(description = "规格 json完整信息")
|
||||
private String specInfo;
|
||||
|
||||
@Schema(description = "宽(mm)")
|
||||
private BigDecimal specSizeWidth;
|
||||
|
||||
@Schema(description = "高(mm)")
|
||||
private BigDecimal specSizeHeight;
|
||||
|
||||
@Schema(description = "厚度(mm)")
|
||||
private BigDecimal specSizeThk;
|
||||
|
||||
@Schema(description = "材质")
|
||||
private String specMaterial;
|
||||
|
||||
@Schema(description = "主色风格")
|
||||
private String mainColor;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package cn.hangtag.module.oms.controller.admin.saleordersku.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 销售订单产品属性表 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class SaleOrderSkuRespVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24887")
|
||||
@ExcelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "销售订单分表id oms_saleorder_entry", example = "26754")
|
||||
@ExcelProperty("销售订单分表id oms_saleorder_entry")
|
||||
private String entryId;
|
||||
|
||||
@Schema(description = "数据key")
|
||||
@ExcelProperty("数据key")
|
||||
private String itemKey;
|
||||
|
||||
@Schema(description = "销售订单id oms_saleorder", example = "32307")
|
||||
@ExcelProperty("销售订单id oms_saleorder")
|
||||
private String saleOrderId;
|
||||
|
||||
@Schema(description = "产品id oms_product_info", example = "17865")
|
||||
@ExcelProperty("产品id oms_product_info")
|
||||
private String productId;
|
||||
|
||||
@Schema(description = "数量")
|
||||
@ExcelProperty("数量")
|
||||
private Integer orderQty;
|
||||
|
||||
@Schema(description = "设计稿id oms_draft_design_data", example = "1282")
|
||||
@ExcelProperty("设计稿id oms_draft_design_data")
|
||||
private Long draftDesignId;
|
||||
|
||||
@Schema(description = "设计稿宽")
|
||||
@ExcelProperty("设计稿宽")
|
||||
private BigDecimal width;
|
||||
|
||||
@Schema(description = "设计稿高")
|
||||
@ExcelProperty("设计稿高")
|
||||
private BigDecimal height;
|
||||
|
||||
@Schema(description = "预览图")
|
||||
@ExcelProperty("预览图")
|
||||
private String previewImage;
|
||||
|
||||
@Schema(description = "动态属性 json动态属性")
|
||||
@ExcelProperty("动态属性 json动态属性")
|
||||
private String propInfo;
|
||||
|
||||
@Schema(description = "规格 json完整信息")
|
||||
@ExcelProperty("规格 json完整信息")
|
||||
private String specInfo;
|
||||
|
||||
@Schema(description = "宽(mm)")
|
||||
@ExcelProperty("宽(mm)")
|
||||
private BigDecimal specSizeWidth;
|
||||
|
||||
@Schema(description = "高(mm)")
|
||||
@ExcelProperty("高(mm)")
|
||||
private BigDecimal specSizeHeight;
|
||||
|
||||
@Schema(description = "厚度(mm)")
|
||||
@ExcelProperty("厚度(mm)")
|
||||
private BigDecimal specSizeThk;
|
||||
|
||||
@Schema(description = "材质")
|
||||
@ExcelProperty("材质")
|
||||
private String specMaterial;
|
||||
|
||||
@Schema(description = "主色风格")
|
||||
@ExcelProperty("主色风格")
|
||||
private String mainColor;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package cn.hangtag.module.oms.controller.admin.saleordersku.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 销售订单产品属性表 新增/修改 Request VO")
|
||||
@Data
|
||||
public class SaleOrderSkuSaveReqVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24887")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "销售订单分表id oms_saleorder_entry", example = "26754")
|
||||
private String entryId;
|
||||
|
||||
@Schema(description = "数据key")
|
||||
private String itemKey;
|
||||
|
||||
@Schema(description = "销售订单id oms_saleorder", example = "32307")
|
||||
private String saleOrderId;
|
||||
|
||||
@Schema(description = "产品id oms_product_info", example = "17865")
|
||||
private String productId;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer orderQty;
|
||||
|
||||
@Schema(description = "设计稿id oms_draft_design_data", example = "1282")
|
||||
private Long draftDesignId;
|
||||
|
||||
@Schema(description = "设计稿宽")
|
||||
private BigDecimal width;
|
||||
|
||||
@Schema(description = "设计稿高")
|
||||
private BigDecimal height;
|
||||
|
||||
@Schema(description = "预览图")
|
||||
private String previewImage;
|
||||
|
||||
@Schema(description = "动态属性 json动态属性")
|
||||
private String propInfo;
|
||||
|
||||
@Schema(description = "规格 json完整信息")
|
||||
private String specInfo;
|
||||
|
||||
@Schema(description = "宽(mm)")
|
||||
private BigDecimal specSizeWidth;
|
||||
|
||||
@Schema(description = "高(mm)")
|
||||
private BigDecimal specSizeHeight;
|
||||
|
||||
@Schema(description = "厚度(mm)")
|
||||
private BigDecimal specSizeThk;
|
||||
|
||||
@Schema(description = "材质")
|
||||
private String specMaterial;
|
||||
|
||||
@Schema(description = "主色风格")
|
||||
private String mainColor;
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
package cn.hangtag.module.oms.dal.dataobject.saleorder;
|
||||
|
||||
import cn.hangtag.module.oms.controller.admin.saleorder.dto.CreateSaleOrderDTO;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -9,6 +12,7 @@ import java.time.LocalDateTime;
|
|||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.hangtag.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
|
|
@ -121,4 +125,45 @@ public class SaleOrderDO extends BaseDO {
|
|||
*/
|
||||
private LocalDateTime auditorTime;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String orderCode;
|
||||
/**
|
||||
* 联系人名称
|
||||
*/
|
||||
private String contactName;
|
||||
/**
|
||||
* 固定电话
|
||||
*/
|
||||
private String tel;
|
||||
/**
|
||||
* 合同编码
|
||||
*/
|
||||
private String contractCode;
|
||||
/**
|
||||
* 零售商单号
|
||||
*/
|
||||
private String retailerCode;
|
||||
/**
|
||||
* 发票地址
|
||||
*/
|
||||
private String invoiceAddress;
|
||||
|
||||
|
||||
/**
|
||||
* 品牌id
|
||||
*/
|
||||
private Integer brandId;
|
||||
|
||||
/**
|
||||
* 是否分批交货 分批交货以明细表中的交货日期为准
|
||||
*/
|
||||
private Boolean isBatch;
|
||||
|
||||
|
||||
|
||||
public SaleOrderDO(CreateSaleOrderDTO dto) {
|
||||
BeanUtil.copyProperties(dto, this,"bizdate","plansenddate");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
package cn.hangtag.module.oms.dal.dataobject.saleorderentry;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.hangtag.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
|
@ -59,4 +60,7 @@ public class SaleOrderEntryDO extends BaseDO {
|
|||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
//
|
||||
private LocalDateTime deliveryDate;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package cn.hangtag.module.oms.dal.dataobject.saleordersku;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.hangtag.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 销售订单产品属性表 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("oms_sale_order_sku")
|
||||
@KeySequence("oms_sale_order_sku_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SaleOrderSkuDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 销售订单分表id oms_saleorder_entry
|
||||
*/
|
||||
private Long entryId;
|
||||
/**
|
||||
* 数据key
|
||||
*/
|
||||
private String itemKey;
|
||||
/**
|
||||
* 销售订单id oms_saleorder
|
||||
*/
|
||||
private String saleOrderId;
|
||||
/**
|
||||
* 产品id oms_product_info
|
||||
*/
|
||||
private String productId;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer orderQty;
|
||||
/**
|
||||
* 设计稿id oms_draft_design_data
|
||||
*/
|
||||
private Long draftDesignId;
|
||||
/**
|
||||
* 设计稿宽
|
||||
*/
|
||||
private BigDecimal width;
|
||||
/**
|
||||
* 设计稿高
|
||||
*/
|
||||
private BigDecimal height;
|
||||
/**
|
||||
* 预览图
|
||||
*/
|
||||
private String previewImage;
|
||||
/**
|
||||
* 动态属性 json动态属性
|
||||
*/
|
||||
private String propInfo;
|
||||
/**
|
||||
* 规格 json完整信息
|
||||
*/
|
||||
private String specInfo;
|
||||
/**
|
||||
* 宽(mm)
|
||||
*/
|
||||
private BigDecimal specSizeWidth;
|
||||
/**
|
||||
* 高(mm)
|
||||
*/
|
||||
private BigDecimal specSizeHeight;
|
||||
/**
|
||||
* 厚度(mm)
|
||||
*/
|
||||
private BigDecimal specSizeThk;
|
||||
/**
|
||||
* 材质
|
||||
*/
|
||||
private String specMaterial;
|
||||
/**
|
||||
* 主色风格
|
||||
*/
|
||||
private String mainColor;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package cn.hangtag.module.oms.dal.mysql.saleordersku;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.hangtag.framework.common.pojo.PageResult;
|
||||
import cn.hangtag.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.hangtag.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.hangtag.module.oms.dal.dataobject.saleordersku.SaleOrderSkuDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.hangtag.module.oms.controller.admin.saleordersku.vo.*;
|
||||
|
||||
/**
|
||||
* 销售订单产品属性表 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface SaleOrderSkuMapper extends BaseMapperX<SaleOrderSkuDO> {
|
||||
|
||||
default PageResult<SaleOrderSkuDO> selectPage(SaleOrderSkuPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<SaleOrderSkuDO>()
|
||||
.eqIfPresent(SaleOrderSkuDO::getEntryId, reqVO.getEntryId())
|
||||
.eqIfPresent(SaleOrderSkuDO::getItemKey, reqVO.getItemKey())
|
||||
.eqIfPresent(SaleOrderSkuDO::getSaleOrderId, reqVO.getSaleOrderId())
|
||||
.eqIfPresent(SaleOrderSkuDO::getProductId, reqVO.getProductId())
|
||||
.eqIfPresent(SaleOrderSkuDO::getOrderQty, reqVO.getOrderQty())
|
||||
.eqIfPresent(SaleOrderSkuDO::getDraftDesignId, reqVO.getDraftDesignId())
|
||||
.eqIfPresent(SaleOrderSkuDO::getWidth, reqVO.getWidth())
|
||||
.eqIfPresent(SaleOrderSkuDO::getHeight, reqVO.getHeight())
|
||||
.eqIfPresent(SaleOrderSkuDO::getPreviewImage, reqVO.getPreviewImage())
|
||||
.eqIfPresent(SaleOrderSkuDO::getPropInfo, reqVO.getPropInfo())
|
||||
.eqIfPresent(SaleOrderSkuDO::getSpecInfo, reqVO.getSpecInfo())
|
||||
.eqIfPresent(SaleOrderSkuDO::getSpecSizeWidth, reqVO.getSpecSizeWidth())
|
||||
.eqIfPresent(SaleOrderSkuDO::getSpecSizeHeight, reqVO.getSpecSizeHeight())
|
||||
.eqIfPresent(SaleOrderSkuDO::getSpecSizeThk, reqVO.getSpecSizeThk())
|
||||
.eqIfPresent(SaleOrderSkuDO::getSpecMaterial, reqVO.getSpecMaterial())
|
||||
.eqIfPresent(SaleOrderSkuDO::getMainColor, reqVO.getMainColor())
|
||||
.betweenIfPresent(SaleOrderSkuDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(SaleOrderSkuDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import javax.validation.*;
|
||||
|
||||
import cn.hangtag.module.oms.controller.admin.common.vo.DataComparisonRespVO;
|
||||
import cn.hangtag.module.oms.controller.admin.saleorder.dto.CreateSaleOrderDTO;
|
||||
import cn.hangtag.module.oms.controller.admin.saleorder.vo.*;
|
||||
import cn.hangtag.module.oms.controller.admin.trade.vo.TradeOrderSummaryRespVO;
|
||||
import cn.hangtag.module.oms.controller.admin.trade.vo.TradeOrderTrendReqVO;
|
||||
|
|
@ -99,4 +100,14 @@ public interface SaleOrderService {
|
|||
Long getCountByBillStatus(String value, Long customerId);
|
||||
|
||||
List<DataComparisonRespVO<TradeOrderTrendRespVO>> getOrderCountTrendComparison(TradeOrderTrendReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 下订单
|
||||
*
|
||||
* @param dto DTO
|
||||
* @return {@link Long }
|
||||
*/
|
||||
Long placeOrder(CreateSaleOrderDTO dto);
|
||||
|
||||
public String getNewOrderCode();
|
||||
}
|
||||
|
|
@ -1,14 +1,22 @@
|
|||
package cn.hangtag.module.oms.service.saleorder;
|
||||
|
||||
import cn.hangtag.framework.common.exception.ServiceException;
|
||||
import cn.hangtag.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||
import cn.hangtag.framework.common.pojo.PageResult;
|
||||
import cn.hangtag.framework.common.util.FuncUtil;
|
||||
import cn.hangtag.framework.common.util.object.BeanUtils;
|
||||
import cn.hangtag.framework.common.util.validation.AssertUtil;
|
||||
import cn.hangtag.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.hangtag.framework.security.core.LoginUser;
|
||||
import cn.hangtag.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.hangtag.module.oms.common.utils.NumberChineseFormatterUtils;
|
||||
import cn.hangtag.module.oms.common.utils.WKHtmlToPdfUtil;
|
||||
import cn.hangtag.module.oms.controller.admin.common.vo.DataComparisonRespVO;
|
||||
import cn.hangtag.module.oms.controller.admin.produceorder.vo.ProduceOrderSaveReqVO;
|
||||
import cn.hangtag.module.oms.controller.admin.product.vo.ProductPriceSaveReqVO;
|
||||
import cn.hangtag.module.oms.controller.admin.saleorder.dto.CreateSaleOrderDTO;
|
||||
import cn.hangtag.module.oms.controller.admin.saleorder.dto.SaleOrderEntryItemDTO;
|
||||
import cn.hangtag.module.oms.controller.admin.saleorder.dto.SaleOrderSkuDTO;
|
||||
import cn.hangtag.module.oms.controller.admin.saleorder.vo.SaleOrderPageReqVO;
|
||||
import cn.hangtag.module.oms.controller.admin.saleorder.vo.SaleOrderRemarkReqVO;
|
||||
import cn.hangtag.module.oms.controller.admin.saleorder.vo.SaleOrderSaveReqVO;
|
||||
|
|
@ -23,25 +31,34 @@ import cn.hangtag.module.oms.dal.dataobject.salecontract.SaleContractDO;
|
|||
import cn.hangtag.module.oms.dal.dataobject.salecontractentry.SaleContractEntryDO;
|
||||
import cn.hangtag.module.oms.dal.dataobject.saleorder.SaleOrderDO;
|
||||
import cn.hangtag.module.oms.dal.dataobject.saleorderentry.SaleOrderEntryDO;
|
||||
import cn.hangtag.module.oms.dal.dataobject.saleordersku.SaleOrderSkuDO;
|
||||
import cn.hangtag.module.oms.dal.mysql.saleorder.SaleOrderMapper;
|
||||
import cn.hangtag.module.oms.dal.mysql.saleorderentry.SaleOrderEntryMapper;
|
||||
import cn.hangtag.module.oms.dal.mysql.saleordersku.SaleOrderSkuMapper;
|
||||
import cn.hangtag.module.oms.enums.ErrorCodeConstants;
|
||||
import cn.hangtag.module.oms.enums.TimeRangeTypeEnum;
|
||||
import cn.hangtag.module.oms.enums.common.BillStatusEnum;
|
||||
import cn.hangtag.module.oms.enums.saleorder.SaleOrderStatusEnum;
|
||||
import cn.hangtag.module.oms.enums.saleorder.SaleOrderTypeEnum;
|
||||
import cn.hangtag.module.oms.serialnumber.CodingRulesUtils;
|
||||
import cn.hangtag.module.oms.service.customer.CustomerService;
|
||||
import cn.hangtag.module.oms.service.produceorder.ProduceOrderService;
|
||||
import cn.hangtag.module.oms.service.product.ProductPriceService;
|
||||
import cn.hangtag.module.oms.service.productinfo.ProductInfoService;
|
||||
import cn.hangtag.module.oms.service.salecontract.SaleContractService;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.google.common.collect.Maps;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -59,6 +76,7 @@ import java.io.InputStream;
|
|||
import java.math.BigDecimal;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -76,24 +94,20 @@ import static cn.hangtag.module.oms.enums.ErrorCodeConstants.SALE_ORDER_NOT_EXIS
|
|||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class SaleOrderServiceImpl implements SaleOrderService {
|
||||
|
||||
@Resource
|
||||
private SaleOrderMapper saleOrderMapper;
|
||||
@Resource
|
||||
private SaleOrderEntryMapper saleOrderEntryMapper;
|
||||
@Resource
|
||||
private ProduceOrderService produceOrderService;
|
||||
@Resource
|
||||
private ProductInfoService productInfoService;
|
||||
@Resource
|
||||
private SaleContractService saleContractService;
|
||||
@Resource
|
||||
private CustomerService customerService;
|
||||
@Resource
|
||||
private ProductPriceService productPriceService;
|
||||
@Resource
|
||||
private TemplateEngine templateEngine;
|
||||
|
||||
private final SaleOrderMapper saleOrderMapper;
|
||||
private final SaleOrderEntryMapper saleOrderEntryMapper;
|
||||
private final SaleOrderSkuMapper skuOrderSkuMapper;
|
||||
private final ProduceOrderService produceOrderService;
|
||||
private final ProductInfoService productInfoService;
|
||||
private final SaleContractService saleContractService;
|
||||
private final CustomerService customerService;
|
||||
private final ProductPriceService productPriceService;
|
||||
private final TemplateEngine templateEngine;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
|
@ -440,6 +454,111 @@ public class SaleOrderServiceImpl implements SaleOrderService {
|
|||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
long l = IdUtil.getSnowflake().nextId();
|
||||
System.out.println(l);
|
||||
}
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long placeOrder(CreateSaleOrderDTO dto) {
|
||||
SaleOrderDO order = new SaleOrderDO(dto);
|
||||
order = wrapperEntity(order, dto);
|
||||
List<SaleOrderEntryItemDTO> saleOrderEntry = dto.getSaleOrderEntry();
|
||||
|
||||
List<SaleOrderEntryDO> entryList = new ArrayList<>();
|
||||
List<SaleOrderSkuDO> skuList = new ArrayList<>();
|
||||
// 转成订单条目
|
||||
for (SaleOrderEntryItemDTO itemDTO : saleOrderEntry) {
|
||||
SaleOrderEntryDO entry = SaleOrderEntryDO.builder()
|
||||
.id(FuncUtil.getNextId())
|
||||
.parentId(order.getId())
|
||||
.materialId(itemDTO.getProductId())
|
||||
.materialName(itemDTO.getProductName())
|
||||
.qty(itemDTO.getOrderQty())
|
||||
.deliveryDate(FuncUtil.parseDate(itemDTO.getDeliveryDate())).build();
|
||||
|
||||
entryList.add(entry);
|
||||
List<SaleOrderSkuDTO> productSkuList = itemDTO.getProductSkuList();
|
||||
// sku
|
||||
for (SaleOrderSkuDTO saleOrderSkuDTO : productSkuList) {
|
||||
SaleOrderSkuDO saleOrderSkuDO = new SaleOrderSkuDO();
|
||||
BeanUtil.copyProperties(saleOrderSkuDTO,saleOrderSkuDO);
|
||||
saleOrderSkuDO.setEntryId(entry.getId());
|
||||
saleOrderSkuDO.setId(FuncUtil.getNextId());
|
||||
skuList.add(saleOrderSkuDO);
|
||||
}
|
||||
|
||||
}
|
||||
saleOrderMapper.insert(order);
|
||||
saleOrderEntryMapper.insertBatch(entryList);
|
||||
skuOrderSkuMapper.insertBatch(skuList);
|
||||
System.out.println(order);
|
||||
return order.getId();
|
||||
}
|
||||
private static final long codeId = 6L;
|
||||
@Override
|
||||
public String getNewOrderCode() {
|
||||
String s = "";
|
||||
int count = 10;
|
||||
while (true){
|
||||
count --;
|
||||
try {
|
||||
s = CodingRulesUtils.generateCode(codeId, false);
|
||||
checkCode(null,s);
|
||||
return s;
|
||||
}catch (ServiceException e){
|
||||
log.warn("重复或者下一个编码");
|
||||
if(count < 0){
|
||||
log.error("编码获取失败");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void checkCode(Long id,String code){
|
||||
if(FuncUtil.isNotEmpty(code)){
|
||||
LambdaQueryWrapper<SaleOrderDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(SaleOrderDO::getId,SaleOrderDO::getOrderCode, BaseDO::getDeleted);
|
||||
lambdaQueryWrapper.eq(SaleOrderDO::getOrderCode, code);
|
||||
lambdaQueryWrapper.eq(SaleOrderDO::getDeleted,false);
|
||||
List<SaleOrderDO> dos = saleOrderMapper.selectList(lambdaQueryWrapper);
|
||||
if(FuncUtil.isEmpty(id) && FuncUtil.isNotEmpty(dos)){
|
||||
throw exception(GlobalErrorCodeConstants.DATA_DUPLICATE);
|
||||
}
|
||||
if (FuncUtil.isNotEmpty(id) && FuncUtil.isNotEmpty(dos)) {
|
||||
for (SaleOrderDO aDo : dos) {
|
||||
// 出现重复并当前id 不一致
|
||||
if(!FuncUtil.equals(aDo.getId(), id)){
|
||||
throw exception(GlobalErrorCodeConstants.DATA_DUPLICATE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private SaleOrderDO wrapperEntity(SaleOrderDO order,CreateSaleOrderDTO dto){
|
||||
// 客户信息
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
AssertUtil.isEmpty(loginUser,"登录信息已过期,请重新登录");
|
||||
CustomerDO customer = customerService.getCustomerByUserId(loginUser.getId());
|
||||
AssertUtil.isEmpty(customer,"客户信息不存在");
|
||||
|
||||
order.setCustomerId(customer.getId());
|
||||
if(FuncUtil.isEmpty(order.getId())){
|
||||
order.setId(FuncUtil.getNextId());
|
||||
}
|
||||
order.setBizdate(LocalDateTime.now());
|
||||
order.setPlansenddate( FuncUtil.parseDate(dto.getPlansenddate()));
|
||||
// 设置订单状态
|
||||
order.setOrderStatus(SaleOrderStatusEnum.YXD.getValue());
|
||||
order.setBillStatus(BillStatusEnum.SAVE.getValue());
|
||||
String orderType = order.getOrderType();
|
||||
if(FuncUtil.isEmpty(orderType)){
|
||||
order.setOrderType(SaleOrderTypeEnum.NORMAL.getType());
|
||||
}
|
||||
order.setBillno(getNewOrderCode());
|
||||
return order;
|
||||
}
|
||||
|
||||
private List<TradeOrderTrendRespVO> getOrderCountTrend(Integer timeRangeType, LocalDateTime beginTime, LocalDateTime endTime) {
|
||||
// 情况一:按年统计时,以月份分组
|
||||
if (TimeRangeTypeEnum.YEAR.getType().equals(timeRangeType)) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
package cn.hangtag.module.oms.service.saleordersku;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.hangtag.module.oms.controller.admin.saleordersku.vo.*;
|
||||
import cn.hangtag.module.oms.dal.dataobject.saleordersku.SaleOrderSkuDO;
|
||||
import cn.hangtag.framework.common.pojo.PageResult;
|
||||
import cn.hangtag.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 销售订单产品属性表 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface SaleOrderSkuService {
|
||||
|
||||
/**
|
||||
* 创建销售订单产品属性表
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createSaleOrderSku(@Valid SaleOrderSkuSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新销售订单产品属性表
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateSaleOrderSku(@Valid SaleOrderSkuSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除销售订单产品属性表
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteSaleOrderSku(Long id);
|
||||
|
||||
/**
|
||||
* 获得销售订单产品属性表
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 销售订单产品属性表
|
||||
*/
|
||||
SaleOrderSkuDO getSaleOrderSku(Long id);
|
||||
|
||||
/**
|
||||
* 获得销售订单产品属性表 分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 销售订单产品属性表 分页
|
||||
*/
|
||||
PageResult<SaleOrderSkuDO> getSaleOrderSkuPage(SaleOrderSkuPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package cn.hangtag.module.oms.service.saleordersku;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.hangtag.module.oms.controller.admin.saleordersku.vo.*;
|
||||
import cn.hangtag.module.oms.dal.dataobject.saleordersku.SaleOrderSkuDO;
|
||||
import cn.hangtag.framework.common.pojo.PageResult;
|
||||
import cn.hangtag.framework.common.pojo.PageParam;
|
||||
import cn.hangtag.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.hangtag.module.oms.dal.mysql.saleordersku.SaleOrderSkuMapper;
|
||||
|
||||
import static cn.hangtag.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.hangtag.module.oms.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 销售订单产品属性表 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class SaleOrderSkuServiceImpl implements SaleOrderSkuService {
|
||||
|
||||
@Resource
|
||||
private SaleOrderSkuMapper saleOrderSkuMapper;
|
||||
|
||||
@Override
|
||||
public Long createSaleOrderSku(SaleOrderSkuSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
SaleOrderSkuDO saleOrderSku = BeanUtils.toBean(createReqVO, SaleOrderSkuDO.class);
|
||||
saleOrderSkuMapper.insert(saleOrderSku);
|
||||
// 返回
|
||||
return saleOrderSku.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSaleOrderSku(SaleOrderSkuSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateSaleOrderSkuExists(updateReqVO.getId());
|
||||
// 更新
|
||||
SaleOrderSkuDO updateObj = BeanUtils.toBean(updateReqVO, SaleOrderSkuDO.class);
|
||||
saleOrderSkuMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSaleOrderSku(Long id) {
|
||||
// 校验存在
|
||||
validateSaleOrderSkuExists(id);
|
||||
// 删除
|
||||
saleOrderSkuMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateSaleOrderSkuExists(Long id) {
|
||||
if (saleOrderSkuMapper.selectById(id) == null) {
|
||||
throw exception(SALE_ORDER_SKU_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SaleOrderSkuDO getSaleOrderSku(Long id) {
|
||||
return saleOrderSkuMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<SaleOrderSkuDO> getSaleOrderSkuPage(SaleOrderSkuPageReqVO pageReqVO) {
|
||||
return saleOrderSkuMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.hangtag.module.oms.dal.mysql.saleordersku.SaleOrderSkuMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,194 @@
|
|||
package cn.hangtag.module.oms.service.saleordersku;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.hangtag.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import cn.hangtag.module.oms.controller.admin.saleordersku.vo.*;
|
||||
import cn.hangtag.module.oms.dal.dataobject.saleordersku.SaleOrderSkuDO;
|
||||
import cn.hangtag.module.oms.dal.mysql.saleordersku.SaleOrderSkuMapper;
|
||||
import cn.hangtag.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.*;
|
||||
import static cn.hangtag.module.oms.enums.ErrorCodeConstants.*;
|
||||
import static cn.hangtag.framework.test.core.util.AssertUtils.*;
|
||||
import static cn.hangtag.framework.test.core.util.RandomUtils.*;
|
||||
import static cn.hangtag.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static cn.hangtag.framework.common.util.object.ObjectUtils.*;
|
||||
import static cn.hangtag.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link SaleOrderSkuServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Import(SaleOrderSkuServiceImpl.class)
|
||||
public class SaleOrderSkuServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private SaleOrderSkuServiceImpl saleOrderSkuService;
|
||||
|
||||
@Resource
|
||||
private SaleOrderSkuMapper saleOrderSkuMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateSaleOrderSku_success() {
|
||||
// 准备参数
|
||||
SaleOrderSkuSaveReqVO createReqVO = randomPojo(SaleOrderSkuSaveReqVO.class).setId(null);
|
||||
|
||||
// 调用
|
||||
Long saleOrderSkuId = saleOrderSkuService.createSaleOrderSku(createReqVO);
|
||||
// 断言
|
||||
assertNotNull(saleOrderSkuId);
|
||||
// 校验记录的属性是否正确
|
||||
SaleOrderSkuDO saleOrderSku = saleOrderSkuMapper.selectById(saleOrderSkuId);
|
||||
assertPojoEquals(createReqVO, saleOrderSku, "id");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateSaleOrderSku_success() {
|
||||
// mock 数据
|
||||
SaleOrderSkuDO dbSaleOrderSku = randomPojo(SaleOrderSkuDO.class);
|
||||
saleOrderSkuMapper.insert(dbSaleOrderSku);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
SaleOrderSkuSaveReqVO updateReqVO = randomPojo(SaleOrderSkuSaveReqVO.class, o -> {
|
||||
o.setId(dbSaleOrderSku.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
saleOrderSkuService.updateSaleOrderSku(updateReqVO);
|
||||
// 校验是否更新正确
|
||||
SaleOrderSkuDO saleOrderSku = saleOrderSkuMapper.selectById(updateReqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(updateReqVO, saleOrderSku);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateSaleOrderSku_notExists() {
|
||||
// 准备参数
|
||||
SaleOrderSkuSaveReqVO updateReqVO = randomPojo(SaleOrderSkuSaveReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> saleOrderSkuService.updateSaleOrderSku(updateReqVO), SALE_ORDER_SKU_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteSaleOrderSku_success() {
|
||||
// mock 数据
|
||||
SaleOrderSkuDO dbSaleOrderSku = randomPojo(SaleOrderSkuDO.class);
|
||||
saleOrderSkuMapper.insert(dbSaleOrderSku);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbSaleOrderSku.getId();
|
||||
|
||||
// 调用
|
||||
saleOrderSkuService.deleteSaleOrderSku(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(saleOrderSkuMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteSaleOrderSku_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> saleOrderSkuService.deleteSaleOrderSku(id), SALE_ORDER_SKU_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetSaleOrderSkuPage() {
|
||||
// mock 数据
|
||||
SaleOrderSkuDO dbSaleOrderSku = randomPojo(SaleOrderSkuDO.class, o -> { // 等会查询到
|
||||
o.setEntryId(null);
|
||||
o.setItemKey(null);
|
||||
o.setSaleOrderId(null);
|
||||
o.setProductId(null);
|
||||
o.setOrderQty(null);
|
||||
o.setDraftDesignId(null);
|
||||
o.setWidth(null);
|
||||
o.setHeight(null);
|
||||
o.setPreviewImage(null);
|
||||
o.setPropInfo(null);
|
||||
o.setSpecInfo(null);
|
||||
o.setSpecSizeWidth(null);
|
||||
o.setSpecSizeHeight(null);
|
||||
o.setSpecSizeThk(null);
|
||||
o.setSpecMaterial(null);
|
||||
o.setMainColor(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
saleOrderSkuMapper.insert(dbSaleOrderSku);
|
||||
// 测试 entryId 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setEntryId(null)));
|
||||
// 测试 itemKey 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setItemKey(null)));
|
||||
// 测试 saleOrderId 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setSaleOrderId(null)));
|
||||
// 测试 productId 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setProductId(null)));
|
||||
// 测试 orderQty 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setOrderQty(null)));
|
||||
// 测试 draftDesignId 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setDraftDesignId(null)));
|
||||
// 测试 width 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setWidth(null)));
|
||||
// 测试 height 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setHeight(null)));
|
||||
// 测试 previewImage 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setPreviewImage(null)));
|
||||
// 测试 propInfo 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setPropInfo(null)));
|
||||
// 测试 specInfo 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setSpecInfo(null)));
|
||||
// 测试 specSizeWidth 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setSpecSizeWidth(null)));
|
||||
// 测试 specSizeHeight 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setSpecSizeHeight(null)));
|
||||
// 测试 specSizeThk 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setSpecSizeThk(null)));
|
||||
// 测试 specMaterial 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setSpecMaterial(null)));
|
||||
// 测试 mainColor 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setMainColor(null)));
|
||||
// 测试 createTime 不匹配
|
||||
saleOrderSkuMapper.insert(cloneIgnoreId(dbSaleOrderSku, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
SaleOrderSkuPageReqVO reqVO = new SaleOrderSkuPageReqVO();
|
||||
reqVO.setEntryId(null);
|
||||
reqVO.setItemKey(null);
|
||||
reqVO.setSaleOrderId(null);
|
||||
reqVO.setProductId(null);
|
||||
reqVO.setOrderQty(null);
|
||||
reqVO.setDraftDesignId(null);
|
||||
reqVO.setWidth(null);
|
||||
reqVO.setHeight(null);
|
||||
reqVO.setPreviewImage(null);
|
||||
reqVO.setPropInfo(null);
|
||||
reqVO.setSpecInfo(null);
|
||||
reqVO.setSpecSizeWidth(null);
|
||||
reqVO.setSpecSizeHeight(null);
|
||||
reqVO.setSpecSizeThk(null);
|
||||
reqVO.setSpecMaterial(null);
|
||||
reqVO.setMainColor(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// 调用
|
||||
PageResult<SaleOrderSkuDO> pageResult = saleOrderSkuService.getSaleOrderSkuPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbSaleOrderSku, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 创建产品工艺
|
||||
export function createProductProcess(data) {
|
||||
return request({
|
||||
url: '/oms/product-process/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新产品工艺
|
||||
export function updateProductProcess(data) {
|
||||
return request({
|
||||
url: '/oms/product-process/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除产品工艺
|
||||
export function deleteProductProcess(id) {
|
||||
return request({
|
||||
url: '/oms/product-process/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得产品工艺
|
||||
export function getProductProcess(id) {
|
||||
return request({
|
||||
url: '/oms/product-process/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得产品工艺 分页
|
||||
export function getProductProcessPage(params) {
|
||||
return request({
|
||||
url: '/oms/product-process/page',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
// 导出产品工艺 Excel
|
||||
export function exportProductProcessExcel(params) {
|
||||
return request({
|
||||
url: '/oms/product-process/export-excel',
|
||||
method: 'get',
|
||||
params,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ const loginData = reactive({
|
|||
captchaEnable: import.meta.env.VITE_APP_CAPTCHA_ENABLE,
|
||||
tenantEnable: import.meta.env.VITE_APP_TENANT_ENABLE,
|
||||
loginForm: {
|
||||
tenantName: '',
|
||||
tenantName: '芋道源码',
|
||||
username: '',
|
||||
password: '',
|
||||
captchaVerification: '',
|
||||
|
|
|
|||
|
|
@ -103,6 +103,10 @@ export const SaleOrderApi = {
|
|||
// 更新分录数据
|
||||
updateOrderEntrys: async (data: SaleOrderVO) => {
|
||||
return await request.put({ url: `/oms/sale-order/update-entrys`, data })
|
||||
}
|
||||
},
|
||||
|
||||
// 下单
|
||||
placeOrder: async (data: any) => {
|
||||
return await request.post({ url: `/front/oms/sale-order/placeOrder`, data })
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,6 @@ const that = reactive({
|
|||
selectRow:[],
|
||||
queryInfo:{
|
||||
productTypeId: null,
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -139,12 +138,16 @@ const getLabel = (id)=>{
|
|||
const res = that.typeList.find(item=>item.id === id);
|
||||
return res ? res.label : id
|
||||
}
|
||||
const openDialog = () => {
|
||||
const openDialog = (filter = {}) => {
|
||||
that.queryInfo = {
|
||||
...that.queryInfo,
|
||||
...filter
|
||||
}
|
||||
updateVisible(true);
|
||||
if(that.typeList.length === 0 ){
|
||||
ProductTypeApi.getProductTypePage({
|
||||
pageNo: 1,
|
||||
pageSize: 100
|
||||
pageSize: 100,
|
||||
}).then(res=>{
|
||||
that.typeList = res.list
|
||||
})
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
export const STEP0_FINISH:string = 'step0finish'
|
||||
|
|
@ -36,12 +36,16 @@
|
|||
</el-table-column>
|
||||
<el-table-column prop="deliveryDate" label="交货日期" width="200">
|
||||
<template #default="scope">
|
||||
<el-date-picker
|
||||
|
||||
<el-date-picker v-if="that.isBatch"
|
||||
:disabledDate="(time)=> {
|
||||
return time.getTime() < (Date.now() + 8 * 60 * 60 * 1000); }"
|
||||
v-model="scope.row.deliveryDate"
|
||||
type="datetime"
|
||||
placeholder="选择日期"/>
|
||||
<div v-else>
|
||||
{{that.planDate}}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="orderQty" label="订货数量"/>
|
||||
|
|
@ -52,15 +56,41 @@
|
|||
|
||||
<script lang="ts" setup name="ProductList">
|
||||
// @ts-nocheck
|
||||
import {useEmitt} from "@/hooks/web/useEmitt";
|
||||
import {STEP0_FINISH} from "@/constants/EmitEventName";
|
||||
import {formatDate} from "@/utils/formatTime";
|
||||
|
||||
const emit = defineEmits(['rowClick'])
|
||||
const tableRef = ref();
|
||||
const that = reactive({
|
||||
tableData: [],
|
||||
selectRow: null,
|
||||
isBatch: true,
|
||||
planDate: true,
|
||||
plansenddate: true,
|
||||
filterParam: {
|
||||
brandId: '',
|
||||
},
|
||||
})
|
||||
|
||||
const handleEvent = (data:any) => {
|
||||
console.log("获取过滤条件",data);
|
||||
if(data){
|
||||
that.filterParam.brandId = data.brandId;
|
||||
that.isBatch = data.isBatch;
|
||||
that.plansenddate = data.plansenddate;
|
||||
that.planDate = formatDate(that.plansenddate);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
useEmitt({
|
||||
name: STEP0_FINISH,
|
||||
callback: handleEvent,
|
||||
});
|
||||
const productInfoListRef = ref(null);
|
||||
const addProduct = () => {
|
||||
productInfoListRef.value.openDialog()
|
||||
productInfoListRef.value.openDialog(that.filterParam)
|
||||
}
|
||||
const delProduct = () => {
|
||||
useMessage().confirm('确定删除吗?').then(() => {
|
||||
|
|
@ -86,9 +116,12 @@ const addRow = (row) => {
|
|||
if (!row.deliveryDate) {
|
||||
row.deliveryDate = Date.now() + (24 * 60 * 60 * 1000)
|
||||
}
|
||||
if(!that.isBatch){
|
||||
row.deliveryDate = that.plansenddate;
|
||||
}
|
||||
// @ts-ignore
|
||||
that.tableData.push({
|
||||
key: Math.random().toString(36).substring(2),
|
||||
itemKey: Math.random().toString(36).substring(2),
|
||||
productId: row.id,
|
||||
productCode: row.code,
|
||||
productName: row.name,
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
//@ts-nocheck
|
||||
import ProductList from "./ProductList.vue";
|
||||
import ProductSkuList from "./ProductSkuList.vue";
|
||||
import {useEmitt} from "@/hooks/web/useEmitt";
|
||||
import {STEP0_FINISH} from "@/constants/EmitEventName";
|
||||
|
||||
const skuListRef = ref(null);
|
||||
const listRef = ref(null);
|
||||
|
|
@ -35,6 +37,8 @@ const rowClick = (row) => {
|
|||
//@ts-nocheck
|
||||
skuListRef.value.init(that.selectRow)
|
||||
}
|
||||
|
||||
|
||||
const changeDetails = (tableData)=>{
|
||||
that.selectRow.productSkuList = [];
|
||||
for (let i = 0; i < tableData.length; i++) {
|
||||
|
|
|
|||
|
|
@ -1,264 +1,288 @@
|
|||
<template>
|
||||
<ContentWrap v-if="stepIndex==0">
|
||||
<el-row :gutter="10">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="150px"
|
||||
>
|
||||
<div>
|
||||
<el-card
|
||||
class="box-card"
|
||||
header="基本资料"
|
||||
shadow="never"
|
||||
style="width: 100%; margin-top: 20px">
|
||||
<template #header>
|
||||
<CardTitle title="基本资料"/>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="that.formLoading"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="150px"
|
||||
>
|
||||
<div class="!w-full">
|
||||
<el-collapse v-model="activeNames">
|
||||
<el-collapse-item name="1">
|
||||
<template #title>
|
||||
<CardTitle title="订单信息"/>
|
||||
</template>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="订单号码" prop="orderNo">
|
||||
<el-input v-model="formData.orderNo" disabled="true" placeholder="*** New ***"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="订单状态" prop="orderstatus">
|
||||
<el-input v-model="formData.orderstatus" disabled="true" placeholder="INITIAL"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户名称" prop="username">
|
||||
<el-input v-model="formData.username" disabled="true"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="创建日期 (GMT+8)" prop="bizdate">
|
||||
<el-date-picker
|
||||
v-model="formData.bizdate"
|
||||
disabled="true"
|
||||
prefix-icon=""
|
||||
style="width: 760px"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="客户号" prop="customerId">
|
||||
<el-input v-model="formData.customerId" disabled="true" placeholder=""/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="企业公司" prop="company">
|
||||
<el-input v-model="formData.company" disabled="true" placeholder=""/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="品牌" prop="brandId">
|
||||
<el-select v-model="formData.brandId" filterable placeholder="请选择品牌">
|
||||
<el-option
|
||||
v-for="brand in brandList"
|
||||
:key="brand.id"
|
||||
:label="brand.name"
|
||||
:value="brand.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="要求交货日期" prop="plansenddate">
|
||||
<el-date-picker
|
||||
v-model="formData.plansenddate"
|
||||
:size="size"
|
||||
style="width: 760px"
|
||||
type="date"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系人" prop="contacts">
|
||||
<el-input v-model="formData.contacts" placeholder=""/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="手机" prop="phone">
|
||||
<el-input v-model="formData.phone" placeholder=""/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="电话" prop="tel">
|
||||
<el-input v-model="formData.tel" placeholder=""/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="传真" prop="fax">
|
||||
<el-input v-model="formData.fax" placeholder=""/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同号" prop="contract">
|
||||
<el-input v-model="formData.contractNo" placeholder=""/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="零售商单号" prop="retailerno">
|
||||
<el-input v-model="formData.retailerNo" placeholder=""/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input
|
||||
v-model="formData.remarks"
|
||||
:autosize="{ minRows: 4, maxRows: 6 }"
|
||||
placeholder="请输入备注"
|
||||
type="textarea"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
<el-card header="电子邮件通知" shadow="never" style="width: 100%; margin-top: 20px">
|
||||
<template #header>
|
||||
<CardTitle title="电子邮件通知"/>
|
||||
</template>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="电子邮件" prop="newEmail">
|
||||
<el-input v-model="formData.newEmail" placeholder=""/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div style="margin-left: 30px">
|
||||
<el-button size="Default" @click="onAddEmail">增加</el-button>
|
||||
<el-button size="Default" @click="onDelEmail">删除</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="" prop="">
|
||||
<div style="border: 1px solid #dcdfe6;width:100%;height: 200px;">
|
||||
<el-scrollbar height="200px">
|
||||
<ul style="padding-left: 4px;margin-top: 4px;">
|
||||
<li
|
||||
v-for="(item, index) in formData.newEmails"
|
||||
:key="index"
|
||||
:class="{'selected': selectedIndex === index}"
|
||||
style="list-style-type: none"
|
||||
@click="selectItem(index)">
|
||||
{{ item }}
|
||||
</li>
|
||||
</ul>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
|
||||
<!-- 右上角:账户信息 -->
|
||||
<el-col :span="12" class="detail-info-item" style="padding-left: 0px; margin-top: 20px">
|
||||
<el-card class="h-full" shadow="never">
|
||||
<template #header>
|
||||
<CardTitle title="发票信息"/>
|
||||
</template>
|
||||
<el-card>
|
||||
<div>
|
||||
<el-row>
|
||||
<el-col :span="12" v-if="formData.orderCode">
|
||||
<el-form-item label="订单号码" prop="orderCode">
|
||||
<el-input v-model="formData.orderCode" disabled placeholder="*** New ***"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="formData.orderStatus">
|
||||
<el-form-item label="订单状态" prop="orderStatus">
|
||||
<el-input v-model="formData.orderStatus" disabled placeholder="INITIAL"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12" v-if="formData.username">
|
||||
<el-form-item label="用户名称" prop="username">
|
||||
<el-input v-model="formData.username" disabled/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="formData.bizdate">
|
||||
<el-form-item label="创建日期 (GMT+8)" prop="bizdate">
|
||||
<el-date-picker
|
||||
v-model="formData.bizdate"
|
||||
disabled
|
||||
prefix-icon=""
|
||||
style="width: 760px"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12" v-if="formData.customerId">
|
||||
<el-form-item label="客户号" prop="customerId">
|
||||
<el-input v-model="formData.customerId" disabled placeholder=""/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="formData.company">
|
||||
<el-form-item label="企业公司" prop="company">
|
||||
<el-input v-model="formData.company" disabled placeholder=""/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="发票抬头" prop="invoiceCode">
|
||||
<el-input v-model="formData.invoiceCode" placeholder="请输入发票抬头"/>
|
||||
<el-form-item label="品牌" prop="brandId">
|
||||
<el-select v-model="formData.brandId" filterable placeholder="请选择品牌">
|
||||
<el-option
|
||||
v-for="brand in brandList"
|
||||
:key="brand.id"
|
||||
:label="brand.name"
|
||||
:value="brand.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
|
||||
<el-form-item label="交货日期" v-if="!formData.isBatch">
|
||||
<el-date-picker
|
||||
:disabledDate="(time)=> { return time.getTime() < (Date.now() + 8 * 60 * 60 * 1000); }"
|
||||
v-model="that.tmpFormData.planDate"
|
||||
style="width: 760px"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="datetime"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
|
||||
<el-tooltip
|
||||
class="box-item"
|
||||
effect="dark"
|
||||
content="选择分批交货,允许分别设置产品的交期"
|
||||
placement="top"
|
||||
>
|
||||
<el-checkbox v-model="formData.isBatch">分批交货</el-checkbox>
|
||||
</el-tooltip>
|
||||
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系人" prop="contactName">
|
||||
<el-input
|
||||
clearable
|
||||
:name="`auto$input_so_contactName`"
|
||||
autocomplete="on"
|
||||
v-model="formData.contactName" placeholder="请填写联系人名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="发票名称" prop="invoiceName">
|
||||
<el-input v-model="formData.invoiceName" placeholder="请输入发票名称"/>
|
||||
<el-form-item label="手机" prop="phone">
|
||||
<el-input
|
||||
clearable
|
||||
:name="`auto$input_so_phone`"
|
||||
autocomplete="on"
|
||||
v-model="formData.phone" placeholder=""/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="发票地址" prop="invoiceAddress">
|
||||
<el-input v-model="formData.invoiceAddress" placeholder="请输入发票地址"/>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="电话" prop="tel">
|
||||
<el-input
|
||||
clearable
|
||||
:name="`auto$input_so_tel`"
|
||||
autocomplete="on"
|
||||
v-model="formData.tel" placeholder="请填写固定电话号码"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="发票备注" prop="invoiceRemarks">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="传真" prop="fax">
|
||||
<el-input
|
||||
v-model="formData.invoiceRemarks"
|
||||
clearable
|
||||
:name="`auto$input_so_fax`"
|
||||
autocomplete="on"
|
||||
v-model="formData.fax"
|
||||
placeholder="请填写传真号码"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同号" prop="contractCode">
|
||||
<div class="flex w-full">
|
||||
<el-input
|
||||
clearable
|
||||
v-model="formData.contractCode"
|
||||
placeholder="请填写合同号"/>
|
||||
<el-button type="primary" @click="generateContractCode">生成</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="零售商单号" prop="retailerCode">
|
||||
<el-input
|
||||
clearable
|
||||
:name="`auto$input_so_contractCode`"
|
||||
autocomplete="on"
|
||||
v-model="formData.retailerCode" placeholder="请填写零售商单号"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input
|
||||
v-model="formData.remarks"
|
||||
:autosize="{ minRows: 4, maxRows: 6 }"
|
||||
placeholder="请输入发票备注"
|
||||
placeholder="请输入备注"
|
||||
type="textarea"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<!-- 右上角:账户信息 -->
|
||||
<!-- <el-col :span="12" class="detail-info-item" style="padding-right: 0px; margin-top: 20px">
|
||||
<el-card shadow="never" class="h-full">
|
||||
<template #header>
|
||||
<CardTitle title="送货信息" />
|
||||
</template>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="150px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="订单号码" prop="name">
|
||||
<el-input v-model="formData.name" disabled="true" placeholder="*** New ***" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="订单状态" prop="email">
|
||||
<el-input v-model="formData.email" placeholder="请输入邮箱" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input v-model="formData.remarks" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>-->
|
||||
</div>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
</el-collapse-item>
|
||||
|
||||
<el-collapse-item name="2">
|
||||
<template #title>
|
||||
<CardTitle title="电子邮件通知"/>
|
||||
</template>
|
||||
<el-card shadow="never" style="width: 100%; margin-top: 20px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="电子邮件" prop="inputEmail">
|
||||
<el-input
|
||||
clearable
|
||||
:name="`auto$input_so_inputEmail`"
|
||||
autocomplete="on"
|
||||
v-model="that.tmpFormData.inputEmail"
|
||||
placeholder="填写联系邮箱"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div style="margin-left: 30px">
|
||||
<el-button @click="onAddEmail">增加</el-button>
|
||||
<el-button type="danger" @click="onDelEmail">删除</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="" prop="">
|
||||
<div style="border: 1px solid #dcdfe6;width:100%;height: 200px;">
|
||||
<el-scrollbar height="200px">
|
||||
<ul style="padding-left: 4px;margin-top: 4px;">
|
||||
<li
|
||||
v-for="(item, index) in that.tmpFormData.emailList"
|
||||
:key="index"
|
||||
:class="{'selected': selectedIndex === index}"
|
||||
style="list-style-type: none"
|
||||
@click="selectItem(index)">
|
||||
{{ item }}
|
||||
</li>
|
||||
</ul>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
|
||||
</el-collapse-item>
|
||||
<el-collapse-item name="3">
|
||||
<template #title>
|
||||
<CardTitle title="发票信息"/>
|
||||
</template>
|
||||
<el-card>
|
||||
<el-row>
|
||||
<!-- 右上角:账户信息 -->
|
||||
<el-col :span="12" class="detail-info-item"
|
||||
style="padding-left: 0px; margin-top: 20px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="发票抬头" prop="invoiceCode">
|
||||
<el-input v-model="formData.invoiceCode" placeholder="请输入发票抬头"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="发票名称" prop="invoiceName">
|
||||
<el-input v-model="formData.invoiceName" placeholder="请输入发票名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="发票地址" prop="invoiceAddress">
|
||||
<el-input
|
||||
name="auto$input_so_invoiceAddress"
|
||||
autocomplete="on"
|
||||
v-model="formData.invoiceAddress"
|
||||
placeholder="请输入发票地址"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="发票备注" prop="invoiceRemarks">
|
||||
<el-input
|
||||
v-model="formData.invoiceRemarks"
|
||||
:autosize="{ minRows: 4, maxRows: 6 }"
|
||||
placeholder="请输入发票备注"
|
||||
type="textarea"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-card>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
|
||||
</div>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
|
||||
<div v-show="stepIndex === 1" class="h-full w-full">
|
||||
<ContentWrap>
|
||||
<OrderAddProductStep ref="stepRef" />
|
||||
<OrderAddProductStep ref="stepRef"/>
|
||||
</ContentWrap>
|
||||
</div>
|
||||
|
||||
|
|
@ -266,45 +290,44 @@
|
|||
<el-affix :offset="20" position="bottom">
|
||||
<div style="background-color: #909399; padding: 20px; text-align: right;">
|
||||
<!-- 使用 el-row 和 el-col 来控制布局(虽然在这个简单场景下可能不是必需的) -->
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<!-- 结算按钮 -->
|
||||
<!-- <el-button type="primary">结算</el-button>-->
|
||||
<!-- 下一步按钮 -->
|
||||
<div class="flex justify-end">
|
||||
<div>
|
||||
<el-button
|
||||
v-if="stepIndex >= 1"
|
||||
style="margin-left: 10px;"
|
||||
type="primary"
|
||||
@click="backStep()">上一步
|
||||
</el-button>
|
||||
<el-button v-if="hasLastIndex" style="margin-left: 10px;" type="primary" @click="addNewBill">
|
||||
</div>
|
||||
<div v-if="hasLastIndex">
|
||||
<el-button style="margin-left: 10px;" type="primary" @click="addNewBill">
|
||||
创建
|
||||
</el-button>
|
||||
<el-button v-else style="margin-left: 10px;" type="primary" @click="nextStep()">下一步
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-button style="margin-left: 10px;" type="primary" @click="nextStep()">下一步
|
||||
</el-button>
|
||||
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-affix>
|
||||
</template>
|
||||
|
||||
|
||||
<script lang="ts" setup>
|
||||
|
||||
import {defaultProps} from "@/utils/tree";
|
||||
//@ts-nocheck
|
||||
import * as BrandApi from "@/api/oms/brand";
|
||||
import {CustomerApi, getCustomer} from "@/api/oms/customer";
|
||||
import Demo03CourseList from "@/views/oms/order/createorder/components/Demo03CourseList.vue";
|
||||
import Demo03StudentForm from "@/views/oms/order/createorder/Demo03StudentForm.vue";
|
||||
import {CustomerApi} from "@/api/oms/customer";
|
||||
import {SaleOrderApi} from "@/api/oms/saleorder";
|
||||
|
||||
import OrderAddProductStep from "./components/OrderAddProductStep/index.vue";
|
||||
import {useEmitt} from "@/hooks/web/useEmitt";
|
||||
import {STEP0_FINISH} from "@/constants/EmitEventName";
|
||||
import {formatDate} from "@/utils/formatTime";
|
||||
|
||||
// 计算当前时间之后指定天数的日期
|
||||
const calculateDateAfterDays = (days) => {
|
||||
const now = new Date();
|
||||
now.setDate(now.getDate() + days);
|
||||
// 转换为 'YYYY-MM-DD' 格式
|
||||
return now.toISOString().split('T')[0];
|
||||
return formatDate(new Date(Date.now() + ((24 * 60 * 60 * 1000) * days)));
|
||||
}
|
||||
|
||||
const loading = ref(false) // 列表的加载中
|
||||
|
|
@ -318,50 +341,51 @@ const queryParams = reactive({
|
|||
description: null,
|
||||
createTime: []
|
||||
})
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
/*const data = await Demo03StudentApi.getDemo03StudentPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total*/
|
||||
} finally {
|
||||
loading.value = true
|
||||
}
|
||||
}
|
||||
|
||||
const stepRef = ref(null);
|
||||
const formRef = ref() // 表单 Ref
|
||||
const selectedIndex = ref(-1)
|
||||
const stepIndex = ref(0)
|
||||
|
||||
const emails = ref([])
|
||||
|
||||
const that = reactive({
|
||||
formLoading: false,
|
||||
tmpFormData: {
|
||||
inputEmail: '',
|
||||
emailList: [],
|
||||
planDate: calculateDateAfterDays(7),
|
||||
},
|
||||
})
|
||||
const customerData = ref()
|
||||
|
||||
const formData = ref({
|
||||
name: undefined,
|
||||
email: undefined,
|
||||
contacts: undefined,
|
||||
phone: undefined,
|
||||
invoiceAddress: undefined,
|
||||
areaId: undefined,
|
||||
status: undefined,
|
||||
type: undefined,
|
||||
remarks: undefined,
|
||||
orderNo: undefined,
|
||||
invoiceName: undefined,
|
||||
newEmail: '',
|
||||
newEmails: [],
|
||||
bizdate: new Date().toISOString(),
|
||||
plansenddate: calculateDateAfterDays(7),
|
||||
contactName: '',
|
||||
phone: '18122943211',
|
||||
invoiceAddress: '',
|
||||
orderStatus: '',
|
||||
customerId: '',
|
||||
username: '',
|
||||
company: '',
|
||||
brandId: '',
|
||||
tel: '',
|
||||
fax: '',
|
||||
invoiceName: '',
|
||||
invoiceCode: '',
|
||||
invoiceRemarks: '',
|
||||
contractCode: '',
|
||||
retailerCode: '',
|
||||
isBatch: false, // 分批交货
|
||||
remarks: '',
|
||||
orderCode: '',
|
||||
emails: '',
|
||||
bizdate: undefined,
|
||||
plansenddate: undefined,
|
||||
saleOrderEntry: [],
|
||||
})
|
||||
|
||||
const formRules = reactive({
|
||||
name: [{required: true, message: '名称不能为空', trigger: 'blur'}],
|
||||
contacts: [{required: true, message: '联系人不能为空', trigger: 'blur'}],
|
||||
contactName: [{required: true, message: '联系人不能为空', trigger: 'blur'}],
|
||||
brandId: [{required: true, message: '品牌不能为空', trigger: 'blur'}],
|
||||
contractCode: [{required: true, message: '品牌不能为空', trigger: 'blur'}],
|
||||
phone: [{required: true, message: '联系人手机号不能为空', trigger: 'blur'},
|
||||
{
|
||||
pattern: /^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/,
|
||||
|
|
@ -369,32 +393,29 @@ const formRules = reactive({
|
|||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
email: [
|
||||
{
|
||||
type: 'email',
|
||||
message: '请输入正确的邮箱地址',
|
||||
trigger: ['blur', 'change']
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
})
|
||||
const activeNames = ref(['1', '2', '3'])
|
||||
|
||||
const onAddEmail = () => {
|
||||
debugger;
|
||||
if (formData.value.newEmail.trim() !== '') {
|
||||
formData.value.newEmails.push(formData.value.newEmail);
|
||||
formData.value.newEmail = ''; // 清空输入框
|
||||
if (!that.tmpFormData.inputEmail || that.tmpFormData.inputEmail.trim() === '') {
|
||||
useMessage().warning('请输入邮箱');
|
||||
return;
|
||||
}
|
||||
const tmp = that.tmpFormData.inputEmail.trim();
|
||||
const index = that.tmpFormData.emailList.indexOf(tmp);
|
||||
if (index != -1) {
|
||||
that.tmpFormData.emailList.splice(index, 1);
|
||||
// 重新添加到第一位置
|
||||
that.tmpFormData.emailList.unshift(tmp);
|
||||
} else {
|
||||
that.tmpFormData.emailList.push(tmp);
|
||||
}
|
||||
that.tmpFormData.inputEmail = ''; // 清空输入框
|
||||
}
|
||||
|
||||
const selectItem = async (index: number) => {
|
||||
selectedIndex.value = index;
|
||||
}
|
||||
|
||||
const onDelEmail = () => {
|
||||
if (selectedIndex.value >= 0) {
|
||||
debugger;
|
||||
formData.value.newEmails.splice(selectedIndex.value, 1); // 从数组中移除指定索引的元素
|
||||
that.tmpFormData.emailList.splice(selectedIndex.value, 1); // 从数组中移除指定索引的元素
|
||||
// 如果删除的是选中项,则清空选中项
|
||||
if (selectedIndex.value === selectedIndex.value) {
|
||||
selectedIndex.value = -1;
|
||||
|
|
@ -402,6 +423,15 @@ const onDelEmail = () => {
|
|||
}
|
||||
selectedIndex.value = -1;
|
||||
}
|
||||
const selectItem = async (index: number) => {
|
||||
selectedIndex.value = index;
|
||||
}
|
||||
const generateContractCode = () => {
|
||||
const code = `CT-${Math.floor(Date.now() / 1000) + '-' + Math.random().toString(10).substring(2, 6).padEnd(4, '0')}`;
|
||||
formData.value.contractCode = code;
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
/** 查询列表 */
|
||||
const getCustomer = async () => {
|
||||
|
|
@ -417,20 +447,55 @@ const getCustomer = async () => {
|
|||
const backStep = async () => {
|
||||
stepIndex.value = stepIndex.value - 1;
|
||||
}
|
||||
const {emitter} = useEmitt();
|
||||
const nextStep = async () => {
|
||||
stepIndex.value = stepIndex.value + 1;
|
||||
if (stepIndex.value === 0) {
|
||||
formRef.value.validate().then(() => {
|
||||
stepIndex.value = stepIndex.value + 1;
|
||||
// 数据转换邮箱地址
|
||||
if (that.tmpFormData.emailList) {
|
||||
formData.value.emails = that.tmpFormData.emailList.join(";")
|
||||
}
|
||||
if (!formData.isBatch && that.tmpFormData.planDate) {
|
||||
formData.value.plansenddate = new Date(that.tmpFormData.planDate).getTime()
|
||||
}
|
||||
emitter.emit(STEP0_FINISH, {
|
||||
...formData.value
|
||||
})
|
||||
}).catch(() => {
|
||||
useMessage().warning("请先完善基本信息")
|
||||
})
|
||||
} else {
|
||||
stepIndex.value = stepIndex.value + 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const addNewBill = ()=>{
|
||||
console.log("stepRef.value.getTableData()",stepRef.value.getTableData())
|
||||
const addNewBill = () => {
|
||||
console.log("stepRef.value.getTableData()", stepRef.value.getTableData())
|
||||
// todo 校验
|
||||
const tableData = stepRef.value.getTableData();
|
||||
if (tableData.length === 0) {
|
||||
useMessage().warning("请添加产品")
|
||||
return;
|
||||
}
|
||||
|
||||
formData.value.saleOrderEntry = stepRef.value.getTableData()
|
||||
console.log("提交",formData.value)
|
||||
for (let i = 0; i < tableData.length; i++) {
|
||||
|
||||
}
|
||||
formData.value.saleOrderEntry = tableData
|
||||
console.log("333", formData.value)
|
||||
SaleOrderApi.placeOrder({
|
||||
...formData.value
|
||||
}).then(res => {
|
||||
useMessage().success("下单成功")
|
||||
resFrom();
|
||||
stepIndex.value = 0
|
||||
})
|
||||
}
|
||||
|
||||
const hasLastIndex = computed(()=>{
|
||||
return stepIndex.value >= 1;
|
||||
const hasLastIndex = computed(() => {
|
||||
return stepIndex.value >= 1;
|
||||
})
|
||||
|
||||
/** 初始化 **/
|
||||
|
|
@ -446,7 +511,35 @@ onMounted(async () => {
|
|||
}
|
||||
|
||||
})
|
||||
const resFrom = (init = {}) => {
|
||||
|
||||
formData.value = {
|
||||
contactName: '',
|
||||
phone: '18122943211',
|
||||
invoiceAddress: '',
|
||||
orderStatus: '',
|
||||
customerId: '',
|
||||
username: '',
|
||||
company: '',
|
||||
brandId: '',
|
||||
tel: '',
|
||||
fax: '',
|
||||
invoiceName: '',
|
||||
invoiceCode: '',
|
||||
invoiceRemarks: '',
|
||||
contractCode: '',
|
||||
retailerCode: '',
|
||||
remarks: '',
|
||||
isBatch: false,
|
||||
orderCode: '',
|
||||
emails: '',
|
||||
bizdate: undefined,
|
||||
plansenddate: undefined,
|
||||
saleOrderEntry: [],
|
||||
...init
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue