<script setup lang="ts">
import { Events } from "~/dim/event";
import { OrderDim } from "~/dim/order";
const props = defineProps<{ shopDatas: shopList[]}>();
const emit = defineEmits([Events.input, Events.change]);
import { DefaultQuery, pageSizes } from "~/domain/query";
import { useShop } from "~/api/shop/shopService";
const { sellerShopList } = useShop();
import type shopList from "~/domain/Shop";
import type shopListQuery from "~/api/shop/shopQuery";
const shopData: Ref<shopList[]> = ref(props.shopDatas);
const defaultQuery = () => {
  const q = new DefaultQuery({}) as shopListQuery;
  return q;
};
const query: Ref<shopListQuery> = ref(defaultQuery());

const options = Object.keys(OrderDim.OrderStatusMap).map(function (code) {
  return {
    code: code,
    name: OrderDim.OrderStatusMap[code],
  };
});
// async function sellerShopListFun() {
//   const q = JSON.parse(JSON.stringify(query.value));
//   const res: any = await sellerShopList(q);
//   if (res.code == 200) {
//     shopData.value = res.rows;
//     emit(Events.reset, shopData.value);
//   }
// }
function handleChange(val: any) {
  emit(Events.input, val);
  emit(Events.change, val);
}
onMounted(() => {
  // sellerShopListFun()
})
</script>

<template>
  <el-select filterable placeholder="请选择" @change="handleChange">
    <el-option v-for="item in shopData" :key="item.id" :label="item.shopName" :value="item.id">
      <span style="float: left">{{ item.shopName }}</span>
    </el-option>
  </el-select>
</template>
