绿满眶商城微信小程序-uniapp
peng
2025-11-06 d68fb476c248c6c3ab974ea6b18d6bba638f12d8
pages/product/goods.vue
@@ -212,10 +212,10 @@
            <u-icon size="34" class="red" name="home-fill"></u-icon>
            <view class="red icon-btn-name">店铺</view>
          </view>
          <view class="icon-btn-item" @click="linkMsgDetail()">
<!--          <view class="icon-btn-item" @click="linkMsgDetail()">
            <u-icon size="34" name="kefu-ermai"></u-icon>
            <view class="icon-btn-name">客服</view>
          </view>
          </view> -->
          <view class="icon-btn-item" @click="reluchToCart()">
            <u-icon size="34" name="storeping-cart"></u-icon>
            <view class="icon-btn-name">购物车</view>
@@ -272,7 +272,7 @@
        <!-- 商品规格  商品详情,以及默认参与活动的id-->
        <popupGoods :addr="delivery" ref="popupGoods" @changed="changedGoods" @closeBuy="closePopupBuy"
          @queryCart="cartCount()" :goodsDetail="goodsDetail" :goodsSpec="goodsSpec" :isGroup="isGroup" :id="productId"
          @queryCart="cartCount()" :goodsDetail="goodsDetail" :consumizetemplateInfo="consumizetemplateInfo" :goodsSpec="goodsSpec" :isGroup="isGroup" :id="productId"
          v-if="goodsDetail.id" :pointDetail="pointDetail" :wholesaleList="wholesaleList" @handleClickSku="selectSku"
          :buyMask="buyMask" />
@@ -289,7 +289,7 @@
/************接口API***************/
import { getGoods, getGoodsList, getMpScene, getGoodsDistribution } from "@/api/goods.js";
import { getGoods, getGoodsList, getMpScene, getGoodsDistribution,getTemplate } from "@/api/goods.js";
import * as API_trade from "@/api/trade.js";
import * as API_Members from "@/api/members.js";
import * as API_store from "@/api/store.js";
@@ -374,6 +374,7 @@
          ___type: "other",
        },
      ],
     consumizetemplateInfo:{},
      popupsSwitch: false, //导航栏列表栏开关
      enableShare: false,
      selectedGoods: "", //选择的商品规格昵称
@@ -528,7 +529,7 @@
 onShareAppMessage(e) {
       console.log("开始分享")
       console.log(this.goodsDetail)
       console.log(JSON.stringify(this.goodsDetail))
       // 返回一个Promise
       return new Promise((resolve) => {
          
@@ -580,6 +581,16 @@
         }
      });
   }
   const shareId =   uni.getStorageSync("shareId");
   if(shareId){
   let param = {
      addType:"SHARE_USER_REGISTRY",
      extend:"",
   }
   let extend = {shareId:shareId}
   param.extend = JSON.stringify(extend)
   addPrizeNum(param);
   }
   this.actionParam.pageParams = JSON.stringify(options)
     if(options.q){
        const queryParam = {
@@ -608,6 +619,18 @@
    // #ifdef MP-WEIXIN
    // #endif
   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 {
     this.init(this.routerVal.id, this.routerVal.goodsId, this.routerVal.distributionId);
   }
  },
  
  onUnload() {
@@ -633,18 +656,18 @@
           userAction(param)
        }
     })   
    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 {
      this.init(this.routerVal.id, this.routerVal.goodsId, this.routerVal.distributionId);
    }
    // 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 {
    //   this.init(this.routerVal.id, this.routerVal.goodsId, this.routerVal.distributionId);
    // }
  },
  methods: {
@@ -757,6 +780,16 @@
      this.PromotionList = response.data.result.promotionMap;
      this.goodsParams = response.data.result.goodsParamsDTOList || [];
   console.log('优惠卷活动--------------------》',response.data.result.promotionMap)
   if(this.goodsDetail.goodsType == 'PHYSICAL_GOODS'&& this.goodsDetail.customizeFlag ==='CUSTOMIZE'){
           //获取模板信息
           this.consumizetemplateInfo = null;
           console.log('是模板获取需要获取信息-------------》',this.goodsDetail.id)
           const template = await getTemplate(this.goodsDetail.id)
           this.consumizetemplateInfo = template.data.data
           console.log('获取到的模板信息----------------->',template.data.data)
   }
      // 判断是否拼团活动或者积分商品 如果有则显示拼团活动信息
      this.PromotionList &&
        Object.keys(this.PromotionList).forEach((item) => {
@@ -772,7 +805,6 @@
        });
      // 轮播图
      this.imgList = this.goodsDetail.goodsGalleryList.filter(i => i.indexOf("\"url\":") === -1 && i.indexOf("\"status\":") === -1);
      // 获取店铺基本信息
      this.getStoreBaseInfoFun(this.goodsDetail.storeId);
@@ -789,6 +821,7 @@
      if (this.$options.filters.isLogin("auth")) {
        this.getGoodsCollectionFun(this.goodsDetail.id);
      }
      // 获取IM 需要的话使用
      // this.getIMDetailMethods();
    },