Browse Source

扫码查看幸运数字刷新

hwb0 3 năm trước cách đây
mục cha
commit
f8bac09d6f
1 tập tin đã thay đổi với 104 bổ sung42 xóa
  1. 104 42
      pages/lucky/index.vue

+ 104 - 42
pages/lucky/index.vue

@@ -76,15 +76,23 @@
 
 		<pay-popup :pay-show="payShow" :pay-info="payInfo" @close="close" @success="getDetailInfo" />
 
-		<u-popup :show="showNull" :round="10" mode="center" :safeAreaInsetBottom="false" overlayOpacity="0.8" @touchmove.prevent.stop>
+		<u-popup :show="showNull" :round="10" mode="center" :safeAreaInsetBottom="false" overlayOpacity="0.8"
+			@touchmove.prevent.stop>
 			<view class="null-prize">
 				<view class="title">该盲票已兑奖</view>
 				<navigator open-type="exit" target="miniProgram" hover-class="none" class="btn">确认</navigator>
 			</view>
 		</u-popup>
 
-		<hch-poster ref="hchPoster" @cancel="handleCancel" :posterData.sync="posterData" @previewImage='previewImage'
-			@canvasConfirm="toIndex" />
+		<u-popup :show="showAction" :round="10" mode="center" :safeAreaInsetBottom="false" overlayOpacity="0.8"
+			@touchmove.prevent.stop>
+			<view class="null-prize">
+				<view class="title">该盲票未激活</view>
+				<navigator open-type="exit" target="miniProgram" hover-class="none" class="btn">确认</navigator>
+			</view>
+		</u-popup>
+
+		<hch-poster ref="hchPoster" :posterData.sync="posterData" />
 	</view>
 </template>
 
@@ -116,6 +124,7 @@
 				picUrlArr: [],
 				boxInfo: {},
 				prizeList: [],
+				showAction: false
 			};
 		},
 
@@ -172,6 +181,9 @@
 							this.showNull = true
 							this.luckyShow = false
 						}
+					} else if (res.code == 1023) {
+						this.showAction = true
+						this.luckyShow = false
 					} else {
 						uni.$u.toast('该盲票不存在!');
 						setTimeout(() => {
@@ -186,23 +198,24 @@
 			},
 
 			getDetailInfo() {
-				this.payShow = false
+				let _this = this
+				_this.payShow = false
 				uni.showLoading({
 					title: '加载中'
 				});
 				$http.post('/api/v1/mp/user/ticket/queryLuckyNum', {
-					serialNo: this.serialNo,
+					serialNo: _this.serialNo,
 					noToken: true
 				}).then(res => {
 					uni.hideLoading();
 					if (res.code == 0) {
-						this.info = res.data
-						let num = res.data.plainLuckyNum
-						this.posterData.num.text =
-							this.posterData = {
+						if (res.data.status == 2) {
+							_this.info = res.data
+							let num = res.data.plainLuckyNum
+							_this.posterData = {
 								poster: {
 									//根据屏幕大小自动生成图片背景大小
-									url: env.filePublic + this.info.picUrl, //图片地址
+									url: env.filePublic + _this.info.picUrl, //图片地址
 									r: 10, //圆角半径
 									w: 300, //图片宽度
 									h: 480, //图片高度
@@ -241,6 +254,72 @@
 									align: 'center'
 								},
 							}
+						} else {
+							let num = 0
+							let time = setInterval(() => {
+								num++
+								uni.showLoading({
+									title: '加载中'
+								});
+								$http.post('/api/v1/mp/user/ticket/queryLuckyNum', {
+									serialNo: _this.serialNo,
+									noToken: true
+								}).then(ele => {
+									if (ele.data.status == 2) {
+										uni.hideLoading();
+										clearInterval(time)
+										_this.info = res.data
+										let num = res.data.plainLuckyNum
+										_this.posterData = {
+											poster: {
+												//根据屏幕大小自动生成图片背景大小
+												url: env.filePublic + _this.info.picUrl, //图片地址
+												r: 10, //圆角半径
+												w: 300, //图片宽度
+												h: 480, //图片高度
+												p: 20 //图片内边距padding
+											},
+											square3: {
+												x: 100,
+												y: 100,
+												r: 0, //圆角半径
+												w: 240, //宽度
+												h: 180, //高度
+												mt: 65
+											},
+											title: {
+												text: "幸运数字", //文本
+												fontSize: 20, //字体大小
+												color: "#000", //颜色
+												lineHeight: 25, //行高
+												mt: 20, //margin-top
+												align: 'center'
+											},
+											num: {
+												text: num + '', //文本
+												fontSize: 40, //字体大小
+												color: "#fff", //颜色
+												lineHeight: 25, //行高
+												mt: 20, //margin-top
+												align: 'center'
+											},
+											txt: {
+												text: res.data.title, //文本
+												fontSize: 16, //字体大小
+												color: "#000", //颜色
+												lineHeight: 25, //行高
+												mt: 20, //margin-top
+												align: 'center'
+											},
+										}
+									}
+								})
+								if (num == 10) {
+									uni.hideLoading();
+									clearInterval(time)
+								}
+							}, 1000)
+						}
 					}
 				}).catch(() => {
 					uni.hideLoading();
@@ -303,33 +382,9 @@
 				})
 			},
 
-			screen() {
-
-			},
-
-			toIndex() {
-				uni.switchTab({
-					url: '/pages/index/index'
-				})
-			},
-
-			previewImage() {
-
-			},
-
 			saveImg() {
 				this.$refs.hchPoster.posterShow()
 			},
-
-			handleCancel() {
-
-			},
-
-			toIndex() {
-				// uni.switchTab({
-				// 	url: '/pages/index/index'
-				// })
-			},
 		}
 	}
 </script>
@@ -345,7 +400,7 @@
 			background-color: #fff;
 
 			.luck-info-image {
-				margin-bottom: 30rpx;
+				// margin-bottom: 30rpx;
 
 				.image1 {
 					width: 400rpx;
@@ -354,9 +409,9 @@
 				}
 
 				.image2 {
-					width: 450rpx;
-					height: 450rpx;
-					margin-top: -286rpx;
+					width: 700rpx;
+					height: 700rpx;
+					margin-top: -446rpx;
 					// padding-bottom: 50rpx;
 				}
 			}
@@ -370,6 +425,7 @@
 					padding: 0 26rpx;
 					color: #666666;
 					text-align: center;
+					border-radius: 10rpx;
 					background: rgba(255, 109, 28, 0.2);
 				}
 			}
@@ -380,7 +436,10 @@
 				.title {
 					line-height: 68rpx;
 					font-size: 48rpx;
-					margin-bottom: 36rpx;
+					color: #FA6401;
+					font-size: 60rpx;
+					font-weight: bold;
+					margin-bottom: 72rpx;
 				}
 
 				.name {
@@ -424,10 +483,13 @@
 
 			.luck-info-num {
 				position: absolute;
-				top: -56rpx;
+				top: -280rpx;
 				width: 100%;
-				font-size: 80rpx;
-				color: #FFFFFF;
+				font-size: 260rpx;
+				font-family: LucidaSans-Demi, LucidaSans;
+				color: #FFBD4E;
+				text-shadow: 1px 1px rgba(255, 255, 255, .7);
+				font-weight: bold;
 			}
 
 			.luck-info-close {