wallet.vue 5.5 KB

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