orderDetailDialog.vue 12.2 KB
<template>
  <baseDialog :is-show.sync="dialogShow" :config="dialogConfig.setting" :dialog-config="dialogConfig.config"
              @closeDialog="handleDetailClose">
    <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">
        <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.contactAddress }}</span></span>
      </div>
      <div class="address-info"
           v-if="detailInfo.purchaseOrderRemark">
        <span class="address">备注:<span class="label">{{ detailInfo.purchaseOrderRemark }}</span></span>
      </div>
      <div class="address-info"
           v-if="detailInfo.terminateDeliveryInstruction">
        <span class="address">结束发货说明:<span class="label">{{ detailInfo.terminateDeliveryInstruction }}</span></span>
      </div>
      <div class="table-class">
        <d2-table ref="purchaseOrderDetailTable" :table-params="tableParams" @refreshTable="refreshTable"
                  :table-data="detailInfo.tableData" :table-total="detailInfo.tableTotal">
          <template slot="filmRollNo" slot-scope="scope">
            <div v-if="scope.scope.filmRollList && scope.scope.filmRollList.length == 1">
              {{ scope.scope.filmRollList[0] }}
            </div>
            <div v-else-if="scope.scope.filmRollList && scope.scope.filmRollList.length > 1">
              <el-popover placement="top"
                          width="200"
                          trigger="hover">
                <div class="film-roll-box">
                  <div class="title">膜卷号</div>
                  <div class="merchant-item" v-for="(subItem, subIndex) in scope.scope.filmRollList" :key="subIndex">
                    {{ subItem }}
                  </div>
                </div>
                <div slot="reference">
                  <!-- <img style="width: 14px;height: 13px;" src="./images/merchant_icon.png"> -->
                  <span style="color: #2A58AD;">(…{{ scope.scope.filmRollList.length }})</span>
                </div>
              </el-popover>
            </div>
            <div v-else>
              <span style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{ '-' }}</span>
            </div>
          </template>
        </d2-table>
      </div>
      <div class="examine-record" v-if="detailInfo.auditDetaiList && !paramsObj.factoryType">
        <div class="title">审核记录</div>
        <div class="record-div">
          <div class="record-div-d" v-for="(item, index) in detailInfo.auditDetaiList" :key="index">
            <span class="dot"></span>
            <span class="span-txt-one">{{ item.status ? $$(statusForShow, [item.status], 'text') : '' }}</span><span
              class="span-txt-two">
              <span :class="item.status ? examineStatusClass[item.status] : ''">
                {{ item.status ? $$(statusForShow, [item.status], 'status') : '' }}</span>
            </span>
            <span class="span-txt-two">审核人:{{ item.reviewedBy }}</span>
            <span class="span-txt-two">审核时间:{{ item.reviewedDateFormat }}</span>
            <span  v-if="item.remark" class="span-txt-two">备注:
                <el-tooltip class="item" popper-class="remark-popper-class" effect="dark" :content="item.remark" placement="right">
                  <el-button type="text">
                    {{ item.remark ? (item.remark.length > 15 ? (item.remark.slice(0, 15) + '...') : item.remark) : '' }}
                  </el-button>
                </el-tooltip>
            </span>
            <span class="span-txt-two" v-if="[4, 6, 7].includes(item.status)">驳回原因:{{ item.rejectCause }}</span>
          </div>
          <!-- <div class="record-div-d"><span class="dot"></span><span
                  class="span-txt-one">运营审核</span><span class="span-txt-two">通过</span><span
                  class="span-txt-two">审核人:赵丽颖</span><span class="span-txt-two">审核时间:2023/04/18
              16:12:10</span>
          </div>
          <div class="record-div-d"><span class="dot"></span><span
                  class="span-txt-one">运营审核</span><span class="span-txt-two">通过</span><span
                  class="span-txt-two">审核人:赵丽颖</span><span class="span-txt-two">审核时间:2023/04/18
              16:12:10</span>
          </div> -->
        </div>
      </div>
    </div>
  </baseDialog>
</template>

