withdrawal.vue 11 KB

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