Commit f82d9bca by ym

埋点

1 parent 75028add
VUE_APP_REPO=https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config VUE_APP_REPO=https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config
VUE_APP_PROJECR_VERSION = 10001
VUE_APP_PROJECR_ID = 10001
VUE_APP_PROJECR_SECRET = 'F50C6A9062D80107E72F6E09B5AD63DD'
\ No newline at end of file \ No newline at end of file
...@@ -3,14 +3,11 @@ ...@@ -3,14 +3,11 @@
VUE_APP_TITLE=广联运营平台 VUE_APP_TITLE=广联运营平台
# 网络请求公用地址 # 网络请求公用地址
#VUE_APP_API=https://wx.glsx.com.cn/rop-ddh-carlife/router #VUE_APP_API=https://wx.glsx.com.cn/rop-ddh-carlife/router
#VUE_APP_API=http://scrm.test.glsx.com.cn/rop-scrm-equity/router VUE_APP_API=http://scrm.test.glsx.com.cn/rop-scrm-equity/router
#VUE_APP_API=http://192.168.2.60:7226/rop-scrm-equity/router #VUE_APP_API=http://192.168.2.60:7226/rop-scrm-equity/router
VUE_APP_API=https://scrm.glsx.com.cn/rop-scrm-equity/router #VUE_APP_API=http://scrm.test.glsx.com.cn/rop-scrm-equity/router
#VUE_APP_API=http://qcwx.glsx.com.cn/rop-ddh-carlife/router #VUE_APP_API=http://qcwx.glsx.com.cn/rop-ddh-carlife/router
#VUE_APP_API=http://192.168.2.60:8086/rop-ddh-carlife/router #VUE_APP_API=http://192.168.2.60:8086/rop-ddh-carlife/router
#VUE_APP_KEY=48e5e13229b82c1b4e6e8c96151f0637 VUE_APP_KEY=48e5e13229b82c1b4e6e8c96151f0637
#VUE_APP_SECRET=c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b VUE_APP_SECRET=c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b
VUE_APP_KEY=036cc0e0fe316483238287e5721df4c3
VUE_APP_SECRET=c7290f606d6b4e9aaf6da3ad6310e883fe316483238287e5
...@@ -3,7 +3,12 @@ module.exports = { ...@@ -3,7 +3,12 @@ module.exports = {
env: { env: {
node: true node: true
}, },
globals: { wx: true }, globals: {
wx: true,
'returnCitySN': true ,
'MobileDetect': true,
'track': true
},
'extends': [ 'extends': [
'plugin:vue/essential', 'plugin:vue/essential',
'eslint:recommended' 'eslint:recommended'
......
This diff could not be displayed because it is too large.
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
"dependencies": { "dependencies": {
"axios": "^0.21.0", "axios": "^0.21.0",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"js-md5": "^0.7.3",
"sha1": "^1.1.1", "sha1": "^1.1.1",
"vant": "^2.10.11", "vant": "^2.10.11",
"vconsole": "^3.4.0", "vconsole": "^3.4.0",
......
...@@ -19,8 +19,11 @@ ...@@ -19,8 +19,11 @@
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %> <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script" /> <link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script" />
<% } %> <% } %>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.8&key=bd290dc27d0945959280753215ddda71&plugin=AMap.Geocoder"></script> <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.8&key=bd290dc27d0945959280753215ddda71&plugin=AMap.Geocoder"></script>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script type="text/javascript" src="https://img01.glsx.com.cn/js/track-1.0.0.js"></script>
<script src="https://pv.sohu.com/cityjson?ie=utf-8"></script>
<script src="https://cdn.jsdelivr.net/npm/mobile-detect@1.4.4/mobile-detect.min.js"></script>
<title>权益中心</title> <title>权益中心</title>
</head> </head>
......
<template> <template>
<div id="app"> <div id="app">
<template v-if="$route.meta.showNavBar && !isMiniprogram"> <template v-if="$route.meta.showNavBar && !isMiniprogram && showNavBar">
<div class="nav-bar"> <div class="nav-bar">
<van-nav-bar <van-nav-bar
safe-area-inset-top safe-area-inset-top
:title="$route.meta.title" :title="$route.meta.title"
left-arrow left-arrow
:fixed='true'
@click-left="onClickLeft" @click-left="onClickLeft"
/> />
</div> </div>
</template> </template>
<div>
<transition name="fade"> <transition name="fade">
<keep-alive> <keep-alive>
<router-view <router-view
v-if="$route.meta.keepAlive" v-if="$route.meta.keepAlive"
class="main-box"
:class="{'app-box': showNavBar && $route.meta.showNavBar}"
v-wechat-title="$route.meta.title" v-wechat-title="$route.meta.title"
/> />
</keep-alive> </keep-alive>
</transition> </transition>
<transition name="fade"> <transition name="fade">
<router-view <router-view
class="main-box"
:class="{'app-box': showNavBar && $route.meta.showNavBar}"
v-wechat-title="$route.meta.title" v-wechat-title="$route.meta.title"
v-if="!$route.meta.keepAlive" v-if="!$route.meta.keepAlive"
/> />
</transition> </transition>
</div> </div>
</div>
</template> </template>
<script> <script>
// import VConsole from 'vconsole' // import VConsole from 'vconsole'
export default { export default {
data() { data() {
return {}; return {
isScroll: false,
pagename: "",
showNavBar: false
};
},
watch: {
// 如果路由有变化
$route(to) {
this.isScroll = false;
let name = to.name;
switch (name) {
case "common.marketing":
this.pagename = "营销页";
break;
case "equity.index":
this.pagename = "权益首页";
break;
case "commodity.recharge":
case "commodity.business":
this.pagename = "商品详情";
break;
case "oilStation.index":
this.pagename = "加油列表";
break;
case "cardRoll.customer":
this.pagename = "客服";
break;
default:
this.pagename = to.meta.title;
}
},
}, },
components: {}, components: {},
created() {}, created() {
const ua = navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) != 'micromessenger') {
this.showNavBar = true;
}
window.onload = function () {
let navigationStart = window.performance.timing.navigationStart.toString();
navigationStart = parseInt(navigationStart.substr(0, 10));
let domContentLoadedEventEnd =
window.performance.timing.domContentLoadedEventEnd.toString();
domContentLoadedEventEnd = parseInt(domContentLoadedEventEnd.substr(0, 10));
let logs = window.vm.trackConfig({
event: "loading_event",
properties: {
pagename: localStorage['pagename'],
enter_time: navigationStart,
leave_time: domContentLoadedEventEnd,
},
});
window.vm.track.collect(logs);
};
},
mounted() { mounted() {
// window.vConsole = new VConsole() // window.vConsole = new VConsole()
//解决ios下history.back后不刷新 //解决ios下history.back后不刷新
this.handleScroll();
var isPageHide = false; var isPageHide = false;
window.addEventListener("pageshow", function() { window.addEventListener("pageshow", function () {
if (isPageHide) { if (isPageHide) {
window.location.reload(); window.location.reload();
} }
}); });
window.addEventListener("pagehide", function() { window.addEventListener("pagehide", function () {
isPageHide = true; isPageHide = true;
}); });
}, },
methods: {}, methods: {
onClickLeft() {
this.$router.go(-1)
},
handleScroll() {
window.addEventListener("scroll", () => {
if (!this.isScroll) {
let logs = window.vm.trackConfig({
event: "scroll_event",
properties: {
pagename: this.pagename,
isScroll: true,
},
});
window.vm.track.collect(logs);
this.isScroll = true;
}
});
},
},
}; };
</script> </script>
...@@ -57,4 +136,31 @@ export default { ...@@ -57,4 +136,31 @@ export default {
#app { #app {
font-size: 14px; font-size: 14px;
} }
.main-box {
width: 100%;
position: absolute;
left: 0px;
height: 100%;
overflow: scroll;
padding-bottom: 0px;
box-sizing: border-box!important;
}
.app-box {
box-sizing: border-box!important;
width: 100%;
position: absolute;
left: 0px;
overflow: scroll;
padding-bottom: 0px;
}
.app-box.main-box {
height: calc(100% - 46px);
}
.van-nav-bar {
z-index: 100;
}
.nav-bar {
height: 46px;
width: 100%;
}
</style> </style>
...@@ -47,8 +47,19 @@ service.interceptors.response.use( ...@@ -47,8 +47,19 @@ service.interceptors.response.use(
} else { } else {
const ua = navigator.userAgent.toLowerCase() const ua = navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) == 'micromessenger') { if (ua.match(/MicroMessenger/i) == 'micromessenger') {
sessionStorage.setItem("CODE_PAST_DUE",true); sessionStorage.setItem(
window.vm.$router.replace({ name: 'common.phoneLogin' }) "CODE_PAST_DUE",
true
);
let { sessionId } = JSON.parse(
sessionStorage.getItem("GL_EQUITY_USER_INFO")
)
? JSON.parse(sessionStorage.getItem("GL_EQUITY_USER_INFO"))
: window.vm.$store.state;
let [href] = window.location.href.split("/#/");
let url = `${href}/#/common/phoneLogin?sessionId=${sessionId}`;
window.vm.openWindows(url, "common.phoneLogin");
// window.vm.$router.replace({ name: 'common.phoneLogin' })
} else { } else {
let equipmentType = "" let equipmentType = ""
let agent = navigator.userAgent.toLowerCase() let agent = navigator.userAgent.toLowerCase()
......

1.74 MB | W: | H:

1.74 MB | W: | H:

src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -3,7 +3,29 @@ ...@@ -3,7 +3,29 @@
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
html, body {
position: absolute;
width: 100%;
height: 100%;
top: 0;
overflow: hidden;
}
body {
margin: 0;
padding: 0;
position: relative;
box-sizing: border-box;
-webkit-text-size-adjust: none;
-webkit-overflow-scrolling: touch;
-moz-user-select: none;
-o-user-select:none;
-khtml-user-select:none;
-webkit-user-select:none;
-ms-user-select:none;
user-select:none;
}
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
......
...@@ -9,21 +9,80 @@ import '@a/scss/common.scss' ...@@ -9,21 +9,80 @@ import '@a/scss/common.scss'
import store from "./store" import store from "./store"
import axios from 'axios' import axios from 'axios'
Vue.use(VueWechatTitle) Vue.use(VueWechatTitle)
import { Lazyload } from 'vant';
Vue.use(Lazyload);
Vue.use(Vant) Vue.use(Vant)
// import VConsole from 'vconsole'
// const vConsole = new VConsole()
// Vue.use(vConsole)
import preview from 'vue-photo-preview' import preview from 'vue-photo-preview'
import 'vue-photo-preview/dist/skin.css' import 'vue-photo-preview/dist/skin.css'
import VConsole from 'vconsole'
const vConsole = new VConsole()
Vue.use(vConsole)
Vue.use(preview) Vue.use(preview)
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.isMiniprogram = window.__wxjs_environment === 'miniprogram' Vue.prototype.isMiniprogram = window.__wxjs_environment === 'miniprogram'
axios({ Vue.prototype.track = track;
if (!localStorage['sessionId'] || !localStorage['expirationTime'] || (localStorage['sessionId'] && (new Date().getTime() - localStorage['expirationTime']) > 60 * 60 * 1000)) {
const ua = navigator.userAgent.toLowerCase();
let terminal;
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
terminal = 'h5'
} else {
if (Vue.prototype.checkPhoneType() == 'ios') {
terminal = 'ios'
} else {
terminal = 'android'
}
}
let project_id = process.env.VUE_APP_PROJECR_VERSION;
let secret = process.env.VUE_APP_PROJECR_SECRET;
let client_id = '';
let user_id = '';
track.setCommonConfig({ project_id, secret, client_id, user_id })
let user = JSON.stringify({
"user_id": user_id,
"client_ip": returnCitySN.cip,
"client_id": localStorage['client_id'],
"wx_open_id": '',
"loc_city": returnCitySN.name,
"loc_province": returnCitySN.name,
"loc_country": '',
"network_carrier": '',
"device_model": '',
"brand": Vue.prototype.getDetect().brand,
"resolution": window.screen.width + '*' + window.screen.height,
"browser_version": window.navigator.appVersion,
"browser": Vue.prototype.getDetect().userAgent,
"os_name": Vue.prototype.getDetect().os_name,
"os_version": Vue.prototype.getDetect().version,
"network_type": window.navigator.connection ? window.navigator.connection.effectiveType : '',
"terminal": terminal
})
track.getSessionId('/collectdata/login', user, function () {
axios({
baseURL: process.env.VUE_APP_REPO + '/scrm-equity-mobile-config',
method: 'get'
}).then(({
data: config
}) => {
window.$baseConfig = config
window.vm = new Vue({
router,
store,
render: h => {
return h(App)
}
}).$mount('#app')
})
})
} else {
axios({
baseURL: process.env.VUE_APP_REPO + '/scrm-equity-mobile-config', baseURL: process.env.VUE_APP_REPO + '/scrm-equity-mobile-config',
method: 'get' method: 'get'
}).then(({ }).then(({
data: config data: config
}) => { }) => {
window.$baseConfig = config window.$baseConfig = config
window.vm = new Vue({ window.vm = new Vue({
router, router,
...@@ -32,4 +91,6 @@ axios({ ...@@ -32,4 +91,6 @@ axios({
return h(App) return h(App)
} }
}).$mount('#app') }).$mount('#app')
})
\ No newline at end of file \ No newline at end of file
})
}
...@@ -98,35 +98,27 @@ export default { ...@@ -98,35 +98,27 @@ export default {
this.setNoticeInfo() this.setNoticeInfo()
}, },
CarLink(e) { CarLink(e) {
let {sessionId} = this.$store.state; this.tabHideShow(0);
let [href] = window.location.href.split('/#/');
let url;
let supplier = e.supplier; let supplier = e.supplier;
sessionStorage.setItem('common',this.icon?1:0) sessionStorage.setItem('common', this.icon ? 1 : 0)
switch(supplier) { switch (supplier) {
case 'GL_OIL': case 'GL_OIL':
url = `${href}/#/oilStation/index?sessionId=${sessionId}` this.$router.push({ name:'oilStation.index' })
this.openWindows(url, 'oilStation.index')
break; break;
case 'GL_ROAD_RESCUE': case 'GL_ROAD_RESCUE':
url = `${href}/#/equity/road` this.$router.push({ name:'equity.road'})
this.openWindows(url, 'equity.road')
break; break;
case 'GL_TIRE_PROTECTION': case 'GL_TIRE_PROTECTION':
url = `${href}/#/equity/tyre` this.$router.push({ name:'equity.tyre'})
this.openWindows(url, 'equity.tyre')
break; break;
case 'GL_ROBBERY_PROTECTION': case 'GL_ROBBERY_PROTECTION':
url = `${href}/#/equity/compensate` this.$router.push({ name:'equity.compensate'})
this.openWindows(url, 'equity.compensate')
break; break;
case 'GL_COLLISION_REPAIR': case 'GL_COLLISION_REPAIR':
url = `${href}/#/equity/collision` this.$router.push({ name:'equity.collision'})
this.openWindows(url, 'equity.collision')
break; break;
case 'GL_CAR_TOTAL_LOSS': case 'GL_CAR_TOTAL_LOSS':
url = `${href}/#/equity/loss` this.$router.push({ name:'equity.loss'})
this.openWindows(url, 'equity.loss')
break; break;
case 'EDJ': case 'EDJ':
this.jumpDEJ(); this.jumpDEJ();
...@@ -134,15 +126,23 @@ export default { ...@@ -134,15 +126,23 @@ export default {
default: default:
this.showToast('即将上线,敬请期待') this.showToast('即将上线,敬请期待')
} }
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益首页",
event_name: e.equityName,
},
});
window.vm.track.collect(logs);
}, },
jumpDEJ() { jumpDEJ() {
let {sessionId} = this.$store.state; let { sessionId } = this.$store.state;
let para = { let para = {
sessionId sessionId
} }
equity.getEdjUrl(para).then(res => { equity.getEdjUrl(para).then(res => {
let {code, data, message} = res let { code, data, message } = res
if (code == 0){ if (code == 0) {
this.openWindows(data) this.openWindows(data)
} else { } else {
this.showToast(message) this.showToast(message)
...@@ -150,27 +150,38 @@ export default { ...@@ -150,27 +150,38 @@ export default {
}) })
}, },
jumpLink(e) { jumpLink(e) {
let { sessionId } = this.$store.state; this.tabHideShow(0);
this.$store.commit('setGoodsInfo',e); this.$store.commit('setGoodsInfo', e);
let {brandId,supplier,brandName} = e; if (e.appearance == 1) {
if(e.appearance == 1) { this.$router.push({ name:'commodity.business' })
let [href] = window.location.href.split('/#/'); } else {
let url = `${href}/#/commodity/business?sessionId=${sessionId}&brandId=${brandId}&supplier=${supplier}&brandName=${brandName}`; this.$router.push({ name:'commodity.recharge' })
this.openWindows(url, 'commodity.business') }
}else { let logs = window.vm.trackConfig({
let [href] = window.location.href.split('/#/'); event: "click_event",
let url = `${href}/#/commodity/recharge?sessionId=${sessionId}&brandId=${brandId}&supplier=${supplier}&brandName=${brandName}`; properties: {
this.openWindows(url, 'commodity.recharge') pagename: "权益首页",
event_name: e.equityName,
extra_data: {
equityName: e.equityName,
brandName: e.brandName,
equityDesc: e.equityDesc,
goodsCategory: e.goodsCategory,
goodsID: e.id,
goodsIcon: e.equityIcon,
} }
}, },
});
window.vm.track.collect(logs);
},
getMerchantid() { getMerchantid() {
this.carServiceList = [] this.carServiceList = []
let para = { let para = {
merchantId: this.merchantId merchantId: this.merchantId
} }
equity.getMerchantid(para).then(res => { equity.getMerchantid(para).then(res => {
let {code, data, message} = res let { code, data, message } = res
if (code == 0){ if (code == 0) {
this.carServiceList = data.carServiceList this.carServiceList = data.carServiceList
this.goodsServiceList = data.goodsServiceList; this.goodsServiceList = data.goodsServiceList;
this.equityGoodsGroupDescDtos = this.goodsServiceList[0].equityGoodsGroupDescDtos; this.equityGoodsGroupDescDtos = this.goodsServiceList[0].equityGoodsGroupDescDtos;
...@@ -182,6 +193,14 @@ export default { ...@@ -182,6 +193,14 @@ export default {
changeGoods(item) { changeGoods(item) {
this.goodsTab = item; this.goodsTab = item;
this.equityGoodsGroupDescDtos = this.goodsServiceList[item].equityGoodsGroupDescDtos; this.equityGoodsGroupDescDtos = this.goodsServiceList[item].equityGoodsGroupDescDtos;
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益首页",
event_name: this.goodsServiceList[item].goodsCategory,
},
});
window.vm.track.collect(logs);
}, },
jumpMore() { jumpMore() {
equity.getCouponList({ equity.getCouponList({
......
import WxConfig from '@u/WxConfig' import WxConfig from '@u/WxConfig'
import {commodity} from "@r/api"; import { commodity } from "@r/api";
const WX = new WxConfig(['chooseWXPay']); const WX = new WxConfig(['chooseWXPay']);
export default { export default {
data() { data() {
...@@ -17,14 +17,28 @@ export default { ...@@ -17,14 +17,28 @@ export default {
}, },
async orderPay() { async orderPay() {
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "商品详情",
event_name: '购买',
extra_data: {
brandName: this.selectData?this.selectData.brandName:this.brandName,
productName: this.selectData?this.selectData.productName:this.businessList[ this.typeSno].productName,
rechargeNumber: this.rechargeNumber,
denomination: this.denomination?this.denomination.denomination:undefined
}
}
});
window.vm.track.collect(logs);
this.showLoading(); this.showLoading();
let {sessionId} = this.$store.state; let { sessionId } = this.$store.state;
let orderCode = await commodity.getOrderCode({ let orderCode = await commodity.getOrderCode({
sessionId, sessionId,
supplier: this.supplier, supplier: this.supplier,
brandId: this.brandId brandId: this.brandId
}).then(res => { }).then(res => {
let {code, data, message} = res let { code, data, message } = res
if (code == 0) { if (code == 0) {
return data; return data;
} else { } else {
...@@ -35,8 +49,8 @@ export default { ...@@ -35,8 +49,8 @@ export default {
const ua = navigator.userAgent.toLowerCase(); const ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == 'micromessenger') { if (ua.match(/MicroMessenger/i) == 'micromessenger') {
payMannerId = 4; payMannerId = 4;
}else { } else {
payMannerId = 5; // 7 payMannerId = 7; // 5
} }
let para = { let para = {
orderCode, orderCode,
...@@ -48,7 +62,7 @@ export default { ...@@ -48,7 +62,7 @@ export default {
} }
let payData = await commodity.payOrder(para).then(res => { let payData = await commodity.payOrder(para).then(res => {
this.hideLoading() this.hideLoading()
let {code, data, message} = res let { code, data, message } = res
if (code == 0) { if (code == 0) {
return data; return data;
} else { } else {
...@@ -56,7 +70,7 @@ export default { ...@@ -56,7 +70,7 @@ export default {
} }
}) })
if (ua.match(/MicroMessenger/i) == 'micromessenger') { if (ua.match(/MicroMessenger/i) == 'micromessenger') {
this.handlePay(payData); this.handlePay(payData,orderCode);
} else { } else {
if (this.checkPhoneType() == 'ios') { if (this.checkPhoneType() == 'ios') {
if (window["payWebOrder"] && typeof window.payWebOrder === "function") { if (window["payWebOrder"] && typeof window.payWebOrder === "function") {
...@@ -68,8 +82,8 @@ export default { ...@@ -68,8 +82,8 @@ export default {
window.myjs.payWebOrder("wxpay", JSON.stringify(payData)); window.myjs.payWebOrder("wxpay", JSON.stringify(payData));
} }
let self = this; let self = this;
window.onMessageFromPayBack = function(result) { window.onMessageFromPayBack = function (result) {
if(result == 0) { if (result == 0) {
if (self.appearance == 2) { if (self.appearance == 2) {
let productName = self.brandName + self.businessList[self.typeSno].productName + self.denomination.denomination let productName = self.brandName + self.businessList[self.typeSno].productName + self.denomination.denomination
window.vm.$router.push({ window.vm.$router.push({
...@@ -79,18 +93,21 @@ export default { ...@@ -79,18 +93,21 @@ export default {
} }
}) })
} else { } else {
window.vm.$router.push({name: 'commodity.success', query: {price:self.isOpen || !self.selectData.noMemberPrice? self.selectData.salesPrice:self.selectData.noMemberPrice}}) window.vm.$router.push({ name: 'commodity.success', query: { price: self.selectData.salesPrice } })
} }
}else { self.payCollect(orderCode,1);
window.vm.showToast(result==-1?'支付失败':'取消支付') } else {
self.payCollect(orderCode,0);
window.vm.showToast(result == -1 ? '支付失败' : '取消支付')
} }
} }
} }
}, },
handlePay(payData) { handlePay(payData,orderCode) {
const {timeStamp, nonceStr, packages, signType, paySign} = payData; const { timeStamp, nonceStr, packages, signType, paySign } = payData;
WX.chooseWXPay(timeStamp, nonceStr, packages, signType, paySign).then(res => { WX.chooseWXPay(timeStamp, nonceStr, packages, signType, paySign).then(res => {
console.log(res) if(res) {
this.payCollect(orderCode,1);
if (this.appearance == 2) { if (this.appearance == 2) {
let productName = this.brandName + this.businessList[this.typeSno].productName + this.denomination.denomination let productName = this.brandName + this.businessList[this.typeSno].productName + this.denomination.denomination
window.vm.$router.push({ window.vm.$router.push({
...@@ -100,9 +117,51 @@ export default { ...@@ -100,9 +117,51 @@ export default {
} }
}) })
} else { } else {
window.vm.$router.replace({name: 'commodity.success', query: {price:this.isOpen || !this.selectData.noMemberPrice? this.selectData.salesPrice:this.selectData.noMemberPrice}}) window.vm.$router.replace({ name: 'commodity.success', query: { price: this.selectData.salesPrice } })
}
}else {
this.payCollect(orderCode,0);
} }
}) })
},
payCollect(orderCode,status) {
let extra_data;
if(this.selectData) {
extra_data = {
brandName: this.selectData.brandName,
productName: this.selectData.productName,
goodsID: this.selectData.id,
goodsIcon: this.selectData.goodsImage,
goodsPriceLineation: this.selectData.lineationPrice,
goodsPriceSales: this.selectData.salesPrice,
goodsPrice: this.selectData.salesPrice,
goodsStock: this.selectData.stock,
orderCode,
result: status?'成功':'失败'
}
}else {
extra_data = {
brandName: this.brandName,
productName: this.businessList[ this.typeSno].productName,
goodsID: this.denomination.id,
account: this.rechargeNumber,
denomination: this.denomination.denomination,
goodsPriceLineation: this.denomination.lineationPrice,
goodsPriceSales: this.denomination.salesPrice,
goodsPrice: this.denomination.salesPrice,
orderCode,
result: status?'成功':'失败'
}
}
let logs = window.vm.trackConfig({
event: "order_event",
properties: {
pagename: "商品详情",
event_name: '支付',
extra_data
}
});
window.vm.track.collect(logs);
} }
} }
} }
...@@ -6,7 +6,7 @@ import { ...@@ -6,7 +6,7 @@ import {
Notify Notify
} from 'vant' } from 'vant'
import store from '@/store' import store from '@/store'
import { common,equity } from '../api/api' import { common, equity } from '../api/api'
Vue.use(VueRouter) Vue.use(VueRouter)
const router = new VueRouter({ const router = new VueRouter({
routes, routes,
...@@ -17,20 +17,35 @@ const router = new VueRouter({ ...@@ -17,20 +17,35 @@ const router = new VueRouter({
} }
} }
}) })
let startTime = Date.parse(new Date()).toString();
startTime = parseInt(startTime.substr(0, 10));
let currentTime = null, pagename = null, currentPagename = null;
// window.onunload = function () {
// let name = localStorage['currentPagename']
// currentTime = parseInt(Date.parse(new Date()).toString().substr(0, 10));
// stayBuried(name, startTime, currentTime)
// }
// document.addEventListener("visibilitychange", function(){
// if(!document.hidden) {
// startTime = localStorage['nextPageTime']
// stayBuried(localStorage['nextPageName'], parseInt(localStorage['nextPageTime']), parseInt(Date.parse(new Date()).toString().substr(0, 10)))
// }
// });
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
routerBuried(to,from)
let { meta: { authBase } } = to let { meta: { authBase } } = to
store.commit('findPrevPath', from.name) store.commit('findPrevPath', from.name)
if (to.name != 'common.phoneLogin') store.commit('jumpPath', to.name) if (to.name != 'common.phoneLogin') store.commit('jumpPath', to.name)
const params = getParams(window.location.href); const params = getParams(window.location.href);
if (params.appId) sessionStorage.setItem('GL_WX_APPID', params.appId) if (params.appId) sessionStorage.setItem('GL_WX_APPID', params.appId)
if (params.merchantId){ if (params.merchantId) {
store.commit('setMerchantId',params.merchantId) store.commit('setMerchantId', params.merchantId)
sessionStorage.setItem('GL_WX_MERCHANTID', params.merchantId) sessionStorage.setItem('GL_WX_MERCHANTID', params.merchantId)
} }
window.onMessageFromLoginBack = (type, userId, sessionId) => { window.onMessageFromLoginBack = (type, userId, sessionId) => {
console.log('onMessageFromLoginBack', type, userId, sessionId) console.log('onMessageFromLoginBack', type, userId, sessionId)
if (type == 0) { if (type == 0) {
getSessionAppId(sessionId,true); getSessionAppId(sessionId, true);
} else { } else {
store.commit('clearSessionId') store.commit('clearSessionId')
next() next()
...@@ -57,10 +72,14 @@ router.beforeEach((to, from, next) => { ...@@ -57,10 +72,14 @@ router.beforeEach((to, from, next) => {
} }
return return
} else { } else {
if(to.name == 'common.marketing' && params.sessionId) {
getSessionAppId(params.sessionId,false,next)
}else {
setUserInfo(params) setUserInfo(params)
getSessionAppId(params.sessionId)
next() next()
} }
}
} }
} else { } else {
setUserInfo(params) setUserInfo(params)
...@@ -68,21 +87,158 @@ router.beforeEach((to, from, next) => { ...@@ -68,21 +87,158 @@ router.beforeEach((to, from, next) => {
} }
}) })
const getSessionAppId = (sid,status) => { //路由跳转埋点收集
const routerBuried = (to, from) => {
let name = from.name, currentName = to.name;
switch (name) {
case 'common.marketing':
pagename = '营销页'
break;
case 'equity.index':
pagename = '权益首页'
break;
case 'commodity.recharge':
case 'commodity.business':
pagename = '商品详情'
break;
case 'oilStation.index':
pagename = '加油列表'
break;
case 'cardRoll.customer':
pagename = '客服'
break;
default:
pagename = from.meta.title;
}
switch (currentName) {
case 'common.marketing':
currentPagename = '营销页'
break;
case 'equity.index':
currentPagename = '权益首页'
break;
case 'commodity.recharge':
case 'commodity.business':
currentPagename = '商品详情'
break;
case 'oilStation.index':
currentPagename = '加油列表'
break;
case 'cardRoll.customer':
currentPagename = '客服'
break;
default:
currentPagename = to.meta.title;
}
currentTime = parseInt(Date.parse(new Date()).toString().substr(0, 10));
localStorage.setItem('startTime', startTime)
localStorage.setItem('pagename', pagename?pagename:localStorage['currentPagename'] )
localStorage.setItem('currentPagename', currentPagename)
stayBuried(pagename?pagename:currentPagename, startTime, currentTime)
jumpBuried(currentPagename, pagename)
startTime = currentTime;
}
//停留事件
const stayBuried = (pagename, startTime, currentTime) => {
if(startTime != currentTime) {
let logs = Vue.prototype.trackConfig({
"event": 'stay_event',
"properties": {
"pagename": pagename,
"enter_time": parseInt(startTime),
"leave_time": currentTime,
}
})
Vue.prototype.track.collect(logs);
}
}
//跳转事件
const jumpBuried = (currentPagename, pagename) => {
let logs = Vue.prototype.trackConfig({
"event": 'jump_event',
"properties": {
"pagename": currentPagename,
"prevpagename": pagename,
"extra_data": {
"isVip": localStorage['isVip'],
}
}
})
Vue.prototype.track.collect(logs);
}
const loginBuried = (data) => {
/**
* 埋点登录
*/
let project_id = process.env.VUE_APP_PROJECR_VERSION;
let secret = process.env.VUE_APP_PROJECR_SECRET;
let client_id = '';
let user_id;
if (data.openid) {
user_id = data.phone
} else {
user_id = data.mobile
}
window.vm.track.setCommonConfig({ project_id, secret, client_id, user_id })
const ua = navigator.userAgent.toLowerCase();
let terminal;
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
terminal = 'h5'
} else {
if (window.vm.checkPhoneType() == 'ios') {
terminal = 'ios'
} else {
terminal = 'android'
}
}
let user = JSON.stringify({
"user_id": user_id,
"client_ip": returnCitySN.cip,
"client_id": localStorage['client_id'],
"wx_open_id": data.openid ? data.openid : '',
"loc_city": returnCitySN.name,
"loc_province": returnCitySN.name,
"loc_country": '',
"network_carrier": '',
"device_model": '',
"brand": Vue.prototype.getDetect().brand,
"resolution": window.screen.width+'*'+window.screen.height,
"browser_version": window.navigator.appVersion,
"browser": Vue.prototype.getDetect().userAgent,
"os_name": Vue.prototype.getDetect().os_name,
"os_version": Vue.prototype.getDetect().version,
"network_type": window.navigator.connection?window.navigator.connection.effectiveType:'',
"terminal": terminal
})
window.vm.track.getSessionId('/collectdata/login', user, function () {
setUserInfo(data)
})
}
const getSessionAppId = (sid, status,callback) => {
common.getAppSessionId({ sid }).then(res => { common.getAppSessionId({ sid }).then(res => {
let { code, data } = res let { code, data } = res
if (code == 0) { if (code == 0) {
/**
* app埋点登录
*/
setUserInfo(data); setUserInfo(data);
if(status) { loginBuried(data)
if (status) {
store.commit('reload'); store.commit('reload');
}else {//登录后,查询会员信息,如果已经开通过了会员,就直接跳转到会员页面,不走营销也? } else {
equity.getCardInfo().then(res => { equity.getCardInfo().then(res => {
let { code,data } = res; let { code,data } = res;
if (code == 0&&data) { if (code == 0 && data) {
router.replace({name: 'equity.index'}) localStorage.setItem('isVip',1)
router.push({ name: 'equity.index' })
}else {
localStorage.setItem('isVip',0)
} }
}) })
} }
callback();
} }
}) })
} }
...@@ -93,10 +249,12 @@ const getSessionId = (redirectUrl, state) => { ...@@ -93,10 +249,12 @@ const getSessionId = (redirectUrl, state) => {
const appId = sessionStorage.getItem('GL_WX_APPID') const appId = sessionStorage.getItem('GL_WX_APPID')
common.getSessionId({ code: params.code, state, appId }).then(res => { common.getSessionId({ code: params.code, state, appId }).then(res => {
if (res) { if (res) {
let { code, data,message } = res let { code, data, message } = res
if (code == 0) { if (code == 0) {
setUserInfo(data) /**
router.push({name: 'common.phoneLogin'}) * 埋点登录
*/
loginBuried(data)
} else { } else {
Notify({ type: 'danger', message }) Notify({ type: 'danger', message })
} }
......
const pages = { const pages = {
equity: [ equity: [
{name: 'index'}, {name: 'index'},
{name: 'road', title: '道路救援'}, {name: 'road', title: '道路救援',showNavBar: true},
{name: 'tyre', title: '轮胎保障'}, {name: 'tyre', title: '轮胎保障',showNavBar: true},
{name: 'collision', title: '碰撞维修'}, {name: 'collision', title: '碰撞维修',showNavBar: true},
{name: 'compensate', title: '盗抢补偿'}, {name: 'compensate', title: '盗抢补偿',showNavBar: true},
{name: 'loss', title: '整车全损'}, {name: 'loss', title: '整车全损',showNavBar: true},
], ],
oilStation: [ oilStation: [
{name: 'index'}, {name: 'index',showNavBar: true},
{name: 'record', title: '加油记录'}, {name: 'record', title: '加油记录',showNavBar: true},
{name: 'detail', title: '加油站详情'}, {name: 'detail', title: '加油站详情',showNavBar: true},
{name: 'location', title: '加油站详情'}, {name: 'location', title: '选择位置',showNavBar: true},
], ],
common: [ common: [
{name: 'index'}, {name: 'index'},
{name: 'activate', title: '激活权益'}, {name: 'activate', title: '激活权益',showNavBar: true},
{name: 'explain', title: '常见疑问'}, {name: 'explain', title: '常见疑问',showNavBar: true},
{name: 'phoneLogin', title: '登录',wxAuth: true}, {name: 'phoneLogin', title: '登录',wxAuth: true},
{name: 'nothing'}, {name: 'nothing'},
{name: 'appTip'}, {name: 'appTip',title: '领取结果'},
{name: 'expcard',title: '体验卡领取'}, {name: 'expcard',title: '体验卡领取'},
{name: 'marketing', wxAuth: true}, {name: 'marketing', wxAuth: true},
], ],
...@@ -34,48 +34,62 @@ const pages = { ...@@ -34,48 +34,62 @@ const pages = {
cardRoll: [ cardRoll: [
{ {
name: 'index', name: 'index',
title: '我的卡券' title: '我的卡券',
showNavBar: true
}, },
{ {
name: 'detail', name: 'detail',
title: '查看卡券' title: '查看卡券',
showNavBar: true
}, },
{ {
name: 'opening', name: 'opening',
title: '开通权益' title: '开通权益',
showNavBar: true
}, },
{ {
name: 'salesDetail', name: 'salesDetail',
title: '售后详情' title: '售后详情',
showNavBar: true
}, },
{ {
name: 'waiting', name: 'waiting',
title: '等待处理' title: '等待处理',
showNavBar: true
}, },
{ {
name: 'salesApply', name: 'salesApply',
title: '申请售后' title: '申请售后',
showNavBar: true
}, },
{ {
name: 'agreement', name: 'agreement',
title: '权益服务协议' title: '权益服务协议',
showNavBar: true
}, },
{ {
name: 'customer', name: 'customer',
showNavBar: true
} }
], ],
commodity: [ commodity: [
{ {
name: 'process', name: 'process',
title: '充值流程',
showNavBar: true
}, },
{ {
name: 'recharge', name: 'recharge',
showNavBar: true
}, },
{ {
name: 'success', name: 'success',
title: '支付成功',
showNavBar: true
}, },
{ {
name: 'business', name: 'business',
showNavBar: true
}, },
], ],
device: [{ device: [{
...@@ -139,3 +153,4 @@ Object.keys(pages).map(parent => { ...@@ -139,3 +153,4 @@ Object.keys(pages).map(parent => {
}) })
}) })
export default routes export default routes
...@@ -77,7 +77,7 @@ export default { ...@@ -77,7 +77,7 @@ export default {
router.replace({ name: 'common.marketing' }) router.replace({ name: 'common.marketing' })
}, },
reload(state) { reload(state) {
console.log(state,'storeRelod方法,已译注'); console.log(state)
// router.replace({ name: 'common.nothing' }) // router.replace({ name: 'common.nothing' })
// setTimeout(() => { // setTimeout(() => {
// state.lastPath?router.replace({ name: state.lastPath }):router.replace({name: 'equity.index'}) // state.lastPath?router.replace({ name: state.lastPath }):router.replace({name: 'equity.index'})
......
...@@ -108,9 +108,11 @@ class WxConfig { ...@@ -108,9 +108,11 @@ class WxConfig {
}, },
fail() { fail() {
window.vm.showToast('已取消支付') window.vm.showToast('已取消支付')
resolve()
}, },
cancel() { cancel() {
window.vm.showToast('支付失败,请重试') window.vm.showToast('支付失败,请重试')
resolve()
} }
}) })
}) })
......
...@@ -4,7 +4,7 @@ import { Toast, Dialog } from 'vant' ...@@ -4,7 +4,7 @@ import { Toast, Dialog } from 'vant'
* 日期格式化 * 日期格式化
* let time = new Date().format('yyyy-MM-dd hh:mm:ss') * let time = new Date().format('yyyy-MM-dd hh:mm:ss')
*/ */
Date.prototype.format = function(fmt) { Date.prototype.format = function (fmt) {
let o = { let o = {
'M+': this.getMonth() + 1, //月份 'M+': this.getMonth() + 1, //月份
'd+': this.getDate(), //日 'd+': this.getDate(), //日
...@@ -30,16 +30,16 @@ const throttle = (fn, gapTime) => { ...@@ -30,16 +30,16 @@ const throttle = (fn, gapTime) => {
gapTime = 1500 gapTime = 1500
} }
let _lastTime = null let _lastTime = null
return function() { return function () {
let _nowTime = +new Date() let _nowTime = +new Date()
if (_nowTime - _lastTime > gapTime || !_lastTime) { if (_nowTime - _lastTime > gapTime || !_lastTime) {
fn.apply(this, arguments) fn.apply(this, arguments)
_lastTime = _nowTime _lastTime = _nowTime
} }
} }
} }
/**防止重复点击 */ /**防止重复点击 */
// const noScroll = (e) => { e.preventDefault() } // const noScroll = (e) => { e.preventDefault() }
const showLoading = (title = '加载中...') => { const showLoading = (title = '加载中...') => {
Toast({ Toast({
type: 'loading', type: 'loading',
...@@ -50,9 +50,9 @@ const showLoading = (title = '加载中...') => { ...@@ -50,9 +50,9 @@ const showLoading = (title = '加载中...') => {
} }
const hideLoading = () => { const hideLoading = () => {
Toast.clear() Toast.clear()
} }
/**复制 */ /**复制 */
const cloneText = (message)=> { const cloneText = (message) => {
let input = document.createElement("input"); let input = document.createElement("input");
input.value = message; input.value = message;
document.body.appendChild(input); document.body.appendChild(input);
...@@ -61,7 +61,7 @@ const cloneText = (message)=> { ...@@ -61,7 +61,7 @@ const cloneText = (message)=> {
document.body.removeChild(input); document.body.removeChild(input);
Toast('复制成功'); Toast('复制成功');
} }
/**num:要转换的数值,fixed:精确几位小数 */ /**num:要转换的数值,fixed:精确几位小数 */
const decimal = (num, fixed) => { const decimal = (num, fixed) => {
let pow = Math.pow(10, fixed) let pow = Math.pow(10, fixed)
return Math.round(num * pow) / pow return Math.round(num * pow) / pow
...@@ -73,8 +73,8 @@ const showToast = (message = '', icon) => { ...@@ -73,8 +73,8 @@ const showToast = (message = '', icon) => {
} }
if (icon) params.icon = icon if (icon) params.icon = icon
Toast(params) Toast(params)
} }
/**触摸样式 */ /**触摸样式 */
const touchstart = e => { const touchstart = e => {
e.target.classList.add('btn-on-leave') e.target.classList.add('btn-on-leave')
} }
...@@ -126,11 +126,59 @@ const openWindows = (url, name) => { ...@@ -126,11 +126,59 @@ const openWindows = (url, name) => {
window.location.href = url window.location.href = url
} }
} else { } else {
let pagename;
switch (name) {
case 'common.marketing':
pagename = '营销页'
break;
case 'equity.index':
pagename = '权益首页'
break;
case 'commodity.recharge':
case 'commodity.business':
pagename = '商品详情'
break;
case 'oilStation.index':
pagename = '加油列表'
break;
case 'cardRoll.detail':
pagename = '查看卡卷'
break;
case 'cardRoll.index':
pagename = '我的卡卷'
break;
case 'cardRoll.opening':
pagename = '开通权益'
break;
case 'cardRoll.salesApply':
pagename = '售后详情'
break;
case 'cardRoll.agreement':
pagename = '服务协议'
break;
case 'equity.road':
pagename = '道路救援'
break;
default:
pagename = '';
}
localStorage.setItem('nextPageName', pagename)
localStorage.setItem('nextPageTime', parseInt(Date.parse(new Date()).toString().substr(0, 10)));
let params = { let params = {
needNavigator: 1, needNavigator: 1,
type: 4, type: 4,
url, url,
} }
let logs = Vue.prototype.trackConfig({
"event": 'stay_event',
"properties": {
"pagename": localStorage['currentPagename'],
"enter_time": parseInt(localStorage['startTime']),
"leave_time": parseInt(Date.parse(new Date()).toString().substr(0, 10)),
}
})
Vue.prototype.track.collect(logs);
if (checkPhoneType() == 'ios') { if (checkPhoneType() == 'ios') {
window.webkit.messageHandlers.jumpNativeApp.postMessage(JSON.stringify(params)) window.webkit.messageHandlers.jumpNativeApp.postMessage(JSON.stringify(params))
} else { } else {
...@@ -152,6 +200,34 @@ const getParams = str => { ...@@ -152,6 +200,34 @@ const getParams = str => {
} }
return obj return obj
} }
const appHide = () => {
// const ua = navigator.userAgent.toLowerCase();
// const currentTime = parseInt(Date.parse(new Date()).toString().substr(0, 10));
// const startTime = parseInt(localStorage['startTime']);
// // if (ua.match(/MicroMessenger/i) != 'micromessenger') {
// document.addEventListener("visibilitychange", function() { //visibilityState
// if(!document.hidden) {
// let logs = Vue.prototype.trackConfig({
// "event": 'stay_event',
// "properties": {
// "pagename": localStorage['currentPagename'],
// "enter_time": startTime,
// "leave_time": currentTime,
// }
// })
// Vue.prototype.track.collect(logs);
// localStorage.setItem('aaa',9)
// }
// console.log(localStorage['currentPagename'])
// localStorage.setItem('aaa',startTime+''+parseInt(Date.parse(new Date()).toString().substr(0, 10))+new Date())
// });
// }
// document.addEventListener("visibilitychange", function(){
// if(!document.hidden) {
// localStorage.setItem('aaa',localStorage['nextPageName']+parseInt(localStorage['nextPageTime'])+''+ parseInt(Date.parse(new Date()).toString().substr(0, 10)))
// }
// });
}
const getChannel = () => { const getChannel = () => {
let source = 3 let source = 3
if (window.__wxjs_environment === 'miniprogram') { if (window.__wxjs_environment === 'miniprogram') {
...@@ -210,6 +286,74 @@ const equityLogin = () => { ...@@ -210,6 +286,74 @@ const equityLogin = () => {
}) })
} }
} }
const nowTime = () => { //获取当前时间戳秒
let time = parseInt(Date.parse(new Date()).toString().substr(0, 10));
return time;
}
const getDetect = function () {
//获取用户代理
let md = new MobileDetect(window.navigator.userAgent);
let version;
if (md.os() == 'iOS') {
version = md.version('iPhone')
} else {
version = md.version('Android')
}
let ua = navigator.userAgent.split("(")[1].split(")")[0];
let brand = "";
let phone = [/IPHONE/gi, /huawei/gi, /mi/gi, /vivo/gi, /OPPO/gi, /samsung/gi, /SONY/gi, /Nokia/gi, /HTC/gi, /ZTE/gi, /Lenovo/gi, /ZUK/gi,]
if (phone[0].test(ua)) {
brand = "iPhone";
} else if (phone[1].test(ua)) {
brand = "HUAWEI";
} else if (phone[2].test(ua)) {
brand = "小米";
} else if (phone[3].test(ua)) {
brand = "vivo";
} else if (phone[4].test(ua)) {
brand = "OPPO";
} else if (phone[5].test(ua)) {
brand = "SAMSUNG";
} else if (phone[6].test(ua)) {
brand = "SONY";
} else if (phone[7].test(ua)) {
brand = "Nokia";
} else if (phone[8].test(ua)) {
brand = "HTC";
} else if (phone[9].test(ua)) {
brand = "ZTE";
} else if (phone[10].test(ua) || phone[11].test(ua)) {
brand = "Lenovo";
} else {
brand = "Android";
}
return {
os_name: md.os(),
brand: brand,
version,
userAgent: md.userAgent()
}
}
const trackConfig = (params) => {
const ua = navigator.userAgent.toLowerCase();
let terminal;
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
terminal = 'h5'
} else {
if (checkPhoneType() == 'ios') {
terminal = 'ios'
} else {
terminal = 'android'
}
}
return Object.assign({}, params, {
"client_time": parseInt(Date.parse(new Date()).toString().substr(0, 10)),
"project_id": parseInt(process.env.VUE_APP_PROJECR_VERSION),
"project_ver": '1.0.0',
"terminal": terminal
})
}
//自定义弹框dialog //自定义弹框dialog
const myDialog = (message,confirmText,cancelText,comfirmFn,cancelFn)=>{ const myDialog = (message,confirmText,cancelText,comfirmFn,cancelFn)=>{
...@@ -253,6 +397,10 @@ const utils = { ...@@ -253,6 +397,10 @@ const utils = {
alert, alert,
cloneText, cloneText,
getParams, getParams,
trackConfig,
getDetect,
appHide,
nowTime,
myDialog myDialog
} }
......
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
<script> <script>
export default { export default {
name: "customer" name: "customer",
mounted() {
}
} }
</script> </script>
......
...@@ -15,23 +15,23 @@ ...@@ -15,23 +15,23 @@
<div class="card-item-style" v-if="detailInfo.cardType == 5"> <div class="card-item-style" v-if="detailInfo.cardType == 5">
<div class="card-item-number"> <div class="card-item-number">
<div class="card-item-label text-hide">账号:{{detailInfo.cardPwd}}</div> <div class="card-item-label text-hide">账号:{{detailInfo.cardPwd}}</div>
<div class="btn-clone" @click="getClone(detailInfo.cardPwd)">复制</div> <div class="btn-clone" @click="getClone(detailInfo.cardPwd,'cardPwd')">复制</div>
</div> </div>
<div class="card-item-number"> <div class="card-item-number">
<div class="card-item-label text-hide">密码:{{detailInfo.cardPwd}}</div> <div class="card-item-label text-hide">密码:{{detailInfo.cardPwd}}</div>
<div class="btn-clone" @click="getClone(detailInfo.cardPwd)">复制</div> <div class="btn-clone" @click="getClone(detailInfo.cardPwd,'cardPwd')">复制</div>
</div> </div>
</div> </div>
<div class="card-item-style" v-if="detailInfo.cardType == 3"> <div class="card-item-style" v-if="detailInfo.cardType == 3">
<div class="card-item-number"> <div class="card-item-number">
<div class="card-item-label text-hide">URL:{{detailInfo.linkUrl}}</div> <div class="card-item-label text-hide">URL:{{detailInfo.linkUrl}}</div>
<div class="btn-clone" @click="getClone(detailInfo.linkUrl)">复制</div> <div class="btn-clone" @click="getClone(detailInfo.linkUrl,'linkUrl')">复制</div>
</div> </div>
</div> </div>
<div class="card-item-style" v-if="detailInfo.cardType == 4"> <div class="card-item-style" v-if="detailInfo.cardType == 4">
<div class="card-item-number"> <div class="card-item-number">
<div class="card-item-label text-hide">兑换码:{{detailInfo.cardPwd}}</div> <div class="card-item-label text-hide">兑换码:{{detailInfo.cardPwd}}</div>
<div class="btn-clone" @click="getClone(detailInfo.cardPwd)">复制</div> <div class="btn-clone" @click="getClone(detailInfo.cardPwd,'cardPwd')">复制</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -68,13 +68,7 @@ export default { ...@@ -68,13 +68,7 @@ export default {
}, },
mounted() { mounted() {
this.showLoading(); this.showLoading();
const ua = navigator.userAgent.toLowerCase(); let orderCode = this.$store.state.order.orderCode;
let orderCode;
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
orderCode = this.$store.state.order.orderCode;
}else {
orderCode = this.$store.state.orderCode;
}
let para = { let para = {
orderCode orderCode
} }
...@@ -90,9 +84,22 @@ export default { ...@@ -90,9 +84,22 @@ export default {
}, },
methods: { methods: {
//复制编码 //复制编码
getClone(value) { getClone(value,name) {
this.cloneText(value) this.cloneText(value)
} let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "查看卡券",
event_name: '复制',
[name]:value,
},
});
this.collect(logs);
},
//埋点
collect(logs) {
window.vm.track.collect(logs);
},
} }
} }
</script> </script>
......
...@@ -137,26 +137,14 @@ export default { ...@@ -137,26 +137,14 @@ export default {
tabStatus, tabStatus,
reStatus, reStatus,
idx: 1, idx: 1,
isFirst: true,
cardStatus cardStatus
} }
}, },
mounted() { mounted() {
this.getCardList(); this.getCardList();
const ua = navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) != 'micromessenger') {
this.reload();
}
}, },
methods: { methods: {
reload() {
let hiddenProperty ='hidden' in document ?'hidden':'webkitHidden' in document ?'webkitHidden':
'mozHidden' in document ?'mozHidden':null;
let visibilityChangeEvent = hiddenProperty.replace(/hidden/i,'visibilitychange');
let onVisibilityChange = function(){
window.location.reload()
}
document.addEventListener(visibilityChangeEvent, onVisibilityChange);
},
getCardList(e) { getCardList(e) {
let {sessionId} = this.$store.state; let {sessionId} = this.$store.state;
this.showLoading(); this.showLoading();
...@@ -177,35 +165,49 @@ export default { ...@@ -177,35 +165,49 @@ export default {
//切换tab //切换tab
tabClick(name) { tabClick(name) {
let params = {}; let params = {};
let str
switch(name) switch(name)
{ {
case 0: case 0:
params = {} params = {}
str = '全部'
break; break;
case 1: case 1:
params = { params = {
'statusList[0]': 1, 'statusList[0]': 1,
'statusList[1]': 2, 'statusList[1]': 2,
} }
str = '待收货'
break break
case 2: case 2:
params = { params = {
'statusList[0]': 3, 'statusList[0]': 3,
} }
str = '已完成'
break; break;
case 3: case 3:
params = { params = {
'statusList[0]': 5, 'statusList[0]': 5,
'statusList[1]': 6, 'statusList[1]': 6,
} }
str = '已退款'
break; break;
case 4: case 4:
params = { params = {
'statusList[0]': 4, 'statusList[0]': 4,
} }
str = '售后'
break; break;
} }
this.getCardList(params) this.getCardList(params)
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "我的卡券",
event_name: str,
},
});
this.collect(logs);
}, },
//确认收货 //确认收货
handleConfirm(val) { handleConfirm(val) {
...@@ -219,6 +221,16 @@ export default { ...@@ -219,6 +221,16 @@ export default {
sessionId: this.sessionId, sessionId: this.sessionId,
orderCode: val orderCode: val
}; };
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "我的卡券",
event_name: '确认收货',
orderCode:val,
sessionId:this.sessionId
},
});
this.collect(logs);
cardRoll.getCardConfirm(para).then(res => { cardRoll.getCardConfirm(para).then(res => {
this.hideLoading() this.hideLoading()
let { code, message } = res let { code, message } = res
...@@ -253,19 +265,32 @@ export default { ...@@ -253,19 +265,32 @@ export default {
// }, // },
//查看卡券 //查看卡券
jumpDetail(val) { jumpDetail(val) {
let { sessionId } = this.$store.state;
this.$store.commit('setOrder',val) this.$store.commit('setOrder',val)
let [href] = window.location.href.split('/#/'); window.vm.$router.push({ name: 'cardRoll.detail' })
let url = `${href}/#/cardRoll/detail?sessionId=${sessionId}&orderCode=${val.orderCode}`; let logs = window.vm.trackConfig({
this.openWindows(url, 'cardRoll.detail') event: "click_event",
properties: {
pagename: "我的卡券",
event_name: '查看卡券',
orderCode:val.orderCode,
},
});
this.collect(logs);
}, },
jumpSales(val) { jumpSales(val) {
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "我的卡券",
event_name: '售后申请',
orderCode:val.orderCode,
orderPrices:val.orderPrices
},
});
this.collect(logs);
if(val.openRefund) { if(val.openRefund) {
let { sessionId } = this.$store.state;
this.$store.commit('setOrder',val) this.$store.commit('setOrder',val)
let [href] = window.location.href.split('/#/'); window.vm.$router.push({ name: 'cardRoll.salesApply' })
let url = `${href}/#/cardRoll/salesApply?sessionId=${sessionId}&orderCode=${val.orderCode}&orderPrices=${val.orderPrices}`;
this.openWindows(url, 'cardRoll.salesApply')
}else { }else {
this.alert({ this.alert({
message: '该卡券无法发起售后,如有其它疑问,请联系购券页面的在线客服进行咨询!', message: '该卡券无法发起售后,如有其它疑问,请联系购券页面的在线客服进行咨询!',
...@@ -273,11 +298,21 @@ export default { ...@@ -273,11 +298,21 @@ export default {
} }
}, },
jumpSalesDetail(val) { jumpSalesDetail(val) {
let { sessionId } = this.$store.state;
this.$store.commit('setOrder',val) this.$store.commit('setOrder',val)
let [href] = window.location.href.split('/#/'); window.vm.$router.push({ name: 'cardRoll.salesDetail' })
let url = `${href}/#/cardRoll/salesDetail?sessionId=${sessionId}&orderCode=${val.orderCode}`; let logs = window.vm.trackConfig({
this.openWindows(url, 'cardRoll.salesDetail') event: "click_event",
properties: {
pagename: "我的卡券",
event_name: '售后详情',
orderCode:val.orderCode
},
});
this.collect(logs);
},
//埋点
collect(logs) {
window.vm.track.collect(logs);
}, },
}, },
} }
......
...@@ -55,18 +55,21 @@ export default { ...@@ -55,18 +55,21 @@ export default {
} }
}, },
mounted() { mounted() {
this.appHide();
this.orderCode = this.$store.state.order.orderCode;
this.orderPrices = this.$store.state.order.orderPrices;
const ua = navigator.userAgent.toLowerCase() const ua = navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) == 'micromessenger') { if (ua.match(/MicroMessenger/i) == 'micromessenger') {
this.weixinImg = true; this.weixinImg = true;
this.orderCode = this.$store.state.order.orderCode;
this.orderPrices = this.$store.state.order.orderPrices;
}else { }else {
this.weixinImg = false; this.weixinImg = false;
this.orderCode = this.$store.state.orderCode;
this.orderPrices = this.$store.state.orderPrices;
} }
}, },
methods: { methods: {
collect(logs) {
window.vm.track.collect(logs);
},
handleEditPrice() { handleEditPrice() {
this.priceDialog = true; this.priceDialog = true;
this.price2 = this.orderPrices; this.price2 = this.orderPrices;
...@@ -170,6 +173,15 @@ export default { ...@@ -170,6 +173,15 @@ export default {
if (img) { if (img) {
this.refundImg = img.data; this.refundImg = img.data;
this.showToast('上传成功') this.showToast('上传成功')
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "申请售后",
event_name: '图片上传',
image:img.data
},
});
this.collect(logs);
} else { } else {
this.showToast('上传失败') this.showToast('上传失败')
this.refundImg = ''; this.refundImg = '';
...@@ -195,6 +207,15 @@ export default { ...@@ -195,6 +207,15 @@ export default {
refundImg: this.refundImg, refundImg: this.refundImg,
sessionId sessionId
} }
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "申请售后",
event_name: '提交申请',
...para
},
});
this.collect(logs);
cardRoll.getCardRefund(para).then(res => { cardRoll.getCardRefund(para).then(res => {
this.hideLoading(); this.hideLoading();
console.log(res) console.log(res)
......
...@@ -52,6 +52,7 @@ export default { ...@@ -52,6 +52,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.appHide();
const ua = navigator.userAgent.toLowerCase(); const ua = navigator.userAgent.toLowerCase();
let orderCode; let orderCode;
if (ua.match(/MicroMessenger/i) == 'micromessenger') { if (ua.match(/MicroMessenger/i) == 'micromessenger') {
......
...@@ -19,6 +19,7 @@ export default { ...@@ -19,6 +19,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.appHide();
sessionStorage.setItem("need-refresh",1) sessionStorage.setItem("need-refresh",1)
}, },
methods: { methods: {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<div class="business-select-item" @click="selectBusiness(item,index)" :class="[{'checked': index == bindex,'itemWid': businessList.length<3},`select-${index}`]" v-for="(item,index) in businessList" :key="index"> <div class="business-select-item" @click="selectBusiness(item,index)" :class="[{'checked': index == bindex,'itemWid': businessList.length<3},`select-${index}`]" v-for="(item,index) in businessList" :key="index">
<van-icon name="checked" class="business-checked" v-if="index == bindex"/> <van-icon name="checked" class="business-checked" v-if="index == bindex"/>
<div class="business-select-img"> <div class="business-select-img">
<img :src="item.goodsImage" alt=""> <img v-lazy="item.goodsImage" alt="">
</div> </div>
<div class="business-select-name text-hide-2">{{ item.productName }}</div> <div class="business-select-name text-hide-2">{{ item.productName }}</div>
<div class="business-select-price1"><span>¥</span>{{ isOpen||!item.noMemberPrice?item.salesPrice:item.noMemberPrice}}</div> <div class="business-select-price1"><span>¥</span>{{ isOpen||!item.noMemberPrice?item.salesPrice:item.noMemberPrice}}</div>
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<div class="pop-item" @click="selectBusiness(item,index)" v-for="(item,index) in businessList" :key="index"> <div class="pop-item" @click="selectBusiness(item,index)" v-for="(item,index) in businessList" :key="index">
<van-icon name="checked" class="pop-checked" v-if="index == bindex"/> <van-icon name="checked" class="pop-checked" v-if="index == bindex"/>
<div class="pop-item-img"> <div class="pop-item-img">
<img :src="item.goodsImage" alt=""> <img v-lazy="item.goodsImage" alt="">
</div> </div>
<div class="pop-item-name text-hide-2">{{ item.productName }}</div> <div class="pop-item-name text-hide-2">{{ item.productName }}</div>
<div class="pop-item-price1"><span>¥</span>{{ isOpen||!item.noMemberPrice?item.salesPrice:item.noMemberPrice}}</div> <div class="pop-item-price1"><span>¥</span>{{ isOpen||!item.noMemberPrice?item.salesPrice:item.noMemberPrice}}</div>
...@@ -101,7 +101,7 @@ export default { ...@@ -101,7 +101,7 @@ export default {
name: "business", name: "business",
data() { data() {
return { return {
isOpen: 0, isOpen: 1,
appearance: 1, appearance: 1,
businessStatus: 2, businessStatus: 2,
bindex: 0, bindex: 0,
...@@ -115,23 +115,17 @@ export default { ...@@ -115,23 +115,17 @@ export default {
}, },
status: true, status: true,
supplier: '', supplier: '',
isFirst: true,
isHaveInventory:true,//是否有库存 isHaveInventory:true,//是否有库存
} }
}, },
mounted() { mounted() {
this.appHide();
this.getCardInfo(); this.getCardInfo();
const ua = navigator.userAgent.toLowerCase()
if(ua.match(/MicroMessenger/i) == 'micromessenger') {
let goods = JSON.parse(sessionStorage.getItem('GL_GOODS_INFO')); let goods = JSON.parse(sessionStorage.getItem('GL_GOODS_INFO'));
document.title = goods.brandName document.title = goods.brandName
this.brandName = goods.brandName; this.brandName = goods.brandName;
this.supplier = goods.supplier; this.supplier = goods.supplier;
}else {
let params = this.getParams(window.location.href)
this.brandName = decodeURI(params.brandName);
this.supplier = params.supplier;
document.title = decodeURI(params.brandName)
}
this.showLoading(); this.showLoading();
let para = { let para = {
brandName: this.brandName, brandName: this.brandName,
...@@ -150,6 +144,20 @@ export default { ...@@ -150,6 +144,20 @@ export default {
}) })
}, },
methods: { methods: {
collect(logs) {
window.vm.track.collect(logs);
},
toSetTrackData(name,data){
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "商品详情",
event_name: name,
...data
},
});
this.collect(logs);
},
getCardInfo() { getCardInfo() {
equity.getCardInfo().then(res => { equity.getCardInfo().then(res => {
let { code,data } = res; let { code,data } = res;
...@@ -161,21 +169,23 @@ export default { ...@@ -161,21 +169,23 @@ export default {
}) })
}, },
getCard() { getCard() {
let { sessionId } = this.$store.state; window.vm.$router.push({ name: 'cardRoll.index' })
let [href] = window.location.href.split('/#/'); this.toSetTrackData('我的卡券',{})
let url = `${href}/#/cardRoll/index?sessionId=${sessionId}`;
this.openWindows(url, 'cardRoll.index')
}, },
jumpCustomer() { jumpCustomer() {
this.isFirst = false;
window.vm.$router.push({ name: 'cardRoll.customer' }) window.vm.$router.push({ name: 'cardRoll.customer' })
this.toSetTrackData('客服',{})
}, },
jumpOpening() { jumpOpening() {
window.vm.$router.push({ name: 'cardRoll.opening',query: {payStatus:1} }) window.vm.$router.push({ name: 'cardRoll.opening',query: {payStatus:1} })
this.setLocalStorage('whereInOpen','goods') this.setLocalStorage('whereInOpen','goods')
this.toSetTrackData('开通权益',{})
}, },
getMore() { getMore() {
this.show = true; this.show = true;
this.toSetTrackData('查看更多',{})
}, },
selectBusiness(item,index){ selectBusiness(item,index){
this.selectData = item; this.selectData = item;
...@@ -185,6 +195,7 @@ export default { ...@@ -185,6 +195,7 @@ export default {
document.querySelector('.business-select').scrollLeft = document.querySelector(`.select-${index}`).offsetLeft - 10; document.querySelector('.business-select').scrollLeft = document.querySelector(`.select-${index}`).offsetLeft - 10;
} }
this.checkInventory(item.id) this.checkInventory(item.id)
this.toSetTrackData('选择商品',item)
}, },
checkInventory(id){ checkInventory(id){
commodity.getInventory({id}).then(res=>{ commodity.getInventory({id}).then(res=>{
......
...@@ -57,6 +57,7 @@ export default { ...@@ -57,6 +57,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.appHide();
this.rechargeNumber = this.$route.query.rechargeNumber; this.rechargeNumber = this.$route.query.rechargeNumber;
this.productName = this.$route.query.productName; this.productName = this.$route.query.productName;
}, },
......
...@@ -24,22 +24,34 @@ export default { ...@@ -24,22 +24,34 @@ export default {
} }
}, },
mounted() { mounted() {
this.appHide();
this.price = this.$route.query.price; this.price = this.$route.query.price;
}, },
methods: { methods: {
collect(logs) {
window.vm.track.collect(logs);
},
getAgainPay() { getAgainPay() {
const ua = navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
window.vm.$router.go(-1) window.vm.$router.go(-1)
}else { let logs = window.vm.trackConfig({
window.vm.$router.replace({name:'equity.index'}) event: "click_event",
} properties: {
pagename: "支付成功",
event_name: '重新购买'
},
});
this.collect(logs);
}, },
getOrder() { getOrder() {
let { sessionId } = this.$store.state; window.vm.$router.push({ name: 'cardRoll.index' })
let [href] = window.location.href.split('/#/'); let logs = window.vm.trackConfig({
let url = `${href}/#/cardRoll/index?sessionId=${sessionId}`; event: "click_event",
this.openWindows(url, 'cardRoll.index') properties: {
pagename: "支付成功",
event_name: '查看订单'
},
});
this.collect(logs);
} }
} }
} }
......
...@@ -47,11 +47,28 @@ export default { ...@@ -47,11 +47,28 @@ export default {
}, },
methods: { methods: {
jump () { jump () {
let [href] = window.location.href.split('/#/') let logs = window.vm.trackConfig({
let url = `${href}/#/common/explain` event: "click_event",
this.openWindows(url, 'common.explain') properties: {
pagename: "激活权益",
event_name: "常见疑问",
},
});
window.vm.track.collect(logs);
window.vm.$router.push({ name: 'common.explain' })
}, },
confirm () { confirm () {
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "激活权益",
event_name: "确定",
extra_data: {
cardNo: this.no
}
},
});
window.vm.track.collect(logs);
let { no } = this let { no } = this
if (!no) return if (!no) return
let target = 'activateBySn' let target = 'activateBySn'
...@@ -77,16 +94,7 @@ export default { ...@@ -77,16 +94,7 @@ export default {
if (window.__wxjs_environment === 'miniprogram') { if (window.__wxjs_environment === 'miniprogram') {
wx.miniProgram.navigateBack() wx.miniProgram.navigateBack()
} else { } else {
const ua = navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
window.vm.$router.push({ name: 'equity.index' }) window.vm.$router.push({ name: 'equity.index' })
} else {
if (this.checkPhoneType() == 'ios') {
window.webkit.messageHandlers.jumpNativeApp.postMessage(JSON.stringify({ type: 1, reloadView: 'equity' }))
} else {
window.myjs.jumpNativeApp(JSON.stringify({ type: 1, reloadView: 'equity' }))
}
}
} }
}) })
} else { } else {
...@@ -100,6 +108,8 @@ export default { ...@@ -100,6 +108,8 @@ export default {
<style scoped lang='scss'> <style scoped lang='scss'>
.main { .main {
width: auto;
height: auto!important;
position: fixed; position: fixed;
top: 50%; top: 50%;
left: 50%; left: 50%;
......
...@@ -35,6 +35,7 @@ export default { ...@@ -35,6 +35,7 @@ export default {
sms: "", sms: "",
countDown: false, countDown: false,
countKey: new Date().getTime(), countKey: new Date().getTime(),
countNum: 0,
day:0 day:0
}; };
}, },
...@@ -81,6 +82,57 @@ export default { ...@@ -81,6 +82,57 @@ export default {
} }
} }
}, },
loginBuried(data) {
let project_id = process.env.VUE_APP_PROJECR_VERSION;
let secret = process.env.VUE_APP_PROJECR_SECRET;
let client_id = '';
let user_id = data.phone;
window.vm.track.setCommonConfig({ project_id, secret, client_id, user_id })
const ua = navigator.userAgent.toLowerCase();
let terminal;
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
terminal = 'h5'
} else {
if (window.vm.checkPhoneType() == 'ios') {
terminal = 'ios'
} else {
terminal = 'android'
}
}
let user = JSON.stringify({
"user_id": user_id,
"client_ip": returnCitySN.cip,
"client_id": localStorage['client_id'],
"wx_open_id": data?data.openid:'',
"loc_city": returnCitySN.name,
"loc_province": returnCitySN.name,
"loc_country": '',
"network_carrier": '',
"device_model": '',
"brand": window.vm.getDetect().brand,
"resolution": window.screen.width+'*'+window.screen.height,
"browser_version": window.navigator.appVersion,
"browser": window.vm.getDetect().userAgent,
"os_name": window.vm.getDetect().os_name,
"os_version": window.vm.getDetect().version,
"network_type": window.navigator.connection?window.navigator.connection.effectiveType:'',
"terminal": terminal
})
window.vm.track.getSessionId('/collectdata/login', user,function(){})
},
toCreateTrack(type,name,data){
let logs = window.vm.trackConfig({
event: type,
properties: {
pagename: "体验卡领取",
event_name: name,
extra_data: {
...data
}
},
});
window.vm.track.collect(logs);
},
login() { login() {
const params = this.getParams(window.location.href) const params = this.getParams(window.location.href)
const appId = sessionStorage.getItem("GL_WX_APPID") const appId = sessionStorage.getItem("GL_WX_APPID")
...@@ -91,6 +143,7 @@ export default { ...@@ -91,6 +143,7 @@ export default {
if(!this.sms){ if(!this.sms){
return return
} }
this.toCreateTrack('login','免费领取',{ mobile: this.tel, code: this.sms, count: this.countNum})
this.showLoading(); this.showLoading();
let para = { let para = {
mobile: this.tel, mobile: this.tel,
...@@ -108,10 +161,7 @@ export default { ...@@ -108,10 +161,7 @@ export default {
this.hideLoading() this.hideLoading()
this.setLocalStorage('codeAuth',false) this.setLocalStorage('codeAuth',false)
this.setLocalStorage('bindinfo',res) this.setLocalStorage('bindinfo',res)
if(res.code==-1&&res.errId==4052 || res.code==-1&&res.errId==1010 ||res.code==-1&&res.errId==10016){ this.loginBuried(res.data)
this.showToast(res.message)
return
}
window.location.href = `${window.location.href.split('?')[0]}#/equity/index?pageFrom=expcard` window.location.href = `${window.location.href.split('?')[0]}#/equity/index?pageFrom=expcard`
}) })
}else{//非微信环境 }else{//非微信环境
...@@ -140,6 +190,7 @@ export default { ...@@ -140,6 +190,7 @@ export default {
if(this.countDown){ if(this.countDown){
return return
} }
this.countNum ++;
this.$store.commit( this.$store.commit(
"setVerificationCount", "setVerificationCount",
Math.round(new Date() / 1000) + 60 Math.round(new Date() / 1000) + 60
......
...@@ -38,6 +38,7 @@ export default { ...@@ -38,6 +38,7 @@ export default {
.main { .main {
padding: 20px; padding: 20px;
color: #2c2c2c; color: #2c2c2c;
window: auto;
.page { .page {
margin-bottom: 30px; margin-bottom: 30px;
.title { .title {
......
...@@ -126,7 +126,14 @@ export default { ...@@ -126,7 +126,14 @@ export default {
let [href] = window.location.href.split('/#/') let [href] = window.location.href.split('/#/')
let url = `${href}/#/cardRoll/opening?sessionId=${sessionId}` let url = `${href}/#/cardRoll/opening?sessionId=${sessionId}`
this.openWindows(url, 'cardRoll.opening'); this.openWindows(url, 'cardRoll.opening');
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益中心",
event_name:'立即领取'
},
});
this.collect(logs);
} else { } else {
this.equityLogin() this.equityLogin()
} }
...@@ -144,6 +151,17 @@ export default { ...@@ -144,6 +151,17 @@ export default {
} }
} }
this.CarLink(e) this.CarLink(e)
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益中心",
event_name:e.equityName,
equityDesc:e.equityDesc,
equityIcon:e.equityIcon,
supplier:e.supplier
},
});
this.collect(logs);
}else { }else {
this.equityLogin() this.equityLogin()
} }
...@@ -161,13 +179,25 @@ export default { ...@@ -161,13 +179,25 @@ export default {
} }
} }
this.jumpLink(e) this.jumpLink(e)
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益中心",
event_name:e.brandName,
...e
},
});
this.collect(logs);
}else { }else {
this.equityLogin() this.equityLogin()
} }
}, },
willComeDialog() { willComeDialog() {
this.showToast('即将上线,敬请期待') this.showToast('即将上线,敬请期待')
} },
collect(logs) {
window.vm.track.collect(logs);
},
} }
} }
</script> </script>
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
</div> </div>
</div> </div>
</div> </div>
<span @click="jump" class="know_btn">我知道了</span> <span @click="jump(1)" class="know_btn">我知道了</span>
</div> </div>
</template> </template>
...@@ -143,10 +143,13 @@ export default { ...@@ -143,10 +143,13 @@ export default {
}, },
methods: { methods: {
collect(logs) {
window.vm.track.collect(logs);
},
init() { init() {
//如果能够获取到这个缓存,说明已经是登录过 //如果能够获取到这个缓存,说明已经是登录过
// let isReload = this.getLocalStorage('reLoadIndex') // let isReload = this.getLocalStorage('reLoadIndex')
// console.log('时间搓',new Date().getTime());
// console.log('sessionId',isReload); // console.log('sessionId',isReload);
// if(isReload){ // if(isReload){
// this.removeLocalStorage('reLoadIndex') // this.removeLocalStorage('reLoadIndex')
...@@ -157,18 +160,8 @@ export default { ...@@ -157,18 +160,8 @@ export default {
// } // }
// }) // })
// } // }
// this.removeLocalStorage('showMydialog1') // let urlObj = JSON.parse(sessionStorage.getItem('URL_PARAM'))
// let urlParam = JSON.parse(sessionStorage.getItem('URL_PARAM')) // // let { sessionId, phone } = this.$store.state
let { sessionId} = this.$store.state
console.log('store------',this.$store.state);
if(sessionId){
equity.getCardInfo().then(res => {
let { code } = res
if (code == 0) {
this.$router.replace({ name: 'equity.index' })
}
})
}
// const ua = navigator.userAgent.toLowerCase() // const ua = navigator.userAgent.toLowerCase()
// let sid = urlObj.sessionId // let sid = urlObj.sessionId
// console.log(sid); // console.log(sid);
...@@ -217,6 +210,14 @@ export default { ...@@ -217,6 +210,14 @@ export default {
}) })
}, },
receive () { receive () {
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "首页",
event_name: "立即领取",
},
});
this.collect(logs);
let { sessionId, phone } = this.$store.state let { sessionId, phone } = this.$store.state
const ua = navigator.userAgent.toLowerCase() const ua = navigator.userAgent.toLowerCase()
if (sessionId) { if (sessionId) {
...@@ -228,14 +229,12 @@ export default { ...@@ -228,14 +229,12 @@ export default {
} }
} }
} }
let [href] = window.location.href.split('/#/') this.$router.push({ name: 'cardRoll.opening'})
let url = `${href}/#/cardRoll/opening?sessionId=${sessionId}`
this.openWindows(url, 'cardRoll.opening')
} else { } else {
this.equityLogin() this.equityLogin()
} }
}, },
jump () { jump (str) {
// let { sessionId } = JSON.parse( // let { sessionId } = JSON.parse(
// sessionStorage.getItem("GL_EQUITY_USER_INFO") // sessionStorage.getItem("GL_EQUITY_USER_INFO")
// ) // )
...@@ -245,6 +244,14 @@ export default { ...@@ -245,6 +244,14 @@ export default {
// let url = `${href}/#/equity/index?sessionId=${sessionId}` // let url = `${href}/#/equity/index?sessionId=${sessionId}`
// this.openWindows(url, 'equity.index'); // this.openWindows(url, 'equity.index');
this.$router.replace({ name: 'equity.index' }) this.$router.replace({ name: 'equity.index' })
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "营销页",
event_name:str===1?'我知道了':'查看更多特权'
},
});
this.collect(logs);
} }
} }
} }
...@@ -255,6 +262,7 @@ export default { ...@@ -255,6 +262,7 @@ export default {
// } // }
.main.marketing_page{ .main.marketing_page{
width: auto;
background-color: #FEFAED; background-color: #FEFAED;
padding: 10px; padding: 10px;
color: #2c2c2c; color: #2c2c2c;
...@@ -343,7 +351,7 @@ export default { ...@@ -343,7 +351,7 @@ export default {
text-align: center; text-align: center;
font-size: 20px; font-size: 20px;
background-image: radial-gradient(86% 95%, #5E5E5E 0%, #2F2F2F 100%); background-image: radial-gradient(86% 95%, #5E5E5E 0%, #2F2F2F 100%);
margin: 0 -10px -10px; margin-bottom: 10px;
} }
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -149,6 +149,7 @@ export default { ...@@ -149,6 +149,7 @@ export default {
tel: "", tel: "",
sms: "", sms: "",
countDown: false, countDown: false,
countNum: 0,
countKey: new Date().getTime(), countKey: new Date().getTime(),
showReSend:false showReSend:false
}; };
...@@ -244,6 +245,7 @@ export default { ...@@ -244,6 +245,7 @@ export default {
}) })
.then((res) => { .then((res) => {
if (res) { if (res) {
this.countNum++
let { code, message } = res; let { code, message } = res;
if (code != 0) { if (code != 0) {
this.showToast(message); this.showToast(message);
...@@ -278,7 +280,8 @@ export default { ...@@ -278,7 +280,8 @@ export default {
this.showToast("请填写正确的手机号"); this.showToast("请填写正确的手机号");
return; return;
} }
this.showLoading("登陆中..."); this.toCreateTrack('login','登录',{ mobile: tel, code: sms, count: this.countNum})
this.showLoading("登录中...");
common common
.smsLogin({ .smsLogin({
mobile: tel, mobile: tel,
...@@ -289,10 +292,13 @@ export default { ...@@ -289,10 +292,13 @@ export default {
if (res) { if (res) {
let { code, data, message } = res; let { code, data, message } = res;
if (code == 0) { if (code == 0) {
sessionStorage.setItem("GL_EQUITY_USER_INFO",JSON.stringify(data)); this.loginBuried(data)
sessionStorage.setItem("CODE_PAST_DUE",false); this.toCreateTrack('login_out_event','登录成功',data)
sessionStorage.setItem(
"GL_EQUITY_USER_INFO",
JSON.stringify(data)
);
this.$store.commit("setUserInfo", data); this.$store.commit("setUserInfo", data);
// window.vm.$router.replace({ name: 'equity.index' });
let flag = window.location.href.indexOf('/#/') let flag = window.location.href.indexOf('/#/')
if(flag!=-1){ if(flag!=-1){
window.location.href = `${window.location.href.split('/#/')[0]}/#/equity/index` window.location.href = `${window.location.href.split('/#/')[0]}/#/equity/index`
...@@ -300,11 +306,63 @@ export default { ...@@ -300,11 +306,63 @@ export default {
window.location.href = `${window.location.href.split('?')[0]}#/equity/index` window.location.href = `${window.location.href.split('?')[0]}#/equity/index`
} }
} else { } else {
this.toCreateTrack('login_out_event','登录失败',{message})
this.showToast(message); this.showToast(message);
} }
} }
}); });
}, },
loginBuried(data) {
let project_id = process.env.VUE_APP_PROJECR_VERSION;
let secret = process.env.VUE_APP_PROJECR_SECRET;
let client_id = '';
let user_id = data.phone;
window.vm.track.setCommonConfig({ project_id, secret, client_id, user_id })
const ua = navigator.userAgent.toLowerCase();
let terminal;
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
terminal = 'h5'
} else {
if (window.vm.checkPhoneType() == 'ios') {
terminal = 'ios'
} else {
terminal = 'android'
}
}
let user = JSON.stringify({
"user_id": user_id,
"client_ip": returnCitySN.cip,
"client_id": localStorage['client_id'],
"wx_open_id": data?data.openid:'',
"loc_city": returnCitySN.name,
"loc_province": returnCitySN.name,
"loc_country": '',
"network_carrier": '',
"device_model": '',
"brand": window.vm.getDetect().brand,
"resolution": window.screen.width+'*'+window.screen.height,
"browser_version": window.navigator.appVersion,
"browser": window.vm.getDetect().userAgent,
"os_name": window.vm.getDetect().os_name,
"os_version": window.vm.getDetect().version,
"network_type": window.navigator.connection?window.navigator.connection.effectiveType:'',
"terminal": terminal
})
window.vm.track.getSessionId('/collectdata/login', user,function(){})
},
toCreateTrack(type,name,data){
let logs = window.vm.trackConfig({
event: type,
properties: {
pagename: "登录页",
event_name: name,
extra_data: {
...data
}
},
});
window.vm.track.collect(logs);
},
jump() { jump() {
let { sessionId, phone } = JSON.parse( let { sessionId, phone } = JSON.parse(
sessionStorage.getItem("GL_EQUITY_USER_INFO") sessionStorage.getItem("GL_EQUITY_USER_INFO")
...@@ -312,7 +370,6 @@ export default { ...@@ -312,7 +370,6 @@ export default {
? JSON.parse(sessionStorage.getItem("GL_EQUITY_USER_INFO")) ? JSON.parse(sessionStorage.getItem("GL_EQUITY_USER_INFO"))
: this.$store.state; : this.$store.state;
const ua = navigator.userAgent.toLowerCase(); const ua = navigator.userAgent.toLowerCase();
console.log(sessionId);
if (sessionId) { if (sessionId) {
if (!this.isMiniprogram) { if (!this.isMiniprogram) {
if (ua.match(/MicroMessenger/i) == "micromessenger") { if (ua.match(/MicroMessenger/i) == "micromessenger") {
...@@ -322,7 +379,6 @@ export default { ...@@ -322,7 +379,6 @@ export default {
} }
} }
} }
sessionStorage.setItem("CODE_PAST_DUE",false);
this.$router.replace({ name: "equity.index" }); this.$router.replace({ name: "equity.index" });
} }
}, },
...@@ -340,6 +396,7 @@ export default { ...@@ -340,6 +396,7 @@ export default {
<style scoped lang='scss'> <style scoped lang='scss'>
.main { .main {
width: auto;
background-color: #fefaed; background-color: #fefaed;
padding: 10px; padding: 10px;
color: #2c2c2c; color: #2c2c2c;
......
...@@ -16,9 +16,7 @@ ...@@ -16,9 +16,7 @@
</div> </div>
<div class="info_wrapper"> <div class="info_wrapper">
<div class="user_name"> <div class="user_name">
{{ {{ userInfo.nickName ? userInfo.nickName : userInfo.memberName }}
userInfo.nickName ? userInfo.nickName : userInfo.memberName
}}
</div> </div>
<div v-if="ismember && userInfo.cardNo" style="height: 9px"></div> <div v-if="ismember && userInfo.cardNo" style="height: 9px"></div>
<div class="user_date" v-if="ismember && userInfo.cardNo"> <div class="user_date" v-if="ismember && userInfo.cardNo">
...@@ -32,7 +30,9 @@ ...@@ -32,7 +30,9 @@
<div class="fn_label"> <div class="fn_label">
<span class="fn_label_wrap" @click="jumpOrder">权益订单</span> <span class="fn_label_wrap" @click="jumpOrder">权益订单</span>
<span style="width: 15px"></span> <span style="width: 15px"></span>
<span v-if="isWXEnvironment" class="fn_label_wrap" @click="jumpJiangli">查看奖励</span> <span v-if="isWXEnvironment" class="fn_label_wrap" @click="jumpJiangli"
>查看奖励</span
>
</div> </div>
<div v-if="!ismember" class="open_wrap"> <div v-if="!ismember" class="open_wrap">
<div class="open_icon"></div> <div class="open_icon"></div>
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
</div> </div>
<div class="box_foot_img"></div> <div class="box_foot_img"></div>
</div> </div>
<!-- <div class="card-box"> <!-- <div class="card-box">
<div class="sprite-icon icon-banner"> <div class="sprite-icon icon-banner">
...@@ -91,7 +90,11 @@ ...@@ -91,7 +90,11 @@
</div> </div>
</div> </div>
</div> --> </div> -->
<div v-if="ismember&&isWXEnvironment" class="card-box box_between" style="padding-top: 0"> <div
v-if="ismember && isWXEnvironment"
class="card-box box_between"
style="padding-top: 0"
>
<div class="invite_box invite_bg" @click="jumpInvite"> <div class="invite_box invite_bg" @click="jumpInvite">
<span class="invite_btn">我要分享</span> <span class="invite_btn">我要分享</span>
<p>享推广佣金奖励</p> <p>享推广佣金奖励</p>
...@@ -149,10 +152,10 @@ ...@@ -149,10 +152,10 @@
</div> </div>
</div> </div>
</template> </template>
<script type="text/ecmascript-6">
<script type='text/ecmascript-6'>
import { indexMixin } from "@/mixins"; import { indexMixin } from "@/mixins";
import { equity } from "@r/api.js"; import { equity } from "@r/api.js";
import AMap from "AMap";
// import { Toast } from "vant"; // import { Toast } from "vant";
export default { export default {
name: "index", name: "index",
...@@ -174,12 +177,15 @@ export default { ...@@ -174,12 +177,15 @@ export default {
}, },
mixins: [indexMixin], mixins: [indexMixin],
mounted() { mounted() {
this.tabHideShow(1);
window.webkit.messageHandlers.jumpNativeApp.postMessage(JSON.stringify({type:2,show:1}))
console.log("更新页面时间:", new Date().format("hh:mm:ss")); console.log("更新页面时间:", new Date().format("hh:mm:ss"));
const ua = navigator.userAgent.toLowerCase(); const ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger"){ if (ua.match(/MicroMessenger/i) == "micromessenger"){
this.isWXEnvironment = true this.isWXEnvironment = true
}else{ }else{
this.isWXEnvironment = false this.isWXEnvironment = false
this.getMapLocation();
} }
// 标记已受过权,状态变为false,下次领取页需要重新授权 // 标记已受过权,状态变为false,下次领取页需要重新授权
this.setLocalStorage("codeAuth", false); this.setLocalStorage("codeAuth", false);
...@@ -196,6 +202,31 @@ export default { ...@@ -196,6 +202,31 @@ export default {
} }
}, },
methods: { methods: {
getMapLocation() {
let self = this;
AMap.plugin("AMap.Geolocation", function () {
var geolocation = new AMap.Geolocation({
enableHighAccuracy: true, //是否使用高精度定位,默认:true
timeout: 10000, //超过10秒后停止定位,默认:5s
buttonPosition: "RB", //定位按钮的停靠位置
buttonOffset: new AMap.Pixel(10, 20), //定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
zoomToAccuracy: false, //定位成功后是否自动调整地图视野到定位点
});
geolocation.getCurrentPosition(function (status, result) {
if (status == "complete") {
self.addressInfo = {
longitude: result.position.lng,
latitude: result.position.lat,
address: result.formattedAddress,
cityCode: result.addressComponent.adcode,
};
}
});
});
},
collect(logs) {
window.vm.track.collect(logs);
},
//获取分享链接 //获取分享链接
getShareInfoUrl() { getShareInfoUrl() {
const urlObj = JSON.parse(sessionStorage.getItem("URL_PARAM")); const urlObj = JSON.parse(sessionStorage.getItem("URL_PARAM"));
...@@ -252,9 +283,11 @@ export default { ...@@ -252,9 +283,11 @@ export default {
data.time = new Date(data.validitDate).format("yyyy-MM-dd"); data.time = new Date(data.validitDate).format("yyyy-MM-dd");
this.userInfo = data; this.userInfo = data;
this.ismember = true; this.ismember = true;
localStorage.setItem('isVip',1)
} else { } else {
this.ismember = false; this.ismember = false;
this.isOpen = 0; this.isOpen = 0;
localStorage.setItem('isVip',0)
} }
// 重新获取头像,避免头像拿不到 // 重新获取头像,避免头像拿不到
//app那边可能拿不到头像---写这个重新获取一下 //app那边可能拿不到头像---写这个重新获取一下
...@@ -273,7 +306,16 @@ export default { ...@@ -273,7 +306,16 @@ export default {
"续费开通", "续费开通",
"不用了", "不用了",
this.jumpOpenEquity, this.jumpOpenEquity,
() => {} () => {
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益首页",
event_name:'不用了'
},
});
this.collect(logs);
}
); );
} }
} }
...@@ -416,17 +458,30 @@ export default { ...@@ -416,17 +458,30 @@ export default {
}, },
followAccount() { followAccount() {
window.location.href = window.$baseConfig.axios.VUE_APP_WECHAT_ACCOUNT; window.location.href = window.$baseConfig.axios.VUE_APP_WECHAT_ACCOUNT;
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益首页",
event_name:'关注用户'
},
});
this.collect(logs);
}, },
jumpHotel() { jumpHotel() {
let url = "http://m.s11.cn/tehui/sz/?order_cust_id=4892038"; let url = "http://m.s11.cn/tehui/sz/?order_cust_id=4892038";
this.openWindows(url); this.openWindows(url);
}, },
jumpOrder() { jumpOrder() {
let { sessionId } = this.$store.state; this.tabHideShow(0);
let [href] = window.location.href.split("/#/"); this.$router.push({ name: 'cardRoll.index'})
let url = `${href}/#/cardRoll/index?sessionId=${sessionId}`; let logs = window.vm.trackConfig({
console.log(url); event: "click_event",
this.openWindows(url, "cardRoll.index"); properties: {
pagename: "权益首页",
event_name:'权益订单'
},
});
this.collect(logs);
}, },
jumpOpenShop() { jumpOpenShop() {
this.openWindows("https://www.wjx.cn/m/89882107.aspx"); this.openWindows("https://www.wjx.cn/m/89882107.aspx");
...@@ -437,6 +492,14 @@ export default { ...@@ -437,6 +492,14 @@ export default {
} else { } else {
this.showToast("尚未配置活动参数"); this.showToast("尚未配置活动参数");
} }
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益首页",
event_name:'查看奖励'
},
});
this.collect(logs);
}, },
jumpInvite() { jumpInvite() {
if (this.inviteUrl) { if (this.inviteUrl) {
...@@ -444,28 +507,46 @@ export default { ...@@ -444,28 +507,46 @@ export default {
} else { } else {
this.showToast("尚未配置活动参数"); this.showToast("尚未配置活动参数");
} }
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益首页",
event_name:'分享好友'
},
});
this.collect(logs);
}, },
willComeDialog() { willComeDialog() {
this.showToast("即将上线,敬请期待"); this.showToast("即将上线,敬请期待");
}, },
jumpOpenEquity() { jumpOpenEquity() {
// let { sessionId } = this.$store.state; this.tabHideShow(0);
// if(sessionId){ this.$router.push({ name: 'cardRoll.opening'})
// window.vm.$router.push({ name: 'cardRoll.opening',query: {payStatus:1} }) this.setLocalStorage('whereInOpen','index')
// }else{ let logs = window.vm.trackConfig({
// this.equityLogin(); event: "click_event",
// } properties: {
let { sessionId } = this.$store.state; pagename: "权益首页",
let [href] = window.location.href.split("/#/"); event_name:'开通'
let url = `${href}/#/cardRoll/opening?sessionId=${sessionId}`;
this.openWindows(url, "cardRoll.opening");
this.setLocalStorage("whereInOpen", "index");
}, },
});
this.collect(logs);
},
tabHideShow(status) {
const ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) != "micromessenger") {
if (this.checkPhoneType() == 'ios') {
window.webkit.messageHandlers.jumpNativeApp.postMessage(JSON.stringify({type:2,show:status}))
} else {
window.myjs.jumpNativeApp.postMessage(JSON.stringify({type:2,show:status}))
}
}
}
}, },
}; };
</script> </script>
<style lang="scss">
<style lang='scss'>
@import "@a/scss/index.scss"; @import "@a/scss/index.scss";
html, html,
body { body {
...@@ -864,7 +945,6 @@ body { ...@@ -864,7 +945,6 @@ body {
} }
} }
} }
&.box_between { &.box_between {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
...@@ -872,7 +952,6 @@ body { ...@@ -872,7 +952,6 @@ body {
} }
} }
} }
.tab_content { .tab_content {
padding: 10px; padding: 10px;
.icon-goods { .icon-goods {
...@@ -881,7 +960,6 @@ body { ...@@ -881,7 +960,6 @@ body {
margin-bottom: 4px; margin-bottom: 4px;
} }
} }
.content .box { .content .box {
&.equity_box { &.equity_box {
margin-bottom: 10px; margin-bottom: 10px;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</div> </div>
<div <div
class="phone btn" class="phone btn"
@click="makePhoneCall('4008060999')" @click="toCall()"
> >
<div class="sprite-icon icon-equity-phone"></div> <div class="sprite-icon icon-equity-phone"></div>
电话咨询 电话咨询
...@@ -49,6 +49,18 @@ export default { ...@@ -49,6 +49,18 @@ export default {
mounted () { mounted () {
}, },
methods: { methods: {
toCall(){
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "道路救援",
event_name:'拨打电话',
phone:'4008060999'
},
});
window.vm.track.collect(logs);
this.makePhoneCall('4008060999')
}
} }
} }
</script> </script>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="main"> <div class="main">
<div class="box" id="mapContainer"> <div class="box" id="mapContainer">
<div class="de-header"> <div class="de-header">
<img :src="detailInfo.gasLogoBig" alt="" /> <img v-lazy="detailInfo.gasLogoBig" alt="" />
</div> </div>
<div class="box-detail"> <div class="box-detail">
<div class="de-desc"> <div class="de-desc">
...@@ -87,8 +87,6 @@ export default { ...@@ -87,8 +87,6 @@ export default {
}; };
}, },
mounted() { mounted() {
const ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
let { oilId, oilNo, longitude, latitude, distance } = this.$route.query; let { oilId, oilNo, longitude, latitude, distance } = this.$route.query;
this.oilId = oilId; this.oilId = oilId;
this.oilNo = oilNo; this.oilNo = oilNo;
...@@ -96,15 +94,6 @@ export default { ...@@ -96,15 +94,6 @@ export default {
this.longitude = longitude; this.longitude = longitude;
this.latitude = latitude; this.latitude = latitude;
this.distance = distance; this.distance = distance;
} else {
let { oilId, oilNo, longitude, latitude, distance } = this.$store.state;
this.oilId = oilId;
this.oilNo = oilNo;
this.oilSnoi = oilNo;
this.longitude = longitude;
this.latitude = latitude;
this.distance = distance;
}
this.getOilDetail(); this.getOilDetail();
this.getCardInfo(); this.getCardInfo();
}, },
...@@ -114,13 +103,20 @@ export default { ...@@ -114,13 +103,20 @@ export default {
name: "cardRoll.opening", name: "cardRoll.opening",
query: { payStatus: 1 }, query: { payStatus: 1 },
}); });
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "开通权益",
},
});
this.collect(logs);
}, },
getCardInfo() { getCardInfo() {
equity.getCardInfo().then((res) => { equity.getCardInfo().then((res) => {
let { code, data } = res; let { code } = res;
if (code == 0 && data) { if (code == 0) {
this.isOpen = 1; this.isOpen = 1;
} else { } else {
this.isOpen = 0; this.isOpen = 0;
} }
...@@ -140,12 +136,15 @@ export default { ...@@ -140,12 +136,15 @@ export default {
this.detailInfo = data; this.detailInfo = data;
this.gunNos = data.gunNos; this.gunNos = data.gunNos;
this.equityOilNoDTOList = data.equityOilNoDTOList; this.equityOilNoDTOList = data.equityOilNoDTOList;
// let img = new Image();
// img.src = data.gasLogoBig;
// img.onload = ()=> {
// this.hideLoading();
// }
} else { } else {
this.showToast(message); this.showToast(message);
} }
setTimeout(()=>{
this.hideLoading(); this.hideLoading();
},1000)
}); });
}, },
openLocation(val) { openLocation(val) {
...@@ -160,13 +159,21 @@ export default { ...@@ -160,13 +159,21 @@ export default {
).then((res) => { ).then((res) => {
console.log(res); console.log(res);
}); });
}else{ }else {
if (this.checkPhoneType() == 'ios') { if (this.checkPhoneType() == 'ios') {
window.webkit.messageHandlers.jumpNativeApp.postMessage(JSON.stringify({type: 8,address:val.gasAddress,latitude:Number(val.gasAddressLatitude),longitude:Number(val.gasAddressLongitude)})) window.webkit.messageHandlers.jumpNativeApp.postMessage(JSON.stringify({ type: 8,address:val.gasAddress,latitude:Number(val.gasAddressLatitude),longitude:Number(val.gasAddressLongitude)}))
} else { } else {
window.myjs.jumpNativeApp(JSON.stringify({type: 8,address:val.gasAddress,latitude:Number(val.gasAddressLatitude),longitude:Number(val.gasAddressLongitude)})) window.myjs.jumpNativeApp(JSON.stringify({ type: 8,address:val.gasAddress,latitude:Number(val.gasAddressLatitude),longitude:Number(val.gasAddressLongitude)}))
} }
} }
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "导航",
},
});
this.collect(logs);
}, },
changeOilSno(item) { changeOilSno(item) {
if (this.oilSnoi == item) { if (this.oilSnoi == item) {
...@@ -176,9 +183,27 @@ export default { ...@@ -176,9 +183,27 @@ export default {
this.oilNo = item; this.oilNo = item;
this.oilSuni = null; this.oilSuni = null;
this.getOilDetail(); this.getOilDetail();
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "选择油号",
oilNo: item,
},
});
this.collect(logs);
}, },
changeOilSun(item) { changeOilSun(item) {
this.oilSuni = item; this.oilSuni = item;
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "选择油枪",
oilSuni: item,
},
});
this.collect(logs);
}, },
oilPay() { oilPay() {
let { oilId } = this.$route.query; let { oilId } = this.$route.query;
...@@ -195,6 +220,27 @@ export default { ...@@ -195,6 +220,27 @@ export default {
oilNo: this.oilSnoi, oilNo: this.oilSnoi,
gunNo: this.oilSuni, gunNo: this.oilSuni,
}; };
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "下一步",
extra_data: {
gasName: this.detailInfo.gasName,
gasId: this.detailInfo.id,
gasAddress: this.detailInfo.gasAddress,
gasAddressLatitude: this.detailInfo.gasAddressLatitude,
gasAddressLongitude: this.detailInfo.gasAddressLongitude,
gasLogoBig: this.detailInfo.gasLogoBig,
priceOfficial: this.detailInfo.priceOfficial,
priceYfq: this.detailInfo.priceYfq,
priceReduced: this.detailInfo.priceReduced,
oilNo: this.oilSnoi,
gunNo: this.oilSuni,
},
},
});
this.collect(logs);
this.showLoading(); this.showLoading();
let jumpUrl; let jumpUrl;
const ua = navigator.userAgent.toLowerCase(); const ua = navigator.userAgent.toLowerCase();
...@@ -204,7 +250,6 @@ export default { ...@@ -204,7 +250,6 @@ export default {
jumpUrl = "getStationAppPayUrl"; jumpUrl = "getStationAppPayUrl";
} }
oilStation[jumpUrl](para).then((res) => { oilStation[jumpUrl](para).then((res) => {
console.log(res, "加油站");
this.hideLoading(); this.hideLoading();
let { code, data, message } = res; let { code, data, message } = res;
if (code == 0) { if (code == 0) {
...@@ -214,6 +259,10 @@ export default { ...@@ -214,6 +259,10 @@ export default {
} }
}); });
}, },
//埋点
collect(logs) {
window.vm.track.collect(logs);
},
}, },
}; };
</script> </script>
......
...@@ -74,8 +74,18 @@ export default { ...@@ -74,8 +74,18 @@ export default {
mounted() { mounted() {
this.getRecord(); this.getRecord();
this.handleLocation(); this.handleLocation();
this.listeningBack();
}, },
methods: { methods: {
listeningBack() {
const path = window.vm.$store.state.prevPath;
window.onpopstate = null;
window.onpopstate = function () {
window.onpopstate = null;
history.pushState({}, null, window.location.href);
window.vm.$router.replace({ name: "oilStation.index" });
};
},
getRecord() { getRecord() {
oilStation.getStationSearchList().then(res => { oilStation.getStationSearchList().then(res => {
this.hideLoading() this.hideLoading()
...@@ -88,6 +98,14 @@ export default { ...@@ -88,6 +98,14 @@ export default {
}) })
}, },
clearEmpty() { clearEmpty() {
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "清空搜索记录",
},
});
this.collect(logs);
oilStation.getStationSearchDeleteAll().then(res => { oilStation.getStationSearchDeleteAll().then(res => {
this.hideLoading() this.hideLoading()
let { code, message } = res let { code, message } = res
...@@ -102,6 +120,15 @@ export default { ...@@ -102,6 +120,15 @@ export default {
let para = { let para = {
id: index id: index
} }
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "删除历史记录",
id:index
},
});
this.collect(logs);
oilStation.getStationSearchDelete(para).then(res => { oilStation.getStationSearchDelete(para).then(res => {
this.hideLoading() this.hideLoading()
let { code, message } = res let { code, message } = res
...@@ -120,6 +147,14 @@ export default { ...@@ -120,6 +147,14 @@ export default {
}else { }else {
this.getMapLocation(); this.getMapLocation();
} }
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "重新定位",
},
});
this.collect(logs);
}, },
getMapLocation() { getMapLocation() {
let self = this; let self = this;
...@@ -174,17 +209,53 @@ export default { ...@@ -174,17 +209,53 @@ export default {
}, },
onCancel() { onCancel() {
this.localStatus = true; this.localStatus = true;
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "取消搜索",
search:this.input
},
});
this.collect(logs);
}, },
onSearch(){ onSearch(){
this.localStatus = false; this.localStatus = false;
this.$refs.maps.onSearch(); this.$refs.maps.onSearch();
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "搜索",
search:this.input
},
});
this.collect(logs);
}, },
selectItem(val) { selectItem(val) {
this.$store.commit('setAddress',val) this.$store.commit('setAddress',val)
window.vm.$router.push({ path: '/oilStation/index'}) window.vm.$router.replace({ path: '/oilStation/index'})
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "选择地址",
address:val
},
});
this.collect(logs);
}, },
selectAddress() { selectAddress() {
window.vm.$router.push({ path: '/oilStation/index'}) window.vm.$router.replace({ path: '/oilStation/index'})
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "当前定位",
address:this.addressInfo.address
},
});
this.collect(logs);
}, },
selectLocation(value) { selectLocation(value) {
let para = { let para = {
...@@ -192,17 +263,30 @@ export default { ...@@ -192,17 +263,30 @@ export default {
longitude: value.location.lng, longitude: value.location.lng,
latitude: value.location.lat, latitude: value.location.lat,
} }
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "选择地点",
...para
},
});
this.collect(logs);
oilStation.getStationSearchInsert(para).then(res => { oilStation.getStationSearchInsert(para).then(res => {
this.hideLoading() this.hideLoading()
let { code, message } = res let { code, message } = res
if (code == 0) { if (code == 0) {
this.$store.commit('setAddress',para) this.$store.commit('setAddress',para)
window.vm.$router.push({ path: '/oilStation/index'}) window.vm.$router.replace({ path: '/oilStation/index'})
} else { } else {
this.showToast(message) this.showToast(message)
} }
}) })
} },
//埋点
collect(logs) {
window.vm.track.collect(logs);
},
} }
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!