transfer.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <view class="container">
  3. <view class="goback-box" @click="toBack">
  4. <image class="goback" src="../../static/img/fanhui.png" mode=""></image>
  5. </view>
  6. <view class="header">转账</view>
  7. <view class="list-box">
  8. <view class="img">
  9. <image src="../../static/img/zhuanzhang-bg.png" mode=""></image>
  10. </view>
  11. <view class="list flex">
  12. <view class="flex_item list-item">
  13. <image :src="logo"></image>
  14. <view>{{ name }}</view>
  15. </view>
  16. <view class="flex_item list-tpl">
  17. <view class="content" @click="useOutClickSide"><selectss ref="easySelect" :options="moneyTypeList" :value="name" @selectOne="selectOne"></selectss></view>
  18. <image src="../../static/img/jiantou.png"></image>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="from-box">
  23. <view class="from-title">对方账号</view>
  24. <input class="input-box" type="text" v-model="account" placeholder="请输入对方账号" />
  25. <view class="from-title">对方UID</view>
  26. <input class="input-box" type="text" v-model="UUID" placeholder="请输入对方UID" />
  27. <view class="from-title">交易密码</view>
  28. <input class="input-box" type="password" v-model="password" placeholder="请输入交易密码" />
  29. <view class="from-title">转账数量</view>
  30. <view class="flex input-tpl">
  31. <input class="input-box" type="number" v-model="num" placeholder="请输入数量" />
  32. <view class="all" @click="num = money">全部</view>
  33. </view>
  34. <view class="all-num">
  35. 可用
  36. <text>{{ money * 1 }}</text>
  37. {{ name }}
  38. </view>
  39. <view class="submit" @click="transfer">确定</view>
  40. <!-- <view class="tpl-box">转账数量10.0个起,手续费:0.0001FIL。</view> -->
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import { goPay, trade,wallet } from '@/api/finance.js';
  46. import selectss from '@/components/select.vue';
  47. export default {
  48. components: {
  49. selectss
  50. },
  51. data() {
  52. return {
  53. moneyTypeList: [],
  54. logo: '',
  55. name: '',
  56. code: '',
  57. money: '',
  58. account: '',
  59. UUID: '',
  60. num: '',
  61. password: ''
  62. };
  63. },
  64. onLoad(option) {
  65. if (option.name) {
  66. this.name = option.name;
  67. this.logo = option.logo;
  68. this.code = option.code;
  69. }
  70. this.moneyType();
  71. },
  72. onShow() {},
  73. methods: {
  74. // 所有币种
  75. async moneyType() {
  76. let obj = this;
  77. wallet({}).then(({ data }) => {
  78. console.log(data)
  79. obj.moneyTypeList = data;
  80. // if (obj.logo == '') {
  81. // obj.logo = obj.moneyTypeList[0].LOGO;
  82. // obj.name = obj.moneyTypeList[0].name;
  83. // obj.code = obj.moneyTypeList[0].code;
  84. // obj.money = obj.moneyTypeList[0].wallet.money;
  85. // }
  86. const arr = Object.keys(data.back);
  87. console.log(arr);
  88. let ar = [];
  89. arr.forEach(e => {
  90. ar.push(data.back[e]);
  91. });
  92. });
  93. },
  94. transfer() {
  95. let obj = this;
  96. if (obj.code == '') {
  97. obj.$api.msg('请选择币种!');
  98. return;
  99. }
  100. if (obj.account == '') {
  101. obj.$api.msg('请输入对方账号!');
  102. return;
  103. }
  104. if (obj.UUID == '') {
  105. obj.$api.msg('请输入对方UUID!');
  106. return;
  107. }
  108. if (obj.password == '') {
  109. obj.$api.msg('请输入交易密码!');
  110. return;
  111. }
  112. if (obj.num == '') {
  113. obj.$api.msg('请输入转账数量!');
  114. return;
  115. }
  116. goPay({
  117. type: obj.code,
  118. num: obj.num,
  119. to_uid: obj.UUID,
  120. trade_psw: obj.password,
  121. to_user_account: obj.account
  122. }).then(data => {
  123. obj.num = '';
  124. obj.UUID = '';
  125. obj.password = '';
  126. obj.account = '';
  127. obj.$api.msg(data.msg);
  128. });
  129. },
  130. selectOne(options) {
  131. this.logo = options.LOGO;
  132. this.name = options.name;
  133. this.code = options.code;
  134. this.money = options.wallet.money;
  135. },
  136. useOutClickSide() {
  137. this.$refs.easySelect.hideOptions && this.$refs.easySelect.hideOptions();
  138. },
  139. toBack(){
  140. uni.navigateBack({
  141. delta: 1
  142. });
  143. }
  144. }
  145. };
  146. </script>
  147. <style lang="scss">
  148. page {
  149. min-height: 100%;
  150. background-color: #ffffff;
  151. .container {
  152. width: 100%;
  153. }
  154. }
  155. .list-box {
  156. padding: 104rpx 30rpx 60rpx;
  157. height: 350rpx;
  158. .img {
  159. position: absolute;
  160. top: 0;
  161. left: 0;
  162. right: 0;
  163. width: 100%;
  164. height: 440rpx;
  165. image {
  166. width: 100%;
  167. height: 100%;
  168. }
  169. }
  170. .list {
  171. position: relative;
  172. z-index: 10;
  173. background-color: #ffffff;
  174. border-radius: 15rpx;
  175. padding: 15rpx 23rpx;
  176. .list-item {
  177. font-size: 30rpx;
  178. font-weight: bold;
  179. color: #333333;
  180. image {
  181. width: 43rpx;
  182. height: 43rpx;
  183. margin-right: 15rpx;
  184. }
  185. }
  186. .list-tpl {
  187. image {
  188. width: 15rpx;
  189. height: 25rpx;
  190. margin-left: 20rpx;
  191. }
  192. }
  193. }
  194. }
  195. .from-box {
  196. margin: 74rpx 30rpx;
  197. padding: 44rpx 25rpx;
  198. background-color: #ffffff;
  199. border-radius: 15rpx;
  200. position: relative;
  201. top: -180rpx;
  202. .from-title {
  203. font-size: 24rpx;
  204. font-weight: bold;
  205. color: #333333;
  206. }
  207. .input-box {
  208. font-size: 26rpx;
  209. font-weight: 500;
  210. color: #666666;
  211. margin: 35rpx 0rpx;
  212. }
  213. .all {
  214. font-size: 30rpx;
  215. font-weight: 500;
  216. color: #44969d;
  217. }
  218. .all-num {
  219. font-size: 24rpx;
  220. font-weight: bold;
  221. color: #333333;
  222. text {
  223. font-size: 26rpx;
  224. padding: 0rpx 10rpx;
  225. color: #44969d;
  226. }
  227. }
  228. .submit {
  229. background: linear-gradient(90deg, #60BAB0, #60BAB0, #45969B);
  230. margin-top: 160rpx;
  231. color: #ffffff;
  232. text-align: center;
  233. padding: 26rpx 0rpx;
  234. border-radius: 15rpx;
  235. }
  236. .tpl-box {
  237. text-align: left;
  238. font-size: 28rpx;
  239. font-weight: 500;
  240. color: #fb3a2f;
  241. margin-top: 26rpx;
  242. }
  243. }
  244. .goback-box {
  245. position: absolute;
  246. left: 18rpx;
  247. top: 0;
  248. height: 80rpx;
  249. display: flex;
  250. align-items: center;
  251. }
  252. .goback {
  253. z-index: 100;
  254. width: 34rpx;
  255. height: 34rpx;
  256. }
  257. .header {
  258. color: #FFFFFF;
  259. position: absolute;
  260. left: 0;
  261. top: 0;
  262. width: 100%;
  263. height: 80rpx;
  264. font-size: 32rpx;
  265. font-weight: 700;
  266. z-index: 99;
  267. display: flex;
  268. justify-content: center;
  269. align-items: center;
  270. }
  271. </style>