Commit a689b0b1 authored by youjie's avatar youjie

优化

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