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