PackHistoryDetail.vue 16.6 KB
Newer Older
1
<template>
我在何方's avatar
我在何方 committed
2
  <div>
3 4 5 6 7 8 9
    <!-- 订单获取入仓记录 -->
    <el-dialog :title="title" visible :before-close="closeDialog" :close-on-click-modal="false" width="1200px">
        <el-card style="margin-bottom:10px">
          <el-descriptions :title="$t('入仓数据')" :column="3" :labelStyle="{width:'66px'}">
            <el-descriptions-item :label="$t('品名')">{{orderItem.prodTitleZh}}</el-descriptions-item>
            <el-descriptions-item :label="$t('英文品名')">{{orderItem.prodTitleEn}}</el-descriptions-item>
            <el-descriptions-item :label="$t('品牌')" >
10 11
                <template v-if="orderItem.brandName">{{orderItem.brandName}}</template>
                <dict-tag v-else :type="DICT_TYPE.ECW_IS_BRAND" :value="orderItem.brandType" />
12
            </el-descriptions-item>
我在何方's avatar
我在何方 committed
13
            <el-descriptions-item :label="$t('箱数')">{{(orderItem.warehouseInInfoVO ? orderItem.warehouseInInfoVO.cartonsNum : 0)+$t('箱')}}</el-descriptions-item>
14 15
            <el-descriptions-item :label="$t('体积')">{{orderItem.warehouseInInfoVO ? orderItem.warehouseInInfoVO.volume : orderItem.volume}}m³</el-descriptions-item>
            <el-descriptions-item :label="$t('重量')">{{orderItem.warehouseInInfoVO ? orderItem.warehouseInInfoVO.weight : orderItem.weight}}kg</el-descriptions-item>
我在何方's avatar
我在何方 committed
16
            <el-descriptions-item :label="$t('数量')">{{orderItem.warehouseInInfoVO ? orderItem.warehouseInInfoVO.quantityAll : orderItem.quantity}}{{$t('个')}}</el-descriptions-item>
17 18
            <el-descriptions-item :label="$t('备货状态')">{{airShipmentData[info.airShipment]}}</el-descriptions-item>
            <el-descriptions-item :label="$t('商品特性')">{{productAttr}}</el-descriptions-item>
我在何方's avatar
我在何方 committed
19 20
            <el-descriptions-item :label="$t('用途')">
              <div v-if="orderItem.usageIds">
我在何方's avatar
我在何方 committed
21
                  <div v-for="(item,index) in orderItem.usageIds.split(',')">
我在何方's avatar
我在何方 committed
22
                    <dict-tag :type="DICT_TYPE.OREER_ITEM_USAGE" :value="item" />
我在何方's avatar
我在何方 committed
23
                    <span v-if="(index+1)!=orderItem.usageIds.split(',').length">,</span>
我在何方's avatar
我在何方 committed
24 25 26
                  </div>
                </div>
              </el-descriptions-item>
27 28 29 30 31 32
          </el-descriptions>
        </el-card>
        <el-card style="margin-bottom:10px">
          <div slot="header" class="card-title">
            {{$t('打包前')}}
          </div>
我在何方's avatar
我在何方 committed
33
          <el-table v-if="orderWarehouseInContent" :data="orderWarehouseInContent.orderWarehouseInBackItemDoList">
34
            <el-table-column type="index" :label="$t('序号')" />
我在何方's avatar
我在何方 committed
35 36 37
            <el-table-column :label="$t('箱数')" prop="cartonsNum">
                <template slot-scope="{row}">
                  <span>{{row.cartonsNum}}</span>
38
                  <el-button v-if="row.orderWarehouseInDetailsVOList&&row.orderWarehouseInDetailsVOList.length>0" type="text" @click="seeBox(row.orderWarehouseInDetailsVOList)">({{$t('混箱')}})</el-button>
