duanshenglang 5 bulan lalu
induk
melakukan
876687b7e8
1 mengubah file dengan 22 tambahan dan 13 penghapusan
  1. 22 13
      lottery/lottery.html

+ 22 - 13
lottery/lottery.html

@@ -213,7 +213,8 @@
   }
 
   .el-dialog__body {
-    height: 260px;
+    height: auto;
+    max-height: 260px;
     overflow-y: auto;
   }
 
@@ -530,11 +531,11 @@
                 oninput="value=value.replace(/[^\d]/g,'')"
                 @blur="$event => {getInfoForm.phone = Number($event.target.value) || '';}"></el-input>
             </el-form-item>
-            <el-form-item label="地址:">
+            <el-form-item label="地址:" v-if="!preOnlyPhone">
               <el-cascader v-model="cityData" :options="transformedData" @change="handleInfoCity">
               </el-cascader>
             </el-form-item>
-            <el-form-item label="意向车型:">
+            <el-form-item label="意向车型:" v-if="!preOnlyPhone">
               <el-select v-model="getInfoForm.intenModel" placeholder="请选择">
                 <el-option v-for="item in allCarList" :key="item" :label="item" :value="item">
                 </el-option>
@@ -625,6 +626,7 @@
           intervalId: null,
           showRuleDialog: false,
           preFormType: null,
+          preOnlyPhone: null,
           showError: false,
           errorMsg: '',
           dialogTitle: ""
@@ -797,6 +799,7 @@
                 this.shareCover = data.cover
                 this.preFormType = data.preFormType
                 if (data.preForm && !data.isSubmit && this.getInfoForm.buyCar !== 0) {
+                  this.preOnlyPhone = data.preOnlyPhone
                   if (this.preFormType) {
                     this.dialogTitle = '五菱试驾体验报名'
                   } else {
@@ -1015,8 +1018,12 @@
             this.currentIndex = 0
             let externalUserid = this.getQueryParam('externalUserid')
             let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
-            const headers = new Headers();
-            headers.append('police', 110);
+            const headers = new Headers()
+            headers.append('police', 110)
+            // 开始转圈
+            this.intervalId = setInterval(() => {
+              this.currentIndex = (this.currentIndex + 1) % 9
+            }, 200); // 每 200 毫秒转一次
             fetch(this.httpUrl + `/scrm/v1/wxcp-raffle/p/lottery?externalUserid=${externalUserid}&openId=${openId}&bId=${this.bId}`, {
               method: 'GET',
               headers: headers
@@ -1026,11 +1033,17 @@
               }).then(result => {
                 let { data, code, msg } = result
                 if (code === 1) {
-                  this.stopLottery()
                   this.prizeData = data
-                  this.showPrizeDialog = true
-                  this.raffleInfo();
-                  this.raffleRecord();
+                  // 2. 添加等待逻辑
+                  const checkInterval = setInterval(() => {
+                    if (this.currentIndex >= 8) {
+                      clearInterval(checkInterval)
+                      this.showPrizeDialog = true
+                      this.raffleInfo()
+                      this.raffleRecord()
+                      this.stopLottery() // 停止动画
+                    }
+                  }, 100) // 每100ms检查一次
                 } else {
                   this.stopLottery()
                   this.$message({
@@ -1038,10 +1051,6 @@
                   })
                 }
               })
-            // 开始转圈
-            this.intervalId = setInterval(() => {
-              this.currentIndex = (this.currentIndex + 1) % 9;
-            }, 200); // 每 200 毫秒转一次
           }
         },
         // 停止抽奖