const { minutesToTimeEl } = require("../../common");

// packageH/free_of_charge/Components/RecordItem/RecordItem.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    simple: {
      type: Boolean,
      value: false,
    },
    data: {
      type: Object,
      value: null,
    },
  },
  data: {
    showTaskInfo: false,
  },

  lifetimes: {
    ready() {
      let task = this.data.data;
      if (task.has_one_task) {
        task.has_one_task.limit_time_string = minutesToTimeEl(
          task.has_one_task.limit_time
        );
      }
      let showTaskInfo = false;
      if (task.status === 1) {
        if (task.has_one_task.order_id === task.order_id) {
          showTaskInfo = true;
        }
      } else {
        showTaskInfo = true;
      }

      this.setData({
        data: task,
        showTaskInfo,
      });
    },
  },
});
