DetailProd.vue 7.95 KB
Newer Older
dragondean@qq.com's avatar
dragondean@qq.com committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
<script>
import Decimal from 'decimal.js'
export default {
  name: 'DetailProd',
  props: {
    list: {
      type: Array,
      required: true
    },
    attrList: {
      type: Array,
      required: true
    }
  },
  computed:{
    // 显示特性
    showAttrText(){
      return ids => {
        if(!ids) return ''
        ids = !Array.isArray(ids) ? ids.split(',') : ids
        const attrMap = {}
        this.attrList.forEach(item => {
          attrMap[item.id] = this.$l(item, 'attrName')
        })
        return ids.map(id => attrMap[id]).join(',')
      }
    },
  },
  methods:{
    // 获取品名汇总数据
    getProdSummary(e){
      console.log("getProdSummart", e)
      // 货值
      let worth = new Decimal(0)
      // 填单数据
      let fillData = {
        num: new Decimal(0),
        weight: new Decimal(0),
        volume: new Decimal(0),
        quantity: new Decimal(0)
      }
      // 入仓数据
      let warehouseInData = {
        num: new Decimal(0),
        weight: new Decimal(0),
        volume: new Decimal(0),
        quantity: new Decimal(0)
      }
      // 收费数据
      let chargeData = {
        weight: new Decimal(0),
        volume: new Decimal(0),
      }
      this.list?.forEach(item => {
        worth = worth.plus(item.worth)
        fillData.num = fillData.num.plus(item.num)
        fillData.weight = fillData.weight.plus(item.weight)
        fillData.volume = fillData.volume.plus(item.volume)
        fillData.quantity = fillData.quantity.plus(item.quantity)
        if(item.warehouseInInfoVO){
          warehouseInData.num = warehouseInData.num.plus(item.cartonsNum)
          warehouseInData.weight = warehouseInData.weight.plus(item.weight)
          warehouseInData.volume = warehouseInData.volume.plus(item.volume)
          warehouseInData.quantity = warehouseInData.quantity.plus(item.quantityAll)
        }
        chargeData.weight = chargeData.weight.plus(item.chargeWeight)
        chargeData.volume = chargeData.volume.plus(item.chargeVolume)
      })
      const summary = Array(19).fill(null)
      summary[3] = this.$t("合计")
      // 入仓
      summary[4] = `${warehouseInData.num}${this.$t('')} ${warehouseInData.weight}KG ${warehouseInData.volume}${warehouseInData.quantity}${this.$t('')}`
      // 货值
      summary[7] = worth.toNumber()
      // 收费数九
      summary[10] = `${chargeData.weight}KG ${chargeData.volume}m³`
      // 填单数据
      summary[17] = `${fillData.num}${this.$t('')} ${fillData.weight}KG ${fillData.volume}${fillData.quantity}${this.$t('')}`
      return summary
    }
  }
}
</script>

