withdrawal.vue 9.8 KB

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