<script>
import { purchaseOrderDetail, operatorreviewView } from '@/api/purchaseShopping.js'
import { baseConfig } from '@/main'
import { Util, deepClone } from '@/common/util'
export default {
  name: 'OrderDetailDialog',
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    paramsObj: {
      type: Object,
      default: {}
    },
    showFilmRollNo: Boolean // 是否显示膜卷号
  },
  computed: {
    dialogShow: {
      get() {
        if (this.visible) {
          this.getDetail({ currentPage: 1, pageSize: 10 })
        }
        return this.visible
      },
      set(val) {
        this.$emit('update:visible', val)
      }
    }
  },
  mounted() {
    this.dynamicParams()
    // this.getDetail()
  },
  data() {
    return {
      dialogConfig: {
        setting: {
          showClose: true,
          appendToBody: false,
          btnList: [
          ]
        },
        config: {
          title: '详细信息',
          width: '1080px'
        }
      },
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'list',
        tableColumns: [
          {
            label: '商品名称',
            prop: 'upgradeGoodsName'
          },
          {
            label: '商品编码',
            prop: 'type'

          },
          {
            label: '规格',
            prop: 'specificationData'

          },
          {
            label: '系列',
            prop: 'goodsName'
          },
          {
            label: '所属分类',
            prop: 'goodsTypeName'

          },
          {
            label: '采购数量',
            prop: 'goodsNumber',
            formatter: (cellValue) => {
              // return membraneTypeList.includes(cellValue.goodsType) ? `${cellValue.goodsNumber}卷/${cellValue.conversionValue ? cellValue.goodsNumber * cellValue.conversionValue : '-'}米` : `${cellValue.goodsNumber}件`
              const condition = baseConfig.membraneTypeList.includes(cellValue.goodsType) ? `${cellValue.goodsNumber}卷` : `${cellValue.goodsNumber}件`
              return this.paramsObj.purchaseType == 1 ? condition : `${cellValue.goodsNumber}件`
            }
          },
          {
            label: '库存总量',
            prop: 'goodsTypeName',
            formatter: cellValue => {
              const condition = baseConfig.membraneTypeList.includes(cellValue.goodsType) ? `${cellValue.conversionValue ? cellValue.goodsNumber * cellValue.conversionValue : '-'}米` : `${cellValue.goodsNumber}件`
              return this.paramsObj.purchaseType == 1 ? condition : `${cellValue.goodsNumber}件`
            }
          },
          {
            label: '采购总价/元',
            prop: 'goodsTotalPrice',
            formatter: (cellValue) => {
              return "¥" + cellValue.goodsTotalPrice
            }
          }
        ]
      },
      detailInfo: {},
      examineStatusClass: {
        2: 'greenSp',
        4: 'redSp',
        5: 'greenSp',
        6: 'redSp',
        7: 'redSp'
      },
      examineStatus: 1,
      statusForShow: {
        2: { text: '运营审核', status: '通过' },
        4: { text: '运营审核', status: '驳回' },
        5: { text: '商务审核', status: '通过' },
        6: { text: '商务审核', status: '驳回' },
        7: { text: '采购驳回', status: '驳回' }
      }
    }
  },
  methods: {
    dynamicParams() {
      console.log(this.paramsObj.purchaseType)

      if (this.paramsObj.purchaseType == 1) {
        this.tableParams.tableColumns.push(
          {
            label: '已发货数量',
            prop: 'purchaseNumber',
            width: 110,
            formatter: cellValue => {
              return baseConfig.membraneTypeList.includes(cellValue.goodsType) ? `${cellValue.purchaseNumber}卷` : `${cellValue.purchaseNumber}件`
            }
          },
          {
            label: '已入库数量',
            prop: 'inputNumber',
            width: 110,
            formatter: cellValue => {
              return baseConfig.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
          }
        )
      }
      if (this.paramsObj.factoryType) {
        this.tableParams.tableColumns = this.tableParams.tableColumns.filter(item => item.prop != 'goodsTotalPrice')
      }
      // 采购订单-自采入库显示膜卷号
      if (this.showFilmRollNo) {
        this.tableParams.tableColumns.splice(5, 0, { label: '膜卷号', prop: 'filmRollNo', type: 'slot', addHtml: 'filmRollNo' })
      }
    },

    handleDetailClose() {
      this.dialogShow = false
    },
    refreshTable(pageObj) {
      this.getDetail(pageObj)
    },
    getDetail(pageObj) {
      // purchaseOrderDetail({ orderCode: this.paramsObj.orderCode, pageSize: pageObj.pageSize, currentPage: pageObj.currentPage }).then(res => {
      operatorreviewView({ 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
        let _auditDetaiList = this.detailInfo.auditDetaiList
        if (_auditDetaiList && _auditDetaiList.length > 0) {
          _auditDetaiList = _auditDetaiList.map(item => {
            item.reviewedDateFormat = item.reviewedDate
              ? Util.dateFormate(item.reviewedDate, 'YYYY-MM-DD HH:mm:ss')
              : ""
            return item
          })
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.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-roll-box{
  font-size: 12px;
  color: #666666;
  .title{
    font-weight: 500;
    color: #3A3A3A;
    margin-bottom: 8px;
  }
}

.examine-record {
  width: 968px;
  min-height: 157px;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  margin-top: 23px;

  .title {
    margin: 16px 20px;
    width: 64px;
    height: 22px;
    font-family: PingFangSC-Medium;
    font-weight: 600;
    font-size: 16px;
    color: #333333;
    text-align: center;
  }

  .dot {
    width: 6px;
    height: 6px;
    background: #185efe;
    border-radius: 6px;
    display: inline-block;
  }

  .record-div {
    margin: 16px 20px;
    font-family: PingFangSC-Regular;
    font-weight: 400;
    font-size: 14px;
    color: #666666;
    letter-spacing: 0;

    .record-div-d {
      margin-top: 10px;
    }

    .span-txt-one {
      margin-left: 14px;
      width: 203px;
      height: 21px;
    }

    .span-txt-two {
      margin-left: 40px;
    }

    .greenSp {
      color: #4aca74;
    }

    .redSp {
      color: #eb4e4e;
    }
  }
}
</style>