tzzz.vue 7.5 KB

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