浏览代码

Merge branch 'master' of http://47.98.226.240:3000/twt/wxThird

* 'master' of http://47.98.226.240:3000/twt/wxThird:
  分享
guo 2 年之前
父节点
当前提交
75d95af3d6
共有 4 个文件被更改,包括 199 次插入17 次删除
  1. 13 1
      pages/shop/confirm.vue
  2. 97 12
      pages/shop/goodsDetail.vue
  3. 54 3
      pages/user/user.vue
  4. 35 1
      utils/common.js

+ 13 - 1
pages/shop/confirm.vue

@@ -13,7 +13,9 @@
 				<view class="goodsPrice"> <span class="goodsPrice1">¥</span> {{goodsInfo.salePrice?goodsInfo.salePrice:goodsInfo.scribingPrice}}</view>
 				<view class="numJsbox">
 					<view class="numJj" @click="calculation(1)">-</view>
-					<view class="goodsnum">{{goodsnum}}</view>
+					<view class="goodsnum">
+					<input type="number" value="" v-model="goodsnum" class="goodsnumInput"/>
+					</view>
 					<view class="numJj" @click="calculation(2)">+</view>
 				</view>
 			</view>
@@ -427,6 +429,16 @@
 	font-size: 24rpx;
 	margin: 0 4rpx;
 }
+.goodsnumInput{
+	width: 88rpx;
+	height: 44rpx;
+	background: #F4F5F7;
+	line-height: 44rpx;
+	text-align: center;
+	font-weight: 500;
+	color: #333333;
+	font-size: 24rpx;
+}
 .numJsbox{
 	display: flex;
 }

+ 97 - 12
pages/shop/goodsDetail.vue

@@ -66,15 +66,15 @@
 				<view class="mealName">项目名称</view>
 				<view class="mealTopRight">
 					<view>数量</view>
-					<view style="padding-left: 44rpx;">有效期</view>
+					<view style="padding-left: 60rpx;">有效期</view>
 				</view>
 			</view>
 			<view class="itemlinebOX">
 				<view class="itemline" v-for="(item,index) in info.itemPackTimesDetails">
 					<view class="itemname">{{item.flowName}}</view>
 					<view>{{item.flowQty}}</view>
-					<view v-if="item.expireNumber">{{item.expireNumber}}个月</view>
-					<view v-else>永久</view>
+					<view class="expireNumber" v-if="item.expireNumber">{{item.expireNumber}}个月</view>
+					<view class="expireNumber" v-else>永久</view>
 				</view>
 			</view>
 		</view>
@@ -83,15 +83,15 @@
 				<view class="mealName">商品名称</view>
 				<view class="mealTopRight">
 					<view>数量</view>
-					<view style="padding-left: 44rpx;">有效期</view>
+					<view style="padding-left: 60rpx;">有效期</view>
 				</view>
 			</view>
 			<view class="itemlinebOX">
 				<view class="itemline" v-for="(item,index) in info.goodsPackTimesDetails">
 					<view class="itemname">{{item.flowName}}</view>
 					<view>{{item.flowQty}}</view>
-					<view v-if="item.expireNumber">{{item.expireNumber}}个月</view>
-					<view v-else>永久</view>
+					<view class="expireNumber" v-if="item.expireNumber">{{item.expireNumber}}个月</view>
+					<view class="expireNumber" v-else>永久</view>
 				</view>
 			</view>
 		</view>
@@ -109,10 +109,14 @@
 			<image src="../../static/timg/home.png" mode="" class="bottomImg"></image>
 			<view class="bottomTxt">首页</view>
 		</view>
-		<view class="bottomImgBox" style="margin-left: 20rpx;">
+		<!-- <view class="bottomImgBox" style="margin-left: 20rpx;" @click="sharewx">
 			<image src="../../static/timg/share.png" mode="" class="bottomImg"></image>
 			<view class="bottomTxt">分享</view>
