<template>
  <view class="quick-access">
    <view class="quick-access-scroll">
      <view
        class="quick-access-item"
        v-for="(item, index) in itemList"
        :key="index"
        @click="sendReply(item)"
      >
        <image
          class="quick-access-item-bg"
          src="https://oss.nianxx.cn/mp/static/quick/quick_icon_bg.png"
          mode="aspectFill"
        />
        <view class="quick-access-item-title">
          <image class="quick-access-item-icon" :src="item.icon" />
          <text>{{ item.title }}</text>
        </view>
        <text class="quick-access-item-content">{{ item.content }}</text>
      </view>
    </view>
  </view>
</template>

<script setup>
import { onMounted, ref } from "vue";
import { currentClientType, ClientType } from "@/constant/base";
const itemList = ref([]);

const emits = defineEmits(["replySent"]);

const sendReply = (item) => {
  emits("replySent", item); // 向父组件传递数据
};

onMounted(() => {
  initData();
});

const initData = () => {
  itemList.value =
    currentClientType() === ClientType.TIANMU
      ? [
          {
            icon: "https://oss.nianxx.cn/mp/static/quick/quick_icon_yuding.png",
            title: "快速预定",
            content: "预定门票、房间、餐食",
            type: "Command.quickBooking",
          },
          {
            icon: "https://oss.nianxx.cn/mp/static/quick/quick_icon_find.png",
            title: "探索发现",
            content: "探索玩法、出片佳地",
            type: "Command.discovery",
          },
          {
            icon: "https://oss.nianxx.cn/mp/static/quick/quick_icon_call.png",
            title: "反馈意见",
            content: "有意见告诉沐沐",
            type: "Command.feedbackCard",
          },
          {
            icon: "https://oss.nianxx.cn/mp/static/quick/quick_icon_order.png",
            title: "订单/工单",
            content: "我的订单/工单",
            type: "MyOrder",
          },
        ]
      : [
          {
            icon: "https://oss.nianxx.cn/mp/static/quick/quick_icon_yuding.png",
            title: "快速预定",
            content: "预定门票、房间、餐食",
            type: "Command.quickBooking",
          },
          {
            icon: "https://oss.nianxx.cn/mp/static/quick/quick_icon_find.png",
            title: "探索发现",
            content: "探索玩法、出片佳地",
            type: "Command.discovery",
          },
          {
            icon: "https://oss.nianxx.cn/mp/static/quick/quick_icon_order.png",
            title: "订单/工单",
            content: "我的订单/工单",
            type: "MyOrder",
          },
          {
            icon: "https://oss.nianxx.cn/mp/static/quick/quick_icon_call.png",
            title: "反馈意见",
            content: "有意见告诉朵朵",
            type: "Command.feedbackCard",
          },
        ];
};
</script>

<style lang="scss" scoped>
@import "./styles/index.scss";
</style>
