Feat(商品详情&店铺):来源模块数据埋点

This commit is contained in:
lifizer
2024-06-24 15:15:20 +08:00
parent 2226d665ad
commit 9ab00a372e
5 changed files with 131 additions and 8 deletions
+29 -2
View File
@@ -339,14 +339,41 @@ export default {
return
}
uni.navigateTo({
url: '/pagesInn/inn/innHome?id=' + id
url: '/pagesInn/inn/innHome?id=' + id + '&from=' + this.getOptionsParams()
})
},
goToGoods(productId) {
if (!productId) {
return
}
this.$global.navToGoods(productId)
uni.navigateTo({
url: `/pages/shop/GoodsCon/index?id=${productId}&from=${this.getOptionsParams()}`
})
},
getOptionsParams() {
// 0、特产;1、文玩;2、七彩云上;3、特色礼品;4、康养食材;5、千县名品;6、景点门票
let from = ''
switch(this.type) {
case 0:
from = 'techan'
break
case 1:
from = 'wenwan'
break
case 3:
from = 'gift'
break
case 4:
from = 'wellness'
break
case 5:
from = 'famous'
break
default:
from = ''
break
}
return from
},
bannerItemTapHandle(banner) {
if (!banner) {
+47 -1
View File
@@ -422,6 +422,7 @@ import cookie from "@/utils/store/cookie";
import {famousGoodsShareImage, secKillGoodsShareImage} from "@/api/share";
import CouponsPopup from "@/components/CouponsPopup.vue"
import {addProduct, checkProduct, removeProduct} from "@/api/favorite";
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: "GoodsCon",
@@ -434,6 +435,7 @@ export default {
ShareInfo,
CouponsPopup
},
mixins: [pageListenMixins],
data: function () {
return {
isProductInfoExpand: true, //商品信息是否展开
@@ -504,7 +506,8 @@ export default {
// v9-2
show: false,
uniqueId: null,
isFavorite: false
isFavorite: false,
pageKeyId: ''
};
},
computed: mapGetters(["isLogin", "location", "userInfo"]),
@@ -541,6 +544,49 @@ export default {
console.log("getEnterOptionsSync", uni.getEnterOptionsSync());
uni.removeStorageSync('couponId')
const from = options.from
const id = options.id
switch (from) {
// 特产
case 'techan':
this.pageKeyId = `product_from_goods_productId_${id}`
break
// 地标好物
case 'landmark':
this.pageKeyId = `product_from_landmarkGoods_productId_${id}`
break
// 节日
case 'gift':
this.pageKeyId = `product_from_appContentFestival_productId_${id}`
break
// 时令尝鲜
case 'season':
this.pageKeyId = `product_from_seasonalFood_productId_${id}`
break
// 秒杀
case 'kill':
this.pageKeyId = `seckillProduct_seckillId_${options.activityId}`
break
// 文玩
case 'wenwan':
this.pageKeyId = `product_from_wenwan_productId_${id}`
break
// 非遗文化
case 'ich':
this.pageKeyId = `product_from_ich_productId_${id}`
break
// 康养食材
case 'wellness':
this.pageKeyId = `product_from_wellnessFood_productId_${id}`
break
// 千县
case 'famous':
this.pageKeyId = `product_from_countyFamous_productId_${id}`
break
default:
break
}
let url = handleQrCode();
if (url && url.productId) {
this.id = url.productId;
+40 -3
View File
@@ -428,11 +428,13 @@ import {getUrlParam} from "@/utils/common.js"
import imgBox from '@/components/imageTypeSet/imagebox.vue'
import cookie from "@/utils/store/cookie"
import {addStore, removeStore} from "@/api/favorite"
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
components: {
imgBox
},
mixins: [pageListenMixins],
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
@@ -469,7 +471,8 @@ export default {
{ text: '商家资质', value: 3, isShow: true }
],
isLoadGoodListoSuccess: false,
isLoadInfoListSuccess: false
isLoadInfoListSuccess: false,
pageKeyId: ''
}
},
// 必须在页面加 onPageScroll(e){} ,才能滑动显示背景
@@ -477,8 +480,42 @@ export default {
this.scrollData = e
},
onLoad(options) {
if (options.id) {
this.id = options.id || null
const id = options.id || ''
const from = options.from
switch (from) {
// 特产
case 'techan':
this.pageKeyId = `hotel_from_techan_hotelId_${id}`
break
// 千县
case 'famous':
this.pageKeyId = `hotel_from_famous_hotelId_${id}`
break
// 特色礼品
case 'gift':
this.pageKeyId = `hotel_from_gift_hotelId_${id}`
break
// 文玩
case 'wenwan':
this.pageKeyId = `hotel_from_wenwan_hotelId_${id}`
break
// 寻趣味
case 'fun':
this.pageKeyId = `hotel_from_findFun_hotelId_${id}`
break
// 养生圣地
case 'wellness':
this.pageKeyId = `hotel_from_wellnessPlace_hotelId_${id}`
break
// 民宿
case 'homestay':
this.pageKeyId = `product_from_countyFamous_productId_${id}`
break
default:
break
}
if (id) {
this.id = id || null
this.partnerId = options.partnerId || null
} else {
let obj = uni.getEnterOptionsSync()
+9 -1
View File
@@ -36,7 +36,7 @@
v-for="(item, index) in dataList"
:key="index"
class="item"
@click="$global.navToGoods(item.id)"
@click="goodItemClick(item.id)"
>
<image
:src="item.image"
@@ -135,6 +135,14 @@ export default {
duration: 1500
})
})
},
goodItemClick(productId) {
if (!productId) {
return
}
uni.navigateTo({
url: `/pages/shop/GoodsCon/index?id=${productId}&from=techan`
})
}
}
}
+6 -1
View File
@@ -36,7 +36,9 @@ export function formatContent(html) {
* @returns {null}
*/
export function pageToWatchShowCount(key, cb = '') {
console.log(Vue.prototype.$pageToWatchData)
if (!key) {
return
}
if (!Vue.prototype.$pageToWatchData[key]) {
Vue.prototype.$pageToWatchData[key] = []
}
@@ -52,6 +54,9 @@ export function pageToWatchShowCount(key, cb = '') {
* @returns {null}
*/
export function pageToWatchShowTimer(key, data) {
if (!key) {
return
}
if (Vue.prototype.$pageToWatchData[key]) {
Vue.prototype.$pageToWatchData[key].push(data)
}