withdmoenys.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="flex">
  5. <view class="buttom">
  6. <view class="icon">{{ userInfo.integral | getMoneyStyle }}</view>
  7. <text class="text">可用响亮积分</text>
  8. </view>
  9. </view>
  10. </view>
  11. <u-form ref="uForm" class="item">
  12. <u-form-item label-width='150' label="用户手机"><u-input type="text" v-model="card" /></u-form-item>
  13. </u-form>
  14. <view class="row-box">
  15. <view class="title">转账金额</view>
  16. <view class="row">
  17. <text class="tit">¥</text>
  18. <input class="input" type="number" v-model="withdrawal" placeholder='转入金额' placeholder-class="placeholder" />
  19. <view class="buttom" @click="withdrawal = userInfo.integral">全部转账</view>
  20. </view>
  21. </view>
  22. <button class="add-btn up" :class="{'action':loding}" @click="!loding?confirm():''">转入</button>
  23. </view>
  24. </template>
  25. <script>
  26. import { getMoneyStyle } from '@/utils/rocessor.js';
  27. import { getUserInfo,transfer } from '@/api/user.js';
  28. import { mapMutations,mapState } from 'vuex';
  29. export default {
  30. filters: {
  31. getMoneyStyle
  32. },
  33. data() {
  34. return {
  35. money: '0.00', //可提现金额
  36. withdrawal: '', //提现金额
  37. password:'',//支付密码
  38. card:'',//转账卡号
  39. name:'',
  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. if(obj.withdrawal == 0){
  77. obj.loding = false;
  78. uni.showModal({
  79. title:"提示",
  80. content:"转账金额不要为0"
  81. })
  82. return;
  83. }
  84. if(obj.card == obj.userInfo.phone){
  85. obj.loding = false;
  86. uni.showModal({
  87. title:"提示",
  88. content:"不要输入自己的用户账号"
  89. })
  90. }else{
  91. let data = {
  92. to_user_account:obj.card, //编号
  93. num: obj.withdrawal //金额
  94. }
  95. transfer(data)
  96. .then(e => {
  97. // 允许按钮点击
  98. obj.loding = false;
  99. // 初始化提现金额
  100. obj.withdrawal = ''
  101. uni.showToast({
  102. title: '提交成功',
  103. duration: 2000,
  104. position: 'top'
  105. });
  106. obj.dataUp();
  107. })
  108. .catch(e => {
  109. obj.$api.msg(e.msg)
  110. obj.loding = false;
  111. console.log();
  112. });
  113. }
  114. }
  115. }
  116. };
  117. </script>
  118. <style lang="scss">
  119. page {
  120. height: 100%;
  121. }
  122. .content-money {
  123. padding: 30rpx 0;
  124. background: #ffffff;
  125. }
  126. .item{
  127. padding: 0 $page-row-spacing;
  128. background-color: #FFFFFF;
  129. }
  130. .flex {
  131. background-color: #ffffff;
  132. text-align: center;
  133. margin: 0 30rpx;
  134. border-radius: $border-radius-sm;
  135. justify-content: center;
  136. .buttom {
  137. font-size: $font-lg;
  138. width: 50%;
  139. }
  140. .interval {
  141. width: 2px;
  142. height: 60rpx;
  143. background-color: #eeeeee;
  144. }
  145. .icon {
  146. background-size: 100%;
  147. font-size: 42rpx;
  148. color: $font-color-dark;
  149. font-weight: bold;
  150. background-repeat: no-repeat;
  151. background-position: center;
  152. }
  153. .text {
  154. color: $font-color-light;
  155. }
  156. }
  157. .row-box {
  158. margin-top: 30rpx;
  159. padding: 20rpx 30rpx;
  160. background: #fff;
  161. .title {
  162. font-size: $font-base + 2rpx;
  163. color: $font-color-dark;
  164. }
  165. .row {
  166. display: flex;
  167. align-items: center;
  168. position: relative;
  169. height: 80rpx;
  170. .tit {
  171. flex-shrink: 0;
  172. width: 40rpx;
  173. font-size: 30rpx;
  174. color: $font-color-dark;
  175. }
  176. .input {
  177. flex: 1;
  178. font-size: 30rpx;
  179. color: $font-color-dark;
  180. }
  181. .iconlocation {
  182. font-size: 36rpx;
  183. color: $font-color-light;
  184. }
  185. .buttom {
  186. color: $base-color;
  187. font-size: $font-base;
  188. }
  189. }
  190. }
  191. .add-btn {
  192. background: $base-color;
  193. display: flex;
  194. align-items: center;
  195. justify-content: center;
  196. width: 690rpx;
  197. height: 80rpx;
  198. margin: 0 auto;
  199. margin-top: 30rpx;
  200. font-size: $font-lg;
  201. border-radius: 10rpx;
  202. color: #fff;
  203. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  204. }
  205. .name {
  206. background: #fff;
  207. padding: 30rpx;
  208. }
  209. .list {
  210. padding-left: 30rpx;
  211. margin-top: 30rpx;
  212. background-color: #ffffff;
  213. .box {
  214. display: flex;
  215. align-items: center;
  216. width: 100%;
  217. height: 120rpx;
  218. border-bottom: 1px solid $border-color-light;
  219. .icon {
  220. font-size: 48rpx;
  221. padding-right: 20rpx;
  222. .icon-img {
  223. height: 50rpx;
  224. width: 50rpx;
  225. }
  226. }
  227. .iconweixin1 {
  228. color: #18bf16;
  229. }
  230. .iconzhifubao {
  231. color: #08aaec;
  232. }
  233. .title-box {
  234. flex-grow: 1;
  235. text-align: left;
  236. .title {
  237. font-size: $font-base + 2rpx;
  238. color: $font-color-base;
  239. }
  240. .node {
  241. font-size: $font-sm;
  242. color: $font-color-light;
  243. }
  244. }
  245. }
  246. }
  247. /deep/ .uni-radio-input {
  248. width: 45rpx;
  249. height: 45rpx;
  250. }
  251. </style>