2022-07-08 08:15:29 +00:00
|
|
|
|
<template>
|
|
|
|
|
<view class="pad-b140">
|
|
|
|
|
<status-nav :ifReturn="true" navBarTitle="套件简介" :marginBottom="0"></status-nav>
|
|
|
|
|
<!-- 商品轮播图 -->
|
2022-07-15 10:29:01 +00:00
|
|
|
|
<view class="shop-img" v-if="isLoading">
|
2022-07-08 08:15:29 +00:00
|
|
|
|
<swiper-pu newRadius="0" :bannerList="kitBanner" newHeight="505rpx" newBottom="35rpx" :isplay='isplay'></swiper-pu>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 商品概述 -->
|
2022-07-15 10:29:01 +00:00
|
|
|
|
<view class="shop-summary kit-summary" v-if="isLoading">
|
2022-07-08 08:15:29 +00:00
|
|
|
|
<view class="shop-title">{{kitDetail.name}}</view>
|
|
|
|
|
<view class="shop-txt flex">
|
|
|
|
|
<view class="left">
|
|
|
|
|
<view class="kit-compose">{{kitDetail.subtitle}}</view>
|
2022-07-15 10:29:01 +00:00
|
|
|
|
<view class="shop-customized">{{kitDetail.tag}}</view>
|
|
|
|
|
<view class="shop-pric">¥{{kitDetail.original_price}}</view>
|
|
|
|
|
<view class="shop-pric-vip" v-if="vipPrice"><text>会员价:</text>¥{{kitDetail.price}}</view>
|
2022-07-08 08:15:29 +00:00
|
|
|
|
</view>
|
|
|
|
|
<view class="right flex">
|
|
|
|
|
<view class="collection-btn flex" :class="kitDetail.is_collected == 1?'active':''" @tap="collectionEv(kitDetail.id)">
|
|
|
|
|
<image src="/static/public/icon-collection.png" mode="widthFix"></image>
|
2022-07-13 08:04:38 +00:00
|
|
|
|
<text>{{kitDetail.is_collected == 1?'已收藏':'收藏'}}</text>
|
2022-07-08 08:15:29 +00:00
|
|
|
|
</view>
|
|
|
|
|
<view class="share-btn flex">
|
|
|
|
|
<image src="/static/public/icon-share.png" mode="widthFix"></image>
|
|
|
|
|
<text>分享</text>
|
|
|
|
|
<button plain="true" data-name="shareBtn" open-type="share"></button>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 套件包含 -->
|
2022-07-15 10:29:01 +00:00
|
|
|
|
<view class="kit-contain" v-if="isLoading">
|
2022-07-08 08:15:29 +00:00
|
|
|
|
<view class="contain-h2">套件包含</view>
|
|
|
|
|
<view class="contain-list flex">
|
|
|
|
|
<view class="contain-item" @tap="toDetail(item.id)" v-for="(item,index) in kitDetail.series" :key="index">
|
|
|
|
|
<view class="contain-img">
|
|
|
|
|
<image :src="item.cover" mode="widthFix"></image>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="contain-title clips2">{{item.name}}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 底部按钮 -->
|
2022-07-15 10:29:01 +00:00
|
|
|
|
<view class="shop-btns flex" v-if="isLoading">
|
2022-07-08 08:15:29 +00:00
|
|
|
|
<view class="btn" @tap="joinCart(specsIndex)">加入购物车</view>
|
|
|
|
|
<view class="btn" @tap="buyNow(specsIndex)">立即购买</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 购物车btn -->
|
|
|
|
|
<enter-cart :bottom="335"></enter-cart>
|
|
|
|
|
<!-- 客服btn -->
|
|
|
|
|
<customer-service></customer-service>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import statusNav from '@/components/status-navs/status-nav';
|
|
|
|
|
import enterCart from '@/components/enter-cart/enter-cart.vue';
|
|
|
|
|
import customerService from '@/components/customer-service/customer-service.vue';
|
|
|
|
|
import swiperPu from '@/components/swipers/swiper-pu';
|
2022-07-13 08:04:38 +00:00
|
|
|
|
import {getCartNum,userInfoEv} from '@/jsFile/public-api.js';
|
|
|
|
|
import {mapState} from 'vuex'//引入mapState
|
2022-07-08 08:15:29 +00:00
|
|
|
|
export default {
|
|
|
|
|
components:{
|
|
|
|
|
statusNav,
|
|
|
|
|
swiperPu,
|
|
|
|
|
enterCart,
|
|
|
|
|
customerService,
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
scrollHeight:uni.getSystemInfoSync().windowHeight - uni.getSystemInfoSync().statusBarHeight - 50,
|
|
|
|
|
newWidth:uni.getSystemInfoSync().windowWidth,
|
|
|
|
|
isplay:false,
|
|
|
|
|
kitDetail:{}, //套件详情
|
|
|
|
|
kitSku:[], //套件规格
|
|
|
|
|
isShow:false, //是否展示规格弹窗
|
|
|
|
|
kitIndex:0, //规格选中位置
|
|
|
|
|
kitBanner:[], //套件轮播
|
|
|
|
|
action:'collect', //收藏类型
|
2022-07-13 08:04:38 +00:00
|
|
|
|
id:'' ,//套件id
|
|
|
|
|
vipPrice:false,// 是否显示会员价
|
2022-07-15 03:05:54 +00:00
|
|
|
|
cacheBusinessId:-1, //商户id
|
2022-07-15 10:29:01 +00:00
|
|
|
|
isLoading:false,
|
2022-07-08 08:15:29 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed:{
|
|
|
|
|
...mapState({
|
|
|
|
|
footHeight: state => state.moduleA.footHeight,
|
|
|
|
|
}),
|
|
|
|
|
},
|
|
|
|
|
onLoad(op) {
|
|
|
|
|
if(op !== ''){
|
2022-07-15 10:29:01 +00:00
|
|
|
|
this.id = op.id;
|
2022-07-12 10:07:08 +00:00
|
|
|
|
if(op.business_id){
|
2022-07-15 03:05:54 +00:00
|
|
|
|
this.cacheBusinessId = op.business_id;
|
2022-07-12 10:07:08 +00:00
|
|
|
|
}
|
2022-07-08 08:15:29 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onShow() {
|
2022-07-15 03:05:54 +00:00
|
|
|
|
if(this.cacheBusinessId !== -1){
|
|
|
|
|
this.$requst.post('/api/index/change-business',{business_id:this.cacheBusinessId}).then(res=>{
|
|
|
|
|
if(res.code == 0){
|
|
|
|
|
this.getKitDetail(this.id);
|
|
|
|
|
userInfoEv();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.getKitDetail(this.id);
|
|
|
|
|
userInfoEv();
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-13 08:41:27 +00:00
|
|
|
|
if(uni.getStorageSync('business_code')!=='' && uni.getStorageSync('showVip')=='true'){
|
2022-07-13 08:04:38 +00:00
|
|
|
|
this.vipPrice = true;
|
|
|
|
|
}
|
2022-07-08 08:15:29 +00:00
|
|
|
|
},
|
|
|
|
|
// 分享到微信
|
2022-07-11 10:35:14 +00:00
|
|
|
|
onShareAppMessage(res) {
|
|
|
|
|
let path = uni.getStorageSync('page-path-options')+'&business_id='+uni.getStorageSync('business_id');
|
|
|
|
|
return {
|
|
|
|
|
path:path
|
|
|
|
|
}
|
2022-07-08 08:15:29 +00:00
|
|
|
|
},
|
|
|
|
|
// 分享到朋友圈
|
2022-07-11 10:35:14 +00:00
|
|
|
|
onShareTimeline(res){
|
|
|
|
|
let path = uni.getStorageSync('page-path-options')+'&business_id='+uni.getStorageSync('business_id');
|
|
|
|
|
return {
|
|
|
|
|
path:path
|
|
|
|
|
}
|
2022-07-08 08:15:29 +00:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
//查询套件详情
|
|
|
|
|
getKitDetail(id){
|
2022-07-14 02:00:23 +00:00
|
|
|
|
uni.showLoading({
|
|
|
|
|
title: '加载中'
|
|
|
|
|
});
|
2022-07-15 10:29:01 +00:00
|
|
|
|
this.isLoading=false;
|
2022-07-08 08:15:29 +00:00
|
|
|
|
this.$requst.get('/api/spu/detail',{id:id}).then(res=>{
|
2022-07-15 10:29:01 +00:00
|
|
|
|
console.log(res,99999)
|
2022-07-08 08:15:29 +00:00
|
|
|
|
if(res.code==0) {
|
|
|
|
|
this.kitDetail = res.data.detail; //套件详情
|
|
|
|
|
this.kitSku = res.data.sku; //套件规格
|
|
|
|
|
let newArr = [];
|
|
|
|
|
res.data.detail.images.forEach(item=>{
|
|
|
|
|
let obj = {
|
|
|
|
|
imgSrc:item,
|
|
|
|
|
}
|
|
|
|
|
newArr.push(obj)
|
|
|
|
|
})
|
|
|
|
|
this.kitBanner = newArr; //详情轮播图
|
|
|
|
|
}
|
|
|
|
|
uni.hideLoading();
|
2022-07-15 10:29:01 +00:00
|
|
|
|
this.isLoading=true;
|
2022-07-08 08:15:29 +00:00
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
//收藏
|
|
|
|
|
collectionEv(id){
|
|
|
|
|
let params = {
|
|
|
|
|
id:id,
|
|
|
|
|
action:this.action
|
|
|
|
|
}
|
|
|
|
|
if(this.kitDetail.is_collected == 1){
|
|
|
|
|
this.$requst.post('/api/spu/un-record',params).then(res=>{
|
|
|
|
|
if(res.code==0) {
|
|
|
|
|
// this.$toolAll.tools.showToast('取消收藏成功');
|
|
|
|
|
this.getKitDetail(this.id);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.$requst.post('/api/spu/record',params).then(res=>{
|
|
|
|
|
if(res.code==0) {
|
|
|
|
|
// this.$toolAll.tools.showToast('收藏成功');
|
|
|
|
|
this.getKitDetail(this.id);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
// 加入购物车
|
|
|
|
|
joinCart(){
|
|
|
|
|
if(this.$toolAll.tools.judgeAuth()) {
|
|
|
|
|
this.$requst.post('/api/order/shopping-cart-add',{sku_id:this.kitSku[this.kitIndex].id,num:1}).then(res=>{
|
|
|
|
|
if(res.code==0) {
|
|
|
|
|
this.$toolAll.tools.showToast('加入购物车成功(*^▽^*)');
|
|
|
|
|
getCartNum();
|
|
|
|
|
} else {
|
|
|
|
|
this.$toolAll.tools.showToast(res.msg)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 立即购买
|
|
|
|
|
buyNow(){
|
|
|
|
|
if(this.$toolAll.tools.judgeAuth()) {
|
|
|
|
|
this.$requst.post('/api/order/shopping-cart-add',{sku_id:this.kitSku[this.kitIndex].id,num:1}).then(res=>{
|
|
|
|
|
if(res.code==0) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url:`/pagesA/cart/cart`
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.$toolAll.tools.showToast(res.msg)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 去商品详情
|
|
|
|
|
toDetail(id){
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url:`/pagesA/shop/detail?id=${id}&source=kit`
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
|
|
</style>
|