一 简单的二级联动 :
<section class="formBox">
<span>支付类型
</span>
<el-select class="input-box"
filterable
v-model="formInline.payType"
@change="paymentMethodTwo"
placeholder="请选择">
<el-option v-for="(item,index ) in payTypeListOne"
:key="index"
:value='item.subjectCode'
:label="item.subjectName"></el-option>
</el-select>
</section>
<section class="formBox">
<span>支付方式
</span>
<el-select class="input-box"
filterable
:disabled="!itemData.paymentType || !payTypeListTwo.length"
v-model="itemData.paymentMethod"
placeholder="请选择">
<el-option v-for="(item,index ) in payTypeListTwo"
:key="index"
:value='item.subjectCode'
:label="item.subjectName"></el-option>
</el-select>
</section>
二 data 数据 :
itemData: {
paymentType: '',//支付类型
paymentMethod:'',//支付方式
},
三 methods js方法 :
//获取支付方式下拉框
paymentMethodTwo(type){
// 一级切换,重选二级
if (type !== 'init') {
this.itemData.paymentMethod = ''
if (this.itemData.paymentType !== 'WZFF') {
this.itemData.accountStatus = 'account_status_1'
} else {
this.itemData.accountStatus = ''
}
if (this.itemData.accountStatus !== 'account_status_1') {
this.itemData.typeOfPayer = ''
this.itemData.flowInformation = ''
this.itemData.payerInformation = ''
}
} else {
if (this.itemData.paymentType !== 'WZFF') {
this.itemData.accountStatus = 'account_status_1'
} else {
this.itemData.paymentMethod = ''
}
}
util.request({
method: 'get',
interface: 'selectChildrenPay',
data: {
subjectCode: this.itemData.paymentType
}
}).then(res => {
if (res.result.success == '1') {
this.payTypeListTwo = res.result.result
} else {
this.$message.error(res.result.message)
}
})
},
//获取支付方式下拉框
paymentTypeList(){
util.request({
method: 'get',
interface: 'selectPayType',
data: {}
}).then(res => {
if (res.result.success == '1') {
this.payTypeListOne = res.result.result
} else {
this.$message.error(res.result.message)
}
})
},
//小判断
<script type="text/javascript">
var reg = /^[a-zA-Z\u4e00-\u9fa5]+message({
type:"success",
message:"请输入联系人姓名!"
})
return false
}else if(!(isokb||"")){
this.$message({
type:"success",
message:"联系人名字只能输入中文英文!"
})
return false
}
// email
if(this.formInline.email != ""){
var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}{1,2})$/;
this.isok=reg.test(this.formInline.email);
if (!(this.isok||"")) {
this.$message({
type:"success",
message:"邮箱格式书写错误!"
})
}
return false
}
if(this.formInline.channelBookingCode != ""){
var reg = /^[0-9a-zA-Z]+$/;
this.isok=reg.test(this.formInline.channelBookingCode);
if (!(this.isok||"")) {
this.$message({
type:"error",
message:"渠道单号错误!"
})
}
return false
}
//离店时间小于入住时间
this.timea = new Date(this.formInline.checkinDateStr).getTime()
this.timeb = new Date(this.formInline.checkoutDateStr).getTime()
if(this.timeb<this.timea){
this.$message({
type:"success",
message:"离店时间早于入住时间!"
})
return false
}
if (!this.formInline.checkinDateStr) {
this.$message({
type:"success",
message:"请选择入住时间!"
})
return false
}
</script>
网友评论