<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.create.create}}</text>
			</view>
		</view>
		<view class="start-bar"></view>
		<view class="corder-tab2 bgf">
			<view class="corder-tab1">
				<view class="corder-tab-top">
					<image src="../../static/img/corder-1.png" mode=""></image>
					<view class="flex items-center flex-1">
            <view class="title">{{$lang.lang.create.consignee}}</view>
            <radio-group @change="changeHasConsignee" class="flex items-center" v-if="noConsignee">
              <label class="radio">
                <radio value="1" :checked="hasConsignee" /><text>{{$lang.lang.create.yes}}</text>
              </label>
              <label class="radio" style="margin-left: 10rpx">
                <radio value="0" :checked="!hasConsignee" /><text>{{$lang.lang.create.no}}</text>
              </label>
            </radio-group>
          </view>
          <view class="flex items-center" style="width: 30px" v-if="hasConsignee">
            <image src="../../static/img/add.png" class="icon" v-if="!showFullConsignee" @click="showFullConsignee=true"></image>
            <image src="../../static/img/sub.png" class="icon" v-else @click="showFullConsignee=false"></image>
          </view>
				</view>
				<view class="corder-tab1-item corder-picker" v-if="hasConsignee">
					<image src="../../static/img/order-user.png" mode=""></image>
					<text><span class="redcolor">*</span>{{$lang.lang.create.name}}</text>
					<view class="addname">
						<input class="consignee-input" v-model="params.consigneeName" type="text"
                   :placeholder="$lang.lang.notices.name"
                   :class="{disabled: !hasConsignee}"
                   :disabled="!hasConsignee"
            />
						<view v-if="hasConsignee" class="choiceBtn" @click="tochoice">{{$lang.lang.create.choiceConsignee}}</view>
					</view>
				</view>
				<view class="corder-tab1-item" v-if="hasConsignee">
					<image src="../../static/img/order-tel.png" mode=""></image>
					<text><span class="redcolor">*</span>{{$lang.lang.create.phone}}</text>
					<!-- <input v-model="params.consigneePhone" type="text" :placeholder="请输入电话" /> -->
					<view class="corder-phone">
						<view class="countrySn-item">
							<picker
                class="countrySn"
                :class="{disabled: !hasConsignee}"
                :disabled="!hasConsignee"
                :value="config.countrySn.indexs"
                :range="config.countrySn.label" data-config="countrySn" data-key="countryCode" @change="configChange" v-if="config.countrySn.value.length > 0">
								<view class="uni-input">{{$request.checkAddIcon(config.countrySn.value[config.countrySn.indexs])}}</view>
							</picker>
							<image class="rgt" src="../../static/img/rgt.png" mode="widthFix"></image>
						</view>
						<input
              :class="{disabled: !hasConsignee}"
              :disabled="!hasConsignee"
              class="countrySn-input"
              v-model="params.consigneePhone" @blur="checkMoblie"
              maxlength="11"
              type="number"
              :placeholder="$lang.lang.notices.phone" />
					</view>
				</view>
        <template v-if="showFullConsignee && hasConsignee">
          <!-- v1.7新增 -->
          <view class="corder-tab1-item corder-picker">
            <image src="../../static/img/order-user.png" mode=""></image>
            <text>{{$lang.lang.create.nameEn}}</text>
            <view class="addname">
              <input
                class="consignee-input"
                :class="{disabled: !hasConsignee}"
                :disabled="!hasConsignee"
                v-model="params.consigneeNameEn" type="text"
                :placeholder="$lang.lang.notices.nameEn" />
            </view>
          </view>
          <view class="corder-tab1-item">
            <image src="../../static/img/order-email.png" mode=""></image>
            <text>{{$lang.lang.create.email}}</text>
            <input v-model="params.consigneeEmail" type="text" :placeholder="$lang.lang.notices.email"
                   :class="{disabled: !hasConsignee}"
                   :disabled="!hasConsignee" />
          </view>
          <view class="corder-tab1-item">
            <image src="../../static/img/corder-1-3.png" mode=""></image>
            <text>{{$lang.lang.create.company}}</text>
            <input v-model="params.consigneeCompany" type="text" :placeholder="$lang.lang.notices.company"
                   :class="{disabled: !hasConsignee}"
                   :disabled="!hasConsignee" />
          </view>
          <!-- v1.7新增 -->
          <view class="corder-tab1-item">
            <image src="../../static/img/corder-1-3.png" mode=""></image>
            <text>{{$lang.lang.create.companyEn}}</text>
            <input v-model="params.consigneeCompanyEn" type="text" :placeholder="$lang.lang.notices.companyEn"
                   :class="{disabled: !hasConsignee}"
                   :disabled="!hasConsignee" />
          </view>
        </template>
			</view>
		</view>
		<view class="corder bgf">
			<view class="corder-tab1">
				<view class="corder-tab-top">
					<image src="../../static/img/corder-1.png" mode=""></image>
					<view>{{$lang.lang.create.transport}}</view>
				</view>
        <view class="corder-tab1-item corder-picker">
          <image src="../../static/img/corder-1-1.png" mode=""></image>
          <text><span class="redcolor">*</span>{{$lang.lang.create.method}}</text>
          <!--<picker :class="config.transport.index == 0 ? 'v-picker v-picker-2' : 'v-picker'"  :value="config.transport.index" :range="config.transport.label" data-config="transport" data-key="transportId" @change="handleChangeTransport" v-if="config.transport.value.length > 0">
            <view class="uni-input">{{config.transport.label[config.transport.index]}}</view>
          </picker>-->
          <picker class="v-picker" :value="currentTransportIndex" :range="transportList" :range-key="transportRangeKey" @change="changeTransport">
            <view class="uni-input">{{currentTransportIndex !== null ? transportList[currentTransportIndex][transportRangeKey] : $lang.lang.create.choose}}</view>
          </picker>
          <image class="rgt" src="../../static/img/rgt.png" mode=""></image>
        </view>

				<view class="corder-tab1-item corder-picker">
					<image src="../../static/img/corder-1-3.png" mode=""></image>
					<text><span class="redcolor">*</span>{{$lang.lang.create.startCity}}</text>
					<!--<picker :class="config.tradeCity1.index == 0 ? 'v-picker v-picker-2' : 'v-picker'" :value="config.tradeCity1.index" :range="config.tradeCity1.label" data-config="tradeCity1" data-key="departureId" @change="configChange" v-if="config.tradeCity1.value.length > 0">
						<view class="uni-input">{{config.tradeCity1.label[config.tradeCity1.index]}}</view>
					</picker>-->
          <picker class="v-picker" :value="currentStartCityIndex" :range="startCityList" :range-key="startCityRangeKey" @change="changeStartCity">
            <view class="uni-input">{{currentStartCityIndex !== null ? startCityList[currentStartCityIndex][startCityRangeKey] : $lang.lang.create.choose}}</view>
          </picker>
					<image class="rgt" src="../../static/img/rgt.png" mode=""></image>
				</view>
        <!--目的国家-->
        <view class="corder-tab1-item corder-picker">
          <image src="../../static/img/corder-1-4.png" mode=""></image>
          <text><span class="redcolor">*</span>{{$lang.lang.create.dstCountry}}</text>
          <picker class="v-picker" :range="dstCountryList" :range-key="guojiaRangeKey" :value="currentDstCountryIndex" @change="changeDstCountry">
            <view class="uni-input">{{currentDstCountryIndex !== null ? dstCountryList[currentDstCountryIndex][guojiaRangeKey] : $lang.lang.create.choose}}</view>
          </picker>
          <image class="rgt" src="../../static/img/rgt.png" mode=""></image>
        </view>
        <!--目的城市-->
				<view class="corder-tab1-item corder-picker">
					<image src="../../static/img/corder-1-4.png" mode=""></image>
          <!--2024-11-21 要求改非必填 https://devops.aliyun.com/projex/bug/JDAA-127# 《3	APP城市非必填》-->
					<text><!--<span class="redcolor">*</span>-->{{$lang.lang.create.endCity}}</text>
          <picker class="v-picker" :range="filteredDstCityList" :range-key="shiRangeKey" :value="currentDstCityIndex" @change="changeDstCity">
            <view class="uni-input">{{ currentDstCityIndex !== null ? filteredDstCityList[currentDstCityIndex][shiRangeKey] : $lang.lang.create.choose }}</view>
          </picker>
					<image class="rgt" src="../../static/img/rgt.png" mode=""></image>
				</view>

				<view class="corder-tab1-item corder-picker">
					<image src="../../static/img/corder-1-5.png" mode=""></image>
					<text><span class="redcolor">*</span>{{$lang.lang.notices.lined}}</text>
					<!--<picker :disabled="openedRouterF||!params.transportId" :class="config.openedRouter.index == 0 ? 'v-picker v-picker-2' : 'v-picker'" :value="config.openedRouter.index" :range="config.openedRouter.label" data-config="openedRouter" data-key="lineId" @change="configChange" v-if="config.openedRouter.value.length > 0">
						<view class="uni-input">{{config.openedRouter.label[config.openedRouter.index]}}</view>
					</picker>-->
          <picker class="v-picker" :value="currentRouteIndex" :range="routerList" :range-key="routerRangeKey" @change="changeRoute">
            <view class="uni-input">{{currentRouteIndex !== null ? routerList[currentRouteIndex][routerRangeKey] : $lang.lang.create.choose}}</view>
          </picker>
					<image class="rgt" src="../../static/img/rgt.png" mode=""></image>
				</view>
        <view class="corder-tab1-item corder-picker" v-if="!channeled">
          <image src="../../static/img/corder-1-2.png" mode=""></image>
          <text>{{$lang.lang.create.channel}}</text>
          <!--<picker :class="config.channel.index == 0 ? 'v-picker v-picker-2' : 'v-picker'" :disabled="channeled" :value="config.channel.index" :range="config.channel.label" data-config="channel" data-key="channelId" @change="configChange" v-if="config.channel.value.length > 0">
            <view class="uni-input">{{config.channel.label[config.channel.index]}}</view>
          </picker>-->
          <picker class="v-picker" :value="currentChannelIndex" :range="channelList" :range-key="channelRangeKey" @change="changeChannel">
            <view class="uni-input">{{currentChannelIndex !== null ? channelList[currentChannelIndex][channelRangeKey] : $lang.lang.create.choose}}</view>
          </picker>
          <image class="rgt" src="../../static/img/rgt.png" mode=""></image>
        </view>
        <view class="corder-tab1-item corder-picker" v-if="otherService.indexOf('1') > -1 || otherService.indexOf('4') > -1">
          <image src="../../static/img/corder-1-2.png" mode=""></image>
          <text>{{$lang.lang.create.type}}</text>
          <view class="order_type">
            <checkbox-group @change="changeType">
              <view v-for="item in items" :key="item.value" v-if="otherService.indexOf(item.value) > -1">
                <checkbox style="transform:scale(0.8)" :value="item.value" :checked="item.checked" />{{item.name}}
              </view>
            </checkbox-group>
          </view>
        </view>
			</view>
		</view>

		<view class="corder-tab2 bgf">
			<view class="corder-tab-top">
				<image src="../../static/img/corder-2.png" mode=""></image>
				<view class="noborder">
					<text>{{$lang.lang.create.info}}</text>
					<text class="addGoods" @click="open(-1)">{{$lang.lang.create.addShop}}</text>
				</view>
			</view>
			<view class="corder-goods">
				<view class="" v-for="(item,index) in params.orderItemVOList" :key="index">
					<view class="corder-gnums">{{index+1}}</view>
					<view class="corder-goods-v" style="flex-direction: column">
						<view class="corder-goods-v-item flex">
<!--							<view class="flex-1">-->
<!--								<text>{{$lang.lang.create.prodZh}}:</text>-->
<!--								<text>{{item.prodTitleZh}}</text>-->
<!--							</view>-->
              <view class="flex flex-1">
                <text>{{$lang.lang.create.prodTitle}}:</text>
                <text class="flex-1">{{item.prodTitle}}</text>
                <view class="action">
                  <image v-if="!item.showFull" @click="item.showFull = true" src="../../static/img/add.png" class="icon"></image>
                  <image v-else @click="item.showFull = false" src="../../static/img/sub.png" class="icon"></image>
                </view>
              </view>
            </view>

            <view class="corder-goods-v-item flex">
              <view class="flex-1">
                <text>{{$lang.lang.create.brand}}:</text>
                <text>{{item.brandType==1?$lang.lang.create.yes:$lang.lang.create.no}}</text>
              </view>
              <view class="flex-1 flex">
                <text>{{$lang.lang.create.form}}:</text>
                <text class="flex-1">{{item.num}}{{$lang.lang.create.box}}</text>
              </view>
            </view>
            <view class="action flex">
              <view class="btn" @click="open(index)">{{$lang.lang.create.edit}}</view>
              <view class="btn" @click="delGoods(index)">{{$lang.lang.create.delete}}</view>
            </view>
          </view>
          <view class="corder-goods-v" v-if="item.showFull">
            <view class="corder-goods-v-item2">
							<view class="">
								<text>{{$lang.lang.create.num}}:</text>
								<text>{{item.quantity||0}}{{$lang.lang.create.aunit}}</text>
							</view>
							<view class="">
								<text>{{$lang.lang.create.volume}}:</text>
								<text>{{item.volume||0}}m³ </text>
							</view>
							<view class="">
								<text>{{$lang.lang.create.works}}(RMB):</text>
								<text> {{item.worth}}</text>
							</view>
							<view class="">
								<text>{{$lang.lang.create.weight}}:</text>
								<text>{{item.weight||0}}Kg </text>
							</view>
							<view class="">
								<text>{{$lang.lang.create.material}}:</text>
								<text>{{getMaterialName(item.material)}}</text>
							</view>
						</view>

						<view class="corder-goods-v-item2">
							<view class="">
								<text>{{$lang.lang.create.prodAttr}}: </text>
								<text>{{getProductAttrLabel(item.prodAttrIds)}}</text>
							</view>
							<view class="">
								<text>{{$lang.lang.create.packageUnit}}:  </text>
								<text> {{getUnitName(item.unit)}} </text>
							</view>
							<view class="">
								<text>{{$lang.lang.create.prepay}}: </text>
								<text>{{item.isPayAdvance?$lang.lang.create.is:$lang.lang.create.fou}}</text>
							</view>
						</view>
					</view>
					<view class="corder-link" v-if="item.showFull">
						<text>{{$lang.lang.create.link}}:</text>
						<view class="corder-linkLabel" @click="toLink(item.link)"><input v-model="item.link" type="text" disabled/></view>
						<view class="link-btn" @click="openLink(index)">{{item.link?$lang.lang.create.editLink:$lang.lang.create.addLink}}</view>
					</view>
          <view class="corder-bom" v-if="item.showFull">
            <view class="corder-bom-v"></view>
            <view class="corder-bom-v">
              <view class="" @click="open(index)">{{$lang.lang.create.edit}}</view>
              <view class="" @click="delGoods(index)">{{$lang.lang.create.delete}}</view>
            </view>
          </view>
				</view>
			</view>

		</view>

		<view class="corder-tab2 bgf">
			<view class="corder-tab-top">
				<image src="../../static/img/corder-3.png" mode=""></image>
				<view class="noborder">{{$lang.lang.create.total}}</view>
			</view>
			<view class="corder-v3-v1">
				<view class="">
					<text>{{$lang.lang.create.sum}}</text>
					<text>{{params.costVO.totalNum||0}}</text>
				</view>
