export class GoodsType {
    //排序
    sort: number
    //标题
    title: string
    //发现全部
    otherAll: string
    //宣传标语
    promotionalSlogans: string
    //商品列表
    goodsList: Array<GoodsInfo>

    constructor(sort: number, title: string, otherAll: string, promotionalSlogans: string, goodsList: Array<GoodsInfo>) {
        this.sort = sort;
        this.title = title;
        this.otherAll = otherAll;
        this.promotionalSlogans = promotionalSlogans;
        this.goodsList = goodsList;
    }
}

export class GoodsInfo {
    id: number
    //图片url
    img: string
    //商品名字
    name: string
    //价格
    price: number
    //原价
    originalPrice: number
    //折扣
    discountPercentage: number


    constructor(id: number, img: string, name: string, price: number, originalPrice: number) {
        this.id = id;
        this.img = img;
        this.name = name;
        this.price = price;
        this.originalPrice = originalPrice;
        this.discountPercentage = Math.floor(price / originalPrice * 100);
    }
}