orderDetailDialog.vue 4.07 KB
<template>
  <GLDialog v-if="dialogShow" bigTitle="详细信息" mode="big" :visible.sync="dialogShow" :close-on-click-modal="false" @onOk="dialogShow = false" @onCancel="dialogShow = 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">
        <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="table-class">
        <GLTable ref="purchaseOrderDetailTable" :tableParams="tableParams" @refreshTable="refreshTable" :tableData="detailInfo.tableData" :pageConf="pageConf" :tableTotal="detailInfo.tableTotal"></GLTable>
      </div>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" size="small" @click="dialogShow = false">关闭</el-button>
    </span>
  </GLDialog>
</template>

<script>
import { membraneTypeList } from '@/utils/constants.js'
export default {
  name: 'OrderDetailDialog',
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    paramsObj: {
      type: Object,
      default: () => {}
    }
  },
  computed: {
    dialogShow: {
      get() {
        if (this.visible) {
          this.getDetail({ currentPage: 1, pageSize: 20 })
        }
        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'
          },
          {
            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}件`
            }
          },
          {
            label: '采购总价/元',
            prop: 'goodsTotalPrice',
            formatter: cellValue => {
              return '¥' + cellValue.goodsTotalPrice
            }
          }
        ]
      },
      detailInfo: {}
    }
  },

  methods: {
    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>
.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;
  }
}
</style>