<template>
  <div>
    <div>
      <div ref="lxHeader">
        <lx-header icon="md-apps" style="margin-bottom: 10px; border: 0px; margin-top: 15px" text="产品管理">
          <div slot="content"></div>
          <slot>
            <div>
              <Input placeholder="关键字搜索" style="width: 200px; margin-right: 10px"/>
              <Button style="margin-left: 10px" type="primary">查询</Button>
              <Button style="margin-left: 10px" type="primary"
                      @click="$refs['addProduct'].type = 'add',$refs['addProduct'].isShow = true">新建产品
              </Button>
            </div>
          </slot>
        </lx-header>
      </div>
    </div>

    <xy-table></xy-table>

    <add-product ref="addProduct" :product-sku="productSku" :product-type="productType"></add-product>
  </div>
</template>

<script>
import {getList} from '@/api/product'
import {getparameter} from '@/api/system/dictionary'
import {getList as getTypes} from '@/api/productType'

import addProduct from "@/views/product/productComponent/addProduct";

export default {
  components: {
    addProduct
  },
  data() {
    return {
      isShowAdd: false,
      productType: [],
      productSku: [],

      list: [],
      table: []
    }
  },
  methods: {
    async getList() {
      const res = await getList()
      console.log(res)
    },
    async getProductType() {
      const res = await getTypes({page_size: 999})
      this.productType = res.data
    },
    async getProductSku() {
      const res = await getparameter({number: 'productSku'})
      this.productSku = res.detail
    }
  },
  mounted() {
    this.getList()
    this.getProductType()
    this.getProductSku()
  }
}
</script>

<style lang="scss" scoped>

</style>