<!-- 				<view class="">
					<text>总体积</text>
					<text>{{params.costVO.totalVolume||0}}m³</text>
				</view>
				<view class="">
					<text>总重量</text>
					<text>{{params.costVO.totalWeight||0}}kg</text>
				</view> -->
				<view class="">
					<text>{{$lang.lang.create.sumWorks}}(RMB)</text>
					<text>{{params.costVO.totalWorth||0}}</text>
				</view>
				<view class="">
					<text>{{$lang.lang.create.proFee}}({{getCurrenyName(currencyUnit)}})</text>
					<text>{{!params.costVO.insuranceFee?0:params.costVO.insuranceFee>2?params.costVO.insuranceFee:2}}</text>
				</view>
			</view>
<!-- 			<view class="corder-v3-v2">
				<view class="">保价费</view>
				<view class="">总运费</view>
				<view class="">总清关费</view>
			</view>
			<view class="corder-v3-v2">
				<view class="">{{params.costVO.insuranceFee||0}}人民币</view>
				<view class="">
					<div>{{params.costVO.seaNGN||0}}奈拉</div>
					<div style="margin-top: 6px;">{{params.costVO.seaRMB||0}}人民币</div>
					<div style="margin-top: 6px;">{{params.costVO.seaUSD||0}}美元</div>
				</view>
				<view class="">
					<div>{{params.costVO.clearanceNGN||0}}奈拉</div>
					<div style="margin-top: 6px;">{{params.costVO.clearanceRMB||0}}人民币</div>
					<div style="margin-top: 6px;">{{params.costVO.clearanceUSD||0}}美元</div>

				</view>
			</view> -->
		</view>

<!-- 		<view class="corder-tab2 bgf">
			<view class="corder-tab-top">
				<image src="../../static/img/corder-4.png" mode=""></image>
				<view class="noborder">优惠信息</view>
			</view>
			<view class="corder-v4-v1" v-for="(item,index) in couponData" :key="index">
				<view class="">
					<span>{{index+1}}.{{item.titleZh}} (-{{item.reduceAmount}}) </span>
					 <span>{{item.validDays}}</span>
					<label class="radio"><radio value="1" :checked="item.checked" @click="getTotalMoney(index)" />使用</label>
				</view>
			</view>
			<view class="corder-v4-v2">合计优惠金额:{{totalMoney}}美元</view> -->
<!-- 			<view class="corder-v4-v3">
				<view class="corder-v4-v3-z">
					<text>实付款</text>
				</view>
				<view class="corder-v4-v3-z">
					<view>5000美元</view>
					<view>21000奈拉</view>
					<view>60000人民币</view>
				</view>
			</view> -->
		<!-- </view> -->



		<view class="corder-tab2 bgf" >
			<view class="corder-tab-top">
				<image src="../../static/img/corder-1.png" mode=""></image>
				<view class="">{{$lang.lang.create.orderInfo}}</view>
			</view>
			<view class="corder-v5">
				<view class="corder-v5-v">
					<view class="corder-v5-label"><span class="redcolor">*</span>{{$lang.lang.create.marks}}</view>
					<input type="text" v-model="params.marks" maxlength="255"  :placeholder="$lang.lang.notices.marks" @blur="trimMarks" />
				</view>
				<view class="corder-v5-v" >
					<view class="corder-v5-label" @click="cnoticeType2=!cnoticeType2">
						<span class="redcolor">*</span>
						{{$lang.lang.create.isCargoControl}}
						<image  src="../../static/img/helps.png" mode=""></image>
						<view v-show="cnoticeType2" class="cnotice" style="width: 260px;">
							<text>{{$lang.lang.create.cnotice2}}</text>
						</view>
					</view>
					<view class="corder-radio-2">
						<radio-group @change="isCargoControl" >
							<label class="radio">
								<radio value="true" :checked="params.isCargoControl" :disabled="controlLine" /><text>{{$lang.lang.create.is}}</text>
							</label>
							<label class="radio" v-if="hasConsignee">
								<radio value="false" :checked="!params.isCargoControl" /><text>{{$lang.lang.create.fou}}</text>
							</label>
						</radio-group>
					</view>
				</view>
				<view class="corder-v5-v" v-if="params.customsType==2">
					<span class="redcolor">{{$lang.lang.notices.customsRefund}}</span>
				</view>
				<view class="corder-v5-v" >
					<view class="corder-v5-label"><span class="redcolor">*</span>{{$lang.lang.create.customsType}}</view>
					<view style="flex:1">
						<radio-group @change="customsType" class="checklist">
							<label class="radio">
								<radio value="1" :checked="params.customsType==1" />
								<text>{{$lang.lang.create.myCustoms}}</text>
								<image @click="cnoticeType3=!cnoticeType3" src="../../static/img/helps.png" mode=""></image>
								<view v-show="cnoticeType3" class="cnotice">
									<text>{{$lang.lang.create.cnotice3}}</text>
								</view>
							</label>
							<label class="radio">
								<radio value="2" :checked="params.customsType==2" />
								<text>{{$lang.lang.create.ownCustoms}}</text>
								<image @click="cnoticeType4=!cnoticeType4" src="../../static/img/helps.png" mode=""></image>
								<view v-show="cnoticeType4" class="cnotice cnotice4"  style="left:-100px">
									<text>{{$lang.lang.create.cnotice4}}</text>
								</view>
							</label>
							<label class="radio">
								<radio value="3" :checked="params.customsType==3" />
								<text>{{$lang.lang.create.allCustoms}}</text>
								<image @click="cnoticeType5=!cnoticeType5" src="../../static/img/helps.png" mode=""></image>
								<view v-show="cnoticeType5" class="cnotice">
									<text>{{$lang.lang.create.cnotice5}}</text>
								</view>
							</label>
						</radio-group>
					</view>
				</view>

        <!--是否代收货款-->
        <view class="corder-v5-v" v-if='collectionShow'>
          <view class="corder-v5-label">{{$lang.lang.create.payment}}</view>
          <view class="corder-radio-2">
            <radio-group @change="isCollection">
              <label class="radio">
                <radio value="true" :checked="params.isCollection" /><text>{{$lang.lang.create.is}}</text>
              </label>
              <label class="radio">
                <radio value="false" :checked="!params.isCollection" /><text>{{$lang.lang.create.fou}}</text>
              </label>
            </radio-group>
          </view>
        </view>
        <view class="corder-v5-v" v-if='collectionShow&&params.isCollection'>
          <view class="corder-v5-label">{{$lang.lang.create.money}}:</view>
          <view class="corder-phone">
            <input class="countrySn-input" v-model="params.collectionProxy"  type="number" :placeholder="$lang.lang.create.money" />
            <view class="countrySn-item">
              <picker class="countrySn" style="width: 100px; height: 1.4em"
                      :value="config.currencyType.index"
                      :range="config.currencyType.label"
                      data-config="currencyType"
                      data-key="collectionProxyCurrency"
                      @change="configChange"
                      v-if="config.currencyType.value.length > 0">
                <view class="uni-input">{{config.currencyType.label[config.currencyType.index] || $lang.lang.create.choose}}</view>
              </picker>
              <image class="rgt" src="../../static/img/rgt.png" mode="widthFix"></image>
            </view>
          </view>
        </view>

        <!--送货日期-->
        <view class="corder-v5-v corder-picker" >
          <view class="corder-v5-label"><span class="redcolor">*</span>{{$lang.lang.create.date}}</view>
          <picker mode="date" class="date-picker" :value="date" :start="startDate" :end="endDate" @change="bindDateChange">
            <view class="uni-input">{{params.deliveryDate ? params.deliveryDate.split(" ")[0] : '请选择'}}</view>
          </picker>
          <image class="rgt" src="../../static/img/rgt.png" mode="widthFix"></image>
        </view>

        <!--入仓类型-->
        <view class="corder-v5-v corder-picker">
          <view class="corder-v5-label"><span class="redcolor">*</span>{{$lang.lang.create.levite}}</view>
          <picker class="date-picker"  :value="config.warehouseType.index" :range="config.warehouseType.label" data-config="warehouseType" data-key="warehouseType" @change="configChange" v-if="config.warehouseType.value.length > 0">
            <view class="uni-input">{{config.warehouseType.label[config.warehouseType.index]}}</view>
          </picker>
          <image class="rgt" src="../../static/img/rgt.png" mode="widthFix"></image>
        </view>

        <!--付款人-->
        <view class="corder-v5-v" >
          <view class="corder-v5-label"><span class="redcolor">*</span>{{$lang.lang.create.payer}}</view>
          <view class="corder-radio-2" style="flex: 1">
            <radio-group v-model="params.drawee"  @change="draweeType">
              <label class="radio">
                <radio value="1" :checked="params.drawee==1" /><text>{{$lang.lang.create.consignor}}</text>
              </label>
              <label class="radio">
                <radio value="2" :checked="params.drawee==2" /><text>{{$lang.lang.create.consignee}}</text>
              </label>
              <label class="radio" @click="$refs.drawee.open()">
                <radio value="3" :checked="params.drawee==3" /><text>{{$lang.lang.create.customDrawee}}</text>
              </label>
            </radio-group>
          </view>
        </view>

        <!--提单价格-->
        <view class="corder-v5-v" >
          <view class="corder-v5-label"><span class="redcolor">*</span>{{$lang.lang.create.billLadingPrice}}</view>
          <view class="corder-radio-2">
            <radio-group @change="changeBillPrice">
              <label class="radio">
                <radio value="1" :checked="params.displayBillLadingPrice" /><text>{{$lang.lang.create.displayBillLadingPrice}}</text>
              </label>
              <label class="radio">
                <radio value="2" :checked="!params.displayBillLadingPrice" /><text>{{$lang.lang.create.hideBillLadingPrice}}</text>
              </label>
            </radio-group>
          </view>
        </view>

        <!--收货方式-->
        <view class="corder-v5-v corder-picker">
          <view class="corder-v5-label"><span class="redcolor">*</span>{{$lang.lang.create.consignorType}}</view>
          <!--<picker class="date-picker"  :value="config.harvestMethod.index" :range="config.harvestMethod.label" data-config="harvestMethod" data-key="harvestMethod" @change="configChange" v-if="config.harvestMethod.value.length > 0">
            <view class="uni-input">{{config.harvestMethod.label[config.harvestMethod.index]}}</view>
          </picker>-->
          <picker class="date-picker" :value="currentHarvestIndex" :range="enabledHarvestList" :range-key="harvestRangeKey" @change="changeHarvestMethod">
            <view class="uni-input">{{currentHarvestIndex !== null && enabledHarvestList[currentHarvestIndex] ? enabledHarvestList[currentHarvestIndex][harvestRangeKey] : $lang.lang.create.choose}}</view>
          </picker>
          <image class="rgt" src="../../static/img/rgt.png" mode="widthFix"></image>
        </view>
        <view class="corder-v5-v corder-picker" v-if="params.harvestMethod==2">
          <image src="../../static/img/order-location.png" mode="widthFix"></image>
          <view class="corder-v5-label">{{$lang.lang.create.address}}</view>
          <view class="address-list">
            <view class="corder-picker">
              <picker class="date-picker"  :value="config.treeList.index" :range="config.treeList.label" data-config="treeList" data-key="country" @change="configChange" v-if="config.treeList.value.length > 0">
                <view class="uni-input">{{config.treeList.label[config.treeList.index]}}</view>
              </picker>
              <image class="rgt" src="../../static/img/rgt.png" mode="widthFix"></image>
            </view>
            <view class="corder-picker">
              <picker class="date-picker"  :value="config.cityList.index" :range="config.cityList.label" data-config="cityList" data-key="province" @change="configChange" v-if="config.cityList.value.length > 0">
                <view class="uni-input">{{config.cityList.label[config.cityList.index]}}</view>
              </picker>
              <image class="rgt" src="../../static/img/rgt.png" mode="widthFix"></image>
            </view>
            <view class="corder-picker">
              <picker class="date-picker"  :value="config.provinceList.index" :range="config.provinceList.label" data-config="provinceList" data-key="city" @change="configChange" v-if="config.provinceList.value.length > 0">
                <view class="uni-input">{{config.provinceList.label[config.provinceList.index]}}</view>
              </picker>
              <image class="rgt" src="../../static/img/rgt.png" mode="widthFix"></image>
            </view>
          </view>
        </view>
        <view class="corder-v5-v" v-if="params.harvestMethod==2">
          <image src="../../static/img/corder-1-4.png" mode="widthFix"></image>
          <view class="corder-v5-label">{{$lang.lang.create.addressInfo}}</view>
          <input type="text" v-model="params.consigneeAddress" :placeholder="$lang.lang.notices.addressInfo"/>
        </view>
      </view>

      <!--下面的字段在新的原型上没有提现,暂时隐藏-->
      <view v-if="0">
        <!--出单方式-->
				<view class="corder-v5-v">
					<view class="corder-v5-label">{{$lang.lang.create.issuingMethod}}</view>
					<view class="corder-radio-2">
						<radio-group @change="issuingMethod">
							<label class="radio">
								<radio value="1" :checked="params.issuingMethod==1" /><text>{{$lang.lang.create.dianfang}}</text>
							</label>
							<label class="radio">
								<radio value="2" :checked="params.issuingMethod==2" /><text>{{$lang.lang.create.zhengben}}</text>
							</label>
						</radio-group>
					</view>
				</view>

				<!--关联报价单-->
				<view class="corder-v5-v">
					<view class="corder-v5-label">{{$lang.lang.create.baojia}}</view>
					<!-- <input type="text" v-model="params.offerId" maxlength="255"  :placeholder="$lang.lang.create.baojia" /> -->
					<span v-if="offerNumber&&offerIdNoChange">{{offerNumber}}</span>
					<cuihai-combox v-else :label="$lang.lang.notices.please" :empty-tips="$lang.lang.create.noSelect" :placeholder="$lang.lang.notices.please"  :value="offerNumber" :candidates="config.offData.label"  @getValue="getOff" :isDisabled="offerIdNoChange"></cuihai-combox>
				</view>
			</view>
		</view>


    <!--其他-->
    <view class="corder-tab2 bgf">
      <view class="corder-tab-top">
        <image src="../../static/img/corder-5.png" mode=""></image>
        <view class="">{{$lang.lang.create.other}}</view>
      </view>
      <view class="corder-v5">
        <!--特殊要求-->
        <view class="corder-v5-v">
          <view class="corder-v5-label" @click="cnoticeType1=!cnoticeType1">
            {{$lang.lang.create.special}}
            <image  src="../../static/img/helps.png" mode=""></image>
            <view v-show="cnoticeType1" class="cnotice" style="width: 260px;">
              <text>{{$lang.lang.create.cnotice1}}</text>
            </view>
          </view>
          <view style="flex:1">
            <checkbox-group @change="getPackageType" class="checklist" v-model="params.packageType">
              <label class="uni-list-cell uni-list-cell-pd" v-for="(item,index) in packageType" :key="index">
                <view class="checkbox-item">
                  <checkbox :value="item.value+''" :checked="item.checked"  style="transform:scale(0.8)"/>
                </view>
                <view>{{item[$lang.label]}}</view>
              </label>
            </checkbox-group>
          </view>
        </view>
        <!--特殊要求备注-->
        <view class="corder-v5-v remark">
          <view class="corder-v5-label">{{$lang.lang.create.specialNote}}</view>
          <input type="text" :placeholder="$lang.lang.notices.specialNote" v-model="params.packageRemarks">
        </view>

        <!--快递单号-->
        <view class="corder-v5-v">
          <view class="corder-v5-label">{{$lang.lang.create.quickNo}}</view>
          <textarea @blur="bindTextAreaBlur" v-model="params.number"  :placeholder="$lang.lang.notices.numbers" />
          <view class="autoBtn" @click="autoCreatOrderSn">{{$lang.lang.create.auto}}</view>
        </view>
      </view>

      <!--下面海运不显示-->
      <view class="corder-v5" v-if="['2','3','4'].indexOf(params.transportId+'') > -1">

        <!--清关证书-->
        <view class="corder-v5-v" v-if="['2','3','4'].indexOf(params.transportId+'') > -1">
          <view class="corder-v5-label">{{$lang.lang.create.clearCard}}</view>
          <view class="corder-radio-2" >
            <radio-group @change="customsClearCert" >
              <label class="radio">
                <radio value="true" :checked="params.customsClearCert" /><text>{{$lang.lang.create.is}}</text>
              </label>
              <label class="radio">
                <radio value="false" :checked="!params.customsClearCert" /><text>{{$lang.lang.create.fou}}</text>
              </label>
            </radio-group>
          </view>
        </view>
        <!--清关证书备注-->
        <view class="corder-v5-v remark" v-if="['2','3','4'].indexOf(params.transportId+'') > -1">
          <view class="corder-v5-label">{{$lang.lang.create.clearRemark}}</view>
          <input type="text" v-model="params.remarks" :placeholder="$lang.lang.notices.clearRemark">
        </view>

        <!--是否拆包-->
        <view class="corder-v5-v" v-if="['3','4'].indexOf(params.transportId+'') > -1">
          <view class="corder-v5-label">{{$lang.lang.create.unpack}}</view>
          <view class="corder-radio-2">
            <radio-group @change="isUnpack">
              <label class="radio">
                <radio value="true" :checked="params.isUnpack" /><text>{{$lang.lang.create.is}}</text>
              </label>
              <label class="radio">
                <radio value="false" :checked="!params.isUnpack" /><text>{{$lang.lang.create.fou}}</text>
              </label>
            </radio-group>
          </view>
        </view>

        <!--单票立刻转运-->
        <view class="corder-v5-v" v-if="['3','4'].indexOf(params.transportId+'') > -1">
          <view class="corder-v5-label">{{$lang.lang.create.nowChange}}</view>
          <view class="corder-radio-2">
            <radio-group @change="isSingleTicketTransport" >
              <label class="radio">
                <radio value="true" :checked="params.isSingleTicketTransport" /><text>{{$lang.lang.create.is}}</text>
              </label>
              <label class="radio">
                <radio value="false" :checked="!params.isSingleTicketTransport" /><text>{{$lang.lang.create.fou}}</text>
              </label>
            </radio-group>
          </view>
        </view>
        <view class="corder-v5-v" v-if="['3','4'].indexOf(params.transportId+'') > -1">
          <image src="../../static/img/tips.png" mode="widthFix"></image>
          <text style="margin-left:10px">{{$lang.lang.create.nowNotice}}</text>
        </view>

        <!--下面内容在新的原型上未有提现,留此备用-->
        <view v-if="0">
          <view class="corder-v5-v" >
            <view class="corder-v5-label">{{$lang.lang.create.doubleClear}}</view>
            <view class="corder-radio-2">
              <radio-group @change="doubleClear">
                <label class="radio">
                  <radio value="1"  :checked="params.doubleClear==1" /><text>{{$lang.lang.create.conClear}}</text>
                </label>
                <label class="radio">
                  <radio value="2"  :checked="params.doubleClear==2" /><text>{{$lang.lang.create.myClear}}</text>
                </label>
              </radio-group>
            </view>
          </view>

          <view class="corder-v5-v">
            <view class="corder-v5-label">{{$lang.lang.create.lined}}</view>
            <view class="">{{config.openedRouter.index==0?$lang.lang.create.no:config.openedRouter.label[config.openedRouter.index]}}</view>
          </view>
          <view class="corder-v5-v" v-if="!channeled">
            <view class="corder-v5-label">{{$lang.lang.create.channel}}</view>
            <view class="">{{config.channel.index==0?$lang.lang.create.no:config.channel.label[config.channel.index]}}</view>
          </view>

          <view class="corder-v5-v corder-picker" v-if="['2'].indexOf(params.transportId+'') > -1">
            <view class="corder-v5-label">{{$lang.lang.create.ship}}</view>
            <picker  class="date-picker" :value="config.clientaData.index" :range="config.clientaData.label" data-config="clientaData" data-key="shippingCompany" @change="configChange" v-if="config.clientaData.value.length > 0">
              <view class="uni-input">{{config.clientaData.label[config.clientaData.index]}}</view>
            </picker>
            <image class="rgt" src="../../static/img/rgt.png" mode="widthFix"></image>
          </view>
        </view>

      </view>
    </view>

    <view class="footer">
      <view v-if="isOverSearWarehouse" class="sumbit disabled">{{$lang.lang.create.submit}}</view>
			<view v-else class="sumbit" @click="addOrder">{{$lang.lang.create.submit}}</view>
			<view class="cancel" @click="toback">{{$lang.lang.create.cancel}}</view>
		</view>
    <view v-if="isOverSearWarehouse" class="over-sea-tips">
      {{$lang.lang.create.overSeaWarehouseTips}}
    </view>

		<!-- <button >打开弹窗</button> -->
		<uni-popup ref="popup" type="center" :mask-click="false">
			<view class="goods">
				<view class="corder-tab-top">
					<view>{{$lang.lang.create.addShop}}</view>
				</view>
				<view class="corder-tab1-item corder-picker">
					<text>{{$lang.lang.create.prodTitle}}<span class="redcolor">*</span></text>
					<cuihai-combox :label="$lang.lang.notices.please" :emptyTips="$lang.lang.create.noSelect" :placeholder="$lang.lang.notices.please" :value="goodsModel.prodTitle" :candidates="config.product.label"  @getValue="getValue"></cuihai-combox>
				</view>
