<style lang="scss">
   @import url("@/asset/css/flex.css");
.backBox{
    width: 45rpx;
    height:45rpx;
    background: rgba(23,23,23,.5);
    border-radius: 50%;
    margin-top: 22rpx;
}
.backIcon{
    display: inline-block;
    margin-top: 6rpx;
}
.backBox img{
    width: 19rpx;
    height: 24rpx;
    display: inline-block;
    margin-top: 10rpx;
}
.itiner-title {
    line-height: 45px !important;
    font-size: 16px;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    box-sizing: content-box;
    z-index: 5;
    background-color: #0072FF;
    padding-left: 6rpx;
}
.itiner-titles{
    color: #fff;
}
.bjLine{
    background: #F5F5F5;
    height: 30rpx;
}
.itiner-c-title{
    font-weight: bold;
}
.itiner-xincheng img{
    width: 31rpx;
    height: 33rpx;
}
.itiner-xincheng-left{
    color: #838383;
}
.itiner-xincheng-right view{
    border: 1rpx solid #3581DA;
    color: #3581DA;
    border-radius: 8rpx;
    padding: 0 8rpx;
}
.itiner-left-line{
    width: 9rpx;
    height: 25rpx;
    border-radius: 100rpx;
    background: #000;
}
.itiner-titleBox{
    border-bottom: 1px solid #eee;
}
.itiner-title-c{
    padding: 25rpx 20rpx;
}
.itiner-title-c.itiner-title-c-top{
    padding: 0rpx 20rpx;
}
.itiner-title-c.active{
    position: relative;
    color: #327FDE;
}
.itiner-title-c.active::after{
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 5rpx;
    background: #3581DA;
}
.itiner-feiyong{
    background: #FF9702;
    color: #fff;
    border-radius: 10rpx;
    padding: 0rpx 20rpx;
}
.media{
    position: relative;
}
.detailsType{
    position: absolute;
    left: 20rpx;
    bottom: 10rpx;
    background: #0130B0;
    color: #fff;
    border-radius: 25rpx;
    padding: 3rpx 20rpx 7rpx 20rpx;
    z-index: 2;
}
.richText{
	white-space: pre-wrap;
}
.name-ali{
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    margin-right: 200rpx;
}
</style>
<template>
    <scroll-view ref="scrollView" scroll-y="true" 
    style="width: 100%; height: 100vh;" 
        @scroll="scroll"
        :scroll-top="scrollTop">
        <view class="media" :style="{ opacity: 100 - boxOption + '%' }" 
        @click="openPicture">
            <u-swiper 
                :list="dataList.tempImgCover" 
                :effect3d="false" 
                :height="545" 
                :interval="5000" 
                :border-radius="0"
                name="Url"
                mode="number"
                indicatorPos="bottomRight">
            </u-swiper>
            <view @click="goback" :style="[titleStyle, { opacity: '100% !important' }]"
                style="position: fixed; top: 0; left: 0; padding-left: 6rpx">
                <view class="backBox text-center">
                    <u-icon class="backIcon" name="arrow-left" size="32" color="#FFF"></u-icon>
                </view>
            </view>
            <!-- <view @click="goback" :style="[titleStyle, { opacity: '100% !important' }]"
                style="position: fixed; top: 0; right: 200rpx; padding-right: 6rpx">
                <view class="backBox text-center">
                    <img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638762515984923148.png" />
                </view>
            </view> -->
            <view class="detailsType fz24">{{ dataList.teamType==0?'跟团游':dataList.teamType==1?'小包团':'一日游' }}</view>
        </view>
        <view class="itiner-title" :style="[titleStyle]">
            <view class="itiner-titles row items-center text-center">
                <view @click="goback">
                    <u-icon name="arrow-left" size="38"></u-icon>
                </view>
                <view style="flex: 1; margin-left: 30rpx; text-align: left" class="name-ali">
                    {{ dataList.title?dataList.title:'' }}
                </view>
            </view>
            <view class="PX30 itiner-titleBox bgFFF row items-center justify-between">
                <view class="itiner-title-c itiner-title-c-top fz30"
                :class="[current==item.ID?'active':'']"
                v-for="(item,index) in titlesList"
                :key="index"
                @click="goTop(item)">
                    {{ item.Name }}
                </view>
            </view>
        </view>
        
        <view class="itiner-content">
            <view class="PX30 PB20">
                <view class="PT25 PB30 fz32 itiner-c-title">
                    {{ dataList.title?dataList.title:'' }}
                </view>
                <view class="row justify-between items-center">
                    <view class="row items-center">
                        <view class="row items-center"><view class="fz28 color9C9C9C">同业价：</view> <text class="fontBold fz38 colorF99710">{{priceList&&priceList.length>0?priceList[0].b2BPrice:0}}</text><text class="fz24 ML10"> / 人</text></view>
                        <view class="row  items-center ML30"><view class="fz28 color9C9C9C">统一售价：</view> <text class="fontBold fz38 colorF99710">{{priceList&&priceList.length>0?priceList[0].b2CPrice:0}} </text><text class="fz24 ML10"> / 人</text></view>
                    </view>
                    <!-- <view>
                        <u-icon class="backIcon" name="arrow-down" size="32" color="#9D9D9D"></u-icon>
                        <u-icon class="backIcon" name="arrow-up" size="32" color="#9D9D9D"></u-icon>
                    </view> -->
                </view>
                <!-- <view class="colorE1432E fz28 PT10">
                    op备注: 
                </view> -->
            </view>
            <view class="bjLine"></view>
            <view class="PX30 PB20">
                <view class="MT15 itiner-xincheng row items-center">
                    <img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638875112655075900.png"/>
                    <view class="itiner-xincheng-left ML30 MR30 fz26">行程天数</view>
                    <view class="itiner-xincheng-right fz28 row items-center"> {{ dataList.dayNum>=0?dataList.dayNum:'' }}<text class="ML10 MR10">天</text> 
                        {{ dataList.nightNum>=0?dataList.nightNum:'' }} <tetx class="ML10 MR10">晚</tetx> 
                        {{ dataList.teamType==0?'跟团游':dataList.teamType==1?'小包团':'一日游' }} 
                        <view class="ML30 MR10" @click="downloadTripPlanHandler">行程下载</view></view>
                </view>
                <view class="MT10 itiner-xincheng row items-center">
                    <img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638875112698474332.png"/>
                    <view class="itiner-xincheng-left ML30 MR30 fz26">出发城市</view>
                    <view class="itiner-xincheng-right fz28 row items-center">{{ dataList.startCityName?dataList.startCityName:'' }}</view>
                </view>
            </view>
            <view class="bjLine"></view>
            <view class="PX30">
                <view class="PY20 row justify-between items-center" @click="showQinDan=!showQinDan">
                    <view class="row items-center">
                        <view class="itiner-left-line">&nbsp;</view>
                        <text class="fz32 fontBold ML20">报名清单</text>
                    </view>
                    <view>
                        <u-icon class="backIcon" :name="!showQinDan?'arrow-down':'arrow-up'" size="32" color="#9D9D9D"></u-icon>
                    </view>
                </view>
                <view class="" v-if="showQinDan">
                    <view class="fz28">
                        <view>本团机位</view>
                        <template v-if="priceList&&priceList.length>0">
                            <view v-if="priceList[0].CSeat>0">头等舱: {{ priceList[0].cSeat }}</view>
                            <view v-if="priceList[0].FSeat>0">商务 : {{ priceList[0].fSeat }}</view>
                            <view v-if="priceList[0].YSeat>0">经济: {{ priceList[0].ySeat }}</view>
                        </template>
                    </view>
                    <view class="fz28 PT15 PB20">报名人数{{ dataList.offerNumber?dataList.offerNumber:'' }}</view>
                </view>
            </view>
            <view class="bjLine"></view>
            <view class="PX30">
                <view class="PY20 row justify-between items-center" @click="showMaiDian=!showMaiDian">
                    <view class="row items-center">
                        <view class="itiner-left-line">&nbsp;</view>
                        <text class="fz32 fontBold ML20">本团卖点</text>
                    </view>
                    <view>
                        <u-icon class="backIcon" :name="!showMaiDian?'arrow-down':'arrow-up'" size="32" color="#9D9D9D"></u-icon>
                    </view>
                </view>
                <view v-if="showMaiDian" class="">
                    <view v-if="dataList.productRecommend" class="fz28 PB20">
                        <rich-text :nodes="dataList.productRecommend" class="richText"></rich-text>
                    </view>
                    <view v-else class="fz28 PB20" style="color: #7B7B7B;">暂未填写</view>
                </view>
            </view>
            <view class="bjLine"></view>
            <view class="PX30">
                <view class="PY20 row justify-between items-center" @click="showHangBan=!showHangBan">
                    <view class="row items-center">
                        <view class="itiner-left-line">&nbsp;</view>
                        <text class="fz32 fontBold ML20">航班信息</text>
                    </view>
                    <view>
                        <u-icon class="backIcon" :name="!showHangBan?'arrow-down':'arrow-up'" size="32" color="#9D9D9D"></u-icon>
                    </view>
                </view>
                <view v-if="showHangBan" class="">
                    <template v-if="priceList.length>0">
                        <view class="fz28 PB20">
                            <view class="priceFlightTitle row color000">
                                <view class="flex1">航空</view>
                                <view class="flex1">出发机场</view>
                                <view class="flex1">到达机场</view>
                            </view>
                            <view class="priceFlightText fz28 row color666 MT20" v-for="(item,index) in priceList[0].priceFlight">
                                <view class="flex1">
                                    {{ item.alName }}
                                    <view class="fz24">{{ item.flightNumber }}</view>
                                </view>  
                                <view class="flex1">
                                    {{ item.departureAirPortName }}
                                    <view class="fz24">{{ item.startDate }} {{ item.departureTime }} </view>
                                    <view v-if="item.stopoverAirPortName" class="fz24">
                                        中:{{ item.stopoverAirPortName }}
                                    </view>
                                </view>
                                <view class="flex1">
                                    {{ item.arrivalAirPortName }}
                                    <view class="fz24">{{ item.arriveDate }} {{ item.arrivalTime }} </view>
                                </view>
                            </view>
                        </view>
                    </template>
                    <view v-else class="fz28 PB20" style="color: #7B7B7B;">暂未航班信息</view>
                </view>
            </view>
            <view class="bjLine"></view>
            <view class="PX30 itiner-titleBox row items-center justify-between">
                <view class="itiner-title-c fz30"
                :class="[current==item.ID?'active':'']"
                v-for="(item,index) in titlesList"
                :key="index"
                @click="goTop(item)">
                    {{ item.Name }}
                </view>
            </view>
            <view class="PX30" id="title1">
                <view class="PY20 row items-center">
                    <view class="itiner-left-line">&nbsp;</view>
                    <text class="fz32 fontBold ML20">行程特色</text>
                </view>
                <view v-if="dataList.feature&&dataList.feature.tripImageList&&dataList.feature.tripImageList.length>0">
                    <image v-for="x in dataList.feature.tripImageList" :src="x" mode="widthFix" 
                    @click='previewTravelPicHandler(x,dataList.feature.tripImageList)'
					 style="width: 100%">
                     </image>
                </view>
            </view>
            <view class="PX30" id="title2">
                <view class="PY20 row items-center">
                    <view class="itiner-left-line">&nbsp;</view>
                    <text class="fz32 fontBold ML20">行程介绍</text>
                </view>
                <view>
                    <view v-if="d.length>0&&dataList.feature&&dataList.feature.detailsImageList.length==0">
                        <view v-for="(x,i) in d" :key="i" class="column PB20">
                            <view class="column fz32 fontBold PB20">
                                <text>第{{(i+1)>9?(i+1):'0'+(i+1)}}天</text>
                                <text class="fz28 MT20" style="font-family: microsoft yahei ui light;">
                                    {{x.title}}
                                </text>
                            </view>
                            
                            <template v-for="(y,yi) in x.dayArray">
                                <view v-if="y.childItem&&y.childItem.imaArray&&y.childItem.imaArray.length>0&&y.type==2"
                                    class="MB20" 
                                    style="border: 1px solid #ddd;">
                                    <view v-for="(z,zi) in y.childItem.imaArray">
                                        <image 
                                        @click="previewImages(y.childItem.imaArray,zi)" 
                                        :src="z.url" mode="aspectFill" 
                                        :key="zi" style="width: 100%;"
                                        v-if="y.type==2"></image>
                                    </view>
                                    <view :key="yi" v-if="y.type==2" class="PA20">
                                        <view class="fz30 fontBold PB20">{{`${y.childItem.couponsName}`}}</view>
                                        <view class="fz28 color666">
                                            <rich-text :nodes="y.childItem.description" class="richText"></rich-text>
                                        </view>
                                    </view>
                                </view>
                                <view :key="yi" v-if="y.type==6">
                                    <view class="fz30 fontWeight500 PY20 colorE1432E">温馨提示</view>
                                    <view class="fz28 PB20 color666">
                                        <rich-text :nodes="y.childItem.description" class="richText"></rich-text>
                                    </view>
                                </view>
                            </template>
                            <view class="row" v-if="x.canshi">
                                <view>
                                    <image style="width: 45rpx;height: 45rpx;display: block;"
                                    mode="aspectFill"
                                    src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638876765053973357.png"/>
                                </view>
                                <view class="PL20">
                                    <view class="row PB20" v-for="item in x.canshi">
                                        <view class="fz34 fontBold MR20 flexS">
                                            {{`${item.childItem.timeStr} ${item.childItem.dinnerTypeName}`}}
                                        </view>
                                        <view class="fz28 MR20 color666">{{item.childItem.dinnerName?item.childItem.dinnerName:'方便游玩敬请自理'}}</view>
                                    </view>
                                </view>
                            </view>
                            <view class="row" v-if="x.zhusu">
                                <view>
                                    <image style="width: 45rpx;height: 45rpx;display: block;"
                                    mode="aspectFill"
                                    src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638876765089861843.png"/>
                                </view>
                                <view class="PL20">
                                    <view class="row" v-for="item in x.zhusu">
                                        <view class="fz34 fontBold MR20 flexS">
                                            住宿
                                        </view>
                                        <view class="fz28 MR20 color666">{{item.childItem.hotelName}}</view>
                                    </view>
                                </view>
                            </view>
                        </view>
                    </view>
                    <view class="PB20 bgFFF" v-if="dataList.feature&&dataList.feature.detailsImageList.length>0">
                        <image class="MB20" :src="x" @click='previewTravelPicHandler(x,dataList.feature.detailsImageList)' 
                        mode="widthFix" style="width: 100%;height: auto;"
                        v-for="x in dataList.feature.detailsImageList"></image>
                    </view>
                </view>
            </view>
            <view class="PX30" id="title3">
                <view class="PY20 row items-center">
                    <view class="itiner-left-line">&nbsp;</view>
                    <text class="fz32 fontBold ML20">费用说明</text>
                </view>
                <view class="PB20">
                    <text class="itiner-feiyong">费用包含</text>
                </view>
                <view  class="PB20">
                    <view class="fz26 color666">
                        <rich-text :nodes="dataList.feature.feeInclude" class="richText"></rich-text>
                    </view>
                </view>
                <view class="PB20">
                    <text class="itiner-feiyong">费用不包含</text>
                </view>
                <view  class="PB20">
                    <view class="fz26 color666">
                        <rich-text :nodes="dataList.feature.feeNonInclude" class="richText"></rich-text>    
                    </view>
                </view>
            </view>
            <view class="PX30" id="title4">
                <view class="PY20 row items-center">
                    <view class="itiner-left-line">&nbsp;</view>
                    <text class="fz32 fontBold ML20">预定须知</text>
                </view>
                <view class="PB20">
                    <text class="itiner-win">重要提示</text>
                </view>
                <view  class="PB20">
                    <view class="fz26">
                        <rich-text :nodes="dataList.feature.importantTip" class="richText"></rich-text>   
                    </view>
                </view>
                <view class="PB20">
                    <text class="itiner-tisp">温馨提示</text>
                </view>
                <view  class="PB20">
                    <view class="fz26">
                        <rich-text :nodes="dataList.feature.warmTip" class="richText"></rich-text>        
                    </view>
                </view>
            </view>
        </view>
    </scroll-view>
