Browse Source

界面更新

yuxingxing 2 years ago
parent
commit
5fc01e2a0e
4 changed files with 157 additions and 146 deletions
  1. 1 1
      api/home.js
  2. 118 116
      components/shareRedPackets/index.vue
  3. 1 1
      pages/goods/goods_list_mall/index.vue
  4. 37 28
      pages/goods_details/index.vue

+ 1 - 1
api/home.js

@@ -163,5 +163,5 @@ export function postLoginAuth(data) {
 // 获取分享连接
 export function postLinkedUrl(data) {
 	// let url = "?code="+data.code+"&getPhoneNumberCode="+data.getPhoneNumberCode
-	return request.post("v1/linked/getLinkedUrl",data);
+	return request.post("v1/linked/getLinkedUser",data);
 }

+ 118 - 116
components/shareRedPackets/index.vue

@@ -1,15 +1,17 @@
 <template>
-	<view v-if="sharePacket.isState" class='sharing-packets' :class='sharePacket.isState && showAnimate ? "":"right"'>
+	<view v-if="sharePacket.isState" class='sharing-packets'
+		:class='sharePacket.isState && showAnimate ? "" : "right"'>
 		<view class='sharing-con' @click='goShare'>
 			<!-- <image :src="imgHost + '/statics/images/red-packets.png'" /> -->
 			<image src="@/static/images/red-packets.png" />
 			<view class='text font-color'>
-				<view>{{$t(`共富1580`)}}</view>
-				<view class='money'><text class='label'></text>{{sharePacket.priceName}}</view>
-				<view class='tip'>{{$t(`推广享红积分`)}}</view>
-				<!-- <view class='shareBut' open-type="share">{{$t(`立即分享`)}}</view> -->
-				<button open-type="share" shape="circle" :plain="true" :hairline="false" class='shareBut'>
-					{{$t(`立即分享`)}}
+				<view>{{ $t(`共富1580`) }}</view>
+				<view class='money'><text class='label'></text>{{ sharePacket.priceName }}</view>
+				<view class='tip'>{{ $t(`推广享红积分`) }}</view>
+				<view class='shareBut' v-if="!sharePacket.isCanShare">{{ $t(`立即分享`) }}</view>
+				<button open-type="share" shape="circle" :plain="true" :hairline="false"
+					class='shareBut'>
+					{{ $t(`立即分享`) }}
 				</button>
 			</view>
 		</view>
@@ -17,137 +19,137 @@
 </template>
 
 <script>
-	import {HTTP_REQUEST_URL} from '@/config/app';
-	export default {
+import { HTTP_REQUEST_URL } from '@/config/app';
+export default {
 
-		props: {
-			sharePacket: {
-				type: Object,
-				default: function() {
-					return {
-						isState: true,
-						priceName: ''
-					}
+	props: {
+		sharePacket: {
+			type: Object,
+			default: function () {
+				return {
+					isState: true,
+					priceName: ''
 				}
-			},
-			showAnimate: {
-				type: Boolean,
-				default: true
-			},
-		},
-		watch: {
-			showAnimate(nVal, oVal) {
-				setTimeout(res => {
-					this.isAnimate = nVal
-				}, 1000)
 			}
 		},
-		data() {
-			return {
-				imgHost:HTTP_REQUEST_URL,
-				isAnimate: true
-			};
+		showAnimate: {
+			type: Boolean,
+			default: true
 		},
+	},
+	watch: {
+		showAnimate(nVal, oVal) {
+			setTimeout(res => {
+				this.isAnimate = nVal
+			}, 1000)
+		}
+	},
+	data() {
+		return {
+			imgHost: HTTP_REQUEST_URL,
+			isAnimate: true
+		};
+	},
 
-		methods: {
-			closeShare: function() {
-				this.$emit('closeChange');
-			},
-			goShare: function() {
-				console.log(this.isAnimate)
-				if (this.isAnimate) {
-					this.$emit('listenerActionSheet');
-				} else {
-					this.isAnimate = true
-					this.$emit('boxStatus', true);
-				}
+	methods: {
+		closeShare: function () {
+			this.$emit('closeChange');
+		},
+		goShare: function () {
+			console.log(this.isAnimate)
+			if (this.isAnimate) {
+				this.$emit('listenerActionSheet');
+			} else {
+				this.isAnimate = true
+				this.$emit('boxStatus', true);
 			}
 		}
 	}
+}
 </script>
 
 <style scoped lang="scss">
-	.sharing-packets {
-		position: fixed;
-		left: 30rpx;
-		bottom: 200rpx;
-		z-index: 5;
-		transition: all 0.3s ease-in-out 0s;
-		opacity: 1;
-		transform: scale(1);
+.sharing-packets {
+	position: fixed;
+	left: 30rpx;
+	bottom: 200rpx;
+	z-index: 5;
+	transition: all 0.3s ease-in-out 0s;
+	opacity: 1;
+	transform: scale(1);
 
-		&.right {
-			left: -170rpx;
-		}
+	&.right {
+		left: -170rpx;
 	}
+}
 
-	// .sharing-packets.on {
-	// 	transform: scale(0);
-	// 	opacity: 0;
-	// }
+// .sharing-packets.on {
+// 	transform: scale(0);
+// 	opacity: 0;
+// }
 
-	.sharing-packets .iconfont {
-		width: 44rpx;
-		height: 44rpx;
-		border-radius: 50%;
-		text-align: center;
-		line-height: 44rpx;
-		background-color: #999;
-		font-size: 20rpx;
-		color: #fff;
-		margin: 0 auto;
-		box-sizing: border-box;
-		padding-left: 1px;
-	}
+.sharing-packets .iconfont {
+	width: 44rpx;
+	height: 44rpx;
+	border-radius: 50%;
+	text-align: center;
+	line-height: 44rpx;
+	background-color: #999;
+	font-size: 20rpx;
+	color: #fff;
+	margin: 0 auto;
+	box-sizing: border-box;
+	padding-left: 1px;
+}
 
-	.sharing-packets .line {
-		width: 2rpx;
-		height: 40rpx;
-		background-color: #999;
-		margin: 0 auto;
-	}
+.sharing-packets .line {
+	width: 2rpx;
+	height: 40rpx;
+	background-color: #999;
+	margin: 0 auto;
+}
 
-	.sharing-packets .sharing-con {
-		width: 187rpx;
-		height: 210rpx;
-		position: relative;
-	}
+.sharing-packets .sharing-con {
+	width: 187rpx;
+	height: 210rpx;
+	position: relative;
+}
 
-	.sharing-packets .sharing-con image {
-		width: 100%;
-		height: 100%;
-	}
+.sharing-packets .sharing-con image {
+	width: 100%;
+	height: 100%;
+}
 
-	.sharing-packets .sharing-con .text {
-		position: absolute;
-		top: 30rpx;
-		font-size: 20rpx;
-		width: 100%;
-		text-align: center;
-	}
+.sharing-packets .sharing-con .text {
+	position: absolute;
+	top: 30rpx;
+	font-size: 20rpx;
+	width: 100%;
+	text-align: center;
+}
 
-	.sharing-packets .sharing-con .text .money {
-		font-size: 32rpx;
-		font-weight: bold;
-		margin-top: 5rpx;
-	}
+.sharing-packets .sharing-con .text .money {
+	font-size: 32rpx;
+	font-weight: bold;
+	margin-top: 5rpx;
+}
 
-	.sharing-packets .sharing-con .text .money .label {
-		font-size: 20rpx;
-	}
+.sharing-packets .sharing-con .text .money .label {
+	font-size: 20rpx;
+}
 
-	.sharing-packets .sharing-con .text .tip {
-		font-size: 18rpx;
-		color: #999;
-		margin-top: 5rpx;
-	}
+.sharing-packets .sharing-con .text .tip {
+	font-size: 18rpx;
+	color: #999;
+	margin-top: 5rpx;
+}
 
-	.sharing-packets .sharing-con .text .shareBut {
-		border: none !important;
-		font-size: 22rpx;
-		color: #fff;
-		margin-top: 14rpx;
-		height: 50rpx;
-		line-height: 50rpx;
-	}
+.sharing-packets .sharing-con .text .shareBut {
+	border: none !important;
+	font-size: 22rpx;
+	color: #fff;
+	margin-top: 14rpx;
+	height: 50rpx;
+	line-height: 50rpx;
+}
 </style>

+ 1 - 1
pages/goods/goods_list_mall/index.vue

@@ -116,7 +116,7 @@ export default {
 			goShopDetail(item, this.uid).then(res => {
 				let userInfo = this.$Cache.get("USER_INFO", true)
 				uni.navigateTo({
-					url: `/pages/goods_details/index?id=${item.id}`+"&inviteCode="+userInfo.code
+					url: `/pages/goods_details/index?id=${item.id}`
 					+"&zoneType="+item.zoneType
 				})
 			})

+ 37 - 28
pages/goods_details/index.vue

@@ -266,35 +266,35 @@
 				<!-- #ifndef MP -->
 				<button class="item" hover-class="none" v-if="weixinStatus === true" @click="H5ShareBox = true">
 					<view class="iconfont icon-weixin3"></view>
-					<view class="">{{$t(`发送给朋友`)}}</view>
+					<view class="">{{ $t(`发送给朋友`) }}</view>
 				</button>
 				<!-- #endif -->
 				<!-- #ifdef MP -->
 				<button class="item" open-type="share" hover-class="none" @click="goFriend">
 					<view class="iconfont icon-weixin3"></view>
-					<view class="">{{$t(`发送给朋友`)}}</view>
+					<view class="">{{ $t(`发送给朋友`) }}</view>
 				</button>
 				<!-- #endif -->
 				<!-- #ifdef H5  -->
 				<div class="item copy-data" v-if="storeInfo.command_word != ''"
 					:data-clipboard-text="storeInfo.command_word">
 					<view class="iconfont icon-fuzhikouling"></view>
-					<text>{{$t(`复制口令`)}}</text>
+					<text>{{ $t(`复制口令`) }}</text>
 				</div>
 				<!-- #endif -->
 				<!-- #ifdef APP-PLUS -->
 				<view class="item" @click="appShare('WXSceneSession')">
 					<view class="iconfont icon-weixin3"></view>
-					<view class="">{{$t(`微信好友`)}}</view>
+					<view class="">{{ $t(`微信好友`) }}</view>
 				</view>
 				<view class="item" @click="appShare('WXSenceTimeline')">
 					<view class="iconfont icon-pengyouquan"></view>
-					<view class="">{{$t(`微信朋友圈`)}}</view>
+					<view class="">{{ $t(`微信朋友圈`) }}</view>
 				</view>
 				<!-- #endif -->
 				<button class="item" hover-class="none" @click="goPoster">
 					<view class="iconfont icon-haibao"></view>
-					<view class="">{{$t(`生成海报`)}}</view>
+					<view class="">{{ $t(`生成海报`) }}</view>
 				</button>
 			</view>
 			<!-- 分享按钮 -->
@@ -333,7 +333,7 @@
 let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
 import {
 	getGoodsDetail, getUserAddressByUserId, postBeforeCheck, getAvailableCheck
-	,postLinkedUrl
+	, postLinkedUrl
 } from "@/api/home.js";
 import {
 	getProductDetail,
@@ -452,6 +452,7 @@ export default {
 			posterImage: "", //海报路径
 			posterbackgd: "/static/images/posterbackgd.png",
 			sharePacket: {
+				isCanShare: false, //是否可以分享
 				isState: false, //默认不显示
 			}, //分销商详细
 			circular: false,
@@ -505,6 +506,8 @@ export default {
 			selectSku: {},
 			currentPage: false,
 			svip_price_open: 1,
+			promotionNo: '',
+			promotionShare: ''
 		};
 	},
 	computed: mapGetters(["isLogin", "uid", "userInfo", "selectAddr"]),
@@ -534,9 +537,10 @@ export default {
 	},
 	onLoad(options) {
 		uni.hideShareMenu();
+		console.log(options.inviteCode);
 		// 判断是否登录
 		if (!this.isLogin) {
-			if (options.inviteCode != "undefined") {
+			if (options.inviteCode) {
 				this.$Cache.set('INVITE_CODE', options.inviteCode);
 			}
 			uni.showToast({
@@ -551,17 +555,14 @@ export default {
 				})
 			}, 1500);
 		} else {
-			let userInfo = this.$Cache.get("USER_INFO", true)
-			console.log("用户自己的推荐码:" + userInfo.code);
 			console.log("受邀的推荐码:" + options.inviteCode);
 			//1580 进入时
 			if (options.zoneType == 8) {
-				//判断是否为自己的要求码进入
-				if (options.inviteCode !== userInfo.code) {
-					if (options.inviteCode != "undefined") {
-						this.$Cache.set('INVITE_CODE', options.inviteCode);
-					}
+				if (options.inviteCode) {
+					this.promotionNo = options.inviteCode
 				}
+				console.log("界面跳转的邀请码:" + this.promotionNo);
+				this.listenerActionSheet()
 			}
 			let that = this;
 			var pages = getCurrentPages();
@@ -650,16 +651,14 @@ export default {
 	 * 用户点击右上角分享
 	 */
 	// #ifdef MP
-	onShareAppMessage: function () {
+	onShareAppMessage: function (res) {
 		let that = this;
 		// 校验是否可以分享(先购买产品)
-		postLinkedUrl().then(res =>{
-			return {
-				title: that.storeInfo.goodsName || "",
-				imageUrl: "http://wine.gzzzyd.com/test/static/img/bg.a82f9752.jpg" ||that.storeInfo.image,
-				path: "/pages/goods_details/index?id=" + that.id + "&inviteCode=" + that.$Cache.get("USER_INFO", true).code,
-			};
-		})
+		return {
+			title: that.storeInfo.goodsName || "",
+			imageUrl: "http://wine.gzzzyd.com/test/static/img/bg.a82f9752.jpg" || that.storeInfo.image,
+			path: "/pages/goods_details/index?id=" + that.id + "&inviteCode=" + that.promotionShare,
+		};
 	},
 
 	// #endif
@@ -952,7 +951,6 @@ export default {
 					that.storeInfo = res.data
 					// 处理分享
 					if (that.storeInfo.zoneType == 8) {
-						uni.showShareMenu();
 						that.sharePacket.isState = true
 					}
 					that.skuArr = storeInfo.goodsSpecList
@@ -1357,10 +1355,21 @@ export default {
 				toLogin();
 			} else {
 				// 校验是否可以分享(先购买产品)
-				postLinkedUrl().then(res =>{
-					// this.downloadFilePromotionCode();
-					// this.posters = true;
-				})
+				if (!this.sharePacket.isCanShare) {
+					postLinkedUrl().then(res => {
+						uni.showShareMenu();
+						this.sharePacket.isCanShare = true
+						//判断是否为自己的要求码进入
+						if (this.promotionNo !== res.data.promotionNo) {
+							if (this.promotionNo) {
+								this.$Cache.set('INVITE_CODE', res.data.promotionNo);
+							}
+						}
+						this.promotionShare = res.data.promotionNo
+						// this.downloadFilePromotionCode();
+						// this.posters = true;
+					})
+				}
 				// if (this.posterImage) {
 				// 	this.posters = true;
 				// 	return