yjzz.vue 6.2 KB

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