2021-05-13 11:03:32 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div class="main-page">
|
|
|
|
|
<!-- #ifdef APP-PLUS -->
|
|
|
|
|
<view class="status_bar"></view>
|
|
|
|
|
<!-- #endif -->
|
|
|
|
|
<!-- 仅h5有效 打开App -->
|
|
|
|
|
|
|
|
|
|
<!-- 分享 -->
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<shares v-if="enableShare && goodsDetail.id" :skuId="this.routerVal.id" :goodsId="this.routerVal.goodsId" :link="
|
2023-02-10 14:13:22 +08:00
|
|
|
|
'/pages/product/goods?id=' +
|
|
|
|
|
this.routerVal.id +
|
|
|
|
|
'&goodsId=' +
|
|
|
|
|
this.routerVal.goodsId
|
|
|
|
|
" :thumbnail="goodsDetail.thumbnail" :goodsName="goodsDetail.goodsName" type="goods"
|
|
|
|
|
@close="enableShare = false" />
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<popups v-model="popupsSwitch" @tapPopup="handleNavbarList" :popData="navbarListData" :x="navbarListX"
|
|
|
|
|
:y="navbarListY" placement="top-start" />
|
2021-05-13 11:03:32 +08:00
|
|
|
|
<view class="index">
|
2021-06-08 09:22:00 +08:00
|
|
|
|
<!-- topBar -->
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<u-navbar :background="navbar" :is-back="false" :class="headerFlag ? 'header' : 'header bg-none scroll-hide'">
|
2021-05-13 11:03:32 +08:00
|
|
|
|
<div class="headerRow">
|
2021-06-08 09:22:00 +08:00
|
|
|
|
<div class="backs">
|
|
|
|
|
<u-icon @click="back()" name="arrow-left" class="icon-back"></u-icon>
|
|
|
|
|
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<u-icon name="list" @click="popupsSwitch = !popupsSwitch" class="icon-list"></u-icon>
|
2021-05-13 11:03:32 +08:00
|
|
|
|
</div>
|
2021-06-08 09:22:00 +08:00
|
|
|
|
<div class="headerList" :class="headerFlag ? 'tab-bar' : 'tab-bar scroll-hide'">
|
2021-05-13 11:03:32 +08:00
|
|
|
|
<div class="headerRow">
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<div class="nav-item" v-for="header in headerList" :key="header.id"
|
|
|
|
|
:class="{ cur: scrollId === header.id }" @click="headerTab(header.id)">
|
2021-05-13 11:03:32 +08:00
|
|
|
|
{{ header.text }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</u-navbar>
|
|
|
|
|
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<u-navbar :border-bottom="false" v-show="!headerFlag" class="header-only-back" :background="navbarOnlyBack"
|
|
|
|
|
:is-back="false">
|
2021-06-08 09:22:00 +08:00
|
|
|
|
<div>
|
|
|
|
|
<div class="bg-back">
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<u-icon size="40" @click="back()" name="arrow-left" class="icon-back"></u-icon>
|
|
|
|
|
<u-icon size="40" @click="popupsSwitch = !popupsSwitch" name="list" class="icon-list"></u-icon>
|
2021-06-08 09:22:00 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</u-navbar>
|
2021-05-13 11:03:32 +08:00
|
|
|
|
</view>
|
2021-06-08 09:22:00 +08:00
|
|
|
|
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<view class="product-container" :style="{ height: productRefHeight }" ref="productRef" id="productRef">
|
|
|
|
|
<scroll-view scroll-anchoring enableBackToTop="true" scroll-with-animation scroll-y class="scroll-page"
|
|
|
|
|
:scroll-top="tabScrollTop" @scroll="pageScroll">
|
2021-05-13 11:03:32 +08:00
|
|
|
|
<view>
|
|
|
|
|
<!-- 轮播图 -->
|
2023-07-20 15:50:29 +08:00
|
|
|
|
|
|
|
|
|
<GoodsSwiper id="main1" :res="imgList" :video="goodsDetail.goodsVideo" />
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
|
|
|
|
<!-- 促销活动条 -->
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<PromotionAssembleLayout v-if="PromotionList" :detail="goodsDetail" :res="PromotionList" />
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
|
|
|
|
<view class="card-box top-radius-0" id="main2">
|
|
|
|
|
<!-- 活动不显示价钱 -->
|
2022-06-01 11:30:23 +08:00
|
|
|
|
<view v-if="isSeckill || isGroup" class="desc-bold -goods-msg">
|
2021-05-13 11:03:32 +08:00
|
|
|
|
<view class="-goods-flex">
|
2021-06-08 09:22:00 +08:00
|
|
|
|
<view class="desc-bold">
|
2021-05-13 11:03:32 +08:00
|
|
|
|
{{ goodsDetail.goodsName || "" }}
|
|
|
|
|
</view>
|
|
|
|
|
<view class="favorite" @click="clickFavorite(goodsDetail.id)">
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<u-icon size="30" :color="favorite ? '#f2270c' : '#262626'" :name="favorite ? 'heart-fill' : 'heart'">
|
2021-09-02 16:08:35 +08:00
|
|
|
|
</u-icon>
|
2021-12-11 13:48:18 +08:00
|
|
|
|
<view :style="{ color: favorite ? '#f2270c' : '#262626' }">{{
|
2023-02-10 14:13:22 +08:00
|
|
|
|
favorite? "已收藏": "收藏"
|
|
|
|
|
}}</view>
|
2021-05-13 11:03:32 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 商品描述 -->
|
|
|
|
|
<view class="-goods-desc">
|
2021-12-11 13:48:18 +08:00
|
|
|
|
{{ goodsDetail.sellingPoint || "" }}
|
2021-05-13 11:03:32 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-else class="-goods-msg">
|
|
|
|
|
<!-- 没有拼团,秒杀等活动的情况下 -->
|
|
|
|
|
<view>
|
|
|
|
|
<view class="-goods-flex">
|
|
|
|
|
<!-- 如果有积分显示积分 -->
|
|
|
|
|
<view class="-goods-price" v-if="goodsDetail.price != undefined">
|
2022-12-27 14:49:23 +08:00
|
|
|
|
|
|
|
|
|
<span>
|
|
|
|
|
<span v-if="wholesaleList.length">
|
|
|
|
|
<span>¥</span><span class="price">{{
|
2023-02-10 14:13:22 +08:00
|
|
|
|
$options.filters.goodsFormatPrice(wholesaleList[wholesaleList.length - 1].price)[0]
|
|
|
|
|
}}</span>.{{
|
2023-05-10 10:46:23 +08:00
|
|
|
|
$options.filters.goodsFormatPrice(wholesaleList[wholesaleList.length - 1].price)[1]
|
|
|
|
|
}}
|
2022-12-27 14:49:23 +08:00
|
|
|
|
~
|
|
|
|
|
<span>¥</span><span class="price">{{
|
2023-02-10 14:13:22 +08:00
|
|
|
|
$options.filters.goodsFormatPrice(wholesaleList[0].price)[0]
|
|
|
|
|
}}</span>.{{
|
2023-05-10 10:46:23 +08:00
|
|
|
|
$options.filters.goodsFormatPrice(wholesaleList[0].price)[1]
|
|
|
|
|
}}
|
2022-12-27 14:49:23 +08:00
|
|
|
|
</span>
|
|
|
|
|
<span v-else>
|
2023-02-10 14:13:22 +08:00
|
|
|
|
<span>¥</span><span class="price">{{
|
|
|
|
|
$options.filters.goodsFormatPrice(goodsDetail.price)[0]
|
|
|
|
|
}}</span>.{{ $options.filters.goodsFormatPrice(goodsDetail.price)[1] }}
|
2022-12-27 14:49:23 +08:00
|
|
|
|
</span>
|
2021-12-11 13:48:18 +08:00
|
|
|
|
</span>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="-goods-price" v-else>
|
2023-05-10 10:46:23 +08:00
|
|
|
|
<div v-if="takeDownFromSale" class="price down-goods">
|
|
|
|
|
暂无报价
|
|
|
|
|
</div>
|
|
|
|
|
<span v-else>
|
2021-12-11 13:48:18 +08:00
|
|
|
|
¥<span class="price">0 </span>.00
|
2023-05-10 10:46:23 +08:00
|
|
|
|
</span>
|
2021-05-13 11:03:32 +08:00
|
|
|
|
</view>
|
2021-06-08 09:22:00 +08:00
|
|
|
|
|
|
|
|
|
<view class="icons share" @click="shareChange()">
|
|
|
|
|
<u-icon size="30" name="share-fill"></u-icon>
|
|
|
|
|
<view>分享</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="icons" @click="clickFavorite(goodsDetail.id)">
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<u-icon size="30" :color="favorite ? '#f2270c' : '#262626'"
|
|
|
|
|
:name="favorite ? 'heart-fill' : 'heart'"></u-icon>
|
2021-12-11 13:48:18 +08:00
|
|
|
|
<view :style="{ color: favorite ? '#f2270c' : '#262626' }">{{
|
2023-02-10 14:13:22 +08:00
|
|
|
|
favorite? "已收藏": "收藏"
|
|
|
|
|
}}</view>
|
2021-05-13 11:03:32 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2021-06-08 09:22:00 +08:00
|
|
|
|
<view class="-goods-name desc-bold">
|
2021-05-13 11:03:32 +08:00
|
|
|
|
{{ goodsDetail.goodsName || "" }}
|
|
|
|
|
</view>
|
|
|
|
|
<view class="-goods-desc">
|
2021-12-11 13:48:18 +08:00
|
|
|
|
{{ goodsDetail.sellingPoint || "" }}
|
2021-05-13 11:03:32 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<view class="card-box">
|
|
|
|
|
<view class="card-flex" @click="shutMask(1)">
|
|
|
|
|
<view class="card-title"> 促销 </view>
|
|
|
|
|
<view class="card-content">
|
|
|
|
|
<span v-if="PromotionList && emptyPromotion()">暂无促销信息</span>
|
|
|
|
|
<PromotionLayout v-else @shutMasks="shutMask" :res="PromotionList" />
|
|
|
|
|
</view>
|
|
|
|
|
<view class="card-bottom">
|
|
|
|
|
<u-icon name="more-dot-fill"></u-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 拼团用户列表 -->
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<PromotionAssembleListLayout v-if="isGroup" @to-assemble-buy-now="toAssembleBuyNow" :res="PromotionList" />
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
2021-06-09 20:12:26 +08:00
|
|
|
|
<!-- 配置地址 如果是虚拟产品的时候不展示 -->
|
2021-12-11 13:48:18 +08:00
|
|
|
|
<view class="card-box" v-if="goodsDetail.goodsType != 'VIRTUAL_GOODS'">
|
2021-05-13 11:03:32 +08:00
|
|
|
|
<view class="card-flex" @click="shutMask(4)">
|
|
|
|
|
<view class="card-title"> 已选 </view>
|
|
|
|
|
<view class="card-content">
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<span v-if="selectedGoods.spec">{{ selectedGoods.spec.specName }}-{{
|
2023-02-10 14:13:22 +08:00
|
|
|
|
selectedGoods.spec.specValue
|
|
|
|
|
}}</span>
|
2021-06-24 18:11:11 +08:00
|
|
|
|
<span v-else>默认</span>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="card-bottom">
|
|
|
|
|
<u-icon name="more-dot-fill"></u-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="card-flex" @click="shutMask(3)">
|
2021-12-20 17:34:27 +08:00
|
|
|
|
<view class="card-title"> 送至</view>
|
2021-06-24 18:11:11 +08:00
|
|
|
|
<view class="card-content">
|
|
|
|
|
<span v-if="delivery">{{
|
2023-02-10 14:13:22 +08:00
|
|
|
|
delivery.consigneeAddressPath | clearStrComma
|
|
|
|
|
}}</span>
|
2021-05-13 11:03:32 +08:00
|
|
|
|
<span v-else>暂无地址信息</span>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="card-bottom">
|
|
|
|
|
<u-icon name="more-dot-fill"></u-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 评价 -->
|
2021-06-08 09:22:00 +08:00
|
|
|
|
<Evaluation id="main5" :goodsDetail="goodsDetail" />
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
|
|
|
|
<!-- 店铺推荐 -->
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<storeLayout id="main7" :storeDetail="storeDetail" :goodsDetail="goodsDetail" :res="recommendList" />
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
|
|
|
|
<!-- 宝贝详情 -->
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<GoodsIntro id="main9" :res="goodsDetail" :goodsParams="goodsParams" :goodsId="goodsDetail.goodsId"
|
|
|
|
|
v-if="goodsDetail.id" />
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
|
|
|
|
<!-- 宝贝推荐 -->
|
|
|
|
|
<GoodsRecommend id="main11" :res="likeGoodsList" />
|
|
|
|
|
</view>
|
|
|
|
|
</scroll-view>
|
|
|
|
|
|
2023-05-10 10:46:23 +08:00
|
|
|
|
|
2021-05-13 11:03:32 +08:00
|
|
|
|
<view class="page-bottom mp-iphonex-bottom" id="pageBottom">
|
|
|
|
|
<view class="icon-btn">
|
2021-05-17 18:19:26 +08:00
|
|
|
|
<view class="icon-btn-item" @click="navigateToStore(goodsDetail.storeId)">
|
2021-05-13 11:03:32 +08:00
|
|
|
|
<u-icon size="34" class="red" name="home-fill"></u-icon>
|
|
|
|
|
<view class="red icon-btn-name">店铺</view>
|
|
|
|
|
</view>
|
2021-06-24 17:59:03 +08:00
|
|
|
|
<view class="icon-btn-item" @click="linkMsgDetail()">
|
2021-05-13 11:03:32 +08:00
|
|
|
|
<u-icon size="34" name="kefu-ermai"></u-icon>
|
|
|
|
|
<view class="icon-btn-name">客服</view>
|
2021-06-24 17:59:03 +08:00
|
|
|
|
</view>
|
2021-05-13 11:03:32 +08:00
|
|
|
|
<view class="icon-btn-item" @click="reluchToCart()">
|
|
|
|
|
<u-icon size="34" name="storeping-cart"></u-icon>
|
|
|
|
|
<view class="icon-btn-name">购物车</view>
|
|
|
|
|
<view v-if="nums && nums > 0" class="num-icon">{{ nums }}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2023-05-10 10:46:23 +08:00
|
|
|
|
<!-- 下架展示 -->
|
|
|
|
|
<div class="detail-btn" v-if="takeDownFromSale">
|
|
|
|
|
<view class="to-store-car to-store-btn" @click="reStartTakeDownSale">
|
|
|
|
|
查看类似商品</view>
|
|
|
|
|
</div>
|
2021-05-13 11:03:32 +08:00
|
|
|
|
<!-- 正常结算页面 -->
|
2023-05-10 10:46:23 +08:00
|
|
|
|
<view class="detail-btn" v-if="!isGroup && !takeDownFromSale">
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<view class="to-store-car to-store-btn" v-if="goodsDetail.goodsType != 'VIRTUAL_GOODS'" @click="shutMask(4)">
|
|
|
|
|
加入购物车</view>
|
2021-05-13 11:03:32 +08:00
|
|
|
|
<view class="to-buy to-store-btn" @click="shutMask(4, 'buy')">立即购买</view>
|
|
|
|
|
<view class="to-store-car to-store-btn" v-if="startTimer">暂未开始</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 拼团结算 -->
|
2023-05-10 10:46:23 +08:00
|
|
|
|
<view class="detail-btn" v-else-if="isGroup">
|
2021-05-13 11:03:32 +08:00
|
|
|
|
<view class="to-store-car pt-buy to-store-btn" @click="shutMask(4, 'buy')">
|
|
|
|
|
<view>¥{{ goodsDetail.price | unitPrice }}</view>
|
|
|
|
|
<view>单独购买</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="to-buy pt-buy to-store-btn" @click="toAssembleBuyNow">
|
|
|
|
|
<view>¥{{ goodsDetail.promotionPrice | unitPrice }}</view>
|
|
|
|
|
<view>拼团价格</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 规格-模态层弹窗 -->
|
2021-10-15 18:01:54 +08:00
|
|
|
|
<view class="spec">
|
2021-05-13 11:03:32 +08:00
|
|
|
|
<!-- 促销弹窗 -->
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<u-popup v-model="promotionShow" :height="setup.height" :mode="setup.mode" :border-radius="setup.radius"
|
|
|
|
|
@close="promotionShow = false" :mask-close-able="setup.close" closeable>
|
2021-10-15 18:01:54 +08:00
|
|
|
|
<view class="header-title">优惠</view>
|
|
|
|
|
<view class="cuxiao">
|
|
|
|
|
<scroll-view class="scroll_mask" :scroll-y="true">
|
|
|
|
|
<view class="con-cuxiao">
|
|
|
|
|
<view class="cuxiao-title">促销活动</view>
|
|
|
|
|
<PromotionDetailsLayout :res="PromotionList" />
|
|
|
|
|
</view>
|
|
|
|
|
<view class="con-cuxiao coupons">
|
|
|
|
|
<view class="cuxiao-title">可领优惠券</view>
|
|
|
|
|
<PromotionCoupon @getCoupon="getCoupon" :res="PromotionList" />
|
|
|
|
|
</view>
|
|
|
|
|
</scroll-view>
|
2021-05-13 11:03:32 +08:00
|
|
|
|
</view>
|
2021-10-15 18:01:54 +08:00
|
|
|
|
</u-popup>
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
|
|
|
|
<!-- 配送地址弹窗 -->
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<popupAddress @closeAddress="closePopupAddress" @deliveryData="deliveryFun" v-if="goodsDetail.id"
|
|
|
|
|
:goodsId="goodsDetail.id" :addressFlag="addressFlag" />
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
|
|
|
|
<!-- 商品规格 商品详情,以及默认参与活动的id-->
|
2022-12-27 14:49:23 +08:00
|
|
|
|
<popupGoods :addr="delivery" ref="popupGoods" @changed="changedGoods" @closeBuy="closePopupBuy"
|
|
|
|
|
@queryCart="cartCount()" :goodsDetail="goodsDetail" :goodsSpec="goodsSpec" :isGroup="isGroup" :id="productId"
|
|
|
|
|
v-if="goodsDetail.id" :pointDetail="pointDetail" :wholesaleList="wholesaleList" @handleClickSku="selectSku"
|
|
|
|
|
:buyMask="buyMask" />
|
2023-05-10 10:46:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 下架框 -->
|
|
|
|
|
<takeDownFormSaleGoods ref="takeDownSale" v-if="takeDownFromSale" />
|
2021-05-13 11:03:32 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
/************接口API***************/
|
2021-12-11 13:48:18 +08:00
|
|
|
|
import { getGoods, getGoodsList, getMpScene, getGoodsDistribution } from "@/api/goods.js";
|
2021-05-13 11:03:32 +08:00
|
|
|
|
import * as API_trade from "@/api/trade.js";
|
|
|
|
|
import * as API_Members from "@/api/members.js";
|
|
|
|
|
import * as API_store from "@/api/store.js";
|
2021-12-23 16:06:59 +08:00
|
|
|
|
import { getIMDetail } from "@/api/common";
|
2021-06-08 09:22:00 +08:00
|
|
|
|
import { modelNavigateTo } from "@/pages/tabbar/home/template/tpl.js";
|
2021-05-13 11:03:32 +08:00
|
|
|
|
/************请求存储***************/
|
|
|
|
|
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"; //轮播图组件
|
2021-11-15 16:19:53 +08:00
|
|
|
|
import popupGoods from "@/components/m-buy/goods"; //购物车商品的模块
|
2021-05-13 11:03:32 +08:00
|
|
|
|
import popupAddress from "./product/popup/address"; //地址选择模块
|
|
|
|
|
import shares from "@/components/m-share/index"; //分享
|
2021-06-08 09:22:00 +08:00
|
|
|
|
import popups from "@/components/popups/popups"; //气泡框
|
2023-05-10 10:46:23 +08:00
|
|
|
|
import takeDownFormSaleGoods from "@/components/m-take-down-sale-goods/index"; //下架框
|
2021-10-15 18:01:54 +08:00
|
|
|
|
import setup from "./product/popup/popup";
|
2022-12-26 15:07:24 +08:00
|
|
|
|
|
2021-05-13 11:03:32 +08:00
|
|
|
|
export default {
|
|
|
|
|
components: {
|
2021-06-08 09:22:00 +08:00
|
|
|
|
popups,
|
2021-05-13 11:03:32 +08:00
|
|
|
|
shares,
|
|
|
|
|
PromotionLayout,
|
|
|
|
|
PromotionDetailsLayout,
|
|
|
|
|
PromotionAssembleLayout,
|
|
|
|
|
PromotionAssembleListLayout,
|
|
|
|
|
PromotionCoupon,
|
|
|
|
|
GoodsIntro,
|
|
|
|
|
GoodsRecommend,
|
|
|
|
|
storeLayout,
|
|
|
|
|
Evaluation,
|
|
|
|
|
GoodsSwiper,
|
|
|
|
|
popupGoods,
|
|
|
|
|
popupAddress,
|
2023-05-10 10:46:23 +08:00
|
|
|
|
takeDownFormSaleGoods
|
2021-05-13 11:03:32 +08:00
|
|
|
|
},
|
2022-12-27 14:49:23 +08:00
|
|
|
|
data () {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
return {
|
2021-10-15 18:01:54 +08:00
|
|
|
|
setup,
|
2021-12-23 18:36:00 +08:00
|
|
|
|
promotionShow: false, //弹窗开关
|
2021-06-08 09:22:00 +08:00
|
|
|
|
// #ifdef H5
|
|
|
|
|
navbarListX: 110, //导航栏列表栏x轴
|
|
|
|
|
navbarListY: 80, //导航栏列表栏y轴
|
|
|
|
|
// #endif
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
navbarListX: 100, //导航栏列表栏x轴
|
|
|
|
|
navbarListY: 140, //导航栏列表栏y轴
|
|
|
|
|
// #endif
|
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
|
navbarListX: 120, //导航栏列表栏x轴
|
|
|
|
|
navbarListY: 170, //导航栏列表栏y轴
|
|
|
|
|
// #endif
|
|
|
|
|
navbarListData: [
|
|
|
|
|
//导航栏列表栏数据
|
|
|
|
|
{
|
|
|
|
|
title: "首页",
|
|
|
|
|
icon: "home-fill",
|
|
|
|
|
___type: "other",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "购物车",
|
|
|
|
|
icon: "bag-fill",
|
|
|
|
|
___type: "other",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "搜索",
|
|
|
|
|
icon: "search",
|
|
|
|
|
___type: "category",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "个人中心",
|
|
|
|
|
icon: "account-fill",
|
|
|
|
|
___type: "other",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
popupsSwitch: false, //导航栏列表栏开关
|
2022-06-01 11:30:23 +08:00
|
|
|
|
enableShare: false,
|
2021-05-13 11:03:32 +08:00
|
|
|
|
selectedGoods: "", //选择的商品规格昵称
|
|
|
|
|
isGroup: false, // 是否是拼团活动
|
2022-12-27 14:49:23 +08:00
|
|
|
|
isSeckill: false, // 是否秒杀活动
|
2021-05-13 11:03:32 +08:00
|
|
|
|
pointDetail: "", // 是否是积分商品
|
|
|
|
|
assemble: "", //拼团的sku
|
2021-06-08 09:22:00 +08:00
|
|
|
|
navbarOnlyBack: {
|
|
|
|
|
background: "transparent",
|
|
|
|
|
},
|
2021-05-13 11:03:32 +08:00
|
|
|
|
navbar: {
|
|
|
|
|
background: "#fff",
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
productRefHeight: "",
|
|
|
|
|
header: {
|
|
|
|
|
top: 0,
|
|
|
|
|
height: 50,
|
|
|
|
|
},
|
2021-07-22 17:32:33 +08:00
|
|
|
|
goodsParams: [], // 商品参数
|
2021-05-13 11:03:32 +08:00
|
|
|
|
headerFlag: false, //顶部导航显示与否
|
|
|
|
|
headerList: [
|
2021-06-08 09:22:00 +08:00
|
|
|
|
//顶部导航文字按照规则来 详情全局搜索
|
2021-05-13 11:03:32 +08:00
|
|
|
|
{
|
|
|
|
|
text: "商品",
|
|
|
|
|
id: "1",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: "评价",
|
|
|
|
|
id: "2",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: "详情",
|
|
|
|
|
id: "3",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: "推荐",
|
|
|
|
|
id: "4",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
tabScrollTop: null,
|
|
|
|
|
scrollArr: [],
|
|
|
|
|
scrollId: "1",
|
|
|
|
|
scrollFlag: true,
|
|
|
|
|
current: "1", //当前显示的轮播图页
|
|
|
|
|
goodsDetail: {}, //商品数据
|
|
|
|
|
goodsSpec: "", //规格数据
|
|
|
|
|
imgList: [], //轮播图数据
|
|
|
|
|
favorite: false, //收藏与否flag
|
|
|
|
|
recommendList: [], //推荐列表
|
2021-10-15 18:01:54 +08:00
|
|
|
|
// maskFlag: false, //模态显示与否
|
2021-05-13 11:03:32 +08:00
|
|
|
|
goodsInfo: false, //商品介绍弹窗
|
|
|
|
|
addressFlag: false, //配送地址弹窗
|
|
|
|
|
buyMask: false, //添加购物车直接购买,查看已选 弹窗
|
|
|
|
|
num: 1, //添加到购物车的数量
|
|
|
|
|
skuId: "", //
|
|
|
|
|
storeDetail: "", //店铺基本信息,
|
|
|
|
|
// 店铺信息
|
|
|
|
|
storeParams: {
|
|
|
|
|
pageNumber: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
likeGoodsList: "", //相似商品列表
|
|
|
|
|
PromotionList: "", //活动,促销,列表
|
|
|
|
|
specList: [],
|
|
|
|
|
selectedSpec: [],
|
|
|
|
|
nums: 0,
|
|
|
|
|
delivery: "",
|
|
|
|
|
|
|
|
|
|
exchange: {},
|
|
|
|
|
productId: 0,
|
|
|
|
|
|
|
|
|
|
startTimer: false, //未开启 是false
|
|
|
|
|
|
|
|
|
|
routerVal: "",
|
2022-06-01 11:02:25 +08:00
|
|
|
|
IMLink: "", // IM地址
|
2023-05-10 10:46:23 +08:00
|
|
|
|
wholesaleList: [],
|
|
|
|
|
takeDownFromSale: false, // 下架销售状态
|
2021-05-13 11:03:32 +08:00
|
|
|
|
};
|
|
|
|
|
},
|
2021-10-26 15:27:13 +08:00
|
|
|
|
|
2022-06-01 11:02:25 +08:00
|
|
|
|
computed: {
|
2022-12-27 14:49:23 +08:00
|
|
|
|
// udesk IM
|
|
|
|
|
IM () {
|
2021-12-20 17:34:27 +08:00
|
|
|
|
return this.IMLink + this.storeDetail.merchantEuid;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
2021-05-13 11:03:32 +08:00
|
|
|
|
watch: {
|
2022-12-27 14:49:23 +08:00
|
|
|
|
isGroup (val) {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
if (val) {
|
|
|
|
|
let timer = setInterval(() => {
|
|
|
|
|
this.$refs.popupGoods.buyType = "PINTUAN";
|
|
|
|
|
clearInterval(timer);
|
|
|
|
|
}, 100);
|
|
|
|
|
} else {
|
|
|
|
|
this.$refs.popupGoods.buyType = "";
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-12-27 14:49:23 +08:00
|
|
|
|
mounted () {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
const { windowHeight } = uni.getSystemInfoSync();
|
|
|
|
|
let bottomHeight = 0;
|
|
|
|
|
let topHeight = 0;
|
|
|
|
|
uni.getSystemInfo({
|
|
|
|
|
success: function (res) {
|
|
|
|
|
// res - 各种参数
|
|
|
|
|
let bottom = uni.createSelectorQuery().select(".page-bottom");
|
|
|
|
|
bottom
|
|
|
|
|
.boundingClientRect(function (data) {
|
|
|
|
|
if (data && data.height) {
|
|
|
|
|
//data - 各种参数
|
|
|
|
|
bottomHeight = data.height; // 获取元素宽度
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.exec();
|
|
|
|
|
let top = uni.createSelectorQuery().select(".header");
|
|
|
|
|
top
|
|
|
|
|
.boundingClientRect(function (data) {
|
|
|
|
|
if (data && data.height) {
|
|
|
|
|
//data - 各种参数
|
|
|
|
|
topHeight = data.height; // 获取元素宽度
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.exec();
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.productRefHeight = windowHeight - bottomHeight + "px";
|
|
|
|
|
},
|
2022-12-27 14:49:23 +08:00
|
|
|
|
async onLoad (options) {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
this.routerVal = options;
|
2021-06-22 18:12:35 +08:00
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
// 小程序默认分享
|
2021-06-25 19:01:37 +08:00
|
|
|
|
uni.showShareMenu({
|
|
|
|
|
withShareTicket: true,
|
|
|
|
|
menus: ["shareAppMessage", "shareTimeline"],
|
|
|
|
|
});
|
2021-06-22 18:12:35 +08:00
|
|
|
|
// #endif
|
2021-05-21 16:47:26 +08:00
|
|
|
|
},
|
2022-12-27 14:49:23 +08:00
|
|
|
|
async onShow () {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
this.goodsDetail = {};
|
|
|
|
|
//如果有参数ids说明事分销短连接,需要获取参数
|
|
|
|
|
if (this.routerVal.scene) {
|
|
|
|
|
getMpScene(this.routerVal.scene).then((res) => {
|
|
|
|
|
if (res.data.success) {
|
|
|
|
|
let data = res.data.result.split(","); // skuId,goodsId,distributionId
|
|
|
|
|
this.init(data[0], data[1], data[2]);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
2021-12-11 13:48:18 +08:00
|
|
|
|
this.init(this.routerVal.id, this.routerVal.goodsId, this.routerVal.distributionId);
|
2021-05-13 11:03:32 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2022-12-27 14:49:23 +08:00
|
|
|
|
|
2021-05-13 11:03:32 +08:00
|
|
|
|
methods: {
|
2023-05-10 10:46:23 +08:00
|
|
|
|
// 重新打开下架
|
|
|
|
|
reStartTakeDownSale(){
|
|
|
|
|
this.$refs.takeDownSale.show = true
|
|
|
|
|
},
|
2022-12-27 14:49:23 +08:00
|
|
|
|
share () {
|
2021-10-26 15:27:13 +08:00
|
|
|
|
return `/pages/product/goods?id=${this.routerVal.id}&goodsId=${this.routerVal.goodsId}`;
|
|
|
|
|
},
|
2021-06-08 09:22:00 +08:00
|
|
|
|
/**
|
|
|
|
|
* 导航栏列表栏
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
handleNavbarList (val) {
|
2021-06-08 09:22:00 +08:00
|
|
|
|
modelNavigateTo({ url: val });
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 循环出当前促销是否为空
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
emptyPromotion () {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
if (
|
|
|
|
|
this.PromotionList == "" ||
|
|
|
|
|
this.PromotionList == null ||
|
|
|
|
|
this.PromotionList == []
|
|
|
|
|
) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-12-27 14:49:23 +08:00
|
|
|
|
selectSku (idObj) {
|
2021-07-02 10:52:36 +08:00
|
|
|
|
this.init(idObj.skuId, idObj.goodsId);
|
|
|
|
|
},
|
2021-06-08 09:22:00 +08:00
|
|
|
|
/**
|
|
|
|
|
* 初始化信息
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
async init (id, goodsId, distributionId = "") {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
this.isGroup = false; //初始化拼团
|
|
|
|
|
this.productId = id; // skuId
|
|
|
|
|
// 这里请求获取到页面数据 解析数据
|
2021-08-09 18:40:06 +08:00
|
|
|
|
|
2021-05-21 16:47:26 +08:00
|
|
|
|
let response = await getGoods(id, goodsId);
|
2023-05-10 10:46:23 +08:00
|
|
|
|
|
|
|
|
|
// 判断当前接口返回内容
|
2021-06-25 19:01:37 +08:00
|
|
|
|
if (!response.data.success) {
|
2023-05-10 10:46:23 +08:00
|
|
|
|
// 商品已下架
|
|
|
|
|
if(response.data.code == 11001){
|
|
|
|
|
this.takeDownFromSale = true
|
|
|
|
|
}
|
|
|
|
|
// setTimeout(() => {
|
|
|
|
|
// uni.navigateBack();
|
|
|
|
|
// }, 500);
|
2021-06-25 19:01:37 +08:00
|
|
|
|
}
|
2021-05-21 16:47:26 +08:00
|
|
|
|
// 这里是绑定分销员
|
|
|
|
|
if (distributionId || this.$store.state.distributionId) {
|
|
|
|
|
let disResult = await getGoodsDistribution(distributionId);
|
|
|
|
|
if (!disResult.data.success || disResult.statusCode == 403) {
|
|
|
|
|
this.$store.state.distributionId = distributionId;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-05-13 11:03:32 +08:00
|
|
|
|
/**商品信息以及规格信息存储 */
|
|
|
|
|
this.goodsDetail = response.data.result.data;
|
2022-05-27 18:17:23 +08:00
|
|
|
|
this.wholesaleList = response.data.result.wholesaleList;
|
2021-05-13 11:03:32 +08:00
|
|
|
|
this.goodsSpec = response.data.result.specs;
|
|
|
|
|
this.PromotionList = response.data.result.promotionMap;
|
2021-07-22 17:32:33 +08:00
|
|
|
|
this.goodsParams = response.data.result.goodsParamsDTOList || [];
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
|
|
|
|
// 判断是否拼团活动或者积分商品 如果有则显示拼团活动信息
|
|
|
|
|
this.PromotionList &&
|
|
|
|
|
Object.keys(this.PromotionList).forEach((item) => {
|
|
|
|
|
// 拼团商品
|
|
|
|
|
if (item.indexOf("PINTUAN") == 0) {
|
|
|
|
|
this.isGroup = true;
|
|
|
|
|
}
|
2022-12-27 14:49:23 +08:00
|
|
|
|
|
2022-06-01 11:30:23 +08:00
|
|
|
|
// 秒杀
|
|
|
|
|
if (item.indexOf("SECKILL") == 0) {
|
|
|
|
|
this.isSeckill = true
|
|
|
|
|
}
|
2021-05-13 11:03:32 +08:00
|
|
|
|
});
|
|
|
|
|
// 轮播图
|
|
|
|
|
this.imgList = this.goodsDetail.goodsGalleryList;
|
|
|
|
|
|
|
|
|
|
// 获取店铺基本信息
|
2021-08-09 18:40:06 +08:00
|
|
|
|
this.getStoreBaseInfoFun(this.goodsDetail.storeId);
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
|
|
|
|
// 获取购物车
|
2021-05-17 18:19:26 +08:00
|
|
|
|
this.cartCount();
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
|
|
|
|
// 获取店铺推荐商品
|
2021-12-20 17:34:27 +08:00
|
|
|
|
this.getStoreRecommend();
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
|
|
|
|
// 获取商品列表
|
|
|
|
|
this.getOtherLikeGoods();
|
|
|
|
|
// 获取商品是否已被收藏 如果未登录不获取
|
|
|
|
|
|
|
|
|
|
if (this.$options.filters.isLogin("auth")) {
|
|
|
|
|
this.getGoodsCollectionFun(this.goodsDetail.id);
|
|
|
|
|
}
|
2021-12-20 17:34:27 +08:00
|
|
|
|
// 获取IM 需要的话使用
|
|
|
|
|
// this.getIMDetailMethods();
|
2021-05-13 11:03:32 +08:00
|
|
|
|
},
|
2021-06-24 18:11:11 +08:00
|
|
|
|
|
2022-12-27 14:49:23 +08:00
|
|
|
|
async getIMDetailMethods () {
|
2021-12-23 16:06:59 +08:00
|
|
|
|
let res = await getIMDetail();
|
|
|
|
|
if (res.data.success) {
|
|
|
|
|
this.IMLink = res.data.result;
|
|
|
|
|
}
|
2021-12-20 17:34:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
2022-12-27 14:49:23 +08:00
|
|
|
|
linkMsgDetail () {
|
2022-06-01 11:02:25 +08:00
|
|
|
|
// lili 基础客服
|
2023-02-10 14:13:22 +08:00
|
|
|
|
this.$options.filters.talkIm(this.goodsDetail.storeId, this.routerVal.goodsId, this.routerVal.id)
|
|
|
|
|
// uni.navigateTo({
|
|
|
|
|
// url: `/pages/mine/im/index?userId=${this.goodsDetail.storeId}&goodsid=${this.routerVal.goodsId}&skuid=${this.routerVal.id}`
|
|
|
|
|
// });
|
2022-12-27 14:49:23 +08:00
|
|
|
|
|
|
|
|
|
// udesk 代码
|
|
|
|
|
// if (this.storeDetail.merchantEuid) {
|
|
|
|
|
// uni.navigateTo({
|
|
|
|
|
// url: `/pages/tabbar/home/web-view?src=${this.IM}`,
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 客服 云智服代码
|
|
|
|
|
// // #ifdef MP-WEIXIN
|
|
|
|
|
// const params = {
|
|
|
|
|
// storeName: this.storeDetail.storeName,
|
|
|
|
|
// goodsName: this.goodsDetail.goodsName,
|
|
|
|
|
// goodsId: this.goodsDetail.goodsId,
|
|
|
|
|
// goodsImg: this.goodsDetail.thumbnail,
|
|
|
|
|
// price: this.goodsDetail.promotionPrice || this.goodsDetail.price,
|
|
|
|
|
// // originalPrice: this.goodsDetail.original || this.goodsDetail.price,
|
|
|
|
|
// uuid: storage.getUuid(),
|
|
|
|
|
// token: storage.getAccessToken(),
|
|
|
|
|
// sign: this.storeDetail.yzfSign,
|
|
|
|
|
// mpSign: this.storeDetail.yzfMpSign,
|
|
|
|
|
// };
|
|
|
|
|
// uni.navigateTo({
|
|
|
|
|
// url:
|
|
|
|
|
// "/pages/product/customerservice/index?params=" +
|
|
|
|
|
// encodeURIComponent(JSON.stringify(params)),
|
|
|
|
|
// });
|
|
|
|
|
// // #endif
|
|
|
|
|
// // #ifndef MP-WEIXIN
|
|
|
|
|
// const sign = this.storeDetail.yzfSign;
|
|
|
|
|
// uni.navigateTo({
|
|
|
|
|
// url:
|
|
|
|
|
// "/pages/tabbar/home/web-view?src=https://yzf.qq.com/xv/web/static/chat/index.html?sign=" +
|
|
|
|
|
// sign,
|
|
|
|
|
// });
|
|
|
|
|
// // #endif
|
|
|
|
|
|
2021-06-08 09:22:00 +08:00
|
|
|
|
},
|
2021-05-17 18:19:26 +08:00
|
|
|
|
/**选择商品 */
|
2022-12-27 14:49:23 +08:00
|
|
|
|
changedGoods (val) {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
this.selectedGoods = val;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/** 点击子级地址回调参数*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
deliveryFun (val) {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
this.delivery = val;
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 地址子级关闭回调
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
closePopupAddress (val) {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
this.addressFlag = val;
|
2021-10-15 18:01:54 +08:00
|
|
|
|
// this.maskFlag = false;
|
2021-05-13 11:03:32 +08:00
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 商品规格子级关闭回调
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
closePopupBuy (val) {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
this.buyMask = val;
|
2021-10-15 18:01:54 +08:00
|
|
|
|
// this.maskFlag = false;
|
2021-05-13 11:03:32 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/** 参与拼团 创建拼团 */
|
2022-12-27 14:49:23 +08:00
|
|
|
|
toAssembleBuyNow (order) {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
this.shutMask(4, "PINTUAN", order);
|
|
|
|
|
},
|
2021-05-17 18:19:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 查看购物车
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
reluchToCart () {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
let obj = {
|
|
|
|
|
from: "product",
|
|
|
|
|
id: this.productId,
|
|
|
|
|
};
|
|
|
|
|
storage.setCartBackbtn(obj);
|
|
|
|
|
uni.switchTab({
|
|
|
|
|
url: "/pages/tabbar/cart/cartList",
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
2021-05-17 18:19:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 查询购物车总数量
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
cartCount () {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
if (storage.getHasLogin()) {
|
|
|
|
|
API_trade.getCartNum().then((res) => {
|
|
|
|
|
this.nums = res.data.result;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2021-05-17 18:19:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 返回
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
back () {
|
2021-05-21 16:47:26 +08:00
|
|
|
|
if (getCurrentPages().length == 1) {
|
2021-05-17 18:19:26 +08:00
|
|
|
|
uni.switchTab({
|
2021-05-21 16:47:26 +08:00
|
|
|
|
url: "/pages/tabbar/home/index",
|
2021-05-17 18:19:26 +08:00
|
|
|
|
});
|
2021-05-21 16:47:26 +08:00
|
|
|
|
} else {
|
|
|
|
|
uni.navigateBack();
|
2021-05-17 18:19:26 +08:00
|
|
|
|
}
|
2021-05-13 11:03:32 +08:00
|
|
|
|
},
|
|
|
|
|
|
2021-05-17 18:19:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 获取店铺信息
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
getStoreBaseInfoFun (id) {
|
2021-08-09 18:40:06 +08:00
|
|
|
|
API_store.getStoreBaseInfo(id).then((res) => {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
if (res.data.success) {
|
|
|
|
|
this.storeDetail = res.data.result;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
2021-05-17 18:19:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 删除收藏店铺
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
deleteGoodsCollectionFun (id) {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
API_Members.deleteGoodsCollection(id).then((res) => {
|
|
|
|
|
if (res.statusCode == 200) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: "商品已取消收藏!",
|
|
|
|
|
icon: "none",
|
|
|
|
|
});
|
|
|
|
|
this.favorite = !this.favorite;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
2021-05-17 18:19:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 获取商品是否已被收藏
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
getGoodsCollectionFun (goodsId) {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
if (storage.getHasLogin()) {
|
2021-10-15 18:01:54 +08:00
|
|
|
|
API_Members.getGoodsIsCollect("GOODS", goodsId).then((res) => {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
this.favorite = res.data.result;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2021-05-17 18:19:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 获取店铺推荐商品列表
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
getStoreRecommend () {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
getGoodsList({
|
|
|
|
|
pageNumber: 1,
|
|
|
|
|
pageSize: 6,
|
|
|
|
|
storeId: this.goodsDetail.storeId,
|
|
|
|
|
recommend: true,
|
|
|
|
|
}).then((res) => {
|
2023-04-04 16:07:22 +08:00
|
|
|
|
this.recommendList = res.data.result.records;
|
2021-05-13 11:03:32 +08:00
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
2021-05-17 18:19:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 获取相似商品列表
|
2021-10-15 18:01:54 +08:00
|
|
|
|
*
|
2021-05-17 18:19:26 +08:00
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
getOtherLikeGoods () {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
getGoodsList({
|
|
|
|
|
pageNumber: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
category: this.goodsDetail.categoryId,
|
|
|
|
|
keyword: this.goodsDetail.name,
|
|
|
|
|
}).then((res) => {
|
2023-04-04 16:07:22 +08:00
|
|
|
|
this.likeGoodsList = res.data.result.records;
|
2021-05-13 11:03:32 +08:00
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
2021-05-17 18:19:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 领取优惠券
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
receiveCouponsFun (id) {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
API_Members.receiveCoupons(id).then((res) => {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: res.data.message,
|
|
|
|
|
icon: "none",
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
2021-05-17 18:19:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 跳转到店铺页面
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
navigateToStore (store_id) {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/product/shopPage?id=` + store_id,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
2021-05-17 18:19:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 获取优惠券按钮
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
getCoupon (item) {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
this.receiveCouponsFun(item.id);
|
|
|
|
|
},
|
|
|
|
|
|
2021-05-17 18:19:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 规格弹窗开关
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
shutMask (flag, buyFlag, type) {
|
2021-12-23 18:36:00 +08:00
|
|
|
|
this.promotionShow = false;
|
2021-10-15 18:01:54 +08:00
|
|
|
|
this.buyMask = false;
|
|
|
|
|
this.addressFlag = false;
|
2021-05-13 11:03:32 +08:00
|
|
|
|
if (flag) {
|
|
|
|
|
switch (flag) {
|
|
|
|
|
case 1: //优惠券弹窗
|
2021-12-23 18:36:00 +08:00
|
|
|
|
this.promotionShow = true;
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
this.addressFlag = true;
|
|
|
|
|
break;
|
|
|
|
|
case 4: //添加购物车直接购买,查看已选 弹窗
|
|
|
|
|
// 判断是否是一个规格
|
2021-10-15 18:01:54 +08:00
|
|
|
|
|
2021-05-13 11:03:32 +08:00
|
|
|
|
this.buyMask = true;
|
|
|
|
|
if (buyFlag == "PINTUAN") {
|
|
|
|
|
if (type.orderSn) {
|
|
|
|
|
this.$refs.popupGoods.parentOrder = type;
|
|
|
|
|
}
|
|
|
|
|
this.$refs.popupGoods.buyType = "PINTUAN";
|
|
|
|
|
}
|
|
|
|
|
if (buyFlag == "buy") {
|
|
|
|
|
this.$refs.popupGoods.buyType = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2021-05-17 18:19:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 收藏
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
clickFavorite (id) {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
if (this.favorite) {
|
|
|
|
|
// 取消收藏
|
|
|
|
|
this.deleteGoodsCollectionFun(id);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2021-10-15 18:01:54 +08:00
|
|
|
|
API_Members.collectionGoods("GOODS", id).then((res) => {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
if (res.data.success) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: "收藏成功!",
|
|
|
|
|
icon: "none",
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.favorite = !this.favorite;
|
|
|
|
|
},
|
|
|
|
|
|
2021-05-17 18:19:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 顶部header显示或隐藏
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
pageScroll (e) {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
if (this.scrollFlag) {
|
|
|
|
|
this.calcSize();
|
|
|
|
|
}
|
|
|
|
|
if (e.detail.scrollTop > 200) {
|
|
|
|
|
//当距离大于200时显示回到顶部按钮
|
|
|
|
|
this.headerFlag = true;
|
|
|
|
|
} else {
|
|
|
|
|
//当距离小于200时隐藏回到顶部按钮
|
|
|
|
|
this.headerFlag = false;
|
|
|
|
|
}
|
|
|
|
|
if (e.detail.scrollTop < this.scrollArr[0] - 10) {
|
|
|
|
|
this.scrollId = "1";
|
|
|
|
|
}
|
|
|
|
|
if (e.detail.scrollTop > this.scrollArr[1] - 10) {
|
|
|
|
|
this.scrollId = "2";
|
|
|
|
|
}
|
|
|
|
|
if (e.detail.scrollTop > this.scrollArr[2] - 10) {
|
|
|
|
|
this.scrollId = "3";
|
|
|
|
|
}
|
|
|
|
|
if (e.detail.scrollTop > this.scrollArr[3] - 10) {
|
|
|
|
|
this.scrollId = "4";
|
|
|
|
|
}
|
|
|
|
|
},
|
2021-05-17 18:19:26 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 计算每个要跳转到的模块高度信息
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
calcSize () {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
let h = 0;
|
|
|
|
|
let that = this;
|
|
|
|
|
let arr = [
|
|
|
|
|
"main1",
|
|
|
|
|
"main2",
|
|
|
|
|
"main3",
|
|
|
|
|
"main4",
|
|
|
|
|
"main5",
|
|
|
|
|
"main6",
|
|
|
|
|
"main7",
|
|
|
|
|
"main8",
|
|
|
|
|
"main9",
|
|
|
|
|
"main10",
|
|
|
|
|
"main11",
|
|
|
|
|
];
|
|
|
|
|
arr.forEach((item) => {
|
|
|
|
|
let view = uni.createSelectorQuery().select("#" + item);
|
|
|
|
|
view
|
|
|
|
|
.fields(
|
|
|
|
|
{
|
|
|
|
|
size: true,
|
|
|
|
|
},
|
|
|
|
|
(data) => {
|
|
|
|
|
if (
|
|
|
|
|
item === "main1" ||
|
|
|
|
|
item === "main5" ||
|
|
|
|
|
item === "main9" ||
|
|
|
|
|
item === "main11"
|
|
|
|
|
) {
|
|
|
|
|
that.scrollArr.push(h);
|
|
|
|
|
}
|
|
|
|
|
if (data && data.height) {
|
|
|
|
|
h += data.height;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
.exec();
|
|
|
|
|
});
|
|
|
|
|
this.scrollFlag = false;
|
|
|
|
|
},
|
2021-05-17 18:19:26 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 点击顶部跳转到对应位置
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
headerTab (id) {
|
2021-05-13 11:03:32 +08:00
|
|
|
|
if (this.scrollFlag) {
|
|
|
|
|
this.calcSize();
|
|
|
|
|
}
|
|
|
|
|
this.scrollId = id;
|
|
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.tabScrollTop = this.scrollArr[id - 1];
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
2021-05-17 18:19:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 点击分享
|
|
|
|
|
*/
|
2022-12-27 14:49:23 +08:00
|
|
|
|
async shareChange () {
|
2022-06-01 11:30:23 +08:00
|
|
|
|
this.enableShare = true;
|
2021-05-13 11:03:32 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-06-24 18:11:11 +08:00
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
@import "./product/mp-goods.scss";
|
|
|
|
|
// #endif
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
2021-06-24 18:11:11 +08:00
|
|
|
|
@import "./product/style.scss";
|
|
|
|
|
@import "./product/product.scss";
|
2021-05-13 11:03:32 +08:00
|
|
|
|
</style>
|