123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318 |
- <template>
- <block>
- <view class="content">
- <view class="cashInfo">
- <view class="cTitle">提现金额</view>
- <view class="cPrice" style="font-size: 24rpx;">
- <view>
- 可提现金额
- <text class="cWeight">{{ info.money }}</text>
- 元
- </view>
- <view @tap="cashAll">全部提现</view>
- </view>
- </view>
- <view class="cInput">
- <view>¥</view>
- <input type="number" @input="cashinput" placeholder="请输入提现金额" placeholder-class="placeClass"
- :value="cashmoney" />
- </view>
- {{lessMoney}}
- {{realMoney}}
- <view class="cItem">
- <view class="cTip">
- <view>到账银行卡:</view>
- </view>
- <picker v-if="banklist.length" mode="selector" @change="bindBankConfirm" range-key="showtitle"
- :value="bankindex" :range="banklist">
- <view class="cNum fweigh">{{ bankTitle ? bankTitle : '请选择提现银行卡' }}</view>
- </picker>
- <view class="cNum fweigh" v-else @tap="toPage" data-url="/pages/Withdrawal/addbank" :data-type="type">
- {{ bankTitle ? bankTitle : '请先添加银行卡' }}</view>
- <image v-if="banklist.length"
- src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/3c95e397fd285160c474c52ed2e3e4d1.png"
- mode="widthFix" class="leftArrow"></image>
- </view>
- </view>
- <view class="btn" @tap="confirm">立即提现</view>
- </block>
- </template>
- <script>
- var app = getApp();
- var loading = false;
- export default {
- data() {
- return {
- info: {
- money: ''
- },
- cashmoney: '',
- banklist: [],
- bankindex: 0,
- bankTitle: '',
- name: '',
- lessMoney:0,
- realMoney:0
-
- };
- },
- onLoad: function(e) {},
- onShow() {
- this.getinfo();
- this.getbank();
- },
- onPullDownRefresh: function() {},
- onReachBottom: function() {},
- methods: {
- async confirm() {
- var that = this;
- if (!this.cashmoney) {
- uni.showToast({
- title: '请先填写提现金额',
- icon: 'none'
- });
- return false;
- }
- if (!this.bankTitle) {
- uni.showToast({
- title: '请先选择银行卡',
- icon: 'none'
- });
- return false;
- }
-
-
- let result = await this.$api.request('/withdraw/add', 'POST', {money:that.cashmoney,bid:that.banklist[that.bankindex].id});
- console.log(result)
- if (result) {
- this.$api.msg('添加成功');
- uni.redirectTo({
- url:'/pages/wallet/index'
- })
-
- }
-
- },
- bindBankConfirm(e) {
- console.log(e);
- this.bankindex = e.detail.value,
- this.bankTitle = this.banklist[e.detail.value].showtitle
- },
- async getbank() {
- var that = this;
- let res = await this.$api.request('/bank/index', 'GET', {
- page: 1,
- pagesize: 20
- });
- console.log(res)
- if (res) {
- if (res.length > 0) {
- res.map(function(item) {
- return item.showtitle = item.bank + '(' + item.card.substr(item.card.length - 4) +
- ')'
- })
- this.banklist = this.banklist.concat(res);
- this.page++;
- } else {
- this.loaded = true
- this.$api.msg('没有更多数据');
- }
- }
- },
- toPage(e) {
- app.globalData.toPage(e);
- },
- cashAll() {
- this.cashmoney = this.info.money
- },
- cashinput(e) {
- this.cashmoney = e.detail.value
- },
- async getinfo() {
- let data = await this.$api.request('/wallet/index');
- console.log(data)
- this.info = data;
- },
- }
- };
- </script>
- <style>
- page {
- background: #f4f5f9;
- }
- .content {
- padding: 36rpx 44rpx 0;
- background: #fff;
- }
- .cashInfo {
- display: flex;
- align-items: center;
- padding-bottom: 60rpx;
- justify-content: space-between;
- }
- .cTitle {
- font-size: 28rpx;
- font-weight: 700;
- }
- .cPrice {
- display: flex;
- align-items: center;
- }
- .cPrice>view:nth-child(2) {
- color: #253f8e;
- margin-left: 30rpx;
- }
- .cWeight {
- font-weight: 700;
- font-size: 30rpx;
- }
- .cInput {
- display: flex;
- align-items: center;
- padding-bottom: 30rpx;
- border-bottom: 1px solid #e4e5ee;
- }
- .cInput>view {
- font-size: 54rpx;
- color: #011b33;
- font-weight: 700;
- }
- .cInput>input {
- font-size: 54rpx;
- color: #011b33;
- font-weight: 700;
- }
- .placeClass {
- font-size: 35rpx;
- font-weight: 500;
- padding-left: 40rpx;
- }
- .cItem {
- padding: 30rpx 0;
- border-bottom: 1px solid #e4e5ee;
- display: flex;
- align-items: center;
- position: relative;
- }
- .cItem:last-child {
- border-bottom: none;
- }
- .cTip>view:nth-child(1) {
- font-size: 28rpx;
- }
- .cTip>view:nth-child(2) {
- margin-top: 8rpx;
- color: #ff4c34;
- font-size: 22rpx;
- }
- .cNum {
- margin-left: 40rpx;
- font-size: 36rpx;
- }
- .fweigh {
- font-size: 28rpx;
- font-weight: 700;
- }
- .leftArrow {
- position: absolute;
- right: 0;
- width: 14rpx;
- }
- .btn {
- width: 614rpx;
- height: 88rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- background: linear-gradient(to right, #F8A52B, #F8C657);
- color: #fff;
- font-size: 30rpx;
- border-radius: 40rpx;
- margin: 72rpx auto;
- }
- picker {
- flex: 1;
- }
- view {
- font-size: 24rpx;
- }
- </style>
|