bind-alipay.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view class="body">
  3. <view class="header-bg">
  4. </view>
  5. <view class="header">
  6. <view class="title">
  7. 绑定支付宝
  8. </view>
  9. </view>
  10. <view class="main">
  11. <view class="input-item inline-form">
  12. <label class="label" for="">姓名</label>
  13. <input class="input" type="text" placeholder="输入支付宝收款人姓名">
  14. </view>
  15. <view class="input-item inline-form">
  16. <label class="label" for="">支付宝号</label>
  17. <input class="input" type="text" placeholder="支付宝账户">
  18. </view>
  19. <view class="input-item inline-form">
  20. <label class="label" for="">手机号码</label>
  21. <input class="input" type="text" placeholder="" v-model="form.mobile" disabled="true">
  22. <button class="send-vcode" @tap="sendSms()"
  23. :disabled="!sendable">{{sendable?'获取验证码':countdown+'秒'}}</button>
  24. </view>
  25. <view class="input-item inline-form">
  26. <label class="label" for="">验证码</label>
  27. <input class="input" type="text" placeholder="请输入验证码">
  28. </view>
  29. </view>
  30. <view class="submit-btn-wrapper">
  31. <button class="btn submit-btn" type="default">确认修改</button>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. let timeInterval = null;
  37. const time = 120;
  38. export default {
  39. data() {
  40. return {
  41. sendable: true,
  42. countdown: time,
  43. form: {
  44. mobile: ""
  45. }
  46. }
  47. },
  48. onLoad() {
  49. this.form.mobile = this.$store.state.user.mobile
  50. },
  51. methods: {
  52. sendSms() {
  53. if (this.sendable && this.$verified.mobile(this.form.mobile)) {
  54. this.sendable = false;
  55. this.$http.get({
  56. url: '/sms/send',
  57. data: {
  58. mobile: this.form.mobile,
  59. event: "bind-alipay"
  60. },
  61. success: (res) => {
  62. uni.showToast({
  63. title: res.data.msg,
  64. icon: "none"
  65. })
  66. timeInterval = setInterval(() => {
  67. if (this.countdown-- === 0) {
  68. clearInterval(timeInterval)
  69. this.countdown = time;
  70. this.sendable = true;
  71. }
  72. }, 1000)
  73. },
  74. fail: () => {
  75. this.sendable = true;
  76. }
  77. })
  78. }
  79. },
  80. submit(){
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. .body {
  87. position: relative;
  88. overflow: hidden;
  89. }
  90. .header-bg {
  91. background: $primary-color;
  92. height: 100upx;
  93. position: absolute;
  94. top: 0;
  95. width: 100%;
  96. }
  97. .header {
  98. margin: 20upx;
  99. background: white;
  100. text-align: center;
  101. border-radius: 20upx;
  102. position: relative;
  103. z-index: 1;
  104. .title {
  105. height: 100upx;
  106. font-size: 32upx;
  107. line-height: 100upx;
  108. // font-weight: bold;
  109. }
  110. }
  111. .main {
  112. margin: 20upx;
  113. background: white;
  114. border-radius: 10upx;
  115. }
  116. .input-item.inline-form {
  117. display: flex;
  118. align-items: center;
  119. height: 80upx;
  120. font-size: 28upx;
  121. padding: 0 20upx;
  122. position: relative;
  123. color: #999999;
  124. .label {
  125. width: 160upx;
  126. // flex: 1 1 160upx;
  127. }
  128. .input {
  129. flex-grow: 1;
  130. font-size: 28upx;
  131. }
  132. }
  133. .send-vcode {
  134. background: $primary-color;
  135. color: white;
  136. font-size: 24upx;
  137. position: absolute;
  138. padding: 5upx 0;
  139. width: 160upx;
  140. line-height: normal;
  141. right: 0upx;
  142. top: 20upx;
  143. }
  144. .submit-btn-wrapper {
  145. margin-top: 80upx;
  146. .submit-btn {
  147. font-size: 30upx;
  148. line-height: 60upx;
  149. width: 250upx;
  150. background: $primary-color;
  151. color: white;
  152. }
  153. }
  154. </style>