|
|
@ -1,6 +1,6 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { CloseOutlined, LeftOutlined, RightOutlined } from '@ant-design/icons-vue' |
|
|
|
import { CloseOutlined, LeftOutlined, RightOutlined } from '@ant-design/icons-vue' |
|
|
|
import { Button, Carousel, Modal, QRCode, message } from 'ant-design-vue' |
|
|
|
import { Button, Carousel, Modal, QRCode, Spin, message } from 'ant-design-vue' |
|
|
|
import { onMounted, ref } from 'vue' |
|
|
|
import { onMounted, ref } from 'vue' |
|
|
|
import type { GoodsData, Racharge } from './index.d' |
|
|
|
import type { GoodsData, Racharge } from './index.d' |
|
|
|
import { getIsPay, goodsList, goodsType, payment } from '@/api/recharge/index' |
|
|
|
import { getIsPay, goodsList, goodsType, payment } from '@/api/recharge/index' |
|
|
@ -13,6 +13,7 @@ import { RechargeEnum } from '@/enums/recharge' |
|
|
|
|
|
|
|
|
|
|
|
const userStore = useUserStore() |
|
|
|
const userStore = useUserStore() |
|
|
|
const rechargeStore = useRechargeStore() |
|
|
|
const rechargeStore = useRechargeStore() |
|
|
|
|
|
|
|
const currentIndex = ref(3) |
|
|
|
// 轮播的ref |
|
|
|
// 轮播的ref |
|
|
|
const carouselRef = ref() |
|
|
|
const carouselRef = ref() |
|
|
|
// 选项卡索引 |
|
|
|
// 选项卡索引 |
|
|
@ -23,6 +24,8 @@ const qrshow = ref<boolean>(false) |
|
|
|
const tabs = ref<Racharge[]>([]) |
|
|
|
const tabs = ref<Racharge[]>([]) |
|
|
|
// 套餐列表 |
|
|
|
// 套餐列表 |
|
|
|
const goodslists = ref<GoodsData[]>([]) |
|
|
|
const goodslists = ref<GoodsData[]>([]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isDataLoaded = ref(false) |
|
|
|
// 支付路径 |
|
|
|
// 支付路径 |
|
|
|
const payData = ref<any>({ |
|
|
|
const payData = ref<any>({ |
|
|
|
orderCode: '', |
|
|
|
orderCode: '', |
|
|
@ -40,14 +43,19 @@ function getType() { |
|
|
|
|
|
|
|
|
|
|
|
// 套餐列表 |
|
|
|
// 套餐列表 |
|
|
|
function getgoodsList(type: string) { |
|
|
|
function getgoodsList(type: string) { |
|
|
|
|
|
|
|
isDataLoaded.value = true |
|
|
|
goodsList({ type }).then((res) => { |
|
|
|
goodsList({ type }).then((res) => { |
|
|
|
goodslists.value = res |
|
|
|
goodslists.value = res |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
isDataLoaded.value = false |
|
|
|
|
|
|
|
}, 300) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 选择选项卡 |
|
|
|
// 选择选项卡 |
|
|
|
function selectTab(index: number, key: string) { |
|
|
|
function selectTab(index: number, key: string) { |
|
|
|
activeTab.value = index |
|
|
|
activeTab.value = index |
|
|
|
|
|
|
|
currentIndex.value = 3 |
|
|
|
getgoodsList(key) |
|
|
|
getgoodsList(key) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -78,7 +86,6 @@ function stopPolling() { |
|
|
|
clearInterval(intervalId.value) |
|
|
|
clearInterval(intervalId.value) |
|
|
|
intervalId.value = null |
|
|
|
intervalId.value = null |
|
|
|
qrshow.value = false |
|
|
|
qrshow.value = false |
|
|
|
|
|
|
|
|
|
|
|
userStore.getChatInfoFun() |
|
|
|
userStore.getChatInfoFun() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -111,12 +118,18 @@ function tabClass(index: number) { |
|
|
|
|
|
|
|
|
|
|
|
// 走马灯向上 |
|
|
|
// 走马灯向上 |
|
|
|
function onPrevClick() { |
|
|
|
function onPrevClick() { |
|
|
|
|
|
|
|
if (currentIndex.value > 3) { |
|
|
|
|
|
|
|
currentIndex.value-- |
|
|
|
carouselRef.value.prev() |
|
|
|
carouselRef.value.prev() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
// 走马灯向下 |
|
|
|
// 走马灯向下 |
|
|
|
function onNextClick() { |
|
|
|
function onNextClick() { |
|
|
|
|
|
|
|
if (currentIndex.value < goodslists.value.length) { |
|
|
|
|
|
|
|
currentIndex.value++ |
|
|
|
carouselRef.value.next() |
|
|
|
carouselRef.value.next() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 数字分隔符 |
|
|
|
// 数字分隔符 |
|
|
|
function separator(num: number | string) { |
|
|
|
function separator(num: number | string) { |
|
|
@ -150,7 +163,8 @@ function separator(num: number | string) { |
|
|
|
<div v-show="goodslists.length > 3" class="prev-button prev" @click="onPrevClick"> |
|
|
|
<div v-show="goodslists.length > 3" class="prev-button prev" @click="onPrevClick"> |
|
|
|
<LeftOutlined /> |
|
|
|
<LeftOutlined /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<Carousel ref="carouselRef" arrows :dots="false" :autoplay="false" :slides-to-show="goodslists.length > 3 ? 3 : goodslists.length" :slides-to-scroll="1"> |
|
|
|
<Spin :spinning="isDataLoaded"> |
|
|
|
|
|
|
|
<Carousel :key="activeTab" ref="carouselRef" arrows :dots="false" :infinite="false" :autoplay="false" :slides-to-show="goodslists.length > 3 ? 3 : goodslists.length" :slides-to-scroll="1"> |
|
|
|
<div v-for="(item, index) in goodslists" :key="index" class="carouse-box"> |
|
|
|
<div v-for="(item, index) in goodslists" :key="index" class="carouse-box"> |
|
|
|
<div class="carouse-item"> |
|
|
|
<div class="carouse-item"> |
|
|
|
<div class="dotnumbox"> |
|
|
|
<div class="dotnumbox"> |
|
|
@ -207,6 +221,7 @@ function separator(num: number | string) { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</Carousel> |
|
|
|
</Carousel> |
|
|
|
|
|
|
|
|
|
|
|
<div v-show="goodslists.length > 3" class="next-button next" @click="onNextClick"> |
|
|
|
<div v-show="goodslists.length > 3" class="next-button next" @click="onNextClick"> |
|
|
|
<RightOutlined /> |
|
|
|
<RightOutlined /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -233,6 +248,7 @@ function separator(num: number | string) { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
</Spin> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div v-else class="extreme-box"> |
|
|
|
<div v-else class="extreme-box"> |
|
|
|
<div class="extreme"> |
|
|
|
<div class="extreme"> |
|
|
|