Commit a689b0b1 authored by youjie's avatar youjie

优化

parent 02e79d83
......@@ -21,12 +21,13 @@
<destination class="q-pa-sm"
:msg="{
CityCode:msg.CityCode,
KeyWords2:msg.Name_CN,
KeyWords:msg.KeyWords,
KeyWords2:msg.CityName,
StartDate:msg.CheckInDate,
EndDate:msg.CheckOutDate,
searchroomGroup:msg.searchroomGroup}"
Type="1"
@change="changeMsg"
@change="clearQuery"
@changeCity="changCity"
@clear="clearQuery"></destination>
<div class="q-pt-sm cursor-pointer">
......@@ -206,12 +207,13 @@
<destination class="q-pa-sm"
:msg="{
CityCode:msg.CityCode,
KeyWords2:msg.Name_CN,
KeyWords:msg.KeyWords,
KeyWords2:msg.CityName,
StartDate:msg.CheckInDate,
EndDate:msg.CheckOutDate,
searchroomGroup:msg.searchroomGroup}"
Type="2"
@change="changeMsg"
@change="clearQuery"
@changeCity="changCity"
@clear="clearQuery"></destination>
......@@ -674,51 +676,10 @@ export default {
};
},
watch: {
// '$route':{
// handler(newVal, oldVal) {
// this.msg = JSON.parse(JSON.stringify(this.qMsg));
// this.msg.priceRange = {
// min: 1,
// max: 100000,
// };
// this.msg.StartPrice = 0;
// this.msg.EndPrice = 100000;
// this.dateRange = { from: this.msg.StartDate, to: this.msg.EndDate };
// if(newVal!=oldVal){
// this.resetQuery();
// }
// var qsearchKey = this.getUrlKey("qsearchKey", window.location.href);
// var qsearchDate = this.getUrlKey("qsearchDate", window.location.href);
// var qsearchEndDate = this.getUrlKey("qsearchEndDate", window.location.href);
// var areaId = this.getUrlKey("areaId", window.location.href);
// var areaName = this.getUrlKey("areaName", window.location.href);
// if (qsearchKey) {
// this.msg.KeyWords = qsearchKey;
// }else if (areaName) {
// this.msg.KeyWords = areaName;
// }else this.msg.KeyWords = ''
// if(this.msg.KeyWords) this.searchCity();
// if (qsearchDate) {
// this.msg.StartDate = qsearchDate;
// }else {
// this.msg.StartDate = date.formatDate(date.addToDate(new Date(), { days: 8 }), "YYYY/MM/DD")
// }
// if (qsearchEndDate) {
// this.msg.EndDate = qsearchEndDate;
// }else {
// this.msg.EndDate = date.formatDate(date.addToDate(new Date(), { days: 9 }), "YYYY/MM/DD")
// }
// this.resetQuery();
// },
// deep: true,
// immediate: true,
// },
qMsg: {
handler(newVal, oldVal) {
this.msg = JSON.parse(JSON.stringify(this.qMsg));
console.log(newVal.KeyWords2,'----222')
this.msg.priceRange = {
min: 1,
max: 100000,
......@@ -737,6 +698,9 @@ export default {
this.CitiesTicked = []
this.regionTicked = []
}
if(this.msg.CityCode){
this.getRegion(this.msg.CityCode)
}
this.resetQuery();
},
deep: true,
......@@ -778,21 +742,13 @@ export default {
...this.msg,
...msg
}
setTimeout(() => {
this.resetQuery()
}, 200);
this.$emit('change', this.msg)
},
changCity(y){
this.msg.CityCode2 = y.CityCode
this.msg.CityCode = y.CityCode
this.resetQuery()
this.getRegion()
},
changeMsg(msg){
this.msg.KeyWords2 = msg.KeyWords2?msg.KeyWords2:''
this.msg.CityCode = msg.CityCode?msg.CityCode:''
this.msg.hotelId = msg.hotelId?msg.hotelId:''
this.resetQuery()
this.getRegion(this.msg.CityCode)
},
clickHandler(e) {
try {
......@@ -930,17 +886,16 @@ export default {
// this.msg.CityCode2 = this.msg.KeyWords?'':data[0].CityList[0].CityCode
// this.CitiesTicked = this.msg.KeyWords?[]:[data[0].CityList[0].CityCode]
this.CitiesJSON = JSON.parse(JSON.stringify(this.CitiesList));
// this.getRegion()
}
},
);
},
// 区域
getRegion() {
getRegion(CityCode) {
//this.parameters.regionCode = ''
var regMsg = {
CityCode: this.msg.CityCode2,
Name: this.msg.CityName,
CityCode: CityCode,
Name: '',
};
this.apipost('dmc_post_GetDestinationByCityCode', regMsg,
(res) => {
......@@ -1020,7 +975,7 @@ export default {
let findIndex = this.CitiesListAll.findIndex(x=>x.CityCode==this.msg.CityCode)
if(findIndex!=-1) this.msg.CityName = this.CitiesListAll[findIndex].CityName
if(this.msg.CityCode2!=oldCityCode&&this.CitiesTicked.length){
this.getRegion()
this.getRegion(this.msg.CityCode2)
}else this.regionList = []
this.resetQuery();
},
......
......@@ -698,11 +698,11 @@
<q-breadcrumbs-el :label="qMsg.KeyWords" />
</q-breadcrumbs>
</div>
<div class="text-h6 text-left" v-if="qMsg.KeyWords">
<!-- <div class="text-h6 text-left" v-if="qMsg.KeyWords">
搜尋結果 “
<span class="text-primary">{{ qMsg.KeyWords }}</span
>
</div>
</div> -->
<!-- 电脑端 -->
<div class="row SearchContent q-mt-md" v-if="!$q.screen.xs && 1 == 0">
<div class="search-filter-inner">
......@@ -1511,6 +1511,8 @@ export default {
}
if(newVal.query&&newVal.query.pageIndex){
this.qMsg = newVal.query
console.log(newVal.query.KeyWords2,'----')
// this.qMsg.KeyWords = newVal.query.KeyWords?newVal.query.KeyWords:newVal.query.KeyWords2?newVal.query.KeyWords2:''
}else{
var qsearchKey = this.getUrlKey("qsearchKey", window.location.href);
var qsearchDate = this.getUrlKey("qsearchDate", window.location.href);
......@@ -1538,7 +1540,6 @@ export default {
this.qMsg.CityCode = areaId;
}
}
console.log(newVal.query.CheckInDate,'-------')
if ((qsearchKey || qsearchDate || qsearchEndDate) && this.ShowType != 2) {
this.goSearchHandler();
......@@ -1574,7 +1575,7 @@ export default {
methods: {
handlerSearchChange(value) {
this.qMsg = value;
this.goSearchHandler();
if(this.ShowType != 2) this.goSearchHandler();
},
//清除所有条件
clearAll() {
......
......@@ -193,7 +193,7 @@
<!-- 目的地 -->
<destination class="q-ml-sm" :msg="{
CityCode:CityCode?CityCode:dataList.CityCode,
KeyWords2:dataList.Name_CN,
KeyWords:dataList.Name_CN,
StartDate:msg.CheckInDate,
EndDate:msg.CheckOutDate,
searchroomGroup:msg.searchroomGroup}"
......
......@@ -3,8 +3,8 @@
<!-- <div class="text-xxs absolute top-0 left-0 q-px-md" style="color: rgba(5,32,50,.8);">
目的地
</div> -->
<div class="row items-center no-wrap">
<div class="">
<div class="row items-center no-wrap relative">
<div class="" id="cit">
<q-btn
dark-percentage
color="primary"
......@@ -22,8 +22,26 @@
<span class="text-xs text-no-wrap overflow-hidden col">{{ HotalMsg.CityName?HotalMsg.CityName:'城市' }}</span>
</span>
</q-btn>
<q-popup-proxy :offset="[0, 10]">
<div class="row no-wrap" id="cit">
<div class="self-center no-outline text-xxs absolute bg-white overflow-hidden"
style="width: 500px;top: 50px;left: 30px;border-radius: 3px;
box-shadow: 0px 0px 20px 0px rgba(76, 87, 125, 0.2) !important;z-index: 2;"
tabindex="0" v-show="showSplitPannel">
<div>
<q-input
v-model="HotalMsg.KeyWords2"
clearable
label="搜索目的地"
filled
dense
standout="col bg-grey-1 text-black"
@input="searchInputHandler(1)"
@focus.stop="searchFocusHandler(1)"
@blur="searchBlurHandler(1)"
@keyup.enter="searchChangeHandler(1)"
@clear="clearHandler(1)"
:loading="loading2"
/>
<div class="row no-wrap">
<div class="bg-grey-2" style="border-right: 1px solid rgb(238, 238, 238);">
<div v-for="(x,index) in CitiesList" :key="index"
@click="changeGName(x)"
......@@ -61,22 +79,23 @@
</q-scroll-area>
</div>
</div>
</q-popup-proxy>
</div>
</div>
</div>
<q-input
id="search_key"
v-model="HotalMsg.KeyWords2"
v-model="HotalMsg.KeyWords"
clearable
label="搜索目的地、酒店"
label="搜索酒店"
filled
dense
standout="col bg-grey-1 text-black"
@input="searchInputHandler"
@focus.stop="searchFocusHandler"
@blur="searchBlurHandler"
@keyup.enter="searchChangeHandler"
@clear="clearHandler"
@input="searchInputHandler(0)"
@focus.stop="searchFocusHandler(0)"
@blur="searchBlurHandler(0)"
@keyup.enter="searchChangeHandler(0)"
@clear="clearHandler(0)"
:loading="loading"
/>
</div>
......@@ -194,11 +213,13 @@ export default {
loadingIndex: 0,
loading: false,
lastKeyword: '',
loading2: false,
};
},
watch: {
msg: {
handler(newVal, oldVal) {
console.log(newVal.KeyWords2,'----3333')
this.HotalMsg = {
...this.HotalMsg,
...JSON.parse(JSON.stringify(newVal)),
......@@ -232,25 +253,21 @@ export default {
this.HotalMsg.EndDate = this.HotalMsg.EndDate? this.HotalMsg.EndDate:date.formatDate(date.addToDate(new Date(), { days: 9}), "YYYY/MM/DD")
if(y.Type==1){
this.HotalMsg.CityCode = y.Id
this.HotalMsg.CityCode2 = y.Id
this.HotalMsg.CityCode2 = ''//y.Id
this.HotalMsg.CityName = y.Name.split(' ')[0]
this.HotalMsg.KeyWords = y.Name.split(' ')[0]
this.HotalMsg.KeyWords = ''
this.HotalMsg.KeyWords2 = y.Name.split(' ')[0]
this.CommonJump('/searchdida', {
...this.HotalMsg
});
}else if(y.Type==2){
this.HotalMsg.KeyWords2 = y.Name
this.HotalMsg.KeyWords2 = ''
this.HotalMsg.hotelId = y.Id
this.$emit('change', this.HotalMsg,y)
this.showKeyWordsList = false
this.showSplitPannel = false
}
if(this.Type>0) {
this.showSplitPannel = false
this.showSplitPannel = false
}
this.showKeyWordsList = false
this.showSplitPannel = false
},
clickHandler(e) {
try {
......@@ -276,7 +293,6 @@ export default {
KeyWords: this.HotalMsg.KeyWords2,
},
res => {
if(this.loadingIndex<2)this.loadingIndex++
if(res.data.resultCode == 1) {
res.data.data.forEach(x => {
x.Name = x.NameCN
......@@ -285,20 +301,24 @@ export default {
x.Type = 1
})
this.DestiList = res.data.data
this.dataList[1].list = []
this.dataList[0].list = res.data.data
if(this.loadingIndex==2) {
this.loading = false
if(this.dataList[0].list.length) {
this.showKeyWordsList = true
this.showSplitPannel = false
}else {
this.$message.error('未查询道相关数据')
}
}
this.loading2 = false
})
},
getHotalList(type){
this.apipost(
"dmc_post_B2BAndB2CGetDidaHotelPage",this.HotalMsg,
res => {
if(this.loadingIndex<2)this.loadingIndex++
if (res.data.resultCode == 1) {
res.data.data.pageData.forEach(x => {
x.Name = x.name
......@@ -308,16 +328,20 @@ export default {
x.Type = 2
})
this.HotalList = res.data.data.pageData
this.dataList[0].list = []
this.dataList[1].list = res.data.data.pageData
if(this.loadingIndex==2) {
this.loading = false
if(this.dataList[1].list.length) {
this.showKeyWordsList = true
this.showSplitPannel = false
}else {
this.$message.error('未查询道相关数据')
}
}
this.loading = false
})
},
clearHandler(){
clearHandler(type){
this.showKeyWordsList = false
this.showSplitPannel = false
this.HotalMsg.CityCode = ''
......@@ -334,41 +358,56 @@ export default {
this.showKeyWordsList = false
this.loading = false
},
searchInputHandler(){
searchInputHandler(type){
return
if(this.HotalMsg.KeyWords2=='') {
this.showKeyWordsList = false
this.showSplitPannel = true
}
},
searchFocusHandler(){
searchFocusHandler(type){
setTimeout(() => {
if(!this.HotalMsg.KeyWords2||this.HotalMsg.KeyWords2==''){
if(!type&&(!this.HotalMsg.KeyWords||this.HotalMsg.KeyWords=='')){
this.loading = false
this.showKeyWordsList = false
this.showSplitPannel = false
}else if(type&&(!this.HotalMsg.KeyWords2||this.HotalMsg.KeyWords2=='')){
this.loading = false
this.HotalMsg.CityName = ''
this.showKeyWordsList = false
}else{
// this.inList()
}
}, 200);
},
searchBlurHandler(){
searchBlurHandler(type){
},
searchChangeHandler(){
searchChangeHandler(type){
setTimeout(()=>{
if(!this.HotalMsg.KeyWords2||this.HotalMsg.KeyWords2=='') {
if(!type&&(!this.HotalMsg.KeyWords||this.HotalMsg.KeyWords=='')) {
this.loading = false
this.showKeyWordsList = false
this.showSplitPannel = false
if(this.Type>0) this.$emit('change', this.HotalMsg)
return
}else if(type&&(!this.HotalMsg.KeyWords2||this.HotalMsg.KeyWords2=='')){
this.loading = false
this.showKeyWordsList = false
this.HotalMsg.CityName = ''
if(this.Type>0) this.$emit('change', this.HotalMsg)
return
}
this.lastKeyword = this.HotalMsg.KeyWords2
this.loading = true
this.lastKeyword = type?this.HotalMsg.KeyWords2:this.HotalMsg.KeyWords
this.loadingIndex = 0
this.getHotalList()
this.getDestiList()
if(!type) {
this.loading = true
this.getHotalList()
}
else {
this.loading2 = true
this.getDestiList()
}
},200)
},
changeRegion(y){
......@@ -380,12 +419,16 @@ export default {
this.HotalMsg.CityCode = y.CityCode
this.HotalMsg.StartDate = this.HotalMsg.StartDate?this.HotalMsg.StartDate:date.formatDate(date.addToDate(new Date(), { days: 8 }), "YYYY/MM/DD")
this.HotalMsg.EndDate = this.HotalMsg.EndDate?this.HotalMsg.EndDate:date.formatDate(date.addToDate(new Date(), { days: 9}), "YYYY/MM/DD")
this.HotalMsg.KeyWords2 = y.CityName
if(this.Type>0) {
this.$emit('changeCity', y)
this.$emit('changeCity', this.HotalMsg)
this.showSplitPannel = false
this.searchChangeHandler(1)
}else{
this.HotalMsg.KeyWords2 = y.CityName
this.searchChangeHandler()
this.HotalMsg.KeyWords = ''
this.CommonJump('/searchdida', {
...this.HotalMsg
});
}
// this.$emit('change', y)
// this.CommonJump('/searchdida', {
......
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