<template>
	<view>
		<view class="header-toper">
			<!-- <view class="start-bar"></view> -->
			<view class="header-toper-title">
				<image src="../../static/img/back.png" mode="" @click="backOrder"></image>
				<text>{{$lang.lang.orderInfo.info}}</text>
			</view>
		</view>
		<!-- <view class="start-bar"></view> -->
		<view class="order-title">
			<view class="">{{$lang.lang.orderInfo.info}}-{{orderData.orderNo}}{{orderData.tidanNo?'-'+orderData.tidanNo:''}}<text style="margin-left: 10px;padding: 0 4px;" @click="copyText(orderData.orderNo)">{{$lang.lang.orderInfo.copy}}</text></view>
			<!-- <text>{{$lang.lang.orderInfo.orderNo}}：{{orderData.orderNo}}</text> -->
		</view>
		<view class="items items1">
			<view class="items-v">
				<image src=".../../static/img/order-user.png" mode=""></image>
				<view class="items-v-it">
					<text  @click="showMore=!showMore">{{$lang.lang.orderInfo.consignor}} <text class="showText">{{showMore?$lang.lang.orderInfo.hiddenInfo:$lang.lang.orderInfo.showInfo}}</text></text>
					<text class="items-rf">{{orderData.consignorVO?orderData.consignorVO.name:$lang.lang.orderInfo.no}}</text>
				</view>
			</view>
			<view class="items-v">
				<image src=".../../static/img/order-tel.png" mode=""></image>
				<view class="items-v-it">
					<text>{{$lang.lang.orderInfo.consignorTel}}:</text>
					<text class="items-rf">{{orderData.consignorVO?$request.checkAddIcon(orderData.consignorVO.countryCode):$lang.lang.orderInfo.none}} {{orderData.consignorVO?orderData.consignorVO.phone:''}}</text>
				</view>
			</view>
			<view :class="showMore?'showInfoClass':'hideInfoClass'">
				<view class="items-v">
					<image src=".../../static/img/order-user.png" mode=""></image>
					<view class="items-v-it">
						<text>{{$lang.lang.orderInfo.consignor}}{{$lang.lang.create.nameEn}}</text>
						<text class="items-rf">{{orderData.consignorVO?orderData.consignorVO.nameEn:$lang.lang.orderInfo.no}}</text>
					</view>
				</view>
				<view class="items-v">
					<image src=".../../static/img/order-email.png" mode=""></image>
					<view class="items-v-it">
						<text>{{$lang.lang.orderInfo.consignorEmail}}:</text>
						<text class="items-rf">{{orderData.consignorVO?(orderData.consignorVO.email||$lang.lang.orderInfo.none):$lang.lang.orderInfo.none}}</text>
					</view>
				</view>
				<view class="items-v">
					<image src=".../../static/img/order-company.png" mode=""></image>
					<view class="items-v-it">
						<text >{{$lang.lang.orderInfo.consignorCom}}:</text>
						<text class="items-rf">{{orderData.consignorVO?(orderData.consignorVO.company||$lang.lang.orderInfo.none):$lang.lang.orderInfo.none}}</text>
					</view>
				</view>
				<view class="items-v">
					<image src=".../../static/img/order-company.png" mode=""></image>
					<view class="items-v-it noborder">
						<text>{{$lang.lang.orderInfo.consignorComEn}}:</text>
						<text class="items-rf">{{orderData.consignorVO?(orderData.consignorVO.companyEn||$lang.lang.orderInfo.none):$lang.lang.orderInfo.none}}</text>
					</view>
				</view>
			</view>
		</view>

		<view class="items" v-if="orderData.consigneeVO">
			<view class="items-v">
				<image src=".../../static/img/order-user.png" mode=""></image>
				<view class="items-v-it">
					<text>{{$lang.lang.orderInfo.consignee}}</text>
					<text class="items-rf">{{orderData.consigneeVO?orderData.consigneeVO.name:$lang.lang.orderInfo.none}}</text>
				</view>
			</view>
			<view class="items-v">
				<image src=".../../static/img/order-tel.png" mode=""></image>
				<view class="items-v-it">
					<text>{{$lang.lang.orderInfo.consigneeTel}}:</text>
					<text class="items-rf">{{orderData.consigneeVO?$request.checkAddIcon(orderData.consigneeVO.countryCode):$lang.lang.orderInfo.none}}{{orderData.consigneeVO?orderData.consigneeVO.phone:''}}</text>
				</view>
			</view>
			<view class="items-v">
				<image src=".../../static/img/order-addr.png" mode=""></image>
				<view class="items-v-it">
					<text>{{$lang.lang.orderInfo.consigneeType}}:</text>
					<text class="items-rf">{{orderData.consigneeVO?orderData.consigneeVO.harvestMethod==1?$lang.lang.orderInfo.own:$lang.lang.orderInfo.toRoom:''}}</text>
				</view>
			</view>
			<view class="items-v" v-if="orderData.consigneeVO.harvestMethod==2">
				<image src=".../../static/img/order-area.png" mode=""></image>
				<view class="items-v-it">
					<text>{{$lang.lang.orderInfo.consigneeCity}}:</text>
					<text class="items-rf">{{addressName||$lang.lang.orderInfo.none}}</text>
				</view>
			</view>
			<view class="items-v" v-if="orderData.consigneeVO.harvestMethod==2">
				<image src=".../../static/img/order-location.png" mode=""></image>
				<view class="items-v-it noborder">
					<text>{{$lang.lang.orderInfo.consigneeAdd}}:</text>
					<text class="items-rf">{{orderData.consigneeVO?orderData.consigneeVO.address||$lang.lang.orderInfo.none:$lang.lang.orderInfo.none}}</text>
				</view>
			</view>
			<view :class="showMore?'showInfoClass':'hideInfoClass'">
				<view class="items-v">
					<image src=".../../static/img/order-user.png" mode=""></image>
					<view class="items-v-it">
						<text>{{$lang.lang.orderInfo.consignee}}{{$lang.lang.create.nameEn}}</text>
						<text class="items-rf">{{orderData.consigneeVO?orderData.consigneeVO.nameEn:$lang.lang.orderInfo.none}}</text>
					</view>
				</view>
				<view class="items-v">
					<image src=".../../static/img/order-email.png" mode=""></image>
					<view class="items-v-it">
						<text>{{$lang.lang.orderInfo.consigneeEmail}}:</text>
						<text class="items-rf">{{orderData.consigneeVO?orderData.consigneeVO.email:$lang.lang.orderInfo.none}}</text>
					</view>
				</view>
				<view class="items-v">
					<image src=".../../static/img/order-company.png" mode=""></image>
					<view class="items-v-it">
						<text>{{$lang.lang.orderInfo.consigneeCom}}:</text>
						<text class="items-rf">{{orderData.consigneeVO?orderData.consigneeVO.company:$lang.lang.orderInfo.none}}</text>
					</view>
				</view>
				<view class="items-v">
					<image src=".../../static/img/order-company.png" mode=""></image>
					<view class="items-v-it">
						<text>{{$lang.lang.orderInfo.consigneeComEn}}:</text>
						<text class="items-rf">{{orderData.consigneeVO?orderData.consigneeVO.companyEn:$lang.lang.orderInfo.none}}</text>
					</view>
				</view>
			</view>
		</view>

		<view class="order-info">
			<view class="order-info-v">
				<view class="order-info-title">
					<image src=".../../static/img/order-express.png" mode=""></image>
					<text>{{$lang.lang.orderInfo.logistics}}</text>
				</view>
				<view class="order-info-txt">
          <view class="mudi">{{$lang.lang.orderInfo.startCity}}：{{orderData.initialLogisticsInfoDto?($lang.locale=='zh'?orderData.initialLogisticsInfoDto.startTitleZh:orderData.initialLogisticsInfoDto.startTitleZh):''}}</view>
					<!-- <view class="">{{$lang.lang.orderInfo.address}}：{{orderData.logisticsInfoDto?($lang.locale=='zh'?orderData.logisticsInfoDto.startAddressZh:orderData.logisticsInfoDto.startAddressEn):''}} </view> -->
					<view>{{$lang.lang.orderInfo.endCity}}：{{orderData.initialLogisticsInfoDto?($lang.locale=='zh'?(orderData.initialLogisticsInfoDto.destCountryTitleZh+'-'+(objectCity?objectCity.titleZh:'')+'-'+orderData.initialLogisticsInfoDto.destTitleZh):(orderData.initialLogisticsInfoDto.destCountryTitleEn+'-'+(objectCity?objectCity.titleEn:'')+'-'+orderData.initialLogisticsInfoDto.destTitleEn)):''}}</view>
				</view>
        <view class="order-info-txt">
          <view class="">{{$lang.lang.orderInfo.transport}}：{{getConfigLabel('transport',orderData.transportId)}}</view>
        	<view class=""  v-if="['3','4'].indexOf(orderData.transportId+'') > -1">{{$lang.lang.orderInfo.channel}}：{{getChannelName(orderData.channelId)}}</view>
          <view class=""  v-if="orderData.type">{{$lang.lang.orderInfo.typeName}}：{{typeName}}</view>
        </view>
			</view>
		</view>

		<view class="order-info">
			<view class="order-info-v">
				<view class="order-info-title">
					<image src=".../../static/img/order-basic.png" mode=""></image>
					<text>{{$lang.lang.orderInfo.basic}}</text>
				</view>
				<view class="order-info-line">
					<view class="order-info-line-v">
						<view style="height: 36px;">{{$lang.lang.orderInfo.marks}}：{{orderData.marks}}</view>
            <view style="height: 36px;">
            	{{$lang.lang.orderInfo.warehouse}}：{{orderData.sumNum||0}}{{$lang.lang.orderInfo.box}}
            	 {{orderData.sumWeight||0}}KG
            	 {{orderData.sumVolume||0}}m³
            	 {{orderData.sumQuantity||0}}{{$lang.lang.create.aunit}}
            	 </view>
            <view style="height: 36px;" v-if="orderData.drawee==1">{{$lang.lang.create.payer}}：{{$lang.lang.create.consignor}}</view>
            <view style="height: 36px;" v-else-if="orderData.drawee==2">{{$lang.lang.create.payer}}：{{$lang.lang.create.consignee}}</view>
            <view style="height: 36px;" v-else @click="showCustomDrawee">{{$lang.lang.create.payer}}：{{$lang.lang.create.customDrawee}}</view>
            <view style="height: 36px;">{{$lang.lang.orderInfo.objectport}}:{{orderData.productRecord==1?$lang.lang.orderInfo.ourUndertakes:$lang.lang.orderInfo.customerUndertakes}}</view>
						<view style="height: 36px;">{{$lang.lang.create.special}}:{{packageTypeName||''}}</view>
					</view>
					<view class="order-info-line-v">
            <view style="height: 36px;">{{$lang.lang.orderInfo.formInfo}}：{{orderData.costVO?orderData.costVO.totalNum:0}}{{$lang.lang.orderInfo.box}}
            {{orderData.costVO?orderData.costVO.totalWeight:0}}KG
            {{orderData.costVO?orderData.costVO.totalVolume:0}}m³
            {{orderData.costVO?orderData.costVO.totalQuantity:0}}{{$lang.lang.create.aunit}}
            </view>
            <view style="height: 36px;">{{$lang.lang.orderInfo.datas}}：{{orderData.sumNum}}{{$lang.lang.orderInfo.box}} {{orderData.vweight}}KG  {{orderData.wvolume}}m³ {{orderData.sumQuantity}}{{$lang.lang.create.aunit}}</view>
						<view style="height: 36px;">{{$lang.lang.orderInfo.customsType}}：{{getConfigLabel('customsType',orderData.customsType)}}</view>
            <view style="height: 36px;">{{$lang.lang.orderInfo.isCargoControl}}：{{orderData.isCargoControl?$lang.lang.orderInfo.yes:$lang.lang.orderInfo.no}}</view>
						<view style="height: 36px;">{{$lang.lang.create.specialNote}}: {{orderData.packageRemarks||''}}</view>
					</view>
				</view>
        <view class="addicon" @click="basicShowMore=!basicShowMore">
          <image src="/static/img/add.png" v-if="!basicShowMore"></image>
          <image src="/static/img/sub.png" v-else></image>
        </view>
        <view :class="basicShowMore?'showInfoClass':'hideInfoClass'" >
          <view class="order-info-line" >
              <view class="order-info-line-v">
                <view style="height: 36px;">{{$lang.lang.orderInfo.time}}：{{orderData.deliveryDate||$lang.lang.orderInfo.none}}</view>
                <view style="height: 36px;" v-if="['3','4'].indexOf(orderData.transportId+'') > -1">
                  {{$lang.lang.orderInfo.clearCard}}：
                  <template v-if="orderData.customsClearCert !== null">
                    {{orderData.customsClearCert? $lang.lang.orderInfo.is : $lang.lang.orderInfo.no}}
                  </template>
                  <template v-else>-</template>
                </view>
                <view style="height: 36px;" v-if="['3','4'].indexOf(orderData.transportId+'') > -1">{{$lang.lang.orderInfo.unpack}}：{{orderData.isUnpack?$lang.lang.orderInfo.is:$lang.lang.orderInfo.no}}</view>
                <view style="height: 36px;">{{$lang.lang.orderInfo.loans}}：{{orderData.collectionProxy?($lang.lang.orderInfo.yes+' ('+orderData.collectionProxy+getType(orderData.collectionProxyCurrency)+')'):$lang.lang.orderInfo.no}}</view>
                <view style="height: 72px;" v-if="orderData.isExternalWarehouse&& orderData.externalWarehousedtolist && orderData.externalWarehousedtolist.length">
                  <text>{{$lang.lang.orderInfo.warehouseName}}:{{$lang.lang.orderInfo.externalWarehouse}}</text>
                  <text>{{$lang.lang.orderInfo.estLoading}}:{{orderData.externalWarehousedtolist[0].estLoadingtime}}</text>
                  <text>{{$lang.lang.orderInfo.loadingAddress}}:{{orderData.externalWarehousedtolist[0].loadingAddress}}</text>
                </view>
                <view style="height: 36px;">{{$lang.lang.orderInfo.creator}}:{{orderData.creatorName}}</view>
              </view>
              <view class="order-info-line-v">
                <view style="height: 36px;">{{$lang.lang.orderInfo.levite}}：{{getConfigLabel('warehouseType',orderData.warehouseType)}}</view>
                <view style="height: 36px;" v-if="['3','4'].indexOf(orderData.transportId+'') > -1">{{$lang.lang.orderInfo.clearRemark}}：{{orderData.remarks||$lang.lang.orderInfo.none}}</view>
                <view style="height: 36px;" v-if="['3','4'].indexOf(orderData.transportId+'') > -1">{{$lang.lang.create.nowChange}}：{{orderData.isSingleTicketTransport?$lang.lang.create.is:$lang.lang.create.fou}}</view>
                <view style="height: 36px;">{{$lang.lang.orderInfo.tidanPrice}}:{{orderData.displayBillLadingPrice?$lang.lang.orderInfo.show:$lang.lang.orderInfo.noShow}}</view>
                <view style="height: 36px;">{{$lang.lang.create.quickNo}}:{{orderData.number}}</view>
                <view style="height: 36px;">{{$lang.lang.orderInfo.createTime}}：{{orderData.createTime|$parseTime}}</view>
              </view>
            </view>
          </view>
        </view>
      </view>

		<view class="order-nav">
			<view class="order-nav-v">
				<view :class="activeIndex==0?'act':''" @click="activeIndex=0">
					<text>{{$lang.lang.orderInfo.goodsInfo}}</text>
				</view>
				<view :class="activeIndex==1?'act':''" @click="activeIndex=1">
					<text>{{$lang.lang.orderInfo.ordering}} </text>
				</view>
				<view :class="activeIndex==2?'act':''" @click="activeIndex=2">
					<text>{{$lang.lang.orderInfo.file}}</text>
				</view>
			</view>
		</view>

		<view class="order-table" v-if="activeIndex==0&&orderData.orderItemVOList&&orderData.orderItemVOList.length>0">
      <view style="width: 100%;" v-for="(item,index) in orderData.orderItemVOList" :key="index">
        <view class="number_shop">{{parseInt(index)+1}}</view>
        <view class="order-info-line" >
          <view class="order-info-line-v">
             <view class="order-table-v">
              <text>{{$lang.lang.orderInfo.prodZh}}:{{item.prodTitleZh}}/{{item.prodTitleEn}}</text>
             </view>
             <view class="order-table-v">
              <text>{{$lang.lang.orderInfo.formInfo}}:{{item.num}}{{$lang.lang.orderInfo.box}}{{item.weight}}KG{{item.volume}}m³{{item.quantity}}{{$lang.lang.create.aunit}}</text>
             </view>
             <view class="order-table-v">
              <text>{{$lang.lang.orderInfo.works}}:{{item.worth}}RMB</text>
             </view>
          </view>
          <view class="order-info-line-v">
             <view class="order-table-v">
              <text>{{$lang.lang.orderInfo.brand}}:</text>
              <text v-if="item.brandName">{{item.brandName}}</text>
              <text v-else>{{item.brandType?($lang.lang.orderInfo.have+$lang.lang.orderInfo.brand):($lang.lang.orderInfo.none+$lang.lang.orderInfo.brand)}}</text>
             </view>
             <view class="order-table-v">
              <text>{{$lang.lang.orderInfo.inWarehouseInfo}}:</text>
              <text>{{item.warehouseInInfoVO?item.warehouseInInfoVO.cartonsNum:0}}{{$lang.lang.orderInfo.box}}</text>
              <text>{{item.warehouseInInfoVO?item.warehouseInInfoVO.weight:0}}KG</text>
              <text>{{item.warehouseInInfoVO?item.warehouseInInfoVO.volume:0}}m³</text>
              <text>{{item.warehouseInInfoVO?item.warehouseInInfoVO.quantityAll:0}}{{$lang.lang.create.aunit}}</text>
             </view>
             <view class="order-table-v">
              <text>{{$lang.lang.create.quickNo}}:{{item.warehouseInInfoVO?item.warehouseInInfoVO.expressNo:item.expressNo}}</text>
             </view>
          </view>
        </view>
        <view class="addicon" @click="shopShowMore=!shopShowMore">
          <image src="/static/img/add.png" v-if="!shopShowMore"></image>
          <image src="/static/img/sub.png" v-else></image>
        </view>
        <view :class="shopShowMore?'showInfoClass':'hideInfoClass'" >
          <view class="order-info-line">
              <view class="order-info-line-v">
                <view class="order-table-v">
                 <text>{{$lang.lang.exception.type}}:</text>
                 <text >{{item.warehouseType}}</text>
                </view>
               <view class="order-table-v">
                <text>{{$lang.lang.orderInfo.material}}:</text>
                <text>{{getConfigLabel('material',item.material)}}</text>
               </view>
               <view class="order-table-v">
                <text>{{$lang.lang.create.link}}:{{item.link}}</text>
               </view>
              </view>
              <view class="order-info-line-v">
               <view class="order-table-v">
                <text>{{$lang.lang.orderInfo.unitType}}:</text>
                <text>{{getConfigLabel('unit',item.unit)}}</text>
               </view>
               <view class="order-table-v">
                <text>{{$lang.lang.orderInfo.quickNos}}:{{item.expressNo}}</text>
               </view>
               <view class="order-table-v">
               </view>
              </view>
            </view>
          </view>
        </view>
		</view>
		<view class="order-info" v-if="activeIndex==1">
			<steper :talk="orderData.orderTimeVOList"></steper>
		</view>
		<view class="order-info" v-if="activeIndex==2">
			<view class="see_lists">
				<view class="see_item" v-if="orderData.status>=3" @click="showRcOrder">
					<image src="../../static/img/see.png"></image>
					<text>{{$lang.lang.orderInfo.seeLevite}}</text>
				</view>
				<view v-if="orderData.status>=3&&orderData.ladingState" class="see_item"  @click="seeBillLading">
					<image src="../../static/img/see.png"></image>
					<text>{{$lang.lang.orderInfo.seeBall}}</text>
				</view>
				<view v-if="orderData.status>=3&&!orderData.ladingState" class="see_item">
					<image src="../../static/img/see.png"></image>
					<text class="noBill">{{$lang.lang.orderInfo.seeBall}}</text>
				</view>
				<view class="see_item"  v-if="orderData.status>5&&orderData.packingListUrl" @click="seepacking">
					<image src="../../static/img/see.png"></image>
					<text>{{$lang.lang.orderInfo.seePack}}</text>
				</view>
				<view class="see_item"  v-if="orderData.status>5&&!orderData.packingListUrl">
					<image src="../../static/img/see.png"></image>
					<text class="noBill">{{$lang.lang.orderInfo.seePack}}</text>
				</view>
				<view class="see_item"  @click="openFile">
					<image src="../../static/img/see.png"></image>
					<text>{{$lang.lang.order.see}}{{$lang.lang.docException.customsType}}</text>
				</view>
			</view>
		</view>
		<uni-popup ref="pdf" type="center">
			<view class="link-content" :style="{maxHeight:windowsHeight+'px'}">
				{{billLadingData}}
			</view>
		</uni-popup>
		<uni-popup ref="bg" >
			<view :style="`height:${phoneHeight}px;width:${phoneWidth}px`">
				<image @click="closeBg" class="bgimg" :src="$lang.locale=='zh'?'../../static/img/bg.jpg':'../../static/img/bgEn.jpg'"></image>
			</view>
		</uni-popup>
		<uni-popup ref="rcOrder" type="center">
			<view class="link-content" :style="{maxHeight:windowsHeight+'px'}">
				<view class="order_title">
					<text>{{orderData.orderNo}}-{{$lang.lang.orderInfo.seeLevite}}</text>
				</view>
				<view class="order_info">
					<text>{{$lang.lang.orderInfo.marks}}:{{orderData.marks}}</text>
					<text>{{$lang.lang.orderInfo.consigneeAndTel}}：{{orderData.consigneeVO?orderData.consigneeVO.name:''}}|{{orderData.consigneeVO?orderData.consigneeVO.countryCode:''}}{{orderData.consigneeVO?orderData.consigneeVO.phone:''}}</text>
					<text>{{$lang.lang.orderInfo.consignorAndTel}}：{{orderData.consignorVO?orderData.consignorVO.name:''}}|{{orderData.consignorVO?orderData.consignorVO.countryCode:''}}{{orderData.consignorVO?orderData.consignorVO.phone:''}}</text>
					<text>{{$lang.lang.orderInfo.ballAddress}}：{{orderData.logisticsInfoDto?($lang.locale=='zh'?orderData.logisticsInfoDto.destTitleZh:orderData.logisticsInfoDto.destTitleEn):''}}</text>
				</view>
				<view class="order_info" v-for="(item,index) in orderData.orderItemVOList" :key="index">
					<text>{{$lang.lang.orderInfo.goodsRemark}}:{{item.prodTitleZh}}/{{item.prodTitleEn}}</text>
					<view>
						<text>{{$lang.lang.orderInfo.brand}}：{{item.brandName?item.brandName:($lang.lang.orderInfo.none+$lang.lang.orderInfo.brand)}}</text>
						<text>{{$lang.lang.orderInfo.num}}：{{item.warehouseInInfoVO?item.warehouseInInfoVO.cartonsNum:0}}</text>
					</view>
					<text>{{$lang.lang.orderInfo.size}}：{{item.warehouseInInfoVO?item.warehouseInInfoVO.boxGauge:$lang.lang.orderInfo.no}}</text>
					<view>
						<text>{{$lang.lang.orderInfo.volume}}：{{item.warehouseInInfoVO?item.warehouseInInfoVO.volume:0}}m³</text>
						<text>{{$lang.lang.orderInfo.weight}}：{{item.warehouseInInfoVO?item.warehouseInInfoVO.weight:0}}kg</text>
					</view>
					<text>{{$lang.lang.orderInfo.leviteTime}}：{{item.warehouseInInfoVO?getDate(item.warehouseInInfoVO.firstInTime):''}}</text>
				</view>
			</view>
		</uni-popup>
		<declaration-documents ref="declaration" :orderId="orderData.orderId" :isoper="orderData.customsType==2" :orderNo="orderData.orderNo" @open="open"></declaration-documents>
    <drawee ref="drawee" :value="orderData.customDraweeVOList" readonly></drawee>
  </view>
