cashDetail.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. var _request = require('../../../../utils/request.js')
  2. var rid
  3. Page({
  4. data: {
  5. detail: {}
  6. },
  7. onLoad: function (options) {
  8. rid = options.id
  9. this.getRadish()
  10. },
  11. getRadish () {
  12. var that = this
  13. var url = 'v1/user/cash/balance/' + rid
  14. var params = {
  15. }
  16. var success = function (res) {
  17. var data = res.data
  18. that.setData({
  19. detail: data
  20. })
  21. }
  22. _request.$get(url, params, success)
  23. },
  24. confirmMerchantTransfer () {
  25. var that = this
  26. var detail = that.data.detail || {}
  27. if (!detail.can_confirm_transfer || !detail.package_info) {
  28. wx.showToast({
  29. title: '当前提现无需确认收款',
  30. icon: 'none',
  31. duration: 2000
  32. })
  33. return
  34. }
  35. if (!wx.canIUse || !wx.canIUse('requestMerchantTransfer')) {
  36. wx.showToast({
  37. title: '当前微信版本不支持确认收款,请升级微信',
  38. icon: 'none',
  39. duration: 2000
  40. })
  41. return
  42. }
  43. wx.requestMerchantTransfer({
  44. mchId: String(detail.mch_id || ''),
  45. appId: String(detail.app_id || ''),
  46. package: detail.package_info,
  47. success: function () {
  48. wx.showToast({
  49. title: '确认收款已提交',
  50. icon: 'none',
  51. duration: 2000
  52. })
  53. that.getRadish()
  54. },
  55. fail: function (res) {
  56. wx.showToast({
  57. title: (res && res.errMsg) ? res.errMsg : '确认收款失败',
  58. icon: 'none',
  59. duration: 3000
  60. })
  61. }
  62. })
  63. },
  64. onShareAppMessage: function (val) {
  65. return _request.share({
  66. sc: 'xcx_user_radishdetail'
  67. })
  68. }
  69. })