withdrawal.vue 11 KB

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