mygwjfhz.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="flex">
  5. <view class="buttom">
  6. <view class="icon">{{ userInfo.sp_final | 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.sp_final">全部转账</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. gwjfhz
  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.card == '') {
  106. obj.loding = false;
  107. return obj.$api.msg('请输入收款人手机号码')
  108. }
  109. if (obj.withdrawal == 0) {
  110. obj.loding = false;
  111. uni.showModal({
  112. title: '提示',
  113. content: '转账金额不要为0'
  114. });
  115. return;
  116. }
  117. if (obj.withdrawal * 1 > obj.userInfo.sp_final) {
  118. obj.loding = false;
  119. return obj.$api.msg('可转余额不足')
  120. }
  121. if (obj.card == obj.userInfo.phone) {
  122. obj.loding = false;
  123. uni.showModal({
  124. title: '提示',
  125. content: '不要输入自己的用户账号'
  126. });
  127. } else {
  128. obj.$refs.uppass.open()
  129. return
  130. }
  131. },
  132. boblack() {
  133. uni.navigateBack({
  134. fail() {
  135. uni.switchTab({
  136. url: '/pages/index/index'
  137. })
  138. }
  139. })
  140. },
  141. cancel() {
  142. this.$refs.uppass.close()
  143. this.password = ''
  144. },
  145. pswQd() {
  146. let obj = this
  147. let data = {
  148. phone: obj.card, //编号
  149. money: obj.withdrawal, //金额
  150. pas: obj.password
  151. };
  152. gwjfhz(data)
  153. .then(e => {
  154. // 允许按钮点击
  155. obj.loding = false;
  156. // 初始化提现金额
  157. obj.withdrawal = '';
  158. uni.showToast({
  159. title: '转账成功',
  160. duration: 2000,
  161. position: 'top'
  162. });
  163. obj.dataUp();
  164. obj.cancel()
  165. })
  166. .catch(e => {
  167. obj.$api.msg(e.msg);
  168. obj.loding = false;
  169. console.log();
  170. });
  171. }
  172. }
  173. };
  174. </script>
  175. <style lang="scss">
  176. page {
  177. height: 100%;
  178. }
  179. .content-money {
  180. padding: 30rpx 0;
  181. background: #ffffff;
  182. }
  183. .item {
  184. padding: 0 $page-row-spacing;
  185. background-color: #ffffff;
  186. }
  187. .flex {
  188. background-color: #ffffff;
  189. text-align: center;
  190. margin: 0 30rpx;
  191. border-radius: $border-radius-sm;
  192. justify-content: center;
  193. .buttom {
  194. font-size: $font-lg;
  195. width: 50%;
  196. }
  197. .interval {
  198. width: 2px;
  199. height: 60rpx;
  200. background-color: #eeeeee;
  201. }
  202. .icon {
  203. background-size: 100%;
  204. font-size: 42rpx;
  205. color: $font-color-dark;
  206. font-weight: bold;
  207. background-repeat: no-repeat;
  208. background-position: center;
  209. }
  210. .text {
  211. color: $font-color-light;
  212. }
  213. }
  214. .row-box {
  215. margin-top: 30rpx;
  216. padding: 20rpx 30rpx;
  217. background: #fff;
  218. .title {
  219. font-size: $font-base + 2rpx;
  220. color: $font-color-dark;
  221. }
  222. .row {
  223. display: flex;
  224. align-items: center;
  225. position: relative;
  226. height: 80rpx;
  227. .tit {
  228. flex-shrink: 0;
  229. width: 40rpx;
  230. font-size: 30rpx;
  231. color: $font-color-dark;
  232. }
  233. .input {
  234. flex: 1;
  235. font-size: 30rpx;
  236. color: $font-color-dark;
  237. }
  238. .iconlocation {
  239. font-size: 36rpx;
  240. color: $font-color-light;
  241. }
  242. .buttom {
  243. color: #f21f5d;
  244. font-size: $font-base;
  245. }
  246. }
  247. }
  248. .add-btn {
  249. width: 520rpx;
  250. height: 80rpx;
  251. border-radius: 20rpx;
  252. margin: 140rpx auto 0;
  253. font-size: 36rpx;
  254. font-weight: bold;
  255. color: #F8DABA;
  256. background-color: #303030;
  257. }
  258. .back-btn {
  259. width: 520rpx;
  260. height: 80rpx;
  261. border-radius: 20rpx;
  262. margin: 40rpx auto;
  263. font-size: 36rpx;
  264. font-weight: bold;
  265. color: #303030;
  266. background-color: #F8DABA;
  267. }
  268. .name {
  269. background: #fff;
  270. padding: 30rpx;
  271. }
  272. .list {
  273. padding-left: 30rpx;
  274. margin-top: 30rpx;
  275. background-color: #ffffff;
  276. .box {
  277. display: flex;
  278. align-items: center;
  279. width: 100%;
  280. height: 120rpx;
  281. border-bottom: 1px solid $border-color-light;
  282. .icon {
  283. font-size: 48rpx;
  284. padding-right: 20rpx;
  285. .icon-img {
  286. height: 50rpx;
  287. width: 50rpx;
  288. }
  289. }
  290. .iconweixin1 {
  291. color: #18bf16;
  292. }
  293. .iconzhifubao {
  294. color: #08aaec;
  295. }
  296. .title-box {
  297. flex-grow: 1;
  298. text-align: left;
  299. .title {
  300. font-size: $font-base + 2rpx;
  301. color: $font-color-base;
  302. }
  303. .node {
  304. font-size: $font-sm;
  305. color: $font-color-light;
  306. }
  307. }
  308. }
  309. }
  310. .tip {
  311. padding: 20rpx;
  312. color: #ff0000;
  313. }
  314. /deep/ .uni-radio-input {
  315. width: 45rpx;
  316. height: 45rpx;
  317. }
  318. .psw-wrapper {
  319. width: 548rpx;
  320. height: 344rpx;
  321. background-color: #FFFFFF;
  322. border-radius: 15rpx 15rpx;
  323. .psw-title {
  324. width: 100%;
  325. font-size: 35rpx;
  326. padding: 43rpx 0 49rpx;
  327. text-align: center;
  328. font-weight: 800;
  329. }
  330. .psw-ipt {
  331. display: block;
  332. background-color: #dce3ed;
  333. height: 90rpx;
  334. width: 464rpx;
  335. padding-left: 30rpx;
  336. margin: 0 auto;
  337. font-size: 80rpx;
  338. }
  339. .psw-btn text {
  340. display: inline-block;
  341. text-align: center;
  342. width: 50%;
  343. padding-top: 29rpx;
  344. font-size: 35rpx;
  345. }
  346. .psw-qd {
  347. color: #5771DF;
  348. }
  349. }
  350. </style>