wx.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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. uni.showLoading({
  110. title: '上传中...',
  111. mask: true
  112. });
  113. upload({
  114. filename: ''
  115. }).then(data => {
  116. uni.hideLoading()
  117. this.image = data[0].url;
  118. }).catch(()=>{
  119. uni.hideLoading();
  120. });
  121. },
  122. confirm() {
  123. let obj = this;
  124. if (!obj.name) {
  125. return this.$api.msg('请输入提款人姓名');
  126. }
  127. if (!obj.code) {
  128. return this.$api.msg('请输入微信账号');
  129. }
  130. if (!obj.image) {
  131. return this.$api.msg('请上传微信二维码');
  132. }
  133. if (!obj.phone) {
  134. return this.$api.msg('请输入手机号码');
  135. }
  136. if (!obj.captcha) {
  137. return this.$api.msg('请输入验证码');
  138. }
  139. auction({
  140. type: 1,
  141. name: obj.name,
  142. payment: obj.code,
  143. image: obj.image,
  144. phone: obj.phone,
  145. captcha:obj.captcha,
  146. })
  147. .then(e => {
  148. obj.$api.msg('修改成功');
  149. })
  150. .catch(e => {
  151. console.log(e);
  152. });
  153. },
  154. }
  155. }
  156. </script>
  157. <style lang="scss">
  158. page,
  159. .content {
  160. height: 100%;
  161. margin: 0;
  162. padding: 0;
  163. }
  164. .box {
  165. margin: 20rpx 0 100rpx 0;
  166. width: 100%;
  167. background: #FFFFFF;
  168. .wx {
  169. border-bottom: #F0F0F0 solid 1rpx;
  170. padding: 20rpx 0 30rpx 0;
  171. display: flex;
  172. text {
  173. width: 150rpx;
  174. margin: 0 30rpx;
  175. }
  176. input {
  177. height: 100rpx;
  178. display: inline-block;
  179. font-size: 28rpx;
  180. font-family: PingFang SC;
  181. font-weight: 400;
  182. color: #999999;
  183. line-height: 100rpx;
  184. }
  185. }
  186. .erweima {
  187. padding: 30rpx 0;
  188. display: flex;
  189. text {
  190. margin: 0 30rpx;
  191. width: 150rpx;
  192. font-size: 30rpx;
  193. font-family: PingFang SC;
  194. font-weight: 400;
  195. color: #333333;
  196. }
  197. .img {
  198. width: 160rpx;
  199. height: 160rpx;
  200. image {
  201. width: 100%;
  202. height: 100%;
  203. }
  204. }
  205. }
  206. }
  207. .button {
  208. margin: 0 auto;
  209. width: 560rpx;
  210. height: 80rpx;
  211. background: #FD3B39;
  212. border-radius: 40rpx;
  213. font-size: 30rpx;
  214. font-family: PingFangSC;
  215. font-weight: 500;
  216. color: #FFFFFF;
  217. line-height: 80rpx;
  218. text-align: center;
  219. }
  220. .uni-input {
  221. text-align: left;
  222. width: 325rpx;
  223. font-size: 28rpx !important;
  224. }
  225. .login_name {
  226. color: #333333;
  227. }
  228. .code {
  229. color: #db292b;
  230. font-size: 23rpx;
  231. border-left: 1px solid #eeeeee;
  232. width: 150rpx;
  233. flex-shrink: 0;
  234. text-align: center;
  235. }
  236. </style>