<!--第三方酒店信息--> <style> .comCheckHotelV2 .comCheckHotelV2 { width: 100%; height: 150px; overflow: auto } .comCheckHotelV2 .comCk_list { padding: 0 20px; margin: 0 15px 5px 0; } .comCheckHotelV2 .cm_Inventory { margin-left: 20px; color: red; display: inline-block; } .comCheckHotelV2 .cm_hotelTitle { width: 100%; text-align: center; margin-bottom: 20px; border-bottom: 1px solid #d1d1d1; padding: 0 20px 10px 20px; } .comCheckHotelV2 .com_SaveBtn { margin: 10px 20px 0 45%; } .comCheckHotelV2 .ckedList { background-color: #E95252; color: #fff; } .comCheckHotelV2 .Ck_hotelInfo { width: 100%; height: 40px; background-color: #F6F8FB; text-align: center; line-height: 40px; margin-bottom: 10px; } .comCheckHotelV2 .ck_goUrl { color: blue; cursor: pointer; margin-left: 10px; } .comCheckHotelV2 .tdLeft { text-align: left; } .comCheckHotelV2 .tdRight { text-align: right; } </style> <template> <div class="comCheckHotelV2"> <div class="Ck_hotelInfo"> {{$t('objFill.jdkcxx')} </div> <div class="cm_hotelTitle clearfix"> <table> <tr> <td class="tdRight"> {{$t('system.query_type')}}: </td> <td class="tdLeft"> <el-select filterable v-model="qHotelType" class="w120" :placeholder="$t('pub.pleaseSel')"> <el-option :label="$t('objFill.v101.traveltrip.dijiejiud')" :value='1'></el-option> <el-option :label="$t('objFill.v101.traveltrip.disanfangjd')" :value='2'></el-option> </el-select> </td> <td class="tdRight"> {{$t('pub.area')}}: </td> <td colspan="2" class="tdLeft"> <el-select filterable v-model="qMsg.ProvinceId" class="w120" :placeholder="$t('pub.pleaseSel')"> <el-option :label="$t('pub.unlimitedSel')" :value='0'></el-option> <el-option v-for="item in ProvinceList" :label='item.Name' :value='item.ID' :key='item.ID'> </el-option> </el-select> </td> </tr> <tr> <td class="tdRight"> {{$t('hotel.table_CheckInDate')}}: </td> <td class="tdLeft"> <el-date-picker v-model='qMsg.UseDate' class="w120" value-format="yyyy-MM-dd" type="date" :placeholder="$t('hotel.table_CheckInDate')"> </el-date-picker> </td> <td class="tdRight"> {{$t('objFill.v101.traveltrip.jiudmcdh')}}: </td> <td class="tdLeft"> <el-input type="text" v-model="qMsg.Name" class="w120" @keyup.native.enter="getCheckHotel()" :placeholder="$t('objFill.jiudianhdh')"></el-input> </td> <td> <input type="button" class="normalBtn" :value="$t('pub.searchBtn')" @click="getCheckHotel()" /> </td> </tr> </table> </div> <div> <el-tabs type="border-card" v-loading="loading" v-if="qHotelType==1"> <el-tab-pane :label="item.ProvinceName" v-for="(item,index) in dataList" :key="item.subCode"> <div class="clearfix comCheckHotelV2"> <div class="comCk_list" v-for="(subItem,subIndex) in item.HotelList"> <input :id="'H'+index+'_'+subIndex" type="checkbox" v-model="subItem.isChecked" @click="getCheck(item.HotelList,subIndex)" /> <label :for="'H'+index+'_'+subIndex" style="cursor: pointer">{{subItem.Name}}</label> <span class="cm_Inventory">{{subItem.Inventory}}</span> <span class="cm_Inventory">{{$t('hotel.hotel_remainList')}}:{{subItem.RemainingInventory}}</span> </div> </div> </el-tab-pane> </el-tabs> <template v-else> <table v-loading="loading" > <thead> <tr> <th style="width:70px">{{$t('objFill.v101.traveltrip.xuanzhe')}}</th> <th style="width:200px">{{$t('hotel.table_hotelname')}}</th> <th style="width:100px">{{$t('Operation.Op_price')}}</th> </tr> </thead> <tbody> <tr v-for="(item,index) in ThirdHotelList"> <td width="50"> <input :id="item.hotelId" type="checkbox" v-model="item.isChecked" @click="getCheck(ThirdHotelList,index)" /> </td> <td width="150">{{item.hotelName}}</td> <td width="150">{{item.lowrateTotal}}</td> </tr> </tbody> <tfoot> <tr> <td colspan="3"> <el-pagination v-if="thirdHotelMsg.numberOfResultMatched>0" background @current-change="handleCurrentChange" :current-page.sync="thirdHotelMsg.displayFrom" :page-size="thirdHotelMsg.numberOfResults" layout="total,prev, pager, next, jumper" :total="thirdHotelMsg.numberOfResultMatched"> </el-pagination> </td> </tr> </tfoot> </table> </template> </div> <input type="button" class="normalBtn com_SaveBtn" @click="sendCkedHotel()" :value="$t('pub.saveBtn')" /> </div> </template> <script> export default { props: [""], data() { return { loading: false, dataList: [], ProvinceList: [], qHotelType: 1, //酒店查询类型 qMsg: { ProvinceId: 0, //选择个省份编号 Name: "", //酒店名称 UseDate: "", //入住时间 }, thirdHotelMsg: { displayFrom: 1, //当前页 numberOfResults: 5, //每页条数 numberOfResultMatched: 0, //总条数 arrivalDate: "", //入住时间 departureDate: "", //离店时间 //房间信息列表 searchroomGroup: [{ numberOfAdults: 1, //大人数, numberOfChildren: 0, //儿童数 childAges: 0, //儿童年龄 roomNum: 1, //房间数 }], searchHotelIdList: [], //酒店id,[1,2,3] freeword: "", //关键字 //类型 1,地区,2-酒店名称 freewordType: 0, reviewRatingUpperLimits: 0, //指定评论分数的上限 reviewRatingLowerLimits: 0, //指定评论分数的下限 searchHotelCategory: [], //酒店分类 searchHotelFeatures: [], //酒店的特征 searchRoomType: [], //类型的房间 searchMealType: [], //饮食条件搜索 searchMinRate: 0, //検索最小金額, searchMinRate: 0, //検索最大金額 sort: 0, //排序 }, ThirdHotelList: [], //第三方酒店列表 IsShow: false, ckedHotel: {} }; }, methods: { getCheckHotel() { this.dataList = []; this.HotelList = []; this.ThirdHotelList=[]; //地接酒店 if (this.qHotelType == 1) { this.GetDMCHotelList(); } //第三方酒店 else { this.GetThirdHotelList(); } }, //查询地接酒店 GetDMCHotelList() { this.loading = true; this.IsShow = false; this.apipost('hotel_post_GetHasStockHotelList_V2', { //1-只查询有库存的酒店 IsMoreThanZero: 0, Country: "651", IsAllHotel: 1, Province: this.qMsg.ProvinceId, Name: this.qMsg.Name, sDate: this.qMsg.UseDate, IsGetPic:true,//获取图片 }, res => { this.loading = false; this.IsShow = true; if (res.data.resultCode == 1) { this.dataList = res.data.data; this.dataList.forEach(x => { x.HotelList.forEach(y => { y.isChecked = false; }) }) } else { this.Error(res.data.message) } }, err => {}) }, //查询第三方酒店 GetThirdHotelList() { this.loading = true; this.IsShow = false; this.thirdHotelMsg.arrivalDate=this.qMsg.UseDate; this.ThirdHotelList=[]; if (this.thirdHotelMsg.arrivalDate == "") { this.Info(this.$t('objFill.v101.traveltrip.qingxuanzherzsj')); return; } else { this.thirdHotelMsg.departureDate = this.$commonUtils.AddDay(this.thirdHotelMsg.arrivalDate, 1); } this.thirdHotelMsg.freeword=this.qMsg.Name; if (this.thirdHotelMsg.freeword == "") { this.thirdHotelMsg.freewordType = 1; if (this.qMsg.ProvinceId > 0) { //获取当前选中的对象 let obj = {}; obj = this.ProvinceList.find(item => { return item.ID === this.qMsg.ProvinceId; //筛选出匹配数据 }); if (obj != undefined) { this.thirdHotelMsg.freeword = obj.Name; } else { this.thirdHotelMsg.freeword = this.ProvinceList[0].Name; } } else { this.thirdHotelMsg.freeword = this.ProvinceList[0].Name; } } else { this.thirdHotelMsg.freewordType = 2; this.thirdHotelMsg.freeword = this.qMsg.Name; } //多了一个参数调用线上的就酒店数据 this.apipost('dmc_post_Get_GetJAPAN_HotelList', this.thirdHotelMsg, res => { this.loading = false; this.IsShow = true; if (res.data.resultCode == 1) { //总条数 this.thirdHotelMsg.numberOfResultMatched = Number(res.data.data.numberOfResultMatched); var newArray= res.data.data.hotelSummary; if(newArray!=null && newArray.length>0) { newArray.forEach(item=>{ item.isChecked=false; }); } this.ThirdHotelList =newArray; } else { this.Error(res.data.message) } }, err => {}, true) }, handleCurrentChange(val) { this.thirdHotelMsg.displayFrom = val; this.GetThirdHotelList(); }, getCheck(hotelList, index) { hotelList.forEach((x, subIndex) => { if (index == subIndex) { x.isChecked = !x.isChecked; this.ckedHotel = x; } else { x.isChecked = false; } }) this.$forceUpdate(); }, //向父组件传递选中酒店 sendCkedHotel() { var ckHotelObj = {}; if (this.ckedHotel) { //地接酒店 if(this.qHotelType==1) { ckHotelObj.HotelId = this.ckedHotel.ID; ckHotelObj.HotelName = this.ckedHotel.Name; ckHotelObj.Description=this.ckedHotel.Descriptions; ckHotelObj.HotelProvideType=1; ckHotelObj.imgList=this.ckedHotel.ImgList; } //第三方酒店 else if(this.qHotelType==2) { ckHotelObj.HotelId = this.ckedHotel.hotelId; ckHotelObj.HotelName = this.ckedHotel.hotelName; ckHotelObj.imgList=[]; ckHotelObj.imgList.push({Name:this.ckedHotel.hotelName,Url:this.ckedHotel.hotelImageUrl}); ckHotelObj.Description=this.ckedHotel.hotelDescription; ckHotelObj.HotelProvideType=2; } } this.$emit("childHotelChange", ckHotelObj); }, //获取日本下面的市->下拉框用 getProvinceList() { let msg = { Id: 651 }; this.apipost("dict_post_Destination_GetChildList", msg, res => { if (res.data.resultCode == 1) { this.ProvinceList = res.data.data; } else { this.Error(res.data.message); } }, err => {} ); }, }, mounted() { this.getProvinceList(); } }; </script>