瀏覽代碼

地图和产品bug修改

yfso 2 年之前
父節點
當前提交
7e31c4d799
共有 6 個文件被更改,包括 47 次插入90 次删除
  1. 30 73
      pages/goods/goods-detail/index.vue
  2. 0 8
      pages/index/index.vue
  3. 12 6
      pages/map/hotel-book/index.vue
  4. 3 2
      pages/map/map.vue
  5. 1 1
      setting.js
  6. 1 0
      utils/tools.js

+ 30 - 73
pages/goods/goods-detail/index.vue

xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -120,40 +120,22 @@
 					</view>
 					<image style="width: 52rpx;height: 52rpx;" src="/static/icon/close01.png" mode=""  @click="Recipientclose"></image>
 				</view>
-
-				<view class="pop-flavor">
-					<text>口味</text>
-					<view class="tab_flavor">
-						<view class="flavorTitle-item" :class="{'flavorTitle-item-active':flavorIsActive === index}"  v-for="(item,index) in flavorList" :key="index"
-							@click="flavorchecked(index,item.attr_name)">
-							<view :class="{'active-flavor':flavorIsActive === index}">
-								{{item.attr_name}}
-							</view>
-						</view>
-					</view>
-				</view>
-				<view class="pop-flavor" style="margin-top: 44rpx;">
-					<text>重量</text>
+				
+				
+				<view class="pop-flavor" v-for="i in attr_groups" :key="i.attr_group_id" style="margin-top: 44rpx;">
+					<text>{{i.attr_group_name}}</text>
 					<view class="tab_flavor">
-						<view class="flavorTitle-item" :class="{'flavorTitle-item-active':weightIsActive === index}" v-for="(item,index) in weightList" :key="index"
-							@click="weightchecked(index,item.attr_name)">
-							<view :class="{'active-flavor':weightIsActive === index}">
+						<view class="flavorTitle-item" 
+							:class="{'flavorTitle-item-active':flavorIsActive[i.attr_group_id] === item.attr_id}"  
+							v-for="(item,index) in i.attr_list" :key="item.attr_id"
+							@click="flavorchecked(item.attr_id,i.attr_group_id)"
+						>
+							<view :class="{'active-flavor':flavorIsActive[i.attr_group_id] === item.attr_id}">
 								{{item.attr_name}}
 							</view>
 						</view>
 					</view>
 				</view>
-				<view class="pop-flavor" style="margin-top: 44rpx;">
-					<text>包装</text>
-					<view class="tab_flavor">
-						<view class="flavorTitle-item" :class="{'flavorTitle-item-active':packIsActive === index}" v-for="(item,index) in packList" :key="index"
-							@click="packchecked(index,item.title)">
-							<view :class="{'active-flavor':packIsActive === index}">
-								{{item.title}}
-							</view>
-						</view>
-					</view>
-				</view>
 			</view>
 			<view class="purchase" v-if="produceType == 1" @click="goIntegralOrder(product_id)">
 				<view class="purchase-btn">立即购买</view>
@@ -162,7 +144,6 @@
 				<!-- <view class="purchase-btn">立即兑换</view> -->
 				<view class="purchase-btn">确认</view>
 			</view>
-
 		</uni-popup>
 
 		<!-- 二维码购买 -->
@@ -205,30 +186,9 @@
 				hotelDetail:'',
 				// 产品id
 				product_id:'',
-				packList: [{
-						title: '礼盒'
-					},
-					{
-						title: '普通'
-					}
-				],
-				weightList: [{
-					attr_name: '50g'
-				}, {
-					attr_name: '100g'
-				}, {
-					attr_name: '150g'
-				}],
-				flavorList: [{
-					attr_name: '五仁'
-				}, {
-					attr_name: '豆沙'
-				}, {
-					attr_name: '水果'
-				}],
 				//激活指定table菜单
 				isActive: 0,
-				flavorIsActive:0,
+				flavorIsActive:{},
 				weightIsActive:0,
 				packIsActive:0,
 				
@@ -250,19 +210,18 @@
 				current1: 0,
 				//指示点模式
 				mode: 'dot',
+				attr_groups:[],
 			}
 		},
 		onReady: function(res) {
 			this.videoContext = uni.createVideoContext('myVideo')
 		},
 		onLoad(op) {
+			const {id, type} = op;
 			this.admin = this.$store.getters.userInfo
-			console.log(this.admin);
-			this.product_id=op.id
-			this.produceType = op.type
-			console.log(this.product_id,this.produceType,"产品id")
-			this.getProductDetail(op.id)
-			
+			this.product_id=id
+			this.produceType = type
+			this.getProductDetail(this.product_id)
 		},
 		methods: {
 			//获取当前页面路径
@@ -313,19 +272,16 @@
 						console.log(e, '失败')
 					}
 				})
-			},
-			
+			},	
 			//视频自动播放
 			openVideoPlay() {
 				this.videoContext.play()
 			},
 			// 获取商品详情
