| 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>
|
| xqd
@@ -162,7 +144,6 @@
|
|
|
<!-- <view class="purchase-btn">立即兑换</view> -->
|
|
|
<view class="purchase-btn">确认</view>
|
|
|
</view>
|
|
|
-
|
|
|
</uni-popup>
|
|
|
|
|
|
<!-- 二维码购买 -->
|
| xqd
@@ -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,
|
|
|
|
| xqd
@@ -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: {
|
|
|
//获取当前页面路径
|
| xqd
@@ -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 => {
|
| xqd
@@ -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]);
|
|
|
}
|
|
|
})
|
|
|
},
|
| xqd
@@ -355,7 +310,6 @@
|
|
|
this.$api.hotel.getHotelDetail({
|
|
|
hotel_id:id
|
|
|
}).then(res=>{
|
|
|
- console.log(res,"酒店详情")
|
|
|
this.hotelDetail=res.data
|
|
|
})
|
|
|
},
|
| xqd
@@ -387,7 +341,8 @@
|
|
|
},
|
|
|
// 口味切换
|
|
|
flavorchecked(index,name) {
|
|
|
- this.flavorIsActive = index
|
|
|
+ this.$set(this.flavorIsActive, name, index)
|
|
|
+ console.log(this.flavorIsActive)
|
|
|
this.specs.flavor=name
|
|
|
},
|
|
|
// 重量切换
|
| xqd
@@ -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)
|
|
|
})
|
|
|
},
|
|
|
}
|