<template>

</template>

<script lang='ts' setup>
onLoad((options) => {
  getApp().logger?.info('ticketsBuy options: ', options);
  let couponId = options?.couponsId;
  if(options?.query && couponId == undefined) {
    const params = decodeURIComponent(options?.query);
    couponId = getQueryParam(params, 'couponsId');
  }
  setTimeout(() => {
    uni.reLaunch({
      url: `/pages/common/groupbuy/detail?id=${couponId}`
    });
  }, 300);
});

function getQueryParam(queryParams: string, key: string) {
  let regex = new RegExp('(?:[?&]|^)' + key + '=([^&]+)'),
    match = queryParams.match(regex);
  return match && match[1];
}
</script>

<style lang='scss' scoped>

</style>
