fix: bet options
This commit is contained in:
parent
45b06b47c4
commit
01a7f363d4
@ -50,10 +50,10 @@ const gameInfo = reactive({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const choices = ref([
|
const choices = ref([
|
||||||
{ id: "1", name: "IDOL 1", active: false },
|
// { id: "1", name: "IDOL 1", active: false },
|
||||||
{ id: "2", name: "IDOL 2", active: false },
|
// { id: "2", name: "IDOL 2", active: false },
|
||||||
{ id: "3", name: "IDOL 3", active: false },
|
// { id: "3", name: "IDOL 3", active: false },
|
||||||
{ id: "4", name: "IDOL 4", active: false },
|
// { id: "4", name: "IDOL 4", active: false },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const choicesSelected = computed(() => {
|
const choicesSelected = computed(() => {
|
||||||
@ -89,8 +89,8 @@ onUnmounted(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const toggleChoice = (id) => {
|
const toggleChoice = (id) => {
|
||||||
const idx = choices.value.findIndex(e => e.id === id);
|
const idx = choices.value.findIndex((e) => e.id === id);
|
||||||
if(idx === -1) return;
|
if (idx === -1) return;
|
||||||
choices.value[idx].active = !choices.value[idx].active;
|
choices.value[idx].active = !choices.value[idx].active;
|
||||||
if (!choices.value[idx].active) {
|
if (!choices.value[idx].active) {
|
||||||
choices.value[idx].amount = 0;
|
choices.value[idx].amount = 0;
|
||||||
@ -108,6 +108,16 @@ const getGameHistory = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const GameInfo = () => {
|
||||||
|
handleRequest(axios.get(API.GAME_INFO + "/" + id)).then(
|
||||||
|
(res) => {
|
||||||
|
if (res.success) {
|
||||||
|
choices.value = res.data.info?.betOptions ?? []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
const confirmOrder = () => {
|
const confirmOrder = () => {
|
||||||
if (choicesSelected.value.length === 0) {
|
if (choicesSelected.value.length === 0) {
|
||||||
return showFailToast("Hãy chọn 1 con số");
|
return showFailToast("Hãy chọn 1 con số");
|
||||||
@ -122,10 +132,10 @@ const confirmOrder = () => {
|
|||||||
|
|
||||||
const cancelOrder = () => {
|
const cancelOrder = () => {
|
||||||
choices.value.forEach((c) => {
|
choices.value.forEach((c) => {
|
||||||
c.active = false
|
c.active = false;
|
||||||
});
|
});
|
||||||
amount.value = ""
|
amount.value = "";
|
||||||
}
|
};
|
||||||
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
const data = {
|
const data = {
|
||||||
@ -193,6 +203,9 @@ const formatResultText2 = (r) => {
|
|||||||
}, 0);
|
}, 0);
|
||||||
return s % 2 ? "IDOL 3" : "IDOL 4";
|
return s % 2 ? "IDOL 3" : "IDOL 4";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GameInfo();
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="container page">
|
<div class="container page">
|
||||||
@ -385,32 +398,45 @@ const formatResultText2 = (r) => {
|
|||||||
</van-popup>
|
</van-popup>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<van-popup v-model:show="isShowConfirmOrder">
|
<van-popup v-model:show="isShowConfirmOrder">
|
||||||
<div class="confirm-order-modal">
|
<div class="confirm-order-modal">
|
||||||
<div class="head van-hairline--bottom">
|
<div class="head van-hairline--bottom">
|
||||||
<p class="text" style="margin: 1em">Bình chọn</p>
|
<p class="text" style="margin: 1em">Bình chọn</p>
|
||||||
</div>
|
|
||||||
<ul class="list">
|
|
||||||
<li
|
|
||||||
class="lise-item van-hairline--bottom"
|
|
||||||
v-for="(item, index) in choicesSelected"
|
|
||||||
:key="index"
|
|
||||||
>
|
|
||||||
<div class="main">
|
|
||||||
<p class="bet-name">{{ item.name }}</p>
|
|
||||||
<p class="detail-text">
|
|
||||||
1ĐặtX{{ item.amount }}Đ={{ item.amount }}Đ
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<van-icon name="close" @click="toggleChoice(item.id)"/>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<div class="sub-bar">
|
|
||||||
<van-button type="default" class="item cancel-btn" color="#979799" plain @click="cancelOrder">Hủy bình chọn</van-button>
|
|
||||||
<van-button type="default" class="item" color='linear-gradient(270deg, #c24491, #775fd9)' @click="submit">Xác nhận</van-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</van-popup>
|
<ul class="list">
|
||||||
|
<li
|
||||||
|
class="lise-item van-hairline--bottom"
|
||||||
|
v-for="(item, index) in choicesSelected"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<div class="main">
|
||||||
|
<p class="bet-name">{{ item.name }}</p>
|
||||||
|
<p class="detail-text">
|
||||||
|
1ĐặtX{{ item.amount }}Đ={{ item.amount }}Đ
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<van-icon name="close" @click="toggleChoice(item.id)" />
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="sub-bar">
|
||||||
|
<van-button
|
||||||
|
type="default"
|
||||||
|
class="item cancel-btn"
|
||||||
|
color="#979799"
|
||||||
|
plain
|
||||||
|
@click="cancelOrder"
|
||||||
|
>Hủy bình chọn</van-button
|
||||||
|
>
|
||||||
|
<van-button
|
||||||
|
type="default"
|
||||||
|
class="item"
|
||||||
|
color="linear-gradient(270deg, #c24491, #775fd9)"
|
||||||
|
@click="submit"
|
||||||
|
>Xác nhận</van-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</van-popup>
|
||||||
</template>
|
</template>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.van-cell {
|
.van-cell {
|
||||||
@ -452,5 +478,4 @@ const formatResultText2 = (r) => {
|
|||||||
.cancel-btn :deep(.van-button__text) {
|
.cancel-btn :deep(.van-button__text) {
|
||||||
color: currentColor !important;
|
color: currentColor !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user