withdmoenys.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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. <image class="jff" src="../../static/icon/iconU1.png" mode="widthFix"></image>
  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. uni.showLoading({
  82. title: '转账中...',
  83. mask: true
  84. })
  85. transfer(data)
  86. .then(e => {
  87. uni.hideLoading()
  88. // 允许按钮点击
  89. obj.loding = false;
  90. // 初始化提现金额
  91. obj.withdrawal = ''
  92. // 初始化交易密码
  93. obj.password = ''
  94. uni.showToast({
  95. title: '提交成功',
  96. duration: 2000,
  97. position: 'top'
  98. });
  99. obj.dataUp();
  100. setTimeout(() => {
  101. uni.navigateBack()
  102. },1500)
  103. })
  104. .catch(e => {
  105. uni.hideLoading()
  106. obj.loding = false;
  107. console.log();
  108. });
  109. }
  110. }
  111. };
  112. </script>
  113. <style lang="scss">
  114. page {
  115. height: 100%;
  116. }
  117. .content-money {
  118. padding: 30rpx 0;
  119. background: #ffffff;
  120. }
  121. .item{
  122. padding: 0 $page-row-spacing;
  123. background-color: #FFFFFF;
  124. }
  125. .flex {
  126. background-color: #ffffff;
  127. text-align: center;
  128. margin: 0 30rpx;
  129. border-radius: $border-radius-sm;
  130. justify-content: center;
  131. .buttom {
  132. font-size: $font-lg;
  133. width: 50%;
  134. }
  135. .interval {
  136. width: 2px;
  137. height: 60rpx;
  138. background-color: #eeeeee;
  139. }
  140. .icon {
  141. background-size: 100%;
  142. font-size: 42rpx;
  143. color: $font-color-dark;
  144. font-weight: bold;
  145. background-repeat: no-repeat;
  146. background-position: center;
  147. }
  148. .text {
  149. color: $font-color-light;
  150. }
  151. }
  152. .row-box {
  153. margin-top: 30rpx;
  154. padding: 20rpx 30rpx;
  155. background: #fff;
  156. .title {
  157. font-size: $font-base + 2rpx;
  158. color: $font-color-dark;
  159. }
  160. .row {
  161. display: flex;
  162. align-items: center;
  163. position: relative;
  164. height: 80rpx;
  165. .tit {
  166. flex-shrink: 0;
  167. width: 40rpx;
  168. font-size: 30rpx;
  169. color: $font-color-dark;
  170. }
  171. .input {
  172. flex: 1;
  173. font-size: 30rpx;
  174. color: $font-color-dark;
  175. }
  176. .iconlocation {
  177. font-size: 36rpx;
  178. color: $font-color-light;
  179. }
  180. .buttom {
  181. color: $base-color;
  182. font-size: $font-base;
  183. }
  184. }
  185. }
  186. .add-btn {
  187. &.modified {
  188. color: $base-color;
  189. }
  190. &.up {
  191. background: $bg-green-gradual;
  192. color: #fff;
  193. }
  194. &.action{
  195. background-color: $color-gray;
  196. }
  197. display: flex;
  198. align-items: center;
  199. justify-content: center;
  200. width: 690rpx;
  201. height: 80rpx;
  202. margin: 0 auto;
  203. margin-top: 30rpx;
  204. font-size: $font-lg;
  205. border-radius: 10rpx;
  206. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  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. /deep/ .uni-radio-input {
  247. width: 45rpx;
  248. height: 45rpx;
  249. }
  250. </style>