| | |
| | | <!-- 配置地址 如果是虚拟产品的时候不展示 --> |
| | | <view class="card-box" v-if="goodsDetail.goodsType != 'VIRTUAL_GOODS'"> |
| | | <view class="card-flex" @click="shutMask(4)"> |
| | | <view class="card-title"> 已选 </view> |
| | | <view class="card-title"> 可选规格 </view> |
| | | <view class="card-content"> |
| | | <span v-if="selectedGoods.spec">{{ selectedGoods.spec.specName }}-{{ |
| | | selectedGoods.spec.specValue |
| | |
| | | <Evaluation id="main5" :goodsDetail="goodsDetail" /> |
| | | |
| | | <!-- 店铺推荐 --> |
| | | <storeLayout id="main7" :storeDetail="storeDetail" :goodsDetail="goodsDetail" :res="recommendList" /> |
| | | <storeLayout v-if="false" id="main7" :storeDetail="storeDetail" :goodsDetail="goodsDetail" :res="recommendList" /> |
| | | |
| | | <!-- 宝贝详情 --> |
| | | <GoodsIntro id="main9" :res="goodsDetail" :goodsParams="goodsParams" :goodsId="goodsDetail.goodsId" |
| | | <GoodsIntro id="main9" :res="goodsDetail" :goodsParams="goodsParams" :goodsId="goodsDetail.goodsId" |
| | | v-if="goodsDetail.id" /> |
| | | |
| | | <!-- 宝贝推荐 --> |
| | | <GoodsRecommend id="main11" :res="likeGoodsList" /> |
| | | <GoodsRecommend id="main11" :res="likeGoodsList" v-if="false" /> |
| | | </view> |
| | | </scroll-view> |
| | | |
| | | |
| | | <view class="page-bottom mp-iphonex-bottom" id="pageBottom"> |
| | | <view class="icon-btn"> |
| | | <view class="icon-btn-item" @click="navigateToStore(goodsDetail.storeId)"> |
| | | <view class="icon-btn-item" @click="navigateToStore(goodsDetail.storeId)"> |
| | | <u-icon size="34" class="red" name="home-fill"></u-icon> |
| | | <view class="red icon-btn-name">店铺</view> |
| | | </view> |
| | |
| | | </view> |
| | | </view> |
| | | <!-- 下架展示 --> |
| | | <div class="detail-btn" v-if="takeDownFromSale"> |
| | | <!-- <div class="detail-btn" v-if="takeDownFromSale"> |
| | | <view class="to-store-car to-store-btn" @click="reStartTakeDownSale"> |
| | | 查看类似商品</view> |
| | | </div> |
| | | </div> --> |
| | | <!-- 正常结算页面 --> |
| | | <view class="detail-btn" v-if="!isGroup && !takeDownFromSale"> |
| | | <view class="to-store-car to-store-btn" v-if="goodsDetail.goodsType != 'VIRTUAL_GOODS'" @click="shutMask(4)"> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import '@/components/uview-components/uview-ui'; |
| | | |
| | | |
| | | /************接口API***************/ |
| | | import { getGoods, getGoodsList, getMpScene, getGoodsDistribution } from "@/api/goods.js"; |
| | | import * as API_trade from "@/api/trade.js"; |
| | |
| | | import storage from "@/utils/storage.js"; |
| | | |
| | | /************组件***************/ |
| | | import PromotionLayout from "./product/promotion/-promotion"; //促销组件 |
| | | import PromotionDetailsLayout from "./product/promotion/-promotion-details"; //促销活动详情 |
| | | import PromotionAssembleLayout from "./product/promotion/-promotion-assemble-promotions"; //促销活动条 |
| | | import PromotionAssembleListLayout from "./product/promotion/-promotion-assemble-list"; //拼团用户列表 |
| | | import PromotionCoupon from "./product/promotion/-promotion-coupon"; //优惠券组件 |
| | | import GoodsIntro from "./product/goods/-goods-intro"; //商品介绍组件 |
| | | import GoodsRecommend from "./product/goods/-goods-recommend"; //宝贝推荐 |
| | | import storeLayout from "./product/shop/-shop"; //店铺组件 |
| | | import Evaluation from "./product/evaluation/-evaluation"; //评价组件 |
| | | import GoodsSwiper from "./product/goods/-goods-swiper"; //轮播图组件 |
| | | import popupGoods from "@/components/m-buy/goods"; //购物车商品的模块 |
| | | import popupAddress from "./product/popup/address"; //地址选择模块 |
| | | import shares from "@/components/m-share/index"; //分享 |
| | | import popups from "@/components/popups/popups"; //气泡框 |
| | | import takeDownFormSaleGoods from "@/components/m-take-down-sale-goods/index"; //下架框 |
| | | import PromotionLayout from "@/pages/product/product/promotion/-promotion.vue"; //促销组件 |
| | | import PromotionDetailsLayout from "@/pages/product/product/promotion/-promotion-details.vue"; //促销活动详情 |
| | | import PromotionAssembleLayout from "@/pages/product/product/promotion/-promotion-assemble-promotions.vue"; //促销活动条 |
| | | import PromotionAssembleListLayout from "@/pages/product/product/promotion/-promotion-assemble-list.vue"; //拼团用户列表 |
| | | import PromotionCoupon from "@/pages/product/product/promotion/-promotion-coupon.vue"; //优惠券组件 |
| | | import GoodsIntro from "@/pages/product/product/goods/-goods-intro.vue"; //商品介绍组件 |
| | | import GoodsRecommend from "@/pages/product/product/goods/-goods-recommend.vue"; //宝贝推荐 |
| | | import storeLayout from "@/pages/product/product/shop/-shop.vue"; //店铺组件 |
| | | import Evaluation from "@/pages/product/product/evaluation/-evaluation"; //评价组件 |
| | | import GoodsSwiper from "@/pages/product/product/goods/-goods-swiper.vue"; //轮播图组件 |
| | | import popupGoods from "@/pages/product/m-buy/goods.vue"; //购物车商品的模块 |
| | | import popupAddress from "@/pages/product/product/popup/address.vue"; //地址选择模块 |
| | | import shares from "@/pages/product/m-share/index.vue"; //分享 |
| | | import popups from "@/pages/product/popups/popups.vue"; //气泡框 |
| | | import takeDownFormSaleGoods from "@/pages/product/m-take-down-sale-goods/index.vue"; //下架框 |
| | | import setup from "./product/popup/popup"; |
| | | |
| | | import { |
| | | getSTSToken |
| | | } from '@/api/common.js' |
| | | export default { |
| | | components: { |
| | | popups, |
| | |
| | | // #endif |
| | | navbarListData: [ |
| | | //导航栏列表栏数据 |
| | | { |
| | | title: "首页", |
| | | icon: "home-fill", |
| | | ___type: "other", |
| | | }, |
| | | // { |
| | | // title: "首页", |
| | | // icon: "home-fill", |
| | | // ___type: "other", |
| | | // }, |
| | | { |
| | | title: "购物车", |
| | | icon: "bag-fill", |
| | | ___type: "other", |
| | | }, |
| | | { |
| | | title: "搜索", |
| | | icon: "search", |
| | | ___type: "category", |
| | | }, |
| | | // { |
| | | // title: "搜索", |
| | | // icon: "search", |
| | | // ___type: "category", |
| | | // }, |
| | | { |
| | | title: "个人中心", |
| | | icon: "account-fill", |
| | |
| | | text: "详情", |
| | | id: "3", |
| | | }, |
| | | { |
| | | text: "推荐", |
| | | id: "4", |
| | | }, |
| | | // { |
| | | // text: "推荐", |
| | | // id: "4", |
| | | // }, |
| | | ], |
| | | tabScrollTop: null, |
| | | scrollArr: [], |
| | |
| | | this.productRefHeight = windowHeight - bottomHeight + "px"; |
| | | }, |
| | | async onLoad (options) { |
| | | this.routerVal = options; |
| | | |
| | | if(options.q){ |
| | | const queryParam = { |
| | | id:'', |
| | | goodsId:'', |
| | | distributionId:'' |
| | | }; |
| | | const decodedUrl = decodeURIComponent(decodeURIComponent(options.q)); |
| | | console.log('原始URL:', decodedUrl); |
| | | const params = this.parseUrlParams(decodedUrl); |
| | | const id = params.id; |
| | | const gooodsId = params.goodsId; |
| | | queryParam.id = id; |
| | | queryParam.goodsId = gooodsId; |
| | | this.routerVal = queryParam; |
| | | }else{ |
| | | this.routerVal = options; |
| | | } |
| | | console.log('打印信息') |
| | | console.log(options) |
| | | console.log(this.routerVal) |
| | | |
| | | // #ifdef MP-WEIXIN |
| | | // 小程序默认分享 |
| | | uni.showShareMenu({ |
| | |
| | | }, |
| | | |
| | | methods: { |
| | | // 解析URL参数 |
| | | parseUrlParams(url) { |
| | | const params = {}; |
| | | // 处理可能存在的hash(如果有的话) |
| | | const cleanUrl = url.split('#')[0]; |
| | | const queryStr = cleanUrl.split('?')[1] || ''; |
| | | |
| | | queryStr.split('&').forEach(pair => { |
| | | const [key, value] = pair.split('='); |
| | | if (key) { |
| | | // 如果值存在,则解码,否则设为空字符串 |
| | | params[key] = value ? decodeURIComponent(value) : ''; |
| | | } |
| | | }); |
| | | |
| | | return params; |
| | | }, |
| | | // 重新打开下架 |
| | | reStartTakeDownSale(){ |
| | | this.$refs.takeDownSale.show = true |
| | |
| | | * 初始化信息 |
| | | */ |
| | | async init (id, goodsId, distributionId = "") { |
| | | console.log('打印id:' + id) |
| | | console.log('打印goodsId:'+ goodsId) |
| | | this.isGroup = false; //初始化拼团 |
| | | this.productId = id; // skuId |
| | | // 这里请求获取到页面数据 解析数据 |
| | |
| | | this.$store.state.distributionId = distributionId; |
| | | } |
| | | } |
| | | const sts = await getSTSToken(); |
| | | const stsUrl = sts.data.data.endpoint |
| | | // // 处理数据 |
| | | // goodsList.data.result.records.forEach(item => { |
| | | // if (item.thumbnail !== '' && item.thumbnail !== null && item.thumbnail.indexOf('http') === |
| | | // -1) { |
| | | // item.thumbnail = stsUrl + '/' + item.thumbnail |
| | | // } |
| | | // if (item.goodsVideo !== '' && item.goodsVideo !== null && item.goodsVideo.indexOf( |
| | | // 'http') === -1) { |
| | | // item.goodsVideo = stsUrl + '/' + item.goodsVideo |
| | | // } |
| | | // }) |
| | | /**商品信息以及规格信息存储 */ |
| | | console.log('--------------------------1>',response.data.result.data.goodsGalleryList) |
| | | response.data.result.data.goodsGalleryList.forEach((item,index)=>{ |
| | | if (item !== '' && item !== null && item.indexOf('http') === |
| | | -1) { |
| | | response.data.result.data.goodsGalleryList[index] = stsUrl + '/' + item |
| | | console.log('是否执行-------------》',item) |
| | | } |
| | | }) |
| | | console.log('--------------------------2>',response.data.result.data.goodsGalleryList) |
| | | this.goodsDetail = response.data.result.data; |
| | | if (this.goodsDetail.goodsVideo !== '' && this.goodsDetail.goodsVideo !== null && this.goodsDetail.goodsVideo.indexOf( |
| | | 'http') === -1) { |
| | | this.goodsDetail.goodsVideo = stsUrl + '/' + this.goodsDetail.goodsVideo |
| | | } |
| | | console.log('--------------------------2>',this.goodsDetail.goodsGalleryList) |
| | | this.wholesaleList = response.data.result.wholesaleList; |
| | | this.goodsSpec = response.data.result.specs; |
| | | this.PromotionList = response.data.result.promotionMap; |
| | | this.goodsParams = response.data.result.goodsParamsDTOList || []; |
| | | |
| | | console.log('优惠卷活动--------------------》',response.data.result.promotionMap) |
| | | // 判断是否拼团活动或者积分商品 如果有则显示拼团活动信息 |
| | | this.PromotionList && |
| | | Object.keys(this.PromotionList).forEach((item) => { |
| | |
| | | * 查看购物车 |
| | | */ |
| | | reluchToCart () { |
| | | console.log('点击了购物车-----------------------》') |
| | | let obj = { |
| | | from: "product", |
| | | id: this.productId, |
| | | }; |
| | | storage.setCartBackbtn(obj); |
| | | uni.switchTab({ |
| | | url: "/pages/tabbar/cart/cartList", |
| | | uni.redirectTo({ |
| | | url: "/pages/cusbar/cart/cartList", |
| | | }); |
| | | }, |
| | | |
| | |
| | | */ |
| | | back () { |
| | | if (getCurrentPages().length == 1) { |
| | | uni.switchTab({ |
| | | url: "/pages/tabbar/home/index", |
| | | uni.redirectTo({ |
| | | url: "/pages/commodity-square/commoditySquare", |
| | | }); |
| | | } else { |
| | | uni.navigateBack(); |