| | |
| | | export default { |
| | | data() { |
| | | return { |
| | | money: null, |
| | | balance: null, |
| | | userInfo: {} |
| | | money: null |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters(['userInfo', 'identity']), |
| | | balance() { |
| | | if (this.identity == 'worker') { |
| | | // if (this.identity == 'worker') { |
| | | if (this.userInfo.userWorker) { |
| | | return this.$common.moneySub(this.userInfo.userWorker.tiXianZonge, this.userInfo |
| | | .userWorker |
| | |
| | | } else { |
| | | return '0.00' |
| | | } |
| | | } else { |
| | | if (this.userInfo.userCompany) { |
| | | return this.userInfo.userCompany.chongZhiYue ? this.userInfo.userCompany |
| | | .chongZhiYue : |
| | | '0.00' |
| | | } else { |
| | | return '0.00' |
| | | } |
| | | } |
| | | // } else { |
| | | // if (this.userInfo.userCompany) { |
| | | // return this.userInfo.userCompany.chongZhiYue ? this.userInfo.userCompany |
| | | // .chongZhiYue : |
| | | // '0.00' |
| | | // } else { |
| | | // return '0.00' |
| | | // } |
| | | // } |
| | | } |
| | | }, |
| | | onLoad() {}, |
| | |
| | | ...mapActions([ |
| | | 'getUserInfo' |
| | | ]), |
| | | stringToNumber(str) { |
| | | const match = str.match(/[\d.]+/); // 正则表达式匹配数字和点 |
| | | if (match) { |
| | | return parseFloat(match[0]); // 使用parseFloat转换 |
| | | } |
| | | return 0; // 如果没有匹配到数字,返回NaN |
| | | }, |
| | | GetTransferMoney() { |
| | | if (!this.money) { |
| | | this.$util.showToast({ |
| | |
| | | }); |
| | | return false |
| | | } |
| | | if (this.money > this.balance) { |
| | | if (this.money < 0.3) { |
| | | this.$util.showToast({ |
| | | title: "最低提现0.3元!", |
| | | icon: 'error' |
| | | }); |
| | | return false |
| | | } |
| | | if (this.stringToNumber(this.money) > this.stringToNumber(this.balance)) { |
| | | this.$util.showToast({ |
| | | title: "输入金额大于可提现金额!" |
| | | }); |
| | |
| | | this.$api.GetTransferMoney(this.money).then(res => { |
| | | if (res.code == 1) { |
| | | this.$util.showToast({ |
| | | title: '提现成功!’', |
| | | title: '提现成功!', |
| | | }); |
| | | this.money = null |
| | | this.getUserInfo() |
| | | } else { |
| | | this.$util.showToast({ |