xfjfzz.vue 7.2 KB

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