zfb.vue 5.2 KB

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