withdrawal.vue 11 KB

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