|
@@ -1,66 +1,71 @@
|
|
|
<template>
|
|
|
<div class="prizeDrawBox">
|
|
|
- <!-- <city @inputChange="null"></city> -->
|
|
|
- <div class="numberBox mb-5">恭喜您获得<span class="colorBase">1</span>次抽奖机会</div>
|
|
|
- <gridPage v-if="props.type === '1'" :lotteryId="props.lotteryId" @end="endCallback"></gridPage>
|
|
|
- <slotMachinePage v-if="props.type === '2'" :lotteryId="props.lotteryId" height="120" @end="endCallback"></slotMachinePage>
|
|
|
+ <div class="text-end cursor-pointer color-666" @click="emit('success')">
|
|
|
+ <v-btn color="primary" variant="tonal" append-icon="mdi-pan-right">我的奖品</v-btn>
|
|
|
+ </div>
|
|
|
+ <div class="d-flex flex-column align-center">
|
|
|
+ <div class="numberBox mb-5">恭喜您获得房券抽奖机会</div>
|
|
|
+ <gridPage v-if="props.type === '1'" :lotteryId="props.lotteryId" :disabled="disabled" @end="endCallback"></gridPage>
|
|
|
+ <slotMachinePage v-if="props.type === '2'" :lotteryId="props.lotteryId" height="120" :disabled="disabled" @end="endCallback"></slotMachinePage>
|
|
|
|
|
|
- <CtDialog :visible="showDialog" titleClass="text-h6" :footer="false" :widthType="3" title="抽奖详情" @close="showDialog = false">
|
|
|
- <div class="d-flex align-center flex-column">
|
|
|
- <svg-icon name="submit" size="300"></svg-icon>
|
|
|
- {{ prizeData?.prompt }}
|
|
|
- <!-- <div class="mt-5 font-weight-bold color-primary text-decoration-underline cursor-pointer" @click="emit('success')">点击前往“我的-我的奖品”中领取</div> -->
|
|
|
- <div class="my-10">
|
|
|
- <v-btn color="primary" variant="outlined" width="120" @click="showDialog = false">取 消</v-btn>
|
|
|
- <v-btn color="primary" width="120" class="ml-5" @click.stop="handleReceive">前往领取</v-btn>
|
|
|
+ <CtDialog :visible="showDialog" titleClass="text-h6" :footer="false" :widthType="3" title="抽奖详情" @close="showDialog = false">
|
|
|
+ <div class="d-flex align-center flex-column">
|
|
|
+ <svg-icon name="submit" size="300"></svg-icon>
|
|
|
+ <p v-for="(k, i) in prizeData" :key="i" class="mb-3">{{ k.prize.prompt }}</p>
|
|
|
+ <div class="my-10">
|
|
|
+ <v-btn color="primary" variant="outlined" width="120" @click="showDialog = false">取 消</v-btn>
|
|
|
+ <v-btn color="primary" width="120" class="ml-5" @click.stop="emit('success')">前往领取</v-btn>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </CtDialog>
|
|
|
+ </CtDialog>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
defineOptions({ name: 'prizeDraw'})
|
|
|
-// import city from './prizeDraw/city.vue'
|
|
|
import gridPage from './prizeDraw/grid.vue'
|
|
|
import slotMachinePage from './prizeDraw/slotMachine.vue'
|
|
|
import { ref } from 'vue'
|
|
|
+import { getLuckLotteryRecordByOrderId } from '@/api/mall/prize'
|
|
|
+import Snackbar from '@/plugins/snackbar'
|
|
|
|
|
|
const emit = defineEmits(['success'])
|
|
|
const props = defineProps({
|
|
|
lotteryId: [Number, String],
|
|
|
+ orderId: [Number, String],
|
|
|
type: {
|
|
|
- type:String,
|
|
|
+ type: String,
|
|
|
default: '1'
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-// 抽中奖品信息
|
|
|
-const showDialog = ref(false)
|
|
|
+const disabled = ref(false)
|
|
|
+
|
|
|
+// 获取中奖记录
|
|
|
const prizeData = ref({})
|
|
|
-const endCallback = (value) => {
|
|
|
- console.log(value.prize, '抽中的奖品')
|
|
|
- prizeData.value = value.prize
|
|
|
- showDialog.value = true
|
|
|
+const getRecord = async () => {
|
|
|
+ const data = await getLuckLotteryRecordByOrderId(props.orderId)
|
|
|
+ prizeData.value = data || []
|
|
|
+ if (!data || !data.length) disabled.value = true
|
|
|
}
|
|
|
+if (props.orderId) getRecord()
|
|
|
|
|
|
-// const handleReceive = () => {
|
|
|
-// showDialog.value = false
|
|
|
-// }
|
|
|
+const showDialog = ref(false)
|
|
|
+const endCallback = () => {
|
|
|
+ if (!prizeData.value.length) return Snackbar.warning('您已经抽过奖了哦')
|
|
|
+ showDialog.value = true
|
|
|
+ disabled.value = true
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
.prizeDrawBox {
|
|
|
padding: 20px 40px;
|
|
|
background-color: var(--default-bgc);
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- // justify-content: center;
|
|
|
- align-items: center;
|
|
|
}
|
|
|
.prizeDraw {
|
|
|
margin: 0 auto;
|
|
|
- cursor: pointer;
|
|
|
}
|
|
|
.numberBox {
|
|
|
font-size: 20px;
|