<template>
  <jx-empty title="暂无活动信息" />
</template>

<script lang="ts" setup>
import { getStorage } from '@/utils/storage'
import toast from '@/utils/toast'
import { timeFormatD } from '@/utils/tools'
import { onShow } from '@dcloudio/uni-app'
import { ref } from 'vue'
import merchant from '@/api/https/merchant'

onShow(async () => {
  await QueryActivity()
})

/**
 * 获取店铺活动信息
 */

const activityData = ref<Array<any>>([])
async function QueryActivity() {
  let fromTime =
    timeFormatD(+new Date() - 30 * 24 * 60 * 1000 * 2) + ' 00:00:00'
  let toTime = timeFormatD(+new Date()) + ' 23:59:59'
  let data = {
    storeID: getStorage('storeID'),
    createdAtFrom: fromTime,
    createdAtTo: toTime,
    typeList: '[0,3,4,5]',
    statusList: '[1]',
    pageSize: 7,
    offset: 1 * 7,
  }
  let activityRes = await merchant.query_acts(data)
  if (activityRes.code == 0) {
    if (activityRes.data.totalCount > 0) {
      activityData.value = activityRes.data.data
    } else {
      activityData.value = []
    }
  } else {
    toast('活动那个信息异常')
  }
}
</script>

<style lang="scss" scoped>
</style>