<template>
  <div class="app-container">
        <el-card>
            <div slot="header" class="card-title">{{$t('报价单详情')}}</div>
          <!-- 列表 -->
          <div class="offer-header">
              <span style="font-size: 15px;">{{$t('报价单号')}}：{{list.number}}</span>
              <div class="btns">
            <el-button size="mini" type="primary"  @click="$router.push('edit?id=' + offerId)">{{$t('编辑')}}</el-button>
                <el-button type="primary" size="mini" @click="handleAdd"
                >{{$t('跟进')}}</el-button>
                <el-button type="primary" size="mini" @click="toResult"
                >{{$t('结果')}}</el-button>
                <el-button size="mini" type="primary" @click="$router.push('/offer/special/' + offerId)">{{$t('特价')}}</el-button>
                <el-button type="danger" size="mini" @click="handleDelete"
                >{{$t('删除')}}</el-button>
              </div>
          </div>
          <div>
            <div class="title-font">
              <label>{{$t('报价单所属')}}：{{list.relation?list.relation==1?$t('发货人'):$t('收货人'):$t('发货人')}}</label>
            </div>
                <el-descriptions :column="3" border class="card">
                    <el-descriptions-item :label="$t('发货人:')">
                        {{consignorData.contactsName||$t('无')}}
                    </el-descriptions-item>
                    <el-descriptions-item :label="$t('手机号:')">
                      {{consignorData?(checkCode(consignorData.areaCode)+consignorData.phoneNew)||$t('无'):$t('无')}}
                    </el-descriptions-item>
                    <el-descriptions-item :label="$t('联系地址:')">
                      {{consignorData.address||$t('无')}}
                    </el-descriptions-item>
                    <el-descriptions-item :label="$t('客户来源:')">
                          {{consignorData.source||$t('无')}}
                    </el-descriptions-item>
                    <el-descriptions-item :label="$t('发货人公司名称:')">
                      {{consignorData.company||$t('无')}}
                    </el-descriptions-item>
                    <el-descriptions-item :label="$t('社交软件:')">
                       {{consignorData.social||$t('无')+' '+consignorData.socialNumber||''}}
                    </el-descriptions-item>
                </el-descriptions>

               <el-descriptions :column="3" border class="card">
                   <el-descriptions-item :label="$t('收货人:')">
                    {{consigneeData.contactsName||$t('无')}}
                    </el-descriptions-item>
                    <el-descriptions-item :label="$t('手机号:')">
                      {{consigneeData?(checkCode(consigneeData.areaCode)+consigneeData.phoneNew)||$t('无'):$t('无')}}
                    </el-descriptions-item>
                    <el-descriptions-item :label="$t('联系地址:')">
                      {{consigneeData.address||$t('无')}}
                    </el-descriptions-item>
                    <el-descriptions-item :label="$t('客户来源:')">
                          {{consigneeData.source||$t('无')}}
                    </el-descriptions-item>
                    <el-descriptions-item :label="$t('发货人公司名称:')">
                      {{consigneeData.company||$t('无')}}
                    </el-descriptions-item>
                    <el-descriptions-item :label="$t('社交软件:')">
                       {{consigneeData.social||$t('无')+' '+consigneeData.socialNumber||''}}
                    </el-descriptions-item>
               </el-descriptions>
                <el-descriptions :column="4" class="card">
                    <el-descriptions-item :label="$t('运输方式')">
                         <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="list.transportId" />
                    </el-descriptions-item>
                    <el-descriptions-item :label="$t('出货渠道')" v-if="[3,4].indexOf(list.transportId) > -1">
                      {{channelName}}
                    </el-descriptions-item>
                 </el-descriptions>
                 <el-descriptions :column="4" class="card">
                     <el-descriptions-item :label="$t('始发城市')">
                        {{getCity(list.departureId)}}
                     </el-descriptions-item>
                     <el-descriptions-item :label="$t('目的城市')">
                        {{getCity(list.objectiveId)}}
                     </el-descriptions-item>
                  </el-descriptions>
                <el-descriptions :column="4" class="card">
                    <el-descriptions-item :label="$t('线路')">
                      {{getRouterNameById(list.lineId)}}
                    </el-descriptions-item>
                 </el-descriptions>
          </div>
        </el-card>

        <el-card class="card">
          <div slot="header" class="card-title">{{$t('商品信息')}}</div>
          <div style="overflow: auto;">
          <el-table v-loading="loading" border :data="list.offerProdRespVOList">
                <el-table-column :label="$t('序号')" width="60px" fixed>
                  <template slot-scope="scope">
                      {{scope.$index + 1}}
                  </template>
                </el-table-column>