-		</view>
+		</view> -->
+		<button open-type="share" class="bottomImgBox shareBtn" >
+			<image src="../../static/timg/share.png" mode="" class="bottomImg"></image>
+			<view class="bottomTxt">分享</view>
+		</button>
 		<view class="bottomBtn" @click="ljbuy">立即购买</view>
 		
 	</view>
@@ -211,16 +215,31 @@
 			this.id=opt.id;
 			//this.userInfo = uni.getStorageSync("userInfo");
 			this.userInfo=this.$store.state.userInfo;
-			this.wxOpenData=this.$store.state.wxOpenData;
-			this.openGoodsDetailById();
 			this.ext=this.$common.getExtStoreId();
+			if(this.userInfo){
+				this.wxOpenData=this.$store.state.wxOpenData;
+				this.openGoodsDetailById();
+			}else{
+				this.$common.automaticlogin().then(val => {
+					this.userInfo=this.$store.state.userInfo;
+					this.wxOpenData=this.$store.state.wxOpenData;
+					this.openGoodsDetailById();
+					console.log(this.userInfo)
+				})
+			}
+			
+			
+			
 		},
 		onShow() {
 			this.shopInfo=this.$store.state.ckshopInfo;
 			
-			console.log(this.shopInfo)
+			//console.log(this.shopInfo)
 		},
 		methods: {
+			sharewx(){
+				
+			},
 			ckShop(){
 				uni.navigateTo({
 					url:'ckshopList?goodsId='+this.id
@@ -342,7 +361,30 @@
 					  })
 			},
 			
-		}
+		},
+		onShareAppMessage(res) {
+			var img='';
+			if(this.info.ImgList.length>0){
+				img=this.info.ImgList[0].url
+			}
+			return {
+				title: this.info.name,
+				imageUrl:img,
+				path: 'pages/shop/goodsDetail?id=' + this.id,
+				success(res){
+					uni.showToast({
+						title:'分享成功'
+					})
+				},
+				fail(res){
+					uni.showToast({
+						title:'分享失败',
+						icon:'none',
+						duration: 3000
+					})
+				}
+			}
+		},
 	}
 </script>
 
@@ -439,6 +481,16 @@
 	font-size: 24rpx;
 	margin: 0 4rpx;
 }
+.goodsnumInput{
+	width: 88rpx;
+	height: 44rpx;
+	background: #F4F5F7;
+	line-height: 44rpx;
+	text-align: center;
+	font-weight: 500;
+	color: #333333;
+	font-size: 24rpx;
+}
 .numJsbox{
 	display: flex;
 }
@@ -550,6 +602,35 @@
 	padding-top: 20rpx;
 	padding-left: 40rpx;
 }
+.shareBtn{
+	width: 100rpx;
+	background: #FFFFFF;
+}
+button::after{
+ 	border: none;
+}
+button{
+	position: relative;
+	display: block;
+	margin-left: 0;
+	margin-right: 0;
+	padding-left: 0px;
+	padding-right: 0px;
+	box-sizing: border-box;
+	// font-size: 18px;
+	text-align: center;
+	text-decoration: none;
+	// line-height: 1;
+	line-height: 1.35;
+	// border-radius: 5px;
+	-webkit-tap-highlight-color: transparent;
+	overflow: hidden;
+	color: #000000;
+	background-color: #fff;
+	
+	height: 100%;
+	}
+
 .bottomBtn{
 	width: 450rpx;
 	height: 74rpx;
@@ -755,6 +836,10 @@
 	color: #333333;
 	font-size: 26rpx;
 }
