orderDetailDialog.vue 11.7 KB
<template>
  <GLDialog v-if="dialogShow" bigTitle="详细信息" mode="big" :visible.sync="dialogShow" :close-on-click-modal="false" @onOk="dialogShow = false" @onCancel="dialogShow = false" :hasFooter="false">
    <div class="detail-content" v-if="dialogShow">
      <div class="addressTitle">
        <img src="@/images/addressIcon.webp" alt="" class="icon" />
        <span class="title">{{ paramsObj.merchantName }}</span>
      </div>
      <div class="address-info" v-if="paramsObj.purchaseType == 1">
        <span class="name">
          收货人:
          <span class="label">{{ detailInfo.contactName }}</span>
        </span>
        <span class="phone">
          电话:
          <span class="label">{{ detailInfo.contactPhone }}</span>
        </span>
        <span class="address">
          收货地址:
          <span class="label">{{ detailInfo.provinceName }}{{ detailInfo.cityName }}{{ detailInfo.areaName }}{{ detailInfo.contactAddress }}</span>
        </span>
        <span class="address" v-if="detailInfo.purchaseOrderRemark">
          备注:
          <span class="label">{{ detailInfo.purchaseOrderRemark }}</span>
        </span>
        <span class="address" v-if="detailInfo.rejectCause">
          驳回原因:
          <span class="label">{{ detailInfo.rejectCause }}</span>
        </span>
      </div>
      <div class="table-class">
        <GLTable ref="purchaseOrderDetailTable" :tableParams="tableParams" @refreshTable="refreshTable" :tableData="detailInfo.tableData" :pageConf="pageConf" :tableTotal="detailInfo.tableTotal">
          <template slot="film" slot-scope="scope">
            <el-tooltip v-if="scope.scope.filmRollList && scope.scope.filmRollList.length > 1" placement="top">
              <div class="film-txt">(...{{ scope.scope.filmRollList.length }})</div>
              <div slot="content">
                <div class="tool-title">膜卷号</div>
                <div v-for="(item, index) in scope.scope.filmRollList" :key="index">{{ item }}</div>
              </div>
            </el-tooltip>
            <div v-else-if="scope.scope.filmRollList && scope.scope.filmRollList.length == 1">{{ scope.scope.filmRollList[0] }}</div>
            <div v-else>--</div>
          </template>
          <template slot="upgradeGoodsName" slot-scope="scope">
            <div>
              <img v-if="scope.scope.refundStatus == 'Y'" class="return" src="@/assets/retrun.png" alt="" />
              <span>{{ scope.scope.upgradeGoodsName }}</span>
            </div>
          </template>
          <template slot="carName" slot-scope="scope">
            <el-tooltip v-if="scope.scope.suitCarTypeList && scope.scope.suitCarTypeList.length" placement="top">
              <div slot="content" class="car-type-list">
                <div v-for="(item, index) in scope.scope.suitCarTypeList" :key="index">{{ `${item.brandName}-${item.childName}-${item.seriesName}-${item.carTypeName}` }}</div>
              </div>
              <div>{{ scope.scope.suitCarTypeList | formatCar }}</div>
            </el-tooltip>
            <div v-else>--</div>
          </template>
          <template slot="isAllocateHtml" slot-scope="scope">
            <el-checkbox :checked="scope.scope.isAllocate === 1" disabled />
          </template>
        </GLTable>
      </div>
    </div>
  </GLDialog>
</template>

