Commit 8ad6582b by 梁建民

js

parent 82540ce2
<template> <template>
<div id="app"> <div id="app">
<keep-alive exclude="newsDetail,wallet,walletRetrieve,walletDetail,walletRecord,walletStatus"> <keep-alive exclude="newsDetail,wallet,walletRetrieve,walletDetail,walletRecord,walletStatus,walletWithdraw">
<router-view class="router-view"></router-view> <router-view class="router-view"></router-view>
</keep-alive> </keep-alive>
</div> </div>
......
...@@ -38,7 +38,7 @@ const state = { ...@@ -38,7 +38,7 @@ const state = {
//订单信息 //订单信息
orderInfoData: [], orderInfoData: [],
//默认提现可点击(防多次点击) //默认提现可点击(防多次点击)
amountWithdrawFlag: true amountWithdrawFlag: false
} }
const mutations = { const mutations = {
...@@ -79,9 +79,7 @@ const mutations = { ...@@ -79,9 +79,7 @@ const mutations = {
state.amountRechargeID = payload.data state.amountRechargeID = payload.data
}, },
walletWithdraw(state, payload) { walletWithdraw(state, payload) {
debugger
state.amountWithdrawID = payload.data,
state.amountWithdrawFlag = payload.amountWithdrawFlag
}, },
rechargeWithdrawOrderIfo(state, payload) { rechargeWithdrawOrderIfo(state, payload) {
state.rechargeWithdrawOrderDetail = payload.data state.rechargeWithdrawOrderDetail = payload.data
...@@ -91,7 +89,7 @@ const mutations = { ...@@ -91,7 +89,7 @@ const mutations = {
}, },
orderInfo(state, payload) { orderInfo(state, payload) {
state.orderInfoData = payload.data state.orderInfoData = payload.data
}, }
} }
const actions = { const actions = {
...@@ -507,6 +505,8 @@ const actions = { ...@@ -507,6 +505,8 @@ const actions = {
Toast.loading({ Toast.loading({
message: '处理中...' message: '处理中...'
}); });
state.amountWithdrawFlag = true;
Services.walletWithdraw(qs.stringify(params)).then((res) => { Services.walletWithdraw(qs.stringify(params)).then((res) => {
let data = res.data; let data = res.data;
if (data.err_code == 0) { if (data.err_code == 0) {
...@@ -514,24 +514,18 @@ const actions = { ...@@ -514,24 +514,18 @@ const actions = {
message: '提现申请成功,预计1个工作日后到账,节假日顺延,请耐心等待', message: '提现申请成功,预计1个工作日后到账,节假日顺延,请耐心等待',
duration: 2000 duration: 2000
}); });
commit({ setTimeout(() => {
type: 'walletWithdraw', state.amountWithdrawFlag = false;
data: data.data,
amountWithdrawFlag: false
});
setTimeout(function () {
window.location.href = "/h5/view/#/wallet/record"; window.location.href = "/h5/view/#/wallet/record";
}, 2000) }, 2000)
} else { } else {
Toast({ Toast({
message: data.err_msg, message: data.err_msg,
duration: 3000 duration: 2000
});
commit({
type: 'walletWithdraw',
data: data.data,
amountWithdrawFlag: true
}); });
setTimeout(() => {
state.amountWithdrawFlag = false;
}, 2000)
} }
}).catch(function (err) { }).catch(function (err) {
Toast.clear(); Toast.clear();
...@@ -636,7 +630,7 @@ const actions = { ...@@ -636,7 +630,7 @@ const actions = {
}).catch(function (err) { }).catch(function (err) {
}); });
}, }
} }
const getters = {} const getters = {}
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
<p>手机号:{{walletInfoData.safe_mobile}}</p> <p>手机号:{{walletInfoData.safe_mobile}}</p>
</div> </div>
<p class="withdraw-tips"> <p class="withdraw-tips">
<van-icon name="warning-o" class="tips va-m" style="font-size: 16px; margin-right: 0.1rem;"/>提现金额预计1个工作日之后到账,节假日顺延,请耐心等待。 <van-icon name="warning-o" class="tips va-m" style="font-size: 16px; margin-right: 0.1rem;"/>
提现金额预计1个工作日之后到账,节假日顺延,请耐心等待。
</p> </p>
<div class="withdraw-amount"> <div class="withdraw-amount">
<p><em>*</em> 提现金额</p> <p><em>*</em> 提现金额</p>
...@@ -27,82 +28,82 @@ ...@@ -27,82 +28,82 @@
<van-icon v-if="showPassword" name="closed-eye" class="va-m f-r" @click="changeShow"/> <van-icon v-if="showPassword" name="closed-eye" class="va-m f-r" @click="changeShow"/>
<van-icon v-else name="eye-o" class="va-m f-r" @click="changeShow"/> <van-icon v-else name="eye-o" class="va-m f-r" @click="changeShow"/>
</div> </div>
<a href="javascript:;" class="submit" :class="withdrawNum == '' ? 'submitNO' : ''" @click="submit">提交</a> <button :disabled="amountWithdrawFlag" class="submit" :class="withdrawNum == '' || amountWithdrawFlag ? 'submitNO' : ''" @click="submit">提交</button>
</div> </div>
</section> </section>
</template> </template>
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import {mapState} from 'vuex' import {mapState} from 'vuex'
import Header from '@/views/common/Header.vue'; import Header from '@/views/common/Header.vue';
import { Icon,Toast } from 'vant'; import {Icon, Toast} from 'vant';
Vue.use(Icon); Vue.use(Icon);
export default { export default {
name: 'WalletWithdraw', name: 'walletWithdraw',
data() { data() {
return { return {
title: "钱包提现", title: "钱包提现",
meaushow: true, meaushow: true,
showPassword: true, //是否显示密码 showPassword: true, //是否显示密码
amountNum: true, amountNum: true,
password: '', password: '',
withdrawNum: '', withdrawNum: '',
clickFlag: true clickFlag: true
} }
}, },
computed: { computed: {
...mapState({ ...mapState({
walletInfoData: state => state.wallet.walletInfoData, walletInfoData: state => state.wallet.walletInfoData,
amountWithdrawFlag: state => state.wallet.amountWithdrawFlag amountWithdrawFlag: state => state.wallet.amountWithdrawFlag
}) })
}, },
watch: { watch: {
withdrawNum: function(val){ withdrawNum: function (val) {
if (val > this.walletInfoData.wallet_usable) { if (val > this.walletInfoData.wallet_usable) {
this.amountNum = !this.amountNum; this.amountNum = !this.amountNum;
}else{ } else {
this.amountNum = true; this.amountNum = true;
} }
} }
}, },
created() { created() {
this.$store.dispatch({
type: 'getWalletInfo'
});
},
methods: {
changeShow() {
this.showPassword = !this.showPassword;
},
withdraw() {
//全部提现
this.withdrawNum = this.walletInfoData.wallet_usable;
},
submit() {
if (this.withdrawNum !== '') {
if (this.password) {
//提现申请
this.$store.dispatch({ this.$store.dispatch({
type: 'getWalletInfo' type: 'walletWithdraw',
}); amount: this.withdrawNum,
}, pay_password: this.password
methods: { });
changeShow() { } else {
this.showPassword = !this.showPassword; Toast({
}, message: '请输入提现密码'
withdraw() { //全部提现 });
this.withdrawNum = this.walletInfoData.wallet_usable; }
},
submit() {
if(this.withdrawNum !== '' && this.clickFlag){
if(this.password){
this.clickFlag = false;
//提现申请
this.$store.dispatch({
type: 'walletWithdraw',
amount: this.withdrawNum,
pay_password: this.password
});
}else{
Toast({
message: '请输入提现密码'
});
}
}
}
},
components: {
Header
} }
}
},
components: {
Header
} }
}
</script> </script>
<style scoped> <style scoped>
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment