// components/orderItemInfo/orderItemInfo.js
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    order:{
      type:Object,
      value:{
        nozzle:5,
        status:'已授权',
        statusColor:'#a6d53f',
        oilName:'92#汽油',
        volume:30,
        amount:224.7,
        payAmount:209.4,
        discount:15.3,
        orderId:'20251111111111',
        time:'2025-01-20 18:33'
      }
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    contentHeight: 10,
    isHide:false,
    rotateDeg:0
  },

  /**
   * 组件的方法列表
   */
  methods: {
    showOrHide(){
      
      const height = this.data.isHide?10:23;
      console.log("点击了",this.data.isHide,height)
      
      this.setData({
        contentHeight:height,
        isHide:!this.data.isHide,
        rotateDeg:this.data.rotateDeg+180
      })
    },

    //第一个按钮的点击事件
    buttonClick1(){
      this.triggerEvent('bottonEvent1',{
        order:this.properties.order,
        event:3 //第一个按钮只会传递取消订单
      })
    },
    //第二个按钮的点击事件
    buttonClick2(){
      /**第二个按钮会是去支付:1和去授权:2两种
       * 当当前订单状态为未支付或者支付失败时,第二个按钮点击就是去支付,event 传递1
       * 当当前订单状态为已失效时,第二个按钮点击就是去重新授权,event 传递2
       */
      var sendEvent = 1;
      if(this.properties.order.status == "已失效") sendEvent = 2
      this.triggerEvent('bottonEvent2',{
        order:this.properties.order,
        event:sendEvent
      })
    },
  }
})