yuezz.vue 5.8 KB

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