withdraw1.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <template>
  2. <view class="withdraw">
  3. <!-- 公共组件-每个页面必须引入 -->
  4. <public-module></public-module>
  5. <view class="withdraw-head d-flex a-center">
  6. <view class="withdraw-head-to">到账渠道</view>
  7. <view class="withdraw-head-way" style="color:#576B95">{{userInfo.esmUserInternal.bankname}} ({{userInfo.esmUserInternal.accountno.substring(userInfo.esmUserInternal.accountno.length - 4)}})</view>
  8. </view>
  9. <view style="color: #ACACAC;background-color: #F7F7F7;padding: 5upx 60upx;">注:仅支持整数,72小时内到账</view>
  10. <view class="withdraw-body">
  11. <text>提现金额</text>
  12. <view class="input-money">
  13. <text class="rmb">¥</text>
  14. <input disabled v-model.number="extract" type="text" @focus.prevent="stopKeyborad" class="t-input" />
  15. </view>
  16. <view class="info-money">
  17. <view v-if="is_out">
  18. <text class="info-money-num" style="color: #ff1e0f;">输入金额超过可提现余额,账户余额{{ pool }}元</text>
  19. </view>
  20. <view v-else-if="is_lowest">
  21. <text class="info-money-num" style="color: #ff1e0f;">最低{{ lowest }}元起提现,账户余额{{ pool }}元</text>
  22. </view>
  23. <view v-else>
  24. <text class="info-money-num">当前可提现余额{{ pool }}元,</text>
  25. <text class="info-money-all" @click="getAll">全部提现</text>
  26. </view>
  27. </view>
  28. <view :class="'tx' + (is_post ? '-active' : '')"><button type="default" @click="handleShowModel">提现</button></view>
  29. </view>
  30. <view :class="['keyboard', keyboradShow ? '' : 'active', isIphoneX ? 'isIphone' : '']">
  31. <block v-for="(item, index) in 9" :key="index">
  32. <view class="keyboard-item" @tap="keyboradKey(index + 1)">{{ index + 1 }}</view>
  33. </block>
  34. <view class="keyboard-item hide"></view>
  35. <view class="keyboard-item" @tap="keyboradKey(0)"><text>0</text></view>
  36. <view class="keyboard-item delte" @tap="keyboradDel()"><image class="img" src="/static/common/del.png" mode="aspectFill" :lazy-load="true"></image></view>
  37. </view>
  38. <wyb-popup ref="withdrawPopup" type="center" height="480" width="680" radius="6" :maskClickClose="false" >
  39. <view class="popup-content">
  40. <view class="withdrawHeader d-flex a-center j-center">提现确认</view>
  41. <view class="withdrawBody">
  42. <view>
  43. <text>提现金额:</text>
  44. <text class="text-red">{{ money }}元</text>
  45. </view>
  46. <view class="margin-top-sm">
  47. <text>实际到账:</text>
  48. <text class="text-red">{{ real_money }}元</text>
  49. </view>
  50. <view class="margin-top-sm">
  51. <text>服务费:</text>
  52. <text class="text-red">{{ service_fee }}元</text>
  53. </view>
  54. <view class="margin-top-sm">
  55. <text>服务费率:</text>
  56. <text class="text-red">{{ fee }}%</text>
  57. </view>
  58. </view>
  59. <view class="withdrawFooter d-flex a-center j-end"><view class="d-flex a-center j-center" @tap="closeWithdrawPopup">我再想想</view><view class="d-flex a-center j-center" @tap="getMoney">确认提现</view></view>
  60. </view>
  61. </wyb-popup>
  62. </view>
  63. </template>
  64. <script>
  65. import {mapState} from "vuex"
  66. import wybPopup from '@/components/common/wyb-popup/wyb-popup.vue'
  67. export default {
  68. components: {
  69. wybPopup
  70. },
  71. computed:{
  72. ...mapState(['userInfo'])
  73. },
  74. data() {
  75. return {
  76. lowest: 0, //最低提现金额
  77. fee: 0, //提现费率
  78. pool: 0, //可提现余额
  79. extract: '', //选择的提现金额
  80. service_fee: 0.0,//提现服务费
  81. showModal: false,
  82. is_out: false,
  83. is_lowest: false,
  84. is_post: false,
  85. money: '', //提现金额
  86. real_money: '', //实际到账
  87. keyboradShow: false,
  88. isIphoneX: false,
  89. isRefuse: false
  90. };
  91. },
  92. watch: {
  93. extract(oldVal, newVal) {}
  94. },
  95. async onLoad() {
  96. await this.getPayAccount();//获取可提现余额
  97. this.loadData();
  98. },
  99. methods: {
  100. // 可提现余额查询
  101. async getPayAccount() {
  102. let res = await this.$http.get('/insPayApply/extendAccount?userid=' + this.userInfo.sysUser.id);
  103. this.pool = res.data.accountBalance;
  104. },
  105. showWithdrawPopup(){
  106. this.$refs.withdrawPopup.show() // 显示
  107. },
  108. closeWithdrawPopup(){
  109. this.$refs.withdrawPopup.hide() // 显示
  110. },
  111. loadData() {
  112. this.lowest = 10;
  113. this.fee = "0";
  114. // this.pool = "136.5";
  115. this.$nextTick(() => {
  116. this.keyboradShow = true;
  117. });
  118. },
  119. stopKeyborad() {
  120. uni.hideKeyboard();
  121. },
  122. keyboradKey(key) {
  123. this.extract = this.extract * 10 + key;
  124. this.checkMoney();
  125. },
  126. keyboradDel() {
  127. if (this.extract && this.extract > 0) {
  128. let val = parseInt(this.extract / 10);
  129. if (val == 0) val = '';
  130. this.extract = val;
  131. this.checkMoney();
  132. }
  133. },
  134. getAll() {
  135. this.extract = parseInt(this.pool);
  136. this.checkMoney();
  137. },
  138. checkMoney() {
  139. if (!this.extract || this.extract < this.lowest) {
  140. this.is_lowest = true;
  141. this.is_post = false;
  142. } else if (this.extract > this.pool) {
  143. this.is_out = true;
  144. this.is_lowest = false;
  145. this.is_post = false;
  146. } else {
  147. this.is_out = false;
  148. this.is_lowest = false;
  149. this.is_post = true;
  150. }
  151. if (parseFloat(this.extract).toString() == 'NaN') {
  152. this.is_post = false;
  153. uni.showToast({ title: '输入金额不合法', icon:"none" });
  154. }
  155. },
  156. handleShowModel() {
  157. if (this.isRefuse) return;
  158. this.checkMoney();
  159. if (!this.is_post) return;
  160. this.money = this.extract;
  161. this.service_fee = Number((this.extract * (this.fee / 100)).toString().match(/^\d+(?:\.\d{0,2})?/));
  162. this.real_money = Number((this.extract - this.service_fee).toString().match(/^\d+(?:\.\d{0,2})?/));
  163. this.showWithdrawPopup();
  164. },
  165. async getMoney() {
  166. this.closeWithdrawPopup();
  167. if (this.isRefuse) return;
  168. this.isRefuse = true;
  169. let res = await this.$http.post('/insPayApply/extendApply?amount='+ this.real_money +'&userid=' + this.userInfo.sysUser.id);
  170. uni.showToast({ title: '提现申请已提交,等待管理员处理', icon:"none",duration:2000 });
  171. setTimeout(() => {
  172. uni.navigateBack();
  173. }, 2000);
  174. }
  175. },
  176. async onPullDownRefresh() {
  177. this.extract = '';
  178. await this.getPayAccount();
  179. this.loadData();
  180. this.is_out = false;
  181. this.is_lowest = false;
  182. this.is_post = false;
  183. setTimeout(function() {
  184. uni.stopPullDownRefresh();
  185. }, 500);
  186. }
  187. };
  188. </script>
  189. <style scoped>
  190. page {
  191. background-color: #ededed;
  192. }
  193. .withdraw{
  194. padding: 20px;
  195. background-color: #ededed;
  196. position:absolute;
  197. width: 100%;
  198. height: 100%;
  199. box-sizing: border-box;
  200. }
  201. .withdraw-head{
  202. background-color: #f7f7f7;
  203. display: flex;
  204. align-content: center;
  205. padding: 10px 30px;
  206. font-size: 14px;
  207. }
  208. .withdraw-head-way{
  209. display: flex;
  210. flex-direction: column;
  211. align-content: center;
  212. margin-left: 20px;
  213. }
  214. .withdraw-head-way-1{
  215. color: #576b95;
  216. margin-bottom: 10px;
  217. }
  218. .withdraw-head-way-1 .way-icon{
  219. width: 16px;
  220. height: 16px;
  221. margin-right: 5px;
  222. top: 2px;
  223. }
  224. .withdraw-head-way-2{
  225. color: #acacac;
  226. font-size: 12px;
  227. }
  228. .withdraw-body{
  229. background-color: #fff;
  230. padding: 20px 30px;
  231. font-size: 28upx;
  232. }
  233. .withdraw-body .input-money{
  234. display: flex;
  235. align-content: center;
  236. font-weight: 600;
  237. border-bottom: 0.5px solid #eaeef1;
  238. }
  239. .withdraw-body .input-money .rmb{
  240. font-size: 2em;
  241. top: 10px;
  242. position: relative;
  243. }
  244. .withdraw-body .input-money .t-input{
  245. height: 1.9em;
  246. font-size: 2.5em;
  247. border: none;
  248. position: relative;
  249. left: 3.5%;
  250. outline: none;
  251. }
  252. .withdraw-body .info-money{
  253. margin-top: 10px;
  254. font-size: 12px;
  255. margin-bottom: 20px;
  256. }
  257. .withdraw-body .info-money-num{
  258. color: #b2b2b2;
  259. }
  260. .withdraw-body .info-money-all{
  261. color: #576b95;
  262. }
  263. .withdraw-body .tx button{
  264. color: #b2b2b2;
  265. font-size: 30upx;
  266. }
  267. .withdraw-body .tx-active button{
  268. font-size: 30upx;
  269. color: #fff;
  270. background: #1E85FE;
  271. }
  272. .withdraw .keyboard{
  273. position: fixed;
  274. bottom: 0;
  275. left: 0;
  276. width: 100%;
  277. background: #ebebeb;
  278. display: flex;
  279. justify-content: center;
  280. z-index: 2;
  281. flex-wrap: wrap;
  282. transition: all 0.2s ease-in 0.2s;
  283. }
  284. .withdraw .active {
  285. bottom: -400rpx;
  286. }
  287. .withdraw .keyboard-item {
  288. box-sizing: border-box;
  289. width: 250rpx;
  290. display: flex;
  291. flex-direction: column;
  292. justify-content: center;
  293. align-items: center;
  294. background: #fff;
  295. font-size: 40rpx;
  296. color: #333;
  297. height: 99rpx;
  298. border: 1rpx solid #ebebeb;
  299. border-top: none;
  300. border-left: none;
  301. }
  302. .withdraw .hide {
  303. opacity: 0;
  304. }
  305. .withdraw .delte {
  306. background: none;
  307. box-shadow: none;
  308. }
  309. .withdraw .delte image {
  310. width: 60rpx;
  311. height: 60rpx;
  312. }
  313. .withdraw .isIphone {
  314. padding-bottom: 68rpx !important;
  315. }
  316. .withdraw .fee em {
  317. font-size: 0.5rem;
  318. font-style: normal;
  319. }
  320. .popup-content .withdrawHeader{
  321. height: 100upx;
  322. background-color: #fff;
  323. color: #666666;
  324. font-size: 32upx;
  325. border-radius: 10upx;
  326. }
  327. .popup-content .withdrawBody{
  328. height: 220upx;
  329. padding: 25upx;
  330. background-color: #F8F8F8;
  331. }
  332. .popup-content .withdrawBody view>text:nth-of-type(1){
  333. font-size: 26upx;
  334. }
  335. .popup-content .withdrawBody view.margin-top-sm {
  336. margin-top: 10upx;
  337. }
  338. .popup-content .withdrawBody .text-red{
  339. color: #E54D42;
  340. }
  341. .popup-content .withdrawFooter{
  342. height: 120upx;
  343. }
  344. .popup-content .withdrawFooter view{
  345. width: 120upx;
  346. height: 70upx;
  347. margin: 0upx 30upx;
  348. border-radius: 10upx;
  349. padding: 0upx 15upx;
  350. }
  351. .popup-content .withdrawFooter view:nth-of-type(1){
  352. background-color: #f0f0f0;
  353. }
  354. .popup-content .withdrawFooter view:nth-of-type(2){
  355. background-color: #1E85FE;
  356. color: #FFFFFF;
  357. }
  358. </style>