package com.qs.mp.admin.domain.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.qs.mp.admin.domain.TicketBox;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.Objects;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author zhongcp
 * @Date 2022/3/3
 */
@Data
@ApiModel("盲票组列表出参类")
public class TicketBoxListVO {
  /**
   * 主键
   */
  @ApiModelProperty("盲票组id")
  private String boxId;

  /**
   * 盲票组标题
   */
  @ApiModelProperty("盲票组标题")
  private String title;

  /**
   * 主图url
   */
  @ApiModelProperty("主图Url")
  private String picUrl;

  /**
   * 盲票张数
   */
  @ApiModelProperty("盲票张数")
  private Integer quantity;

  /**
   * 已售盲票张数
   */
  @ApiModelProperty("已售盲票张数")
  private Integer saleQty;

  /**
   * 盲票包原价
   */
  @ApiModelProperty("盲票包原价")
  private Integer pkgPrice;

  /**
   * 盲票包售价
   */
  @ApiModelProperty("盲票包售价")
  private Integer pkgSalePrice;

  /**
   * 每包盲票张数
   */
  @ApiModelProperty("每包盲票张数")
  private Integer pkgUnit;

  /**
   * 盲票包数
   */
  @ApiModelProperty("盲票包数")
  private Integer pkgQty;

  /**
   * 已销售包数
   */
  @ApiModelProperty("已销售包数")
  private Integer salePkgQty;

  /**
   * 盲票票面价格
   */
  @ApiModelProperty("盲票票面价格")
  private Integer facePrice;

  @ApiModelProperty("盲票原价")
  private Integer originPrice;

  /**
   * 盲票销售价格
   */
  @ApiModelProperty("盲票销售价格")
  private Integer salePrice;

  @ApiModelProperty("盲票预购价")
  private Integer prePrice;

  @ApiModelProperty("盲票包预购价")
  private Integer pkgPrePrice;

  /**
   * 分佣的销售额百分比
   */
  @ApiModelProperty("分佣的销售额百分比")
  private BigDecimal saleCommRate;

  /**
   * 规格属性
   */
  @ApiModelProperty("规格属性")
  private String properties;

  /**
   * 上架时间
   */
  @ApiModelProperty("上架时间")
  private Date onTime;

  @ApiModelProperty("经销商分佣百分比")
  private BigDecimal channelCommRate;

  @ApiModelProperty("分佣金额")
  public Integer getSaleCommPrice() {
    if (Objects.isNull(this.saleCommRate) || Objects.isNull(this.salePrice) || Objects.isNull(this.channelCommRate)) {
      return 0;
    }
    return BigDecimal.valueOf(this.salePrice).multiply(this.saleCommRate).multiply(this.channelCommRate).divide(BigDecimal.valueOf(10000), 0).intValue();
  }
}
