// packageA/remitVoucher/modules/remitDetail.js
const _Http = getApp().globalData.http
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    detail: {
      type: Object
    }
  },
  options: {
    addGlobalClass: true,
  },
  /**
   * 组件的初始数据
   */
  data: {
    content: {
      nocache: true,
      pageNumber: 1,
      pageTotal: 1,
      total: null
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
    getList(id, init) {
      let content = this.data.content;
      content.sa_paybillid = id;
      if (init) content.pageNumber = 1;
      _Http.basic({
        "id": "20221227092804",
        content
      }).then(res => {
        console.log("打款明细", res)
        if (res.msg != '成功') return wx.showToast({
          title: res.msg,
          icon: "none"
        })
        getCurrentPages()[getCurrentPages().length - 1].setData({
          "detail.accountname": res.data[0].accountname,
          "detail.sa_accountclassid": res.data[0].sa_accountclassid,
          "detail.sa_paybilldetailid": res.data[0].sa_paybilldetailid,
        })
        this.setData({
          list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
          "content.pageNumber": res.pageNumber + 1,
          "content.pageSize": res.pageSize,
          "content.pageTotal": res.pageTotal,
          "content.total": res.total,
          sa_paybillid: id
        })
      })
    }
  }
})