xuhaolan 4 years ago
parent
commit
e95f41baf8
4 changed files with 56 additions and 6 deletions
  1. 46 1
      pages/product/common/productBottom.vue
  2. 3 2
      pages/product/list.vue
  3. 5 1
      pages/product/product.vue
  4. 2 2
      store/index.js

+ 46 - 1
pages/product/common/productBottom.vue

@@ -12,7 +12,12 @@
 			<button type="primary" class=" action-btn no-border add-cart-btn" @click="buy(2)">加入购物车</button>
 			<button type="primary" class=" action-btn no-border buy-now-btn" @click="buy(1)">立即购买</button>
 		</view> -->
-		<view class="btm-btn">
+		<view class="btm-btn" v-if="option==17&&userInfo.uid">
+			<button type="primary" class="buy-btn" @click="buy(1)" :class="{'quck':!showAdd }"v-if="userInfo.uid &&  userInfo.level==1" >立即领取</button>
+			<button type="primary" class="add-btn1" v-else >非礼包会员</button>.
+			
+		</view>
+		<view class="btm-btn" v-else>
 			<button type="primary" class="add-btn" @click="buy(2)" v-if="showAdd&&jifen==0">加入购物车</button>
 			<button type="primary" class="buy-btn" @click="buy(1)" :class="{'quck':!showAdd }">立即购买</button>
 		</view>
@@ -20,6 +25,13 @@
 </template>
 
 <script>
+	import {
+		mapState,
+		mapMutations
+	} from 'vuex';
+	import {
+		getCategoryList
+	} from '@/api/product.js';
 	import {
 		collectAdd,
 		collectDel
@@ -29,6 +41,9 @@
 	} from '@/api/index.js'
 	export default {
 		props: {
+			option:{
+				
+			},
 			jifen: {
 
 			},
@@ -50,8 +65,27 @@
 		data() {
 			return {};
 		},
+		computed:{
+			...mapState('user', ['hasLogin', 'userInfo']),
+			// putvip(){
+			// 	let obj = this;
+			// 	getCategoryList({}).then(function(e) {
+			// 		console.log(e);
+			// 		e.data.forEach(function(e) {
+			// 			if (e.id == fid) {
+			// 				obj.cateList = e.children;
+			// 				return;
+			// 			}
+			// 		});
+			// 		console.log(obj.cateList,diasadiji);
+			// 	});
+			// }
+		},
 		onLoad() {
 			addJifen()
+			
+			
+			// putvip()
 		},
 		methods: {
 			buy(type) {
@@ -236,6 +270,17 @@
 			color: #ff4c4c;
 			line-height: 90rpx;
 		}
+		.add-btn1 {
+			width: 100%;
+			height: 90rpx;
+			border: 1px solid #F3F4F6;
+			border-radius: 45rpx;
+			background-color: #DCDFE6;
+			font-size: 36rpx;
+			font-weight: 500;
+			color: black;
+			line-height: 90rpx;
+		}
 
 		.buy-btn {
 			width: 100%;

+ 3 - 2
pages/product/list.vue

@@ -127,7 +127,7 @@
 							return;
 						}
 					});
-					console.log(obj.cateList);
+					console.log(obj.cateList,'数据');
 				});
 			},
 			//加载商品 ,带下拉刷新和上滑加载
@@ -236,9 +236,10 @@
 			//详情
 			navToDetailPage(item) {
 				let id = item.id;
+				console.log(item,'我的item');
 				let url = `/pages/product/product?id=${id}`
 				if (this.userInfo.uid) {
-					url = url + '&spread=' + this.userInfo.uid
+					url = url + '&spread=' + this.userInfo.uid +'&cateId='+ item.cate_id
 				}
 				uni.navigateTo({
 					url: url

+ 5 - 1
pages/product/product.vue

@@ -19,7 +19,7 @@
 		<!-- 底部高度撑开 -->
 		<view class="contentBottomHeight"></view>
 		<!-- 底部操作菜单 -->
-		<product-bottom @buy="buy" :goodsObjact="goodsObjact" :jifen = "jifen" :goodsid="goodsid" @specOPne="specOPne"
+		<product-bottom @buy="buy" :goodsObjact="goodsObjact" :option='option' :jifen="jifen" :goodsid="goodsid" @specOPne="specOPne"
 			:showAdd="showAdd"></product-bottom>
 		<!-- 规格-模态层弹窗 -->
 		<view class="popup spec" :class="specClass" @touchmove.stop.prevent="stopPrevent" @click="toggleSpec">
@@ -121,6 +121,7 @@
 		},
 		data() {
 			return {
+				option:'',
 				jifen:0,//是否有积分
 				mer_id:'',//商户编号
 				show: false,
@@ -192,8 +193,11 @@
 		},
 		
 		async onLoad(options) {
+		console.log(options,'接受到的参数');
 		
 			let obj = this;
+			obj.option = options.cateId;
+			console.log(obj.option)
 			obj.userInfo = uni.getStorageSync('userInfo');
 			//保存商品id
 			this.goodsid = options.id;

+ 2 - 2
store/index.js

@@ -8,8 +8,8 @@ Vue.use(Vuex)
 const store = new Vuex.Store({
 	state: {
 		// baseURL:"http://yrh.liuniu946.com",//'http://eb.shuibo.net',//请求地址配置 
-		baseURL:'https://ysg.liuniu946.com',//请求地址配置 
-		// baseURL:'http://ysg.frp.liuniu946.com',//请求地址配置 
+		// baseURL:'https://ysg.liuniu946.com',//请求地址配置 
+		baseURL:'http://ysg.frp.liuniu946.com',//请求地址配置 
 		// baseURL:'http://www.zjxwcm.cn',
 		urlFile:'/index',//项目部署所在文件夹
 		userInfo: {}, //登录信息