wallet.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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. if(obj.loding){
  90. return
  91. }
  92. obj.loding = true;
  93. if (obj.withdrawal < 10) {
  94. obj.loding = false;
  95. uni.showModal({
  96. title: '提示',
  97. content: '转账金额最低为10'
  98. });
  99. return;
  100. }
  101. if (obj.password == '') {
  102. obj.loding = false;
  103. uni.showModal({
  104. title: '提示',
  105. content: '请输入交易密码'
  106. });
  107. return;
  108. }
  109. if (obj.withdrawal % 10 != 0) {
  110. obj.loding = false;
  111. uni.showModal({
  112. title: '提示',
  113. content: '转账金额请输入10的倍数'
  114. });
  115. return;
  116. } else {
  117. let data = {
  118. uid: obj.card, //编号
  119. anticipate: obj.withdrawal, //金额
  120. payment: obj.password
  121. };
  122. transfer_accounts(data)
  123. .then(e => {
  124. // 允许按钮点击
  125. obj.loding = false;
  126. // 初始化提现金额
  127. obj.withdrawal = '';
  128. uni.showToast({
  129. title: '转账成功',
  130. duration: 2000,
  131. position: 'top'
  132. });
  133. obj.dataUp();
  134. })
  135. .catch(e => {
  136. obj.$api.msg(e.msg);
  137. obj.loding = false;
  138. console.log();
  139. });
  140. }
  141. }
  142. }
  143. };
  144. </script>
  145. <style lang="scss">
  146. page {
  147. height: 100%;
  148. }
  149. .content-money {
  150. padding: 30rpx 0;
  151. background: #ffffff;
  152. }
  153. .item {
  154. padding: 0 $page-row-spacing;
  155. background-color: #ffffff;
  156. }
  157. .flex {
  158. background-color: #ffffff;
  159. text-align: center;
  160. margin: 0 30rpx;
  161. border-radius: $border-radius-sm;
  162. justify-content: center;
  163. .buttom {
  164. font-size: $font-lg;
  165. width: 50%;
  166. }
  167. .interval {
  168. width: 2px;
  169. height: 60rpx;
  170. background-color: #eeeeee;
  171. }
  172. .icon {
  173. background-size: 100%;
  174. font-size: 42rpx;
  175. color: $font-color-dark;
  176. font-weight: bold;
  177. background-repeat: no-repeat;
  178. background-position: center;
  179. }
  180. .text {
  181. color: $font-color-light;
  182. }
  183. }
  184. .row-box {
  185. margin-top: 30rpx;
  186. padding: 20rpx 30rpx;
  187. background: #fff;
  188. .title {
  189. font-size: $font-base + 2rpx;
  190. color: $font-color-dark;
  191. }
  192. .row {
  193. display: flex;
  194. align-items: center;
  195. position: relative;
  196. height: 80rpx;
  197. .tit {
  198. flex-shrink: 0;
  199. width: 40rpx;
  200. font-size: 30rpx;
  201. color: $font-color-dark;
  202. }
  203. .input {
  204. flex: 1;
  205. font-size: 30rpx;
  206. color: $font-color-dark;
  207. }
  208. .iconlocation {
  209. font-size: 36rpx;
  210. color: $font-color-light;
  211. }
  212. .buttom {
  213. color: #f21f5d;
  214. font-size: $font-base;
  215. }
  216. }
  217. }
  218. .add-btn {
  219. width: 520rpx;
  220. height: 80rpx;
  221. border: 2rpx solid #f21f5d;
  222. border-radius: 40rpx;
  223. margin: 140rpx auto;
  224. font-family: PingFang SC;
  225. font-weight: bold;
  226. color: #f21f5d;
  227. }
  228. .name {
  229. background: #fff;
  230. padding: 30rpx;
  231. }
  232. .list {
  233. padding-left: 30rpx;
  234. margin-top: 30rpx;
  235. background-color: #ffffff;
  236. .box {
  237. display: flex;
  238. align-items: center;
  239. width: 100%;
  240. height: 120rpx;
  241. border-bottom: 1px solid $border-color-light;
  242. .icon {
  243. font-size: 48rpx;
  244. padding-right: 20rpx;
  245. .icon-img {
  246. height: 50rpx;
  247. width: 50rpx;
  248. }
  249. }
  250. .iconweixin1 {
  251. color: #18bf16;
  252. }
  253. .iconzhifubao {
  254. color: #08aaec;
  255. }
  256. .title-box {
  257. flex-grow: 1;
  258. text-align: left;
  259. .title {
  260. font-size: $font-base + 2rpx;
  261. color: $font-color-base;
  262. }
  263. .node {
  264. font-size: $font-sm;
  265. color: $font-color-light;
  266. }
  267. }
  268. }
  269. }
  270. .tip {
  271. padding: 20rpx;
  272. color: #ff0000;
  273. }
  274. /deep/ .uni-radio-input {
  275. width: 45rpx;
  276. height: 45rpx;
  277. }
  278. </style>