+.expireNumber{
+	width: 110rpx;
+	text-align: right;
+}
 .authorizBox{
 		width: 100vw;
 		height: 100vh;

+ 54 - 3
pages/user/user.vue

@@ -142,13 +142,20 @@
 				<image src="../../static/img/big_rightArrow.png" mode="" class="big_rightArrow"></image>
 			</view>
 
-			<view class="rowBox" @click="gonavigateTo('invite')">
+			<!-- <view class="rowBox" @click="gonavigateTo('invite')">
 				<view class="leftView">
 					<image src="../../static/img/icon_me6.png" mode="" class="liftIcon"></image>
 					<view class="rowTitle">分享给好友</view>
 				</view>
 				<image src="../../static/img/big_rightArrow.png" mode="" class="big_rightArrow"></image>
-			</view>
+			</view> -->
+			<button open-type="share" class="rowBox" >
+				<view class="leftView">
+					<image src="../../static/img/icon_me6.png" mode="" class="liftIcon"></image>
+					<view class="rowTitle">分享给好友</view>
+				</view>
+				<image src="../../static/img/big_rightArrow.png" mode="" class="big_rightArrow"></image>
+			</button>
 
 			<view class="rowBox" @click="gonavigateTo('invite')">
 				<view class="leftView">
@@ -338,7 +345,26 @@
 			},
 
 		},
-
+       onShareAppMessage(res) {
+       
+       	return {
+       		title: this.wxOpenData.miniAppName,
+       		//imageUrl:img,
+       		path: 'pages/index/index',
+       		success(res){
+       			uni.showToast({
+       				title:'分享成功'
+       			})
+       		},
+       		fail(res){
+       			uni.showToast({
+       				title:'分享失败',
+       				icon:'none',
+       				duration: 3000
+       			})
+       		}
+       	}
+       },
 		// 下拉刷新
 		onPullDownRefresh() {
 
@@ -351,6 +377,31 @@
 </script>
 
 <style scoped>
+	button::after{
+	 	border: none;
+	}
+	button{
+		position: relative;
+		display: block;
+		margin-left: 0;
+		margin-right: 0;
+		padding-left: 0px;
+		padding-right: 0px;
+		box-sizing: border-box;
+		// font-size: 18px;
+		text-align: center;
+		text-decoration: none;
+		// line-height: 1;
+		line-height: 1.35;
+		// border-radius: 5px;
+		-webkit-tap-highlight-color: transparent;
+		overflow: hidden;
+		color: #000000;
+		background-color: #fff;
+		
+		height: 100%;
+		}
+	
 	.box {
 
 		width: 100vw;

+ 35 - 1
utils/common.js

@@ -1,4 +1,5 @@
-
+import $store from '../store'
+import request from '@/utils/request.js'
 const isUserId = function() {
 	var userId=uni.getStorageSync("wxOpenData").loginInfo.uid;
 	//console.log("userId---"+userId)
@@ -8,6 +9,38 @@ const isUserId = function() {
 		   })
 	 }
 }
+const automaticlogin = function() {
+	//console.log($store.state.userInfo)
+	var that=this;
+	const extConfig = uni.getExtConfigSync();
+	//console.log(extConfig)
+	
+	 return new Promise((resolve, reject) => {
+		 if($store.state.userInfo){
+			 resolve()
+		 }else{
+			uni.login({
+			  provider: 'weixin',
+			  success: function (loginRes) {
+			    //console.log(loginRes);
+				request.http('miniApp2/sys/getWxOpenID', {
+				   code:loginRes.code,
+				   unionId:extConfig.unionId
+				  },'GET').then(res => {
+					  $store.commit('mutationswxOpenData', res.data);
+					  if(res.data.loginInfo){
+					  	$store.commit('mutationsuserInfo', res.data.loginInfo.openUser)
+					  }
+					 resolve()
+				  })				
+			  }
+			}); 
+		 }
+		
+	 })
+	 //return Promise.resolve()
+	 
+}
 /* const uid =function() {
 	var userId=uni.getStorageSync("logodata").uid;
 	return
@@ -51,6 +84,7 @@ export default {
     commonData:{
         companyType:1,
     },
+	automaticlogin,
     isUserId,
 	getExtStoreId,
 	noMultipleClicks,      // 禁止多次点击