xfjfzz.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="flex">
  5. <view class="buttom">
  6. <view class="icon">{{ userInfo.now_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">
  18. <!-- <text class="tit">¥</text> -->
  19. <input class="input" type="number" v-model="withdrawal" placeholder="转入金额" placeholder-class="placeholder" />
  20. <view class="buttom" @click="withdrawal = userInfo.now_money">全部转账</view>
  21. </view>
  22. </view>
  23. <button class="add-btn up" :class="{ action: loding }" @click="!loding ? confirm() : ''">提交申请</button>
  24. <button class="back-btn up" @click="boblack">返回</button>
  25. </view>
  26. </template>
  27. <script>
  28. import { getMoneyStyle } from '@/utils/rocessor.js';
  29. import { getUserInfo,transfer_accounts } from '@/api/user.js';
  30. import { mapMutations, mapState } from 'vuex';
  31. export default {
  32. filters: {
  33. getMoneyStyle
  34. },
  35. data() {
  36. return {
  37. money: '0.00', //可提现金额
  38. withdrawal: '', //提现金额
  39. password: '', //支付密码
  40. card: '', //转账卡号
  41. name: '',
  42. // #ifdef H5
  43. weichatBsrowser: false,
  44. // #endif
  45. loding: false,
  46. type: 'xl'
  47. };
  48. },
  49. onLoad(options) {
  50. // #ifdef H5
  51. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  52. // #endif
  53. this.dataUp();
  54. if (options.type) {
  55. this.type = options.type;
  56. console.log(this.type);
  57. }
  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. obj.login();
  70. // 保存返回用户数据
  71. obj.setUserInfo(e.data);
  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. obj.loding = true;
  85. if (obj.withdrawal == 0) {
  86. obj.loding = false;
  87. uni.showModal({
  88. title: '提示',
  89. content: '转账金额不要为0'
  90. });
  91. return;
  92. }
  93. if (obj.card == obj.userInfo.phone) {
  94. obj.loding = false;
  95. uni.showModal({
  96. title: '提示',
  97. content: '不要输入自己的用户账号'
  98. });
  99. } else {
  100. let data = {
  101. phone: obj.card, //编号
  102. money: obj.withdrawal //金额
  103. };
  104. transfer_accounts(data)
  105. .then(e => {
  106. // 允许按钮点击
  107. obj.loding = false;
  108. // 初始化提现金额
  109. obj.withdrawal = '';
  110. uni.showToast({
  111. title: '提交成功',
  112. duration: 2000,
  113. position: 'top'
  114. });
  115. obj.dataUp();
  116. })
  117. .catch(e => {
  118. obj.$api.msg(e.msg);
  119. obj.loding = false;
  120. console.log();
  121. });
  122. }
  123. },
  124. boblack() {
  125. uni.navigateBack({
  126. fail(){
  127. uni.switchTab({
  128. url: '/pages/index/index'
  129. })
  130. }
  131. })
  132. }
  133. }
  134. };
  135. </script>
  136. <style lang="scss">
  137. page {
  138. height: 100%;
  139. }
  140. .content-money {
  141. padding: 30rpx 0;
  142. background: #ffffff;
  143. }
  144. .item {
  145. padding: 0 $page-row-spacing;
  146. background-color: #ffffff;
  147. }
  148. .flex {
  149. background-color: #ffffff;
  150. text-align: center;
  151. margin: 0 30rpx;
  152. border-radius: $border-radius-sm;
  153. justify-content: center;
  154. .buttom {
  155. font-size: $font-lg;
  156. width: 50%;
  157. }
  158. .interval {
  159. width: 2px;
  160. height: 60rpx;
  161. background-color: #eeeeee;
  162. }
  163. .icon {
  164. background-size: 100%;
  165. font-size: 42rpx;
  166. color: $font-color-dark;
  167. font-weight: bold;
  168. background-repeat: no-repeat;
  169. background-position: center;
  170. }
  171. .text {
  172. color: $font-color-light;
  173. }
  174. }
  175. .row-box {
  176. margin-top: 30rpx;
  177. padding: 20rpx 30rpx;
  178. background: #fff;
  179. .title {
  180. font-size: $font-base + 2rpx;
  181. color: $font-color-dark;
  182. }
  183. .row {
  184. display: flex;
  185. align-items: center;
  186. position: relative;
  187. height: 80rpx;
  188. .tit {
  189. flex-shrink: 0;
  190. width: 40rpx;
  191. font-size: 30rpx;
  192. color: $font-color-dark;
  193. }
  194. .input {
  195. flex: 1;
  196. font-size: 30rpx;
  197. color: $font-color-dark;
  198. }
  199. .iconlocation {
  200. font-size: 36rpx;
  201. color: $font-color-light;
  202. }
  203. .buttom {
  204. color: #f21f5d;
  205. font-size: $font-base;
  206. }
  207. }
  208. }
  209. .add-btn {
  210. width: 520rpx;
  211. height: 80rpx;
  212. border-radius: 20rpx;
  213. margin: 140rpx auto 0;
  214. font-size: 36rpx;
  215. font-weight: bold;
  216. color: #F8DABA;
  217. background-color: #303030;
  218. }
  219. .back-btn {
  220. width: 520rpx;
  221. height: 80rpx;
  222. border-radius: 20rpx;
  223. margin: 40rpx auto;
  224. font-size: 36rpx;
  225. font-weight: bold;
  226. color: #303030;
  227. background-color:#F8DABA;
  228. }
  229. .name {
  230. background: #fff;
  231. padding: 30rpx;
  232. }
  233. .list {
  234. padding-left: 30rpx;
  235. margin-top: 30rpx;
  236. background-color: #ffffff;
  237. .box {
  238. display: flex;
  239. align-items: center;
  240. width: 100%;
  241. height: 120rpx;
  242. border-bottom: 1px solid $border-color-light;
  243. .icon {
  244. font-size: 48rpx;
  245. padding-right: 20rpx;
  246. .icon-img {
  247. height: 50rpx;
  248. width: 50rpx;
  249. }
  250. }
  251. .iconweixin1 {
  252. color: #18bf16;
  253. }
  254. .iconzhifubao {
  255. color: #08aaec;
  256. }
  257. .title-box {
  258. flex-grow: 1;
  259. text-align: left;
  260. .title {
  261. font-size: $font-base + 2rpx;
  262. color: $font-color-base;
  263. }
  264. .node {
  265. font-size: $font-sm;
  266. color: $font-color-light;
  267. }
  268. }
  269. }
  270. }
  271. .tip {
  272. padding: 20rpx;
  273. color: #ff0000;
  274. }
  275. /deep/ .uni-radio-input {
  276. width: 45rpx;
  277. height: 45rpx;
  278. }
  279. </style>