stockDetailDialog.vue 4.19 KB
<!-- 库存明细弹窗 -->
<template>
  <d2-dialog
    title="库存明细"
    :is-visible="dialogVisible"
    class="stockMonthDailog"
    width="50%"
    :no-cancel="false"
    btn-ok-label="确定"
    btn-cancel-label="取消"
    @closeDialog="handleClose"
    @confirmDialog="handleClose"
    :appendToBody="true"
  >
    <div class="d2-container-content">
      <div class="search-box">
        <el-input
          v-model="searchForm.merchantName"
          size="small"
          placeholder="请输入商户名称"
          prefix-icon="el-icon-search"
          style="width: 200px; margin-right: 10px"
        ></el-input>
        <el-button :id="tableParams.btnId" size="small" type="primary">
          查询
        </el-button>
      </div>
      <d2-table
        ref="recordTable"
        :get-list-api="getListApi"
        :search-form="searchForm"
        :table-params="tableParams"
      >
      </d2-table>
    </div>
  </d2-dialog>
</template>

<script>
import { mapActions, mapState } from "vuex"
import { merchantShopGoodsStockPageH5 } from "@api/stockManage"
import { baseConfig } from "@/main"

export default {
  name: "StockDetailDialog",
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    recordInfo: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      userInfo: this.$store.state.d2admin.user.info,
      membraneTypeList: baseConfig.membraneTypeList,
      searchForm: {
        upgradeGoodsId: "",
        merchantName: ""
        // yqMerchantId: ""
      },
      getListApi: merchantShopGoodsStockPageH5,
      tableData: [],
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: "list",
        // tableOption: false,
        tableColumns: [
          {
            label: "门店",
            prop: "merchantName"
          },
          {
            label: "当前库存",
            prop: "stock",
            // width: ''
            formatter: (cellValue) => {
              return cellValue.stock || cellValue.stock == 0
                ? parseFloat(cellValue.stock).toFixed(2) +
                    (this.membraneTypeList.includes(cellValue.goodsType)
                      ? "米"
                      : "件")
                : "-"
            }
          },
          {
            label: "膜卷号",
            prop: "filmRollNo",
            formatter: (cellValue) => {
              return cellValue?.filmRollNo || "-"
            }
          }
        ]
      }
    }
  },

  computed: {
    dialogVisible: {
      get() {
        return this.visible
      },
      set(val) {
        this.$emit("update:visible", val)
      }
    }
  },
  mounted() {
    if (this.recordInfo) {
      // this.searchForm.yqMerchantId = this.recordInfo.yqMerchantId
      this.searchForm.upgradeGoodsId = this.recordInfo.upgradeGoodsId
    }
  },

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

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

    // chooseYear() {
    //   this.getList()
    // },

    // handleSearch() {
    //   this.$refs.recordTable.handleSearch()
    // },

    handleReset() {
      // this.handleSearch()
      this.searchForm.merchantName = ""
      // this.$refs.showSearch.handleReset(true, true)
    },

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

.stockMonthDailog ::v-deep.el-dialog__body {
  padding: 0px 20px;
  .d2-container-content {
    padding: 0px 0px !important;
  }
}

.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;
}

.search-box {
  display: flex;
  margin-bottom: 15px;
}
</style>