fenxiao_tixian_apply.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. mui.ready(function () {
  2. $.ajax({
  3. type: "post",
  4. url: base_path + "/WithDrawalsLogs/getWithdrawPage",
  5. dataType: "json",
  6. xhrFields: {
  7. withCredentials: true
  8. },
  9. crossDomain: true,
  10. data: {"openid": "oaH_GwHCnG8fZPwI8c4D_SqLmV0Y"},
  11. success: function (res) {
  12. $("#allowMoney").html(accDiv(res.data.amount, 100));
  13. $("#lessMoney").text(accDiv(res.data.lessMoney, 100));
  14. $("#withdrawalsCount").text(res.data.withdrawalsCount);
  15. var Withdraw = res.data.Withdraw;
  16. if (Withdraw) {
  17. $("#userName").val(Withdraw.withDrawalsName);
  18. $("#tel").val(Withdraw.tel);
  19. $("#bankCount").val(Withdraw.accountNo);
  20. $("#bankLocal").val(Withdraw.bankLocal);
  21. }
  22. document.querySelector('.loading-bg').style.display = 'none'
  23. }
  24. })
  25. });
  26. function ajaxSendApply(url, data) {
  27. $.ajax({
  28. url: url, data: data, dataType: "json", asyn: false, success: function (data) {
  29. var obj = eval("(" + data + ")");
  30. mui.alert(data.message)
  31. }, error: function (data) {
  32. mui.alert(data.message)
  33. }
  34. })
  35. };var flag = true;
  36. function submitOrder() {
  37. if (!flag) {
  38. getAlert("正在处理中,请稍等!")
  39. }
  40. var limitMoney = parseInt($("#allowMoney").html());
  41. var data = {
  42. "openid": "",
  43. "withDrawalsName": $.trim($("#userName").val()),
  44. "withDrawalsNum": $("#amount").val() == "" ? 0 : $("#amount").val(),
  45. "tel": $.trim($("#tel").val()),
  46. "accountNo": $.trim($("#bankCount").val()),
  47. "bankLocal": $("#bankLocal").val()
  48. };
  49. if (!checkAddress(data.withDrawalsName)) {
  50. getAlert("用户名为空或者格式不正确");
  51. return
  52. } else if (!(/^1[3|4|5|7|8]\d{9}$/.test(data.tel))) {
  53. mui.alert("手机号码有误,请重填");
  54. return false
  55. } else if (!(/^[1-9]+[0-9]*$/.test(data.withDrawalsNum))) {
  56. getAlert("请输入正确的金额!");
  57. return
  58. } else if (data.withDrawalsNum < 1) {
  59. getAlert("金额不能小于0");
  60. return
  61. } else if (data.withDrawalsNum > limitMoney) {
  62. getAlert("金额超过账户现有金额!");
  63. return
  64. } else if (!(/^\d{15}\d{1,4}$/.test(data.accountNo))) {
  65. mui.alert("请输入正确的银行卡号!");
  66. return
  67. } else if (!checkAddress(data.bankLocal)) {
  68. getAlert("支行地址填写不正确!");
  69. return
  70. }
  71. flag = false;
  72. data.withDrawalsNum = parseInt(data.withDrawalsNum);
  73. $.ajax({
  74. type: "post",
  75. url: base_path + "/WithDrawalsLogs/submitWithdraw",
  76. dataType: "json",
  77. data: data,
  78. xhrFields: {
  79. withCredentials: true
  80. },
  81. crossDomain: true,
  82. success: function (res) {
  83. flag = true;
  84. if (res.status) {
  85. window.location.href = base_path + "/drp/withdrawalssubmitSuccess"
  86. } else {
  87. getAlert("申请失败:" + res.message == "null" ? "" : res.message)
  88. }
  89. }
  90. })
  91. };function goHistoryWithdrawals() {
  92. window.location.href = base_path + "/drp/withdrawalsList"
  93. };function getAlert(message) {
  94. mui.alert(message, '水时代-消息提醒', function () {
  95. })
  96. };