<!--				<view class="corder-tab1-item corder-picker">-->
<!--					<text>{{$lang.lang.create.prodTitle}}<span class="redcolor">*</span></text>-->
<!--					<cuihai-combox :label="$lang.lang.notices.please" :emptyTips="$lang.lang.create.noSelect" :placeholder="$lang.lang.notices.please" :value="goodsModel.prodTitleEn"  :candidates="config.productEn.label"  @getValue="getValueEn"></cuihai-combox>-->
<!--				</view>-->
				<view class="corder-tab1-item">
					<view class="corder-picker addGoods-item">
						<text>{{$lang.lang.create.brand}}<span class="redcolor">*</span></text>
						<picker :class="config.brandData.index == 0 ? 'v-picker v-picker-2' : 'v-picker'"  :value="config.brandData.index" :range="config.brandData.label" data-config="brandData" data-key="brandType" @change="goodsChange" v-if="config.brandData.value.length > 0">
							<view class="uni-input">{{config.brandData.label[config.brandData.index]}}</view>
						</picker>
						<image class="rgt" src="../../static/img/rgt.png" mode=""></image>
					</view>
					<view class="addGoods-item">
						<text>{{$lang.lang.create.volume}}(m³)</text>
						<input type="number" v-model="goodsModel.volume" :placeholder="$lang.lang.create.volume"/>
					</view>
				</view>
				<view class="corder-tab1-item">
					<view class="addGoods-item">
						<text>{{$lang.lang.price.num}}<span class="redcolor">*</span></text>
						<input type="number" v-model="goodsModel.num" :placeholder="$lang.lang.price.num"/>
					</view>
					<view class="corder-picker addGoods-item">
						<text>{{$lang.lang.create.unit}}<span class="redcolor">*</span></text>
						<picker :class="config.unitData.index == 0 ? 'v-picker v-picker-2' : 'v-picker'"  :value="config.unitData.index" :range="config.unitData.label" data-config="unitData" data-key="unit" @change="goodsChange" v-if="config.unitData.value.length > 0">
							<view class="uni-input">{{config.unitData.label[config.unitData.index]}}</view>
						</picker>
						<image class="rgt" src="../../static/img/rgt.png" mode=""></image>
					</view>
				</view>
				<view class="corder-tab1-item">
					<view class="addGoods-item">
						<text>{{$lang.lang.create.num}}    ({{$lang.lang.create.aunit}})</text>
						<input type="number" v-model="goodsModel.quantity" :placeholder="$lang.lang.create.num" />
					</view>
					<view class="addGoods-item">
						<text>{{$lang.lang.create.weight}}(kg)</text>
						<input type="number" v-model="goodsModel.weight" :placeholder="$lang.lang.create.weight" />
					</view>
				</view>
				<view class="corder-tab1-item">
					<text>{{$lang.lang.create.works}}<span class="redcolor">*</span></text>
					<input type="number" v-model="goodsModel.worth" placeholder="RMB" />
				</view>
				<view class="corder-tab1-item corder-picker">
					<text>{{$lang.lang.create.material}}</text>
					<picker :class="config.material.index == 0 ? 'v-picker v-picker-2' : 'v-picker'"  :value="config.material.index" :range="config.material.label" data-config="material" data-key="material" @change="goodsChange" v-if="config.material.value.length > 0">
						<view class="uni-input">{{config.material.label[config.material.index]}}</view>
					</picker>
					<image class="rgt" src="../../static/img/rgt.png" mode=""></image>
				</view>
				<view class="corder-tab1-item corder-picker">
					<text>{{$lang.lang.create.prodAttr}}</text>
					<checkbox-group @change="checkboxChange" class="corder-checkbox" >
						<label class="uni-list-cell uni-list-cell-pd" v-for="item in productAttrList" :key="item.id" >
							<view class="checkbox-item">
								<checkbox :value="item.id+''" :checked="isProductAttr(item.id)" :disabled="isdisable" style="transform:scale(0.8)"/>
							</view>
							<view>{{item[$lang.attrName]}}</view>
						</label>
					</checkbox-group>
				</view>
				<view class="addGoods-btns">
					<view class="addGoods-btn" @click="addGood">{{$lang.lang.create.confirm}}</view>
					<view class="addGoods-btn" @click="colsePopup">{{$lang.lang.create.cancel}}</view>
				</view>
			</view>
		</uni-popup>
		<uni-popup ref="shoplink" type="center" :mask-click="false">
			<view class="link-content">
				<input v-model="link" :placeholder="$lang.lang.notices.link" />
				<view class="btnlists">
					<view @click="addlink">{{$lang.lang.create.confirm}}</view>
					<view @click="closelink">{{$lang.lang.create.cancel}}</view>
				</view>
			</view>
		</uni-popup>
		<uni-popup ref="payNotice" type="center" :mask-click="false">
			<view class="link-content">
				<text>{{$lang.lang.create.paynotice}}</text>
				<view class="btnlists">
					<view @click="createOrder">{{$lang.lang.create.confirm}}</view>
					<view @click="closePayNotice">{{$lang.lang.create.cancel}}</view>
				</view>
			</view>
		</uni-popup>
		<uni-popup ref="addCon" :mask-click="false">
			<view class="addCon-content">
				<view class="addCon-title">{{$lang.lang.create.consignee}}</view>
				<view class="order-tabs">
					<view class="order-tabs-v2">
						<view class="order-tabs-v2s">
							<image class="search" src="../../static/img/search.png" mode=""></image>
							<input type="text" v-model="searchKey" :placeholder="$lang.lang.notices.keyWord" placeholder-style="color: #666666">
							<image @click="searchKey=''" v-show="searchKey" class="close" src="../../static/img/close.png"></image>
							<view class="" @click="searchCon">{{$lang.lang.order.search}}</view>
						</view>
					</view>
				</view>
				<view class="addcon-scroll">
					<scroll-view scroll-y="true">
						<view class="conRadioList" v-for="(item,indexs) in consignee" :key="indexs" >
							<view class="coninfo_list">
								<view class="coninfo_item">
									<image src="../../static/img/people.png" mode="widthFix"></image>
									<text>{{item.name}}</text>
								</view>
								<view class="coninfo_item">
									<image src="../../static/img/people.png" mode="widthFix"></image>
									<text>{{item.nameEn}}</text>
								</view>
							</view>
							<view class="coninfo_list">
								<view class="coninfo_item">
									<image src="../../static/img/telephone.png" mode="widthFix"></image>
									<text>{{$request.checkAddIcon(item.dialCode)}} {{item.phone}}</text>
								</view>
								<view class="coninfo_item">
									<image src="../../static/img/email.png" mode="widthFix"></image>
									<text>{{item.email}}</text>
								</view>
							</view>
							<view class="coninfo_list">
								<view class="coninfo_item">
									<image src="../../static/img/company.png" mode="widthFix"></image>
									<text>{{item.company}}</text>
								</view>
								<view class="coninfo_item">
									<image src="../../static/img/company.png" mode="widthFix"></image>
									<text>{{item.companyEn}}</text>
								</view>
							</view>
							<view class="con_btns">
								<view @click="choiceCon(indexs)">{{$lang.lang.create.choice}}</view>
								<view @click="editCon(indexs)">{{$lang.lang.create.edit}}</view>
							</view>
						</view>
						<view v-if="moreShow" class="coninfo_more" @click="showMore">{{$lang.lang.create.more}}</view>
					</scroll-view>
				</view>
				<view class="btnlist">
					<view @click="openCon">{{$lang.lang.create.add}}</view>
					<view @click="closeAddCon">{{$lang.lang.create.cancel}}</view>
				</view>
			</view>
		</uni-popup>
		<uni-popup ref="insertCon" :mask-click="false">
			<view class="addCon-content addCon">
				<view class="addCon-title">{{$lang.lang.create.addConsignee}}</view>
				<view class="corder-tab1-item">
					<text>{{$lang.lang.create.name}}:</text>
					<input v-model="conForm.name" type="text" :placeholder="$lang.lang.notices.name" />
				</view>
				<!-- v1.7新增 -->
				<view class="corder-tab1-item">
					<text>{{$lang.lang.create.nameEn}}:</text>
					<input v-model="conForm.nameEn" type="text" :placeholder="$lang.lang.notices.nameEn" />
				</view>
				<view class="corder-tab1-item">
					<text>{{$lang.lang.create.phone}}:</text>
					<view class="corder-phone">
						<view class="countrySn-item">
							<picker class="countrySn"  :value="config.countrySn.index" :range="config.countrySn.label" data-config="countrySn" data-key="dialCode" @change="configChange" v-if="config.countrySn.value.length > 0">
								<view class="uni-input">{{$request.checkAddIcon(config.countrySn.value[config.countrySn.index])}}</view>
							</picker>
							<image class="rgt" src="../../static/img/rgt.png" mode="widthFix"></image>
						</view>
						<input class="countrySn-input" v-model="conForm.phone" maxlength="11" type="number" :placeholder="$lang.lang.notices.phone" />
					</view>
				</view>
				<view class="corder-tab1-item">
					<text>{{$lang.lang.create.email}}:</text>
					<input v-model="conForm.email" type="text" :placeholder="$lang.lang.notices.email"/>
				</view>
				<view class="corder-tab1-item">
					<text>{{$lang.lang.create.company}}:</text>
					<input v-model="conForm.company" type="text" :placeholder="$lang.lang.notices.company" />
				</view>
				<!-- v1.7新增 -->
				<view class="corder-tab1-item">
					<text>{{$lang.lang.create.companyEn}}:</text>
					<input v-model="conForm.companyEn" type="text" :placeholder="$lang.lang.notices.companyEn" />
				</view>
				<view class="btnlist">
					<view @click="insertCon">{{conForm.id==0?$lang.lang.create.add:$lang.lang.create.edit}}</view>
					<view @click="closeInsertCon">{{$lang.lang.create.cancel}}</view>
				</view>
			</view>
		</uni-popup>

    <drawee ref="drawee" :value="params.customDraweeVOList" @confirm="setCustomDrawee"></drawee>
	</view>
