cashapply.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import Vue from 'vue'
  2. import lib from 'lib'
  3. let uid = lib.getParam("uid"),token = lib.getParam("token")
  4. export default {
  5. data() {
  6. return {
  7. winHeight : 0,
  8. money : 0,
  9. zfbName : "",
  10. zfbAccount : "",
  11. phone : "",
  12. uid : lib.getParam("uid"),
  13. token : lib.getParam("token"),
  14. applyId : lib.getParam("applyId")
  15. };
  16. },
  17. mounted () {
  18. lib.setTitle("申请提现");
  19. this.winHeight = $(window).height()
  20. this.getApplyWithdraw()
  21. },
  22. methods: {
  23. removeError: function(){
  24. this.isMoneyError = false,this.isNameError = false,this.isAccountError = false,this.isPhoneError = false
  25. },
  26. checkForm : function(){
  27. let moneyReg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
  28. let phoneReg = /^[0-9]{11}$/
  29. if(!moneyReg.test(this.money)) {
  30. lib.showTip("提现金额格式不正确")
  31. return
  32. }
  33. if(!this.zfbName) {
  34. lib.showTip("请输入真实姓名")
  35. return
  36. }
  37. if(!this.zfbAccount) {
  38. lib.showTip("请输入支付宝账号")
  39. return
  40. }
  41. if(!phoneReg.test(this.phone)) {
  42. lib.showTip("联系电话格式不正确")
  43. return
  44. }
  45. this.updateApplyWithdraw()
  46. },
  47. //获取提现信息
  48. getApplyWithdraw : function(){
  49. let self = this
  50. let url = `${lib.apiUrl}/share/getApplyWithdraw.do`
  51. let param = {
  52. channel : "LuciferChannel",
  53. ver : 1,
  54. os : 1,
  55. uid : uid || 1,
  56. token : token || "lucifer_test_token",
  57. applyId : self.applyId
  58. }
  59. $.ajax({
  60. type: "get",
  61. url: url,
  62. data: param,
  63. dataType: "jsonp",
  64. success: function(ret) {
  65. if (ret.code==0) {
  66. let data = ret.data
  67. self.money = data.money/100
  68. self.phone = data.phone
  69. self.zfbAccount = data.zfbAccount
  70. self.zfbName = data.zfbName
  71. } else {
  72. lib.showTip(ret.msg)
  73. }
  74. }
  75. });
  76. },
  77. //更新提现信息
  78. updateApplyWithdraw : function(){
  79. let self = this
  80. let url = `${lib.apiUrl}/share/updateApplyWithdraw.do`
  81. let param = {
  82. channel : "LuciferChannel",
  83. ver : 1,
  84. os : 1,
  85. applyId : self.applyId,
  86. uid : uid || 1,
  87. token : token || "lucifer_test_token",
  88. zfbName : self.zfbName,
  89. zfbAccount : self.zfbAccount,
  90. phone : self.phone
  91. }
  92. $.ajax({
  93. type: "get",
  94. url: url,
  95. data: param,
  96. dataType: "jsonp",
  97. success: function(ret) {
  98. if (ret.code==0) {
  99. lib.showTip("提交成功")
  100. setTimeout(function() {
  101. location.replace(`/?page=answer-cashrecord&uid=${uid}&token=${token}`)
  102. }, 1000);
  103. } else {
  104. lib.showTip(ret.msg)
  105. }
  106. }
  107. });
  108. }
  109. }
  110. };