cash.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <!-- 提现 -->
  2. <template>
  3. <view class="page">
  4. <ul class="profile" style="margin-top:0px;" >
  5. <li>账户余额:</li>
  6. <li>
  7. <span style="color:#FF0000">{{user.money}}</span>元
  8. </li>
  9. </ul>
  10. <ul class="profile" >
  11. <li>选择银行:</li>
  12. <li>
  13. <picker @change="bindbankChange" value="0" :range="bank_arr">
  14. <view class="uni-input">{{bank_arr[bankid]}}</view>
  15. </picker>
  16. </li>
  17. </ul>
  18. <ul class="profile" >
  19. <li>提现金额:</li>
  20. <li>
  21. <input type="text" v-model="money" style="width: 100px;display: inline-block;vertical-align: middle;margin-right: 5px;" class="input1" :placeholder="'最低'+system.plat_min+'元'" />元
  22. </li>
  23. </ul>
  24. <ul class="profile" >
  25. <li>资金密码:</li>
  26. <li>
  27. <input type="password" id="password" v-model="pwd" style="width: 150px;" class="input1" placeholder="请输入资金密码" />
  28. </li>
  29. </ul>
  30. <view style="margin:15px auto;display:block;width: 80%;">
  31. <button class="button1" @tap="submit()">申请提现</button>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import http from "../../library/http.js"
  37. export default {
  38. data() {
  39. return {
  40. money: '',
  41. pwd:'',
  42. user: uni.getStorageSync('userInfo'),
  43. system: uni.getStorageSync('system'),
  44. bank: uni.getStorageSync('bank'),
  45. bank_arr:[],
  46. bankid:0,
  47. bank_id:0
  48. }
  49. },
  50. methods: {
  51. bindbankChange(e){
  52. var num= e.target.value;
  53. this.setbanknum(num);
  54. },
  55. setbanknum(num){
  56. this.bankid=num;
  57. var i=0;
  58. for(var ii in this.bank){
  59. if(i==num){
  60. this.bank_id=this.bank[ii].id
  61. }
  62. i++;
  63. }
  64. },
  65. getuserinfo(){
  66. var postdata={
  67. id: uni.getStorageSync('access_token')
  68. };
  69. http.setWait(false).post('user.php?act=userinfo',postdata).then(res=>{
  70. this.user=res.data;
  71. uni.setStorageSync('userInfo',this.user)
  72. })
  73. },
  74. setbank(){
  75. var arr=[];
  76. for(var i=0;i<this.bank.length;i++){
  77. arr.push(this.bank[i]['number']);
  78. }
  79. this.bank_arr=arr;
  80. this.setbanknum(0);
  81. },
  82. getbank(){
  83. this.setbank();
  84. var postdata={
  85. userid: uni.getStorageSync('access_token')
  86. };
  87. http.setWait(false).post('user.php?act=mybank',postdata).then(res=>{
  88. this.bank=res.data;
  89. uni.setStorageSync('bank',this.bank)
  90. this.setbank();
  91. })
  92. },
  93. submit() {
  94. var money=this.money;
  95. if (money == "") {
  96. uni.showToast({
  97. title:'请填写提现金额',
  98. icon:'none'
  99. })
  100. return false;
  101. }
  102. if (isNaN(money)) {
  103. uni.showToast({
  104. title:'提现金额必须为数字',
  105. icon:'none'
  106. })
  107. return false;
  108. }
  109. if (parseFloat(money) - parseFloat(this.system.plat_min) < 0) {
  110. uni.showToast({
  111. title:'每次最少提现'+ this.system.plat_min + '元!',
  112. icon:'none'
  113. })
  114. return false;
  115. }
  116. if (parseFloat(money) - parseFloat(this.user.money) >0) {
  117. uni.showToast({
  118. title:'提现金额不能大于'+ this.user.money+ '元!',
  119. icon:'none'
  120. })
  121. return false;
  122. }
  123. if (parseFloat(money) - parseFloat(this.system.plat_max) >0) {
  124. uni.showToast({
  125. title:'每次最多提现'+ this.system.plat_max+ '元!',
  126. icon:'none'
  127. })
  128. return false;
  129. }
  130. if (this.pwd == "") {
  131. uni.showToast({
  132. title:'请输入资金密码',
  133. icon:'none'
  134. })
  135. return false;
  136. }
  137. if(parseInt(this.pwd)>0 && parseInt(this.pwd)<1000000 && this.pwd.length==6){
  138. }else{
  139. uni.showToast({
  140. title:'资金密码必须为6位数字',
  141. icon:'none'
  142. })
  143. return false;
  144. }
  145. if(this.$action.check_userlock()==false) return false;
  146. http.setWait(true).post('pay.php?act=plat',{money:money,bankid:this.bank_id,pwd:this.pwd,userid:this.user.id}).then(res=>{
  147. this.getuserinfo();
  148. uni.showModal({
  149. title: '提示',
  150. content: "提现已提交,请耐心等待",
  151. showCancel: true,
  152. cancelText: '关闭',
  153. confirmText: '查看账单',
  154. success: res => {
  155. if(res.confirm) {
  156. uni.redirectTo({
  157. url:"/pages/mine/order"
  158. })
  159. }
  160. }
  161. });
  162. })
  163. }
  164. },
  165. onLoad() {
  166. this.getuserinfo();
  167. this.getbank();
  168. }
  169. }
  170. </script>
  171. <style scoped>
  172. @import "@/static/css/user.css";
  173. .page{
  174. background-color: #fafafa;
  175. }
  176. .profile,.login-lines1{
  177. background-color: #fff;
  178. margin: 10px auto;
  179. width: 100%;
  180. vertical-align: middle;
  181. }
  182. .profile li{
  183. vertical-align: middle;
  184. }
  185. .profile li:first-child{
  186. width:120px
  187. }
  188. .profile li:last-child{
  189. width:calc(100% - 130px)
  190. }
  191. .input1{
  192. max-width: 150px;
  193. }
  194. </style>