Bladeren bron

盲票分享

hwb0 3 jaren geleden
bovenliggende
commit
7ff0c3a0f6

BIN
packageGoods/static/list_down.png


BIN
packageGoods/static/list_null.png


BIN
packageGoods/static/list_up.png


+ 61 - 12
pages/ticketBox/detail.vue

@@ -39,7 +39,7 @@
 					<image src="../../static/ticketBox/ticket_block.png" mode="scaleToFill"></image>
 					<view class="txt">¥{{ $numberFormat(info.salePrice) }}</view>
 				</view>
-				<view class="prize-price-past" v-if="info.originPrice != 0">原价:¥{{ $numberFormat(info.originPrice) }}/个</view>
+				<view class="prize-price-past" v-if="info.originPrice != 0">原价:¥{{ $numberFormat(info.originPrice) }}</view>
 			</view>
 			
 			<!-- 开启盲票 -->
@@ -49,7 +49,10 @@
 					<image src="../../static/ticketBox/ticket_btn_center.png" mode="scaleToFill"></image>
 					<view class="ticket-btn-center-txt">刮开盲票</view>
 				</view>
-				<image class="ticket-btn-share" src="../../static/ticketBox/ticket_share.png" mode="scaleToFill"></image>
+				<view class="ticket-btn-share flex">
+					<image src="../../static/ticketBox/ticket_share.png" mode="scaleToFill" @click="toShare"></image>
+					<button type="default" open-type="share" v-if="loginState"></button>
+				</view>
 			</view>
 		</view>
 		
@@ -126,7 +129,9 @@
 				prizeIndex: 0,
 				contnetHeight: 0,
 				btnFixed: false,
-				prizeInfo: {}
+				prizeInfo: {},
+				userInfo: {},
+				loginState: false,
 			};
 		},
 
@@ -166,10 +171,14 @@
 		},
 		
 		onShow() {
+			this.loginState = uni.getStorageSync('token') ? true : false
 			this.pagesNum = getCurrentPages().length
 			if (this.boxId) {
 				this.getDetail()
 			}
+			if(this.loginState) {
+				this.getBaseInfo()
+			}
 		},
 
 		methods: {
@@ -254,15 +263,16 @@
 			},
 
 			toShare() {
-				if (!uni.getStorageSync('token')) {
-					uni.navigateTo({
-						url: "/pages/login/index"
-					})
-					return
-				}
-				uni.navigateTo({
-					url: `/packageOperate/share/index?boxId=${ this.info.boxId }`
-				})
+				this.getBaseInfo()
+				// if (!uni.getStorageSync('token')) {
+				// 	uni.navigateTo({
+				// 		url: "/pages/login/index"
+				// 	})
+				// 	return
+				// }
+				// uni.navigateTo({
+				// 	url: `/packageOperate/share/index?boxId=${ this.info.boxId }`
+				// })
 			},
 
 			toIndex() {
@@ -296,6 +306,23 @@
 						url: `/packagePrize/goods/detail?id=424`
 					})
 				}
+			},
+			
+			getBaseInfo() {
+				$http.post('/api/v1/mp/user/getLoginUserinfo', {}).then(res => {
+					uni.hideLoading();
+					if (res.code == 0) {
+						this.userInfo = res.data
+					}
+				})
+			},
+		},
+		
+		onShareAppMessage(res) {
+			return {
+				title: '分享盲票',
+				path: `/pages/ticketBox/detail?boxId=${ this.info.boxId }&userId=${ this.userInfo.userId }&type=1`,
+				type: 2,
 			}
 		}
 	}
@@ -456,8 +483,30 @@
 			}
 			
 			&-share {
+				position: relative;
 				width: 110rpx;
 				height: 110rpx;
+				
+				image {
+					position: absolute;
+					width: 110rpx;
+					height: 110rpx;
+				}
+				
+				/deep/ button {
+					position: absolute;
+					z-index: 5;
+					width: 110rpx;
+					height: 110rpx;
+					background: none;
+					border: none !important;
+				}
+				/deep/ uni-button:after {
+					border: none !important;
+				}
+				/deep/ button:after {
+					border: none !important;
+				}
 			}
 		}
 	}

BIN
static/public/goods_coin.png


BIN
static/ticketBox/ticket_block.png