bank.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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. </view>
  34. </template>
  35. <script>
  36. import { auction, pay_list } from '@/api/wallet.js';
  37. import { orderData, getUserInfo } from '@/api/user.js';
  38. import { mapState, mapMutations } from 'vuex';
  39. import { verify } from '@/api/login.js';
  40. export default {
  41. computed: {
  42. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  43. },
  44. data() {
  45. return {
  46. name: '',
  47. id: '',
  48. idName: '',
  49. phone: '',
  50. bankname: '',
  51. countDown:0,//倒计时
  52. code:'',//验证码
  53. time:''
  54. };
  55. },
  56. watch: {
  57. // 监听倒计时
  58. countDown(i) {
  59. if (i == 0) {
  60. clearInterval(this.time);
  61. }
  62. }
  63. },
  64. onLoad() {
  65. pay_list().then(({ data }) => {
  66. if (data.bank != '') {
  67. this.name = data.bank.name;
  68. this.id = data.bank.payment;
  69. this.phone = data.bank.phone;
  70. this.idName = data.bank.bank;
  71. this.bankname = data.bank.bank_name;
  72. }
  73. });
  74. },
  75. methods: {
  76. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  77. //发送验证码
  78. verification() {
  79. let obj = this;
  80. if (!this.userInfo.phone) {
  81. this.$api.msg('请绑定手机号');
  82. return;
  83. }
  84. // 判断是否在倒计时
  85. if (obj.countDown > 0) {
  86. return false;
  87. } else {
  88. obj.countDown = 60;
  89. obj.time = setInterval(() => {
  90. obj.countDown--;
  91. }, 1000);
  92. //调用验证码接口
  93. verify({
  94. phone: obj.userInfo.phone,
  95. type: ''
  96. })
  97. .then(({ data }) => {})
  98. .catch(err => {
  99. console.log(err);
  100. });
  101. }
  102. },
  103. confirm() {
  104. let obj = this;
  105. if (!obj.name) {
  106. return this.$api.msg('请输入提款人姓名');
  107. }
  108. if (!obj.idName) {
  109. return this.$api.msg('请输入所属银行');
  110. }
  111. if (!obj.id) {
  112. return this.$api.msg('请输入银行卡号');
  113. }
  114. // if (!obj.phone) {
  115. // return this.$api.msg('请输入手机号码');
  116. // }
  117. if (!obj.bankname) {
  118. return this.$api.msg('请输入所属支行');
  119. }
  120. // if (!obj.code) {
  121. // return this.$api.msg('请输入验证码');
  122. // }
  123. auction({
  124. type: 3,
  125. name: obj.name,
  126. bank: obj.idName,
  127. payment: obj.id,
  128. phone:obj.userInfo.phone,
  129. bank_name: obj.bankname,
  130. // captcha:obj.code
  131. }).then(e => {
  132. obj.$api.msg('修改成功');
  133. uni.redirectTo({
  134. url: './collection',
  135. });
  136. });
  137. }
  138. }
  139. };
  140. </script>
  141. <style lang="scss">
  142. page,
  143. .content {
  144. height: 100%;
  145. padding: 0;
  146. margin: 0;
  147. }
  148. .top {
  149. border-top: 1rpx solid #f3f3f3;
  150. border-bottom: 1rpx solid #f3f3f3;
  151. }
  152. .box {
  153. background: #ffffff;
  154. margin: 20rpx 0 70rpx 0;
  155. .item {
  156. display: flex;
  157. align-items: center;
  158. text {
  159. margin: 0 40rpx 0 25rpx;
  160. width: 150rpx;
  161. font-size: 30rpx;
  162. font-family: PingFang SC;
  163. font-weight: 400;
  164. color: #333333;
  165. line-height: 100rpx;
  166. }
  167. input {
  168. width: 500rpx;
  169. height: 100rpx;
  170. display: inline-block;
  171. font-size: 28rpx;
  172. font-family: PingFang SC;
  173. font-weight: 400;
  174. color: #999999;
  175. line-height: 100rpx;
  176. }
  177. .uni-input {
  178. text-align: left;
  179. width: 325rpx;
  180. font-size: 28rpx !important;
  181. }
  182. .login_name {
  183. color: #333333;
  184. }
  185. .code {
  186. color: #ECC697 ;
  187. font-size: 23rpx;
  188. border-left: 1px solid #eeeeee;
  189. width: 150rpx;
  190. flex-shrink: 0;
  191. text-align: center;
  192. }
  193. }
  194. }
  195. .button {
  196. text-align: center;
  197. width: 560rpx;
  198. height: 80rpx;
  199. // background: #fd3b39;
  200. background: #ECC697 ;
  201. border-radius: 40rpx;
  202. font-size: 30rpx;
  203. font-family: PingFangSC;
  204. font-weight: 500;
  205. color: #ffffff;
  206. line-height: 80rpx;
  207. margin: 0 auto;
  208. }
  209. </style>