withdraw1.vue 9.6 KB

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