|
|
- <!-- 提现页面 -->
- <template>
- <view class="withdraw bx">
- <navbar :leftClick="leftClick" :title="$t('page.withdraw.title')"></navbar>
-
- <!-- 用户余额信息 -->
- <view class="user-money content">
- <view class="title">{{ $t('page.purse.account') }}</view>
- <view class="money">
- <view class="money-unit">{{ $t('page.withdraw.unit') }}</view>
- <view class="money-detail">{{ money }}</view>
- </view>
- </view>
-
- <view class="withdraw-amount content">
- <view class="withdraw-title">{{ $t('page.withdraw.withdraw-amount')}}</view>
- <view class="withdraw-content">{{ $t('page.withdraw.withdraw-descript')}}</view>
- </view>
-
- <!-- 输入框组 -->
- <view class="inputs content">
- <view class="input-item">
- <view class="input-top">
- <view class="title">{{ $t('page.withdraw.withdraw-amount') }}</view>
- <view @click="withdrawAll" class="all">{{ $t('page.withdraw.withdrawal-all') }}</view>
- </view>
- <input v-model="form.money" type="number" :placeholder="$t('page.withdraw.deposit-now')"/>
- </view>
-
- <view class="input-item">
- <view class="input-top">
- <view class="title">{{ $t('page.withdraw.pin') }}</view>
- </view>
- <input v-model="form.payPass" type="text"/>
- </view>
- </view>
-
- <!-- 提交按钮 -->
- <view @click="withdraw" class="submit content">{{ $t('page.withdraw.submit') }}</view>
-
- <!-- 超出最大提现金额提示 -->
- <view v-if="showModal" class="modal">
- <view class="modal-main">
- <view class="title">{{ $t('page.withdraw.warn') }}</view>
- <view class="tip">{{ $t('page.withdraw.warn-detail') }}</view>
- <view @click="showModal = false;$play()" class="ok">{{ $t('page.withdraw.ok') }}</view>
- </view>
- </view>
-
- <!-- 客服列表 -->
- <serviceList :show="showService" :serverList="serverList" @close="closeServiceList"></serviceList>
- </view>
- </template>
-
- <script>
- import navbar from '@/components/base/m-navbar.vue'
- import serviceList from '@/components/serviceList/serviceList.vue';
-
- export default {
- components: {
- navbar
- },
- data() {
- return {
- money : '',
- form : {
- money : '', //提现金额
- payPass : ''
- },
- vipInfo : {},
- showModal : false, //是否显示超出最大提现金额提示
- serverList : [],
- showService : false
- }
- },
- onShow() {
- this.getUserInfo()
- this.forgetPass()
- },
- methods: {
-
- leftClick() {
- uni.navigateTo({
- url: '/pages/home/home'
- })
- },
-
- //获取用户信息
- getUserInfo(){
- this.request('userInfo').then(res => {
- if(res.code == 200){
- this.money = res.result.userInfo.money
- this.vipInfo = res.result.vip
- }
- })
- },
-
- //点击提现全部按钮
- withdrawAll(){
- this.$play()
- if(!this.money){
- return uni.$u.toast(this.$t('page.withdraw.noBalance'))
- }
- this.form.money = this.money
- },
-
- //提现
- withdraw(){
- this.$play()
- let { money , payPass } = this.form;
- if(money <= 0){
- return uni.$u.toast(this.$t('page.withdraw.creditLimit'))
- }
- // if(money > this.vipInfo.maxPrice){ //提现金额大于当前vip等级最大提现金额(后端给了提示,使用toast展示去了)
- // return this.showModal = true
- // }
- if(money > this.money){ //用户提现金额大于用户余额
- return uni.$u.toast(this.$t('page.withdraw.insufficientBalance'))
- }
- if(payPass.trim() == ''){
- return uni.$u.toast(this.$t('page.withdraw.payPassEmpty'))
- }
- this.request('withdrawal',{},this.form).then(res => {
- if(res.code == 200){
- uni.$u.toast(this.$t('page.withdraw.successfulWithdrawal'))
- this.cleanForm()
- this.revealServiceList()
- this.getUserInfo() //刷新用户信息(更新用户余额)
- }
- })
- },
-
- //显示客服列表
- revealServiceList(){
- this.$play()
- this.showService = true;
- },
-
- //关闭客服列表
- closeServiceList(){
- this.showService = false;
- },
-
- //忘记密码(获取客服列表)
- forgetPass(){
- this.request('forgetPass').then(res => {
- if(res.code == 200){
- this.serverList = res.result
- }
- })
- },
-
- //清空表单数据
- cleanForm(){
- this.form = {}
- }
- }
- }
- </script>
-
- <style lang="scss" scoped>
- .withdraw {
- width: 750rpx;
- min-height: 100vh;
- background-color: black;
- margin: 0 auto;
- background-image: url('@/static/withdraw/bg.png');
- background-size: 100%;
- background-repeat: no-repeat;
-
- .content {
- width: 96%;
- margin: 0 auto;
- }
-
- .user-money {
- background: rgba(176, 199, 59, .8);
- margin: 20rpx auto 30rpx auto;
- border: 4rpx solid #D3EA5E;
- padding: 60rpx 0rpx;
- font-size: 36rpx;
-
- .title,
- .money {
- display: flex;
- justify-content: center;
- align-items: center;
- height: 60rpx;
-
- .money-unit {
- margin-right: 15rpx;
- font-size: 28rpx;
- font-weight: bold;
- }
-
- .money-detail{
- font-size: 50rpx;
- font-weight: bold;
- }
- }
- }
-
- .withdraw-amount{
- color: #D3EA5E;
-
- .withdraw-title{
- font-size: 28rpx;
- font-weight: bold;
- margin-bottom: 20rpx;
- }
-
- .withdraw-content{
- color: white;
- font-size: 24rpx;
- }
- }
-
- .inputs{
-
- .input-item{
- margin-top: 35rpx;
- .input-top{
- display: flex;
- justify-content: space-between;
-
- .title{
- font-size: 28rpx;
- font-weight: bold;
- color: #D3EA5E;
- }
-
- .all{
- background: #D3EA5E;
- padding: 5rpx 10rpx;
- border-radius: 10rpx;
- font-size: 20rpx;
- }
- }
-
- input{
- border: 1px solid #B0C73B;
- height: 80rpx;
- margin-top: 20rpx;
- text-indent: 1em;
- color: #B0C73B;
- border-radius: 10rpx;
- }
- }
- }
-
- .submit{
- height: 90rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- background: #B0C73B;
- border-radius: 10rpx;
- font-size: 40rpx;
- font-weight: bold;
- margin-top: 30rpx;
- }
-
- .modal{
- display: flex;
- align-items: center;
- justify-content: center;
- position: fixed;
- left: 0;
- top: 0;
- width: 750rpx;
- height: 100vh;
-
- .modal-main{
- width: 600rpx;
- background: black;
- border-radius: 10rpx;
- color: #ccc;
- border: 1px solid #ccc;
-
- .title{
- text-align: center;
- font-size: 36rpx;
- color: #afc638;
- font-weight: bold;
- padding: 20rpx 0rpx;
- }
-
- .tip{
- box-sizing: border-box;
- padding: 0rpx 20rpx;
- margin-bottom: 20rpx;
- }
-
- .ok{
- height: 90rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- background: black;
- border-radius: 10rpx;
- font-size: 40rpx;
- font-weight: bold;
- border-top: 1px solid #ffffff80;
- }
- }
- }
- }
- </style>
|