# 優惠活動-紅包信息
## 功能
取得紅包信息
## 使用
``` jsx!
<script setup>
// 引入 onBeforeMount
import { onBeforeMount } from "vue";
import { useStore } from "vuex";
import common from "@/utils/common";
const store = useStore();
const { errorHandling } = common();
const DomainLayoutId = computed(() => store.state.DomainLayoutId);
const redPacketStatusNo = ref('');
const currency = ref('');
const startTime = ref(0);
const endTime = ref(0);
const getRedPacketInfo = async () => {
const params = {
sessionKey: localStorage.getItem('sessionKey'),
currencyNo: +localStorage.getItem('currencyNo'),
DomainLayoutId: DomainLayoutId.value,
}
isLoading.value = true;
try {
const res = await apiService.post('/Promotion/RedPacket/Info', params)
redPacketStatusNo.value = res.data.status
currency.value = res.data.currency?.currencyId;
startTime.value = res.data.startTime;
endTime.value = res.data.endTime;
} catch (err) {
errorHandling(err);
}
isLoading.value = false;
}
onBeforeMount(() => {
getRedPacketInfo();
})
</script>
```
## 說明書
### API 路徑
 /api/Promotion/RedPacket/Info
### 前端傳入資料(以 aai 版面為例)
##### Example Value
``` jsx
// params
{
"sessionKey": "b822c7204d8c4219804d569bcecf494d",
"currencyNo": 1,
"DomainLayoutId": "aah"
}
```
##### parameters
| params | Description | type | required | other |
| -------------- | ----------- | --------------- | -------- |-------|
| sessionKey | Session Key | string | false | |
| currencyNo | 貨幣編號 | integer($int32) | true |maximum: 2147483647<br/>minimum: 0|
| domainLayoutId | 域名版面識別碼 | string | true | |
### 後端回傳資料(以 aah 版面為例)
#### 成功
##### Example Value
``` jsx!
// status code: 200
{
"status": 3, // 優惠活動紅包信息狀態 | integer($int32) | 1=無活動, 2=活動尚未開始, 3=可點擊領取, 4=已領取, 5=活動已結束, 6=未達領取條件
"startTime": 1706112000000, // 活動開始時間 | integer($int64) | nullable: true
"endTime": 1713974399999, // 活動結束時間 | integer($int64) | nullable: true
"currency": { // 幣別信息
"no": 1, // 幣別編號 | integer($int32)
"currencyId": "CNY", // 幣別 | string | nullable: true
"protocol": null, // 虛擬貨幣協議 | string | nullable: true
"isVirtual": false, // 是否為虛擬貨幣 | boolean
"isPublicityCoin": false // 是否為宣傳(試玩)幣 | boolean
}
}
```
| params | Description | type | nullable |
| --------------- | ------------------------ | --------------- | -------- |
| status | 優惠活動紅包信息狀態 | integer($int32) | |
| startTime | 活動開始時間 | integer($int64) | true |
| endTime | 內容 | integer($int64) | true |
| no | 活動結束時間 | integer($int32) | |
| currencyId | 幣別 | string | true |
| protocol | 虛擬貨幣協議 | string | true |
| isVirtual | 是否為虛擬貨幣 | boolean | |
| isPublicityCoin | 是否為宣傳(試玩)幣 | boolean | |
#### 失敗