</template>
<script>
export default {
    data() {
        return {
            scrollTop: 0,
            old: {
                scrollTop: 0
            },
            boxOption: 0,
			titleStyle: {
				opacity: 0,
			},
            imgsList: [
                {
                    url: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638874829612454395.png',
                    Path: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638874829612454395.png',
                },
                {
                    url: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638874829612454395.png',
                    Path: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638874829612454395.png',
                },
            ],
            titlesList:[{
                    Name: '行程特色',
                    ID: 1,
                    val: 'title1',
                    top: 0,
                },
                {
                    Name: '行程',
                    ID: 2,
                    val: 'title2',
                    top: 0,
                },
                {
                    Name: '费用说明',
                    ID: 3,
                    val: 'title3',
                    top: 0,
                },
                {
                    Name: '预定须知',
                    ID: 4,
                    val: 'title4',
                    top: 0,
                },
            ],
            current: 1,
            msg: {
                configId: '',
                cityId: '',
                tcid: '',
            },
            dataList: {},
            priceList: [],
            isDownloading: false,
            showQinDan: false,
            showMaiDian: false,
            showHangBan: false,
            d: [],
            Up: {},
        }
    },
    computed: {

    },
    created() {

    },
    onLoad(options) {
        if(options.configId){
            this.msg.configId = options.configId
            this.init()
        }
        if(options.TCID){
            this.msg.tcid = options.TCID
        }
        this.Up = uni.getStorageSync("mall_UserInfo") ?
				uni.getStorageSync("mall_UserInfo").UserPageType :
				0;
    },
    onShow() {
        let that = this;
        uni.getSystemInfo({
            success(res) {
                that.titleStyle = {
                    height: "45px",
                    paddingTop: `${res.statusBarHeight}px`,
                    opacity: "0",
                };
            },
        });
    },
    watch: {
        d:{
            handler(newVal,oldVal){
                if(this.d&&this.d.length > 0){
                    setTimeout(()=>{
                        this.titlesList.forEach((x,index) => {
                            if(index==1) x.Name = `${this.dataList.dayNum}日行程`
                            const query = uni.createSelectorQuery().select(`#${x.val}`);
                            if(query) query.boundingClientRect((rect) => {
                                x.top = rect.top-130;
                            }).exec();
                            if(index==3) uni.hideLoading()
                        })
                    },10000)
                }
            },
            deep:true,
            immediate:false
        },
    },
    mounted() {

    },
    methods: {
        goTop(item) {
            this.current = item.ID;
            this.scrollTop = this.old.scrollTop
            this.$nextTick(function() {
                this.scrollTop = item.top
            });
        },
        async formatDay() {
		    this.d = this.dataList.dayList
            if (this.d.length > 0) {
                await this.d.forEach((x) => {
                    x.dayArray.forEach((y) => {
                        if (y.type == 7) {
                            x.title = y.childItem.title;
                        } else if (y.type == 1) {
                            y.subtitle =
                                y.childItem.subTraffic.length > 0 && y.childItem.subTraffic[0]
                                .startTime +
                                " - " +
                                y.childItem.subTraffic[y.childItem.subTraffic.length - 1]
                                .endTime;
                            y.title = this.formatTraffice(y.childItem.subTraffic);
                            y.icon = "iconfont iconjiaotong";
                        } else if (y.type == 4) {
                            let t = ["早餐", "午餐", "晚餐"];
                            y.childItem.dinnerTypeName =
                                t[parseInt(y.childItem.useDinnerType) - 1];
                        }
                    });
                    x.dayArray = x.dayArray.sort((a,b)=>{
                        return new Date(a.type) - new Date(b.type)
                    })
                    x.zhusu = x.dayArray.filter(z=>z.type==3)
                    x.canshi = x.dayArray.filter(z=>z.type==4)
                });
            }
        },
        formatTraffice(tras) {
            let txt = "从" + (tras.length > 0 ? tras[0].startCityName : '');
            tras.forEach((z, i) => {
                if (i > 0 && txt != '') {
                    txt += "；再";
                }
                if (z.arrivalType == 1) {
                    txt += "搭乘航班";
                } else if (z.arrivalType == 2) {
                    txt += "乘坐豪华巴士";
                } else if (z.arrivalType == 3) {
                    txt += "乘坐豪华游轮";
                } else {
                    txt += "乘坐高铁";
                }
                txt += " 到达" + z.arrivalCityName;
            });
            return txt;
        },
        init(){
            uni.showLoading({
                title: '加载中...',
            })
            this.apipost("b2b_get_GetB2BTravelInfoNoDes", this.msg, (res) => {
                if (res.resultCode == 1) {
                    res.data.tempImgCover = JSON.parse(res.data.imgCover);
                    this.dataList = res.data
                    this.priceList = res.data.priceList
                    this.formatDay()
                }
            }, (failed) => {
                uni.hideLoading()
                uni.showToast({
                    title: failed.message,
                    icon: "none",
                });
            }, (error) => {
                uni.hideLoading()
            })
        },
        goback() {
            uni.navigateBack({
                delta: 1,
            });
        },
        previewImages(images, cur) {
            let imgObj = [];
            if (images[0].url) {
                imgObj = []
                images.forEach(x => imgObj.push(x.url))
            }
            uni.previewImage({
                urls: imgObj,
                current: cur,
            })
        },
        previewTravelPicHandler(url, urls) {
            uni.previewImage({
                urls: urls,
                current: url,
            })
        },
        openPicture() {
            let imgObj = JSON.stringify(this.dataList.tempImgCover);
            uni.navigateTo({
                url: "/pages/hotel/picture?imgObj=" + imgObj+"&isLine=1",
            });
        },
        scroll(e) {
            this.old.scrollTop = e.detail.scrollTop
            this.boxOption = Math.floor((e.detail.scrollTop - 600) / 1.5);
            this.titleStyle.opacity =
                e.detail.scrollTop - 600 < 0 ?
                0 :
                Math.floor(e.detail.scrollTop - 600) / 100 > 1 ?
                1 :
                Math.floor(e.detail.scrollTop - 600) / 100;
                this.titlesList.forEach((x,index)=>{
                    let pev
                    let nex
                    let fir
                    let las
                    if(index>0) pev = this.titlesList[index-1]
                    if(index<this.titlesList.length-1) nex = this.titlesList[index+1]
                    if(index==this.titlesList.length-1) las = this.titlesList[index]
                    if(index==0) fir = this.titlesList[index]
                    if(pev!=undefined&&this.old.scrollTop>pev.top&&nex!=undefined&&this.old.scrollTop<nex.top){
                        this.current = x.ID
                    }
                    if(fir!=undefined&&this.old.scrollTop<fir.top){
                        this.current = x.ID
                    }
                    if(las!=undefined&&this.old.scrollTop>las.top){
                        this.current = x.ID
                    }
                })
            this.$forceUpdate();
        },
        downloadTripPlanHandler() {
            if (this.isDownloading) return;
            let that = this
            uni.showLoading({
                title: '这可能需要30秒，请耐心等待'
            })
            this.isDownloading = true
            let url =
            `https://im.oytour.com/TripDownLoad/${this.msg.configId}_${this.msg.tcid}/${this.msg.configId}_${this.msg.tcid}.pdf`

            let fileName =
                `${this.dataList.ltName.replace(/\s+/g,"").replaceAll("/","")}`
            
            const filePath = wx.env.USER_DATA_PATH + `/${fileName}.pdf`
            uni.downloadFile({
                url: url,
                filePath,
                success: (res) => {
                    wx.openDocument({
                        filePath: filePath,
                        showMenu: true,
                        success: fres => {
                            uni.hideLoading()
                            that.isDownloading = false
                        },
                        fail: fres => {
                            console.log('downloadTripPlanHandler_打开失败', fres)
                            that.downloadFailed('打开失败，请重试。如果仍然失败，请联系销售索要PDF行程')
                        },
                    })
                },
                fail(err) {
                    console.log("downloadTripPlanHandler_fail", err)
                    that.downloadFailed('下载失败，请重试。如果仍然失败，请联系销售索要PDF行程' + err)
                },
            });
        },
        downloadFailed(msg) {
            uni.showToast({
                icon: 'none',
                title: msg
            })
            this.isDownloading = false;
        },
        // #ifdef MP-WEIXIN
			//分享朋友圈
			onShareTimeline() {
				let uid = uni.getStorageSync("mall_UserInfo") ?
					uni.getStorageSync("mall_UserInfo").UserId :
					0;
				if (uid == 0) {
					uid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0;
				}
				let SmallShopId = uni.getStorageSync("mall_UserInfo") ?
					uni.getStorageSync("mall_UserInfo").SmallShopId :
					0;
				if (SmallShopId == 0) {
					//如果微店id为0 去找所属微店id
					SmallShopId = uni.getStorageSync("mall_UserInfo") ?
						uni.getStorageSync("mall_UserInfo").UserSmallShopId :
						0;
				}
				let title = this.dataList.title ? this.dataList.title : "帖子";
				let imageUrl =
					this.dataList.tempImgCover && this.dataList.tempImgCover.length > 0 ?
					this.dataList.tempImgCover[0] :
					"";
				return {
					title: title,
					query: "tcid=" +
						this.delMsg.tcid +
						"&user_id=" +
						uid +
						"&SmallShopId=" +
						SmallShopId +
						"&Up=" +
						this.Up +
						"&JumpType=19" +
						"&configId=" +
						this.msg.configId +
						"&cityId=" +
						this.msg.cityId+this.$uiConfig.DIRECT_PARAMETER,
					imageUrl: imageUrl,
				};
			},
			// #endif
			//分享给朋友
			onShareAppMessage(res) {
				let u = uni.getStorageSync("mall_UserInfo");
				let uid = u.UserId ? u.UserId : 0;
				if (uid == 0) {
					uid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0;
				}
				let SmallShopId = u.SmallShopId ? u.SmallShopId : 0;
				if (SmallShopId == 0) {
					//如果微店id为0 去找所属微店id
					SmallShopId = u.UserSmallShopId ? u.UserSmallShopId : 0;
				}
				return {
					title: this.dataList.title ? this.dataList.title : "帖子",
					path: "/pages/jiuzhai/jz_LineDetail?tcid=" +
						this.msg.tcid +
						"&user_id=" +
						uid +
						"&SmallShopId=" +
						SmallShopId +
						"&Up=" +
						this.Up +
						"&JumpType=19" +
						"&configId=" +
						this.msg.configId +
						"&cityId=" +
						this.msg.cityId+this.$uiConfig.DIRECT_PARAMETER,
					imageUrl: "",
					// imageUrl:
					//   this.dataList.tempImgCover && this.dataList.tempImgCover.length > 0
					//     ? this.dataList.tempImgCover[0]
					//     : "",
				};
			},
    },
}
</script>