| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537 | <template>	<view class="box">		<!-- 自定义导航 -->		<view class="zdyNavBox">			<view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>			<view class="zdyNav">				<view class="zdyNavLeft">					<image src="../../static/img/nav_icon_back.png" mode="aspectFit" class="backImg" @click="goback">					</image>				</view>				<view class="zdyNavTitle">活动</view>				<image v-if="iOSInfo.indexOf('Q021')!=-1||!iOSInfo" src="../../static/img/icon_nav_add.png" mode="aspectFit" class="addImg" @click="goAdd"></image>				<view v-else style="width: 50px;"></view>			</view>		</view>		<view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>		<view style="height: 44px;"></view>		<view class="tab">			<view class="tabLine" :class="{tabActive:tabIndex==''}" @click="tabClick('')">全部</view>			<view class="tabLine" :class="{tabActive:tabIndex=='未启用'}" @click="tabClick('未启用')">未启用</view>			<view class="tabLine" :class="{tabActive:tabIndex=='未开始'}" @click="tabClick('未开始')">未开始</view>			<view class="tabLine" :class="{tabActive:tabIndex=='进行中'}" @click="tabClick('进行中')">进行中</view>			<view class="tabLine" :class="{tabActive:tabIndex=='已结束'}" @click="tabClick('已结束')">已结束</view>		</view>		<view class="conBox">			<view class="itemHistory" v-for="(item,index) in itemData" :key="index">				<image :src="item.Img" mode="" class="itemImg" @click="goDetail(item.ID)"></image>				<view class="timeBox">					<image v-if="item.state=='进行中'" src="../../static/img/bg_huangse.png" mode="" class="state"></image>					<image v-if="item.state=='未开始'" src="../../static/img/bg_hongse.png" mode="" class="state"></image>					<image v-if="item.state=='未启用'" src="../../static/img/bg_weiqiyong.png" mode="" class="state">					</image>					<image v-if="item.state=='已结束'" src="../../static/img/bg_jieshu.png" mode="" class="state"></image>					<view class="time" v-if="item.StartTime">{{item.StartTime.slice(0,10)}}-{{item.EndTime.slice(0,10)}}					</view>				</view>				  <view class="groupType" v-if="item.GroupType==1">拼团</view>				<view class="name">{{item.ActivityName}}</view>				<view class="btns">					<view class="btnBox">						<view v-if="iOSInfo.indexOf('Q022')!=-1 || iOSInfo.indexOf('Q023')!=-1 || iOSInfo.indexOf('Q024')!=-1||!iOSInfo" class="moreBox">							<view class="btn" style="width: 120rpx;" @click="changeMore(item)">更多</view>														<view class="moreBtn" v-if="item.showMoreBtn==true">								<view v-if="iOSInfo.indexOf('Q022')!=-1||!iOSInfo" class="more" @click="goEdit(item.ID)">									<image src="../../static/img/icon_bianji.png" mode="" class="btnImg"></image>									<view class="btn2">编辑</view>								</view>								<view v-if="(iOSInfo.indexOf('Q023')!=-1||!iOSInfo) && item.state=='未启用'" class="more" @click="open(item)">									<image src="../../static/img/icon_tingyong.png" mode="" class="btnImg"></image>									<view class="btn2">启用</view>								</view>								<view v-if="(iOSInfo.indexOf('Q024')!=-1||!iOSInfo) && item.state=='进行中'" class="more" @click="stop(item)" v-else>									<image src="../../static/img/icon_tingyong.png" mode="" class="btnImg"></image>									<view class="btn2">停用</view>								</view>															</view>													</view>						<view v-if="iOSInfo.indexOf('Q025')!=-1||!iOSInfo" class="btn" @click="goSign(item)">报名详情</view>						<view v-if="iOSInfo.indexOf('Q028')!=-1||!iOSInfo" class="btn" @click="goStatis(item)">数据统计</view>						<view class="btn" style="width: 120rpx;" @click="goshare(item)" >分享</view>					</view>									</view>			</view>			<!-- 上拉 加载更多 -->			<view class="noMore" v-if="noMoreShow && (itemData.length!=0)">没有更多数据</view>			<!-- 无数据空白页 -->			<nodata v-if="itemData.length==0"></nodata>		</view>	</view></template><script scoped>	import nodata from '../../components/nodata/nodata.vue'	export default {		components: {			nodata,		},		data() {			return {				iStatusBarHeight: '',				page: 1,				itemData: [],				noMoreShow: false,				tabIndex: '',                type:'',				iOSInfo:'',			}		},		// onBackPress(options){		// 	if (options.from === 'navigateBack') {		// 	        return false		// 	    }		// 	console.log(options)		// 	console.log("返回")		// 	return true; 		// },		onLoad(opt) {			this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;			this.page = 1			this.myOrderCoupon();			this.type=opt.type						 /* var qxnum=uni.getStorageSync("quanxian");			 if(qxnum==1){				 this.iOSInfo = JSON.parse(JSON.stringify(window.iOSInfo));			 }else if(qxnum==2){				 window.getAndroid=this.getAndroid;			 } */			 this.getpermission()		},		methods: {			getpermission(){				this.$http('openH5ShopHelpSheetOrder/permission', {					 					},'POST').then(res => {												this.iOSInfo=res.data;											})			},			getAndroid(e){				this.iOSInfo=e					},			goAdd(){				uni.navigateTo({					url:'choice?type=2'				})			},			goshare(item){				//app交互				item.groupType=item.GroupType;				console.log(item)				var standalone = window.navigator.standalone				var userAgent = window.navigator.userAgent.toLowerCase()				var safari = /safari/.test(userAgent)				var ios = /iphone|ipod|ipad|mac/.test(userAgent)				var android = /android/.test(userAgent)				if (ios) {					 if ( true) {//!standalone&& !safari					   window.webkit.messageHandlers.goShare.postMessage(item)					 }				} else if (android) {					 window.android.share(JSON.stringify(item))				}			},			goback(){				if(this.type==2){					uni.navigateBack()				}else{					//app交互					var standalone = window.navigator.standalone					var userAgent = window.navigator.userAgent.toLowerCase()					var safari = /safari/.test(userAgent)					var ios = /iphone|ipod|ipad|mac/.test(userAgent)					var android = /android/.test(userAgent)					if (ios) {									 if ( true) {//!standalone&& !safari									   window.webkit.messageHandlers.goMyNav.postMessage(null)									 }					} else if (android) {									 window.android.postMessage()					}				}			   			},			open(item) {				var that = this;				uni.showLoading({					title: '加载中'				});				that.$http('openH5SetTheGuest/updateActivityState', {					id: item.ID,					clState: 2				}, 'POST').then(res => {					uni.showToast({						title: '成功',						icon: 'none',						duration: 3000					});											that.page = 1;					that.myOrderCoupon()				})						},			stop(item) {				var that = this;				uni.showModal({					title: '提示',					content: '停用后,用户将不可见此活动',					success: function(res) {						if (res.confirm) {							uni.showLoading({								title: '加载中'							});							that.$http('openH5SetTheGuest/updateActivityState', {								id: item.ID,								clState: 1							}, 'POST').then(res => {								uni.showToast({									title: '成功',									icon: 'none',									duration: 3000								});								that.page = 1;								that.myOrderCoupon()							})						} else if (res.cancel) {						}					}				});			},			changeMore(item) {				item.showMoreBtn = !item.showMoreBtn			},			tabClick(state) {				this.tabIndex = state;				this.page = 1;				this.myOrderCoupon()			},			goDetail(id) {				uni.navigateTo({					url: 'activityDetail?id=' + id				})			},			goEdit(id) {				uni.navigateTo({					url: 'eadit?id=' + id				})			},			goSign(item) {				uni.navigateTo({					url: 'signJkDetail?activity=' + JSON.stringify(item)				})			},			goStatis(item) {				uni.navigateTo({					url: 'statistics?activity=' + JSON.stringify(item)				})			},			myOrderCoupon() {				uni.showLoading({					title: '加载中'				})				this.$http('openH5SetTheGuest/getActivity', {					page: this.page,					limit: 10,					state: this.tabIndex				}, 'GET').then(res => {					uni.hideLoading();					// var list = res.data.Items					var list = res.data.Items					list.forEach((item, index) => {						item.showMoreBtn = false					})					if (this.page == 1) {						this.itemData = list					} else {						this.itemData = this.itemData.concat(list)					}					if (list.length < 10) {						this.noMoreShow = true					} else {						this.noMoreShow = false					}				})			},		},		// 下拉刷新 上拉加载更多		onPullDownRefresh() {			this.page = 1			this.myOrderCoupon()			setTimeout(function() {				uni.stopPullDownRefresh();			}, 1000);		},		onReachBottom() {			this.page++;			this.myOrderCoupon()		},	}</script><style scoped lang="less">	.box {		background: #F4F5F7;		min-height: 100vh;	}.groupType{		width: 76rpx;color: #FFFFFF;		height: 36rpx;line-height: 36rpx;text-align: center;		background: linear-gradient(109deg, #FD5A04 0%, #FD0900 100%);		border-radius: 0rpx 10rpx 0rpx 10rpx;		position: absolute;		top: 0;right: 0;font-size: 24rpx;	}	.zdyNavBox {		width: 100vw;		background: #FFFFFF;		position: fixed;		top: 0;		left: 0;		z-index: 9999999;	}	.zdyNav {		height: 44px;		display: flex;		justify-content: space-between;		align-items: center;	}	.backImg {		width: 44rpx;		height: 44rpx;		margin-left: 10rpx;		margin-right: 20rpx;	}	.homeImg {		width: 44rpx;		height: 44rpx;	}	.zdyNavLeft {		display: flex;		align-items: center;	}	.zdyNavTitle {		height: 44px;		background: #FFFFFF;		text-align: center;		font-size: 34rpx;		line-height: 44px;	}	.addImg {		width: 36rpx;		height: 36rpx;		margin-right: 20rpx;	}	.tab {		background: #FFFFFF;		display: flex;		justify-content: space-between;		line-height: 87rpx;		position: fixed;		width: calc(100vw - 100rpx);		padding-left: 50rpx;		padding-right: 50rpx;		height: 87rpx;		z-index: 11;		border-top: 1rpx solid #EEEEEE;	}	.tabLine {		font-size: 32rpx;		color: #666666;		text-align: center;	}	.tabActive {		color: #3F90F7;		font-weight: bold;		border-bottom: 4rpx solid #3F90F7;	}	.conBox {		padding-top: 107rpx;	}	.itemHistory {		margin: 0rpx 24rpx 20rpx;		background-color: #FFFFFF;		border-radius: 10rpx;		position: relative;	}	.itemImg {		height: 280rpx;		width: 702rpx;		border-radius: 10rpx 10rpx 0px 0px;		display: block;			}	.timeBox {		display: flex;		margin-top: -52rpx;		align-items: flex-end;		position: relative;	}	.state {		width: 102rpx;		height: 53rpx;					}	.time {		padding: 5rpx 10rpx;		color: #FFFFFF;		font-size: 24rpx;		background: rgba(0, 0, 0, 0.5);		margin-left: -8rpx;		border-radius: 0 10rpx 0 0;			}	.name {		padding: 24rpx 20rpx;		color: #333333;		font-size: 28rpx;		background: #FFFFFF;		border-radius: 0 0 10rpx 10rpx;		border-bottom: 1rpx solid #eeeeee;	}	.btns {		position: relative;	}	.btnBox {		padding: 26rpx 20rpx;		border-radius: 0 0 10rpx 10rpx;		display: flex;		justify-content: flex-end;		align-items: center;	}	.moreBtn {		background-image: url("../../static/img/bg_more.png");		background-size: 100% 100%;		width: 196rpx;		height: 234rpx;		position: absolute;		z-index: 999;		top: 84rpx;	}	.more {		display: flex;		align-items: center;		padding: 32rpx 46rpx 0;	}	.btnImg {		width: 32rpx;		height: 32rpx;		margin-right: 15rpx;	}	.btn {		font-size: 28rpx;		color: #333333;		width: 160rpx;		height: 60rpx;		border-radius: 30rpx;		border: 1rpx solid #DDDDDD;		text-align: center;		line-height: 60rpx;		margin-left: 17rpx;	}	.btn2 {		font-size: 28rpx;		color: #333333;		height: 60rpx;		border-radius: 30rpx;		text-align: center;		line-height: 60rpx;	}	.noMore {		text-align: center;		line-height: 50rpx;		color: #999999;		font-size: 28rpx;	}</style>
 |