XSLu08042 4 days ago
parent
commit
8dc12e9554

+ 12 - 10
pages_company/coupon.vue

@@ -156,15 +156,13 @@ export default {
 	  	getPackagCateList(data).then(
 	  		res => {
 	  			if(res.code==200&&res.data&&res.data.length>0){
-	  				var cate={dictLabel:"全部",dictValue:0};
-	  				this.cates.push(cate);
-	  				this.cates=this.cates.concat(res.data);
-					this.cateId = 0
-					this.mescroll&&this.mescroll.resetUpScroll()
-	  			} else {
-					this.cateId = 0
-					this.dataList = []
-				}
+	  				this.cates=res.data;
+	  				this.cateId = res.data[0].dictValue;
+	  				this.mescroll&&this.mescroll.resetUpScroll()
+	  			}else {
+	  				this.cateId = 0
+	  				this.couponsList = []
+	  			}
 	  		},
 	  		err => {
 	  		}
@@ -250,7 +248,11 @@ export default {
 		})
 	},
     upCallback(page) {
-		console.log(page)
+		if(!this.cateId){
+			this.couponsList = []
+			this.mescroll.endBySize(0, 0);
+			return
+		}
       if (this.loading) return //阻止下次请求(false可以进行请求);
       if (this.loadend) return //阻止结束当前请求(false可以进行请求);
       this.loading = true

+ 7 - 5
pages_company/couponDetails.vue

@@ -80,18 +80,20 @@ export default {
 		popshow:false,
 		keyword:'',
 		phoneUser:{},
+		isShare: 0
     }
   },
   onLoad(options) {
 	console.log(options.id)
+	this.isShare = options.isShare || 0
 	this.id=JSON.parse(options.id);
 	this.CompanyUserInfo=uni.getStorageSync('CompanyUserInfo');
-	if(this.CompanyUserInfo&&JSON.stringify(this.CompanyUserInfo)!="{}"){
-		console.log(JSON.stringify(this.CompanyUserInfo))
-		uni.showShareMenu()
-	}else{
+	if(this.isShare==1){
 		uni.hideShareMenu()
 		if(!this.utils.isLogin()) return
+	}else{
+		console.log(JSON.stringify(this.CompanyUserInfo))
+		uni.showShareMenu()
 	}
 	this.getCouponIssueById();
   },
@@ -99,7 +101,7 @@ export default {
   onShareAppMessage(res) {
   	return {
   		title: this.item.couponName,
-  		path: `/pages_company/couponDetails?id=${this.item.id}`
+  		path: `/pages_company/couponDetails?isShare=1&id=${this.item.id}`
   	}
   },
   mounted: function() {

+ 5 - 0
pages_company/storeProductPackage.vue

@@ -254,6 +254,11 @@
 				mescroll.resetUpScroll()
 			},
 			upCallback(page) {
+				if(!this.cateId){
+					this.dataList = []
+					this.mescroll.endBySize(0, 0);
+					return
+				}
 				//联网加载数据
 				var that = this;
 				var data = {

+ 26 - 17
pages_company/storeProductPackageDetails.vue

@@ -91,7 +91,11 @@
 				 
 			</view>
 			<view class="btn-box">
-				<view class="btn buy" @click="buy">立即购买</view>
+				<view class="btn buy" @click="buy" v-if="isShare==1">立即购买</view>
+				<view class="btn buy" v-else>
+					分享
+					<button  class="share" data-name="shareBtn" open-type="share">分享</button>
+				</view>
 			</view>
 		</view>
 		<view class="message-box" v-if="messageShow">
@@ -118,18 +122,15 @@
 				products:[],
 				// 当前轮播的图片
 				activeBanner: 1,
-				 CompanyUserInfo:{}
+				 CompanyUserInfo:{},
+				 isShare: 0
 			};
 		},
 		onLoad(options) {
+			this.isShare = options.isShare || 0
 			this.CompanyUserInfo=uni.getStorageSync('CompanyUserInfo');
-			if(this.CompanyUserInfo&&JSON.stringify(this.CompanyUserInfo)!="{}"){
-				console.log(JSON.stringify(this.CompanyUserInfo))
-				uni.showShareMenu()
-			}else{
-				uni.hideShareMenu()
-			}
 			if (options.hasOwnProperty('q') && options.q) {
+				this.isShare=1
 				// 通过下面这步解码,可以拿到url的值
 				const url = decodeURIComponent(options.q)
 				this.url=url;
@@ -144,6 +145,12 @@
 				this.companyId = options.companyId;
 				this.companyUserId = options.companyUserId;
 			}
+			if(this.isShare==1){
+				console.log(JSON.stringify(this.CompanyUserInfo))
+				uni.hideShareMenu()
+			}else{
+				uni.showShareMenu()
+			}
 			// uni.showShareMenu({
 			// 	withShareTicket:true,
 			// 	//小程序的原生菜单中显示分享按钮,才能够让发送给朋友与分享到朋友圈两个按钮可以点击
@@ -156,15 +163,7 @@
 		onShareAppMessage(res) {
 			return {
 				title: this.package.title,
-				path: `/pages_company/storeProductPackageDetails?packageId=${this.package.packageId}`+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId,
-				imageUrl: this.package.imgUrl //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
-			}
-		},
-		//分享到朋友圈
-		onShareTimeline(res) {
-			return {
-				title: this.package.title,
-				query:'packageId='+this.package.packageId+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId,//页面参数
+				path: `/pages_company/storeProductPackageDetails?isShare=1&packageId=${this.package.packageId}`+"&companyId="+this.companyId+"&companyUserId="+this.companyUserId,
 				imageUrl: this.package.imgUrl //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
 			}
 		},
@@ -600,6 +599,7 @@
 				font-family: PingFang SC;
 				font-weight: bold;
 				color: #FFFFFF;
+				position: relative;
 				&:first-child{
 					margin-left: 0;
 				}
@@ -610,6 +610,15 @@
 					background: #2BC7B9;
 				}
 			}
+			.share{
+				display: inline-block;
+				position: absolute;
+				top: 0;
+				left: 0;
+				width: 100%;
+				height: 100%rpx;
+				opacity: 0;
+			}
 		}
 	}
 	.product-spec{