detailDialog.vue 5.16 KB
<!-- 退货详情弹窗弹窗 -->
<template>
  <GLDialog bigTitle="详细信息" width="1500px" :visible.sync="detailVisible" :hasFooter="false" :before-close="handleClose" class="detailDailog" mode="big" okText="关闭" @onCancel="handleClose" @onOk="handleClose">
    <div>
      <div>
        单据状态:
        <span :class="refundClassName()" />
        {{ (baseData.refundStatusList.find(item => item.confId == recordInfo.refundStatus)||{}).confLabel || '-' }}
      </div>
      <div class="header" slot="header" style="padding: 10px 20px">
        <!-- <GLCombiForm ref="showSearch"
                   class="show-search"
                   :search-form="searchForm"
                   :search-select-obj="searchSelectObj"
                   :form-data="showFormData"></GLCombiForm> -->
      </div>
      <div class="d2-container-content">
        <GLTable ref="recordTable" :getListApi="getListApi" :searchForm="searchFormSearch" :tableParams="tableParams" :beforeSearchFn="beforeSearchFn">
          <template slot="profitAndLoss" slot-scope="scope">
            <span v-if="scope.scope.profitAndLoss || scope.scope.profitAndLoss == 0">
              <span v-if="parseFloat(scope.scope.profitAndLoss) > 0" style="color: blue">{{ '+' + parseFloat(scope.scope.profitAndLoss).toFixed(2) + (membraneTypeList.includes(scope.scope.goodsType) ? '米' : '件') }}</span>
              <span v-else-if="parseFloat(scope.scope.profitAndLoss) < 0" style="color: red">{{ parseFloat(scope.scope.profitAndLoss).toFixed(2) + (membraneTypeList.includes(scope.scope.goodsType) ? '米' : '件') }}</span>
              <span v-else>{{ parseFloat(scope.scope.profitAndLoss).toFixed(2) + (membraneTypeList.includes(scope.scope.goodsType) ? '米' : '件') }}</span>
            </span>
            <span v-else>-</span>
          </template>
        </GLTable>
      </div>
    </div>
  </GLDialog>
</template>

<script>
// import { membraneTypeList } from '@/utils/constants.js'
import constData from './constant/data.js'
export default {
  name: 'DetailDialog',
  data() {
    return {
      membraneTypeList: this.$membraneTypeList,
      countObj: {},
      searchForm: {
        id: ''
      },
      searchFormSearch: {},
      searchSelectObj: {},
      showFormData: [],
      getListApi: this.$apis.stockManage.refundDetailPage,
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'list',
        // singleSelectUniqueKey: 'id',
        tableOption: false,
        tableColumns: [
          {
            label: '产品名称',
            prop: 'upgradeGoodsName',
            width: 180,
            line: 1
          },
          {
            label: '规格',
            prop: 'specificationData',
            width: 180,
            line: 1
          },
          {
            label: '产品编码',
            prop: 'type'
            // width: 250
          },
          {
            label: '系列',
            prop: 'goodsName'
          },
          {
            label: '所属分类',
            prop: 'goodsTypeName'
          },
          {
            label: '系统库存',
            prop: 'stock',
            formatter: cellValue => {
              return cellValue.stock || cellValue.stock == 0 ? parseFloat(cellValue.stock).toFixed(2) + (this.$membraneTypeList.includes(cellValue.goodsType) ? '米' : '件') : '-'
            }
          },
          {
            label: '退货库存',
            prop: 'refundStock',
            formatter: cellValue => {
              return cellValue.refundStock || cellValue.refundStock == 0 ? parseFloat(cellValue.refundStock).toFixed(2) + (this.$membraneTypeList.includes(cellValue.goodsType) ? '米' : '件') : '-'
            }
          },
          {
            label: '膜卷号',
            prop: 'filmRollNo'
          }
        ]
      },
      baseData: {
        refundStatusList: constData.refundStatusList
      }
    }
  },

  props: {
    detailVisible: {
      type: Boolean,
      default: false
    },
    recordInfo: {
      type: Object,
      default: () => { }
    }
  },

  computed: {},
  mounted() { },

  methods: {
    beforeSearchFn() {
      return new Promise(resolve => {
        this.searchForm.refundCode = this.recordInfo.refundCode
        this.searchFormSearch = this.$common.utils.deepClone(this.searchForm)
        resolve()
      })
    },

    refundClassName() {
      console.log(this.recordInfo.refundStatus)
      return {
        1: 'yellowSpot',
        2: 'yellowSpot',
        3: 'redSpot',
        4: 'greenSpot',
        5: 'ashSpot'
      }[this.recordInfo.refundStatus]
    },

    handleClose() {
      this.$emit('dialogClose')
    }
  }
}
</script>
<style scoped lang="scss">
.count-txt {
  font-weight: 700;
  color: #2a58ad;
  margin: 0 2px;
}

.detailDailog .el-dialog {
  margin-top: 20vh !important;
  min-width: 700px;
}
@mixin spotBase {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  display: inline-block;
}
.ashSpot {
  @include spotBase();
  background: #c6c8cc;
}

.greenSpot {
  @include spotBase();
  background: #2cca74;
}

.yellowSpot {
  @include spotBase();
  background: #fdb757;
}

.redSpot {
  @include spotBase();
  background: #eb4e4e;
}
</style>