bank.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <view class="content">
  3. <view class="box">
  4. <view class="item ">
  5. <text>姓名</text>
  6. <input type="text" v-model="name" value="" placeholder="请输入真实姓名" />
  7. </view>
  8. <view class="item top">
  9. <text>银行卡号</text>
  10. <input type="text" v-model="id" value="" placeholder="请输入银行卡账号" />
  11. </view>
  12. <view class="item top">
  13. <text>所属银行</text>
  14. <input type="text" v-model="idName" value="" placeholder="请输入银行" />
  15. </view>
  16. <view class="item top">
  17. <text>所属支行</text>
  18. <input type="text" v-model="bankname" value="" placeholder="请输入所属支行" />
  19. </view>
  20. <!-- <view class="item top">
  21. <text>手机号</text>
  22. <input type="text" v-model="phone" value="" placeholder="请输入手机号" />
  23. </view> -->
  24. <view class="item">
  25. <text>验证码</text>
  26. <view class="login_name flex">
  27. <input class="uni-input" v-model="code" focus placeholder="请输入验证码" />
  28. <view class="code" @click="verification">{{ countDown == 0 ? '验证码' : countDown }}</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="button" @click="confirm()">确认</view>
  33. <codeImage @openCode='getCode' loginType="" @close='showAlert=false' :phone="userInfo.phone" ref="alertImage" :show='showAlert'></codeImage>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. auction,
  39. pay_list
  40. } from '@/api/wallet.js';
  41. import {
  42. getUserInfo
  43. } from '@/api/user.js';
  44. import codeImage from '@/components/codeImage.vue';
  45. export default {
  46. data() {
  47. return {
  48. name: '',
  49. id: '',
  50. idName: '',
  51. phone: '',
  52. bankname: '',
  53. countDown: 0, //倒计时
  54. code: '', //验证码
  55. time: '',
  56. showAlert:false,
  57. userInfo:{}
  58. };
  59. },
  60. components: {
  61. codeImage
  62. },
  63. watch: {
  64. // 监听倒计时
  65. countDown(i) {
  66. if (i == 0) {
  67. clearInterval(this.time);
  68. }
  69. }
  70. },
  71. onLoad() {
  72. pay_list().then(({
  73. data
  74. }) => {
  75. if (data.bank != '') {
  76. this.name = data.bank.name;
  77. this.id = data.bank.payment;
  78. // this.phone = data.bank.phone;
  79. this.idName = data.bank.bank;
  80. this.bankname = data.bank.bank_name;
  81. }
  82. });
  83. },
  84. onShow() {
  85. getUserInfo().then((res) => {
  86. this.userInfo = res.data;
  87. })
  88. },
  89. methods: {
  90. close() {
  91. console.log('end')
  92. this.showAlert = false;
  93. },
  94. // 发送验证码
  95. getCode() {
  96. const obj = this;
  97. obj.countDown = 60;
  98. obj.time = setInterval(() => {
  99. obj.countDown--;
  100. }, 1000);
  101. //调用验证码接口
  102. },
  103. //发送验证码
  104. verification() {
  105. let obj = this;
  106. if (!this.userInfo.phone) {
  107. this.$api.msg('请绑定手机号');
  108. return;
  109. }
  110. // 判断是否在倒计时
  111. if (obj.countDown > 0) {
  112. return false;
  113. } else {
  114. obj.showAlert = true;
  115. obj.$refs.alertImage.getImage()
  116. }
  117. },
  118. confirm() {
  119. let obj = this;
  120. if (!obj.name) {
  121. return this.$api.msg('请输入提款人姓名');
  122. }
  123. if (!obj.idName) {
  124. return this.$api.msg('请输入所属银行');
  125. }
  126. if (!obj.id) {
  127. return this.$api.msg('请输入银行卡号');
  128. }
  129. // if (!obj.phone) {
  130. // return this.$api.msg('请输入手机号码');
  131. // }
  132. if (!obj.bankname) {
  133. return this.$api.msg('请输入所属支行');
  134. }
  135. if (!obj.code) {
  136. return this.$api.msg('请输入验证码');
  137. }
  138. auction({
  139. type: 3,
  140. name: obj.name,
  141. bank: obj.idName,
  142. payment: obj.id,
  143. phone: obj.userInfo.phone,
  144. bank_name: obj.bankname,
  145. captcha: obj.code
  146. }).then(e => {
  147. obj.$api.msg('修改成功');
  148. uni.redirectTo({
  149. url: './collection',
  150. });
  151. });
  152. }
  153. }
  154. };
  155. </script>
  156. <style lang="scss">
  157. page,
  158. .content {
  159. height: 100%;
  160. padding: 0;
  161. margin: 0;
  162. }
  163. .top {
  164. border-top: 1rpx solid #f3f3f3;
  165. border-bottom: 1rpx solid #f3f3f3;
  166. }
  167. .box {
  168. background: #ffffff;
  169. margin: 20rpx 0 70rpx 0;
  170. .item {
  171. display: flex;
  172. align-items: center;
  173. text {
  174. margin: 0 40rpx 0 25rpx;
  175. width: 150rpx;
  176. font-size: 30rpx;
  177. font-family: PingFang SC;
  178. font-weight: 400;
  179. color: #333333;
  180. line-height: 100rpx;
  181. }
  182. input {
  183. width: 500rpx;
  184. height: 100rpx;
  185. display: inline-block;
  186. font-size: 28rpx;
  187. font-family: PingFang SC;
  188. font-weight: 400;
  189. color: #999999;
  190. line-height: 100rpx;
  191. }
  192. .uni-input {
  193. text-align: left;
  194. width: 325rpx;
  195. font-size: 28rpx !important;
  196. }
  197. .login_name {
  198. color: #333333;
  199. }
  200. .code {
  201. color: #db292b;
  202. font-size: 23rpx;
  203. border-left: 1px solid #eeeeee;
  204. width: 150rpx;
  205. flex-shrink: 0;
  206. text-align: center;
  207. }
  208. }
  209. }
  210. .button {
  211. text-align: center;
  212. width: 560rpx;
  213. height: 80rpx;
  214. background: #fd3b39;
  215. border-radius: 40rpx;
  216. font-size: 30rpx;
  217. font-family: PingFangSC;
  218. font-weight: 500;
  219. color: #ffffff;
  220. line-height: 80rpx;
  221. margin: 0 auto;
  222. }
  223. </style>