yuezz.vue 5.7 KB

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