// pages/demo11/index.js
var Nova = getApp().Nova;
Component({
  options: {
    multipleSlots: true,  //在组件定义时的选项中启用多slot支持
  },
  /**
   * 组件的属性列表
   */
  properties: {
    options: null,
  },

  /**
   * 组件的初始数据
   */
  data: {
    column: "",
    button: true,   //购买按钮
    reductionPrice: true, //满减
    inventoryNumber: true,  //库存
    timeData: {},
    List: [
      {
        reductionPrice: 90, //满减
        goodsName: "此处显示商品名称",
        describeName: "此处显示商品描述",
        price: 79.99, //折扣价
        original: 159.99, //原价
        inventoryNumber: 20,//库存
        time: 30 * 60 * 60 * 1000,
        buy: "购买",
      },
    ],
    twoList: [
      {
        reductionPrice: 90, //满减
        goodsName: "此处显示商品名称",
        describeName: "此处显示商品描述",
        price: 79.99, //折扣价
        original: 159.99, //原价
        inventoryNumber: 20,//库存
        time: 0.1 * 60 * 1000,
        buy: "购买",

      },
      {
        reductionPrice: 90, //满减
        goodsName: "此处显示商品名称",
        describeName: "此处显示商品描述",
        price: 79.99, //折扣价
        original: 159.99, //原价
        inventoryNumber: 20,//库存
        time: 0.1 * 60 * 1000,
        buy: "购买",
      }
    ],
    threeList: [
      {
        goodsName: "此处显示商品名称",
        describeName: "此处显示商品描述",
        price: 79.99, //折扣价
        original: 159.99, //原价
        inventoryNumber: 20,//库存
        buy: "购买",

      },
      {
        goodsName: "此处显示商品名称",
        describeName: "此处显示商品描述",
        price: 79.99, //折扣价
        original: 159.99, //原价
        inventoryNumber: 20,//库存
        buy: "购买",
      },
      {
        goodsName: "此处显示商品名称",
        describeName: "此处显示商品描述",
        price: 79.99, //折扣价
        original: 159.99, //原价
        inventoryNumber: 20,//库存
        buy: "购买",
      }
    ],
    fourList: [
      {
        reductionPrice: 90, //满减
        goodsName: "此处显示商品名称",
        describeName: "此处显示商品描述",
        price: 79.99, //折扣价
        original: 159.99, //原价
        inventoryNumber: 20,//库存
        time: 0.1 * 60 * 1000,
        buy: "购买",
      },
    ],
    fiveList: [
      {
        goodsName: "此处显示商品名称",
        describeName: "此处显示商品描述",
        price: 79.99, //折扣价
        original: 159.99, //原价
        inventoryNumber: 20,//库存
        buy: "购买",
      },
      {
        goodsName: "此处显示商品名称",
        describeName: "此处显示商品描述",
        price: 79.99, //折扣价
        original: 159.99, //原价
        inventoryNumber: 20,//库存
        buy: "购买",
      },
      {
        goodsName: "此处显示商品名称",
        describeName: "此处显示商品描述",
        price: 79.99, //折扣价
        original: 159.99, //原价
        inventoryNumber: 20,//库存
        buy: "购买",
      },
      {
        goodsName: "此处显示商品名称",
        describeName: "此处显示商品描述",
        price: 79.99, //折扣价
        original: 159.99, //原价
        inventoryNumber: 20,//库存
        buy: "购买",
      },
      {
        goodsName: "此处显示商品名称",
        describeName: "此处显示商品描述",
        price: 79.99, //折扣价
        original: 159.99, //原价
        inventoryNumber: 20,//库存
        buy: "购买",
      },
    ],

    style: {
      countDown: "white",
      countDownFontSize: 10,
      countDownPadding:"0 5rpx",
      background: "#f6f6f6",
      secondsKillFontSize: 17,
      secondsKillWeight: 700,
      secondsKillColor: "white",
      tiemBackground: "#FF3422",
      describeFontSize: 13,
      describeColor: "#a39799",
      reductionFontSize: 12,
      reductionColor: "red",
      reductionBackground: "#ffecec",
      goodsImg: "https://file-cloud.fmode.cn/nCCirOU5zn/20211225/9r16pe035115.jpg",
      goodsTitleSize: 14,
      goodsTitleWieght: 350,
      oneInventorySizeFont: 13,
      oneInventoryColor: "#a39799",
      discountFontSize: 18,
      discountWeight: 250,
      discountColor: "red",
      originalFontSize: 13,
      originalWeight: 249,
      originalColor: "#c8c9cc",
      //购买按钮
      buyFontSize: 14,
      buyWeight: 500,
      buyColor: "red",

      twoBackground: "#f6f6f6",
      twoSecondsKillFontSize: 12,
      twoSecondsKillWeight: 700,
      twoSecondsKillColor: "white",
      twoTiemBackground: "#FF3422",
      twoDescribeFontSize: 13,
      twoDescribeColor: "#a39799",
      twoReductionPrice: 90,
      twoReductionFontSize: 12,
      twoReductionColor: "red",
      twoReductionBackground: "#ffecec",
      twoDiscountPrice: 159.99,  //折扣价格
      twoOriginalPrice: 79.99,  //原价价格
      twoGoodsImg: "https://file-cloud.fmode.cn/nCCirOU5zn/20211225/9r16pe035115.jpg",
      twoGoodsTitleSize: 15,
      twoGoodsTitleWieght: 300,
      twoInventorySizeFont: 13,
      twoInventoryColor: "#a39799",
      twoDiscountFontSize: 16,
      twoDiscountWeight: 249,
      twoDiscountColor: "red",
      twoOriginalFontSize: 12,
      twoOriginalWeight: 249,
      twoOriginalColor: "#c8c9cc",
      //购买按钮
      twoBuyWidth: 35,
      twoBuyPadding: 3,
      twoBuyFontSize: 12,
      twoBuyWeight: 249,
      twoBuyColor: "red",
      twoBuyBorder: "1rpx solid red",

      threeBackground: "#f6f6f6",
      threeDescribeFontSize: 12,
      threeDescribeColor: "#a39799",
      threeDescribeMarginBottom: 5,
      threeReductionHeight: 17,  //满减高度
      threeReductionPrice: 90.00,
      threeReductionFontSize: 12,
      threeReductionColor: "red",
      threeReductionBackground: "#ffecec",
      threeReductionBorderRadius: 17,
      threeReductionMarginRight: 5,
      threeDiscountPrice: 59.99,  //折扣价格
      threeOriginalPrice: 79.99,  //原价价格
      threeGoodsImg: "https://file-cloud.fmode.cn/nCCirOU5zn/20211225/9r16pe035115.jpg",
      threeGoodsTitleSize: 12,
      threeGoodsTitleWieght: 350,
      threeInventoryNumber: 10, //库存总数量
      threeInventorySizeFont: 12,
      threeInventoryColor: "#a39799",
      threeDiscountFontSize: 14,
      threeDiscountWeight: 249,
      threeDiscountColor: "red",
      threeOriginalFontSize: 10,
      threeOriginalWeight: 249,
      threeOriginalColor: "#c8c9cc",
      //购买按钮
      threeBuyFontSize: 12,
      threeBuyWeight: 249,
      threeBuyColor: "white",
      threeBuyBackground: "#ffa400",
      
      detailsBackground: "#f6f6f6",
      detailSecondsKillFontSize: 12,
      detailSecondsKillWeight: 700,
      detailSecondsKillColor: "white",
      detailsTiemBackground: "#FF3422",
      detailsDescribeFontSize: 12,
      detailsDescribeColor: "#a39799",
      detailsReductionFontSize: 12,
      detailsReductionColor: "red",
      detailsReductionBackground: "#ffecec",
      detailsGoodsImg: "https://file-cloud.fmode.cn/nCCirOU5zn/20211225/9r16pe035115.jpg",
      detailsGoodsTitleSize: 13,
      detailsGoodsTitleWieght: 300,
      detailsInventorySizeFont: 12,
      detailsInventoryColor: "#a39799",
      detailsDiscountFontSize: 16,
      detailsDiscountWeight: 249,
      detailsDiscountColor: "red",
      detailsOriginalFontSize: 12,
      detailsOriginalWeight: 249,
      detailOriginalColor: "#c8c9cc",
      //购买按钮
      detailsBuyFontSize: 12,
      detailsBuyWeight: 249,
      detailsBuyColor: "red",
      
      fiveBackground: "#f6f6f6",
      fiveInventorySizeFont: 12,
      fiveInventoryColor: "#a39799",
      fiveGoodsImg: "https://file-cloud.fmode.cn/nCCirOU5zn/20211225/9r16pe035115.jpg",
      fiveGoodsTitleSize: 14,
      fiveDescribeFontSize: 12,
      fiveDescribeColor: "#a39799",
      fiveDiscountFontSize: 14,
      fiveDiscountWeight: 249,
      fiveDiscountColor: "red",
      fiveGoodsTitleWieght: 350,
      fiveOriginalFontSize: 10,
      fiveOriginalWeight: 249,
      fiveOriginalColor: "#c8c9cc",
      //购买按钮
      fiveBuyBackground: "#ffa400",
      fiveBuyFontSize: 12,
      fiveBuyWeight: 249,
      fiveBuyColor: "white",
    },
  },

  ready: function () {
    // 在组件布局完成后执行，确保options参数中有data信息
    this.loadData()
  },
  lifetimes: {
    attached: function () { }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    onChange(e) {
      this.setData({
        timeData: e.detail,
      });
    },
    async loadData(){
      await Nova.checkComponentsDataProperties(this);
      console.log(this.data.options)
      let list = await Nova.getBlockData(this.data.options.data);
      let { options } = this.data;
      console.log('秒杀', options);
      console.log(list);
      let {
        data,
        column,
        src,
        style,
      } = options
      let { className, filter } = data;
      this.setData({
        list,
        column,
        style,
        className,
        filter
      })
      console.log(this.data.column)
    }
  }
})