-			getProductDetail(id){
+			getProductDetail(product_id){
 				this.$api.product.getProductDetail({
-					product_id:id
+					product_id:product_id
 				}).then(res=>{
-					console.log(res,"产品详情")
-					// console.log(res.data.attr_group,"产品规格")
 					if(res.code==0){
 						this.productDetail=res.data
 						this.info = JSON.parse(res.data.img_urls).map(item => {
@@ -339,14 +295,13 @@
 						//banner展示视频或者图片
 						this.resource_type = res.data.resource_type
 						this.video_url = res.data.video_url
-						console.log(this.video_url, '--->this.video_url');
 						//视频自动播放
 						this.openVideoPlay()
-						// 口味
-						// this.flavorList=JSON.parse(res.data.attr_group)[0].attr_list
-						// 重量
-						// this.weightList=JSON.parse(res.data.attr_group)[1].attr_list
-						this.getHotelDetail(res.data.hotel_id)
+						//规格对接
+						this.attr_groups = JSON.parse(res.data.attr_group)
+						//获取默认酒店
+						const hotel_ids = JSON.parse(res.data.hotel_ids);
+						(hotel_ids.constructor == Array) && (hotel_ids.length > 0) &&  this.getHotelDetail(hotel_ids[0]);
 					}
 				})
 			},
@@ -355,7 +310,6 @@
 				this.$api.hotel.getHotelDetail({
 					hotel_id:id
 				}).then(res=>{
-					console.log(res,"酒店详情")
 					this.hotelDetail=res.data
 				})
 			},
@@ -387,7 +341,8 @@
 			},
 			// 口味切换
 			flavorchecked(index,name) {
-				this.flavorIsActive = index
+				this.$set(this.flavorIsActive, name, index)
+				console.log(this.flavorIsActive)
 				this.specs.flavor=name
 			},
 			// 重量切换
@@ -424,8 +379,10 @@
 			},
 			// 跳转积分兑换
 			goIntegralOrder(id){
-				uni.navigateTo({
-					url:'/pages/my/integral/integralOrder?product_id='+id
+				this.$utils.jump({
+					jump_type: this.hotelDetail.buy_jump_type,
+					jump_config: this.hotelDetail.buy_jump_config,
+					attr: JSON.stringify(this.flavorIsActive)
 				})
 			},
 		}

+ 0 - 8
pages/index/index.vue

xqd xqd xqd
@@ -126,7 +126,6 @@
 		<!-- 酒店推荐图片 -->
 		<view class="home-hotel-img">
 			<view class="home-hotel-img-content">
-<<<<<<< HEAD
 				<!-- <view @click="produceDetail(item.id)" class="home-hotel-img-content-item" v-for="(item,index) in goodsList" :key="index"
 					:style="{marginTop:item.marginTop || 0 }">
 					<image class="home-hotel-img-content-item-img"
@@ -136,9 +135,6 @@
 						<text class="text-top">{{item.name}}</text>
 				</view> -->
 				<view  class="home-hotel-img-content-item" v-for="(item,index) in goodsList" :key="index"
-=======
-				<view @click="produceDetail(item.id)" class="home-hotel-img-content-item" v-for="(item,index) in goodsList" :key="index"
->>>>>>> 2ce03f3f71db2687208ef178dd9481642dc9161b
 					:style="{marginTop:item.marginTop || 0 }">
 					<image class="home-hotel-img-content-item-img"
 						:class="item.short?'home-hotel-img-content-item-img': 'home-hotel-img-content-item-img-long' "
@@ -324,11 +320,7 @@
 			this.admin = this.$store.getters.userInfo
 		},
 		onLoad() {
-<<<<<<< HEAD
-			// this.getGoodsList()
-=======
 			this.getGoodsList()
->>>>>>> 2ce03f3f71db2687208ef178dd9481642dc9161b
 			this.getAllSet()
 		},
 		methods: {

+ 12 - 6
pages/map/hotel-book/index.vue

xqd
@@ -108,14 +108,20 @@
 			this.videoContext = uni.createVideoContext('myVideo')
 		},
 
-		onLoad(o) {
-			if (o.hotel_id) {
-				this.hotel = o;
-				this.hotel_id = o.hotel_id
-				this.getDetail()
+		onLoad(params) {
+			if(!this.$store.getters.userInfo){
+				uni.navigateTo({
+					url: '/pages/login/login'
+				})
 			}
+			if (params?.hotel_id) {
+				params.address = params.address == 'null' ? "" : params.address;
+				this.hotel = params;
+				this.hotel_id = params.hotel_id;
+				this.getDetail()
+			}			
 		},
-
+		
 		methods: {
 			// 切换轮播图指示点
 			change1(e) {

+ 3 - 2
pages/map/map.vue

xqd xqd xqd
@@ -167,7 +167,7 @@
 							<view class="address-detail-main">
 								<view class="address-detail-main-left">
 									<text class="title">{{item.name}}</text>
-									<view class="content">
+									<view class="content" :style="{opacity: item.label?1:0}">
 										<text>{{item.label}}</text>
 									</view>
 									<view class="bottom" v-if="item.min_price">
@@ -209,7 +209,7 @@
 						<view class="address-detail-main">
 							<view class="address-detail-main-left">
 								<text class="title">{{item.name}}</text>
-								<view class="content">
+								<view class="content" :style="{opacity: item.label?1:0}">
 									<text>{{item.label}}</text>
 								</view>
 								<view class="bottom" v-if="item.min_price">
@@ -470,6 +470,7 @@
 					uni.navigateTo({
 						url: '/pages/login/login'
 					})
+					return;
 				}
 				const hotel = this.hotelList[index];
 

+ 1 - 1
setting.js

xqd
@@ -1,7 +1,7 @@
 /**
  * Created by JianJia.Zhou<jianjia.zhou> on 2022/3/18.
  */
-const IS_DEV = process.env.NODE_ENV === 'development1'
+const IS_DEV = process.env.NODE_ENV === 'development'
 // const URL = 'https://t9.9026.com'
 const URL = 'https://ihg.9026.com'
 

+ 1 - 0
utils/tools.js

xqd
@@ -18,6 +18,7 @@ const toHttps = (url)=>{
  * ×¢£ºÍ¼Æ¬Ìø×ªÂß¼­¿Õȱ
  */
 const jump = ({jump_type, jump_config, ...params} = {})=>{
+	console.log(params);
 	return new Promise((resolve, reject)=>{
 		if(!jump_type) reject(false);
 		jump_config = jump_config == undefined ? "" : jump_config;