<script>
import { membraneTypeList, goodsTypeList } from '@/utils/constants.js'
export default {
  name: 'OrderDetailDialog',
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    paramsObj: {
      type: Object,
      default: () => {}
    }
  },
  filters: {
    formatCar(list) {
      console.log(list, 'list')
      let str = list
        .map(item => {
          return `${item.brandName}-${item.childName}-${item.seriesName}-${item.carTypeName}`
        })
        .join(',')
      return str.length > 15 ? str.substring(0, 15) + '...' : str
    }
  },
  computed: {
    dialogShow: {
      get() {
        if (this.visible) {
          this.getDetail({ currentPage: 1, pageSize: 10 })
        }
        return this.visible
      },
      set(val) {
        this.$emit('update:visible', val)
      }
    }
  },
  data() {
    return {
      pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'list',
        tableColumns: [
          {
            label: '产品名称',
            prop: 'upgradeGoodsName',
            addHtml: 'upgradeGoodsName',
            width: 120,
            line: 1
          },
          {
            label: '产品ID',
            prop: 'upgradeGoodsCommodityCode',
            width: 150,
            formatter: cellValue => cellValue.upgradeGoodsCommodityCode || '-'
          },
          {
            label: '供应商名称',
            prop: 'thirdPartyName',
            width: 110
          },
          {
            label: '产品编码',
            prop: 'type',
            width: 100
          },

          {
            label: '规格',
            prop: 'specificationData',
            width: 100
          },
          {
            label: '适用车型',
            prop: 'carName',
            addHtml: 'carName',
            width: 200
          },
          {
            label: '系列',
            prop: 'goodsName',
            width: 150,
            line: 1
          },
          {
            label: '产品别名',
            prop: 'purchaseGoodsName',
            width: 100
          },
          {
            label: '所属分类',
            prop: 'goodsTypeName',
            width: 150
          },
          {
            label: '采购数量',
            prop: 'goodsNumber',
            formatter: cellValue => {
              // 商品来源 1-商城采购 2-自采入库
              let list = this.paramsObj.purchaseType == 1 ? membraneTypeList : goodsTypeList
              let attr = this.paramsObj.purchaseType == 1 ? 'goodsType' : 'goodsTypeName'
              let condition = list.includes(cellValue[attr]) ? `${cellValue.goodsNumber}卷` : `${cellValue.goodsNumber}件`
              return condition
            },
            width: 100
          },
          {
            label: '是否转调拨',
            prop: 'isAllocate',
            addHtml: 'isAllocateHtml',
            width: 200
          },
          {
            label: '调入方门店',
            prop: 'callInMerchantName',
            width: 200
          },
          {
            label: '调入方仓库',
            prop: 'callInYqMerchantName',
            width: 200
          },
          {
            label: '调出方门店',
            prop: 'callOutMerchantName',
            width: 200
          },
          {
            label: '调出方仓库',
            prop: 'callOutYqMerchantName',
            width: 200
          },
          {
            label: '膜卷号',
            prop: 'filmRollList',
            addHtml: 'film',
            width: 100
          },
          {
            label: '库存总量',
            prop: 'goodsTypeName',
            formatter: cellValue => {
              // 商品来源 1-商城采购 2-自采入库
              let list = this.paramsObj.purchaseType == 1 ? membraneTypeList : goodsTypeList
              let attr = this.paramsObj.purchaseType == 1 ? 'goodsType' : 'goodsTypeName'
              let unit = list.includes(cellValue[attr]) ? '米' : '件'
              // let condition = list.includes(cellValue[attr]) ? `${cellValue.conversionValue ? cellValue.goodsNumber * cellValue.conversionValue : '-'}米` : `${cellValue.goodsNumber}件`
              let condition = (cellValue.conversionValue ? cellValue.goodsNumber * cellValue.conversionValue : cellValue.goodsNumber) + unit
              return condition
            },
            width: 100
          },
          {
            label: '采购总价/元',
            prop: 'goodsTotalPrice',
            formatter: cellValue => {
              return '¥' + cellValue.goodsTotalPrice
            },
            width: 120
          },
          {
            label: '备注',
            prop: 'remark',
            width: 150
          }
        ]
      },
      detailInfo: {}
    }
  },
  created() {
    this.dynamicParams()
    console.log(this.paramsObj, 'paramsObj')
    // 不是商城采购过滤掉车型和备注
    if (this.paramsObj.purchaseType != 1) {
      this.tableParams.tableColumns = this.tableParams.tableColumns.filter(item => {
        return item.prop !== 'carName' && item.prop !== 'remark'
      })
      // console.log(this.tableParams.tableColumns, ' this.tableParams.tableColumns ')
    }
  },
  methods: {
    dynamicParams() {
      if (this.paramsObj.purchaseType == 1) {
        let idx = this.tableParams.tableColumns.findIndex(item => item.label == '膜卷号')
        this.tableParams.tableColumns.splice(idx, 1)
        this.tableParams.tableColumns.push(
          {
            label: '已发货数量',
            prop: 'purchaseNumber',
            width: 110,
            line: 1,
            formatter: cellValue => {
              return membraneTypeList.includes(cellValue.goodsType) ? `${cellValue.purchaseNumber}卷` : `${cellValue.purchaseNumber}件`
            }
          },
          {
            label: '已入库数量',
            prop: 'inputNumber',
            width: 110,
            line: 1,
            formatter: cellValue => {
              return membraneTypeList.includes(cellValue.goodsType) ? `${cellValue.inputNumber}米` : `${cellValue.inputNumber}件`
            }
          }
        )
      } else {
        this.tableParams.tableColumns.push(
          {
            label: '入库仓库',
            prop: 'putYqMerchantName',
            width: 100,
            line: 1
          },
          {
            label: '入库门店',
            prop: 'putMerchantName',
            width: 100,
            line: 1
          }
        )
      }
    },
    handleDetailClose() {
      this.dialogShow = false
    },
    refreshTable(pageObj) {
      this.getDetail(pageObj)
    },
    getDetail(pageObj) {
      this.$apis.purchaseShopping.purchaseOrderDetail({ orderCode: this.paramsObj.orderCode, pageSize: pageObj.pageSize, currentPage: pageObj.currentPage }).then(res => {
        this.detailInfo = res
        this.detailInfo.tableData = res.pagination.list
        this.detailInfo.tableTotal = res.pagination.total
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.car-type-list {
  max-height: 300px;
  overflow-y: scroll;
}

.return {
  width: 15px;
  height: 14px;
}

.addressTitle {
  display: flex;
  align-items: center;

  .title {
    font-family: PingFangSC-Medium;
    font-weight: 600;
    font-size: 16px;
    color: #333333;
  }

  .icon {
    width: 28px;
    height: 28px;
    margin-right: 8px;
  }
}

.address-info {
  display: flex;
  box-sizing: border-box;
  align-items: center;
  // justify-content: space-between;
  flex-wrap: wrap;
  width: 100%;
  // height: 36px;
  padding: 0 20px;
  margin-top: 10px;
  font-size: 14px;
  color: #666666;

  > span {
    margin-right: 20px;
    margin-bottom: 10px;
  }

  .label {
    color: #333333;
  }

  .address {
    min-width: 500px;
  }
}

.film-txt {
  font-size: 14px;
  color: #5850ff;
  cursor: pointer;
}

.tool-title {
  font-weight: 500 !important;
  font-size: 12px;
  color: #3a3a3a;
  margin-bottom: 4px;
}
</style>
<style>
.el-tooltip__popper.is-light {
  background: #ffffff;
  border: 1px solid #e5e5e5 !important;
  box-shadow: 0 8px 20px 0 #00000033;
  width: 177px;
  box-sizing: border-box;
  font-size: 12px;
  color: #666666;
  line-height: 18px;
}

.el-tooltip__popper[x-placement^='top'] .popper__arrow {
  border-color: #e4e7ed !important;
}

.el-tooltip__popper[x-placement^='top'] .popper__arrow:after {
  border-bottom-color: #e4e7ed !important;
}
</style>