|
|
|
@ -39,79 +39,96 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import putMoney from "../models/put-money-model.js"; |
|
|
|
import { Alert,Toast } from 'vux' |
|
|
|
import configs from '../configs'; |
|
|
|
var locationUrl = configs.locationUrl; |
|
|
|
export default{ |
|
|
|
data() { |
|
|
|
return { |
|
|
|
//提现金额验证提示 |
|
|
|
inputCue : '(请输入整数金额)', |
|
|
|
//默认一开始输入款的值不符合验证规则 |
|
|
|
isActive:false, |
|
|
|
inputVal: null, |
|
|
|
//余额 |
|
|
|
currentAmount: 0, |
|
|
|
} |
|
|
|
}, |
|
|
|
components: { |
|
|
|
Toast, |
|
|
|
}, |
|
|
|
watch:{ |
|
|
|
//验证输入框的值 |
|
|
|
inputVal: function (val) { |
|
|
|
var rule = /^[1-9]\d*$/; |
|
|
|
if (!rule.test(val)) { |
|
|
|
this.inputCue = '( 请输入正整数金额!)' |
|
|
|
this.inputVal = '' |
|
|
|
this.isActive = false |
|
|
|
return |
|
|
|
}else { |
|
|
|
this.isActive = true; |
|
|
|
this.inputCue = '' |
|
|
|
} |
|
|
|
import putMoney from "../models/put-money-model.js"; |
|
|
|
import { Alert, Toast } from "vux"; |
|
|
|
import configs from "../configs"; |
|
|
|
var locationUrl = configs.locationUrl; |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
//提现金额验证提示 |
|
|
|
inputCue: "(请输入整数金额)", |
|
|
|
//默认一开始输入款的值不符合验证规则 |
|
|
|
isActive: false, |
|
|
|
inputVal: null, |
|
|
|
//余额 |
|
|
|
currentAmount: 0 |
|
|
|
}; |
|
|
|
}, |
|
|
|
components: { |
|
|
|
Toast |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
//验证输入框的值 |
|
|
|
inputVal: function(val) { |
|
|
|
var rule = /^[1-9]\d*$/; |
|
|
|
if (!rule.test(val)) { |
|
|
|
this.inputCue = "( 请输入正整数金额!)"; |
|
|
|
this.inputVal = ""; |
|
|
|
this.isActive = false; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
this.isActive = true; |
|
|
|
this.inputCue = ""; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
//提交申请 |
|
|
|
submit() { |
|
|
|
if (this.isActive) { |
|
|
|
|
|
|
|
this.$router.push({ |
|
|
|
name: "提现成功", |
|
|
|
params: { amount: this.inputVal } |
|
|
|
}); |
|
|
|
|
|
|
|
return; |
|
|
|
//判断是否在微信环境下操作 |
|
|
|
var ua = navigator.userAgent.toLowerCase(); |
|
|
|
if (!ua.match(/MicroMessenger/i) == "micromessenger") { |
|
|
|
this.$vux.toast.text("请登录微信进行操作", "middle"); |
|
|
|
return; |
|
|
|
} |
|
|
|
putMoney.putMoney({ amount: this.inputVal * 100 }).then(res => { |
|
|
|
if (res.code == 0) { |
|
|
|
this.$router.push({ |
|
|
|
name: "提现成功", |
|
|
|
params: { amount: this.inputVal } |
|
|
|
}); |
|
|
|
} else if (res.code == 666) { |
|
|
|
this.$vux.toast.text(res.msg, "middle"); |
|
|
|
setTimeout(function() { |
|
|
|
window.location.href = |
|
|
|
locationUrl + |
|
|
|
"/mall/web/user/login?callback=" + |
|
|
|
encodeURIComponent(window.location.href); |
|
|
|
}, 1000); |
|
|
|
} else { |
|
|
|
this.$vux.toast.text(res.msg, "middle"); |
|
|
|
} |
|
|
|
}, |
|
|
|
methods:{ |
|
|
|
//提交申请 |
|
|
|
submit() { |
|
|
|
if(this.isActive) { |
|
|
|
putMoney.putMoney( |
|
|
|
{amount:this.inputVal*100} |
|
|
|
).then(res => { |
|
|
|
if (res.code == 0){ |
|
|
|
this.$router.push({path:'/put-money-success'}); |
|
|
|
} else if (res.code == 666) { |
|
|
|
this.$vux.toast.text(res.msg,'middle') |
|
|
|
setTimeout(function () { |
|
|
|
window.location.href = locationUrl + '/mall/web/user/login?callback=' + encodeURIComponent(window.location.href); |
|
|
|
}, 1000); |
|
|
|
} else { |
|
|
|
this.$vux.toast.text(res.msg,'middle') |
|
|
|
} |
|
|
|
// this.$vux.toast.text(res) |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
//返回上一页 |
|
|
|
goBack() { |
|
|
|
history.go(-1) |
|
|
|
}, |
|
|
|
//获取链接参数 |
|
|
|
getParam(name) { |
|
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); |
|
|
|
var url = window.location.href |
|
|
|
url = window.location.href.substring(url.indexOf('?')+1,url.length) |
|
|
|
var r = url.match(reg); |
|
|
|
if (r != null) return unescape(r[2]); |
|
|
|
return null; |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
//获取余额值 |
|
|
|
this.currentAmount = (this.getParam("currentAmount")/100).toFixed(2) |
|
|
|
//this.$vux.toast.text(this.currentAmount,'middle') |
|
|
|
} |
|
|
|
// this.$vux.toast.text(res) |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
//返回上一页 |
|
|
|
goBack() { |
|
|
|
history.go(-1); |
|
|
|
}, |
|
|
|
//获取链接参数 |
|
|
|
getParam(name) { |
|
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); |
|
|
|
var url = window.location.href; |
|
|
|
url = window.location.href.substring(url.indexOf("?") + 1, url.length); |
|
|
|
var r = url.match(reg); |
|
|
|
if (r != null) return unescape(r[2]); |
|
|
|
return null; |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
//获取余额值 |
|
|
|
this.currentAmount = (this.getParam("currentAmount") / 100).toFixed(2); |
|
|
|
//this.$vux.toast.text(this.currentAmount,'middle') |
|
|
|
} |
|
|
|
}; |
|
|
|
</script> |