refundInfo.js 3.0 KB
// pages/main/finalpay/refundInfo/refundInfo.js
var app = getApp();
var baseUrl = app.globalData.baseUrl;
Page({

  /**
   * Page initial data
   */
  data: {

  },

  /**
   * Lifecycle function--Called when page load
   */
  onLoad: function(options) {
    this.initOSS()
  },

  /**
   * Lifecycle function--Called when page is initially rendered
   */
  onReady: function() {

  },

  initOSS: function() {
    var that = this
    var Authorization = getApp().globalData.Authorization;
    //OSS 上传前init
    wx.showLoading()
    wx.request({
      url: baseUrl + "filemeta/v1/inits",
      header: {
        'Authorization': Authorization
      },
      method: 'POST',
      data: {
        "access_type": "web_upload",
        "action ": "put_object",
        "instance_id": "",
        "object_type": "wx_image"
      },
      success: function(result) {

        OSSInit = result.data
        console.log(' OSS init 成功', OSSInit)
      },
      fail: function(res) {
        console.log('OSS init  失败', res)
      },
      complete: function() {
        wx.hideLoading()
      }
    })
  },

  /**
   * Lifecycle function--Called when page show
   */
  onShow: function() {

  },

  bindbank: function() {
    var that = this
    wx.chooseImage({
      sourceType: ['camera', 'album'],
      // sizeType: ['original'],
      count: 1,
      success: function(res) {
        console.log('success', res)
        that.ocrBankImage(res.tempFilePaths[0])
      }
    })
  },

  // 识别银行卡照片
  ocrBankImage: function(path) {
    var that = this
    this.Authorization = getApp().globalData.Authorization;
    wx.request({
      url: baseUrl + "common/v1/ocr/bankcards",
      method: "POST",
      header: {
        'Authorization': this.Authorization
      },
      data: {
        "image": path
      },
      success: function(result) {
        console.log("payinfo", result)
        if (result.statusCode == 200) {

        }
      },
    })
  },

  formSubmit: function() {
    // 是否放弃退税,(是:"5",否:"")
    var that = this
    this.Authorization = getApp().globalData.Authorization;
    wx.request({
      url: baseUrl + "payroll/v1/settlement-tax/record",
      header: {
        'Authorization': this.Authorization
      },
      data: {
        'name': '',
        "bank": '',
        "bank_card_no": '',
        "bank_card_province": ''
      },
      success: function(result) {
        console.log("submit", result)
        if (result.statusCode == 200) {
          that.setData({

          })
        }
      },
    })
  },

  /**
   * Lifecycle function--Called when page hide
   */
  onHide: function() {

  },

  /**
   * Lifecycle function--Called when page unload
   */
  onUnload: function() {

  },

  /**
   * Page event handler function--Called when user drop down
   */
  onPullDownRefresh: function() {

  },

  /**
   * Called when page reach bottom
   */
  onReachBottom: function() {

  },

  /**
   * Called when user click on the top right corner to share
   */
  onShareAppMessage: function() {

  }
})