绿满眶商城微信小程序-uniapp
peng
2025-07-21 d2c5aeeb8e059dbdeb2a8b28d187bf5ad1d9dc82
pages/product/goods.vue
@@ -184,21 +184,21 @@
          <Evaluation id="main5" :goodsDetail="goodsDetail" />
          <!-- 店铺推荐 -->
          <storeLayout id="main7" :storeDetail="storeDetail" :goodsDetail="goodsDetail" :res="recommendList" />
          <!-- <storeLayout id="main7" :storeDetail="storeDetail" :goodsDetail="goodsDetail" :res="recommendList" /> -->
          <!-- 宝贝详情 -->
          <GoodsIntro id="main9" :res="goodsDetail" :goodsParams="goodsParams" :goodsId="goodsDetail.goodsId"
            v-if="goodsDetail.id" />
          <!-- 宝贝推荐 -->
          <GoodsRecommend id="main11" :res="likeGoodsList" />
          <!-- <GoodsRecommend id="main11" :res="likeGoodsList" /> -->
        </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>
@@ -213,10 +213,10 @@
          </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)">
@@ -275,7 +275,9 @@
</template>
<script>
import '@/uview-components/uview-ui'
import '@/components/uview-components/uview-ui';
/************接口API***************/
import { getGoods, getGoodsList, getMpScene, getGoodsDistribution } from "@/api/goods.js";
import * as API_trade from "@/api/trade.js";
@@ -297,13 +299,15 @@
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 popupGoods from "@/pages/product/m-buy/goods.vue"; //购物车商品的模块
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 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"; //下架框
import setup from "./product/popup/popup";
   import {
      getSTSToken
   } from '@/api/common.js'
export default {
  components: {
    popups,
@@ -340,21 +344,21 @@
      // #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",
@@ -396,10 +400,10 @@
          text: "详情",
          id: "3",
        },
        {
          text: "推荐",
          id: "4",
        },
        // {
        //   text: "推荐",
        //   id: "4",
        // },
      ],
      tabScrollTop: null,
      scrollArr: [],
@@ -574,8 +578,35 @@
          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;
@@ -701,13 +732,14 @@
     * 查看购物车
     */
    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",
      });
    },