<template>
  <!-- <el-cascader style="width: 100%"
               ref="cascader"
               :options="productGroupList"
               :props="{ checkStrictly: true,label: 'groupName',value: 'id',children: 'childs' }"
               clearable></el-cascader> -->

  <el-select v-model="productGroup" placeholder="请选择">
    <el-option
      v-for="item in productGroupList"
      :key="item.shopGroupId"
      :label="item.groupName"
      :value="item.shopGroupId">
    </el-option>
  </el-select>
</template>

<script>
  import api from '@@/components/canvasShow/config/api'
  import {sendReqMixin} from '@@/components/canvasShow/config/mixin'
  import {checkEmptyChild} from '@@/config/common'
  import {getShopId} from "@@/utils/auth.js"
  export default {
    name: 'product-group-select',
    mixins: [sendReqMixin],
    data () {
      return {
        productGroupList: [],
        productGroup : {}
      }
    },
    mounted () {
      this.getProductGroup()
    },
    methods: {
      // 获取类别
      getProductGroup () {
        var _this = this
        // let shopId = parseInt(getShopId())
        // var paramsUrl = `${api.getProductGroup}?`
        // if (shopId) {
        //   paramsUrl += `&shopId=${shopId}`
        // }
        let params = {
          url: api.getProductGroup,
          method: 'GET',
          project: '0'
        }
        this.sendReq(params, (res) => {
          _this.productGroupList = res.data
          checkEmptyChild(_this.productGroupList)
        })
      }
    }
  }
</script>
