Commit 1434523c authored by 黄奎's avatar 黄奎
parents 79f8ffa4 0a631c31
......@@ -193,7 +193,7 @@
</li>
<li>
<el-form-item label="出生日期" prop="Birthday">
<el-date-picker v-model='addMsg.Birthday' class="w230" value-format="yyyy-MM-dd" type="date"
<el-date-picker v-model='addMsg.Birthday' class="w230" @change="zhanchuangTips(addMsg.Birthday)" value-format="yyyy-MM-dd" type="date"
placeholder="选择日期"></el-date-picker>
</el-form-item>
</li>
......@@ -604,6 +604,7 @@
export default {
data() {
return {
ppAge: 0,
loading: false,
appkey_ocr: "OGAhU38ib8EweXMtPVqCbkpN",
secretKey_ocr: "OcqfFF5hlleWovzA6vLweykxPgwE8XF2",
......@@ -798,6 +799,63 @@
};
},
methods: {
jsGetAge(strBirthday){
let returnAge;
let strBirthdayArr=strBirthday.split("-");
let birthYear = strBirthdayArr[0];
let birthMonth = strBirthdayArr[1];
let birthDay = strBirthdayArr[2];
let d = new Date();
let nowYear = d.getFullYear();
let nowMonth = d.getMonth() + 1;
let nowDay = d.getDate();
if(nowYear == birthYear && birthMonth <= nowMonth && birthDay <= nowDay){
returnAge = 1;//同年 则为0岁
} else {
let ageDiff = nowYear - birthYear ; //年之差
if(ageDiff > 0){
if(nowMonth == birthMonth) {
let dayDiff = nowDay - birthDay;//日之差
if(dayDiff < 0)
{
returnAge = ageDiff - 1;
}
else
{
returnAge = ageDiff ;
}
}
else
{
let monthDiff = nowMonth - birthMonth;//月之差
if(monthDiff < 0)
{
returnAge = ageDiff - 1;
}
else
{
returnAge = ageDiff ;
}
}
}
else
{
returnAge = -1;//返回-1 表示出生日期输入错误 晚于今天
}
}
return returnAge;//返回周岁年龄
},
zhanchuangTips: function (b){
let age = this.jsGetAge(b)
this.ppAge = age
if (age == -1) {
this.$message.error('出生日期'+ b +'有误')
this.addMsg.Birthday = ''
return
}
},
getJingDIan: function (){
this.apipost(
"sellorder_post_GetGuestScenicRefundList",
......@@ -1585,25 +1643,35 @@
if (this.addMsg.Marriage == "") {
this.addMsg.Marriage = "0";
}
this.apipost(
"sellorder_post_SetTravelGuestInfo_V2",
this.addMsg,
res => {
if (res.data.resultCode == 1) {
this.$message.success(res.data.message);
if (type == 1) {
history.go(-1);
} else {
this.btnState = true
this.ClearData();
}
} else {
if(this.ppAge <= 10 && this.addMsg.IsBed == 1) {
this.$confirm(this.$t('确认占床?'), this.$t('tips.tips'), {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.apipost(
"sellorder_post_SetTravelGuestInfo_V2",
this.addMsg,
res => {
if (res.data.resultCode == 1) {
this.$message.success(res.data.message);
if (type == 1) {
history.go(-1);
} else {
this.btnState = true
this.ClearData();
}
} else {
this.btnState = true
this.$message.error(res.data.message);
}
},
err => {}
);
}).catch(() => {
this.btnState = true
this.$message.error(res.data.message);
}
},
err => {}
);
});
}
},
getEconomicCapability() {
//获取经济能力
......
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 to comment