withdraw.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. <template>
  2. <view class="withdraw">
  3. <!-- 公共组件-每个页面必须引入 -->
  4. <public-module></public-module>
  5. <view class="withdraw-head dis f-c" @click="bankCardOption">
  6. <view class="dis a-c j-s">
  7. <view class="withdraw-head-to">到账银行卡</view>
  8. <view class="dis a-c" style="font-weight: bold;font-size: 12px;">
  9. <view class="bankLogo">
  10. <image src="/static/icon/bjdcar.png" mode="" style="width: 100%;height: 100%;"></image>
  11. </view>
  12. <text
  13. v-if="bankCardInfo.bankAccount && bankCardInfo.bankNumber">{{bankCardInfo.bankAccount.slice(-4)}}({{ bankCardInfo.bankNumber.slice(-4)}})</text>
  14. </view>
  15. <u-icon name="arrow-right" color="#999" size="30"></u-icon>
  16. </view>
  17. <text style="color: #999;background-color: #F7F7F7;font-size: 12px;">注:仅支持整数,72小时内到账</text>
  18. </view>
  19. <view class="withdraw-body">
  20. <text>提现金额</text>
  21. <view class="input-money">
  22. <text class="rmb">¥</text>
  23. <input disabled v-model.number="extract" type="text" @focus.prevent="stopKeyborad" class="t-input" />
  24. </view>
  25. <view class="info-money">
  26. <view v-if="is_out">
  27. <text class="info-money-num" style="color: #ff1e0f;">输入金额超过可提现余额,账户余额{{ amount }}元</text>
  28. </view>
  29. <view v-else-if="is_lowest">
  30. <text class="info-money-num" style="color: #ff1e0f;">最低{{ lowest }}元起提现,账户余额{{ amount }}元</text>
  31. </view>
  32. <view v-else>
  33. <text class="info-money-num">当前可提现余额{{ amount }}元,</text>
  34. <text class="info-money-all" @click="getAll">全部提现</text>
  35. </view>
  36. </view>
  37. <view :class="'tx' + (is_post ? '-active' : '')"><button @click="handleShowModel">提现</button></view>
  38. </view>
  39. <view :class="['keyboard', keyboradShow ? '' : 'active', isIphoneX ? 'isIphone' : '']">
  40. <block v-for="(item, index) in 9" :key="index">
  41. <view class="keyboard-item" @tap="keyboradKey(index + 1)">{{ index + 1 }}</view>
  42. </block>
  43. <view class="keyboard-item hide"></view>
  44. <view class="keyboard-item" @tap="keyboradKey(0)"><text>0</text></view>
  45. <view class="keyboard-item delte" @tap="keyboradDel()">
  46. <image class="img" src="/static/common/del.png" mode="aspectFill" :lazy-load="true"></image>
  47. </view>
  48. </view>
  49. <u-popup v-model="bankCardListShow" mode="bottom" height="700" border-radius="20">
  50. <view class="bankCardPopup">
  51. <view class="title dis f-c a-c">
  52. <text>选择到账银行卡</text>
  53. <text>请留意各银行到账时间</text>
  54. </view>
  55. <scroll-view scroll-y="true" style="height: 480rpx;">
  56. <view class="PopupSet dis j-s" v-for="(bankitem,bankindex) in bankCardList" :key="bankitem.id"
  57. @click="bankCardPopupClick(bankitem)">
  58. <view class="setLeft">
  59. <image src="../../static/icon/bjdcar.png" mode=""></image>
  60. </view>
  61. <view class="setRight dis j-s a-c">
  62. <view class="dis f-c">
  63. <text v-if="bankitem.bankAccount && bankitem.bankNumber">
  64. {{bankitem.bankAccount.slice(-4)}} 储蓄卡({{bankitem.bankNumber.slice(-4)}})</text>
  65. <text>72小时到账</text>
  66. </view>
  67. <u-icon v-if="bankCardInfo.id==bankitem.id" name="checkbox-mark" color="#02c25d"
  68. size="50"></u-icon>
  69. </view>
  70. </view>
  71. </scroll-view>
  72. </view>
  73. </u-popup>
  74. </view>
  75. </template>
  76. <script>
  77. import {
  78. mapState
  79. } from "vuex"
  80. import wybPopup from '@/components/common/wyb-popup/wyb-popup.vue'
  81. export default {
  82. components: {
  83. wybPopup
  84. },
  85. computed: {
  86. ...mapState(['userInfo'])
  87. },
  88. data() {
  89. return {
  90. lowest: 0, //最低提现金额
  91. amount: 0, //可提现余额
  92. extract: '', //选择的提现金额
  93. amountStatus: "", //提现类型
  94. is_out: false,
  95. is_lowest: false,
  96. is_post: false,
  97. money: '', //提现金额
  98. real_money: '', //实际到账
  99. keyboradShow: false,
  100. isIphoneX: false,
  101. isRefuse: false,
  102. bankCardList: [],
  103. bankCardInfo: {},
  104. bankCardListShow: false, //银行卡选择
  105. };
  106. },
  107. watch: {
  108. extract(oldVal, newVal) {}
  109. },
  110. async onLoad(params) {
  111. if (!!params.amount) {
  112. this.amount = params.amount
  113. this.amountStatus = params.amountStatus
  114. }
  115. this.loadData();
  116. this.getbankCard();
  117. },
  118. methods: {
  119. bankCardPopupClick(info) {
  120. this.bankCardInfo = info;
  121. this.bankCardListShow = false;
  122. },
  123. bankCardOption() {
  124. this.bankCardListShow = true;
  125. },
  126. async getbankCard() {
  127. let res = await this.$http.get('/userBank/getUserBankList');
  128. this.bankCardList = res.data;
  129. this.bankCardInfo = this.bankCardList.find(val => val.isDefault == 1)
  130. console.log(this.bankCardInfo);
  131. },
  132. loadData() {
  133. this.lowest = 50;
  134. this.$nextTick(() => {
  135. this.keyboradShow = true;
  136. });
  137. },
  138. //隐藏原生
  139. stopKeyborad() {
  140. uni.hideKeyboard();
  141. },
  142. //输入事件
  143. keyboradKey(key) {
  144. this.extract = this.extract * 10 + key;
  145. this.checkMoney();
  146. },
  147. //键盘递减事件
  148. keyboradDel() {
  149. if (this.extract && this.extract > 0) {
  150. let val = parseInt(this.extract / 10);
  151. this.extract = val;
  152. this.checkMoney();
  153. }
  154. },
  155. //全部提现
  156. getAll() {
  157. this.extract = parseInt(this.amount);
  158. this.checkMoney();
  159. },
  160. //提现
  161. async handleShowModel() {
  162. let params = {
  163. amount: this.extract,
  164. amountStatus: this.amountStatus,
  165. fromBankCardId: this.bankCardInfo.id,
  166. }
  167. let res = await this.$http.post('/sysUserAccount/insert', params);
  168. if (res.code == '200') {
  169. uni.showToast({
  170. title: res.msg,
  171. icon: "none"
  172. });
  173. setTimeout(() => {
  174. return uni.navigateBack();
  175. }, 2000);
  176. }
  177. },
  178. //金额计算
  179. checkMoney() {
  180. if (!this.extract || this.extract < this.lowest) {
  181. this.is_lowest = true;
  182. this.is_post = false;
  183. } else if (this.extract > this.amount) {
  184. this.is_out = true;
  185. this.is_lowest = false;
  186. this.is_post = false;
  187. } else {
  188. this.is_out = false;
  189. this.is_lowest = false;
  190. this.is_post = true;
  191. }
  192. if (parseFloat(this.extract).toString() == 'NaN') {
  193. this.is_post = false;
  194. uni.showToast({
  195. title: '输入金额不合法',
  196. icon: "none"
  197. });
  198. }
  199. },
  200. StringSlice(val) {
  201. let data = val.slice(-4)
  202. return data
  203. },
  204. async getMoney() {
  205. this.closeWithdrawPopup();
  206. if (this.isRefuse) return;
  207. this.isRefuse = true;
  208. let res = await this.$http.post('/insPayApply/applyPay?amount=' + this.real_money + '&userid=' + this
  209. .userInfo.sysUser.id);
  210. uni.showToast({
  211. title: '提现申请已提交,等待管理员处理',
  212. icon: "none",
  213. duration: 2000
  214. });
  215. setTimeout(() => {
  216. uni.navigateBack();
  217. }, 2000);
  218. }
  219. },
  220. async onPullDownRefresh() {
  221. this.extract = '';
  222. await this.getPayAccount();
  223. this.loadData();
  224. this.is_out = false;
  225. this.is_lowest = false;
  226. this.is_post = false;
  227. setTimeout(function() {
  228. uni.stopPullDownRefresh();
  229. }, 500);
  230. }
  231. };
  232. </script>
  233. <style scoped>
  234. page {
  235. background-color: #ededed;
  236. }
  237. .bankCardPopup {
  238. padding: 10px 30px;
  239. .title {
  240. color: #000;
  241. font-weight: bold;
  242. border-bottom: 1px solid #f2f2f2;
  243. padding-bottom: 10px;
  244. text:last-child {
  245. font-size: 12px;
  246. color: #999;
  247. font-weight: 400;
  248. }
  249. }
  250. .scroll {
  251. min-height: 200px;
  252. overflow-y: auto;
  253. }
  254. .PopupSet {
  255. padding-top: 15px;
  256. .setLeft {
  257. width: 25px;
  258. height: 25px;
  259. background-color: #fff;
  260. border-radius: 50%;
  261. padding: 4px;
  262. box-sizing: border-box;
  263. margin-right: 5px;
  264. box-shadow: 0px 1px 4px #c3c3c3;
  265. margin-right: 20px;
  266. margin-top: 2px;
  267. image {
  268. width: 100%;
  269. height: 100%;
  270. }
  271. }
  272. .setRight {
  273. width: 100%;
  274. padding: 0 2px 15px 0;
  275. border-bottom: 1px solid #f2f2f2;
  276. text {
  277. font-size: 12px;
  278. color: #999;
  279. }
  280. text:first-child {
  281. font-size: 15px;
  282. color: #000;
  283. font-weight: bold;
  284. }
  285. }
  286. }
  287. }
  288. .withdraw {
  289. padding: 20px;
  290. background-color: #ededed;
  291. position: absolute;
  292. width: 100%;
  293. height: 100%;
  294. box-sizing: border-box;
  295. }
  296. .withdraw-head {
  297. background-color: #f7f7f7;
  298. display: flex;
  299. align-content: center;
  300. padding: 30px;
  301. border-top-left-radius: 10px;
  302. border-top-right-radius: 10px;
  303. font-size: 14px;
  304. }
  305. .withdraw-head-way {
  306. display: flex;
  307. flex-direction: column;
  308. align-content: center;
  309. margin-left: 20px;
  310. }
  311. .withdraw-head-way-1 {
  312. color: #576b95;
  313. margin-bottom: 10px;
  314. }
  315. .withdraw-head-way-1 .way-icon {
  316. width: 16px;
  317. height: 16px;
  318. margin-right: 5px;
  319. top: 2px;
  320. }
  321. .withdraw-head-way-2 {
  322. color: #acacac;
  323. font-size: 12px;
  324. }
  325. .withdraw-body {
  326. background-color: #fff;
  327. padding: 20px 30px;
  328. font-size: 28upx;
  329. border-top-left-radius: 10px;
  330. border-top-right-radius: 10px;
  331. margin-top: -20px;
  332. }
  333. .withdraw-body .input-money {
  334. display: flex;
  335. align-content: center;
  336. font-weight: 600;
  337. border-bottom: 0.5px solid #eaeef1;
  338. }
  339. .withdraw-body .input-money .rmb {
  340. font-size: 2em;
  341. top: 10px;
  342. position: relative;
  343. }
  344. .withdraw-body .input-money .t-input {
  345. height: 1.9em;
  346. font-size: 2.5em;
  347. border: none;
  348. position: relative;
  349. left: 3.5%;
  350. outline: none;
  351. }
  352. .withdraw-body .info-money {
  353. margin-top: 10px;
  354. font-size: 12px;
  355. margin-bottom: 20px;
  356. }
  357. .withdraw-body .info-money-num {
  358. color: #b2b2b2;
  359. }
  360. .withdraw-body .info-money-all {
  361. color: #576b95;
  362. }
  363. .withdraw-body .tx button {
  364. color: #b2b2b2;
  365. font-size: 30upx;
  366. }
  367. .withdraw-body .tx-active button {
  368. font-size: 30upx;
  369. color: #fff;
  370. background: #1E85FE;
  371. }
  372. .withdraw .keyboard {
  373. position: fixed;
  374. bottom: 0;
  375. left: 0;
  376. width: 100%;
  377. background: #ebebeb;
  378. display: flex;
  379. justify-content: center;
  380. z-index: 2;
  381. flex-wrap: wrap;
  382. transition: all 0.2s ease-in 0.2s;
  383. }
  384. .withdraw .active {
  385. bottom: -400rpx;
  386. }
  387. .withdraw .keyboard-item {
  388. box-sizing: border-box;
  389. width: 250rpx;
  390. display: flex;
  391. flex-direction: column;
  392. justify-content: center;
  393. align-items: center;
  394. background: #fff;
  395. font-size: 40rpx;
  396. color: #333;
  397. height: 99rpx;
  398. border: 1rpx solid #ebebeb;
  399. border-top: none;
  400. border-left: none;
  401. }
  402. .withdraw .hide {
  403. opacity: 0;
  404. }
  405. .withdraw .delte {
  406. background: none;
  407. box-shadow: none;
  408. }
  409. .withdraw .delte image {
  410. width: 60rpx;
  411. height: 60rpx;
  412. }
  413. .withdraw .isIphone {
  414. padding-bottom: 68rpx !important;
  415. }
  416. .withdraw .fee em {
  417. font-size: 0.5rem;
  418. font-style: normal;
  419. }
  420. .popup-content .withdrawHeader {
  421. height: 100upx;
  422. background-color: #fff;
  423. color: #666666;
  424. font-size: 32upx;
  425. border-radius: 10upx;
  426. }
  427. .bankLogo {
  428. width: 20px;
  429. height: 20px;
  430. background-color: #fff;
  431. border-radius: 50%;
  432. padding: 4px;
  433. box-sizing: border-box;
  434. margin-right: 5px;
  435. image {
  436. width: 100%;
  437. height: 100%;
  438. }
  439. }
  440. .popup-content .withdrawBody {
  441. height: 220upx;
  442. padding: 25upx;
  443. background-color: #F8F8F8;
  444. }
  445. .popup-content .withdrawBody view>text:nth-of-type(1) {
  446. font-size: 26upx;
  447. }
  448. .popup-content .withdrawBody view.margin-top-sm {
  449. margin-top: 10upx;
  450. }
  451. .popup-content .withdrawBody .text-red {
  452. color: #E54D42;
  453. }
  454. .popup-content .withdrawFooter {
  455. height: 120upx;
  456. }
  457. .popup-content .withdrawFooter view {
  458. width: 120upx;
  459. height: 70upx;
  460. margin: 0upx 30upx;
  461. border-radius: 10upx;
  462. padding: 0upx 15upx;
  463. }
  464. .popup-content .withdrawFooter view:nth-of-type(1) {
  465. background-color: #f0f0f0;
  466. }
  467. .popup-content .withdrawFooter view:nth-of-type(2) {
  468. background-color: #1E85FE;
  469. color: #FFFFFF;
  470. }
  471. </style>