<!--                <el-table-column :label="商品类型" align="center" prop="goodsType" /> -->
                <el-table-column :label="$t('中文品名')" align="center" prop="prodTitleZh" />
                <el-table-column :label="$t('英文品名')" align="center" prop="prodTitleEn" />
                <el-table-column :label="$t('品牌')" width="100px">
                  <template slot-scope="scope">
                      <dict-tag :value="scope.row.brand" :type="DICT_TYPE.ECW_IS_BRAND" defaultable />
                  </template>
                </el-table-column>
                <el-table-column :label="$t('件数')" width="90px" prop="num" />
                <el-table-column :label="$t('包装单位')">
                  <template slot-scope="scope">
                      <dict-tag :value="scope.row.unit" :type="DICT_TYPE.ECW_PACKAGE_TYPE" defaultable />
                  </template>
                </el-table-column>
                <el-table-column :label="$t('箱规(m)')" width="120px" prop="boxGauge" />
                <el-table-column :label="$t('体积(m³)')" width="100px" prop="volume" />
                <el-table-column :label="$t('重量(kg)')" width="100px" prop="weight" />
                <el-table-column :label="$t('货值(RMB)')" width="100px" prop="worth" />
                <el-table-column :label="$t('商品特性')" width="200px" prop="prodAttrName" />
                 <el-table-column :label="$t('是否预付')">
                   <template slot-scope="scope">
                      {{scope.row.isPayAdvance==1?$t('预付'):$t('到付')}}
                   </template>
                 </el-table-column>

                <el-table-column :label="$t('运费')" width="200px">
                  <template slot-scope="{row}">
                    <template v-if="row.charging ==1">
                      <template v-if="!row.seaFreight">未报价</template>
                      <template>{{$t('全包价')}} {{row.oneSeaFreight}} {{currentcyMap[row.seaFreightCurrency]}} / {{unitMap[row.seaFreightVolume]}}</template>
                    </template>
                    <template v-else-if="!row.seaFreight && !row.clearanceFreight">未报价</template>
                    <template v-else>
                      <div>
                          {{$t('运费')}}：{{row.oneSeaFreight}} {{currentcyMap[row.seaFreightCurrency]}} / {{unitMap[row.seaFreightVolume]}}
                      </div>
                      <div>
                          {{$t('清关费')}}：{{row.oneClearanceFreight}} {{currentcyMap[row.clearanceFreightCurrency]}} / {{unitMap[row.clearanceFreightVolume]}}
                      </div>
                    </template>
                  </template>
                </el-table-column>
              </el-table>
              </div>
        </el-card>
        <el-card class="card">
          <div slot="header" class="card-title">{{$t('费用小计')}}</div>
            <el-descriptions border class="card" :column="5">
              <el-descriptions-item :label="$t('总件数:')">
                  {{list.estCostVO?list.estCostVO.totalNum||'0':0}}
              </el-descriptions-item>
              <el-descriptions-item :label="$t('总体积:')">
                {{list.estCostVO?(list.estCostVO.totalVolume+'m³')||'0':0}}
              </el-descriptions-item>
              <el-descriptions-item :label="$t('总重量:')">
                {{list.estCostVO?(list.estCostVO.totalWeight+'kg')||'0':0}}
              </el-descriptions-item>
              <el-descriptions-item :label="$t('总数量:')">
                {{list.estCostVO?list.estCostVO.totalQuantity||'0':0}}
              </el-descriptions-item>
              <el-descriptions-item :label="$t('总货值(RMB):')">
                  {{list.estCostVO?list.estCostVO.totalWorth||'0':0}}
              </el-descriptions-item>