我在何方's avatar
我在何方 committed
39 40
                </template>
            </el-table-column>
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
            <el-table-column :label="$t('入仓类型')" prop="cartonsNum">
              <template slot-scope="{row}">
                <dict-tag :type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE" :value="row.specificationType" />
              </template>
            </el-table-column>
            <el-table-column :label="$t('包装类型')" prop="unit">
              <template slot-scope="{row}">
                <dict-tag :type="DICT_TYPE.ECW_PACKAGING_TYPE" :value="row.unit" />
              </template>
            </el-table-column>
            <el-table-column :label="$t('长')" prop="boxGauge">
              <template slot-scope="{row}">
                {{row.boxGauge.split('*')[0]}}
              </template>
            </el-table-column>
            <el-table-column :label="$t('宽')" prop="boxGauge" >
              <template slot-scope="{row}">
                {{row.boxGauge.split('*')[1]}}
              </template>
            </el-table-column>
            <el-table-column :label="$t('高')" prop="boxGauge" >
              <template slot-scope="{row}">
                {{row.boxGauge.split('*')[2]}}
              </template>
            </el-table-column>
            <el-table-column :label="$t('体积') + '(m³)'" prop="volume" />
            <el-table-column :label="$t('重量') + '(kg)'" prop="weight" />
            <el-table-column :label="$t('数量(个)')" prop="quantityAll" />
            <el-table-column :label="$t('入仓快递单号')" prop="expressNo" />
我在何方's avatar
我在何方 committed
70
            <el-table-column :label="$t('入仓时间')" prop="inTime" min-width="150">
71 72 73 74 75 76 77
              <template slot-scope="{row}">{{row.inTime|parseTime}}</template>
            </el-table-column>
            <el-table-column :label="$t('储位')" prop="orderLocationBackVOList" >
              <template slot-scope="{row}">
                {{getLocationName(row.orderLocationBackVOList)}}
              </template>
            </el-table-column>
78
<!--            <el-table-column :label="$t('入仓影像')" prop="orderLocationBackVOList" >
我在何方's avatar
我在何方 committed
79
              <template slot-scope="{row}">
我在何方's avatar
我在何方 committed
80
               <el-button type="primary" @click="seeMv(orderWarehouseInContent.pictureUrls)">{{$t('查看')}}</el-button>
我在何方's avatar
我在何方 committed
81
              </template>
82
            </el-table-column> -->
83
          </el-table>
84 85 86 87
          <div  style="margin:20px 0;font-size:16px;font-weight:600">
            {{$t('打包前入仓影像')}}
          </div>
          <image-and-video-upload v-if="orderWarehouseInContent.pictureUrls" readonly :fileSize="50" :isShowTip="true" :value="orderWarehouseInContent.pictureUrls" ></image-and-video-upload>
88 89 90 91 92 93 94
      </el-card>
      <el-card style="margin-bottom:10px">
          <div slot="header" class="card-title">
            {{$t('打包后')}}
          </div>
          <el-table v-if="warehouseItem && warehouseItem.orderWarehouseInBackItemDoList" :data="warehouseItem.orderWarehouseInBackItemDoList">
            <el-table-column type="index" :label="$t('序号')" />
我在何方's avatar
我在何方 committed
95 96 97
            <el-table-column :label="$t('箱数')" prop="cartonsNum">
            <template slot-scope="{row}">
                  <span>{{row.cartonsNum}}</span>
我在何方's avatar
我在何方 committed
98
                  <el-button v-if="row.orderWarehouseInDetailsVOList&&row.orderWarehouseInDetailsVOList.length>0" type="text" @click="seeBox(row.orderWarehouseInDetailsVOList)">({{$t('混箱')}})</el-button>
