const Http = require("../../utils/HttpBasics");
var config = require("../../config/config.js");
const util = require("../../utils/util.js");
var app = getApp();
const navigationBarHeight = (getApp().statusBarHeight + 50) + 'px'
Page({
  data: {
    navigationBarHeight,
    id: "",
    obj: null
  },
  getRefunData() {
    Http.get({
      url: config.api.getRefund,
      data: {
        orderId: this.data.id,
        mallTenantId: this.data.mallTenantId || ''
      }
    }).then(res => {
      let temp = res.data
      temp.createTime = util.formatTime(temp.createTime, "yyyy-MM-dd hh:mm:ss");
      this.setData({
        obj: temp
      })
    }).catch(err => {
      tt.showToast({
        title: err.message ? err.message : err.data, // 内容
        icon: "none"
      });
    })
  },
  copyId() {
    let id = this.data.obj.id
    tt.setClipboardData({
      data: id,
      success: function () {
        tt.showToast({
          title: '复制成功',
          icon: "none"
        })
      }
    })
  },
  onLoad: function (options) {
    console.log(options.id);
    this.setData({
      id: options.id,
      mallTenantId: options.mallTenantId,
    })
    this.getRefunData()
  }
})