<!--              <el-descriptions-item :label="报价费：">
                {{list.estCostVO?list.estCostVO.insuranceFee||'0':0}}
              </el-descriptions-item> -->
          </el-descriptions>
<!--          <el-descriptions border class="card">
            <el-descriptions-item :label="佣金类型" :span="2" class="card">
                <dict-selector :type="DICT_TYPE.COMMISSION_TYPE" form-type="radio" fomtter="number"  :value="list.commissionType" defaultable />
            </el-descriptions-item>
          </el-descriptions> -->
        </el-card>
        <el-card class="mt-10">
            <div class="card-title" slot="header">{{$t('预计费用')}}</div>

            <el-descriptions :column="5" border>
                <el-descriptions-item :label="$t('保价费')">
                    {{list.estCostVO?list.estCostVO.insuranceFee: 0}} {{$t('美元')}}
                </el-descriptions-item>
                <el-descriptions-item :label="$t('总运费')">
                    <template v-for="item in clearanceFeeList">
                        <div :key="item.currencyId">{{item.amount || 0}}{{currentcyMap[item.currencyId]}}</div>
                    </template>
                </el-descriptions-item>
                <!--代收货款，只有非控货订单、并且线路开通了代收货款后，才显示是否代收货款选项-->
                <el-descriptions-item :label="$t('总清关费')">
                    <template v-for="item in freightFeeList">
                        <div :key="item.currencyId">{{item.amount || 0}}{{currentcyMap[item.currencyId]}}</div>
                    </template>
                </el-descriptions-item>
                <el-descriptions-item :label="$t('其他费用')">
                   <template v-for="item in otherFeeList">
                       <div :key="item.currencyId">{{item.amount || 0}}{{currentcyMap[item.currencyId]}}</div>
                   </template>
                </el-descriptions-item>
                <el-descriptions-item :label="$t('原价')" :span="2">
                    <template v-for="item in originalFeeList">
                        <div :key="item.currencyId">{{item.amount || 0}}{{currentcyMap[item.currencyId]}}</div>
                    </template>
                </el-descriptions-item>
            </el-descriptions>


            <div class="card-title" style="padding:20px 0;">{{$t('优惠信息')}}</div>
            <el-table :data="couponList" :show-header="false">
                <el-table-column label="">
                    <template slot-scope="scope">
                        {{scope.$index+1}}.
                        <dict-tag :type="DICT_TYPE.ECW_COUPON_TYPE" :value="scope.row.type" />