我在何方's avatar
我在何方 committed
99 100
                </template>
            </el-table-column>
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
            <el-table-column :label="$t('入仓类型')" prop="cartonsNum">
              <template slot-scope="{row}">
                <dict-tag :type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE" :value="row.specificationType" />
              </template>
            </el-table-column>
            <el-table-column :label="$t('包装类型')" prop="unit">
              <template slot-scope="{row}">
                <dict-tag :type="DICT_TYPE.ECW_PACKAGING_TYPE" :value="row.unit" />
              </template>
            </el-table-column>
            <el-table-column :label="$t('长')" prop="boxGauge">
              <template slot-scope="{row}">
                {{row.boxGauge.split('*')[0]}}
              </template>
            </el-table-column>
            <el-table-column :label="$t('宽')" prop="boxGauge" >
              <template slot-scope="{row}">
                {{row.boxGauge.split('*')[1]}}
              </template>
            </el-table-column>
            <el-table-column :label="$t('高')" prop="boxGauge" >
              <template slot-scope="{row}">
                {{row.boxGauge.split('*')[2]}}
              </template>
            </el-table-column>
            <el-table-column :label="$t('体积') + '(m³)'" prop="volume" />
            <el-table-column :label="$t('重量') + '(kg)'" prop="weight" />
            <el-table-column :label="$t('数量(个)')" prop="quantityAll" />
            <el-table-column :label="$t('入仓快递单号')" prop="expressNo" />
我在何方's avatar
我在何方 committed
130
            <el-table-column :label="$t('入仓时间')" prop="inTime" min-width="150">
131 132 133 134 135 136 137
              <template slot-scope="{row}">{{row.inTime|parseTime}}</template>
            </el-table-column>
            <el-table-column :label="$t('储位')" prop="orderLocationBackVOList" >
              <template slot-scope="{row}">
                {{getLocationName(row.orderLocationBackVOList)}}
              </template>
            </el-table-column>
138
 <!--           <el-table-column :label="$t('入仓影像')" prop="orderLocationBackVOList" >
我在何方's avatar
我在何方 committed
139
              <template slot-scope="{row}">
我在何方's avatar
我在何方 committed
140
                <el-button type="primary" @click="seeMv(warehouseItem.pictureUrls)">{{$t('查看')}}</el-button>
我在何方's avatar
我在何方 committed
141
              </template>
142
            </el-table-column> -->
143
          </el-table>
144 145 146 147
          <div  style="margin:20px 0;font-size:16px;font-weight:600">
             {{$t('打包后入仓影像')}}
          </div>
          <image-and-video-upload v-if="warehouseItem.pictureUrls" readonly :fileSize="50" :isShowTip="true" :value="warehouseItem.pictureUrls" ></image-and-video-upload>
148 149 150 151
      </el-card>
      <el-card style="margin-bottom:10px">
        <el-descriptions :title="$t('打包数据')" :column="2" :labelStyle="{width:'120px'}">
          <el-descriptions-item :label="$t('打包后箱数')">{{packData.cartonsNum+$t('箱')}}</el-descriptions-item>
我在何方's avatar
我在何方 committed
152 153
          <el-descriptions-item :label="$t('打包后体积')">{{packData.volume.toFixed(2)}}m³</el-descriptions-item>
          <el-descriptions-item :label="$t('打包后重量')">{{packData.weight.toFixed(2)}}kg</el-descriptions-item>
154 155 156 157 158 159
          <el-descriptions-item :label="$t('打包后数量(个)')" >{{packData.quantityAll}}</el-descriptions-item>
          <el-descriptions-item :label="$t('打包人')">{{packAfterData.creatorName}}</el-descriptions-item>
          <el-descriptions-item :label="$t('打包时间')">{{packAfterData.createTime|parseTime}}</el-descriptions-item>
        </el-descriptions>
      </el-card>
      <el-button type="primary" @click="closeDialog">{{$t('关闭窗口')}}</el-button>
我在何方's avatar
我在何方 committed
160 161

    </el-dialog>
162 163
    <el-dialog :title="$t('入仓影像')" :visible.sync="mvShow" :before-close="closeMv" :close-on-click-modal="false">
<!--      <div style="display:flex;flex-wrap:wrap">
我在何方's avatar
我在何方 committed
164
        <div v-for="(item, index) in pictureUrls" :index="index" :key="index" style="width:80px;height:80px">
