wx.vue 4.6 KB

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