瀏覽代碼

去除抽奖次数

Xiao_123 4 月之前
父節點
當前提交
b74832fce1

+ 6 - 16
src/views/mall/components/prizeDraw.vue

@@ -1,19 +1,18 @@
 <template>
   <div class="prizeDrawBox">
     <city @inputChange="null"></city>
-    <gridPage v-if="props.type === '1'" :disabled="!Number(luckyDrawsNum)" :lotteryId="props.lotteryId" @end="endCallback"></gridPage>
-    <slotMachinePage v-if="props.type === '2'" :disabled="!Number(luckyDrawsNum)" :lotteryId="props.lotteryId" @end="endCallback"></slotMachinePage>
-    <div class="numberBox mt-5">您还剩余<span class="colorBase">{{ luckyDrawsNum }}</span>次抽奖机会</div>
+    <gridPage v-if="props.type === '1'" :lotteryId="props.lotteryId" @end="endCallback"></gridPage>
+    <slotMachinePage v-if="props.type === '2'" :lotteryId="props.lotteryId" @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">
+        {{ 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>
-        </div> -->
+        </div>
       </div>
     </CtDialog>
   </div>
@@ -25,7 +24,6 @@ import city from './prizeDraw/city.vue'
 import gridPage from './prizeDraw/grid.vue'
 import slotMachinePage from './prizeDraw/slotMachine.vue'
 import { ref } from 'vue'
-import { getNumByLotteryId } from '@/api/mall/prize'
 
 const emit = defineEmits(['success'])
 const props = defineProps({
@@ -36,13 +34,6 @@ const props = defineProps({
   }
 })
 
-// 获取抽奖次数
-const luckyDrawsNum = ref(0)
-const getLuckyNum = async () => {
-  luckyDrawsNum.value = await getNumByLotteryId(props.lotteryId)
-}
-getLuckyNum()
-
 // 抽中奖品信息
 const showDialog = ref(false)
 const prizeData = ref({})
@@ -50,7 +41,6 @@ const endCallback  = (value) => {
   console.log(value.prize, '抽中的奖品')
   prizeData.value = value.prize
   showDialog.value = true
-  getLuckyNum()
 }
 
 // const handleReceive = () => {

+ 1 - 3
src/views/mall/components/prizeDraw/grid.vue

@@ -9,7 +9,6 @@
       :blocks="blocks"
       :buttons="buttons"
       :default-config="defaultConfig"
-      :disabled="true"
       class="prizeDraw"
       @start="startCallback"
       @end="endCallback"
@@ -23,7 +22,7 @@ import { getPrizeByLotteryId } from '@/api/mall/prize'
 import Snackbar from '@/plugins/snackbar'
 import { ref } from 'vue'
 const emit = defineEmits(['start', 'end'])
-const props = defineProps({ lotteryId: [Number, String], disabled: [Number, Boolean] })
+const props = defineProps({ lotteryId: [Number, String] })
 
 const myLucky = ref()
 // 背景样式
@@ -75,7 +74,6 @@ const getPrizeData = async (lotteryId) => {
 if (props.lotteryId) getPrizeData()
 
 const startCallback = () => {
-  if (props.disabled) return Snackbar.warning('抽奖次数已用完!')
   emit('start')
   // 调用抽奖组件的play方法开始游戏
   myLucky.value.play()

+ 1 - 3
src/views/mall/components/prizeDraw/slotMachine.vue

@@ -11,7 +11,6 @@
       accelerationTime="1000"
       decelerationTime="10000"
       :default-config="defaultConfig"
-      :disabled="true"
       class="prizeDraw"
       @start="startCallback"
       @end="endCallback"
@@ -31,7 +30,7 @@ import { getPrizeByLotteryId } from '@/api/mall/prize'
 import Snackbar from '@/plugins/snackbar'
 import { ref } from 'vue'
 const emit = defineEmits(['start', 'end'])
-const props = defineProps({ lotteryId: [Number, String], disabled: [Number, Boolean] })
+const props = defineProps({ lotteryId: [Number, String] })
 
 const myLucky = ref()
 // 背景样式
@@ -73,7 +72,6 @@ const getPrizeData = async (lotteryId) => {
 if (props.lotteryId) getPrizeData()
 
 const startCallback = () => {
-  if (props.disabled) return Snackbar.warning('抽奖次数已用完!')
   emit('start')
   // 调用抽奖组件的play方法开始游戏
   myLucky.value.play()