wx.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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 {
  45. verify
  46. } from '@/api/login.js';
  47. import { getUserInfo } from '@/api/user.js';
  48. export default {
  49. data() {
  50. return {
  51. code: '',
  52. name: '',
  53. image: '',
  54. phone: '',
  55. captcha: '',
  56. countDown: 0, //倒计时
  57. time: '',
  58. upFileLoding:false,
  59. userInfo:{}
  60. };
  61. },
  62. watch: {
  63. // 监听倒计时
  64. countDown(i) {
  65. if (i == 0) {
  66. clearInterval(this.time);
  67. }
  68. }
  69. },
  70. onShow() {
  71. getUserInfo().then((res)=>{
  72. this.userInfo = res.data;
  73. })
  74. },
  75. onLoad() {
  76. pay_list().then(({
  77. data
  78. }) => {
  79. if (data.wx != '') {
  80. this.name = data.wx.name
  81. this.code = data.wx.payment
  82. this.image = data.wx.image
  83. this.phone = data.wx.phone
  84. }
  85. })
  86. },
  87. methods: {
  88. //发送验证码
  89. verification() {
  90. let obj = this;
  91. if (!this.userInfo.phone) {
  92. this.$api.msg('请绑定手机号');
  93. return;
  94. }
  95. // 判断是否在倒计时
  96. if (obj.countDown > 0) {
  97. return false;
  98. } else {
  99. obj.countDown = 60;
  100. obj.time = setInterval(() => {
  101. obj.countDown--;
  102. }, 1000);
  103. //调用验证码接口
  104. verify({
  105. phone: obj.userInfo.phone,
  106. type: ''
  107. })
  108. .then(({
  109. data
  110. }) => {})
  111. .catch(err => {
  112. console.log(err);
  113. });
  114. }
  115. },
  116. uploads() {
  117. const that = this;
  118. if (that.upFileLoding) {
  119. return
  120. }
  121. that.upFileLoding = true;
  122. setTimeout(()=>{
  123. that.upFileLoding = false;
  124. },1000);
  125. upload({
  126. filename: '',
  127. file_name: 'collection/wx/' + that.userInfo.uid
  128. }).then(data => {
  129. that.image = data[0].url;
  130. }).catch((err) => {
  131. console.log(err);
  132. })
  133. },
  134. confirm() {
  135. let obj = this;
  136. if (!obj.name) {
  137. return this.$api.msg('请输入提款人姓名');
  138. }
  139. if (!obj.code) {
  140. return this.$api.msg('请输入微信账号');
  141. }
  142. if (!obj.image) {
  143. return this.$api.msg('请上传微信二维码');
  144. }
  145. if (!obj.phone) {
  146. return this.$api.msg('请输入手机号码');
  147. }
  148. if (!obj.captcha) {
  149. return this.$api.msg('请输入验证码');
  150. }
  151. auction({
  152. type: 1,
  153. name: obj.name,
  154. payment: obj.code,
  155. image: obj.image,
  156. phone: obj.phone,
  157. captcha: obj.captcha,
  158. })
  159. .then(e => {
  160. obj.$api.msg('修改成功');
  161. uni.redirectTo({
  162. url: './collection',
  163. });
  164. })
  165. .catch(e => {
  166. console.log(e);
  167. });
  168. },
  169. }
  170. }
  171. </script>
  172. <style lang="scss">
  173. page,
  174. .content {
  175. height: 100%;
  176. margin: 0;
  177. padding: 0;
  178. }
  179. .box {
  180. margin: 20rpx 0 100rpx 0;
  181. width: 100%;
  182. background: #FFFFFF;
  183. .wx {
  184. border-bottom: #F0F0F0 solid 1rpx;
  185. padding: 20rpx 0 30rpx 0;
  186. display: flex;
  187. text {
  188. width: 150rpx;
  189. margin: 0 30rpx;
  190. }
  191. input {
  192. height: 100rpx;
  193. display: inline-block;
  194. font-size: 28rpx;
  195. font-family: PingFang SC;
  196. font-weight: 400;
  197. color: #999999;
  198. line-height: 100rpx;
  199. }
  200. }
  201. .erweima {
  202. padding: 30rpx 0;
  203. display: flex;
  204. text {
  205. margin: 0 30rpx;
  206. width: 150rpx;
  207. font-size: 30rpx;
  208. font-family: PingFang SC;
  209. font-weight: 400;
  210. color: #333333;
  211. }
  212. .img {
  213. width: 160rpx;
  214. height: 160rpx;
  215. image {
  216. width: 100%;
  217. height: 100%;
  218. }
  219. }
  220. }
  221. }
  222. .button {
  223. margin: 0 auto;
  224. width: 560rpx;
  225. height: 80rpx;
  226. background: #FD3B39;
  227. border-radius: 40rpx;
  228. font-size: 30rpx;
  229. font-family: PingFangSC;
  230. font-weight: 500;
  231. color: #FFFFFF;
  232. line-height: 80rpx;
  233. text-align: center;
  234. }
  235. .uni-input {
  236. text-align: left;
  237. width: 325rpx;
  238. font-size: 28rpx !important;
  239. }
  240. .login_name {
  241. color: #333333;
  242. }
  243. .code {
  244. color: #db292b;
  245. font-size: 23rpx;
  246. border-left: 1px solid #eeeeee;
  247. width: 150rpx;
  248. flex-shrink: 0;
  249. text-align: center;
  250. }
  251. </style>