我在何方's avatar
我在何方 committed
165
            <img v-if="item.type === 'image'" :src="item.url" mode="scaleToFill" style="height: 100%" @tap="previewImage(item.url)" />
我在何方's avatar
我在何方 committed
166 167 168 169 170
            <video v-else-if="item.type === 'video'" :id="`video_${index}`" style="width: 100%;height: 100%" :src="item.url" @play="playVideo(index)" @tap="playVideo(index)" @fullscreenchange="fullscreenchange"></video>
        </div>
      </div>
      <div v-if="pictureUrls.length==0">
        <span>{{$t('暂无影像')}}</span>
171 172
      </div> -->
      <image-and-video-upload readonly :fileSize="50" :isShowTip="true" :value="pictureUrls" ></image-and-video-upload>
173
    </el-dialog>
我在何方's avatar
我在何方 committed
174
    <el-dialog :title="$t('箱明细')" :visible.sync="boxShow" :before-close="closeBox" :close-on-click-modal="false" width="800px">
我在何方's avatar
我在何方 committed
175
       <el-form>
我在何方's avatar
我在何方 committed
176 177 178 179 180 181
        <WarehouseRecordDetailItem
            v-for="(item, index) in boxData"
            :key="index" v-model="boxData[index]"
            :index="index" :attr-list="attrList"
            :readonly="true"
        />
我在何方's avatar
我在何方 committed
182
        </el-form>
我在何方's avatar
我在何方 committed
183
    </el-dialog>
我在何方's avatar
我在何方 committed
184
    </div>
