withdrawal.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. <template>
  2. <view class="page">
  3. <view class="account dis f-c " @click="switchCard">
  4. <text class="title">提现账户</text>
  5. <view class="dis a-c ">
  6. <image class="logo" v-if=" bankCardInfo.stylelist && bankCardInfo.stylelist.logo "
  7. :src="bankCardInfo.stylelist.logo" mode="">
  8. </image>
  9. <text v-if=" bankCardInfo.bankCardNumber"
  10. style="margin-left: 16rpx;">{{bankCardInfo.bankName}}(****{{bankCardInfo.bankCardNumber.slice(-4)}})</text>
  11. <image class="arrowRight" src="/static/icon/my/arrowRight1.png" mode=""></image>
  12. </view>
  13. </view>
  14. <view class="withdraw-body">
  15. <view class="" style="padding: 40rpx 20rpx; box-sizing: border-box;">
  16. <text style="font-size: 15px;color: #333;">提现金额</text>
  17. <view class="input-money">
  18. <view class="rmb dis a-c">¥</view>
  19. <text class="t-input dis a-c">{{extract}}</text>
  20. </view>
  21. <view class="info-money dis a-c">
  22. <view v-if="is_out">
  23. <text class="info-money-num" style="color: #ff1e0f;">输入金额超过可提现余额,账户余额{{ amount }}元</text>
  24. </view>
  25. <view v-else-if="is_lowest">
  26. <text class="info-money-num" style="color: #ff1e0f;">最低{{ lowest }}元起提现,账户余额{{ amount }}元</text>
  27. </view>
  28. <view v-else>
  29. <text class="info-money-num">当前可提现余额{{ amount }}元,</text>
  30. <text class="info-money-all" @click="getAll">全部提现</text>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="dis j-s keyboard">
  35. <view class="dis a-s j-s f-wrap gild " style="width: 80%;">
  36. <block v-for="(item, index) in 9" :key="index">
  37. <view class="keyboard-item" @tap="keyboradKey(index + 1)">{{ index + 1 }}</view>
  38. </block>
  39. <view class="keyboard-item" style=" grid-column: span 2" @tap="keyboradKey(0)"><text>0</text></view>
  40. <view class="keyboard-item " @tap="keyboradKey('.')">.</view>
  41. </view>
  42. <view class="dis f-c j-s" style="margin-left: 20rpx;width: 20%;">
  43. <view class="keyboard-item " @tap="keyboradDel()" style="width: 100%;">
  44. <image src="/static/image/Frame.png" mode="aspectFill" :lazy-load="true"
  45. style="width: 26px;height: 26px;">
  46. </image>
  47. </view>
  48. <u-button class="Withdrawal" :disabled="!is_post" @click="handleShowModel">提现</u-button>
  49. </view>
  50. </view>
  51. </view>
  52. <!-- 银行卡选择 -->
  53. <uni-Popup :show="selectbankCard" @close='selectbankCard=false' headerTitle="选择提现银行卡" overflow="auto"
  54. maxHeight="580rpx">
  55. <template #content>
  56. <view class="bankCardview ">
  57. <view class="view dis j-s" v-for="(item,index) in bankCardList" :key="index"
  58. @click="bankCardPopupClick(item)">
  59. <image class="logo" :src="item.stylelist.logo" mode=""></image>
  60. <view class="CardInfo">
  61. <view class="dis j-s" v-if="item.bankCardNumber">
  62. <text class="carTitle">{{item.bankName}}储蓄卡({{item.bankCardNumber.slice(-4)}})</text>
  63. <u-icon v-if="bankCardInfo.id==item.id" name="checkbox-mark" color="#333333"
  64. size="50rpx"></u-icon>
  65. </view>
  66. <text class="comment">72小时到账</text>
  67. </view>
  68. </view>
  69. </view>
  70. </template>
  71. </uni-Popup>
  72. </view>
  73. </template>
  74. <script>
  75. import {
  76. mapState,
  77. mapMutations
  78. } from "vuex"
  79. export default {
  80. data() {
  81. return {
  82. lowest: 0, //最低提现金额
  83. amount: 0, //可提现余额
  84. extract: '', //选择的提现金额
  85. is_out: false,
  86. is_lowest: false,
  87. is_post: false,
  88. selectbankCard: false, //银行卡弹窗
  89. bankCardList: [], //银行卡列表
  90. bankCardInfo: {}, //默认显示银行卡
  91. bankList: [{
  92. bankName: "中国邮政储蓄银行",
  93. logo: "/static/image/bankLogo1/youzheng.png",
  94. },
  95. {
  96. bankName: "中国工商银行",
  97. logo: "/static/image/bankLogo1/gongshang.png",
  98. },
  99. {
  100. bankName: "中国农业银行",
  101. logo: "/static/image/bankLogo1/nongye.png",
  102. },
  103. {
  104. bankName: "中国银行",
  105. logo: "/static/image/bankLogo1/zhongguo.png",
  106. },
  107. {
  108. bankName: "中国建设银行",
  109. logo: "/static/image/bankLogo1/jianshe.png",
  110. },
  111. {
  112. bankName: "招商银行",
  113. logo: "/static/image/bankLogo1/zhaoshang.png",
  114. },
  115. {
  116. bankName: "中国民生银行",
  117. logo: "/static/image/bankLogo1/minsheng.png",
  118. },
  119. {
  120. bankName: "中国光大银行",
  121. logo: "/static/image/bankLogo1/guangda.png",
  122. },
  123. {
  124. bankName: "中信银行",
  125. logo: "/static/image/bankLogo1/zhongxin.png",
  126. },
  127. {
  128. bankName: "华夏银行",
  129. logo: "/static/image/bankLogo1/huaxia.png",
  130. },
  131. {
  132. bankName: "中国交通银行",
  133. logo: "/static/image/bankLogo1/jiaotong.png",
  134. },
  135. {
  136. bankName: "晋商银行",
  137. logo: "/static/image/bankLogo1/jinshang.png",
  138. },
  139. {
  140. bankName: "山西银行",
  141. logo: "/static/image/bankLogo1/shanxi.png",
  142. },
  143. {
  144. bankName: "农村商业银行",
  145. logo: "/static/image/bankLogo1/nongcun.png",
  146. },
  147. ],
  148. }
  149. },
  150. onShow() {
  151. },
  152. onLoad(options) {
  153. if (options) {
  154. this.amount = options.amount;
  155. this.getcardPack();
  156. }
  157. },
  158. computed: {
  159. ...mapState(['userInfo']),
  160. },
  161. methods: {
  162. //选择银行卡
  163. bankCardPopupClick(item) {
  164. this.bankCardInfo = item;
  165. this.selectbankCard = false;
  166. },
  167. //提现
  168. async handleShowModel() {
  169. let params = {
  170. withdrawAmount: this.extract,
  171. bankCardId: this.bankCardInfo.id,
  172. }
  173. let res = await this.$http.post('/amountAuditing/applyWithdraw', params);
  174. if (res.code == '200') {
  175. uni.showToast({
  176. title: res.msg,
  177. icon: "none"
  178. });
  179. setTimeout(() => {
  180. return uni.navigateBack(1);
  181. }, 2000);
  182. } else {
  183. uni.showToast({
  184. title: res.msg,
  185. icon: "none"
  186. });
  187. }
  188. },
  189. //输入事件
  190. keyboradKey(key) {
  191. // this.extract = this.extract * 10 + key;
  192. this.extract += key;
  193. this.checkMoney();
  194. },
  195. //键盘递减事件
  196. keyboradDel() {
  197. if (this.extract.length) this.extract = this.extract.substr(0, this.extract.length - 1);
  198. this.checkMoney();
  199. },
  200. //金额计算
  201. checkMoney() {
  202. if (!this.extract || parseFloat(this.extract) < parseFloat(this.lowest)) {
  203. this.is_lowest = true;
  204. this.is_post = false;
  205. } else if (parseFloat(this.extract) > parseFloat(this.amount)) {
  206. this.is_out = true;
  207. this.is_lowest = false;
  208. this.is_post = false;
  209. } else {
  210. this.is_out = false;
  211. this.is_lowest = false;
  212. this.is_post = true;
  213. }
  214. if (parseFloat(this.extract).toString() == 'NaN') {
  215. this.is_post = false;
  216. uni.showToast({
  217. title: '输入金额不全',
  218. icon: "none"
  219. });
  220. }
  221. },
  222. //全部提现
  223. getAll() {
  224. this.extract = this.amount;
  225. this.checkMoney();
  226. },
  227. //切换银行卡
  228. switchCard() {
  229. this.selectbankCard = true;
  230. },
  231. arrinput(val) {
  232. console.log(val);
  233. },
  234. async getcardPack() {
  235. let res = await this.$http.post('/userBankCard/queryUserBankCardList', {
  236. userId: this.userInfo.sysUser.userId,
  237. auditStatus: '1'
  238. });
  239. if (res.code == '200' && res.data.records.length) {
  240. res.data.records.map(val => {
  241. let name = this.bankList.find(ele => ele.bankName === val.bankName || ele.bankName
  242. .includes(val.bankName))
  243. if (name) {
  244. val.stylelist = {
  245. ...name
  246. };
  247. } else {
  248. val.stylelist = {
  249. logo: "",
  250. }
  251. }
  252. val.isDefault == 1 ? val.isDefault = true : val.isDefault = false
  253. const resultArray = [];
  254. for (let i = 0; i < val.bankCardNumber.length; i += 4) {
  255. resultArray.push(val.bankCardNumber.substring(i, i + 4));
  256. }
  257. val.bankArray = resultArray;
  258. return val;
  259. })
  260. this.bankCardList = res.data.records;
  261. let bankinfo = res.data.records.find(val => val.isDefault == 1)
  262. if (bankinfo) {
  263. this.bankCardInfo = bankinfo;
  264. } else {
  265. this.bankCardInfo = res.data.records[0]
  266. }
  267. console.log(this.bankCardList);
  268. }
  269. },
  270. }
  271. }
  272. </script>
  273. <style lang="scss" scoped>
  274. .page {
  275. background-color: #f8f8f8;
  276. padding: 20rpx;
  277. box-sizing: border-box;
  278. height: calc(100vh - 88rpx);
  279. }
  280. .account {
  281. padding: 30rpx 20rpx;
  282. box-sizing: border-box;
  283. background-color: #fff;
  284. border-radius: 10rpx;
  285. font-size: 32rpx;
  286. color: #333;
  287. .title {
  288. margin-bottom: 25rpx;
  289. }
  290. .logo {
  291. width: 40rpx;
  292. height: 40rpx;
  293. }
  294. .arrowRight {
  295. width: 22rpx;
  296. height: 22rpx;
  297. margin-left: auto;
  298. }
  299. }
  300. .bankCardview {
  301. padding: 18rpx 40rpx 30rpx;
  302. box-sizing: border-box;
  303. width: 100%;
  304. .view {
  305. margin-bottom: 15rpx;
  306. }
  307. .logo {
  308. width: 40rpx;
  309. height: 40rpx;
  310. margin-right: 20rpx;
  311. margin-top: 3rpx;
  312. }
  313. .CardInfo {
  314. width: 90%;
  315. border-bottom: 1rpx solid #EFEFEF;
  316. padding-bottom: 15rpx;
  317. box-sizing: border-box;
  318. .carTitle {
  319. font-size: 30rpx;
  320. color: #333;
  321. font-weight: bold;
  322. }
  323. .comment {
  324. font-size: 24rpx;
  325. color: #999;
  326. }
  327. }
  328. }
  329. .withdraw-body {
  330. position: relative;
  331. background-color: #fff;
  332. border-radius: 10rpx;
  333. font-size: 28upx;
  334. height: calc(100vh - 344rpx);
  335. margin-top: 20rpx;
  336. }
  337. .withdraw-body .input-money {
  338. display: flex;
  339. align-content: center;
  340. border-bottom: 0.5px solid #eaeef1;
  341. }
  342. .withdraw-body .input-money .rmb {
  343. font-size: 52rpx;
  344. line-height: 1.8;
  345. }
  346. .withdraw-body .input-money .t-input {
  347. height: 1.9em;
  348. font-size: 52rpx;
  349. border: none;
  350. position: relative;
  351. left: 3.5%;
  352. outline: none;
  353. }
  354. .withdraw-body .info-money {
  355. margin-top: 10px;
  356. font-size: 12px;
  357. margin-bottom: 20px;
  358. }
  359. .withdraw-body .info-money-num {
  360. color: rgba(51, 51, 51, 0.6);
  361. font-size: 13px;
  362. }
  363. .withdraw-body .info-money-all {
  364. color: #2D4D89;
  365. }
  366. .withdraw-body .tx button {
  367. color: #b2b2b2;
  368. font-size: 30upx;
  369. }
  370. .withdraw-body .tx-active button {
  371. font-size: 30upx;
  372. color: #fff;
  373. background: #1E85FE;
  374. }
  375. .withdraw .keyboard-item {
  376. box-sizing: border-box;
  377. width: 32.33%;
  378. display: flex;
  379. flex-direction: column;
  380. justify-content: center;
  381. align-items: center;
  382. background: #ffffff;
  383. font-size: 40rpx;
  384. color: #333;
  385. height: 84rpx;
  386. border-top: none;
  387. border-left: none;
  388. border-radius: 4px;
  389. }
  390. .keyboard-item:active {
  391. background-color: #e6e5ea;
  392. }
  393. .withdraw .hide {
  394. opacity: 0;
  395. }
  396. .withdraw .delte {
  397. background: none;
  398. box-shadow: none;
  399. }
  400. .withdraw .delte image {
  401. width: 60rpx;
  402. height: 60rpx;
  403. }
  404. .withdraw .isIphone {
  405. padding-bottom: 68rpx !important;
  406. }
  407. .withdraw .fee em {
  408. font-size: 0.5rem;
  409. font-style: normal;
  410. }
  411. .popup-content .withdrawHeader {
  412. height: 100upx;
  413. background-color: #fff;
  414. color: #666666;
  415. font-size: 32upx;
  416. border-radius: 10upx;
  417. }
  418. .bankLogo {
  419. width: 25px;
  420. height: 25px;
  421. margin-right: 8px;
  422. }
  423. .bankName {
  424. text:first-child {
  425. margin-bottom: 10px;
  426. line-height: 1;
  427. font-weight: bold;
  428. font-size: 16px;
  429. }
  430. text:last-child {
  431. margin-bottom: 20px;
  432. font-size: 12px;
  433. color: #999;
  434. }
  435. }
  436. //自定义键盘
  437. .keyboard {
  438. position: absolute;
  439. bottom: 0;
  440. height: 210px;
  441. width: 100%;
  442. background: #F7F7F7;
  443. margin-top: 20rpx;
  444. padding: 20rpx 0;
  445. .gild {
  446. display: grid;
  447. /* 启用网格布局 */
  448. grid-template-columns: repeat(3, 1fr);
  449. /* 3 列,每列等宽 */
  450. grid-template-rows: auto;
  451. /* 行高自适应 */
  452. row-gap: 20rpx;
  453. /* 只设置行间距(上下) */
  454. column-gap: 20rpx;
  455. /* 列间距设为 0(可选) */
  456. }
  457. .keyboard-item {
  458. background: #ffffff;
  459. font-size: 40rpx;
  460. color: #333;
  461. height: 84rpx;
  462. border-radius: 4px;
  463. display: flex;
  464. align-items: center;
  465. justify-content: center;
  466. }
  467. .Withdrawal {
  468. width: 100%;
  469. height: 310rpx;
  470. background: #FDEA3E;
  471. border-radius: 4px;
  472. text-align: center;
  473. color: #1F1F1F;
  474. font-size: 36rpx;
  475. font-weight: bold;
  476. border: none;
  477. }
  478. }
  479. </style>