// pages/refundDetail/refundDetail.js
const app = getApp()
const wxService = require('../../utils/wxService')
const utils = require('../../utils/util')
const envInfo = require('../../config/index').envInfo

wxService.page({

  /**
   * 页面的初始数据
   */
  data: {
    showApplyRefundModal:false,
    id:'',
    refundDetail: null
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.hideShareMenu()
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    const { id } = this.options
    if(id) {
      this.setData({
        id
      },()=>{
        this.getRfDetail(id)
      })
    }
  },
  getRfDetail(id) {
    wx.showLoading({
      title: '加载中',
      mask: true
    })
    wxService.post(`/sale/refund/buyer/${id}`).then(res => {
      if (res) {
        const { result, data } = res.data
        if (result == 0) {
          wx.hideLoading()
          this.setData({
            refundDetail: data
          })
        }
      }
    })
  },
  copy(e){
    wx.setClipboardData({
      //准备复制的数据
      data: e.currentTarget.dataset.content,
      success: function (res) {
        wx.showToast({
          title: '复制成功',
          icon:'none'
        });
      }
    });
  },

  //填写物流信息
  tapWriteLogis(){
    console.log('222')
    this.setData({
      showApplyRefundModal: true
    })
  }
})