withdmoenys.vue 4.7 KB

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