Browse Source

下单添加推荐码

yuxingxing 2 years ago
parent
commit
e9de439cf1

+ 2 - 0
config/cache.js

@@ -7,6 +7,8 @@ module.exports = {
 	UID:'UID',
 	//open_id
 	OPENID:'OPENID',
+	//inviteCode 邀请码
+	INVITE_CODE: 'INVITE_CODE',
 	//用户信息
 	USER_INFO: 'USER_INFO',
 	//token过期时间

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

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

+ 5 - 2
pages/goods/order_confirm/index.vue

@@ -416,7 +416,8 @@ export default {
 			inputTrip: false,
 			focus: true,
 			goodsSpecId: 0,
-			freight: 0
+			freight: 0,
+			zoneType: 0,
 		};
 	},
 	computed: mapGetters(['isLogin']),
@@ -653,7 +654,8 @@ export default {
 				remark: that.remark,
 				settleType: 1,
 				userAddressId: that.addressInfo.id,
-				wlPrice: that.freight
+				wlPrice: that.freight,
+				promotionCode: that.zoneType == 8?that.$Cache.get("INVITE_CODE"):''
 			}).then(res => {
 				that.orderKey = res.data.orderNo,
 				uni.showLoading({
@@ -890,6 +892,7 @@ export default {
 				.then((res) => {
 					that.cartInfo = []
 					let porject = res.data
+					that.zoneType = porject.zoneType
 					//找出选择的规格
 					porject.goodsSpecList.forEach(element => {
 						if (that.goodsSpecId == element.id) {

+ 9 - 0
pages/goods_details/index.vue

@@ -486,6 +486,15 @@ export default {
 		},
 	},
 	onLoad(options) {
+		let userInfo = this.$Cache.get("USER_INFO", true)
+		console.log(options.inviteCode);
+		//1580 进入时
+		if(options.zoneType == 8){
+			//判断是否为自己的要求码进入
+		if(options.inviteCode !== userInfo.code){
+			this.$Cache.set('INVITE_CODE', options.inviteCode);
+		}
+		}
 		let that = this;
 		var pages = getCurrentPages();
 		that.returnShow = pages.length === 1 ? false : true;

+ 1 - 0
pages/users/register/index.vue

@@ -205,6 +205,7 @@ export default {
 		});
 	},
 	mounted: function () {
+		this.codeInvitation = this.$Cache.get('INVITE_CODE');
 		// this.getCode();
 		// this.getLogoImage();
 	},