<style> @import url('../assets/css/tripIndex.css'); @import url("../assets/css/UpgradedVersion.css"); @import url("../assets/css/tripIndexNew2.css"); @import url('../assets/css/detail.css'); @import url('../assets/css/tripIndexNewHV.css'); .confirmOrder { width: 950px; } .travelControlTrip .hangban-info tr td, .travelControlTrip .hangban-info tr th { padding-left: 0 !important; } .travelControlTrip .WeiXinShare { width: 118px; position: relative; top: 55px; } .edit_form_box { display: flex; justify-content: space-around; } .edit_form_box_tit { color: #000000; text-align: left; margin-top: 0; border-left: 2px solid #e95252; padding-left: 25px; } .TravelFlightList { width: 100%; background-color: #fff; } .TravelFlightList table { width: 100%; } .TFTable .el-button.is-circle { padding: 5px; } .TFTable .el-form-item { margin: 10px; } .TFTable i { font-size: 14px; } .TFTable .el-input--prefix .el-input__inner { padding-right: 0; } .TFAddFlight { width: 100%; height: 40px; text-align: center; line-height: 40px; color: #333; margin-top: 5px; background-color: #f1f1f1; font-size: 12px; border: 1px dashed #dcdcdc; cursor: pointer; } .w110 { width: 110px !important; } .w120 { width: 120px !important; } .normalBtn { color: #fff; padding: 0 15px; height: 30px; background: #E95252; border: 1px solid #E95252; cursor: pointer; border-radius: 15px; margin-left: 10px; } .hollowFixedBtn { background: #fff; color: #E95252; padding: 0 15px; height: 30px; border: 1px solid #E95252; cursor: pointer; border-radius: 15px; margin-left: 10px; } </style> <template> <div class="travelControlTrip" :style="{'width':dataAll&&dataAll.featurePageType==2?'1240px':'1754px'}" :class="[dataAll&& dataAll.feature&& dataAll.feature.featureType==9?'VerticalBjNew':'']"> <div class="trip_cover" v-show="pdfLoading" v-loading="pdfLoading" :element-loading-text="loadingText"></div> <el-row style="padding: 0 0 20px 0;box-shadow: 1px 10px 10px#e6e6e6;"> <el-col :span="14" class="row-aic"> <a id="pdfDownLoad" style="display:none;" target="_blank" href="http://www.baidu.com" download="xx.pdf">页面跳转</a> <template v-if="orderId>0"> <el-button type="primary" @click="toPDF_2023()"> 出团通知书下载</el-button> <template v-if="lineId==119||lineId==168"> <el-dropdown style="padding-left:20px;"> <el-button type="primary"> 出团通知书<i class="el-icon-arrow-down el-icon--right"></i> </el-button> <el-dropdown-menu slot="dropdown"> <el-dropdown-item @click.native="ToWord_2023()">出团通知书WORD</el-dropdown-item> <el-dropdown-item @click.native="OuZhouPdf2024()">出团通知书(欧洲PDF)</el-dropdown-item> </el-dropdown-menu> </el-dropdown> </template> <template v-else> <el-button type="primary" @click="ToWord_2023()"> 出团通知书下载WROD</el-button> </template> </template> <template v-else> <el-button type="primary" @click="toPDF_2023(1)"> 行程下载</el-button> <template v-if="lineId==119||lineId==168"> <el-dropdown style="padding-left:20px;"> <el-button type="primary"> 行程下载WORD<i class="el-icon-arrow-down el-icon--right"></i> </el-button> <el-dropdown-menu slot="dropdown"> <el-dropdown-item @click.native="ToWord_2023()">行程下载WORD</el-dropdown-item> <el-dropdown-item @click.native="OuZhouPdf2024()">行程下载(欧洲PDF)</el-dropdown-item> </el-dropdown-menu> </el-dropdown> </template> <template v-else> <el-button type="primary" @click="ToWord_2023()" style="margin-left:20px;"> 行程下载WORD</el-button> </template> </template> <!-- 可以让销售修改基本信息--> <el-button v-if="orderId>0" type="primary" value="修改信息" @click="editMsgShow=true" style="margin-left:20px;"> 修改信息</el-button> </el-col> <el-col v-if="orderId<=0"> <span style="color:red;padding-left:10px;">温馨提示:OP保存行程后请等待1-2分钟后再下载行程。</span> </el-col> </el-row> <div id="pdfNode" class="LeaveGroupDownload-form LeaveGroupDownload-formHV"> <div id="pdfDom" :class="[dataAll&&dataAll.featurePageType==1?'pdfDomHV':'']"> <!-- 首页 --> <LeaveGroupDownload :class="[dataAll&&dataAll.featurePageType==1?'pdfDomHVIndex':'']" :dataAll="dataAll" :vshowJ="vshowJ" :vshowL="vshowL" :WeiXinShareImgSrc="WeiXinShareImgSrc" :orderMsg="orderMsg" :orderTripdiff="orderTripdiff" :vshowLLR="vshowLLR" :vshowB="vshowB" :lineId="lineId" :priceList="priceList"> </LeaveGroupDownload> <!-- 行程特色 --> <ItineraryFeatures :dataAll="dataAll" :feature="feature" :vshowC="vshowC" :showType="showType"> </ItineraryFeatures> <!-- 行程天数 --> <travelDays v-if="dataAll&&dataAll.featurePageType==2" :dataAll="dataAll" :orderMsg="orderMsg" :orderTripdiff="orderTripdiff" :tripList="tripList" :vshowD="vshowD" :vshowK="vshowK" :feature="feature"> </travelDays> <travelDaysHV v-if="dataAll&&dataAll.featurePageType==1" :dataAll="dataAll" :orderMsg="orderMsg" :orderTripdiff="orderTripdiff" :tripList="tripList" :vshowD="vshowD" :vshowK="vshowK" :feature="feature"> </travelDaysHV> <!-- 团队费用说明 --> <TourFareDescription :vshowE="vshowE" :vshowF="vshowF" :dataList="dataList" :feature="feature"> </TourFareDescription> <!-- 订单须知 --> <OrderNotice :vshowG="vshowG" :feature="feature"></OrderNotice> <!-- 签证信息 --> <VisaInformation :vshowG="vshowG" :vshowM="vshowM" :vshowJ="vshowJ" :vshowI="vshowI" :feature="feature" :orderMsg="orderMsg"> </VisaInformation> </div> </div> <el-dialog title="修改信息" custom-class="confirmOrder" :visible.sync="editMsgShow" center> <el-form :model="editForm" label-width="100px"> <p class="edit_form_box_tit">集合地点&联系人</p> <div class="edit_form_box"> <div> <el-form-item label="本团领队"> <el-input v-model="editForm.leaderInfo"></el-input> </el-form-item> <el-form-item label="机场服务"> <el-input v-model="editForm.airportService"></el-input> </el-form-item> <el-form-item label="紧急联系人"> <el-input v-model="editForm.emergencyContact"></el-input> </el-form-item> </div> <div> <el-form-item label="集合时间"> <el-input v-model="editForm.gatheringTime"></el-input> </el-form-item> <el-form-item label="集合标识"> <el-input v-model="editForm.gatherIdent"></el-input> </el-form-item> <el-form-item label="集合地点"> <el-input v-model="editForm.gatheringAddress"></el-input> </el-form-item> </div> </div> <p class="edit_form_box_tit">航班信息</p> <div class="TravelFlightList"> <el-form label-width="0"> <table class="TFTable"> <tr> <th>航空公司</th> <th>航班</th> <th>起飞机场/时间</th> <th>到达机场/时间</th> <th>出发日期</th> <th>到达日期</th> <th>{{$t('system.table_operation')}}</th> </tr> <tr v-for="(priceFlight,index) in editForm.travelOrderFlightList" :key="priceFlight.code"> <td> <el-select class="w120" :placeholder="$t('pub.pleaseSel')" filterable v-model="priceFlight.airLineID" @change="airLineSelectChange(priceFlight.airLineID,priceFlight,1)"> <el-option :label="$t('pub.unlimitedSel')" :value="defaultSelectValue"></el-option> <el-option v-for="item in airLineList" :label="item.AlName" :value="item.AirLineId" :key="item.AirLineId"></el-option> </el-select> </td> <td> <el-select class="w120" :placeholder="$t('pub.pleaseSel')" filterable v-model="priceFlight.flightID" @change="flightSelectChange(priceFlight.flightID,priceFlight)"> <el-option :label="$t('pub.unlimitedSel')" :value="defaultSelectValue"></el-option> <el-option v-for="item in priceFlight.airportNameList" :label="item.Flight_number" :value="item.ID" :key="item.ID"></el-option> </el-select> </td> <td>{{priceFlight.departureAirPortName}} <template v-if="priceFlight.departureTime&& priceFlight.departureTime!=''">({{priceFlight.departureTime}})</template> </td> <td> {{priceFlight.arrivalAirPortName}}<template v-if="priceFlight.arrivalTime && priceFlight.arrivalTime!=''">({{priceFlight.arrivalTime}})</template> </td> <td> <el-date-picker class="w110" :clearable="false" v-model="priceFlight.startDate" type="date" value-format="yyyy-MM-dd"></el-date-picker> </td> <td> <el-date-picker class="w110" :clearable="false" v-model="priceFlight.arriveDate" type="date" value-format="yyyy-MM-dd"></el-date-picker> </td> <td> <el-tooltip class="item" effect="dark" :content="$t('system.table_delete')" placement="top-start"> <el-button type="danger" icon="el-icon-delete" @click="removePriceFlight(index,priceFlight,1)" circle></el-button> </el-tooltip> <el-tooltip class="item" v-if="index!=0" style="margin-left:0" effect="dark" content="上移" placement="top-start"> <el-button type="danger" icon="iconfont icon-shangyi" @click="MoveItem(priceFlight,index,0)" circle> </el-button> </el-tooltip> <el-tooltip class="item" v-if="index!=editForm.travelOrderFlightList.length-1" style="margin-left:0" effect="dark" content="下移" placement="top-start"> <el-button type="danger" icon="iconfont icon-xiayi1" @click="MoveItem(priceFlight,index,1)" circle> </el-button> </el-tooltip> </td> </tr> </table> </el-form> <div class="TFAddFlight" @click="addFlight()"> <i class="iconfont icon-img_haha"></i>添加 </div> </div> </el-form> <div slot="footer" class="dialog-footer"> <button class="normalBtn" type="primary" @click="submitForm()">{{$t('pub.saveBtn')}}</button> <button class="hollowFixedBtn" @click="editMsgShow = false">{{$t('pub.cancelBtn')}}</button> <button class="normalBtn" type="primary" @click="backForm()">还原</button> </div> </el-dialog> </div> </template> <script> import LeaveGroupDownload from './LeaveGroupDownload/index' import ItineraryFeatures from './LeaveGroupDownload/ItineraryFeatures' import travelDays from './LeaveGroupDownload/travelDays' import travelDaysHV from './LeaveGroupDownload/travelDaysHV' import TourFareDescription from './LeaveGroupDownload/TourFareDescription' import OrderNotice from './LeaveGroupDownload/OrderNotice' import VisaInformation from './LeaveGroupDownload/VisaInformation' import { setInterval, clearInterval } from 'timers'; export default { components: { LeaveGroupDownload, ItineraryFeatures, travelDays, travelDaysHV, TourFareDescription, OrderNotice, VisaInformation }, data() { return { dataAll: null, //微信分享图片 WeiXinShareImgSrc: "", //下拉框默认值 defaultSelectValue: 0, //航空公司下拉 airLineList: [], //orderId和是否op操作控制按钮显示 orderId: 0, editForm: {}, //团源基础数据 SourceData: { orderId: 0, leaderInfo: '', gatheringTime: '', airportService: '', gatherIdent: '', emergencyContact: '', gatheringAddress: '', flightInfoJson: '', travelOrderFlightList: [] }, editMsgShow: false, vshowA: this.$route.query.vshowA === undefined ? true : this.$route.query.vshowA === 'true', vshowB: this.$route.query.vshowB === undefined ? true : this.$route.query.vshowB === 'true', vshowC: this.$route.query.vshowC === undefined ? true : this.$route.query.vshowC === 'true', vshowD: this.$route.query.vshowD === undefined ? true : this.$route.query.vshowD === 'true', vshowE: this.$route.query.vshowE === undefined ? true : this.$route.query.vshowE === 'true', vshowF: this.$route.query.vshowF === undefined ? true : this.$route.query.vshowF === 'true', vshowG: this.$route.query.vshowG === undefined ? true : this.$route.query.vshowG === 'true', vshowH: this.$route.query.vshowH === undefined ? true : this.$route.query.vshowH === 'true', vshowI: this.$route.query.vshowI === undefined ? true : this.$route.query.vshowI === 'true', vshowJ: this.$route.query.vshowJ === undefined ? true : this.$route.query.vshowJ === 'true', vshowK: this.$route.query.vshowK === undefined ? true : this.$route.query.vshowK === 'true', vshowL: this.$route.query.vshowL === undefined ? true : this.$route.query.vshowL === 'true', vshowM: this.$route.query.vshowM === undefined ? true : this.$route.query.vshowM === 'true', vshowLLR: this.$route.query.vshowLLR === undefined ? true : this.$route.query.vshowLLR === 'true', vshowTCNUM: this.$route.query.vshowTCNUM === undefined ? false : this.$route.query.vshowTCNUM === 'true', vshowO: this.$route.query.vshowO === undefined ? true : this.$route.query.vshowO === 'true', list: [], tripList: [], priceList: [], feature: {}, dataList: {}, showType: -1, orderMsg: {}, //订单不同数据 orderTripdiff: {}, title: '', isClick: this.$route.query.isClick === undefined ? 0 : 1, //不算统计 lineId: 0, downLoadUrl: "", //文件下载 pdfLoading: false, loadingText: "", //加载文字 download_timer: null, } }, mounted() { this.orderId = this.$route.query.orderId; this.getWxCode(); this.getTripDetail(); this.getAirlines(); }, methods: { //获取微信二维码 getWxCode: function () { this.apipost('survey_post_GetSurveyWeiXinShare', { TCID: this.$route.query.tcid }, res => { if (res.data.resultCode == 1) { this.WeiXinShareImgSrc = res.data.data; } }) }, //还原表单 backForm() { var oldData = JSON.parse(JSON.stringify(this.SourceData)); this.editForm.orderId = this.$route.query.orderId; this.editForm.leaderInfo = oldData.leaderInfo; this.editForm.gatheringTime = oldData.gatheringTime; this.editForm.airportService = oldData.airportService; this.editForm.gatherIdent = oldData.gatherIdent; this.editForm.emergencyContact = oldData.emergencyContact; this.editForm.gatheringAddress = oldData.gatheringAddress; this.editForm.flightInfoJson = ""; this.editForm.travelOrderFlightList = []; this.editForm.travelOrderFlightList = oldData.travelOrderFlightList; this.editForm.travelOrderFlightList.forEach((item) => { this.airLineSelectChange(item.airLineID, item); }); }, removePriceFlight: function (index, item, type) { var that = this that.Confirm("删除航班后将不能恢复?", function () { if (index > -1) { that.editForm.travelOrderFlightList.splice(index, 1) } }); }, airLineSelectChange: function (airLineId, item, type) { item.airLineID = airLineId this.airLineList.forEach(x => { if (x.AirLineId == airLineId) { item.alName = x.AlName } }); if (type == 1) { item.flightID = 0; item.flightNumber = ""; item.departureAirPortName = ""; item.departureTime = ""; item.arrivalAirPortName = ""; item.arrivalTime = ""; } let msg = { airlineID: airLineId } this.apipost( 'flight_post_GetAirportNameList', msg, res => { if (res.data.resultCode == 1) { item.airportNameList = res.data.data; } }) this.$forceUpdate(); }, flightSelectChange(flightId, item) { item.airportNameList.forEach(x => { if (x.ID == flightId) { item.flightNumber = x.Flight_number.split('/')[0]; item.departureAirPortName = x.dName; item.departureTime = x.DepartureTime; item.arrivalAirPortName = x.aName; item.arrivalTime = x.ArrivalTime; } }); }, //初始化航空公司下拉 getAirlines() { this.apipost('airline_post_GetList', {}, res => { if (res.data.resultCode == 1) { this.airLineList = res.data.data } }) }, addFlight: function () { let obj = { airLineID: 0, flightID: 0, alName: '', flightNumber: '', startDate: '', departureTime: '', departureAirPortName: '', arrivalTime: '', arrivalAirPortName: '', stopoverAirPortName: '', flightState: 0, arriveDate: '', airportNameList: [], } this.editForm.travelOrderFlightList.push(obj) }, setDate: function (j) { let stDate = ""; if (this.priceList && this.priceList.length > 0) { stDate = this.priceList[0].startDate; } if (j === 0) { return stDate } else { if (stDate) { let d = new Date(stDate) d = d.getTime(d); let add = d + ((24 * 60 * 60 * 1000) * j) let date = new Date(add); //时间戳为10位需*1000,时间戳为13位的话不需乘1000 let Y = date.getFullYear() + '-'; let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'; let D = date.getDate() < 10 ? ('0' + date.getDate()) + ' ' : date.getDate() + ' '; return Y + M + D; } else { return ""; } } }, //检查文件是否生成 checkFile(configId, fileName) { var that = this; let urlObj = this.domainManager(); var checkUrl = urlObj.ocrUrl + "/Home/CheckFile?configId=" + configId + "&url=" + encodeURIComponent(this.downLoadUrl); this.loadingText = "正在生成PDF文件..."; this.$http({ headers: { 'Content-Type': 'application/json' }, method: 'get', url: checkUrl, data: {} }).then(res => { if (res.data == 1) { clearInterval(this.download_timer); this.loadingText = "正在下载PDF文件..."; var ocrUrl = ""; ocrUrl = urlObj.ocrUrl + "/Home/DownloadFileForPdfERP?configId=" + configId + "&url=" + encodeURIComponent(that.downLoadUrl); that.$http({ headers: { 'Content-Type': 'application/json' }, method: 'get', url: ocrUrl, data: {}, responseType: 'arraybuffer', onDownloadProgress: (progressEvent) => { const progress = Math.round((progressEvent.loaded / progressEvent.total) * 100); that.loadingText = `正在下载` + (that.orderId > 0 ? "出团通知书" : "行程") + `文件` + progress + `%,请勿关闭或刷新页面...`; // 在这里处理下载进度, 如更新界面上的进度条 } }).then(res => { that.pdfLoading = false; let blob = new Blob([res.data], { type: "application/pdf" }) let fileUrl = URL.createObjectURL(blob); let link = document.getElementById('pdfDownLoad'); link.href = fileUrl; link.setAttribute("download", fileName); link.click(); that.loadingText = ""; //删除缓存的Key var deleteUrl = urlObj.ocrUrl + "/Home/DeteleKey?configId=" + configId + "&url=" + encodeURIComponent(this.downLoadUrl); that.$http({ headers: { 'Content-Type': 'application/json' }, method: 'get', url: deleteUrl, data: {}, }).then(dRes => { console.log("dRes", dRes); }); }).catch(err => { that.pdfLoading = false }) } }).catch(err => { that.loadingText = ""; that.pdfLoading = false; clearInterval(that.download_timer); }) }, //获取参数 getPostMsg() { var postData = { configId: this.$route.query.configId, cityId: this.$route.query.cityId, tcid: this.$route.query.tcid, orderId: this.$route.query.orderId, unionfid: this.$route.query.unionfid, GuestIds: this.$route.query.GuestIds, //是否显示基础信息 isShowBase: this.vshowA ? 1 : 0, //是否显示航班 isShowFlight: this.vshowB ? 1 : 0, //是否显示行程特色 isShowFeature: this.vshowC ? 1 : 0, //自费、费用包含、费用不含 isShowFee: this.vshowE ? 1 : 0, //购物说明,购物安排 isShowShop: this.vshowF ? 1 : 0, //重要提示、温馨提示 [订单须知] isShowTip: this.vshowG ? 1 : 0, //是否显示同行备注 isShowB2B: this.vshowI ? 1 : 0, //是否显示行程 isShowTrip: this.vshowD ? 1 : 0, //是否显示标题 isShowTitle: this.vshowL ? 1 : 0, //是否显示旅客名单 isShowGuest: this.vshowM ? 1 : 0, //是否显示紧急联系人 isShowMan: this.vshowLLR ? 1 : 0, //是否显示团号 isShowTCNUM: this.vshowTCNUM ? 1 : 0, //是否显示行程图片 isShowTripImage: this.vshowK ? 1 : 0, //是否显示签证信息 isShowVisa: this.vshowH ? 1 : 0, //是否显示视频图片 isShowVideoImg: this.vshowO ? 1 : 0, //isPc是否PC下载 isPc: 2, //模板参数 templateId: this.showType, //用户Id UId: this.getLocalStorage().EmployeeId } return postData; }, ToWord_2023: function (title) { var title = this.orderMsg.startDate + this.orderMsg.lineteamName + this.orderMsg.dayNum + '日游' this.pdfLoading = true; this.loadingText = "正在生成Word文件..."; let msg = this.getPostMsg(); let urlObj = this.domainManager(); this.$http({ headers: { 'Content-Type': 'application/json' }, method: 'post', url: urlObj.DomainUrl + '/api/file/GetToWord_2023', data: { "msg": msg } }).then(res => { if (res.data.resultCode === 1) { this.loadingText = "正在下载Word文件..."; let sign = title; const a = document.createElement('a'); a.setAttribute('download', ''); a.setAttribute('href', urlObj.DomainUrl + '/api/file/DownloadFileForPdf?fileName=' + sign + '.doc&&fPath=' + res.data.data); a.click(); this.loadingText = ""; } else { this.Error('WORD获取失败'); } this.pdfLoading = false }).catch(err => { }) }, OuZhouPdf2024: function () { var title = ""; if (this.priceList && this.priceList.length > 0 && this.priceList[0].priceFlight && this.priceList[0] .priceFlight.length > 0) { if (this.priceList[0].priceFlight[0].alName && this.priceList[0].priceFlight[0].alName != '') { title += this.priceList[0].priceFlight[0].alName; } } title += this.orderMsg.startDate; //欧洲 if (this.dataAll.lineId == 168 || this.dataAll.lineId == 119) { if (this.dataAll.title.length > 60) { title += this.dataAll.title.substring(0, 60); } else { title += this.dataAll.title; } } else { title += this.orderMsg.lineteamName + this.orderMsg.dayNum + '日游'; } this.pdfLoading = true; this.loadingText = "正在生成PDF文件..."; let msg = this.getPostMsg(); let urlObj = this.domainManager(); var that = this; var fileName = title + ".pdf"; this.$http({ headers: { 'Content-Type': 'application/json' }, method: 'post', url: urlObj.DomainUrl + '/api/file/OuZhouPdf2024', data: { "msg": msg } }).then(res => { if (res.data.resultCode === 1) { this.loadingText = "正在下载pdf文件..."; let path = res.data.data; that.downLoadUrl = path; that.pdfLoading = true; this.download_timer = setInterval(function () { that.checkFile(msg.configId, fileName) }, 2000); } else { this.Error('WORD获取失败'); } }).catch(err => { }) }, // 生成pdf toPDF_2023: function (command) { var that = this; let msg = this.getPostMsg(); var title = ""; if (this.priceList && this.priceList.length > 0 && this.priceList[0].priceFlight && this.priceList[0] .priceFlight.length > 0) { if (this.priceList[0].priceFlight[0].alName && this.priceList[0].priceFlight[0].alName != '') { title += this.priceList[0].priceFlight[0].alName; } } title += this.orderMsg.startDate; //欧洲 if (this.dataAll.lineId == 168 || this.dataAll.lineId == 119) { if (this.dataAll.title.length > 60) { title += this.dataAll.title.substring(0, 60); } else { title += this.dataAll.title; } } else { title += this.orderMsg.lineteamName + this.orderMsg.dayNum + '日游'; } //阿里云行程下载 var objFileKey = "TripDownLoad" objFileKey += "/" + msg.configId + "_" + msg.tcid; var fileName = title + ".pdf"; if (this.orderId && this.orderId > 0) { //出团通知书下载 this.pdfDownLoad(fileName, msg); } else if (command && command == 1) { this.pdfLoading = true; objFileKey += "/" + msg.configId + "_" + msg.tcid + "_B2B.pdf?d=" + Math.random(); that.downloadChengDuFileRename(objFileKey, fileName, res => { this.pdfLoading = false; if (res.resultCode == 0) { msg.isShowB2B = 1; that.pdfDownLoad(fileName, msg); } }) } else if (command && command == 2) { objFileKey += "/" + msg.configId + "_" + msg.tcid + ".pdf"; this.pdfLoading = true; that.downloadChengDuFileRename(objFileKey, fileName, res => { this.pdfLoading = false; if (res.resultCode == 0) { msg.isShowB2B = 0; that.pdfDownLoad(fileName, msg); } }) } else { that.pdfDownLoad(fileName, msg); } }, pdfDownLoad: function (fileName, msg) { var that = this; let urlObj = this.domainManager(); this.$http({ headers: { 'Content-Type': 'application/json' }, method: 'post', url: urlObj.DomainUrl + '/api/file/DownLoadPdf2023Url', data: { "msg": msg } }).then(res => { if (res.data.resultCode === 1 && res.data.data) { let path = res.data.data; that.downLoadUrl = path; that.pdfLoading = true; this.download_timer = setInterval(function () { that.checkFile(msg.configId, fileName) }, 2000); } else { that.pdfLoading = false that.$message.error('PDF获取失败'); } }).catch(err => { }) }, //保存基础数据 submitForm: function () { this.editForm.travelOrderFlightList.forEach(x => { x.airportNameList = []; }); this.editForm.FlightInfoJson = JSON.stringify(this.editForm.travelOrderFlightList); this.editForm.travelOrderFlightList = []; this.apipost('sellorder_post_SetOrderTripDiff', this.editForm, res => { if (res.data.resultCode == 1) { this.Success(res.data.message); this.editMsgShow = false; this.getTripDetail(); } else { this.Error(res.data.message); } }); }, DateDiff(sDate1, sDate2) { //sDate1和sDate2是2002-12-18格式 var aDate, oDate1, oDate2, iDays aDate = sDate1.split("-") oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]) //转换为12-18-2002格式 aDate = sDate2.split("-") oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]) iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) //把相差的毫秒数转换为天数 return iDays }, getTripDetail() { var unionfid = 0; if (this.$route.query.unionfid) { unionfid = this.$route.query.unionfid; } this.pdfLoading = true; this.loadingText = "正在获取行程信息..."; this.apipost('b2b_get_GetB2BTravelInfoNoDes', { configId: this.$route.query.configId, cityId: this.$route.query.cityId, tcid: this.$route.query.tcid, orderId: this.$route.query.orderId, isClick: this.isClick, //不算统计 unionfid: unionfid, GuestIds:this.$route.query.GuestIds, }, res => { this.pdfLoading = false; this.loadingText = ""; if (res.data.resultCode == 1) { let data = (res.data.data); this.dataAll = data; this.orderTripdiff = data.orderTripdiff; this.lineId = data.lineId; this.orderMsg = data.orderMsg; if (this.orderTripdiff && this.orderTripdiff.flightInfoJson) { this.orderTripdiff.travelOrderFlightList = JSON.parse(this.orderTripdiff.flightInfoJson); if (this.orderMsg.outNotice == 1) { if (this.orderTripdiff.travelOrderFlightList != null && this.orderTripdiff.travelOrderFlightList .length > 0) { this.orderTripdiff.travelOrderFlightList.forEach(subItem => { subItem.flightState = 1; }); } } } //HK新加 this.SourceData.Id = 0; if (this.$route.query.orderId > 0) { this.SourceData.orderId = this.$route.query.orderId; this.SourceData.leaderInfo = this.orderMsg.leaderInfo; this.SourceData.gatheringTime = this.orderMsg.gatheringTimeInfo; this.SourceData.airportService = this.orderMsg.airportServiceInfo; this.SourceData.gatherIdent = this.orderMsg.gatherIdentInfo; this.SourceData.emergencyContact = this.orderMsg.emergencyContactInfo; this.SourceData.gatheringAddress = this.orderMsg.gatheringAddressInfo; if (data.priceList != null && data.priceList.length > 0) { var array = JSON.parse(JSON.stringify(data.priceList[0].priceFlight)); this.SourceData.travelOrderFlightList = []; array.forEach(fItem => { this.SourceData.travelOrderFlightList.push({ airLineID: fItem.airLineID, flightID: fItem.flightID, alName: fItem.alName, flightNumber: fItem.flightNumber, startDate: fItem.startDate, departureTime: fItem.departureTime, departureAirPortName: fItem.departureAirPortName, arrivalTime: fItem.arrivalTime, arrivalAirPortName: fItem.arrivalAirPortName, stopoverAirPortName: fItem.stopoverAirPortName, flightState: fItem.flightState, arriveDate: fItem.arriveDate, airportNameList: [], }); }); } if (this.orderTripdiff) { this.editForm = JSON.parse(JSON.stringify(this.orderTripdiff)); if (this.orderTripdiff.flightInfoJson) { this.editForm.travelOrderFlightList = JSON.parse(this.orderTripdiff.flightInfoJson); } } else { this.editForm = JSON.parse(JSON.stringify(this.SourceData)); } this.editForm.travelOrderFlightList.forEach(fItem => { fItem.airportNameList = []; this.airLineSelectChange(fItem.airLineID, fItem); }); } this.title = this.orderMsg.startDate + this.orderMsg.lineteamName + this.orderMsg.dayNum + '日游' document.title = this.title; //初始化行程 this.initTrip(res, data); } }); }, //上移下移(IsUp:0上移,1下移) MoveItem(item, subIndex, IsUp) { var currentItem = this.editForm.travelOrderFlightList[subIndex]; //上移 if (IsUp == 0) { if (subIndex > 0) { var upItem = this.editForm.travelOrderFlightList[subIndex - 1]; this.$set(this.editForm.travelOrderFlightList, subIndex - 1, currentItem); this.$set(this.editForm.travelOrderFlightList, subIndex, upItem); this.$forceUpdate(); } } else { //下移 if (subIndex != this.editForm.travelOrderFlightList.length - 1) { var downItem = this.editForm.travelOrderFlightList[subIndex + 1]; this.$set(this.editForm.travelOrderFlightList, subIndex + 1, currentItem); this.$set(this.editForm.travelOrderFlightList, subIndex, downItem); this.$forceUpdate(); } } }, //初始化行程 initTrip(res, data) { this.tripList = res.data.data.dayList; this.feature = res.data.data.feature this.showType = this.feature.featureType; if (data.priceList.length > 0) { data.priceList[0].priceFlight.forEach((x, i) => { if (i == 0) { x.dayNum = 1; if (x.departureTime < x.arrivalTime) { x.daodaDay = 1; } else { x.daodaDay = 2; } } else { x.dayNum = this.DateDiff(data.priceList[0].priceFlight[0].startDate, x.startDate); if (x.departureTime < x.arrivalTime) { x.daodaDay = x.dayNum; } else { x.daodaDay = x.dayNum + 1; } } }) } this.priceList = data.priceList; this.dataList = data; this.tripList.forEach((x, j) => { let useDinnerTypeBy = '' let jin = [], jiu = [], jiu2 = [], jiao = [], dadian = [], tips = [], activy = [], can = { breakfirst: '敬请自理', lanuch: '敬请自理', dinner: '敬请自理' } x.dayArray.forEach((y, index) => { if (y.type == 7 && y.childItem.title != '') { let obj = { title: y.childItem.title, content: y.childItem.description, img: y.childItem.imaArray && y.childItem.imaArray.length > 0 ? y.childItem.imaArray[0] .url : '', ticketName: '', playTimeHour: null, playTimeMinutes: null, url: '' } dadian.push(obj) } else if (y.type == 1) { let title = '' if (y.childItem.subTraffic && y.childItem.subTraffic.length > 0) { y.childItem.subTraffic.forEach((z, i) => { title += z.startCityName if (z.arrivalType == 1) { title += '<i class="iconfont icon-feiji"></i>' } else if (z.arrivalType == 2) { title += '<i class="iconfont icon-bus"></i>' } else if (z.arrivalType == 3) { title += '<i class="iconfont icon-icon31"></i>' } else { title += '<i class="iconfont icon-gaotiedongche"></i>' } if (i + 1 == y.childItem.subTraffic.length) { title += z.arrivalCityName } }) } var imgUrl = ""; if (y.childItem.trafficIntroduce && y.childItem.trafficIntroduce.introduceImage && y.childItem .trafficIntroduce.introduceImage != '') { imgUrl = y.childItem.trafficIntroduce.introduceImage; } let obj = { title: title, content: y.childItem.description, img: imgUrl, ticketName: '', playTimeHour: null, playTimeMinutes: null, url: '' } jiao.push(obj) } else if (y.type == 2 && y.childItem.couponsName != '' && y.childItem.imaArray.length > 0) { let obj = { title: y.childItem.couponsName, content: y.childItem.description, img: y.childItem.imaArray[0].url, videoPath: y.childItem.imaArray[0].videoPath, fileType: y.childItem.imaArray[0].fileType, ticketName: y.childItem.couponsTicketName, playTimeHour: y.childItem.playTimeHour, playTimeMinutes: y.childItem.playTimeMinutes, scenicJson: y.childItem.scenicJson, url: y.childItem.url } jin.push(obj) } else if (y.type == 3 && y.childItem.hotelName != '' && y.childItem.imaArray.length > 0) { //酒店 let obj = { title: y.childItem.hotelName, newTitle: y.childItem.newHotelName, status: y.childItem.status, content: y.childItem.description, img: y.childItem.imaArray[0].url, ticketName: '', playTimeHour: null, playTimeMinutes: null, url: y.childItem.url } jiu.push(obj) } else if (y.type == 4) { if (y.childItem.useDinnerType == "1") { can.breakfirst = y.childItem.dinnerName } else if (y.childItem.useDinnerType == "2") { can.lanuch = y.childItem.dinnerName } else if (y.childItem.useDinnerType == "3") { can.dinner = y.childItem.dinnerName } } else if (y.type == 5) { let obj = { title: '自由活动', content: y.childItem.description, img: '', ticketName: '', playTimeHour: null, playTimeMinutes: null, url: '' } activy.push(obj) } else if (y.type == 6) { let obj = { title: y.childItem.title, content: y.childItem.description, img: '', ticketName: '', playTimeHour: null, playTimeMinutes: null, url: '' } tips.push(obj) } if (y.type == 3) { jiu2.push({ name: y.childItem.hotelName, url: y.childItem.url, newTitle: y.childItem.newHotelName, status: y.childItem.status, }); useDinnerTypeBy = y.childItem.useDinnerType } }) if (can.breakfirst == '敬请自理' && useDinnerTypeBy.indexOf('1') != -1) { can.breakfirst = '酒店内享用早餐' } else if (can.breakfirst == '') { can.breakfirst = '方便游玩敬请自理' } if (can.lanuch == '敬请自理' && useDinnerTypeBy.indexOf('2') != -1) { can.lanuch = '酒店自助' } else if (can.lanuch == '') { can.lanuch = '方便游玩敬请自理' } if (can.dinner == '敬请自理' && useDinnerTypeBy.indexOf('3') != -1) { can.dinner = '酒店自助' } else if (can.dinner == '') { can.dinner = '方便游玩敬请自理' } x.can = can let details = []; x.tips = tips x.jiu2 = jiu2 if (jin.length > 0) { details = jin } else if (dadian.length > 0) { if (dadian && dadian.length > 0 && jiao && jiao.length > 0) { if (jiao[0].img) { dadian[0].img = jiao[0].img; } } details = dadian; } else if (jiao.length > 0) { if (j == this.tripList.length - 1) { let obj = { title: '温暖的家', content: '感谢您参加本次行程,期待下次与您相遇', img: '' } details.push(obj) } else { details = jiao } } else if (activy.length > 0) { details = activy } x.title = dadian.length > 0 && dadian[0].title && dadian[0].title != '' ? dadian[0].title : (jiao .length > 0 ? jiao[0].title : '集合出发') x.details = details if (x.details.length == 0) { if (j == 0) { let obj = { title: '集合出发', content: '向着远方的目标出发起飞', img: '', ticketName: '', playTimeHour: null, playTimeMinutes: null } details.push(obj) } else if (j == this.tripList.length - 1) { let obj = { title: '温暖的家', content: '感谢您参加本次行程,期待下次与您相遇', img: '', ticketName: '', playTimeHour: null, playTimeMinutes: null } details.push(obj) } } else { if (x.title == '集合出发') { x.details.forEach(xc => { if (xc.title !== undefined) x.title = xc.title + '~' }) if (x.title == '集合出发') { if (j > 0 && j < tripList.length - 1) x.title = '自由活动' } else { x.title = x.title.substring(0, x.title.length - 1) } } } x.islast = (j + 1) == this.tripList.length this.$set(this.tripList, j, x) x.dateTime = this.setDate(j); }) }, }, } </script>