lilei 4 éve
szülő
commit
ba3c6f22a6
2 módosított fájl, 35 hozzáadás és 68 törlés
  1. 9 0
      api/luckyDraw.js
  2. 26 68
      pagesA/luckDraw/luckDraw.vue

+ 9 - 0
api/luckyDraw.js

@@ -50,4 +50,13 @@ export const receive = params => {
     method: 'post',
 	data: params
   })
+};
+
+// 获奖记录
+export const queryWinRecord = params => {
+  return axios.request({
+    url: `luckyDraw/queryWinRecord/${params.pageNo}/${params.pageSize}`,
+    method: 'post',
+	data: {}
+  })
 };

+ 26 - 68
pagesA/luckDraw/luckDraw.vue

@@ -39,9 +39,9 @@
 				  <view class="marquee-list" :class="{'animate-up': animateUp}">
 					<view class="hjList_item" v-for="(item, index) in hjList" :key="index">
 						恭喜
-						<text>{{ item.phone }}</text>
+						<text>{{ item.customerMobile }}</text>
 						获得
-						<text>{{ item.prize }}</text>
+						<text>{{ item.prizeType == 'GOLD' ? (item.prizeDesc + '乐豆') : item.prizeDesc }}</text>
 					</view>
 				  </view>
 				</view>
@@ -146,7 +146,7 @@
 <script>
 import AlmostLottery from '@/components/almost-lottery/almost-lottery.vue';
 import { clearCacheFile } from '@/almost-utils/almost-utils.js';
-import { findCustomerTimes, buyDrawTimes, takeOut } from '@/api/luckyDraw.js'
+import { findCustomerTimes, buyDrawTimes, takeOut, queryWinRecord } from '@/api/luckyDraw.js'
 import { existPayPwd } from '@/api/order.js'
 export default {
 	name: 'Home',
@@ -177,53 +177,7 @@ export default {
 			animateUp: false,
 			timer: null,
 			scrollTextHeight: 0,
-			hjList: [
-				{
-					time: '2019年1月',
-					phone: '1855****7766',
-					prize: '20乐豆'
-				},
-				{
-					time: '2019年2月',
-					phone: '1855****7766',
-					prize: 'iphone1164G一部'
-				},
-				{
-					time: '2019年3月',
-					phone: '1855****7766',
-					prize: '蓝牙耳机一部'
-				},
-				{
-					time: '2019年4月',
-					phone: '1855****7766',
-					prize: 'iphone1164G一部'
-				},
-				{
-					time: '2019年5月',
-					phone: '1855****7766',
-					prize: '20乐豆'
-				},
-				{
-					time: '2019年6月',
-					phone: '1855****7766',
-					prize: '20乐豆'
-				},
-				{
-					time: '2019年7月',
-					phone: '1855****7766',
-					prize: '洗衣液一桶'
-				},
-				{
-					time: '2019年8月',
-					phone: '1855****7766',
-					prize: '15乐豆'
-				},
-				{
-					time: '2019年9月',
-					phone: '1855****7766',
-					prize: '15乐豆'
-				}
-			], // 已获奖人员
+			hjList: [], // 已获奖人员
 			showLottery: false, // 是否显示抽奖弹框
 			winTypes: '', // 抽奖弹框类型
 			payPws: '', // 支付密码
@@ -252,23 +206,30 @@ export default {
 			weightArr: []
 		};
 	},
-	watch: {
-		showLottery(newValue, oldValue) {
-			if(!newValue){
-				console.log(!newValue)
-				this.handleInitCanvas()
-			}
-		}
-	},
 	methods: {
 		// 重新生成
 		handleInitCanvas() {
 			clearCacheFile();
 			this.targetName = '';
-			this.prizeIndex = -1
-			this.$refs.lottery.targetAngle = 0
-			// this.prizeList = [];
-			// this.getPrizeList();
+			this.prizeList = [];
+			this.getPrizeList();
+		},
+		// 获取亦获奖列表
+		getDrawList(){
+			queryWinRecord({
+				pageNo: 1,
+				pageSize: 1000
+			}).then(res => {
+				if(res.status == 200){
+					this.hjList = res.data.list
+					setTimeout(()=>{
+						if(!this.timer && this.hjList.length){
+							this.getScrollTextHeight()
+							this.timer = setInterval(this.scrollAnimate, 2000);
+						}
+					},300)
+				}
+			})
 		},
 		// 获取奖品列表
 		async getPrizeList() {
@@ -372,6 +333,7 @@ export default {
 				}
 				// 刷新免费抽奖次数
 				this.getCustomerTimes()
+				this.getDrawList()
 			})
 		},
 		// 本次抽奖结束
@@ -402,8 +364,6 @@ export default {
 			}
 			
 			this.showLottery = true
-			console.log(this.reTimes)
-			console.log(this.targetName);
 		},
 		// 抽奖转盘绘制完成
 		handleDrawFinish(res) {
@@ -492,12 +452,10 @@ export default {
 		},
 	},
 	onShow() {
-		if(this.scrollTextHeight == 0){
-			this.getScrollTextHeight()
-			this.timer = setInterval(this.scrollAnimate, 2000);
-		}
 		// 查询免费抽奖次数
 		this.getCustomerTimes()
+		// 查询亦获奖列表
+		this.getDrawList()
 	},
 	onLoad() {
 		this.luckDraw = this.$store.state.vuex_LuckDraw