zfb.vue 4.9 KB

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