绿满眶商城微信小程序-uniapp
peng
2025-10-10 7dbe13ff4c1b5784aa285faf6b5248d2de25e9ce
获取定制模板信息
3个文件已修改
35 ■■■■■ 已修改文件
api/goods.js 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/product/goods.vue 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/product/m-buy/goods.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/goods.js
@@ -358,3 +358,14 @@
  })
}
/**
 * 根据skuid获取模板
 */
export function getTemplate(skuId) {
  return http.request({
    url: `/store/store/getTemplate/${skuId}`,
    method: Method.GET,
  })
}
pages/product/goods.vue
@@ -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: "", //选择的商品规格昵称
@@ -757,6 +758,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 +783,6 @@
        });
      // 轮播图
      this.imgList = this.goodsDetail.goodsGalleryList.filter(i => i.indexOf("\"url\":") === -1 && i.indexOf("\"status\":") === -1);
      // 获取店铺基本信息
      this.getStoreBaseInfoFun(this.goodsDetail.storeId);
@@ -789,6 +799,7 @@
      if (this.$options.filters.isLogin("auth")) {
        this.getGoodsCollectionFun(this.goodsDetail.id);
      }
      // 获取IM 需要的话使用
      // this.getIMDetailMethods();
    },
pages/product/m-buy/goods.vue
@@ -101,6 +101,9 @@
                        <view class="view-class-title">数量</view>
                        <uni-number-box class="uNumber" :min="1" :max="999" :disabled="goodsDetail.quantity === 0"  v-model="num"></uni-number-box>
                    </view>
                    <view class="template">
                        {{JSON.stringify(consumizetemplateInfo)}}
                    </view>
                </scroll-view>
                <!-- 按钮 -->
                <view class="btns" v-if="goodsDetail.quantity !== 0">
@@ -169,6 +172,10 @@
        pointDetail: {
            default: '',
            type: null
        },
        consumizetemplateInfo:{
            default:'',
            type: null
        }
    },
    computed: {