prizeDraw.vue 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div class="prizeDrawBox">
  3. <city @inputChange="null"></city>
  4. <gridPage v-if="props.type === '1'" :disabled="!Number(luckyDrawsNum)" :lotteryId="props.lotteryId" @end="endCallback"></gridPage>
  5. <slotMachinePage v-if="props.type === '2'" :disabled="!Number(luckyDrawsNum)" :lotteryId="props.lotteryId" @end="endCallback"></slotMachinePage>
  6. <div class="numberBox mt-5">您还剩余<span class="colorBase">{{ luckyDrawsNum }}</span>次抽奖机会</div>
  7. <CtDialog :visible="showDialog" titleClass="text-h6" :footer="false" :widthType="3" title="抽奖详情" @close="showDialog = false">
  8. <div class="d-flex align-center flex-column">
  9. <svg-icon name="submit" size="300"></svg-icon>
  10. <!-- {{ prizeData?.prompt }}
  11. <div class="mt-5 font-weight-bold color-primary text-decoration-underline cursor-pointer" @click="emit('success')">点击前往“我的-我的奖品”中领取</div> -->
  12. <!-- <div class="my-10">
  13. <v-btn color="primary" variant="outlined" width="120" @click="showDialog = false">取 消</v-btn>
  14. <v-btn color="primary" width="120" class="ml-5" @click.stop="handleReceive">前往领取</v-btn>
  15. </div> -->
  16. </div>
  17. </CtDialog>
  18. </div>
  19. </template>
  20. <script setup>
  21. defineOptions({ name: 'prizeDraw'})
  22. import city from './prizeDraw/city.vue'
  23. import gridPage from './prizeDraw/grid.vue'
  24. import slotMachinePage from './prizeDraw/slotMachine.vue'
  25. import { ref } from 'vue'
  26. import { getNumByLotteryId } from '@/api/mall/prize'
  27. const emit = defineEmits(['success'])
  28. const props = defineProps({
  29. lotteryId: [Number, String],
  30. type: {
  31. type:String,
  32. default: '1'
  33. }
  34. })
  35. // 获取抽奖次数
  36. const luckyDrawsNum = ref(0)
  37. const getLuckyNum = async () => {
  38. luckyDrawsNum.value = await getNumByLotteryId(props.lotteryId)
  39. }
  40. getLuckyNum()
  41. // 抽中奖品信息
  42. const showDialog = ref(false)
  43. const prizeData = ref({})
  44. const endCallback = (value) => {
  45. console.log(value.prize, '抽中的奖品')
  46. prizeData.value = value.prize
  47. showDialog.value = true
  48. getLuckyNum()
  49. }
  50. // const handleReceive = () => {
  51. // showDialog.value = false
  52. // }
  53. </script>
  54. <style scoped lang="scss">
  55. .prizeDrawBox {
  56. padding: 40px;
  57. background-color: var(--default-bgc);
  58. display: flex;
  59. flex-direction: column;
  60. // justify-content: center;
  61. align-items: center;
  62. }
  63. .prizeDraw {
  64. margin: 0 auto;
  65. cursor: pointer;
  66. }
  67. .numberBox {
  68. font-size: 20px;
  69. font-weight: bold;
  70. padding: 2px 38px;
  71. border-bottom: 3px solid var(--v-primary-base);
  72. }
  73. .colorBase {
  74. color: var(--v-primary-base);
  75. margin: 0 6px;
  76. font-size: 22px;
  77. }
  78. </style>