transfer.vue 6.0 KB

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