<!--                        {{$l(productNames[scope.row.prodId], 'title') || $t('未知')}} -->
                    </template>
                </el-table-column>
                <el-table-column label="">
                    <template slot-scope="{row}">
                        {{$l(row, 'title')}}
                    </template>
                </el-table-column>
                <el-table-column label="">
                    <template slot-scope="{row}">
                        -{{row.reduceAmount}}
                        {{currentcyMap[row.reduceCurrencyId]}}
                    </template>
                </el-table-column>
                <el-table-column label="">
                    <template slot-scope="{row}">
                        {{$t('有效期至')}}：{{row.endTime ? row.endTime : $t('永久有效')}}
                    </template>
                </el-table-column>
            </el-table>

            <el-descriptions :column="1" class="mt-20">
                <el-descriptions-item :label="$t('优惠费用')"  v-if="couponTotalAmountList && couponTotalAmountList.length">
                    <div v-for="(item, discountIndex) in couponTotalAmountList" :key="discountIndex">
                        {{item.totalAmount}} {{currentcyMap[item.currencyId]}}
                    </div>
                </el-descriptions-item>
                <el-descriptions-item :label="$t('预计费用')">
                    <template >
                        <div v-for="item in estimatedCosts" :key="item.currencyId">{{item.amount || 0}}{{currentcyMap[item.currencyId]}}</div>
                    </template>
                </el-descriptions-item>
            </el-descriptions>
        </el-card>
        <el-card class="card">
          <div slot="header" class="card-title">{{$t('通用信息')}}</div>
            <el-descriptions :column="4">
              <el-descriptions-item :label="$t('唛头')">
                  {{list.marks||'/'}}
              </el-descriptions-item>
              <el-descriptions-item :label="$t('报关方式')">
                  <dict-tag :type="DICT_TYPE.ECW_CUSTOMS_TYPE" :value="list.customsType"></dict-tag>
              </el-descriptions-item>
              </el-descriptions>
            <el-descriptions :column="4">
             <el-descriptions-item :label="$t('预计结束时间')">
                  {{list.stopTime||'/'}}
              </el-descriptions-item>
              <el-descriptions-item :label="$t('控货')">
                   {{list.control?$t('是'):$t('否')}}
               </el-descriptions-item>
               <el-descriptions-item :label="$t('竞争对手')">
                  {{list.competitor||'/'}}
                </el-descriptions-item>
                <el-descriptions-item :label="$t('重要程度')">
                    <el-rate v-model="list.importance"></el-rate>
                 </el-descriptions-item>
          </el-descriptions>
          <el-descriptions :column="4">
             <el-descriptions-item :label="$t('价格有效期')">
                 {{list.startTime+$t('至')}}{{list.endTime}}
              </el-descriptions-item>
              <el-descriptions-item :label="$t('交货方式')">
                <dict-tag :type="DICT_TYPE.ECW_TRADE_TYPE" :value="list.tradeType"></dict-tag>
                   <span style="margin-left: 10px;">{{list.tradeAdress}}</span>
               </el-descriptions-item>
          </el-descriptions>
          <el-descriptions >
              <el-descriptions-item :label="$t('备注')">
                   {{list.remarks||'/'}}
               </el-descriptions-item>
          </el-descriptions>
        </el-card>
        <el-card class="card" v-if='list.transportVO'>
          <div slot="header" class="card-title">
            <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="list.transportId"></dict-tag>
          </div>
          <div class="line">
            <el-descriptions>
                <el-descriptions-item :label="[3,4].indexOf(list.transportId)>-1?$t('空运路线'):$t('海运路线')">
                    {{getRouterNameById(list.lineId)||'/'}}
                </el-descriptions-item>
            </el-descriptions>
            <el-descriptions v-if="[3,4].indexOf(list.transportId) > -1">
               <el-descriptions-item :label="$t('出货渠道')">
                   {{channelName||'/'}}
                </el-descriptions-item>
            </el-descriptions>
          </div>
          <el-descriptions class="card" v-if="[2,3,4].indexOf(list.transportId) > -1">
              <el-descriptions-item :label="$t('是否双清')">
                  <dict-tag :type="DICT_TYPE.ECW_DOUBLE_CLEAR" :value="list.transportVO.doubleClear"></dict-tag>
              </el-descriptions-item>
          </el-descriptions>
          <el-descriptions v-if="[3,4].indexOf(list.transportId) > -1">
              <el-descriptions-item :label="$t('航空公司')">
                 {{getSupplierData(list.transportVO.airlineCompany)||'/'}}
              </el-descriptions-item>
          </el-descriptions>
          <el-descriptions v-if="list.transportId==2">
              <el-descriptions-item :label="$t('船公司')">
                 {{getSupplierData(list.transportVO.shippingCompany)||'/'}}
              </el-descriptions-item>
          </el-descriptions>
          <el-descriptions v-if="[2,3,4].indexOf(list.transportId) > -1">
              <el-descriptions-item :label="$t('清关证书')">
                 <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="list.transportVO.customsClearCert"></dict-tag>
              </el-descriptions-item>
          </el-descriptions>
          <el-descriptions v-if="[2,3,4].indexOf(list.transportId) > -1">
              <el-descriptions-item :label="$t('清关证书备注')">
                 {{list.transportVO.remarks||'/'}}
              </el-descriptions-item>
          </el-descriptions>
          <el-descriptions class="card" v-if="[3,4].indexOf(list.transportId) > -1">
              <el-descriptions-item :label="$t('是否拆包')">
                 <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="list.transportVO.isUnpack"></dict-tag>
              </el-descriptions-item>
          </el-descriptions>
          <el-descriptions v-if="[3,4].indexOf(list.transportId) > -1">
              <el-descriptions-item :label="$t('单票立刻转运')">
                <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="list.transportVO.isSingleTicketTransport"></dict-tag>

                   <span style="margin-left:10px;color: #0000FF;">{{$t('注：若只有一件，货到仓库立即发，选“是”，多件需仓库集运待发，选“否”')}}</span>
              </el-descriptions-item>

          </el-descriptions>
          <el-descriptions>
              <el-descriptions-item :label="$t('特殊要求')">
                 <dict-selector  form-type="checkbox"  :type="DICT_TYPE.ORDER_SPECIAL_NEEDS" multiple  v-model="list.transportVO.packageType" :disabled="true" />
              </el-descriptions-item>
          </el-descriptions>
          <el-descriptions>
              <el-descriptions-item :label="$t('特殊要求备注')">
                {{list.transportVO.packageRemarks||'/'}}
              </el-descriptions-item>
          </el-descriptions>
        </el-card>

  </div>
