wx.vue 4.9 KB

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