out.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. import * as API from '@/apis/merchant.js'
  2. export default {
  3. data() {
  4. return {
  5. txbool:false,
  6. txAmount:'',
  7. myAccount:{
  8. account:{}
  9. },
  10. }
  11. },
  12. methods: {
  13. myerror(){
  14. this.$refs.common.alert("每周"+this.showday(this.myAccount.date)+"可申请将账户内资金提现至银行卡;");
  15. },
  16. myerror2(){
  17. this.$refs.common.alert("请输入提现金额");
  18. },
  19. showday(num){
  20. if(num==1){
  21. return "一"
  22. }
  23. if(num==2){
  24. return "二"
  25. }
  26. if(num==3){
  27. return "三"
  28. }
  29. if(num==4){
  30. return "四"
  31. }
  32. if(num==5){
  33. return "五"
  34. }
  35. if(num==6){
  36. return "六"
  37. }
  38. if(num==7){
  39. return "日"
  40. }
  41. return ""
  42. },
  43. show(num){
  44. if(num){
  45. var i =num.length
  46. return num.substring(i-4);
  47. }
  48. return ""
  49. },
  50. gotoTx(){
  51. if(!this.myAccount.account.bankNumber){
  52. this.$refs.common.alert("请联系管理员绑定银行卡");
  53. return "";
  54. }
  55. uni.navigateTo({
  56. url:"/pages/wallet/out"
  57. })
  58. },
  59. getWithdrawalSubmit(){
  60. if(!this.txAmount){
  61. this.$refs.common.alert("请填写金额");
  62. return
  63. }
  64. if(this.txAmount==0){
  65. this.$refs.common.alert("请填写金额");
  66. return
  67. }
  68. this.$refs.common.showLoading()
  69. API.withdrawalSubmit(this.txAmount).then(response => {
  70. //this.myAccount=response.data
  71. if(response.code=="200"){
  72. uni.redirectTo({
  73. url:"/pages/wallet/success?number="+this.txAmount
  74. })
  75. }else{
  76. this.$refs.common.showLoading(false,response.message);
  77. }
  78. }).catch(error => {
  79. this.$refs.common.showLoading(false,error);
  80. })
  81. },
  82. getMyAccount(){
  83. this.$refs.common.showLoading()
  84. API.myAccount().then(response => {
  85. this.myAccount=response.data
  86. var d=new Date();
  87. var week=d.getDay();
  88. if(this.myAccount.date==week){
  89. this.txbool=true;
  90. }
  91. if(this.myAccount.date==7&&week==0){
  92. this.txbool=true;
  93. }
  94. this.$refs.common.showLoading(false);
  95. }).catch(error => {
  96. this.$refs.common.showLoading(false,error);
  97. })
  98. }
  99. },
  100. mounted() {
  101. // document.body.style.backgroundColor = '#eee';
  102. },
  103. destroyed() {
  104. //document.body.style.backgroundColor = '';
  105. },
  106. onLoad(temp) {
  107. },onReady(){
  108. this.getMyAccount();
  109. }
  110. }