withdrawal.vue 9.5 KB

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