zfb.vue 5.2 KB

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