</template>

<script>
	import steper from '../../components/steper/index.vue'
	import config from '../../utils/config'
	import declarationDocuments from '../../components/declarationDocuments/index.vue'
	//#ifdef H5
	import FileSaver from 'file-saver'
  import Drawee from "@/pages/create_order/components/drawee.vue";
	//#endif
	export default {
		components: {
      Drawee,
			steper,declarationDocuments
		},
		data() {
			return {
				orderData:[],
				config: {
					transport:[],
					warehouseType:[],
					customsType:[],
					doubleClear:[],
					suingMethod:[],
					unit:[],
					material:[],
          packageType:[],
				},
				clientaData:[],
				channelData:[],
				activeIndex:0,
				tdWidth:0,
				widowsWidth:0,
				address:[],
				addressName:'',
				windowsHeight:667,
				billLadingData:'',
				basicUrl:config.API,
				billladshow:false,
				currencyType:[],
				packData:'',
				phoneHeight:0,
				phoneWidth:0,
				showMore:false,
				offerNumber:'',
        objectCity:'',
        typeName:'',
        packageTypeName:'',

        basicShowMore:false,
        shopShowMore:false
			}
		},
		onLoad(options) {
			let that = this
      uni.getSystemInfo({
        success: function (res) {
          that.tdWidth=res.windowWidth*0.72;
          that.widowsWidth=res.windowWidth*0.72;
          that.windowsHeight = res.windowHeight*0.8;
          that.phoneHeight = res.windowHeight
          that.phoneWidth = res.windowWidth
        }
      });
			this.getTreeList()
			this.getcurrency()
			this.orderConfig('transport_type', 'transport')
			this.orderConfig('order_status', 'status')
			this.orderConfig('warehousing_type','warehouseType')
			this.orderConfig('customs_type','customsType')
			this.orderConfig('double_clear','doubleClear')
			this.orderConfig('suing_method','suingMethod')
			this.orderConfig('packaging_type','unit')
			this.orderConfig('product_material','material')
      this.orderConfig('order_special_needs', 'packageType')
			this.getClientaData()
			this.getChanel()
			if(options.id){
				setTimeout(()=>{
					this.getOrderData(options.id)
				},500)
				this.getOfferNumber(options.id)
				// this.getBilladStatus(options.id)
			}
		},
		watch:{
		        orderData(){
		            /* this.pdfData = this.detail.imgUrl */
					//#ifdef H5
		            fetch(this.orderData.packingListUrl).then(async response => {
		                console.log(response)
		                this.packData = await response.arrayBuffer()
		            })
					//#endif
		        },
		    },
		methods: {
			// 关闭在浏览器打开提示
			closeBg(){
				this.$refs.bg.close()
			},
			showRcOrder(){
				this.$refs.rcOrder.open()
			},
			getTreeList(){
				this.$request.get('/app-api/ecw/region/getListTree',{treeType:1}).then(res => {
					if(res.code==0&&res.data&&res.data.length > 0){
						this.address = res.data
					}
				})
			},
			getBilladStatus(id){
				this.$request.get('/app-api/shipment/make-bill-of-lading/getStatus',{orderId:id}).then(res => {
					if(res.code==0){
						this.billladshow = res.data
					}
				})
			},
			backOrder(){
				uni.navigateTo({
					url:'../order/order'
				})
			},
			getOrderData(id){
				let that = this
				that.$request.get('/app-api/my/order/info/'+id).then(res => {
					if(res.code==0&&res.data){
						that.orderData = res.data
						if(res.data.orderItemVOList&&res.data.orderItemVOList.length>0&&res.data.orderItemVOList.length<5){
							that.tdWidth = that.widowsWidth/res.data.orderItemVOList.length
						}
            if(res.data.initialLogisticsInfoDto&&res.data.initialLogisticsInfoDto.destCityId){
              that.getObjectCity(res.data.initialLogisticsInfoDto.destCityId)
            }
            if(res.data.type){
              if(res.data.type.includes(1)){
                that.typeName += this.$lang.lang.create.service
              }
              if(res.data.type.includes(2)){
                that.typeName += this.$lang.lang.create.oversears
              }
            }
            if(res.data.packageType){
              that.config.packageType.forEach(item=>{

                if(res.data.packageType.includes(item.value)){
                  that.packageTypeName += that.$lang.locale=='zh'?item.label:item.labelEn
                }
              })
            }
						if(res.data.consigneeVO&&res.data.consigneeVO.country){
							var orderAdderss = ''
							var country = that.address.find(item=>item.id == res.data.consigneeVO.country)||''
							if(country){
								if(that.$lang.locale=='zh'){
									orderAdderss = country.titleZh
								}else{
									orderAdderss = country.titleEn
								}
								if(res.data.consigneeVO.province){
									console.log(res.data.consigneeVO.province)
									console.log(country.children)
									var province = country.children.find(item=>item.id == res.data.consigneeVO.province)||''
									if(province){
										if(that.$lang.locale=='zh'){
											orderAdderss += province.titleZh
										}else{
											orderAdderss += province.titleEn
										}
										if(res.data.consigneeVO.city){
											console.log(res.data.consigneeVO.city)
											console.log(province.children)
											var city = province.children.find(item=>item.id == res.data.consigneeVO.city)||''
											if(city){
												if(that.$lang.locale=='zh'){
													orderAdderss += city.titleZh
												}else{
													orderAdderss += city.titleEn
												}
											}
										}
									}
								}
							}
							that.addressName = orderAdderss
						}
					}
				})
			},
			//获取供应商
			getClientaData(){
				this.$request.get('/app-api/ecw/admin-clienta/page',{page:1,rows:20}).then(res => {
					if(res.code==0&&res.data&&res.data.list&&res.data.list.length > 0){
						this.clientaData = res.data.list
					}
				})
			},
			getClientaName(id){
				var label = this.clientaData.find(item=>item.id == id)
				if(label) {
					if(this.$lang.locale=='zh'){
						return label.name
					}else{
						return label.nameEn
					}
				}
			},
			getcurrency () {
				/*this.$request.getConfig('commission_currency_type').then(res => {
					if(res.code==0&&res.data&&res.data.list.length>0){
						this.currencyType = res.data.list
					}
				})*/
        this.$request.get('/app-api/ecw/currency/list').then(res => {
          if(res.code==0&&res.data&&res.data.length>0){
            this.currencyType = res.data
          }
        })
			},
			getType(value){
				const item = this.currencyType?.find(item => item.id === value)
        if(!item) return ''
        return item[this.$lang.locale === 'zh' ? 'titleZh' : 'titleEn']
			},
			getChannelName(id){
				var label = this.channelData.find(item=>item.channelId == id)
				if(label) {
					if(this.$lang.locale=='zh'){
						return label.nameZh
					}else{
						return label.nameEn
					}
				}
			},
      //获取城市
      getObjectCity(id){
        this.$request.get('/app-api/ecw/region/get',{id:id}).then(res => {
        	if(res.code==0&&res.data){
        		this.objectCity = res.data
        	}
        })
      },
			//获取出货渠道
			getChanel(){
				this.$request.get('/app-api/ecw/channel/select').then(res => {
					if(res.code==0&&res.data&&res.data.length > 0){
						this.channelData = res.data
					}
				})
			},
			getDate(time) {
				const date = new Date(time);
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();

				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			},
			getConfigLabel(key,value){
				var label = ''
				let that = this
				that.config[key].forEach(function(item,index){
					if(item.value == value){
						if(that.$lang.locale=='zh'){
							label = item.label
						}else{
							label = item.labelEn
						}
					}
				})
				return label
			},
			orderConfig (field, key) {
				this.$request.getConfig(field).then(res => {
					if(res.data&&res.data.list&&res.data.list.length > 0){
						this.config[key] = res.data.list
					}
				})
			},
			pdfWeb(type){
				uni.request({
					  url:this.basicUrl+'/app-api/shipment/make-bill-of-lading/downloadByOrderId?orderId='+this.orderData.orderId,
					  header:this.$request.getImgHeader(),
					  responseType: 'arraybuffer', //这里记得设置响应数据格式，不然预览的pdf是空白
					  success: (response) => {
						  console.log(response)
						if(response){
							let pdfData = response.data; //pdfData是后端返回的文件流
							let blob = new Blob([ pdfData], {
							  type: 'application/pdf;charset=UTF-8'
							})
							pdfData = window.URL.createObjectURL(blob) //创建预览路径
							var agreementUrl = encodeURIComponent(pdfData)
							console.log(agreementUrl)
							uni.navigateTo({
								url: '../filePreview/filePreview?url=' + agreementUrl
							})//这里的url指向你刚创建的filePreviwe.vue页面
						}else{
							uni.showToast({
								title:this.$lang.lang.notices.openError,
								icon:'error'
							})
						}

					  },
					  fail: err => {
						console.log(err)
					  }
					})
			},
			pdfApp(type) {
				  let datas = {
					//自定义下载文件路径，保存文件路径仅支持以"_downloads/"、"_doc/"、"_documents/"开头的字符串
					// filename: '_doc/' + 'test.pdf',
					filename: "file://storage/emulated/0/Download/.pdf",
					//默认为GET请求。注意这里需大写“GET”、“POST”
					method: 'GET'
				  }
				  let dtask = plus.downloader.createDownload(
					this.basicUrl+'/app-api/shipment/make-bill-of-lading/downloadByOrderId?orderId='+this.orderData.orderId,
					datas,
					(d, status) => {
					  // 下载完成
					  if (status == 200) {
						// this.$toast('正在打开')
							console.log(d)
						//下载成功,d.filename是文件在保存在本地的相对路径，使用下面的API可转为平台绝对路径
						var fileSaveUrl =
						  plus.io.convertLocalFileSystemURL(
							d.filename
						  )
						  console.log(fileSaveUrl)
						plus.runtime.openFile(d.filename) //下载完后自动弹出可以选择的app,预览文件
					  } else {
						dtask.clear() //清除下载任务
						// this.$toast('下载失败')
					  }
					}
				  )
				  dtask.setRequestHeader("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
				  dtask.setRequestHeader("Authorization", "Bearer " +uni.getStorageSync('Authorization'));
				  dtask.start()
			},
			seeBillLading(){
				let that = this
				uni.request({
					  url:that.basicUrl+'/app-api/shipment/make-bill-of-lading/downloadByOrderId?orderId='+that.orderData.orderId,
					  header:that.$request.getImgHeader(),
					  // responseType: 'arraybuffer', //这里记得设置响应数据格式，不然预览的pdf是空白
					  success: (response) => {
						  console.log(response)
						        // window.open(
						        //   response.data.data.imgUrl
						        // )
								// const elink = document.createElement('a')
								//         elink.href = response.data.data.imgUrl
								//         elink.style.display = 'none'
								// 		elink.target = '_blank'
								//         elink.click()
						  	  // console.log('h5',response.data.data.imgUrl)
							  // let onlocal = window.open('', ' _blank');
							  // onlocal.location = response.data.data.imgUrl
							  //#ifdef H5
							  let ua = navigator.userAgent.toLowerCase();
							  var isWx = /micromessenger/.test(ua) ? true : false;
							  if(isWx){
							  	that.$refs.bg.open()
							  	return false
							  }
							  fetch(response.data.data.imgUrl).then(async res => {
							      var billBuff = await res.arrayBuffer()
								  let blob = new Blob([billBuff], {type: "application/pdf"})
								  FileSaver.saveAs(blob, response.data.data.imgUrl.split("/").pop());
							  })
							// #endif
						  // #ifdef APP-PLUS
							uni.downloadFile({
								url: response.data.data.imgUrl,
								success: function(res) {
								  console.log('downloadFile ==> ',res)
								  uni.hideLoading();
								  var filePath = res.tempFilePath;
								 //  if(!fileType.includes(typeName)) {
									// return false;
								 //  }
								  uni.showLoading({
									title: that.$lang.lang.notices.opening,
									mask: true
								  })
								  // 新开页面打开文档，支持格式：doc, xls, ppt, pdf, docx, xlsx, pptx。
								  uni.openDocument({
									filePath: filePath,
									// fileType: typeName,// 文件类型，指定文件类型打开文件，有效值 doc, xls, ppt, pdf, docx, xlsx, pptx
									// showMenu: true, // 允许出现分享功能
									success: res => {
									  uni.hideLoading();
									  console.log('打开文档成功',res);
									},
									fail: openError => {
									  uni.hideLoading();
									  console.log('fail:' + JSON.stringify(openError));
									}
								  });
								},
								fail: function(err) {
								  uni.hideLoading();
								  console.log('fail:' + JSON.stringify(err));
								}
							  });
						// #endif
					  },
					  fail: err => {
						console.log(err)
					  }
					})
				// var type = 1
				// if(this.orderData.transportId&&this.orderData.transportId!=1){
				// 	type = parseInt(this.orderData.transportId)-1
				// }
				// var types = uni.getSystemInfoSync().uniPlatform
				// if(types=='web'){
				// 	this.pdfWeb(type)
				// }else{
				// 	this.pdfApp(type)
				// }
			},
			seepacking(){
				      // window.open(
				      //   this.orderData.packingListUrl
				      // )
					  // const elink = document.createElement('a')
					  //         elink.href = this.orderData.packingListUrl
					  //         elink.style.display = 'none'
					  // 		elink.target = '_blank'
					  //         elink.click()
					    // let onlocal = window.open('', ' _blank');
					    // onlocal.location = this.orderData.packingListUrl;
					//#ifdef H5
					  let ua = navigator.userAgent.toLowerCase();
					  var isWx = /micromessenger/.test(ua) ? true : false;
					  if(isWx){
						that.$refs.bg.open()
						return false
					}
					let blob = new Blob([this.packData], {type: "application/pdf"})
					FileSaver.saveAs(blob, this.orderData.packingListUrl.split("/").pop());
				  // #endif
				// #ifdef APP-PLUS
				let that = this
				uni.downloadFile({
					url: that.orderData.packingListUrl,
					success: function(res) {
					  console.log('downloadFile ==> ',res)
					  uni.hideLoading();
					  var filePath = res.tempFilePath;
					 //  if(!fileType.includes(typeName)) {
						// return false;
					 //  }
					  uni.showLoading({
						title: that.$lang.lang.notices.opening,
						mask: true
					  })
					  // 新开页面打开文档，支持格式：doc, xls, ppt, pdf, docx, xlsx, pptx。
					  uni.openDocument({
						filePath: filePath,
						// fileType: typeName,// 文件类型，指定文件类型打开文件，有效值 doc, xls, ppt, pdf, docx, xlsx, pptx
						// showMenu: true, // 允许出现分享功能
						success: res => {
						  uni.hideLoading();
						  console.log('打开文档成功',res);
						},
						fail: openError => {
						  uni.hideLoading();
						  console.log('fail:' + JSON.stringify(openError));
						}
					  });
					},
					fail: function(err) {
					  uni.hideLoading();
					  console.log('fail:' + JSON.stringify(err));
					}
				  });
				  // #endif
			},
			openFile(){
				this.$refs.declaration.open()
				setTimeout(()=>{
					this.$refs.declaration.getFileList()
				},200)
			},
			getOfferNumber(id){
				this.$request.get('/app-api/offer/check',{orderId:id}).then(res => {
					if(res.code==0&&res.data){
						this.offerNumber = res.data.number
					}
				})
			},
      copyText(text){
        uni.setClipboardData({
        	data:text,
        	success:()=>{
        		uni.showToast({
        			title:this.$lang.lang.notices.copySuccess,
        			icon:"none",
        		})
        	}
        })
      },
      showCustomDrawee(){
        this.$refs.drawee.open()
      }
		}
	}
</script>

<style>
	@import url("../../static/css/orderInfo.css");
  .corder-goods-v-item view text:nth-child(2){
      line-height: unset;
  }
</style>
