withdrawal.vue 9.3 KB

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