</template>

<script>
import Drawee from "@/pages/create_order/components/drawee.vue";

export default {
    components: {Drawee},
		data() {
			const currentDate = this.getDate({
				format: true
			})
			return {
        // 收货方式
        harvestList: [],
        currentHarvestIndex: null,
        // 始发城市
        startCityList:[],
        currentStartCityIndex: null,
        // 路线
        routerList: [],
        currentRouteIndex: null,
        // 渠道
        channelList:[],
        currentChannelIndex: null,
        // 运输方式
        transportList: [],
        currentTransportIndex: null,
        // 目的国
        dstCountryList:[],
        // 当前国家索引
        currentDstCountryIndex: null,

        // 目的城市
        dstCityList: [],
        // 当前展示的目的城市列表
        filteredDstCityList:[],
        // 当前城市索引
        currentDstCityIndex: null,

				items:[
					{
					value:"1",
					checked:false,
					name:this.$lang.lang.create.service,
					otherService:1,
					show:false
				},
				{
					value:"2",
					checked:false,
					name:this.$lang.lang.create.oversears,
					otherService:2,
					show:false
				}],
				openedRouterF: true,
				channeled:true,
				currentDate:currentDate,
				address:'',
				linkIndex:0,
				isEmail:false,
				shopName:'shopName',
				config: {
					transport:{
						index: 0,
						label: [this.$lang.lang.notices.please],
						value: [''],
						cssClass:['']
					},
					channel:{
						index: 0,
						label: [this.$lang.lang.notices.please],
						value: [''],
					},
					suitable:{
						index: 0,
						label: [this.$lang.lang.notices.please],
						value: [''],
					},
					tradeCity1: {
						index: 0,
						label: [this.$lang.lang.notices.please],
						value: [''],
					},
					tradeCity2: {
						index: 0,
						label: [this.$lang.lang.notices.please],
						value: [''],
					},
					openedRouter: {
						index: 0,
						label: [this.$lang.lang.notices.please],
						value: [''],
						otherService:[''],
						controlStatus:['']
					},
          product:{
            index: 0,
            label: [],
            value: [],
            data:[]
          },
					// productZh:{
					// 	index: 0,
					// 	label: [],
					// 	value: [],
					// 	data:[]
					// },
					// productEn:{
					// 	index: 0,
					// 	label: [],
					// 	value: [],
					// },
					brandData:{
						index: 0,
						label: [],
						value: [],
					},
					unitData:{
						index: 0,
						label: [this.$lang.lang.notices.please],
						value: [''],
					},
					material:{
						index: 0,
						label: [this.$lang.lang.notices.please],
						value: [''],
					},
					warehouseType:{
						index: 0,
						label: [this.$lang.lang.notices.please],
						value: [''],
					},
					treeList:{
						index: 0,
						label: [this.$lang.lang.notices.please],
						value: [''],
						children:['']
					},
					cityList:{
						index: 0,
						label: [this.$lang.lang.notices.please],
						value: [''],
						children:['']
					},
					provinceList:{
						index: 0,
						label: [this.$lang.lang.notices.please],
						value: [''],
					},
					countrySn:{
						index: 0,
						label: [],
						value: [],
						indexs:0
					},
					clientaData:{
						index: 0,
						label: [this.$lang.lang.notices.please],
						value: [''],
					},
					harvestMethod:{
						index: 0,
						label: [],
						value: [],
					},
					currencyType:{
						index: null,
						label: [],
						value: [],
					},
					offData:{
						index: 0,
						label: [],
						value: [],
					},
				},
				params: {
					transportId: 0, //运输类型
					departureId: 0, //始发ID
					objectiveId: 0, //目的地ID
					lineId: 0, //线路ID
					channelId:0,//渠道ID
					orderItemVOList:[],
					costVO:{},
					deliveryDate: null,
					drawee:2,
					number:'',
					isCargoControl:false,
					consigneeId:0,
					customsType:1,
					type:'',
					isCollection:false,
					issuingMethod:1,
					doubleClear:2,
          // 清关证书默认否
          customsClearCert: false,
          customDraweeVOList: [],
          // 提单是否显示价格
          displayBillLadingPrice: true
				},
				goodsModel:{
					prodTitle:'',
					// prodTitleEn:'',
					volume:'',
					prodAttrs:[],
					prodAttrIds:'',
					brandType:null,
					num:null,
					unit:'',
					quantity:null,
					weight:null,
					worth:null,
					material:null
				},
				totalMoney:0,
				productAttrList:[],
				productData:[],
				goodsEditIndex:-1,
				couponData:[],
				packageType:[],
				consignee:[],
				page:1,
				conForm:{
					dialCode:'',
					id:0
				},
				date: '',
				time:'00:00',
				isClick:false,
				link:'',
				conIndex:-1,
				orderId:0,
				copy:false,
				unitType:[],
				currencyType:[],
				lineMethod: false,
				collectionShow:false,
				isdisable:false,
				searchKey:'',//搜索联系人关键词
				moreShow:true,
				controlLine:false,//线路控货
				currencyUnit:0,
				offerNumber:'' ,//关联报价单
				offerIdNoChange:false,
				cnoticeType1:false,
				cnoticeType2:false,
				cnoticeType3:false,
				cnoticeType4:false,
				cnoticeType5:false,
        // 是否有收货人
        hasConsignee: true,
        // 是否显示完整的收货人信息
        showFullConsignee: false
			}
		},
		async onLoad (op) {
      await this.getDstCountryList()
      await this.getTransport()
      await this.getStartCity()
      await this.getHarvestMethod()
			// this.getZd()
			this.getTreeList()
			this.getCurrencyData()
			this.getUnitTypeData()
			this.orderConfig('transport_type', 'transport')
			this.orderConfig('product_material', 'material')
			this.orderConfig('packaging_type', 'unitData')
			this.orderConfig('warehousing_type', 'warehouseType')
			this.orderConfig('is_brand', 'brandData')
			this.orderConfig('order_special_needs', 'packageType')
			this.orderConfig('harvest_method', 'harvestMethod')
			// this.orderConfig('commission_currency_type', 'currencyType')
			this.getCurrencyList()
			// this.getTradeCity('tradeCity1')
			// this.getTradeCity('tradeCity2')
			this.getChanel()
			this.getProductAttrList()
			this.getproductData()
			this.getCon()
			this.getCountrySn()
			this.getClientaData()
			if(op.id){
        await this.$nextTick()
        this.orderId = op.id
        if (op.copy && op.copy == 1){
          this.copy = true
          this.getOrderData(op.id, true)
        }else {
          this.getOrderData(op.id, false)
        }

			}else{
        this.setDefaultDrawee()
      }
			if(op.transportId){
				/*this.params.transportId = op.transportId
				setTimeout(()=>{
					this.getConfigIndex('transport',op.transportId)
				},1000)
				if(this.params.transportId == 3){
					this.channeled = false
				}
				this.openedRouterF = false
				this.getOpenedRouter()*/
        const transIndex = this.transportList.findIndex(item => item.value == op.transportId)
        if(transIndex > -1){
          // 模拟选择
          this.changeTransport({detail: {value: transIndex}})
        }
			}
			// this.gertConsignorId()
		},
		computed: {
			startDate() {
				return this.getDate('start');
			},
			endDate() {
				return this.getDate('end');
			},
      noConsignee(){
        return !!this.$store.state.userInfo?.noConsignee
      },
      isOverSearWarehouse(){
        return this.params.type?.indexOf('2') != -1
      },
      // 可用的收货方式
      enabledHarvestList(){
        const currentRoute = this.currentRouteIndex !== null ? this.routerList[this.currentRouteIndex] : null
        const otherService = currentRoute?.otherService?.split(",") || []
        console.log("enabledHarvestList", otherService, currentRoute)
        // 开通了送货上门才显示全部
        if(otherService?.indexOf("2") > -1){
          return this.harvestList
        }
        // 否则隐藏送货上门服务
        return this.harvestList.filter(item => item.value != 2)
      },
      transportRangeKey(){
        return this.$lang.label;
      },
      guojiaRangeKey(){
        return this.$lang.guojiaName;
      },
      shiRangeKey(){
        return this.$lang.shiName;
      },
      channelRangeKey(){
        return this.$lang.name;
      },
      routerRangeKey(){
        return 'showName'
      },
      startCityRangeKey(){
        return this.$lang.title;
      },
      harvestRangeKey(){
        return this.$lang.label;
      },
      otherService(){
        const currentRoute = this.currentRouteIndex !== null ? this.routerList[this.currentRouteIndex] : null
        return currentRoute?.otherService?.split(",") || []
      },
		},
		watch:{
			'params.countryCode'(){
				if(this.params.lineId&&this.params.consigneePhone) this.getOffData()
			},
			'params.consigneePhone'(){
				if(this.params.lineId) this.getOffData()
			},
      hasConsignee(val){
        if(!val){
          // 没有收货人必须控货
          this.params.isCargoControl = true
        }
      },
      "params.isCargoControl"() {
        this.setDefaultDrawee()
      },
      "params.drawee"(drawee) {
        // 240224 微信反馈
        // 不好意思,这写错了,付款人=发货人----提单价格默认否;付款人=收货人,提交价格默认是
        if (drawee == 1) {
          this.params.displayBillLadingPrice = false
        }
        if (drawee == 2) {
          this.params.displayBillLadingPrice = true
        }
      }
		},
		methods: {
      setDefaultDrawee(){
        // 优先级为:发货人默认付款,发货人付款>收货人默认付款,收货人付款>订单控货,收货人付款
        if(this.$store.state.userInfo.defaultPay){
          this.$set(this.params, 'drawee', 1)
          return
        }
        if(this.params.isCargoControl){
          this.$set(this.params, 'drawee', 2)
        }
      },
      changeHasConsignee(e){
        this.hasConsignee = e.detail.value === "1"
        // 无收货人默认发货人付款
        // if(!this.hasConsignee){
        //   this.$set(this.params, 'drawee', 1)
        // }
        this.setDefaultDrawee()
      },
			toback(){
				uni.navigateBack()
			},
			ismobiles(code,mobile){
				let that = this
				that.$request.get('/app-api/param/validator/mobile',{code:code,mobile:mobile}).then(res => {
					if(res.code==0){
						if(that.params.drawee==1){
							that.$refs.payNotice.open()
						}else{
							that.createOrder()
						}
						that.isClick = false
					}else{
						that.isClick = false
						 uni.showToast({
							title: this.$lang.lang.notices.nophone,
							icon: 'error',
						})
					}
				})
			},
			checkMoblie(){
				if(!this.params.countryCode){
					this.params.countryCode = this.config.countrySn.value[0]
				}
				if(!this.params.consigneePhone){
					return
				}
				this.$request.get('/app-api/param/validator/mobile',{code:this.params.countryCode,mobile:this.params.consigneePhone}).then(res => {
					if(res.code!=0){
						 uni.showToast({
							title: this.$lang.lang.notices.nophone,
							icon: 'error',
						})
					}
				})
			},
			changeType(e){
				var items = this.items,
					values = e.detail.value;
				for (var i = 0, lenI = items.length; i < lenI; ++i) {
					const item = items[i]
					if(values.includes(item.value)){
						this.$set(item,'checked',true)
					}else{
						this.$set(item,'checked',false)
					}
				}
				if(values){
					this.params.type = e.detail.value.join(',')
				}else{
					this.params.type = ''
				}

				console.log(this.params.type)
        // 如果勾选了海外仓给提示
        if(this.params.type.indexOf('2') > -1){
          return uni.showModal({
            title: this.$lang.lang.tips,
            content: this.$lang.lang.create.overSeaWarehouseTips,
            showCancel: false
          })
        }
			},
			getType(){
				var items = this.items,
					values = this.params.type.split(',');
				for (var i = 0, lenI = items.length; i < lenI; ++i) {
					const item = items[i]
					if(values.includes(item.value)){
						this.$set(item,'checked',true)
					}else{
						this.$set(item,'checked',false)
					}
				}
			},
			//货币单位
			getCurrencyData () {
				this.$request.getConfig('commission_currency_type').then(res => {
					if(res.code==0&&res.data&&res.data.list.length>0){
						this.currencyType = res.data.list
					}
				})
			},
			getCurrencyType(value){
				var title = ''
				let that = this
				that.currencyType.forEach((item)=>{
					if(item.value == value){
						if(that.$lang.locale=='zh'){
							title =  item.label
						}else{
							title =  item.labelEn
						}
					}
				})
				return title
			},
			//计量单位
			getUnitTypeData () {
				this.$request.get('/app-api/app/unit/list').then(res => {
					if(res.code==0&&res.data&&res.data.length>0){
						this.unitType = res.data
					}
				})
			},
			getUnitType(value){
				var title = ''
				let that = this
				that.unitType.forEach((item)=>{
					if(item.id == value){
						if(that.$lang.locale=='zh'){
							title =  item.titleZh
						}else{
							title =  item.titleEn
						}
					}
				})
				return title
			},
			getValue(e) {
				if(e){
					var sindex = 0
					this.config.product.data.forEach((item,index)=>{
						if(item[this.$lang.title] == e){
							sindex = index
						}
					})
					this.goodsModel.prodTitle = e
					// this.goodsModel.prodTitleEn = this.config['productEn'].label[sindex]
					this.goodsNameChange(sindex)
				}
			},
			goodsNameChange(sindex){
				this.goodsModel.prodId = this.config['product'].data[sindex].id
				this.goodsModel.prodAttrs = this.config['product'].data[sindex].attrId.split(',')
				this.goodsModel.material = this.config['product'].data[sindex].materialType
				this.goodsModel.unit = this.config['product'].data[sindex].packaging
				// this.goodsModel.volume = this.config['productZh'].data[sindex].square
				this.getConfigIndex('material',this.goodsModel.material)
				this.getConfigIndex('unitData',this.goodsModel.unit)
			},
			// getValueEn(e) {
			// 	if(e){
			// 		var sindex = 0
			// 		this.config.productEn.label.forEach((item,index)=>{
			// 			if(item == e){
			// 				sindex = index
			// 			}
			// 		})
			// 		this.goodsModel.prodTitleEn = e
			// 		this.goodsModel.prodTitleZh = this.config['productZh'].label[sindex]
			// 		this.goodsNameChange(sindex)
			// 	}
			// },
			getIdcard () {
				this.$request.get('/app-api/member/user/get-auth-idcard-info').then(res => {
					if(res.code==0&&res.data&&res.data.status==2){
						this.isIdAuth = true
					}
				})
			},
			gertConsignorId(){
				this.$request.get('/app-api/member/user/get').then(res => {
					if(res.code==0&&res.data){
						this.params.consignorId = res.data.id
					}

				})
			},
			goodsChange(e){
				this.goodsModel[e.target.dataset.key] = this.config[e.target.dataset.config].value[e.detail.value]
				this.config[e.target.dataset.config].index = e.detail.value
				// if(e.target.dataset.key == 'material'){
				// 	this.goodsModel.material = this.config[e.target.dataset.config].value[e.detail.value]
				// }
			},
			backOrder(){
				uni.navigateTo({
					url:'../index/index'
				})
			},
			configChange (e){
				let that = this
				if(e.target.dataset.key == 'dialCode'){
					that.conForm.dialCode = that.config[e.target.dataset.config].value[e.detail.value]
				}else{
					that.params[e.target.dataset.key] = that.config[e.target.dataset.config].value[e.detail.value]
				}

				if(e.target.dataset.key == 'countryCode'){
					that.config[e.target.dataset.config].indexs = e.detail.value
					that.checkMoblie()
				}else{
					that.config[e.target.dataset.config].index = e.detail.value
				}
				if(e.target.dataset.key == 'harvestMethod'){
					if(e.detail.value==2){
						that.params.consigneeAddress = that.consignee[that.conIndex].address
					}
				}
				if(e.target.dataset.key == 'transportId'){
					if(that.config[e.target.dataset.config].cssClass[e.detail.value] == 'channel'){
						that.channeled = false
					}else{
						that.config.channel.index = 0
						that.channeled = true
					}
				}
				if(e.target.dataset.key == 'transportId' || e.target.dataset.key == 'departureId' || e.target.dataset.key == 'objectiveId') {
					that.params.lineId = 0
				}
				if(e.target.dataset.key=='objectiveId'){
					that.getChanel()
				}
				if(e.target.dataset.key=='channelId'){
          // 没有选择目的城市才需要更换
          if(this.currentDstCityIndex === null){
            that.getTradeCity('tradeCity2')
          }
				}
				if(e.target.dataset.key =='channelId' || e.target.dataset.key == 'transportId' || e.target.dataset.key == 'departureId' || e.target.dataset.key == 'objectiveId') {
					if(!that.params.channelId  || !that.params.transportId  ||!that.params.lineId ||(that.params.departureId != 0 && this.params.objectiveId != 0)){
						// if((that.params.transportId==3||that.params.transportId==4)&&!that.params.channelId){
						// 	that.openedRouterF = true
						// }else{
							that.openedRouterF = false
						// }

						that.config.openedRouter = {
							index: 0,
							label: [ this.$lang.lang.notices.please],
							value: [''],
							otherService:[''],
							controlStatus:['']
						}
						that.getOpenedRouter()
					}
					that.getOffData()
				}
				if(e.target.dataset.key == 'lineId' || e.target.dataset.key == 'transportId' || e.target.dataset.key =='channel'){
					// that.params.costVO = {}
					// that.params.orderItemVOList = []
					that.calculationPrice(-1)
				}
        if(e.target.dataset.key == 'lineId'){
          // 切换路线则回显城市和国家
          const router = this.routerList.find(item => item.id == this.config.openedRouter.value[this.config.openedRouter.index])
          console.log("切换路线", router, this.config.openedRouter.index, [...this.routerList])
          if(router){
            this.currentDstCountryIndex = this.dstCountryList.findIndex(item => item.id == router.objectiveId)
            this.currentDstCityIndex = this.filteredDstCityList.findIndex(item => item.id == router.objectiveId)
            this.$set(this.params, 'objectiveId', router.destCityId)

            // 找出始发城市
            const startCityIdIndex = this.config.tradeCity1.value.findIndex(item => item == router.startCityId)
            if(startCityIdIndex > -1){
              this.config.tradeCity1.index = startCityIdIndex
              this.$set(this.params, 'departureId', router.startCityId)
            }
          }
        }
				if(e.target.dataset.key == 'lineId'&&that.params.isCargoControl){
					that.checkKycStatus()
				}
				if(e.target.dataset.key=='country'){
					that.config.cityList = {
						index: 0,
						label: [this.$lang.lang.notices.notice],
						value: [''],
						children:['']
					}
					that.config.treeList.value.forEach((item,index) => {
						if(index == e.detail.value){
							that.config.treeList.children[index].forEach(items=>{
								if(that.$lang.locale == 'zh'){
									that.config['cityList'].label.push(items.titleZh)
								}else{
									that.config['cityList'].label.push(items.titleEn)
								}
								that.config['cityList'].value.push(items.id)
								that.config['cityList'].children.push(items.children)
							})
						}
					})
				}
				if(e.target.dataset.key=='province'){
					that.config.provinceList = {
						index: 0,
						label: [ this.$lang.lang.notices.notice],
						value: [''],
					}
					that.config.cityList.value.forEach((item,index) => {
						if(index == e.detail.value){
							that.config.cityList.children[index].forEach(items=>{
								if(that.$lang.locale == 'zh'){
									that.config['provinceList'].label.push(items.titleZh)
								}else{
									that.config['provinceList'].label.push(items.titleEn)
								}
								that.config['provinceList'].value.push(items.id)
							})
						}
					})
				}
			},
			getUnitName(key){
				var index = 0
				this.config.unitData.value.forEach((item,i)=>{
					if(item == key){
						index = i
					}
				})
				if(index==0) return ''
				return this.config.unitData.label[index]
			},
			getProductAttrLabel(data){
				var label = ''
				var productArr = data?.split(',') || []

				this.productAttrList.forEach((item)=>{
					if(productArr.find(items => {return items == item.id})){
						label+= item[this.$lang.attrName]+' '
					}
				})
				return label
			},
			getMaterialName(data){
				var index = 0
				this.config.material.value.forEach((item,i)=>{
					if(item == data){
						index = i
					}
				})
				if(index==0) return ''
				return this.config.material.label[index]
			},
			isProductAttr(data){
				let that = this
				var ischeck = false
				var isdisable = false
				if(that.goodsModel.prodAttrs.length>0){
					that.goodsModel.prodAttrs.forEach((item)=>{
						if(item == data){
							ischeck = true
						}
						if(item==4){
							isdisable = true
						}
					})
				}
				this.isdisable = isdisable
				return ischeck
			},
			checkboxChange: function (e) {
				var items = this.productAttrList,
					values = e.detail.value;
					this.goodsModel.prodAttrs = values
				for (var i = 0, lenI = items.length; i < lenI; ++i) {
					const item = items[i]
					if(values.includes(item.value)){
						this.$set(item,'checked',true)
					}else{
						this.$set(item,'checked',false)
					}
				}
			},
			getDate(type) {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();

				if (type === 'start') {
					year = year - 60;
				} else if (type === 'end') {
					year = year + 2;
				}
				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			},
			bindDateChange: function(e) {
				this.date = e.detail.value
				this.params.deliveryDate = e.detail.value +' ' +'00:00:00'
			},
			snChange(e){
				this.conForm.dialCode = e.detail.value
			},
			//付款人
			draweeType(e){
				this.params.drawee = e.detail.value
			},
			//特殊需求
			getPackageType(e){
				this.params.packageType = e.detail.value.join(',')
			},

			addOrder(){
        // 如果勾选了海外仓给提示
        if(this.params.type.indexOf('2') > -1){
          return uni.showModal({
            title: this.$lang.lang.tips,
            content: this.$lang.lang.create.overSeaWarehouseTips,
            showCancel: false
          })
        }
        /*有收货人 但是 没有填写收货人名称*/
				if(this.hasConsignee && !this.params.consigneeName){
					return uni.showToast({
						title:  this.$lang.lang.notices.consignee,
						icon: 'error',
					})
				}
				if(this.hasConsignee && !this.params.countryCode){
					this.params.countryCode = this.config.countrySn.value[0]
				}
        // 有收货人但是无收货人电话
				if(this.hasConsignee && !this.params.consigneePhone){
					return uni.showToast({
						title:  this.$lang.lang.notices.consigneePhone,
						icon: 'error',
					})
				}/*else if(!this.params.isCargoControl && this.params.countryCode==this.config.countrySn.value[0]){
					return uni.showToast({
						title:  this.$lang.lang.notices.foreignConsignee,
						icon: 'error',
					})
				}*/

				if(this.params.consigneeEmail){
					let email_reg = /[a-zA-Z0-9]+([-_.][A-Za-zd]+)*@([a-zA-Z0-9]+[-.])+[A-Za-zd]{2,5}$/

					if (!email_reg.test(this.params.consigneeEmail)) {
						return uni.showToast({
							title:  this.$lang.lang.notices.noEmail,
							icon: 'error',
						})
					}
				}

				if(this.params.orderItemVOList.length>0){
					this.$set(this.params,'orderItemVOList',this.getProductListWithDefaultValue())
					var isNotAcceptGoods = false
					this.params.orderItemVOList.forEach(item=>{
						if(item.prodAttrIds.indexOf(4)!=-1){
							isNotAcceptGoods = true
						}
					})
					if(isNotAcceptGoods){
						return uni.showToast({
							title:  this.$lang.lang.notices.isClude,
							icon: 'error',
						})
					}

				}
				if(!this.params.transportId) {
					return uni.showToast({
						title:  this.$lang.lang.notices.transport,
						icon: 'error',
					})
				}
				// if(this.params.transportId>2&&!this.params.channelId){
				// 	return uni.showToast({
				// 		title:  this.$lang.lang.notices.channel,
				// 		icon: 'error',
				// 	})
				// }
				if(this.params.lineId==''||this.params.lineId==null){
					return uni.showToast({
						title:  this.$lang.lang.notices.lined,
						icon: 'error',
					})
				}
				if(this.params.departureId==''||this.params.departureId==null){
					return uni.showToast({
						title:  this.$lang.lang.notices.startCity,
						icon: 'error',
					})
				}
				if(this.params.objectiveId==''||this.params.objectiveId==null){
					return uni.showToast({
						title:  this.$lang.lang.notices.endCity,
						icon: 'error',
					})
				}
				// if(this.params.number==''||this.params.number==null){
				// 	return uni.showToast({
				// 		title: '请输入快递单号',
				// 		icon: 'error',
				// 	})
				// }
				if(this.params.marks==''||this.params.marks==null){
					return uni.showToast({
						title:  this.$lang.lang.notices.marksIn,
						icon: 'error',
					})
				}/*else if(parseFloat(this.params.marks.slice(0,1)).toString() != "NaN"){
					return uni.showToast({
						title:  this.$lang.lang.notices.marksNum,
						icon: 'error',
					})
				}*/
				if(this.params.customsType==''||this.params.customsType==null){
					return uni.showToast({
						title:  this.$lang.lang.notices.customsType,
						icon: 'error',
					})
				}
				if(this.params.deliveryDate==''||this.params.deliveryDate==null){
					return uni.showToast({
						title:  this.$lang.lang.notices.date,
						icon: 'error',
					})
				}
				if(this.params.isCargoControl){
					this.checkKycStatus()
				}
				if(this.params.warehouseType==''||this.params.warehouseType==null){
					this.params.warehouseType = this.config.warehouseType.value[1]
				}
				if(this.params.harvestMethod==''||this.params.harvestMethod==null){
					this.params.harvestMethod = this.config.harvestMethod.value[0]
				}


				var  ids = []
				if(this.couponData.length>0){
					this.couponData.forEach((item)=>{
						if(item.checked){
							ids.push(item.id)
						}
					})
					this.params.couponIds = ids.join(',')
				}

				if(!this.collectionShow){
					this.params.isCollection = false
				}
        // 如果选择了代收货款则判断是否设置了代收金额和货币单位
        if(this.params.isCollection){
          if(!this.params.collectionProxy){
            return uni.showToast({
              title: this.$lang.lang.create.needCollectionAmount,
              icon: 'error',
            })
          }
          if(!this.params.collectionProxyCurrency){
            return uni.showToast({
              title: this.$lang.lang.create.needCollectionCurrency,
              icon: 'error',
            })
          }
        }
				if(this.params.harvestMethod!=2){
					this.params.consigneeAddress = ''
				}
				var url=''
				if(this.isClick){
					return
				}
				this.isClick = true
				if(this.hasConsignee){
          return this.ismobiles(this.params.countryCode,this.params.consigneePhone)
        }
        if(this.params.drawee==1){
          this.$refs.payNotice.open()
        }else{
          this.createOrder()
        }
        this.isClick = false
			},
			// 校验目的国和手机区号
      async validateCountryAndAreaCode(){
        if(this.hasConsignee){
          const res = await this.$request.get('/app-api/ecw/region/check/dest-currency/area-code/', {
            areaCode: this.params.countryCode,
            currencyId: this.dstCountryList[this.currentDstCountryIndex].guojia
          })
          console.log("目的地货币校验", res)
          if(!res.data){
            const res = await uni.showModal({
              title: this.$lang.lang.create.tips,
              content: this.$lang.lang.create.areaCodeAndDestCountryCheckFail,
              showCancel: true
            })
            console.log("确认结果", res)
            if(!res[1].confirm){
              throw new Error("目的国手机号校验不通过且用户点击取消")
            }
          }
        }
      },
      async creatOrder(){
        await this.validateCountryAndAreaCode()
				this.$request.post('/app-api/my/order/create', {...this.params, hasConsignee: this.hasConsignee}).then(res => {
					this.isClick = false
					if(res.code == 0&&res.data){
						this.params = {
							transportId: 0, //运输类型
							departureId: 0, //始发ID
							objectiveId: 0, //目的地ID
							lineId: 0, //线路ID
							channelId:0,//渠道ID
							orderItemVOList:[],
							costVO:{},
							deliveryDate:this.currentDate+' 00:00:00',
							drawee:2,
							number:'',
							isCargoControl:false,
							consigneeId:0,
							customsType:1,
							type:'',
							isCollection:false,
							issuingMethod:1,
							doubleClear:2
						},

						uni.showToast({
							title: this.$lang.lang.notices.creat,
							icon:"none",
							success() {
								setTimeout(function(){
									uni.navigateTo({
										url:'../orderFinsh/orderFinsh?orderId='+res.data
									})
								},2000)
							}
						})
					}else{
						uni.showToast({
							title:res.msg,
							icon:"none"
						})
					}

				})
			},
			getOrderData(id, copy){
				let that = this
				that.$request.get('/app-api/my/order/get',{orderId:id}).then(async (res) => {
					if(res.code==0&&res.data){
            this.params = Object.assign({}, res.data, {
              orderItemVOList: [],
              destCountryId: null,
              consigneeName: '',
              consigneePhone: ''
            })
            if (copy){
              // 复制订单,需要将数据初始化
              that.params.orderId = null
              that.params.orderNo = null
              that.params.containerNumber = null
              that.params.tidanNo = null
              that.params.parentOrderId = null
              that.params.parentNumber = null
              that.params.number = null
              that.params.initialParentOrderId = null
              that.params.initialParentOrderNo = null
              that.params.noChargeRecord = null
              that.params.oldNumbers = null
              that.params.userId = 0
              that.params.sumNum = null
              that.params.sumQuantity = null
              that.params.sumVolume = null
              that.params.sumWeight = null
              that.params.pickleType = null
              that.params.pickRatio = null
              that.params.pickNum = null
              that.params.releaseRatio = null
              that.params.cost = null
              that.params.packingListUrl = null
              that.params.commissionPayable = null
              that.params.specialVWeight = null
              that.params.handlerChannelAttrException = null
              that.params.weightBeforePack = null
              that.params.weightAfterPack = null
              that.params.stockOverWeightLimit = null
              that.params.firstStockedTime = null
              that.params.isLimitUpdateConsignee = null
              that.params.lockConsigneeDay = null
              that.params.lockConsigneeTime = null
              that.params.firstStockedTime = null
              // 状态重置
              that.params.status = 0
              that.params.cargoControlStatus = 0
              that.params.abnormalState = 0
              that.params.inWarehouseState = 0
              that.params.shipmentState = 0
              that.params.auditType = 0
              that.params.auditResult = null
              that.params.airShipment = null
              that.params.splitSeparateOrder = null
              that.params.pickState = null
              that.params.guanLianOrderStatus = null
              that.params.oldInWarehouseState = null
              that.params.oldStatus = null
              that.params.oldShipmentState = null
              // 时间重置
              that.params.takeTime = null
              that.params.unloadTime = null
              that.params.rucangTime = null
              that.params.loadTime = null
              that.params.preLoadTime = null
              that.params.deliveryDate = null
              that.params.daogangTime = null
              that.params.qingguanTime = null
              that.params.splitTime = null
              that.params.isException = null
              that.params.exceptionReason = null
              that.params.externalWarehouseJson = null
              that.params.hasExitAndEntry = null
              that.params.hasSendRucangSms = null
              that.params.hasSendWarehouseInNotice = null
              if (that.params.consignorVO){
                that.params.consignorVO.id = null
                that.params.consignorVO.orderId = null
              }
              if (that.params.consigneeVO){
                that.params.consigneeVO.id = null
                that.params.consigneeVO.orderId = null
              }

            }
						// if(!that.params.number) that.params.number = ''
						that.getType()
            res.data.orderItemVOList.forEach((item)=>{
              let newItem = {}
              if (copy) {
                newItem = {
                  link: item.link,
                  prodId: item.prodId,
                  prodTitleEn: item.prodTitleEn,
                  prodTitleZh: item.prodTitleZh,
                  prodAttrIds: item.prodAttrIds,
                  prodType: item.prodType,
                  volume: item.volume,
                  weight: item.weight,
                  quantity: item.quantity,
                  num: item.num,
                  worth: item.worth,
                  boxGauge: item.boxGauge,
                  brand: item.brand,
                  brandType: item.brandType
                }
              }else {
                newItem = item
              }
              if(newItem.prodAttrIds) newItem.prodAttrs = newItem.prodAttrIds.split(',')
              that.params.orderItemVOList.push({ ...newItem })
            });


						/*if(that.params.transportId != 0 ||that.params.lineId!=0 ||(that.params.departureId != 0 && that.params.objectiveId != 0)){
							that.openedRouterF = false
							that.getOpenedRouter()
						}
						that.getConfigIndex('transport',that.params.transportId)
						that.getConfigIndex('channel',that.params.channelId)
						that.getConfigIndex('tradeCity2',that.params.objectiveId)
						that.getConfigIndex('tradeCity1',that.params.departureId)*/
						that.setPackType()
						if(that.params.shippingCompany){
							that.getConfigIndex('clientaData',that.params.shippingCompany)
						}
						if(that.params.airlineCompany){
							that.getConfigIndex('clientaData',that.params.airlineCompany)
						}
						that.getConfigIndex('warehouseType',that.params.warehouseType)

						if(that.params.consigneeVO){
							that.params.consigneeAddress = that.params.consigneeVO.address


							that.getConfigIndex('treeList',that.params.consigneeVO.country)

							that.getConfigIndex('cityList',that.params.consigneeVO.province)
							that.getConfigIndex('provinceList',that.params.consigneeVO.city)
						}
						that.getConIndex()
            // 2024-11-21测试consigneeVO下面的deliveryDate为null,而且可能没有收货人所有不能据此回显
						if(that.params.deliveryDate){
							var dateArr = that.params.deliveryDate.split(' ')
							that.date = dateArr[0]
							that.time = dateArr[1]
						}
						that.getOffData()

            // 回显目的城市和目的国
            const dstCityIndex = this.filteredDstCityList.findIndex(item => item.shi === that.params.objectiveId)
            if(dstCityIndex > -1){
              const currentDstCountryId = this.filteredDstCityList[dstCityIndex].guojia
              const currentDstCountrtyIndex = this.dstCountryList.findIndex(item => item.guojia === currentDstCountryId)
              that.currentDstCountryIndex = currentDstCountrtyIndex
              await this.$nextTick()
              this.currentDstCityIndex = dstCityIndex
            }

            // 回显始发城市
            const startCityIndex = this.startCityList.findIndex(item => item.id == that.params.departureId)
            console.log("startCityIndex", startCityIndex, this.startCityList.length)
            if(startCityIndex > -1){
              this.currentStartCityIndex = startCityIndex
            }
            // 回显运输方式
            const transIndex = this.transportList.findIndex(item => item.value == that.params.transportId)
            if(transIndex > -1){
              this.currentTransportIndex = transIndex
            }
            // 回显路线
            await that.getOpenedRouter()
            const currentRouteIndex = this.routerList.findIndex(item => item.id == this.params.lineId)
            if(currentRouteIndex > -1){
              this.currentRouteIndex = currentRouteIndex
            }

            // 回显收货方式
            const harvestIndex = this.enabledHarvestList.findIndex(item => item.value == that.params.harvestMethod)
            if(harvestIndex > -1){
              this.currentHarvestIndex = harvestIndex
            }

            this.hasConsignee = res.data.hasConsignee
            if (!that.noConsignee){
              this.hasConsignee = true
            }
          }
				})
			},
			setPackType(){

				for(let i in this.packageType){
					console.log(this.packageType[i].value)
					if(this.params.packageType&&this.params.packageType.split(',').indexOf(this.packageType[i].value)!=-1){
						this.packageType[i].checked = true
					}
				}
			},
			getConfigIndex(key,value,type=0){
				let that = this
				var sIndex = 0
				var arrData = that.config[key].value
				for(let i in arrData){

					if(arrData[i]==value){
						sIndex = i
						if(type==1){
							that.config[key].indexs = i
						}else{
							that.config[key].index = i
						}

					}
				}
				if(key == 'treeList'&&sIndex!=0){
					 var treeDat = that.config.treeList.children[sIndex]
					 for(let i in treeDat){
						 if(that.$lang.locale == 'zh'){
						 	that.config['cityList'].label.push(treeDat[i].titleZh)
						 }else{
						 	that.config['cityList'].label.push(treeDat[i].titleEn)
						 }
					 	 that.config['cityList'].value.push(treeDat[i].id)
					 	 that.config['cityList'].children.push(treeDat[i].children)
					 }
				}
				if(key == 'cityList'&&sIndex!=0){
					var treeDats = that.config.cityList.children[sIndex]
					for(let i in treeDats){
						if(that.$lang.locale == 'zh'){
							that.config['provinceList'].label.push(treeDats[i].titleZh)
						}else{
							that.config['provinceList'].label.push(treeDats[i].titleEn)
						}
						 that.config['provinceList'].value.push(treeDats[i].id)
					}
				}
				if(key == 'material'){
					if(sIndex>0) return that.config[key].label[sIndex]
				}
				if(key == 'transport' && value>2){
					that.channeled = false
				}
			},
			async updateOrder(){
        await this.validateCountryAndAreaCode()
        this.params.hasConsignee = this.hasConsignee
				this.$request.put('/app-api/my/order/update', { ...this.params, status: 2}).then(res => {
					this.isClick = false
					if(res.code == 0){
						this.params = {
							transportId: 0, //运输类型
							departureId: 0, //始发ID
							objectiveId: 0, //目的地ID
							lineId: 0, //线路ID
							channelId:0,//渠道ID
							orderItemVOList:[],
							costVO:{},
							deliveryDate:this.currentDate+ "00:00:00",
							drawee:2,
							number:'',
							isCargoControl:false,
							consigneeId:0,
							customsType:1,
							type:'',
							isCollection:false,
							issuingMethod:1,
							doubleClear:2
						},

						uni.showToast({
							title: this.$lang.lang.notices.edited,
							icon:"none",
							success() {
								setTimeout(()=>{
									uni.navigateBack()
								},2000)
							}
						})
					}else{
						uni.showToast({
							title:res.msg,
							icon:"none",
						})
					}

				})
			},
			addGood(){
				console.log(this.goodsModel)
				if(this.goodsModel.prodTitle==''){
					return uni.showToast({
						title:  this.$lang.lang.notices.shopname,
						icon: 'error',
					})
				}
				if(this.goodsModel.brandType ==''||this.goodsModel.brandType==null){
					this.goodsModel.brandType = this.config['brandData'].value[0]
					console.log(this.goodsModel.bandType)
				}
				if(this.goodsModel.volume ==''||this.goodsModel.volume==null){
						// this.goodsModel.volume = 1
				}else if(this.goodsModel.volume<=0){
					return uni.showToast({
						title:this.$lang.lang.notices.intNotice3
					})
				}

				if(this.goodsModel.num ==''||this.goodsModel.num==null){
					return uni.showToast({
						title:  this.$lang.lang.notices.num,
						icon: 'error',
					})
				}else if(this.goodsModel.num<=0||Math.floor(this.goodsModel.num)!=this.goodsModel.num){
					console.log(Math.floor(this.goodsModel.num)!=this.goodsModel.num)
					return uni.showToast({
						title:this.$lang.lang.notices.intNotice1
					})
				}
				if(this.goodsModel.unit ==''||this.goodsModel.unit==null){
					return uni.showToast({
						title:  this.$lang.lang.notices.unit,
						icon: 'error',
					})
				}

				if(this.goodsModel.quantity ==''||this.goodsModel.quantity==null){
						// this.goodsModel.quantity = 1
				}else if(this.goodsModel.quantity<=0||Math.floor(this.goodsModel.quantity)!=this.goodsModel.quantity){
					console.log(Number.isInteger(this.goodsModel.quantity))
					return uni.showToast({
						title:this.$lang.lang.notices.intNotice2
					})
				}
				if(this.goodsModel.weight ==''||this.goodsModel.weight==null){
						// this.goodsModel.weight = 1
				}else if(this.goodsModel.weight<=0){
					return uni.showToast({
						title:this.$lang.lang.notices.intNotice4
					})
				}
				if(this.goodsModel.worth ==''||this.goodsModel.worth==null){
					return uni.showToast({
						title:  this.$lang.lang.notices.works,
						icon: 'error',
					})
				}else if(this.goodsModel.worth<=0){
					return uni.showToast({
						title:this.$lang.lang.notices.intNotice5
					})
				}


				// if(!this.goodsModel.quantity){
				// 	this.goodsModel.quantity = 1
				// }
				// if(!this.goodsModel.volume){
				// 	this.goodsModel.volume = 1
				// }
				// if(!this.goodsModel.weight){
				// 	this.goodsModel.weight = 1
				// }
				if(this.goodsModel.prodAttrs){
				    this.goodsModel.prodAttrIds = this.goodsModel.prodAttrs.join(',')
				}
				var editIndex = this.goodsEditIndex
				if(this.goodsEditIndex!=-1){
					this.params.orderItemVOList[editIndex] = this.goodsModel
				}else{
					editIndex = this.params.orderItemVOList.length
					this.params.orderItemVOList.push({
            ...this.goodsModel,
            showFull: false
          })
				}
				this.calculationPrice(editIndex)
				this.$refs.popup.close()
			},
			getProductListWithDefaultValue(){
			    let arr = []
			    this.params.orderItemVOList.forEach(item => {
			        let tmp = {...item}
			        if(!tmp.volume)tmp.volume = 1
			        if(!tmp.weight)tmp.weight = 1
			        if(!tmp.quantity)tmp.quantity = 1
			        if(!tmp.num)tmp.num = 1
			        tmp.orderType = item.orderItemType
			        arr.push(tmp)
			    })
			    return arr
			},
			calculationPrice(editIndex){
				var paramsData = {}
				var list = this.params.orderItemVOList
				if(this.params.channelId){
					paramsData={
						lineId: this.params.lineId,
						transportId: this.params.transportId,
						channelId: this.params.channelId,
						prodConditionParamList: this.getProductListWithDefaultValue(),
					}
				}else{
					paramsData={
						lineId: this.params.lineId,
						transportId: this.params.transportId,
						prodConditionParamList: this.getProductListWithDefaultValue()
					}
				}
				this.$request.post('/app-api/product/line/price/calculation',paramsData).then(res => {
					if(res.code==0&&res.data){
						if(editIndex>=0){
							this.params.orderItemVOList[editIndex].brand = res.data.prodCostDtoList[editIndex].brand
							this.params.orderItemVOList[editIndex].charging = res.data.prodCostDtoList[editIndex].charging
							this.params.orderItemVOList[editIndex].clearanceFreight = res.data.prodCostDtoList[editIndex].clearanceFee
							this.params.orderItemVOList[editIndex].clearanceFreightCurrency = res.data.prodCostDtoList[editIndex].clearanceFeeCurrency
							this.params.orderItemVOList[editIndex].clearanceFreightVolume = res.data.prodCostDtoList[editIndex].clearanceFeeVolume
							this.params.orderItemVOList[editIndex].seaFreight = res.data.prodCostDtoList[editIndex].freight
							this.params.orderItemVOList[editIndex].seaFreightCurrency = res.data.prodCostDtoList[editIndex].freightCurrency
							this.params.orderItemVOList[editIndex].seaFreightVolume = res.data.prodCostDtoList[editIndex].freightVolume
							this.params.orderItemVOList[editIndex].isPayAdvance = res.data.prodCostDtoList[editIndex].isPayAdvance
							this.params.orderItemVOList[editIndex].premium = res.data.prodCostDtoList[editIndex].premium

							this.reset()
						}else{
							for(let i=0;i<this.params.orderItemVOList.length;i++){
								this.params.orderItemVOList[i].charging = res.data.prodCostDtoList[i].charging
								this.params.orderItemVOList[i].clearanceFreight = res.data.prodCostDtoList[i].clearanceFee
								this.params.orderItemVOList[i].clearanceFreightCurrency = res.data.prodCostDtoList[i].clearanceFeeCurrency
								this.params.orderItemVOList[i].clearanceFreightVolume = res.data.prodCostDtoList[i].clearanceFeeVolume
								this.params.orderItemVOList[i].seaFreight = res.data.prodCostDtoList[i].freight
								this.params.orderItemVOList[i].seaFreightCurrency = res.data.prodCostDtoList[i].freightCurrency
								this.params.orderItemVOList[i].seaFreightVolume = res.data.prodCostDtoList[i].freightVolume
								this.params.orderItemVOList[i].isPayAdvance = res.data.prodCostDtoList[i].isPayAdvance
								this.params.orderItemVOList[i].premium = res.data.prodCostDtoList[i].premium
							}
						}
						this.params.costVO = res.data.costDto
					}
			    })
			},

			getCouponData(){
				this.$request.post('/app-api/product/coupon/customer/available/couponList',{
					lineId: this.params.lineId,
					transportId: this.params.transportId,
					channelId: this.params.channelId,
					prodConditionParamList: this.params.orderItemVOList,
					customsType:this.params.customsType,
					isCargoControl:this.params.isCargoControl
				}).then(res => {

					if(res.code==0&&res.data&&res.data.legth>0){
						this.couponData = res.data
						this.couponData.forEach((item)=>{
							item.checked = false
						})
					}
			    })
			},
			getTotalMoney(index){
				this.totalMoney = 0
				this.couponData[index].checked = !this.couponData[index].checked
				this.couponData.forEach((item)=>{
					if(item.checked){
						this.totalMoney += item.reduceAmount
					}
				})
			},
			open (index) {
				if(!this.params.transportId) {
					return uni.showToast({
						title:  this.$lang.lang.notices.transport,
						icon: 'error',
					})
				}
				// if(this.params.transportId>2&&!this.params.channelId){
				// 	return uni.showToast({
				// 		title:  this.$lang.lang.notices.channel,
				// 		icon: 'error',
				// 	})
				// }
				if(this.params.departureId==''||this.params.departureId==null){
					return uni.showToast({
						title:  this.$lang.lang.notices.startCity,
						icon: 'error',
					})
				}
				if(this.params.objectiveId==''||this.params.objectiveId==null){
					return uni.showToast({
						title:  this.$lang.lang.notices.endCity,
						icon: 'error',
					})
				}
				if(this.params.lineId==''||this.params.lineId==null){
					return uni.showToast({
						title:  this.$lang.lang.notices.lined,
						icon: 'error',
					})
				}
				this.goodsEditIndex = index
				if(index!=-1){
					this.goodsModel = this.params.orderItemVOList[index]
					this.goodsModel.prodAttrs = this.goodsModel.prodAttrIds.split(',')
					this.config.brandData.value.forEach((item,index)=>{
						if(this.goodsModel.brandType == item){
							this.config.brandData.index = index
						}
					})
					this.config.unitData.value.forEach((item,index)=>{
						if(this.goodsModel.unit == item){
							this.config.unitData.index = index
						}
					})
					this.config.material.value.forEach((item,index)=>{
						if(this.goodsModel.material == item){
							this.config.material.index = index
						}
					})
					this.config.product.value.forEach((item,index)=>{
						if(this.goodsModel.prodTitle == item){
							this.config.product.index = index
						}
					})
					// this.config.productZh.value.forEach((item,index)=>{
					// 	if(this.goodsModel.prodTitleZh == item){
					// 		this.config.productZh.index = index
					// 	}
					// })
				}else{
					this.reset()
				}
				this.$refs.popup.open()
			},
			openLink(index){
				this.linkIndex = index
				this.link = this.params.orderItemVOList[index].link
				this.$refs.shoplink.open()
			},
			addlink(){
				var arr = this.params.orderItemVOList[this.linkIndex]
				arr.link = this.link
				this.params.orderItemVOList.splice(this.linkIndex,1,arr)
				this.$refs.shoplink.close()
			},
			toLink(src){
				uni.navigateTo({
					url:'../shop_link/shop_link?src='+src
				})
			},
			closelink(){
				this.$refs.shoplink.close()
			},
			closeInsertCon(){
				this.conForm = {
					dialCode:this.config.countrySn.value[0],
					id:0
				}
				this.$refs.insertCon.close()
			},
			//编辑收货人
			editCon(index){
				this.conForm = this.consignee[index]
				this.searchKey = ''
				this.getConfigIndex('countrySn',this.consignee[index].dialCode)
				this.$refs.insertCon.open()
			},
			ismobile(){
				this.$request.get('/app-api/param/validator/mobile',{code:this.conForm.dialCode,mobile:this.conForm.phone}).then(res => {
					if(res.code==0){
						this.insertCons()
					}else{
						uni.showToast({
							title:  this.$lang.lang.notices.nophone,
							icon: 'error',
						})
					}
				})
			},
			insertCon(){
				if(!this.conForm.dialCode){
					this.conForm.dialCode = '86'
				}
				if(this.conForm.name ==''||this.conForm.name==null){
					return uni.showToast({
						title:  this.$lang.lang.notices.name,
						icon: 'error',
					})
				}
				if(this.conForm.phone ==''||this.conForm.phone==null){
					return uni.showToast({
						title:  this.$lang.lang.notices.phone,
						icon: 'error',
					})
				}
				if(this.conForm.email ==''||this.conForm.email==null){
					// return uni.showToast({
					// 	title:  this.$lang.lang.notices.email,
					// 	icon: 'error',
					// })
				}else{
					let email_reg = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;

					if (!email_reg.test(this.conForm.email)) {
						return uni.showToast({
							title:  this.$lang.lang.notices.noEmail,
							icon: 'error',
						})
					}
				}
				this.ismobile()
			},
			//添加收货人
			insertCons(){
				if(this.conForm.id>0){
					this.$request.put('/app-api/ecw/admin-client/update',this.conForm).then(res => {
						if(res.code==0){
							uni.showToast({
								title: this.$lang.lang.notices.edited,
								icon:"none"
							})
							this.page = 1
							this.getCon()
							this.closeInsertCon()
						}else{
							uni.showToast({
								title:res.msg,
								icon:"none"
							})
						}

					})
				}else{
					this.$request.post('/app-api/ecw/admin-client/create',this.conForm).then(res => {
						if(res.code==0){
							uni.showToast({
								title: this.$lang.lang.notices.add,
								icon:"none"
							})
							this.page = 1
							this.getCon()
							this.closeInsertCon()
						}else{
							uni.showToast({
								title:res.msg,
								icon:"none"
							})
						}

					})
				}

			},
			tochoice(){
				this.$refs.addCon.open('top')
			},
			closeAddCon(){
				this.searchKey = ''
				this.$refs.addCon.close()
			},
			openCon(){
				this.searchKey = ''
				this.$refs.insertCon.open()
			},
			delGoods(index){
				let that = this
				uni.showModal({
					title:  this.$lang.lang.notices.notice,
					content:  this.$lang.lang.notices.delete,
					success: function (res) {
						if (res.confirm) {
							that.params.orderItemVOList.splice(index,1)
              console.log("删除后剩余产品数:", that.params.orderItemVOList.length)
							if(that.params.orderItemVOList.length){
								that.calculationPrice(-1)
							}else{
								that.params.costVO = {}
							}
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			},
			reset(){
				this.goodsModel = {
					// prodTitleZh:'',
					// prodTitleEn:'',
          prodTitle: '',
					volume:'',
					prodAttrs:[],
					prodAttrIds:'',
					brandType:null,
					num:null,
					unit:'',
					quantity:null,
					weight:null,
					worth:null,
					material:null,
				}
				this.config.brandData.index = 0
				this.config.unitData.index = 0
				this.config.material.index = 0
				this.config.product.index = 0
				// this.config.productZh.index = 0
			},
			colsePopup (){
				this.reset()
				this.$refs.popup.close()
			},
			getZd(){
				this.$request.get('/app-api/system/dict-type/list-all-simple').then(res => {
					//console.log(res)
				})
			},
			//获取供应商
			getClientaData(){
				this.$request.get('/app-api/ecw/supplier/page',{page:1,rows:500}).then(res => {
					if(res.code==0&&res.data&&res.data.list.length > 0){
						let d = res.data.list
						for(let i in d){
							this.config['clientaData'].label.push(d[i].companyZh)
							this.config['clientaData'].value.push(d[i].id)
						}
					}
				})
			},
			//获取币种
			getCurrencyList(){
				let that = this
				that.$request.get('/app-api/ecw/currency/list').then(res => {
					if(res.code==0&&res.data.length > 0){
						let d = res.data
						for(let i in d){
							if(that.$lang.locale=='zh'){
								that.config['currencyType'].label.push(res.data[i].titleZh)
							}else{
								that.config['currencyType'].label.push(res.data[i].titleEn)
							}
							// this.config['countrySn'].label.push(d[i].tel)
							that.config['currencyType'].value.push(d[i].id)
						}
					}
				})
			},
			//获取区号
			getCountrySn(){
				let that = this
				that.$request.get('/app-api/ecw/country/list-all').then(res => {
					if(res.code==0&&res.data.length > 0){
						let d = res.data
						for(let i in d){
							// if(that.$lang.locale=='zh'){
								that.config['countrySn'].label.push('+'+res.data[i].tel + ' ' + res.data[i][this.$lang.name])
							// }else{
							// 	that.config['countrySn'].label.push('+'+res.data[i].tel + ' ' + res.data[i].nameEn)
							// }
							// this.config['countrySn'].label.push(d[i].tel)
							that.config['countrySn'].value.push(d[i].tel)
						}
					}
				})
			},
			//获取国家
			getTreeList(){
				let that = this
				that.$request.get('/app-api/ecw/region/getListTree',{treeType:1}).then(res => {
					if(res.code==0&&res.data&&res.data.length > 0){
						let d = res.data
						for(let i in d){
							if(that.$lang.locale == 'zh'){
								that.config['treeList'].label.push(d[i].titleZh)
							}else{
								that.config['treeList'].label.push(d[i].titleEn)
							}
							that.config['treeList'].value.push(d[i].id)
							that.config['treeList'].children.push(d[i].children)
						}
					}
				})
			},
			//选择收货人
			choiceCon(index){
				let that = this
				that.searchKey = ''
				that.conIndex = index
				that.params.consigneeId = that.consignee[index].id
				that.params.consigneeName = that.consignee[index].name
				that.params.consigneeCompany = that.consignee[index].company
				that.params.consigneeNameEn = that.consignee[index].nameEn
				that.params.consigneeCompanyEn = that.consignee[index].companyEn
				that.params.countryCode = that.consignee[index].dialCode
				that.getConfigIndex('countrySn',that.params.countryCode,1)
				that.params.consigneePhone = that.consignee[index].phone
				that.params.consigneeEmail = that.consignee[index].email
				that.params = Object.assign({},that.params)
				that.$refs.addCon.close()
				if(that.params.lineId) that.getOffData()
			},
			getConIndex(){
				let that = this
				var sid = 0
				if(that.params.consigneeId){
					for(let i in that.consignee){
						if(that.consignee[i].id == that.params.consigneeId){
							sid = i+1
						}
					}
					if(sid){
						that.conIndex = sid-1
						that.params.consigneeCompany = that.consignee[that.conIndex].company
						that.params.consigneeName = that.consignee[that.conIndex].name
						that.params.consigneeCompanyEn = that.consignee[that.conIndex].companyEn
						that.params.consigneeNameEn = that.consignee[that.conIndex].nameEn
						that.params.countryCode = that.consignee[that.conIndex].dialCode
						that.params.consigneePhone = that.consignee[that.conIndex].phone
						that.getConfigIndex('countrySn',that.params.countryCode,1)
						that.params.consigneeEmail = that.consignee[that.conIndex].email
					}
				}
				if(sid==0 && that.params.consigneeVO){
					that.params.consigneeCompany = that.params.consigneeVO.company
					that.params.consigneeName = that.params.consigneeVO.name
					that.params.consigneeCompanyEn = that.params.consigneeVO.companyEn
					that.params.consigneeNameEn = that.params.consigneeVO.nameEn
					that.params.countryCode = that.params.consigneeVO.countryCode
					that.params.consigneePhone = that.params.consigneeVO.phone
					that.getConfigIndex('countrySn',that.params.countryCode,1)
					that.params.consigneeEmail = that.params.consigneeVO.email
				}
			},
			searchCon(){
				this.page = 1
				this.getCon()
			},
			//收货人
			getCon(){
				let that = this
				that.$request.get('/app-api/ecw/admin-client/page',{page:that.page,rows:10,searchKey:that.searchKey}).then(res => {
					if(res.code==0){
						if(that.page==1){
							that.consignee = []
							that.consignee = res.data.list
						}else{
							that.consignee = that.consignee.concat(res.data.list)
						}
						if(that.consignee.length>=res.data.total){
							that.moreShow = false
						}else{
							that.moreShow = true
						}
					}else{
						that.moreShow = false
					}
				})
			},
			showMore(){
				this.page++
				this.getCon()
			},
			//单证报关
			customsType(e){
				this.params.customsType = e.detail.value
				// if(this.params.isCargoControl!=''&&this.params.isCargoControl!=null&&this.params.orderItemVOList.length>0){
				// 	this.getCouponData()
				// }
			},
			autoCreatOrderSn(){
				let that = this
				that.$request.get('/app-api/my/order/courier/number').then(res => {
					if(res.code==0&&res.data){
						if(that.params.number){
							that.params.number += ',' + res.data
						}else{
							that.params.number = res.data
						}
					}
				})
			},
			//获取订单号
			bindTextAreaBlur(e){
				this.params.number = e.detail.value
			},
			//是否拆包
			isUnpack(e){
				this.params.isUnpack = e.detail.value=='true'?true:false
			},
			//清关证书
			customsClearCert(e){
				this.params.customsClearCert = e.detail.value=='true'?true:false
			},
			isCollection(e){
				this.params.isCollection = e.detail.value=='true'?true:false
				console.log(this.params.isCollection)
			},
			issuingMethod(e){
				this.params.issuingMethod = e.detail.value
			},
			//是否控货
			isCargoControl(e){
        // 没有收货人必须控货
        if(!this.hasConsignee){
          return
        }
				this.params.isCargoControl = e.detail.value=='true'?true:false
				var server = this.config['openedRouter'].otherService[this.config['openedRouter'].index]
				if(this.params.isCargoControl){
					this.checkKycStatus()
					// this.$set(this.params,'drawee',2)
				}else{
					// this.$set(this.params,'drawee',1)
				}
				if(!this.params.isCargoControl&&server.indexOf(3)>-1){
					this.collectionShow = true
				}else{
					this.collectionShow = false
				}
			},
			checkKycStatus(){
				this.$request.get('/app-api/my/order/getKycStatus',{controlCargoStatus:true,lineId:this.params.lineId}).then(res => {
					if(res.code==0&&res.data){
						if(res.data.wareHouseStatus==2&&res.data.memberKycStatus!=2){
							this.showNotice(2)
						}
						if(res.data.wareHouseStatus==3&&res.data.companyKycStatus!=2){
							this.showBusNotice()
						}
						if(res.data.wareHouseStatus==4){
							if(res.data.memberKycStatus!=2&&res.data.companyKycStatus!=2){
								this.showNotice(4)
							}else if(res.data.memberKycStatus!=2&&res.data.companyKycStatus==2){
								this.showNotice(2)
							}else if(res.data.memberKycStatus==2&&res.data.companyKycStatus!=2){
								this.showBusNotice()
							}
						}
						if(res.data.wareHouseStatus==5){
							if(res.data.memberKycStatus!=2&&res.data.companyKycStatus!=2){
								this.showNotice(2)
							}
						}
					}
				})
			},
			showNotice(index){
				let that = this
				uni.showModal({
					title: this.$lang.lang.notices.notice,
					content:  this.$lang.lang.create.idNotice,
					success: function (res) {
						if (res.confirm) {
							uni.navigateTo({
								url:"../auth/auth"
							})
						}else if(res.cancel){
							if(index==4){
								that.showBusNotice()
							}
						}
					}
				});
			},
			showBusNotice(){
				let that = this
				uni.showModal({
					title: this.$lang.lang.notices.notice,
					content:  this.$lang.lang.create.busNotice,
					confirmText:this.$lang.lang.notices.contactKf+'400-900-9962',
					success: function (res) {
						if (res.confirm) {
							uni.makePhoneCall({
								phoneNumber: '400-900-9962',
								success(){
									console.log('拨打成功了');
								},
								fail() {
									console.log('拨打失败了');
								}
							});
						}
					}
				});
			},
			//双清
			doubleClear: function(evt) {
				this.params.doubleClear = evt.detail.value
			},
			//单票立刻转运
			isSingleTicketTransport(e){
				this.params.isSingleTicketTransport = e.detail.value=='true'?true:false
			},
			//获取特性
			getProductAttrList(){
				this.$request.get('/app-api/ecw/product-attr/list').then(res => {
					if(res.code==0&&res.data){
						this.productAttrList = res.data
					}

				})
			},
			//获取商品名
			getproductData(){
				this.$request.get('/app-api/ecw/product/list',{auditStatus:2}).then(res => {
					if(res.code==0&&res.data&&res.data.length > 0){
						let d = res.data
						this.productData = res.data
						for(let i in d){
              this.config['product'].label.push(d[i][this.$lang.title])
              this.config['product'].value.push(d[i][this.$lang.title])
              this.config['product'].data.push(d[i])

              // this.config['productEn'].label.push(d[i].titleEn)
							// this.config['productEn'].value.push(d[i].titleEn)
							// this.config['productZh'].label.push(d[i].titleZh)
							// this.config['productZh'].value.push(d[i].titleZh)
							// this.config['productZh'].data.push(d[i])
						}
					}
				})
			},
      async getStartCity(){
        const res = await this.$request.get('/app-api/ecw/region/getTradeCityList', {type: 2})
        this.startCityList = res.data || []
      },
			//获取始发、目的城市
			getTradeCity(key){
				let that = this
				let type = key == 'tradeCity1' ? 2 : 1
				let param = {}
				param.type = type
				if(type==1&&this.params.channelId){
					that.config[key] = {
						index: 0,
						label: [this.$lang.lang.notices.please],
						value: [''],
					};
					param.channelId = this.params.channelId
				}

				that.$request.get('/app-api/ecw/region/getTradeCityList', param).then(res => {
					if(res.code==0&&res.data&&res.data.length > 0){
						let d = res.data
						for(let i in d){
							if(that.$lang.locale=='zh'){
								that.config[key].label.push(d[i].titleZh)
							}else{
								that.config[key].label.push(d[i].titleEn)
							}
							that.config[key].value.push(d[i].id)
						}
					}
				})
			},
			//获取出货渠道
			async getChanel(){
        /*this.config.channel = {
          index: 0,
          label: [this.$lang.lang.notices.please],
          value: [''],
        }*/

				let that = this
				let params={}
				if(that.params.objectiveId){
					params.cityId = that.params.objectiveId
				}
        if(that.currentDstCountryIndex !== null){
          params.countryId = this.dstCountryList[this.currentDstCountryIndex].guojia
        }
				const res = await that.$request.get('/app-api/ecw/channel/select',params)
        this.channelList = res.data || []
        /*
          .then(res => {
					if(res.code==0&&res.data&&res.data.length > 0){
						let d = res.data
						for(let i in d){
							if(that.$lang.locale=='zh'){
								that.config['channel'].label.push(d[i].nameZh||'')
							}else{
								that.config['channel'].label.push(d[i].nameEn||'')
							}
							that.config['channel'].value.push(d[i].channelId)
						}
					}
				})*/
			},
			//获取线路
			async getOpenedRouter () {
				let that = this
				let params = {}
				if(that.params.channelId){
					params.channelId = that.params.channelId
				}
				if(that.params.transportId){
					params.transportType = that.params.transportId
				}
				if(that.params.departureId){
					params.startCityId = that.params.departureId
				}
				if(that.params.objectiveId){
					params.destCityId = that.params.objectiveId
				}
        if(this.currentDstCountryIndex !== null){
          params.destCountryId = this.dstCountryList[this.currentDstCountryIndex].guojia
        }
				const res = await that.$request.post('/app-api/ecw/warehouse/openedRouterList', params)
        if(!res.data.length){
          return this.routerList = []
        }

        this.routerList = res.data.map(item => {
          item.showName = `${item[this.$lang.startTitle]} >> ${item[this.$lang.destTitle]}`
          return item
        })
        /*
          .then(res => {
					if(res.code==0&&res.data&&res.data.length > 0){
						let d = res.data
            this.routerList = res.data
						that.config.openedRouter={
							index: 0,
							label: [this.$lang.lang.notices.please],
							value: [''],
							otherService:[''],
							controlStatus:['']
						}
						for(let i in d){
							if(that.$lang.locale=='zh'){
								that.config.openedRouter.label.push(d[i].startTitleZh+'>>'+d[i].destTitleZh)
							}else{
								that.config.openedRouter.label.push(d[i].startTitleEn+'>>'+d[i].destTitleEn)
							}

							that.config.openedRouter.value.push(d[i].id)
							if(d[i].otherService){
								that.config.openedRouter.otherService.push(d[i].otherService)
							}else{
								that.config.openedRouter.otherService.push('')
							}
							that.config.openedRouter.controlStatus.push(d[i].controlStatus)
						}
						if(that.params.lineId){
							that.getConfigIndex('openedRouter',that.params.lineId)
							if(!that.params.transportId){
								that.getConfigIndex('transport',res.data[0].transportType)
							}
							if(!that.params.departureId){
								that.getConfigIndex('tradeCity1',res.data[that.config['openedRouter'].index-1].startCityId)
								that.params.departureId = that.config['tradeCity1'].value[that.config['tradeCity1'].index]
							}
							if(!that.params.objectiveId){
								that.getConfigIndex('tradeCity2',res.data[that.config['openedRouter'].index-1]?.destCityId)
								that.params.objectiveId = that.config['tradeCity2'].value[that.config['tradeCity2'].index]
							}
							that.currencyUnit = res.data[that.config['openedRouter'].index-1].currencyUnit
							var server = that.config['openedRouter'].otherService[that.config['openedRouter'].index]

							if(server.indexOf('1') > -1||server.indexOf('2') > -1){
								that.lineMethod = true
							}else{
								that.lineMethod = false
								that.params.type = ''
							}
							if(server.indexOf('1') > -1){
								that.items[0].show = true
							}else{
								that.items[0].show = false
							}
							if(server.indexOf('2') > -1){
								that.items[1].show = true
							}else{
								that.items[1].show = false
							}
							if(server.indexOf('3')>-1&&!that.params.isCargoControl){
								that.collectionShow = true
							}else{
								that.collectionShow = false
							}
							if(that.config['openedRouter'].controlStatus[that.config['openedRouter'].index]==1){
								that.params.isCargoControl = false
								that.controlLine = true
							}else{
								that.controlLine = false
							}
							that.config.harvestMethod = {
								index: 0,
								label: [],
								value: [],
							}
							that.orderConfig('harvest_method', 'harvestMethod')
						}
					}
				})*/


			},
			orderConfig (field, key) {
				let that = this
				that.$request.getConfig(field).then(res => {
					if(res.code==0&&res.data&&res.data.list.length > 0){
						let d = res.data.list
						if(key == 'packageType'){
							that.packageType = d
							for(let i in d){
								that.packageType[i].checked = false
							}
						}else{
							for(let i in d){
								if(key=='harvestMethod'){
									var server = that.config['openedRouter'].otherService[that.config['openedRouter'].index]
                  if (server.indexOf('2') > -1) {
                    that.config[key].label.push(d[i][that.$lang.label])
                    that.config[key].value.push(d[i].value)
                  } else {
                    if (i == 0) {
                      that.config[key].label.push(d[i][that.$lang.label])
                      that.config[key].value.push(d[i].value)
                    }
                  }
									if(server.indexOf('10') > -1){
										that.config[key].index = 1
										that.params.harvestMethod = 2
									}else{
										if(that.params.harvestMethod){
											that.getConfigIndex('harvestMethod',that.params.harvestMethod)
										}
									}

								}else{
                  that.config[key].label.push(d[i][that.$lang.label])
                  that.config[key].value.push(d[i].value)
								}

								if(key == 'transport'){
									that.config[key].cssClass.push(d[i].cssClass)
								}

							}
							if(key=='warehouseType'){
								that.config[key].index = 1
							}

						}
					}
				})
			},
			closePayNotice(){
				this.$refs.payNotice.close()
			},
			createOrder(){
				this.closePayNotice()
				if(this.orderId > 0 && !this.copy){
          // 订单id大于0,且不是复制订单,则调用编辑订单业务
					this.updateOrder()
				}else{
					this.creatOrder()
				}
			},
			getCurrenyName(id){
				var indexs = 0
				this.config.currencyType.value.forEach((item,index)=>{

					if(item == id){
						indexs = index
					}
				})
				return this.config.currencyType.label[indexs]
			},
			getOffData(){
				let that = this
				this.offerNumber = ''
				let offParams = {}
				if(that.params.lineId){
					offParams.lineId = that.params.lineId
				}
				if(that.params.channelId){
					offParams.channelId = that.params.channelId
				}
				if(that.params.consigneePhone){
					offParams.consigneeCode = that.params.countryCode?that.params.countryCode:that.config.countrySn.value[0]
					offParams.consigneePhone = that.params.consigneePhone
				}
				that.$request.get('/app-api/offer/select',offParams).then(res => {
					if(res.code==0&&res.data&&res.data.length > 0){
						that.config.offData ={
							index: 0,
							label: [],
							value: []
						}
						let d = res.data
						for(let i in d){
							that.config['offData'].label.push(d[i].number)
							that.config['offData'].value.push(d[i].offerId)
						}
					}
					if(!that.params.offerId&&that.orderId){
						that.getOfferNumber()
					}
					console.log(that.config['offData'])
				})
			},
			getOff(e) {
				if(e){
					let sindex = 0
					this.config.offData.label.forEach((item,index)=>{
						if(item == e){
							sindex = index
						}
					})
					this.offerNumber = e
					this.params.offerId = this.config.offData.value[sindex]
					this.config.offData.index = sindex
				}
			},
			getOfferNumber(){
				this.offerIdNoChange = false
				this.$request.get('/app-api/offer/check',{orderId:this.orderId}).then(res => {
					if(res.code==0&&res.data){
						this.getOff(res.data.number)
						this.offerIdNoChange = true
					}
				})
			},
      setCustomDrawee(val){
        this.$set(this.params, 'customDraweeVOList', val)
      },
      changeBillPrice(e){
        this.params.displayBillLadingPrice = e.detail.value == 1 ? true : false
      },
      async getHarvestMethod(){
        const res = await this.$request.getConfig("harvest_method")
        this.harvestList = res.data.list || []
      },
      async getDstCountryList(){
        const res = await this.$request.get("/app-api/ecw/warehouse/getGuojiaAndShiAndWarehouseList", {tradeType: 1})
        console.log("getDstCountryList", res)
        this.dstCountryList = res.data.guojiaList
        this.dstCityList = res.data.shiList
        this.filteredDstCityList = this.dstCityList
      },
      changeDstCountry(e){
        console.log("changeDstCountry", e)
        this.currentDstCountryIndex = e.detail.value
        // 重置目的城市
        this.currentDstCityIndex = null
        this.params.objectiveId = ''
        this.filteredDstCityList = this.dstCityList.filter(item => item.guojia == this.dstCountryList[this.currentDstCountryIndex].guojia)

        // 重置线路
        this.resetRoutes()
        this.getOpenedRouter()

        // 如果是空运则重置渠道
        this.resetChannelIfAir()
      },
      changeDstCity(e){
        this.currentDstCityIndex = e.detail.value
        this.params.objectiveId = this.filteredDstCityList[this.currentDstCityIndex].shi

        // 切换城市,路线要重置
        this.resetRoutes()
        this.getOpenedRouter()

        // 如果是空运则重置渠道
        this.resetChannelIfAir()
      },
      resetRoutes(){
        this.currentRouteIndex = null
        this.params.lineId = ''
      },
      // 如果是空运则重置渠道
      resetChannelIfAir(){
        if(this.currentTransportIndex === null){
          return
        }
        // 如果是空运则重置渠道
        if(this.transportList[this.currentTransportIndex].value == 3){
          this.params.channelId = ''
          this.getChanel()
        }
      },
      async getTransport(){
        const res = await this.$request.getConfig("transport_type")
        console.log("transport", res)
        this.transportList = res.data.list
      },
      changeTransport(e){
        console.log("changeTransport", e)
        this.currentTransportIndex = e.detail.value
        this.params.transportId = this.transportList[this.currentTransportIndex].value

        // 重置渠道
        this.currentChannelIndex = null
        this.params.channelId = ''
        // 空运则加载渠道
        if(this.params.transportId == 3){
          this.channeled = false
          this.getChanel()
        }else this.channeled = true

        // 重置并重新获取线路
        this.currentRouteIndex = null
        this.params.lineId = ''
        this.getOpenedRouter()
      },
      changeChannel(e){
        this.currentChannelIndex = e.detail.value
        this.params.channelId = this.channelList[this.currentChannelIndex].channelId

        // 如果未选择目的城市,则需要根据渠道回显目的国
        if(this.currentDstCityIndex === null){
          const countryId = this.channelList[this.currentChannelIndex].countryId
          const dstCountryIndex = this.dstCountryList.findIndex(item => item.guojia == countryId)
          if(dstCountryIndex > -1 && dstCountryIndex != this.currentDstCountryIndex){
            this.currentDstCountryIndex = dstCountryIndex
            this.params.objectiveId = ''
            this.filteredDstCityList = this.dstCityList.filter(item => item.guojia == this.dstCountryList[this.currentDstCountryIndex].guojia)

            // 重置城市和目的国之后需要重新加载路线
            this.resetRoutes()
            this.getOpenedRouter()
          }
        }
      },
      async changeRoute(e){
        this.currentRouteIndex = e.detail.value
        this.params.lineId = this.routerList[this.currentRouteIndex].id


        // 如果没有始发城市则回显
        if(this.currentStartCityIndex === null){
          const startCityIndex = this.startCityList.findIndex(item => item.id == this.routerList[this.currentRouteIndex].startCityId)
          if(startCityIndex > -1){
            this.currentStartCityIndex = startCityIndex
            this.params.departureId = this.startCityList[this.currentStartCityIndex].id
          }
        }

        // 如果没有目的城市则回显
        if(this.currentDstCityIndex === null){
          const currentCityIndex = this.filteredDstCityList.findIndex(item => item.shi == this.routerList[this.currentRouteIndex].destCityId)
          if(currentCityIndex > -1){
            this.currentDstCityIndex = currentCityIndex
            this.params.objectiveId = this.filteredDstCityList[this.currentDstCityIndex].shi

            const currentDstCountryIndex = this.dstCountryList.findIndex(item => item.guojia == this.filteredDstCityList[this.currentDstCityIndex].guojia)
            if(currentDstCountryIndex > -1 && currentDstCountryIndex != this.currentDstCountryIndex){
              this.currentDstCountryIndex = currentDstCountryIndex

              // 切换了目的国则需要更新渠道
              this.currentChannelIndex = null
              this.params.channelId = ''
              this.getChanel()
            }
          }
        }

        await this.$nextTick()

        const currentRoute = this.routerList[this.currentRouteIndex]
        const otherService = currentRoute.otherService?.split(",") || []
        // 如果不支持送货上门则设置为自提,2表示送货上门,10表示默认送货上门
        if(otherService.indexOf("2") == -1){
          this.params.harvestMethod = 1
          this.currentHarvestIndex = 0
        }
        // 支持送货上门,且默认送货上门
        if(otherService.indexOf("2") > -1 && otherService.indexOf("10") > -1){
          // value == 1 表示自提 2 表示送货上门
          this.currentHarvestIndex = this.enabledHarvestList.findIndex(item => item.value == 2)
          this.params.harvestMethod = 2
        }
      },
      changeStartCity(e){
        this.currentStartCityIndex = e.detail.value
        this.params.departureId = this.startCityList[this.currentStartCityIndex].id

        // 重置路线
        this.currentRouteIndex = null
        this.params.lineId = ''
        this.getOpenedRouter()
      },
      // 更换收货方式
      changeHarvestMethod(e){
        this.currentHarvestIndex = e.detail.value
        this.params.harvestMethod = this.harvestList[this.currentHarvestIndex].value
      },
      // 去掉唛头首尾空格
      trimMarks(){
        this.params.marks = this.params.marks.trim()
      }
		}
	}
</script>

<style>
	@import url("../../static/css/create_order.css");
  .corder-tab-top .title{
    border:none; width: auto; margin-right: 20rpx;
    padding-bottom: 0;
    display: flex !important;
  }
</style>
<style scoped>
.disabled{
  background: #ccc;
}
.corder-goods-v .action{
  justify-content: flex-end;
}
.corder-goods-v .action .icon{
  width: 20px;
  height: 20px;
}
.corder-goods-v .action .btn{
  background: #2A6cd9;
  padding: 3px 10rpx;
  color:#fff;
  border-radius: 5px;
  margin-left: 5px;
}
.over-sea-tips{
  color: red;
  padding: 0 20rpx;
}
</style>