wallet.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="flex">
  5. <view class="buttom">
  6. <view class="icon">{{ money | getMoneyStyle }}</view>
  7. <text class="text">可转数量</text>
  8. </view>
  9. </view>
  10. </view>
  11. <view class="row-box">
  12. <view class="title">收款人账户</view>
  13. <view class="row"><input class="input" type="number" v-model="card" placeholder="请输入收款人账户" placeholder-class="placeholder" /></view>
  14. </view>
  15. <!-- <view class="row-box">
  16. <view class="title">交易密码</view>
  17. <view class="row"><input class="input" type="password" v-model="password" placeholder="请输入交易密码" placeholder-class="placeholder" /></view>
  18. </view> -->
  19. <view class="row-box">
  20. <view class="title">转账金额</view>
  21. <view class="row">
  22. <!-- <text class="tit">¥</text> -->
  23. <input class="input" type="number" v-model="withdrawal" placeholder="转入金额" placeholder-class="placeholder" />
  24. <view class="buttom" @click="withdrawal = money">全部转账</view>
  25. </view>
  26. </view>
  27. <button class="add-btn up" :class="{ action: loding }" @click="!loding ? confirm() : ''">提交</button>
  28. </view>
  29. </template>
  30. <script>
  31. import { getMoneyStyle } from '@/utils/rocessor.js';
  32. import { getUserInfo, transfer_accounts } from '@/api/user.js';
  33. import { mapMutations, mapState } from 'vuex';
  34. export default {
  35. filters: {
  36. getMoneyStyle
  37. },
  38. data() {
  39. return {
  40. money: '0.00', //可转账金额
  41. withdrawal: '', //转账金额
  42. password: '', //支付密码
  43. card: '', //转账卡号
  44. name: '',
  45. // #ifdef H5
  46. weichatBsrowser: false,
  47. // #endif
  48. loding: false,
  49. type: ''
  50. };
  51. },
  52. onLoad(options) {
  53. // #ifdef H5
  54. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  55. // #endif
  56. this.type = options.type;
  57. this.dataUp();
  58. },
  59. computed: {
  60. ...mapState('user', ['userInfo'])
  61. },
  62. methods: {
  63. ...mapMutations('user', ['setUserInfo', 'login']),
  64. // 更新数据
  65. dataUp() {
  66. let obj = this;
  67. getUserInfo({})
  68. .then(e => {
  69. // 保存返回用户数据
  70. obj.setUserInfo(e.data);
  71. this.money = this.userInfo.brokerage_price;
  72. })
  73. .catch(e => {
  74. console.log(e);
  75. });
  76. },
  77. // 切换选中对象
  78. tabRadio(e) {
  79. this.type = e.detail.value;
  80. },
  81. // 提交
  82. confirm() {
  83. let obj = this;
  84. if (obj.loding) {
  85. return;
  86. }
  87. if (!obj.card) {
  88. return obj.$api.msg('请输入转入人的账户');
  89. }
  90. if (obj.withdrawal <= 0) {
  91. return obj.$api.msg('请输入转入数量');
  92. }
  93. obj.loding = true;
  94. let data = {
  95. other_uid: obj.card, //编号
  96. TransferMoney: obj.withdrawal, //金额
  97. uid: obj.userInfo.uid
  98. };
  99. transfer_accounts(data)
  100. .then(e => {
  101. // 允许按钮点击
  102. obj.loding = false;
  103. // 初始化提现金额
  104. obj.withdrawal = '';
  105. uni.showToast({
  106. title: '转账成功',
  107. duration: 2000,
  108. position: 'top'
  109. });
  110. obj.dataUp();
  111. })
  112. .catch(e => {
  113. obj.$api.msg(e.msg);
  114. obj.loding = false;
  115. });
  116. }
  117. }
  118. };
  119. </script>
  120. <style lang="scss">
  121. page {
  122. height: 100%;
  123. }
  124. .content-money {
  125. padding: 30rpx 0;
  126. background: #ffffff;
  127. }
  128. .item {
  129. padding: 0 $page-row-spacing;
  130. background-color: #ffffff;
  131. }
  132. .flex {
  133. background-color: #ffffff;
  134. text-align: center;
  135. margin: 0 30rpx;
  136. border-radius: $border-radius-sm;
  137. justify-content: center;
  138. .buttom {
  139. font-size: $font-lg;
  140. width: 50%;
  141. }
  142. .interval {
  143. width: 2px;
  144. height: 60rpx;
  145. background-color: #eeeeee;
  146. }
  147. .icon {
  148. background-size: 100%;
  149. font-size: 42rpx;
  150. color: $font-color-dark;
  151. font-weight: bold;
  152. background-repeat: no-repeat;
  153. background-position: center;
  154. }
  155. .text {
  156. color: $font-color-light;
  157. }
  158. }
  159. .row-box {
  160. margin-top: 30rpx;
  161. padding: 20rpx 30rpx;
  162. background: #fff;
  163. .title {
  164. font-size: $font-base + 2rpx;
  165. color: $font-color-dark;
  166. }
  167. .row {
  168. display: flex;
  169. align-items: center;
  170. position: relative;
  171. height: 80rpx;
  172. .tit {
  173. flex-shrink: 0;
  174. width: 40rpx;
  175. font-size: 30rpx;
  176. color: $font-color-dark;
  177. }
  178. .input {
  179. flex: 1;
  180. font-size: 30rpx;
  181. color: $font-color-dark;
  182. }
  183. .iconlocation {
  184. font-size: 36rpx;
  185. color: $font-color-light;
  186. }
  187. .buttom {
  188. color: #ff4c4c;
  189. font-size: $font-base;
  190. }
  191. }
  192. }
  193. .add-btn {
  194. width: 630rpx;
  195. height: 90rpx;
  196. border: 2rpx solid #ff4c4c;
  197. margin: 140rpx auto;
  198. font-family: PingFang SC;
  199. font-weight: bold;
  200. background: #ff4c4c;
  201. color: #fff;
  202. line-height: 90rpx;
  203. }
  204. .name {
  205. background: #fff;
  206. padding: 30rpx;
  207. }
  208. .list {
  209. padding-left: 30rpx;
  210. margin-top: 30rpx;
  211. background-color: #ffffff;
  212. .box {
  213. display: flex;
  214. align-items: center;
  215. width: 100%;
  216. height: 120rpx;
  217. border-bottom: 1px solid $border-color-light;
  218. .icon {
  219. font-size: 48rpx;
  220. padding-right: 20rpx;
  221. .icon-img {
  222. height: 50rpx;
  223. width: 50rpx;
  224. }
  225. }
  226. .iconweixin1 {
  227. color: #18bf16;
  228. }
  229. .iconzhifubao {
  230. color: #08aaec;
  231. }
  232. .title-box {
  233. flex-grow: 1;
  234. text-align: left;
  235. .title {
  236. font-size: $font-base + 2rpx;
  237. color: $font-color-base;
  238. }
  239. .node {
  240. font-size: $font-sm;
  241. color: $font-color-light;
  242. }
  243. }
  244. }
  245. }
  246. .tip {
  247. padding: 20rpx;
  248. color: #ff0000;
  249. }
  250. /deep/ .uni-radio-input {
  251. width: 45rpx;
  252. height: 45rpx;
  253. }
  254. </style>