integralTransforms.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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 != ''">用户昵称:{{ name }}</view>
  12. <view class="item">
  13. <view class="title">用户编号</view>
  14. <view class="row"><input class="input" type="text" v-model="card" placeholder="输入转入的用户编号" @blur="userName" placeholder-class="placeholder" /></view>
  15. </view>
  16. <view class="item">
  17. <view class="title">支付密码</view>
  18. <view class="row"><input class="input" type="password" v-model="password" placeholder="输入支付密码" placeholder-class="placeholder" /></view>
  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({})
  67. .then(e => {
  68. obj.login();
  69. // 保存返回用户数据
  70. obj.setUserInfo(e.data);
  71. })
  72. .catch(e => {
  73. console.log(e);
  74. });
  75. },
  76. // 切换选中对象
  77. tabRadio(e) {
  78. this.type = e.detail.value;
  79. },
  80. userName() {
  81. if (this.card != '') {
  82. nickname({ uid: this.card }).then(data => {
  83. this.name = data.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: 20rpx $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. }
  179. .title {
  180. font-size: $font-base + 2rpx;
  181. color: $font-color-dark;
  182. }
  183. .row {
  184. display: flex;
  185. align-items: center;
  186. position: relative;
  187. height: 80rpx;
  188. .tit {
  189. flex-shrink: 0;
  190. width: 40rpx;
  191. font-size: 30rpx;
  192. color: $font-color-dark;
  193. }
  194. .input {
  195. flex: 1;
  196. font-size: 30rpx;
  197. color: $font-color-dark;
  198. }
  199. .iconlocation {
  200. font-size: 36rpx;
  201. color: $font-color-light;
  202. }
  203. .buttom {
  204. color: $base-color;
  205. font-size: $font-base;
  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>