withdrawal.vue 9.3 KB

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