withdrawal.vue 11 KB

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