<template>
    <view class="context">
        <template v-if="activityServiceList?.length">
            <GoodsDesc :lists="activityServiceList"></GoodsDesc>
        </template>
        <u-empty
            v-else
            text="暂无数据～"
            :src="'/static/images/empty/collection.png'"
            :icon-size="300"
        ></u-empty>
    </view>
</template>

<script lang="ts" setup>
import { shallowRef, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import GoodsDesc from '@/components/goods-desc/index.vue'
import { useAppStore } from '@/stores/app'
import { apiActivityDetail } from '@/api/goods'

const appStore = useAppStore()
const paging = shallowRef()
const activityId = ref<number>()

const activityServiceList = ref<any>([])

const upCallback = async (): Promise<void> => {
    try {
        const res = await apiActivityDetail({ id: activityId.value })
        activityServiceList.value = res.goodsList
        uni.setNavigationBarTitle({
            title: res.name
        })
        paging.value.complete([activityServiceList.value])
    } catch (err) {
        console.log(err)
        // refreshRef.value.endErr()
        paging.value?.complete(false)
    }
}

onLoad((options: any) => {
    activityId.value = options?.id * 1 || 0
    upCallback()
})
</script>

<style lang="scss" scoped>
.context {
    flex: 1;
    min-height: 0;
    overflow: scroll;
    // background: linear-gradient(to bottom, #c6ecff, #c6ecee);
}
</style>