<template>
  <el-table
    :data="list"
    border
    show-summary
    :summary-method="getProdSummary"
    style="width: 100%">
    <el-table-column :label="$t('序号')" width="90px">
      <template slot-scope="scope">{{scope.$index + 1}}</template>
    </el-table-column>
    <el-table-column prop="prodTitleZh" :label="$t('品名')">
      <template slot-scope="{row}">
        {{row.prodTitleZh}}/{{row.prodTitleEn}}
      </template>
    </el-table-column>
    <!--<el-table-column prop="prodTitleEn" :label="$t('品名')" />-->
    <el-table-column prop="brand" :label="$t('品牌')"  width="90px">
      <template slot-scope="{row}">
        <template v-if="row.brandName">{{row.brandName}}</template>
        <dict-tag v-else :type="DICT_TYPE.ECW_IS_BRAND" :value="row.brandType" />
      </template>
    </el-table-column>
    <el-table-column prop="brand" :label="$t('特性')"  width="90px">
      <template slot-scope="{row}">
        {{showAttrText(row.warehouseInInfoVO ? row.warehouseInProdAttrIds : row.prodAttrIds)}}
      </template>
    </el-table-column>
    <el-table-column prop="sumNum" :label="$t('入仓信息')"  width="90px">
      <template slot-scope="{row}">
        <!--<el-link type="primary" @click.native="showWarehouseLogs(row,1)">{{row.warehouseInInfoVO ? row.warehouseInInfoVO.cartonsNum : 0}}</el-link>
        <div v-if="row.warehouseInInfoVO && row.warehouseInInfoVO.isMultiSpecification">({{$t('多规格')}})</div>-->
        <div v-if="row.warehouseInInfoVO">
          {{row.warehouseInInfoVO.cartonsNum}}{{$t('')}}
          {{row.warehouseInInfoVO.weight}}Kg
          {{row.warehouseInInfoVO.volume}}
          {{row.warehouseInInfoVO.quantityAll}}{{$t('')}}
        </div>
      </template>
    </el-table-column>
    <el-table-column prop="warehouseType" :label="$t('类型')"  width="120px"/>
    <el-table-column prop="specificationType" :label="$t('包装')"  width="120px"/>
    <el-table-column prop="worth" :label="$t('货值')"  width="120px"/>
    <el-table-column prop="warehouseRecordRemark" :label="$t('入仓备注')"  width="120px"/>
    <el-table-column prop="TODO" :label="$t('快递单号')" />
    <el-table-column prop="sumNum" :label="$t('收费数据')"  width="90px">
      <template slot-scope="{row}">
        <div v-if="row.warehouseInInfoVO">
          {{row.chargeWeight}}Kg
          {{row.chargeVolume}}
        </div>
      </template>
    </el-table-column>
    <el-table-column prop="" :label="`${$t('费用类型')}/${$t('模式')}`">
      <template slot-scope="{row}">
        <dict-tag :type="DICT_TYPE.ECW_PAY_ADVANCE" :value="row.isPayAdvance" />
        <div v-if="row.charging ==0">{{ $t('运费/清关费') }}</div>
        <div v-if="row.charging ==1">{{ $t('全包价') }}</div>
      </template>
    </el-table-column>
    <el-table-column prop="" :label="$t('成交单价')"  width="220px">
      <template slot-scope="{row}">

        <template v-if="row.charging ==1">
          <template v-if="!row.originalSeaFreight">{{ $t('未报价') }}</template>
          <el-link type="primary" @click="showFeeDetail(row, 'clearance')" v-else>{{$t('全包价')}} {{row.oneSeaFreight}} {{currencyMap[row.seaFreightCurrency]}} / {{unitMap[row.seaFreightVolume]}}</el-link>
        </template>
        <template v-else-if="!row.originalSeaFreight && !row.originalClearanceFreight">{{ $t('未报价') }}</template>
        <template v-else>
          <el-link type="primary" @click="showFeeDetail(row, 'freight')">
            {{$t('运费')}}{{row.oneSeaFreight}} {{currencyMap[row.seaFreightCurrency]}} / {{unitMap[row.seaFreightVolume]}}
          </el-link>
          <el-link type="primary" @click="showFeeDetail(row, 'clearance')">
            {{$t('清关费')}}{{row.oneClearanceFreight}} {{currencyMap[row.clearanceFreightCurrency]}} / {{unitMap[row.clearanceFreightVolume]}}
          </el-link >
        </template>
      </template>
    </el-table-column>
    <el-table-column prop="" :label="$t('材质')">
      <template slot-scope="{row}">
        <dict-tag :type="DICT_TYPE.ECW_PRODUCT_MATERIAL" :value="row.material" />
      </template>
    </el-table-column>
    <el-table-column prop="" :label="$t('用途')">
      <template slot-scope="{row}">
        <div v-if="row.usageIds">
          <div v-for="(item,index) in row.usageIds.split(',')">
            <dict-tag :type="DICT_TYPE.OREER_ITEM_USAGE" :value="item" />
            <span v-if="(index+1)!=row.usageIds.split(',').length">,</span>
          </div>
        </div>
      </template>
    </el-table-column>
    <el-table-column prop="" :label="$t('储位')">
      <template slot-scope="{row}">
        <template v-if="row.warehouseInInfoVO">
          {{getLocationName(row.warehouseInInfoVO.orderLocationMergeVOSet)}}
        </template>
      </template>
    </el-table-column>
    <el-table-column prop="" :label="$t('商品链接')">
      <template slot-scope="{row}">
        <template v-if="row.link">
          <a target="_blank" :url="row.link">{{row.link}}</a>
        </template>
      </template>
    </el-table-column>
    <el-table-column prop="sumNum" :label="$t('填单信息')"  width="90px">
      <template slot-scope="{row}">
        {{row.num}}{{$t('')}}
        {{row.weight}}Kg
        {{row.volume}}
        {{row.quantity}}{{$t('')}}
      </template>
    </el-table-column>
    <el-table-column prop="expressNo" :label="$t('填单快递单号')" />
  </el-table>
</template>