From 2cdde4c98b75e3edc9b070e01a905a2b75bf987b Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期五, 10 十月 2025 14:54:16 +0800
Subject: [PATCH] 定制商品不能加入购物车
---
pages/product/goods.vue | 142 +++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 125 insertions(+), 17 deletions(-)
diff --git a/pages/product/goods.vue b/pages/product/goods.vue
index a7bbf36..7105891 100644
--- a/pages/product/goods.vue
+++ b/pages/product/goods.vue
@@ -6,13 +6,15 @@
<!-- 浠卙5鏈夋晥 鎵撳紑App -->
<!-- 鍒嗕韩 -->
- <shares v-if="enableShare && goodsDetail.id" :skuId="this.routerVal.id" :goodsId="this.routerVal.goodsId" :link="
+<!-- <shares v-if="enableShare && goodsDetail.id" :skuId="this.routerVal.id" :goodsId="this.routerVal.goodsId" :link="
'/pages/product/goods?id=' +
this.routerVal.id +
'&goodsId=' +
this.routerVal.goodsId
" :thumbnail="goodsDetail.thumbnail" :goodsName="goodsDetail.goodsName" type="goods"
@close="enableShare = false" />
+ -->
+
<popups v-model="popupsSwitch" @tapPopup="handleNavbarList" :popData="navbarListData" :x="navbarListX"
:y="navbarListY" placement="top-start" />
<view class="index">
@@ -114,10 +116,18 @@
</span>
</view>
- <view class="icons share" @click="shareChange()">
+ <!-- <view class="icons share" @click="shareChange()">
<u-icon size="30" name="share-fill"></u-icon>
<view>鍒嗕韩</view>
- </view>
+ </view> -->
+ <view class="icons share" style="margin-top: -15px;">
+ <button open-type="share" class="custom-share-btn" plain="true" style="border: none;">
+ <u-icon size="30" name="share-fill"></u-icon>
+ </button>
+ <view style="margin-top: -14px;">鍒嗕韩</view>
+ </view>
+
+
<view class="icons" @click="clickFavorite(goodsDetail.id)">
<u-icon size="30" :color="favorite ? '#f2270c' : '#262626'"
:name="favorite ? 'heart-fill' : 'heart'"></u-icon>
@@ -187,7 +197,7 @@
<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" />
<!-- 瀹濊礉鎺ㄨ崘 -->
@@ -219,7 +229,7 @@
</div> -->
<!-- 姝e父缁撶畻椤甸潰 -->
<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)">
+ <view class="to-store-car to-store-btn" v-if="goodsDetail.goodsType != 'VIRTUAL_GOODS'&& goodsDetail.customizeFlag!=='CUSTOMIZE'" @click="shutMask(4)">
鍔犲叆璐墿杞�</view>
<view class="to-buy to-store-btn" @click="shutMask(4, 'buy')">绔嬪嵆璐拱</view>
<view class="to-store-car to-store-btn" v-if="startTimer">鏆傛湭寮�濮�</view>
@@ -301,17 +311,16 @@
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'
+import { getSessionId, userAction,userShare } from "@/api/userAction.js";
+import { getSTSToken } from '@/api/common.js'
+import {addPrizeNum} from '@/api/prize.js'
export default {
components: {
popups,
- shares,
PromotionLayout,
PromotionDetailsLayout,
PromotionAssembleLayout,
@@ -444,6 +453,24 @@
IMLink: "", // IM鍦板潃
wholesaleList: [],
takeDownFromSale: false, // 涓嬫灦閿�鍞姸鎬�
+ pageSessionNo:"",
+ sendOnShow:false,
+ actionParam:{
+ sessionId:'',
+ actionType:"PAGE",
+ joinType:"SELF",
+ pageCode:"GOODS_DETAILS",
+ pageParams:"{}",
+ pageStatus:"JOIN",
+ pageType:"DETAIL",
+ shareId:null,
+ },
+ shareParam:{
+ pageCode:"GOODS_DETAILS",
+ shareOption:"{}",
+ pageType:"DETAIL"
+ },
+ shareId:'',
};
},
@@ -496,12 +523,69 @@
this.productRefHeight = windowHeight - bottomHeight + "px";
},
+
+
+
+ onShareAppMessage(e) {
+ console.log("寮�濮嬪垎浜�")
+ console.log(this.goodsDetail)
+ // 杩斿洖涓�涓狿romise
+ return new Promise((resolve) => {
+
+ this.shareId = '';
+ this.shareParam.shareOption = JSON.stringify(this.routerVal)
+ userShare(this.shareParam).then(res => {
+ this.shareId = res.data.data;
+ let param = {
+ addType:"SHARE_GOODS_VIDEO",
+ extend:"",
+ }
+ let extend = {shareId:this.shareId}
+ param.extend = JSON.stringify(extend)
+ addPrizeNum(param);
+
+ // 褰撹幏鍙栧埌shareId鍚庯紝鍐峳esolve鍒嗕韩閰嶇疆
+ resolve({
+ title: this.goodsDetail.goodsName,
+ path: '/pages/product/goods' +'?id='+ this.routerVal.id + '&goodsId=' + this.routerVal.goodsId +'&shareId=' + this.shareId,
+ imageUrl: this.goodsDetail.goodsGalleryList[0],
+ success(e) {
+ console.log("鍒嗕韩鎴愬姛", e);
+ },
+ fail(e) {
+ console.log('鍒嗕韩澶辫触', e);
+ }
+ });
+ }).catch(err => {
+ // 澶勭悊閿欒鎯呭喌锛屼緥濡備娇鐢ㄩ粯璁ゅ弬鏁�
+ console.error('鑾峰彇鍒嗕韩ID澶辫触', err);
+ resolve({
+ title: this.goodsDetail.goodsName,
+ path: '/pages/product/goods' +'?id='+ this.routerVal.id + '&goodsId=' + this.routerVal.goodsId,
+ imageUrl: this.goodsDetail.goodsGalleryList[0],
+ });
+ });
+ });
+ },
async onLoad (options) {
-
+ if(options.shareId){
+ this.actionParam.shareId = options.shareId;
+ this.actionParam.joinType = 'SHARE'
+ console.log('瑙﹀彂onLoad')
+ uni.setStorage({
+ key: 'shareId',
+ data: options.shareId,
+ success: function () {
+ console.log('缂撳瓨shareId鎴愬姛');
+ }
+ });
+ }
+ this.actionParam.pageParams = JSON.stringify(options)
if(options.q){
const queryParam = {
id:'',
- goodsId:''
+ goodsId:'',
+ distributionId:''
};
const decodedUrl = decodeURIComponent(decodeURIComponent(options.q));
console.log('鍘熷URL:', decodedUrl);
@@ -511,22 +595,44 @@
queryParam.id = id;
queryParam.goodsId = gooodsId;
this.routerVal = queryParam;
+ this.actionParam.pageParams = JSON.stringify(params)
+ this.actionParam.joinType = 'SCAN'
}else{
this.routerVal = options;
+ this.actionParam.pageParams = JSON.stringify(options)
}
console.log('鎵撳嵃淇℃伅')
console.log(options)
console.log(this.routerVal)
// #ifdef MP-WEIXIN
- // 灏忕▼搴忛粯璁ゅ垎浜�
- uni.showShareMenu({
- withShareTicket: true,
- menus: ["shareAppMessage", "shareTimeline"],
- });
+
// #endif
},
+
+ onUnload() {
+ let param = Object.assign({}, this.actionParam);
+ if (this.sendOnShow)return
+ param.pageStatus = "LEAVE"
+ userAction(param)
+ },
+ onHide() {
+ this.startHidenTime = Date.now()
+ let param = Object.assign({}, this.actionParam);
+ this.sendOnShow = true;
+ param.pageStatus = "LEAVE"
+ userAction(param)
+ },
async onShow () {
+ getSessionId().then(res=>{
+ this.pageSessionNo = res.data.data
+ this.actionParam.sessionId = this.pageSessionNo
+ this.actionParam.sessionId = res.data.data
+ if(this.pageSessionNo){
+ let param = Object.assign({}, this.actionParam);
+ userAction(param)
+ }
+ })
this.goodsDetail = {};
//濡傛灉鏈夊弬鏁癷ds璇存槑浜嬪垎閿�鐭繛鎺ワ紝闇�瑕佽幏鍙栧弬鏁�
if (this.routerVal.scene) {
@@ -592,6 +698,8 @@
* 鍒濆鍖栦俊鎭�
*/
async init (id, goodsId, distributionId = "") {
+ console.log('鎵撳嵃id:' + id)
+ console.log('鎵撳嵃goodsId:'+ goodsId)
this.isGroup = false; //鍒濆鍖栨嫾鍥�
this.productId = id; // skuId
// 杩欓噷璇锋眰鑾峰彇鍒伴〉闈㈡暟鎹� 瑙f瀽鏁版嵁
--
Gitblit v1.8.0