yjzz.vue 6.3 KB

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