withdrawal.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <template>
  2. <view class="content">
  3. <view class="tishi">
  4. 提示:提现税率为{{suilv}}%
  5. </view>
  6. <view class="row-box">
  7. <view class="could">
  8. <text class="">
  9. 可提现金额
  10. </text>
  11. <text class="num" v-if="money*1 >= 0">
  12. ¥{{ money | getMoneyStyle }}
  13. </text>
  14. <text class="num" v-else>
  15. ¥{{ money*-1 | getMoneyStyle }}(冻结中)
  16. </text>
  17. </view>
  18. <view class="jg"></view>
  19. <view class="sq">
  20. <text class="">
  21. 申请提现金额
  22. </text>
  23. <text class="num">
  24. ¥{{ withdrawal | getMoneyStyle }}
  25. </text>
  26. </view>
  27. <view class="jg"></view>
  28. <view class="row">
  29. <text class="tit">¥</text>
  30. <input class="input" type="number" v-model="withdrawal" :placeholder="'最低提现金额' + minPrice + '元'" placeholder-class="placeholder" />
  31. <view class="buttom" @click="withdrawal = money">全部提现</view>
  32. </view>
  33. <template v-if="withdrawal*1 > 0">
  34. <!-- <view class="sq">
  35. <text class="" style="font-size: 28rpx;">
  36. 手续费
  37. </text>
  38. <text class="num" style="font-size: 28rpx;">
  39. ¥{{ sxf | getMoneyStyle }}
  40. </text>
  41. </view> -->
  42. <view class="sq" >
  43. <text class="" style="font-size: 28rpx;">
  44. 实际到账
  45. </text>
  46. <text class="num" style="font-size: 28rpx;">
  47. ¥{{ sjdz | getMoneyStyle }}
  48. </text>
  49. </view>
  50. </template>
  51. </view>
  52. <view class="list">
  53. <view style="padding-top: 28rpx; font-size: 32rpx; font-weight: 600;color: #4d4d4d;">
  54. 提现到
  55. </view>
  56. <radio-group @change="tabRadio">
  57. <!-- <label>
  58. <view class="box">
  59. <view class="icon iconfont iconweixin1"></view>
  60. <view class="title-box">
  61. <view class="title"><text>提现至微信</text></view>
  62. </view>
  63. <view class="right"><radio value="weixin" color="#ff4c4c" :checked="type == 'weixin'" /></view>
  64. </view>
  65. </label> -->
  66. <!-- <label>
  67. <view class="box">
  68. <view class="icon iconfont iconzhifubao"></view>
  69. <view class="title-box">
  70. <view class="title">
  71. <text v-if="aliData.fullname">提现至支付宝</text>
  72. <text v-else>请创建支付宝账号</text>
  73. </view>
  74. <view class="node">
  75. <text v-if="aliData.fullname">真实姓名({{ aliData.fullname }})</text>
  76. </view>
  77. </view>
  78. <view class="right"><radio value="alipay" color="#ff4c4c" :checked="type == 'alipay'" /></view>
  79. </view>
  80. </label> -->
  81. <label>
  82. <view class="box">
  83. <view class="icon iconfont"><image class="icon-img" src="/static/icon/i8.png" mode="aspectFit"></image></view>
  84. <view class="title-box">
  85. <view class="title">
  86. <text v-if="bankData.code">{{ bankData.bank +'(' + bankData.zhiBank + ')' + ' ' + bankData.code }}</text>
  87. <text v-else>请创建银行账号</text>
  88. </view>
  89. <view class="node">
  90. <text v-if="bankData.name">真实姓名({{ bankData.name }})</text>
  91. </view>
  92. </view>
  93. <view class="right"><radio value="bank" color="#ff4c4c" :checked="type == 'bank'" /></view>
  94. </view>
  95. </label>
  96. </radio-group>
  97. </view>
  98. <button class="add-btn up" @click="confirm">提交申请</button>
  99. <button class="add-btn up" @click="navTo('/pages/money/account')">账号管理</button>
  100. </view>
  101. </template>
  102. <script>
  103. import { getMoneyStyle } from '@/utils/rocessor.js';
  104. import { extractCash, extractBank, aliInfo, bankInfo, } from '@/api/wallet.js';
  105. import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue';
  106. import { getSpreadCount } from '@/api/user.js';
  107. import {
  108. mapState,
  109. mapMutations
  110. } from 'vuex';
  111. export default {
  112. filters: {
  113. getMoneyStyle
  114. },
  115. components: {
  116. uniNoticeBar
  117. },
  118. data() {
  119. return {
  120. // sxf: '0.00',
  121. type: 'alipay', //提现方式
  122. money: '0.00', //可提现金额
  123. freeze: '0.0', //冻结金额
  124. withdrawal: '', //提现金额
  125. minPrice: '', //最少提现金额
  126. suilv:'',
  127. aliData: {},
  128. bankData: {},
  129. // #ifdef H5
  130. weichatBsrowser: false
  131. // #endif
  132. };
  133. },
  134. computed: {
  135. //提现手续费
  136. sxf() {
  137. return (this.withdrawal*1*this.suilv*0.01)
  138. },
  139. //实际到账
  140. sjdz() {
  141. return (this.withdrawal*1*(1-this.suilv*0.01))
  142. },
  143. ...mapState('user',['bankInfo'])
  144. },
  145. onLoad(options) {
  146. // #ifdef H5
  147. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  148. // #endif
  149. //加载提现信息
  150. this.loadData();
  151. // 加载提款账号信息
  152. // this.loadAli();
  153. // this.loadBank();
  154. },
  155. onShow() {
  156. console.log(this.bankInfo,"33333")
  157. this.bankData= this.bankInfo
  158. },
  159. methods: {
  160. // 更新数据
  161. dataUp(){
  162. this.loadAli();
  163. this.loadBank();
  164. },
  165. //加载数据
  166. async loadAli(source) {
  167. aliInfo({}).then(e => {
  168. this.aliData = e.data;
  169. });
  170. },
  171. // 加载银行卡信息
  172. async loadBank() {
  173. bankInfo({}).then(e => {
  174. // this.bankData = e.data;
  175. console.log(this.bankData,'银行卡信息');
  176. });
  177. },
  178. // 加载余额信息
  179. async loadData() {
  180. // spreadInfo().then( ({data}) => {
  181. // console.log(data,"spreadInfo++++++++++++++++++")
  182. // this.money = data.brokerage_price//可提现余额
  183. // this.minPrice = data.user_extract_min//最小提现
  184. // this.freeze = data.lock_brokerage//冻结金额
  185. // })
  186. // getSpreadCount({}, 3).then(({ data }) => {
  187. // console.log(data);
  188. // this.money = data.count;
  189. // });
  190. extractBank({}).then(({ data }) => {
  191. this.money = data.commissionCount;//可提现余额
  192. this.suilv = data.commission//税率
  193. console.log(this.money)
  194. this.minPrice = data.minPrice;//最小提现
  195. this.freeze =data.inmoneyCount//提现中的余额
  196. });
  197. },
  198. // 跳转
  199. navTo(url) {
  200. uni.navigateTo({
  201. url: url
  202. });
  203. },
  204. // 切换选中对象
  205. tabRadio(e) {
  206. this.type = e.detail.value;
  207. },
  208. // 提交
  209. confirm() {
  210. console.log(this.withdrawal,this.money)
  211. if(+this.withdrawal == 0) {
  212. return this.$api.msg('请输入提现金额')
  213. }
  214. if(+this.withdrawal < +this.minPrice){
  215. return this.$api.msg('提现金额不足最低提现金额')
  216. }
  217. if(+this.withdrawal > +this.money){
  218. return this.$api.msg('可提现佣金不足')
  219. }
  220. let data = {
  221. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  222. money: this.withdrawal, //金额
  223. money_type: 0//0佣金1余额
  224. }
  225. if (this.type=='alipay') {
  226. data.name = this.aliData.fullname;
  227. data.alipay_code = this.aliData.alino;
  228. if(!data.name){
  229. return this.$api.msg('请完善账户名称')
  230. }
  231. if(!data.alipay_code){
  232. return this.$api.msg('请完善支付宝账号')
  233. }
  234. }
  235. if (this.type=='bank') {
  236. data.name = this.bankData.name;
  237. data.bankname = this.bankData.bank + '(' + this.bankData.zhiBank + ')';
  238. data.cardnum = this.bankData.code;
  239. if(!data.name) {
  240. return this.$api.msg('请完善银行卡信息')
  241. }
  242. if(!data.bankname) {
  243. return this.$api.msg('请完善银行卡信息')
  244. }
  245. if(!data.cardnum) {
  246. return this.$api.msg('请完善银行卡信息')
  247. }
  248. }
  249. extractCash(data)
  250. .then(e => {
  251. uni.showToast({
  252. title: '提交成功',
  253. duration: 2000,
  254. position: 'top'
  255. });
  256. })
  257. .catch(e => {
  258. console.log();
  259. });
  260. }
  261. }
  262. };
  263. </script>
  264. <style lang="scss">
  265. page {
  266. height: 100%;
  267. }
  268. .content-money {
  269. padding: 30rpx 0;
  270. background: #ffffff;
  271. }
  272. .flex {
  273. background-color: #ffffff;
  274. text-align: center;
  275. margin: 0 30rpx;
  276. border-radius: $border-radius-sm;
  277. justify-content: space-between;
  278. flex-direction: row;
  279. .buttom {
  280. font-size: $font-lg;
  281. width: 50%;
  282. }
  283. .interval {
  284. width: 2px;
  285. height: 60rpx;
  286. background-color: #eeeeee;
  287. }
  288. .icon {
  289. background-size: 100%;
  290. font-size: 42rpx;
  291. color: $font-color-dark;
  292. font-weight: bold;
  293. background-repeat: no-repeat;
  294. background-position: center;
  295. }
  296. .text {
  297. color: $font-color-light;
  298. }
  299. }
  300. .row-box {
  301. // margin-top: 30rpx;
  302. padding: 20rpx 30rpx;
  303. background: #fff;
  304. .title {
  305. font-size: $font-base + 2rpx;
  306. color: $font-color-dark;
  307. }
  308. .row {
  309. display: flex;
  310. align-items: center;
  311. position: relative;
  312. height: 80rpx;
  313. .tit {
  314. flex-shrink: 0;
  315. width: 40rpx;
  316. font-size: 30rpx;
  317. color: $font-color-dark;
  318. }
  319. .input {
  320. flex: 1;
  321. font-size: 30rpx;
  322. color: $font-color-dark;
  323. }
  324. .iconlocation {
  325. font-size: 36rpx;
  326. color: $font-color-light;
  327. }
  328. .buttom {
  329. // color: $font-color-spec;
  330. color: #f34358;
  331. font-size: $font-base;
  332. }
  333. }
  334. }
  335. .add-btn {
  336. &.modified {
  337. color: $base-color;
  338. }
  339. &.up {
  340. background-color: $base-color;
  341. color: #fff;
  342. }
  343. display: flex;
  344. align-items: center;
  345. justify-content: center;
  346. width: 690rpx;
  347. height: 80rpx;
  348. margin: 0 auto;
  349. margin-top: 30rpx;
  350. font-size: $font-lg;
  351. border-radius: 10rpx;
  352. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  353. }
  354. .list {
  355. padding-left: 30rpx;
  356. margin-top: 30rpx;
  357. background-color: #ffffff;
  358. .box {
  359. display: flex;
  360. align-items: center;
  361. width: 100%;
  362. padding:0 21rpx ;
  363. height: 120rpx;
  364. border-bottom: 1px solid $border-color-light;
  365. .icon {
  366. font-size: 48rpx;
  367. padding-right: 20rpx;
  368. .icon-img {
  369. height: 50rpx;
  370. width: 50rpx;
  371. }
  372. }
  373. .iconweixin1 {
  374. color: #18bf16;
  375. }
  376. .iconzhifubao {
  377. color: #08aaec;
  378. }
  379. .title-box {
  380. flex-grow: 1;
  381. text-align: left;
  382. .title {
  383. font-size: $font-base + 2rpx;
  384. color: $font-color-base;
  385. }
  386. .node {
  387. font-size: $font-sm;
  388. color: $font-color-light;
  389. }
  390. }
  391. }
  392. }
  393. /deep/ .uni-radio-input {
  394. width: 45rpx;
  395. height: 45rpx;
  396. }
  397. .could, .sq {
  398. height: 110rpx;
  399. font-size: 32rpx;
  400. font-weight: 600;
  401. color: #333333;
  402. line-height: 110rpx;
  403. display: flex;
  404. justify-content: space-between;
  405. .num {
  406. font-size: 40rpx;
  407. font-weight: bold;
  408. color: #333333;
  409. // line-height: 46px;
  410. }
  411. }
  412. .jg {
  413. width: 100%;
  414. height: 1px;
  415. background-color: #E6E6E6;
  416. }
  417. .tishi {
  418. padding:10rpx 30rpx;
  419. font-size: 28rpx;
  420. color: #eb8a31;
  421. }
  422. </style>