lixin-web
Version:
vue and bootstrap
59 lines (57 loc) • 1.59 kB
JavaScript
export default {
props: ['accountData','quotaList','minQuotaPoint','getQuotaList'],
data(){
return {
openTypeName: '代理',
point:this.accountData.lotteryAgentRange.minPoint,
quotaRule:[
{ validator:(rule, value,callback) => {
if (!this.req.quotaable) {
return callback('您的配额不足!')
}
callback()
}}
],
}
},
methods:{
quotaValidate(quota){
if(this.minQuotaPoint){
if(!this.quotaList.length){
this.req.quotaable = quota < this.minQuotaPoint
}else if(this.minQuotaPoint <= quota){
const playQuota = this.quotaList.find(i => {
const range = i.range
return typeof range == 'string' ? range.includes(quota) : range === quota
})
this.req.quotaable = playQuota && playQuota.surplusAmount > 0 ? true : false
}else {
this.req.quotaable = true
}
}
else{
this.req.quotaable = true
}
this.$form.validateField('quotaable')
return this.req.quotaable
},
},
computed: {
rangeType(){
return this.accountData[`lottery${this.openType ? 'Agent' : 'Player'}Range`]
},
openType(){
return this.openTypeName == '代理' ? 1 : 0
},
minPoint(){
return this.rangeType.minPoint
},
maxPoint(){
return this.rangeType.maxPoint
},
disabled(){
const {minPoint,maxPoint} = this
return minPoint > maxPoint
}
}
}