detailDialog.vue 6.42 KB
<!-- 月度库存结算单弹窗 -->
<template>
  <d2-dialog title="查看明细"
             :is-visible="detailVisible"
             class="stockMonthDailog"
             width="70%"
             :no-cancel="true"
             btn-ok-label="关闭"
             @closeDialog="handleClose"
             @confirmDialog="handleClose">
    <div class="merchantInfo">
      <span class="merchantName">{{ recordInfo.merchantName }}</span><span
            class="merchantId">{{ recordInfo.merchantId }}</span>
    </div>
    <div>
      <div class="header"
           slot="header">
        <d2-search ref="showSearch"
                   class="show-search"
                   :search-form="searchForm"
                   :search-select-obj="searchSelectObj"
                   :form-data="showFormData">
          <div slot="yearChoose"
               slot-scope="scope">
            <el-date-picker v-model="searchForm.statYear"
                            type="year"
                            placeholder="选择年"
                            value-format="yyyy"
                            format="yyyy"
                            :clearable="false"
                            :picker-options="pickerOption"
                            @change="chooseYear">
            </el-date-picker>
          </div>
        </d2-search>
      </div>
      <div class="d2-container-content">
        <d2-table ref="recordTable"
                  :table-data="tableData"
                  :search-form="searchFormSearch"
                  :table-params="tableParams"
                  :before-search-fn="beforeSearchFn"
                  :has-page="false"
                  :has-num="false">
          <div slot="other"
               slot-scope="scope">
            <template>
              <span
                    style="marginRight:10px">{{ (scope.scope.otherAmount || scope.scope.otherAmount == 0) ? scope.scope.otherAmount.toFixed(2) : '-' }}</span>
              <span v-if="scope.scope.otherAmount || scope.scope.otherAmount == 0"><el-button
                           type="text"
                           @click="gotoManage(scope.scope)">管理</el-button>
              </span>
            </template>
          </div>
        </d2-table>
      </div>
    </div>
    <!-- 管理其他变更明细 -->
    <manage-other-dialog :manage-visible="manageVisible"
                         v-if="manageVisible"
                         :info="rowData"
                         :stat-year="searchForm.statYear"
                         @dialogClose="manageDialogClose" />
  </d2-dialog>
</template>

<script>
import { Util, deepClone } from '@/common/util'
import { mapActions, mapState } from 'vuex'
import { dfBalanceMonthStatListStatYear } from '@api/balanceStatistics'
import { rangePickerOptions_year_2023 } from '@/common/format'
import manageOtherDialog from './manageOtherDialog'
export default {
  name: 'DetailDialog',
  components: {
    manageOtherDialog
  },
  data() {
    return {
      userInfo: this.$store.state.d2admin.user.info,
      pickerOption: rangePickerOptions_year_2023,
      countObj: {},
      searchForm: {
        statYear: '',
        merchantId: ''
      },
      searchFormSearch: {},
      searchSelectObj: {},
      showFormData: [{
        label: '年度',
        addHtml: 'yearChoose'
      }],
      // getListApi: getReportByGoods,
      tableData: [],
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'list',
        // singleSelectUniqueKey: 'id',
        tableOption: false,
        tableColumns: [{
          label: '月份',
          prop: 'statMonth',
          width: '100px'
        }, {
          label: '可代付金额',
          prop: 'canDfQuota',
          formatter: (cellValue) => {
            return (cellValue.canDfQuota || cellValue.canDfQuota == 0) ? cellValue.canDfQuota.toFixed(2) : '-'
          }
        }, {
          label: '已代付金额',
          prop: 'usedDfQuota',
          formatter: (cellValue) => {
            return (cellValue.usedDfQuota || cellValue.usedDfQuota == 0) ? cellValue.usedDfQuota.toFixed(2) : '-'
          }
        }, {
          label: "其他",
          prop: "other",
          addHtml: "other"
        }, {
          label: '余额',
          prop: 'remnantQuota',
          formatter: (cellValue) => {
            return (cellValue.remnantQuota || cellValue.remnantQuota == 0) ? cellValue.remnantQuota.toFixed(2) : '-'
          }
        }
        ]
      },
      baseData: {

      },
      manageVisible: false,
      rowData: {}
    }
  },

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

  computed: {

  },
  mounted() {
    const nowDate = new Date()
    this.searchForm.statYear = nowDate.getFullYear().toString()
    if (this.recordInfo) {
      this.searchForm.merchantId = this.recordInfo.merchantId
    }
    this.getList()
  },

  methods: {
    ...mapActions({
      get: 'd2admin/base/get',
      close: 'd2admin/page/close'
    }),

    beforeSearchFn() {
      return new Promise(resolve => {
        this.searchFormSearch = deepClone(this.searchForm)
        resolve()
      })
    },

    chooseYear() {
      this.getList()
    },

    getList() {
      var params = deepClone(this.searchForm)
      dfBalanceMonthStatListStatYear(params).then(res => {
        this.tableData = res
      })
    },

    handleClose() {
      this.$emit('dialogClose')
    },

    // 管理其他变更明细
    gotoManage(scope) {
      this.rowData = scope
      this.manageVisible = !this.manageVisible
    },

    manageDialogClose() {
      this.manageVisible = !this.manageVisible
      this.getList()
    }

  }
}

</script>
<style lang="scss" scoped>
.merchantInfo {
  // margin-left: 20px;
  .merchantName {
    font-family: PingFangSC-Medium;
    font-weight: 600;
    font-size: 15px;
    color: #333333;
  }
  .merchantId {
    margin-left: 10px;
  }
}
.count-txt {
  font-weight: 700;
  color: #2a58ad;
  margin: 0 2px;
}

.stockMonthDailog .el-dialog {
  margin-top: 20vh !important;
  min-width: 700px;
}

.stockMonthDailog .btn-tips img {
  width: 18px;
  height: 15px;
  margin-right: 9px;
  vertical-align: bottom;
}

.stockMonthDailog .btn-tips {
  display: inline-block;
  font-size: 12px;
  height: 14px;
  line-height: 14px;
  background-color: #fff2e5;
  color: #999999;
  margin-right: 24px;
  padding: 6.5px 10px;
}

.show-search {
  margin-left: -65px;
}
</style>