withdrawal.vue 10 KB

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