withdrawal.vue 9.5 KB

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