</template>

<script>
  import {DICT_TYPE,getDictDatas} from  '@/utils/dict'
  import {getOffer,deleteOffer} from '@/api/ecw/offer'
  import {getProductAttrList} from '@/api/ecw/productAttr'
  import {getCustomerList,getCustomer} from '@/api/ecw/customer'
   import {getChannelList,getChannel} from '@/api/ecw/channel'
   import {getTradeCityList} from '@/api/ecw/region'
   import {getUnitList} from '@/api/ecw/unit'
   import { getOrder } from '@/api/ecw/order'
   import {getCurrencyList} from '@/api/ecw/currency'
   import {getCustomerContactsSelect} from '@/api/ecw/customerContacts'
   import {openedRouterList as getOpenedRouterList} from '@/api/ecw/warehouse'
   import {calculationPrice} from '@/api/ecw/product'
   import {getSupplier, getSupplierPage} from '@/api/ecw/supplier'
  export default {
    name: "detail",
    data() {
      return {
        // 遮罩层
        loading: false,
        list: [],
        types:'package,bag',
        importance:1,
        productAttrList:[],
        offerId:0,
        //发货/收货人信息
        consigneeData:{},
        routerList:[],
        channelName:'/',
        tradeCityList:[],
        productNames: {},
        currencyList:[],
        unitList:[],
        orderData:[],
        consignorData:{},
        customerSource: getDictDatas(DICT_TYPE.CUSTOMER_SOURCE),
        couponAvailableGroupDtoList: [], // 可用优惠
        couponTotalAmountList: [], // 优惠总额
      };
    },
    computed:{
      currentcyMap(){
          let map = {}
          this.currencyList.forEach(item => {
              map[item.id] = item.titleZh
          })
          return map
      },
      unitMap(){
          let map = {}
          this.unitList.forEach(item => {
              map[item.id] = item.titleZh
          })
          return map
      },
      // 总有优惠金额
      couponList(){
          let arr = []
          this.couponAvailableGroupDtoList.forEach(item => {
              if(item.couponAvailableDtoList && item.couponAvailableDtoList.length){
                  // 只取第一个
                  let it = item.couponAvailableDtoList[0]
                  arr.push({
                          prodId: item.prodId,
                          type: it.type,
                          titleZh: it.titleZh,
                          titleEn: it.titleEn,
                          endTime: it.endTime,
                          reduceAmount: it.reduceAmount,
                          reduceCurrencyId: it.reduceCurrencyId
                })
              }
          })
          return arr
      },
      // 计算返回的费用清单
      feeDtoList(){
          if(this.list&&this.list.estCostVO){
            return this.list.estCostVO.feeDtoList || []
          }else{
            return []
          }
      },
      // 清关费
      clearanceFeeList(){
          return this.feeDtoList.filter(item => item.feeType == 2)
      },
      // 运费
      freightFeeList(){
          return this.feeDtoList.filter(item => item.feeType == 1)
      },
      // 其他费用
      otherFeeList(){
          return this.feeDtoList.filter(item => item.feeType == 1)
      },
      // 原价（清关费 + 运费）
      originalFeeList(){
          let arr = []
          this.clearanceFeeList.forEach(item => {
              let it = {...item}
              let freight = this.freightFeeList.find(fee => fee.currencyId == item.currencyId)
              if(freight){
                  it.amount += freight.amount
              }
              arr.push(it)
          })
          return arr
      },
      // 预计费用(原价 - 优惠金额)
      estimatedCosts(){
          let arr = []
          this.originalFeeList.forEach(item => {
              let it = {...item}
              let coupon = this.couponList.find(coupon => coupon.reduceCurrencyId == item.currencyId)
              if(coupon){
                  it.amount -= coupon.reduceAmount
              }
              arr.push(it)
          })
          return arr
      },
    },
    created() {
      getCurrencyList().then(res => this.currencyList = res.data)
      getUnitList().then(res => this.unitList = res.data)
      getTradeCityList().then(res => this.tradeCityList = res.data)
      getProductAttrList().then(res => this.productAttrList = res.data)
      if(this.$route.query.offerId){
        this.offerId = this.$route.query.offerId
        this.getList();
      }
    },
    methods: {
      sourceLabel(data){
        let label=''
        var source = this.customerSource.find(item=>item.value==data)
        if(source) label = source.label
        return label
      },
      checkCode(data){
        if(!data){
          return ''
        }
        if(data.indexOf('+')==-1){
        	return '+'+data
        }
        return data
      },
      getOrderData(id) {
        let that = this
        that.loading = true;
        // 执行查询
        getOrder(id).then(response => {
          that.orderDat = response.data;
        });
      },
      getSupplierData(id){
        var labelname = ''
        if(id){
          getSupplier(id).then(res=>{
            if(res.data){
              labelname =  res.data.companyZh
            }
          })
        }
        return labelname
      },
      // 计算商品运费
      calculationPrice(){
          calculationPrice({
              lineId: this.list.lineId,
              transportId: this.list.transportId,
              channelId: this.list.channelId,
              prodConditionParamList: this.list.offerProdRespVOList,
              consigneeCustomerContactsId: this.list.consigneeCustomerContactsId,
              consignorCustomerContactsId: this.list.consignorCustomerContactsId,
              customsType: this.list.customsType,
              isCargoControl: this.list.control,
              orderType: this.list.orderType,
          }).then(res => {
              this.$set(this, 'couponTotalAmountList', res.data.availableDto.couponTotalAmountList)
              this.$set(this, 'couponAvailableGroupDtoList', res.data.availableDto.couponAvailableGroupDtoList)
          }).finally(() => {
              this.calculating = false
          })
      },
      /** 查询列表 */
      getList() {
        let that = this
        that.loading = true;
        // 执行查询
        getOffer(that.offerId).then(response => {
          that.list = response.data;
          if(that.list.channelId){
            that.getChannelData()
          }
          that.calculationPrice()
          if(that.list.orderId){
            that.getOrderData(that.list.orderId)
          }
          getCustomerContactsSelect({ids: [that.list.consignorId, that.list.consigneeId].join(',')}).then((res) => {
               let consignor = res.data.list.find(item => item.customerContactsId == that.list.consignorId)
               if(consignor) that.consignorData=consignor
               let consignee = res.data.list.find(item => item.customerContactsId == that.list.consigneeId)
               if(consignee) that.consigneeData=consignee
               that.getCnsigneeData()
          })
          that.list.offerProdRespVOList.forEach((item)=>{
            var arr = item.prodAttrIds.split(',')
            var prodAttrName = []
            arr.forEach((itemValue)=>{
                 var prodAttrCenter = this.productAttrList.filter(items=>items.id==itemValue)
                 if(prodAttrCenter.length>0){
                   prodAttrName.push(prodAttrCenter[0].attrName)
                 }
            })
            if(prodAttrName.length>1){
              item.prodAttrName = prodAttrName.join(',')
            }else if(prodAttrName.length==1){
              item.prodAttrName = prodAttrName[0]
            }else{
              item.prodAttrName = ''
            }
          })

          that.loading = false;

          that.getOpenedRouterList()
        });
      },
      getCity(id){
        var city = ''
        this.tradeCityList.forEach((item)=>{
          if(item.id == id){
            city = item.titleZh
          }
        })
        return city
      },
      getChannelData(){
        getChannel(this.list.channelId).then(res=>{
          this.channelName = res.data.nameZh
        })
      },
      // 获取路线
      getOpenedRouterList(){
          let params = {}
          if(this.list.departureId){
              params.startCityId = this.list.departureId
          }
          if(this.list.objectiveId){
              params.destCityId = this.list.objectiveId
          }
          getOpenedRouterList(params).then(res => this.routerList = res.data)
      },
      // 根据线路id显示线路名称
      getRouterNameById(routerId){
            let router = this.routerList.find(item => item.id == routerId)
            if(router){
                return router.startTitleZh + ' >>>' + router.destTitleZh
            }
            return '-'
      },
      // 获取发货/收货人
      getCnsigneeData(){
        let that = this
         if(that.consigneeData&&that.consigneeData.customerId){
            getCustomer(that.consigneeData.customerId).then(result=>{
                result.data.source = this.sourceLabel(result.data.source)
                that.$set(that.consigneeData,'source',result.data.source)
                that.$set(that.consigneeData,'address',result.data.address)

            })
        }
        if(that.consignorData&&that.consignorData.customerId){
            getCustomer(that.consignorData.customerId).then(ress=>{
              ress.data.source = this.sourceLabel(ress.data.source)
                that.$set(that.consignorData,'source',ress.data.source)
                that.$set(that.consignorData,'address',ress.data.address)
            })
          }
      },
      /** 跟进按钮操作 */
      handleAdd() {
        this.$router.push({
          path: "/offer/logList",
          query:{
            offerId:this.offerId,
            relationId:this.list.consignorId
          }
        });
      },
      toResult(){
        this.$router.push({
          path: "/offer/result",
          query:{
            offerId:this.offerId,
            number:this.list.number
          }
        });
      },
      /** 删除按钮操作 */
      handleDelete() {
        const offerId = this.offerId;
        this.$modal.confirm(this.$t('是否确认删除报价单管理编号为')+'"' + offerId + '"'+this.$t('的数据项')+'?').then(function() {
            return deleteOffer(offerId);
          }).then(() => {
            this.$router.push({
              path: "/offer/result"
            });
            this.$modal.msgSuccess(this.$t("删除成功"));
          }).catch(() => {});
      },
    }
  };
</script>

<style scoped>
  .card-title{
      font-size: 18px;
      font-weight: bold;
       margin-top: 10px;
  }
  .offer-header{
    padding-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .line{
    display: flex;
    align-items: center;
  }
  .line el-descriptions{
    flex: 1;
  }
  .btn{
    width: 60%;
    display: flex;
    align-items: center;
    justify-content: space-around;
  }
  .title-font{
    font-size: 16px;
    font-weight: 600;
    margin-top: 20px;
  }
  .title-font label{
    margin-right: 20px;
  }
  .card{
    margin-top: 20px;
  }
</style>
