widthdraw.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. var app = new Vue({
  2. el: '#app',
  3. data: {
  4. submitting: false,
  5. // 详情
  6. info: {},
  7. payType: 1,
  8. // 提交参数
  9. params: {
  10. money: '',
  11. account: '',
  12. realname: '',
  13. mobile: '',
  14. bank: '',
  15. bankname: '',
  16. },
  17. },
  18. created: function () {
  19. this.getInfo();
  20. },
  21. updated: function () {
  22. $(".weui-money").blur(function () {
  23. var money = $.trim($(this).val());
  24. var patt = /^(\d+\.\d{1,2}|\d+)$/gi;
  25. if (!patt.test(money)) {
  26. money = !isNaN(parseFloat(money)) ? moneyFormat(parseFloat(money), 2) : '0.00';
  27. }
  28. $(this).val(money);
  29. })
  30. },
  31. methods: {
  32. // 获取用户信息
  33. getInfo: function () {
  34. var _this = this;
  35. var id = getParam('id');
  36. $.post('/weixin/member/getMemberInfo', {id: id}, function (res) {
  37. if (res.code == 'success') {
  38. _this.info = res.data
  39. } else if (res.code == 'login') {
  40. login(res.data.url);
  41. } else {
  42. $.toast(res.message, 'text');
  43. }
  44. }, "json");
  45. },
  46. // 提交
  47. doSubmit: function () {
  48. var _this = this;
  49. if (_this.submitting) {
  50. return false;
  51. }
  52. if (_this.params.money <= 0 || _this.params.money == null) {
  53. $.toast('请输入提现金额', 'text');
  54. return false;
  55. }
  56. if (_this.params.realname == '' || _this.params.realname == null) {
  57. $.toast('请填写收款人姓名', 'text');
  58. return false;
  59. }
  60. if (_this.params.mobile == '' || _this.params.mobile == null) {
  61. $.toast('请填写收款人电话', 'text');
  62. return false;
  63. }
  64. if (this.payType == 1) {
  65. if (_this.params.account == '' || _this.params.account == null) {
  66. $.toast('请填写收款微信号', 'text');
  67. return false;
  68. }
  69. } else {
  70. if (_this.params.bank == '' || _this.params.bank == null) {
  71. $.toast('请填写开户行', 'text');
  72. return false;
  73. }
  74. if (_this.params.account == '' || _this.params.account == null) {
  75. $.toast('请填写银行卡号', 'text');
  76. return false;
  77. }
  78. if (_this.params.bankname == '' || _this.params.bankname == null) {
  79. $.toast('请填写开户人姓名', 'text');
  80. return false;
  81. }
  82. }
  83. if (confirm('确认申请提现?')) {
  84. $.showLoading('数据提交中...');
  85. _this.params.payType = _this.payType;
  86. $.post('/weixin/member/doWidthdraw', _this.params, function (res) {
  87. $.hideLoading();
  88. if (res.code == 'success') {
  89. $.toast('提现申请成功,请耐心等候审核...');
  90. setTimeout(function () {
  91. _this.params = {
  92. money: '',
  93. account: '',
  94. realname: '',
  95. mobile: '',
  96. bank: '',
  97. bankname: '',
  98. };
  99. _this.getInfo();
  100. }, 500)
  101. } else if (res.code == 'login') {
  102. login(res.data.url);
  103. } else {
  104. $.toast(res.message, 'text');
  105. }
  106. }, 'json');
  107. }
  108. }
  109. }
  110. });