185 186 187 188 189 190 191
</template>
<script>
import { getOrder, getOrderWarehouseIn } from '@/api/ecw/order'
import { DICT_TYPE } from '@/utils/dict'
import { parseTime } from '@/utils/ruoyi'
import WarehouseAreaSelect from "@/components/WarehouseAreaSelect"
import {getProductAttrList} from '@/api/ecw/productAttr'
192
import ImageAndVideoUpload from '@/components/ImageAndVideoUpload'
我在何方's avatar
我在何方 committed
193
import WarehouseRecordDetailItem from "@/views/ecw/order/warehousing/components/WarehouseRecordDetailItem.vue";
194 195
export default {
  components: {
196
    WarehouseAreaSelect,WarehouseRecordDetailItem,ImageAndVideoUpload
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
  },
    filters: {parseTime},
    props:{
        order: Object, // order 和 orderId 二选一
        packAfterData: Object,
        orderItemId: Number,
    },
    data(){
        return {
            orderDetail: null,
            warehouseList: null,
            productAttrList:[],  // 商品属性
            airShipmentData:['默认值','待出','可出','备货中','已备货'],
            packData:{
              cartonsNum:0,
              volume:0,
              weight:0,
              quantityAll:0
我在何方's avatar
我在何方 committed
215 216
            },
            pictureUrls:[],
我在何方's avatar
我在何方 committed
217 218 219 220 221
            mvShow:false,
            boxShow:false,
            // 特性列表
            attrList: [],
            boxData: []
222 223
        }
    },
我在何方's avatar
我在何方 committed
224

225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
    computed:{
      info(){
        return this.orderDetail || this.order
      },
      orderItem(){
        if(!this.info) return null
        return this.info.orderItemVOList.find(item => item.orderItemId == this.orderItemId)
      },
      warehouseItem(){
        if(!this.warehouseList) return []
        return this.warehouseList.find(item => item.orderItemId == this.orderItemId) || []
      },
      title(){
        if(!this.orderItem) return '-'
        return this.$l(this.orderItem, 'prodTitle') + ' - ' + this.$t('入仓记录')
      },
      orderWarehouseInContent(){
        if(!this.packAfterData) return []
        return JSON.parse(this.packAfterData.orderWarehouseInContent)
      },
      productAttr(){
246 247 248 249 250
        if(this.productAttrList.length==0||!this.orderItem.warehouseInProdAttrIds) return ''
        let data = []
          // 要拆分成数组再用indexOf,字符串直接indexOf会有问题,"12,3".indexOf('1') > -1 为true
        let warehouseInProdAttrIds = this.orderItem.warehouseInProdAttrIds.split(',')
          console.log({warehouseInProdAttrIds})
251
        this.productAttrList.forEach(item=>{
252
          if(warehouseInProdAttrIds.indexOf(`${item.id}`)>-1){
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
            data.push(this.$l(item, 'attrName'))
          }
        })
        return data.join(',')
      },
    },

    async created(){
        this.show = true
        if(!this.order && this.orderId){
          getOrder(this.orderId).then(res => {
            this.orderDetail = res.data
          })
        }
        this.getOrderWarehouseIn()
        this.productAttrList = (await getProductAttrList()).data
我在何方's avatar
我在何方 committed
269
        this.getAttrList()
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298
    },
    methods:{
      // 获取储位名称
      getLocationName(locationArr){
        if(!locationArr || !locationArr.length) return ''
        let arr = []
        locationArr.forEach(item => {
          arr.push(`${item.areaName}${item.locationName || ''}`)
        })
        return Array.from(new Set(arr)).join(",")
      },
        closeDialog(){
            this.show = false
            this.$emit('close');
        },
        getOrderWarehouseIn(){
          getOrderWarehouseIn(this.info.orderId).then(res => {
            this.warehouseList = res.data
            var warehouseItem = this.warehouseList.find(item => item.orderItemId == this.orderItemId)
            if(warehouseItem&&warehouseItem.orderWarehouseInBackItemDoList!=null){
              warehouseItem.orderWarehouseInBackItemDoList.forEach(item=>{
                if(item.volume) this.packData.volume += parseFloat(item.volume)
                if(item.weight) this.packData.weight += parseFloat(item.weight)
                if(item.cartonsNum) this.packData.cartonsNum += parseInt(item.cartonsNum)
                if(item.quantityAll) this.packData.quantityAll += parseInt(item.quantityAll)
              })
            }
          })
        },
我在何方's avatar
我在何方 committed
299 300 301
        seeMv(list){
          this.mvShow=true
          if(list){
302
            this.pictureUrls = list
我在何方's avatar
我在何方 committed
303 304
          }else{
            this.pictureUrls = []
我在何方's avatar
我在何方 committed
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322
          }

        },
        isImageFile(filename) {
          var imageExtensions = [".jpeg", ".jpg", ".png", ".gif", ".bmp", ".tiff"];
          var extension = "";
          var length = filename.length;
          for (var i = length - 1; i >= 0; i--) {
            if (filename[i] === ".") {
              extension = filename.slice(i).toLowerCase();
              break;
            }
          }

          return imageExtensions.indexOf(extension) !== -1;
        },
        closeMv(){
          this.mvShow = false
我在何方's avatar
我在何方 committed
323 324 325 326 327 328
        },
        closeBox(){
          this.boxData = []
          this.boxShow = false
        },
        seeBox(data){
我在何方's avatar
我在何方 committed
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343
          data.forEach(e => {
            let bg = {}
            if (e.boxGauge) {
              const boxGauge = e.boxGauge.split('*')
              // e.boxGauge1 = boxGauge[0]
              // e.boxGauge2 = boxGauge[1]
              // e.boxGauge3 = boxGauge[2]
              bg = {
                boxGauge1: boxGauge[0],
                boxGauge2: boxGauge[1],
                boxGauge3: boxGauge[2]
              }
            }
            this.boxData.push({...e, ...bg})
          })
我在何方's avatar
我在何方 committed
344 345 346 347 348 349 350 351
          this.boxShow = true
        },
        /** 获取产品属性列表 */
        getAttrList() {
          getProductAttrList().then(response => {
            this.attrList = response.data;
          })
        },
352 353 354 355
    }
}
</script>