9.6107ebc2c97165438d4e.js 7.2 KB

1
  1. webpackJsonp([9],{vF93:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a("//Fk"),n=a.n(r),i=a("mvHQ"),o=a.n(i),l=a("woOf"),u=a.n(l),c=a("0xDb"),f=a("gtmD"),d=a("vLgD");var s={name:"yaWeiSearch",components:{SearchTableTemplate:a("NUeu").a},methods:{getRate:function(e,t){(function(e){return Object(d.a)({data:e,url:"/order/lfExchangerate/rate"})})(e).then(function(e){t.currency=e.data.data.code,t.finalRate=e.data.data.rate}).catch(function(){t.currency="CNY",t.finalRate=1})},search:function(e,t,a){var r=this;t.validate(function(t){if(t){a.loading=!0,r.searchData=e;var n=e.airSource,i=n.length,l=u()({},e);delete l.airSource;var c=[],d=r.$loading({target:r.$refs.searchTable.$refs.table.$el});n.forEach(function(e){f.c.search(o()(u()({airSource:e},l))).then(function(t){200!==t.data.status&&r.$message({message:t.data.attachment||e+"查询失败",type:"error"}),c.push({airSource:e,fromSegments:t.data.attachment.fromSegments?t.data.attachment.fromSegments:[]}),--i||(r.tableData=r.flightParse(c),d.close(),a.loading=!1)}).catch(function(){--i||(r.tableData=r.flightParse(c),d.close(),a.loading=!1)})})}})},flightParse:function(e){var t=[];return e.forEach(function(e){e.fromSegments.forEach(function(e){if(t.every(function(t){if(t.routeInfoEntities.length===e.routeInfoEntities.length){var a=t.routeInfoEntities.some(function(t){var a=e.routeInfoEntities.find(function(e){return e.depAirport===t.depAirport&&e.arrAirport===t.arrAirport});return!!a&&t.flightNumber!==a.flightNumber});return a||t.airlinePriceInfos.push({airSourceName:e.airSourceName,airlinePriceInfos:e.airlinePriceInfos?e.airlinePriceInfos.sort(function(e,t){return e.adultPrice+e.adultTax>t.adultPrice+t.adultTax}):e.airlinePriceInfos}),a}return!0})){var a=u()({},e);a.airlinePriceInfos=[{airSourceName:a.airSourceName,airlinePriceInfos:a.airlinePriceInfos?a.airlinePriceInfos.sort(function(e,t){return e.adultPrice+e.adultTax>t.adultPrice+t.adultTax}):a.airlinePriceInfos}],t.push(a)}})}),t},timeParse:function(e){return e.replace(/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/,function(e,t,a,r,n,i){return t+"-"+a+"-"+r+" "+n+":"+i})},yaWei:function(e,t,a){var r=this,i={fromStation:e.formCity,toStation:e.toCity,fromDate:e.fromDate,adultNum:this.searchData.adultNum,trainCode:e.routeInfoEntities[0].flightNumber};return new n.a(function(e){f.c.verification(i).then(function(n){r.$confirm('当前航班 最低积分:<span class="text-danger">'+n.data.data.currentPoint+'</span> 剩余座位:<span class="text-danger">'+n.data.data.maxSeats+"</span><br>是否押位?","押位",{dangerouslyUseHTMLString:!0}).then(function(){i.currentPoint=n.data.data.currentPoint,i.maxSeats=n.data.data.maxSeats,r.tableData[a][t.prop+"_loading"]=!0,r.tableData=[].concat(r.tableData),f.c.submit(i).then(function(t){r.$message({message:"已提交押位订单列表",type:"success"}),e()}).catch(function(){return e()})}).catch(function(){return e()})}).catch(function(){return e()})})}},data:function(){var e=this;return{formInputList:[{label:"出发城市",value:"",type:"text",maxlength:3,required:!0,name:"formCity",module:"input",placeholder:"出发城市",handle:function(t){t[this.name]=t[this.name].toUpperCase(),e.getRate({fromStation:t[this.name]},t)}},{label:"到达城市",value:"",type:"text",maxlength:3,required:!0,module:"input",name:"toCity",placeholder:"到达城市",handle:function(e){e[this.name]=e[this.name].toUpperCase()}},{label:"出发日期",value:"",module:"date",required:!0,name:"fromDate",format:"yyyy-MM-dd",placeholder:"出发日期"},{label:"成人人数",value:2,required:!0,module:"select",name:"adultNum",placeholder:"成人人数",optionList:[{value:1,label:1},{value:2,label:2},{value:3,label:3},{value:4,label:4},{value:5,label:5},{value:6,label:6},{value:7,label:7},{value:8,label:8},{value:9,label:9}]},{label:"币种",value:"",type:"text",required:!0,module:"input",name:"currency",placeholder:"币种"},{label:"汇率",value:"",type:"number",required:!0,module:"input",name:"finalRate",placeholder:"汇率"},{label:"航司",value:["AK_BIG_APP","AK_WEB"],multiple:!0,readonly:!0,module:"select",name:"airSource",placeholder:"航司",hidden:!0,optionList:[{value:"AK_WEB",label:"AK_WEB"},{value:"AK_BIG_APP",label:"AK_BIG_APP"}]}],formButtonlist:[{module:"button",title:"搜索",type:"primary",icon:"el-icon-search",loading:!1,handle:function(t,a,r){e.search(t,a,this)}},{module:"reset",title:"重置",type:"text",icon:"el-icon-close"}],tableColumn:[{label:"航班号",prop:"flightNumber",width:60,formatter:function(){return arguments[0].routeInfoEntities.map(function(e){return"<div>"+e.flightNumber+"</div>"}).join("")}},{label:"起降城市",prop:"city",width:80,formatter:function(){return arguments[0].routeInfoEntities.map(function(e){return"<div>"+e.depAirport+"~"+e.arrAirport+"</div>"}).join("")}},{label:"起降时间",prop:"date",width:220,formatter:function(){return arguments[0].routeInfoEntities.map(function(t){return"<div>"+e.timeParse(t.arrTime)+"~"+e.timeParse(t.depTime)+"</div>"}).join("")}},{label:"亚航官网",child:[{label:"座位",prop:"AK_WEB_maxSeats",width:60,formatter:function(){return arguments[0].airlinePriceInfos.map(function(e){return e.airlinePriceInfos.map(function(t){if("AK_WEB"===e.airSourceName)return"<div>"+t.cabin+":"+t.maxSeats+"</div>"}).join("")}).join("")}},{label:"成人价格",prop:"AK_WEB_adultPrice",formatter:function(){return arguments[0].airlinePriceInfos.map(function(e){return e.airlinePriceInfos.map(function(t){if("AK_WEB"===e.airSourceName)return"<div>"+t.cabin+":"+t.adultPrice+" ("+t.adultTax+") ["+Object(c.e)(t.adultPrice+t.adultTax)+"]</div>"}).join("")}).join("")}}]},{label:"亚航积分",child:[{label:"座位",prop:"AK_BIG_APP_realSeats",width:60,formatter:function(){return arguments[0].airlinePriceInfos.map(function(e){return e.airlinePriceInfos.map(function(t){if("AK_BIG_APP"===e.airSourceName)return"<div>"+t.cabin+":"+t.data.realSeats+"</div>"}).join("")}).join("")}},{label:"成人价格",prop:"AK_BIG_APP_adultPrice",formatter:function(){return arguments[0].airlinePriceInfos.map(function(e){return e.airlinePriceInfos.map(function(t){if("AK_BIG_APP"===e.airSourceName)return"<div>"+t.cabin+":"+t.adultPrice+" ("+t.adultTax+") ["+Object(c.e)(t.adultPrice+t.adultTax)+"]</div>"}).join("")}).join("")}},{label:"成人积分",prop:"AK_BIG_APP_AdultQuotedPoints",width:120,formatter:function(){return arguments[0].airlinePriceInfos.map(function(e){return e.airlinePriceInfos.map(function(t){if("AK_BIG_APP"===e.airSourceName)return"<div>"+t.cabin+":"+t.data.AdultQuotedPoints+"</div>"}).join("")}).join("")}}]},{label:"押位",prop:"yaWei",fixed:"right",custom:!0,width:100,button:{module:"button",title:"押位",prop:"yaWei",type:"primary",disabled:function(){return arguments[0].routeInfoEntities.length>1||arguments[0].airlinePriceInfos.every(function(e){return"AK_BIG_APP"!==e.airSourceName})},handle:function(){var t=arguments,a=this;arguments[0][this.prop+"_loading"]=!0,e.yaWei(arguments[0]).then(function(){t[0][a.prop+"_loading"]=!1})}}}],tableData:[],searchData:{}}}},m={render:function(){var e=this.$createElement;return(this._self._c||e)("search-table-template",{ref:"searchTable",attrs:{formInputList:this.formInputList,formButtonlist:this.formButtonlist,tableColumn:this.tableColumn,tableData:this.tableData}})},staticRenderFns:[]},p=a("VU/8")(s,m,!1,null,null,null);t.default=p.exports}});