widthdraw.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 if(res.code == 'exception'){
  42. showAlert(res.message);
  43. } else {
  44. $.toast(res.message, 'text');
  45. }
  46. }, "json");
  47. },
  48. // 提交
  49. doSubmit: function () {
  50. var _this = this;
  51. if (_this.submitting) {
  52. return false;
  53. }
  54. if (_this.params.money <= 0 || _this.params.money == null) {
  55. $.toast('请输入提现金额', 'text');
  56. return false;
  57. }
  58. if (_this.params.realname == '' || _this.params.realname == null) {
  59. $.toast('请填写收款人姓名', 'text');
  60. return false;
  61. }
  62. if (_this.params.mobile == '' || _this.params.mobile == null) {
  63. $.toast('请填写收款人电话', 'text');
  64. return false;
  65. }
  66. if (this.payType == 1) {
  67. if (_this.params.account == '' || _this.params.account == null) {
  68. $.toast('请填写收款微信号', 'text');
  69. return false;
  70. }
  71. } else {
  72. if (_this.params.bank == '' || _this.params.bank == null) {
  73. $.toast('请填写开户行', 'text');
  74. return false;
  75. }
  76. if (_this.params.account == '' || _this.params.account == null) {
  77. $.toast('请填写银行卡号', 'text');
  78. return false;
  79. }
  80. if (_this.params.bankname == '' || _this.params.bankname == null) {
  81. $.toast('请填写开户人姓名', 'text');
  82. return false;
  83. }
  84. }
  85. if (confirm('确认申请提现?')) {
  86. $.showLoading('数据提交中...');
  87. _this.params.payType = _this.payType;
  88. $.post('/weixin/member/doWidthdraw', _this.params, function (res) {
  89. $.hideLoading();
  90. if (res.code == 'success') {
  91. $.toast('提现申请成功,请耐心等候审核...');
  92. setTimeout(function () {
  93. _this.params = {
  94. money: '',
  95. account: '',
  96. realname: '',
  97. mobile: '',
  98. bank: '',
  99. bankname: '',
  100. };
  101. _this.getInfo();
  102. }, 500)
  103. } else if (res.code == 'login') {
  104. login(res.data.url);
  105. } else {
  106. $.toast(res.message, 'text');
  107. }
  108. }, 'json');
  109. }
  110. }
  111. }
  112. });