Commit f82d9bca by ym

埋点

1 parent 75028add
VUE_APP_REPO=https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config
\ No newline at end of file
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
......@@ -3,14 +3,11 @@
VUE_APP_TITLE=广联运营平台
# 网络请求公用地址
#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=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://192.168.2.60:8086/rop-ddh-carlife/router
#VUE_APP_KEY=48e5e13229b82c1b4e6e8c96151f0637
#VUE_APP_SECRET=c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b
VUE_APP_KEY=036cc0e0fe316483238287e5721df4c3
VUE_APP_SECRET=c7290f606d6b4e9aaf6da3ad6310e883fe316483238287e5
VUE_APP_KEY=48e5e13229b82c1b4e6e8c96151f0637
VUE_APP_SECRET=c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b
......@@ -3,7 +3,12 @@ module.exports = {
env: {
node: true
},
globals: { wx: true },
globals: {
wx: true,
'returnCitySN': true ,
'MobileDetect': true,
'track': true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended'
......
This diff could not be displayed because it is too large.
......@@ -10,6 +10,7 @@
"dependencies": {
"axios": "^0.21.0",
"core-js": "^3.6.5",
"js-md5": "^0.7.3",
"sha1": "^1.1.1",
"vant": "^2.10.11",
"vconsole": "^3.4.0",
......
......@@ -19,8 +19,11 @@
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="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://webapi.amap.com/maps?v=1.4.8&key=bd290dc27d0945959280753215ddda71&plugin=AMap.Geocoder"></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>
</head>
......
<template>
<div id="app">
<template v-if="$route.meta.showNavBar && !isMiniprogram">
<template v-if="$route.meta.showNavBar && !isMiniprogram && showNavBar">
<div class="nav-bar">
<van-nav-bar
safe-area-inset-top
:title="$route.meta.title"
left-arrow
:fixed='true'
@click-left="onClickLeft"
/>
</div>
</template>
<div>
<transition name="fade">
<keep-alive>
<router-view
v-if="$route.meta.keepAlive"
class="main-box"
:class="{'app-box': showNavBar && $route.meta.showNavBar}"
v-wechat-title="$route.meta.title"
/>
</keep-alive>
</transition>
<transition name="fade">
<router-view
class="main-box"
:class="{'app-box': showNavBar && $route.meta.showNavBar}"
v-wechat-title="$route.meta.title"
v-if="!$route.meta.keepAlive"
/>
</transition>
</div>
</div>
</template>
<script>
// import VConsole from 'vconsole'
export default {
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: {},
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() {
// window.vConsole = new VConsole()
//解决ios下history.back后不刷新
this.handleScroll();
var isPageHide = false;
window.addEventListener("pageshow", function() {
window.addEventListener("pageshow", function () {
if (isPageHide) {
window.location.reload();
}
});
window.addEventListener("pagehide", function() {
window.addEventListener("pagehide", function () {
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>
......@@ -57,4 +136,31 @@ export default {
#app {
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>
......@@ -47,8 +47,19 @@ service.interceptors.response.use(
} else {
const ua = navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
sessionStorage.setItem("CODE_PAST_DUE",true);
window.vm.$router.replace({ name: 'common.phoneLogin' })
sessionStorage.setItem(
"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 {
let equipmentType = ""
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 @@
margin: 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 {
width: 100%;
height: 100%;
......
......@@ -9,27 +9,88 @@ import '@a/scss/common.scss'
import store from "./store"
import axios from 'axios'
Vue.use(VueWechatTitle)
import { Lazyload } from 'vant';
Vue.use(Lazyload);
Vue.use(Vant)
// import VConsole from 'vconsole'
// const vConsole = new VConsole()
// Vue.use(vConsole)
import preview from 'vue-photo-preview'
import 'vue-photo-preview/dist/skin.css'
import VConsole from 'vconsole'
const vConsole = new VConsole()
Vue.use(vConsole)
Vue.use(preview)
Vue.config.productionTip = false
Vue.prototype.isMiniprogram = window.__wxjs_environment === 'miniprogram'
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)
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'
}
}).$mount('#app')
})
\ No newline at end of file
}
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',
method: 'get'
}).then(({
data: config
}) => {
window.$baseConfig = config
window.vm = new Vue({
router,
store,
render: h => {
return h(App)
}
}).$mount('#app')
})
}
......@@ -17,23 +17,23 @@ export default {
description: '7折起',
id: 54
},
{
name: '道路救援',
icon: 'jiuyuan',
description: '非事故免费',
route: 'road'
},
{
name: '道路救援',
icon: 'jiuyuan',
description: '非事故免费',
route: 'road'
},
],
hotelList: [{
name: '今日特惠',
icon: 'today',
description: '超性价比'
},
{
name: '景区门票',
icon: 'tickets',
description: '全国3000+景点'
}
{
name: '景区门票',
icon: 'tickets',
description: '全国3000+景点'
}
],
cateringList2: [{
name: '肯德基',
......@@ -41,35 +41,35 @@ export default {
description: '最高省81元',
typeId: 23
},
{
name: '麦当劳',
icon: 'm',
description: '最高省44元',
typeId: 64
},
{
name: '星巴克',
icon: 'xbk',
description: '最高省17元',
typeId: 21
},
{
name: '瑞幸咖啡',
icon: 'ruixing',
description: '最高省10元',
typeId: 148
}
{
name: '麦当劳',
icon: 'm',
description: '最高省44元',
typeId: 64
},
{
name: '星巴克',
icon: 'xbk',
description: '最高省17元',
typeId: 21
},
{
name: '瑞幸咖啡',
icon: 'ruixing',
description: '最高省10元',
typeId: 148
}
],
gasList: [{
name: '覆盖城市',
icon: 'city',
subIcon: '400'
},
{
name: '加油站',
icon: 'gas',
subIcon: '10000'
}
{
name: '加油站',
icon: 'gas',
subIcon: '10000'
}
],
...shopList
}
......@@ -98,35 +98,27 @@ export default {
this.setNoticeInfo()
},
CarLink(e) {
let {sessionId} = this.$store.state;
let [href] = window.location.href.split('/#/');
let url;
this.tabHideShow(0);
let supplier = e.supplier;
sessionStorage.setItem('common',this.icon?1:0)
switch(supplier) {
sessionStorage.setItem('common', this.icon ? 1 : 0)
switch (supplier) {
case 'GL_OIL':
url = `${href}/#/oilStation/index?sessionId=${sessionId}`
this.openWindows(url, 'oilStation.index')
this.$router.push({ name:'oilStation.index' })
break;
case 'GL_ROAD_RESCUE':
url = `${href}/#/equity/road`
this.openWindows(url, 'equity.road')
this.$router.push({ name:'equity.road'})
break;
case 'GL_TIRE_PROTECTION':
url = `${href}/#/equity/tyre`
this.openWindows(url, 'equity.tyre')
this.$router.push({ name:'equity.tyre'})
break;
case 'GL_ROBBERY_PROTECTION':
url = `${href}/#/equity/compensate`
this.openWindows(url, 'equity.compensate')
this.$router.push({ name:'equity.compensate'})
break;
case 'GL_COLLISION_REPAIR':
url = `${href}/#/equity/collision`
this.openWindows(url, 'equity.collision')
this.$router.push({ name:'equity.collision'})
break;
case 'GL_CAR_TOTAL_LOSS':
url = `${href}/#/equity/loss`
this.openWindows(url, 'equity.loss')
this.$router.push({ name:'equity.loss'})
break;
case 'EDJ':
this.jumpDEJ();
......@@ -134,15 +126,23 @@ export default {
default:
this.showToast('即将上线,敬请期待')
}
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益首页",
event_name: e.equityName,
},
});
window.vm.track.collect(logs);
},
jumpDEJ() {
let {sessionId} = this.$store.state;
let { sessionId } = this.$store.state;
let para = {
sessionId
}
equity.getEdjUrl(para).then(res => {
let {code, data, message} = res
if (code == 0){
let { code, data, message } = res
if (code == 0) {
this.openWindows(data)
} else {
this.showToast(message)
......@@ -150,18 +150,29 @@ export default {
})
},
jumpLink(e) {
let { sessionId } = this.$store.state;
this.$store.commit('setGoodsInfo',e);
let {brandId,supplier,brandName} = e;
if(e.appearance == 1) {
let [href] = window.location.href.split('/#/');
let url = `${href}/#/commodity/business?sessionId=${sessionId}&brandId=${brandId}&supplier=${supplier}&brandName=${brandName}`;
this.openWindows(url, 'commodity.business')
}else {
let [href] = window.location.href.split('/#/');
let url = `${href}/#/commodity/recharge?sessionId=${sessionId}&brandId=${brandId}&supplier=${supplier}&brandName=${brandName}`;
this.openWindows(url, 'commodity.recharge')
this.tabHideShow(0);
this.$store.commit('setGoodsInfo', e);
if (e.appearance == 1) {
this.$router.push({ name:'commodity.business' })
} else {
this.$router.push({ name:'commodity.recharge' })
}
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
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() {
this.carServiceList = []
......@@ -169,8 +180,8 @@ export default {
merchantId: this.merchantId
}
equity.getMerchantid(para).then(res => {
let {code, data, message} = res
if (code == 0){
let { code, data, message } = res
if (code == 0) {
this.carServiceList = data.carServiceList
this.goodsServiceList = data.goodsServiceList;
this.equityGoodsGroupDescDtos = this.goodsServiceList[0].equityGoodsGroupDescDtos;
......@@ -182,6 +193,14 @@ export default {
changeGoods(item) {
this.goodsTab = item;
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() {
equity.getCouponList({
......
import WxConfig from '@u/WxConfig'
import {commodity} from "@r/api";
import { commodity } from "@r/api";
const WX = new WxConfig(['chooseWXPay']);
export default {
data() {
......@@ -17,14 +17,28 @@ export default {
},
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();
let {sessionId} = this.$store.state;
let { sessionId } = this.$store.state;
let orderCode = await commodity.getOrderCode({
sessionId,
supplier: this.supplier,
brandId: this.brandId
}).then(res => {
let {code, data, message} = res
let { code, data, message } = res
if (code == 0) {
return data;
} else {
......@@ -35,8 +49,8 @@ export default {
const ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
payMannerId = 4;
}else {
payMannerId = 5; // 7
} else {
payMannerId = 7; // 5
}
let para = {
orderCode,
......@@ -48,7 +62,7 @@ export default {
}
let payData = await commodity.payOrder(para).then(res => {
this.hideLoading()
let {code, data, message} = res
let { code, data, message } = res
if (code == 0) {
return data;
} else {
......@@ -56,7 +70,7 @@ export default {
}
})
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
this.handlePay(payData);
this.handlePay(payData,orderCode);
} else {
if (this.checkPhoneType() == 'ios') {
if (window["payWebOrder"] && typeof window.payWebOrder === "function") {
......@@ -68,8 +82,8 @@ export default {
window.myjs.payWebOrder("wxpay", JSON.stringify(payData));
}
let self = this;
window.onMessageFromPayBack = function(result) {
if(result == 0) {
window.onMessageFromPayBack = function (result) {
if (result == 0) {
if (self.appearance == 2) {
let productName = self.brandName + self.businessList[self.typeSno].productName + self.denomination.denomination
window.vm.$router.push({
......@@ -79,30 +93,75 @@ export default {
}
})
} 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 {
window.vm.showToast(result==-1?'支付失败':'取消支付')
self.payCollect(orderCode,1);
} else {
self.payCollect(orderCode,0);
window.vm.showToast(result == -1 ? '支付失败' : '取消支付')
}
}
}
},
handlePay(payData) {
const {timeStamp, nonceStr, packages, signType, paySign} = payData;
handlePay(payData,orderCode) {
const { timeStamp, nonceStr, packages, signType, paySign } = payData;
WX.chooseWXPay(timeStamp, nonceStr, packages, signType, paySign).then(res => {
console.log(res)
if (this.appearance == 2) {
let productName = this.brandName + this.businessList[this.typeSno].productName + this.denomination.denomination
window.vm.$router.push({
name: 'commodity.process', query: {
rechargeNumber: this.rechargeNumber,
productName
}
})
} else {
window.vm.$router.replace({name: 'commodity.success', query: {price:this.isOpen || !this.selectData.noMemberPrice? this.selectData.salesPrice:this.selectData.noMemberPrice}})
if(res) {
this.payCollect(orderCode,1);
if (this.appearance == 2) {
let productName = this.brandName + this.businessList[this.typeSno].productName + this.denomination.denomination
window.vm.$router.push({
name: 'commodity.process', query: {
rechargeNumber: this.rechargeNumber,
productName
}
})
} else {
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 {
Notify
} from 'vant'
import store from '@/store'
import { common,equity } from '../api/api'
import { common, equity } from '../api/api'
Vue.use(VueRouter)
const router = new VueRouter({
routes,
......@@ -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) => {
routerBuried(to,from)
let { meta: { authBase } } = to
store.commit('findPrevPath', from.name)
if (to.name != 'common.phoneLogin') store.commit('jumpPath', to.name)
const params = getParams(window.location.href);
if (params.appId) sessionStorage.setItem('GL_WX_APPID', params.appId)
if (params.merchantId){
store.commit('setMerchantId',params.merchantId)
if (params.merchantId) {
store.commit('setMerchantId', params.merchantId)
sessionStorage.setItem('GL_WX_MERCHANTID', params.merchantId)
}
window.onMessageFromLoginBack = (type, userId, sessionId) => {
console.log('onMessageFromLoginBack', type, userId, sessionId)
if (type == 0) {
getSessionAppId(sessionId,true);
getSessionAppId(sessionId, true);
} else {
store.commit('clearSessionId')
next()
......@@ -57,9 +72,13 @@ router.beforeEach((to, from, next) => {
}
return
} else {
setUserInfo(params)
getSessionAppId(params.sessionId)
next()
if(to.name == 'common.marketing' && params.sessionId) {
getSessionAppId(params.sessionId,false,next)
}else {
setUserInfo(params)
next()
}
}
}
} else {
......@@ -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 => {
let { code, data } = res
if (code == 0) {
/**
* app埋点登录
*/
setUserInfo(data);
if(status) {
loginBuried(data)
if (status) {
store.commit('reload');
}else {//登录后,查询会员信息,如果已经开通过了会员,就直接跳转到会员页面,不走营销也?
} else {
equity.getCardInfo().then(res => {
let { code,data } = res;
if (code == 0&&data) {
router.replace({name: 'equity.index'})
if (code == 0 && data) {
localStorage.setItem('isVip',1)
router.push({ name: 'equity.index' })
}else {
localStorage.setItem('isVip',0)
}
})
}
callback();
}
})
}
......@@ -93,10 +249,12 @@ const getSessionId = (redirectUrl, state) => {
const appId = sessionStorage.getItem('GL_WX_APPID')
common.getSessionId({ code: params.code, state, appId }).then(res => {
if (res) {
let { code, data,message } = res
let { code, data, message } = res
if (code == 0) {
setUserInfo(data)
router.push({name: 'common.phoneLogin'})
/**
* 埋点登录
*/
loginBuried(data)
} else {
Notify({ type: 'danger', message })
}
......
const pages = {
equity: [
{name: 'index'},
{name: 'road', title: '道路救援'},
{name: 'tyre', title: '轮胎保障'},
{name: 'collision', title: '碰撞维修'},
{name: 'compensate', title: '盗抢补偿'},
{name: 'loss', title: '整车全损'},
{name: 'road', title: '道路救援',showNavBar: true},
{name: 'tyre', title: '轮胎保障',showNavBar: true},
{name: 'collision', title: '碰撞维修',showNavBar: true},
{name: 'compensate', title: '盗抢补偿',showNavBar: true},
{name: 'loss', title: '整车全损',showNavBar: true},
],
oilStation: [
{name: 'index'},
{name: 'record', title: '加油记录'},
{name: 'detail', title: '加油站详情'},
{name: 'location', title: '加油站详情'},
{name: 'index',showNavBar: true},
{name: 'record', title: '加油记录',showNavBar: true},
{name: 'detail', title: '加油站详情',showNavBar: true},
{name: 'location', title: '选择位置',showNavBar: true},
],
common: [
{name: 'index'},
{name: 'activate', title: '激活权益'},
{name: 'explain', title: '常见疑问'},
{name: 'activate', title: '激活权益',showNavBar: true},
{name: 'explain', title: '常见疑问',showNavBar: true},
{name: 'phoneLogin', title: '登录',wxAuth: true},
{name: 'nothing'},
{name: 'appTip'},
{name: 'appTip',title: '领取结果'},
{name: 'expcard',title: '体验卡领取'},
{name: 'marketing', wxAuth: true},
],
......@@ -34,48 +34,62 @@ const pages = {
cardRoll: [
{
name: 'index',
title: '我的卡券'
title: '我的卡券',
showNavBar: true
},
{
name: 'detail',
title: '查看卡券'
title: '查看卡券',
showNavBar: true
},
{
name: 'opening',
title: '开通权益'
title: '开通权益',
showNavBar: true
},
{
name: 'salesDetail',
title: '售后详情'
title: '售后详情',
showNavBar: true
},
{
name: 'waiting',
title: '等待处理'
title: '等待处理',
showNavBar: true
},
{
name: 'salesApply',
title: '申请售后'
title: '申请售后',
showNavBar: true
},
{
name: 'agreement',
title: '权益服务协议'
title: '权益服务协议',
showNavBar: true
},
{
name: 'customer',
showNavBar: true
}
],
commodity: [
{
name: 'process',
title: '充值流程',
showNavBar: true
},
{
name: 'recharge',
showNavBar: true
},
{
name: 'success',
title: '支付成功',
showNavBar: true
},
{
name: 'business',
showNavBar: true
},
],
device: [{
......@@ -139,3 +153,4 @@ Object.keys(pages).map(parent => {
})
})
export default routes
......@@ -77,7 +77,7 @@ export default {
router.replace({ name: 'common.marketing' })
},
reload(state) {
console.log(state,'storeRelod方法,已译注');
console.log(state)
// router.replace({ name: 'common.nothing' })
// setTimeout(() => {
// state.lastPath?router.replace({ name: state.lastPath }):router.replace({name: 'equity.index'})
......
......@@ -108,9 +108,11 @@ class WxConfig {
},
fail() {
window.vm.showToast('已取消支付')
resolve()
},
cancel() {
window.vm.showToast('支付失败,请重试')
resolve()
}
})
})
......
......@@ -4,7 +4,7 @@ import { Toast, Dialog } from 'vant'
* 日期格式化
* let time = new Date().format('yyyy-MM-dd hh:mm:ss')
*/
Date.prototype.format = function(fmt) {
Date.prototype.format = function (fmt) {
let o = {
'M+': this.getMonth() + 1, //月份
'd+': this.getDate(), //日
......@@ -26,20 +26,20 @@ Date.prototype.format = function(fmt) {
return fmt
}
const throttle = (fn, gapTime) => {
if (gapTime == null || gapTime == undefined) {
gapTime = 1500
}
let _lastTime = null
return function() {
let _nowTime = +new Date()
if (_nowTime - _lastTime > gapTime || !_lastTime) {
fn.apply(this, arguments)
_lastTime = _nowTime
}
if (gapTime == null || gapTime == undefined) {
gapTime = 1500
}
let _lastTime = null
return function () {
let _nowTime = +new Date()
if (_nowTime - _lastTime > gapTime || !_lastTime) {
fn.apply(this, arguments)
_lastTime = _nowTime
}
}
/**防止重复点击 */
// const noScroll = (e) => { e.preventDefault() }
}
/**防止重复点击 */
// const noScroll = (e) => { e.preventDefault() }
const showLoading = (title = '加载中...') => {
Toast({
type: 'loading',
......@@ -49,10 +49,10 @@ const showLoading = (title = '加载中...') => {
})
}
const hideLoading = () => {
Toast.clear()
}
Toast.clear()
}
/**复制 */
const cloneText = (message)=> {
const cloneText = (message) => {
let input = document.createElement("input");
input.value = message;
document.body.appendChild(input);
......@@ -61,20 +61,20 @@ const cloneText = (message)=> {
document.body.removeChild(input);
Toast('复制成功');
}
/**num:要转换的数值,fixed:精确几位小数 */
/**num:要转换的数值,fixed:精确几位小数 */
const decimal = (num, fixed) => {
let pow = Math.pow(10, fixed)
return Math.round(num * pow) / pow
}
const showToast = (message = '', icon) => {
let params = {
message,
forbidClick: true
}
if (icon) params.icon = icon
Toast(params)
let params = {
message,
forbidClick: true
}
/**触摸样式 */
if (icon) params.icon = icon
Toast(params)
}
/**触摸样式 */
const touchstart = e => {
e.target.classList.add('btn-on-leave')
}
......@@ -126,11 +126,59 @@ const openWindows = (url, name) => {
window.location.href = url
}
} 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 = {
needNavigator: 1,
type: 4,
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') {
window.webkit.messageHandlers.jumpNativeApp.postMessage(JSON.stringify(params))
} else {
......@@ -139,7 +187,7 @@ const openWindows = (url, name) => {
}
}
}
const getParams = str => {
const getParams = str => {
let params = str.split('?')
if (params.length < 2) return {}
let param = params[1].split('&')
......@@ -152,6 +200,34 @@ const getParams = str => {
}
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 = () => {
let source = 3
if (window.__wxjs_environment === 'miniprogram') {
......@@ -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
const myDialog = (message,confirmText,cancelText,comfirmFn,cancelFn)=>{
......@@ -253,6 +397,10 @@ const utils = {
alert,
cloneText,
getParams,
trackConfig,
getDetect,
appHide,
nowTime,
myDialog
}
......
......@@ -8,7 +8,9 @@
<script>
export default {
name: "customer"
name: "customer",
mounted() {
}
}
</script>
......
......@@ -15,23 +15,23 @@
<div class="card-item-style" v-if="detailInfo.cardType == 5">
<div class="card-item-number">
<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 class="card-item-number">
<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-style" v-if="detailInfo.cardType == 3">
<div class="card-item-number">
<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 class="card-item-style" v-if="detailInfo.cardType == 4">
<div class="card-item-number">
<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>
......@@ -68,13 +68,7 @@ export default {
},
mounted() {
this.showLoading();
const ua = navigator.userAgent.toLowerCase();
let orderCode;
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
orderCode = this.$store.state.order.orderCode;
}else {
orderCode = this.$store.state.orderCode;
}
let orderCode = this.$store.state.order.orderCode;
let para = {
orderCode
}
......@@ -90,9 +84,22 @@ export default {
},
methods: {
//复制编码
getClone(value) {
getClone(value,name) {
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>
......
......@@ -137,26 +137,14 @@ export default {
tabStatus,
reStatus,
idx: 1,
isFirst: true,
cardStatus
}
},
mounted() {
this.getCardList();
const ua = navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) != 'micromessenger') {
this.reload();
}
},
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) {
let {sessionId} = this.$store.state;
this.showLoading();
......@@ -177,35 +165,49 @@ export default {
//切换tab
tabClick(name) {
let params = {};
let str
switch(name)
{
case 0:
params = {}
str = '全部'
break;
case 1:
params = {
'statusList[0]': 1,
'statusList[1]': 2,
}
str = '待收货'
break
case 2:
params = {
'statusList[0]': 3,
}
str = '已完成'
break;
case 3:
params = {
'statusList[0]': 5,
'statusList[1]': 6,
}
str = '已退款'
break;
case 4:
params = {
'statusList[0]': 4,
}
str = '售后'
break;
}
this.getCardList(params)
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "我的卡券",
event_name: str,
},
});
this.collect(logs);
},
//确认收货
handleConfirm(val) {
......@@ -219,6 +221,16 @@ export default {
sessionId: this.sessionId,
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 => {
this.hideLoading()
let { code, message } = res
......@@ -253,19 +265,32 @@ export default {
// },
//查看卡券
jumpDetail(val) {
let { sessionId } = this.$store.state;
this.$store.commit('setOrder',val)
let [href] = window.location.href.split('/#/');
let url = `${href}/#/cardRoll/detail?sessionId=${sessionId}&orderCode=${val.orderCode}`;
this.openWindows(url, 'cardRoll.detail')
window.vm.$router.push({ name: 'cardRoll.detail' })
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "我的卡券",
event_name: '查看卡券',
orderCode:val.orderCode,
},
});
this.collect(logs);
},
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) {
let { sessionId } = this.$store.state;
this.$store.commit('setOrder',val)
let [href] = window.location.href.split('/#/');
let url = `${href}/#/cardRoll/salesApply?sessionId=${sessionId}&orderCode=${val.orderCode}&orderPrices=${val.orderPrices}`;
this.openWindows(url, 'cardRoll.salesApply')
window.vm.$router.push({ name: 'cardRoll.salesApply' })
}else {
this.alert({
message: '该卡券无法发起售后,如有其它疑问,请联系购券页面的在线客服进行咨询!',
......@@ -273,11 +298,21 @@ export default {
}
},
jumpSalesDetail(val) {
let { sessionId } = this.$store.state;
this.$store.commit('setOrder',val)
let [href] = window.location.href.split('/#/');
let url = `${href}/#/cardRoll/salesDetail?sessionId=${sessionId}&orderCode=${val.orderCode}`;
this.openWindows(url, 'cardRoll.salesDetail')
window.vm.$router.push({ name: 'cardRoll.salesDetail' })
let logs = window.vm.trackConfig({
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 {
}
},
mounted() {
this.appHide();
this.orderCode = this.$store.state.order.orderCode;
this.orderPrices = this.$store.state.order.orderPrices;
const ua = navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
this.weixinImg = true;
this.orderCode = this.$store.state.order.orderCode;
this.orderPrices = this.$store.state.order.orderPrices;
}else {
this.weixinImg = false;
this.orderCode = this.$store.state.orderCode;
this.orderPrices = this.$store.state.orderPrices;
}
},
methods: {
collect(logs) {
window.vm.track.collect(logs);
},
handleEditPrice() {
this.priceDialog = true;
this.price2 = this.orderPrices;
......@@ -170,6 +173,15 @@ export default {
if (img) {
this.refundImg = img.data;
this.showToast('上传成功')
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "申请售后",
event_name: '图片上传',
image:img.data
},
});
this.collect(logs);
} else {
this.showToast('上传失败')
this.refundImg = '';
......@@ -195,6 +207,15 @@ export default {
refundImg: this.refundImg,
sessionId
}
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "申请售后",
event_name: '提交申请',
...para
},
});
this.collect(logs);
cardRoll.getCardRefund(para).then(res => {
this.hideLoading();
console.log(res)
......
......@@ -52,6 +52,7 @@ export default {
}
},
mounted() {
this.appHide();
const ua = navigator.userAgent.toLowerCase();
let orderCode;
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
......
......@@ -19,6 +19,7 @@ export default {
}
},
mounted() {
this.appHide();
sessionStorage.setItem("need-refresh",1)
},
methods: {
......
......@@ -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">
<van-icon name="checked" class="business-checked" v-if="index == bindex"/>
<div class="business-select-img">
<img :src="item.goodsImage" alt="">
<img v-lazy="item.goodsImage" alt="">
</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>
......@@ -79,7 +79,7 @@
<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"/>
<div class="pop-item-img">
<img :src="item.goodsImage" alt="">
<img v-lazy="item.goodsImage" alt="">
</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>
......@@ -101,7 +101,7 @@ export default {
name: "business",
data() {
return {
isOpen: 0,
isOpen: 1,
appearance: 1,
businessStatus: 2,
bindex: 0,
......@@ -115,23 +115,17 @@ export default {
},
status: true,
supplier: '',
isFirst: true,
isHaveInventory:true,//是否有库存
}
},
mounted() {
this.appHide();
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
this.brandName = goods.brandName;
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();
let para = {
brandName: this.brandName,
......@@ -150,6 +144,20 @@ export default {
})
},
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() {
equity.getCardInfo().then(res => {
let { code,data } = res;
......@@ -161,21 +169,23 @@ export default {
})
},
getCard() {
let { sessionId } = this.$store.state;
let [href] = window.location.href.split('/#/');
let url = `${href}/#/cardRoll/index?sessionId=${sessionId}`;
this.openWindows(url, 'cardRoll.index')
window.vm.$router.push({ name: 'cardRoll.index' })
this.toSetTrackData('我的卡券',{})
},
jumpCustomer() {
this.isFirst = false;
window.vm.$router.push({ name: 'cardRoll.customer' })
this.toSetTrackData('客服',{})
},
jumpOpening() {
window.vm.$router.push({ name: 'cardRoll.opening',query: {payStatus:1} })
this.setLocalStorage('whereInOpen','goods')
this.toSetTrackData('开通权益',{})
},
getMore() {
this.show = true;
this.toSetTrackData('查看更多',{})
},
selectBusiness(item,index){
this.selectData = item;
......@@ -185,6 +195,7 @@ export default {
document.querySelector('.business-select').scrollLeft = document.querySelector(`.select-${index}`).offsetLeft - 10;
}
this.checkInventory(item.id)
this.toSetTrackData('选择商品',item)
},
checkInventory(id){
commodity.getInventory({id}).then(res=>{
......
......@@ -57,6 +57,7 @@ export default {
}
},
mounted() {
this.appHide();
this.rechargeNumber = this.$route.query.rechargeNumber;
this.productName = this.$route.query.productName;
},
......
......@@ -24,22 +24,34 @@ export default {
}
},
mounted() {
this.appHide();
this.price = this.$route.query.price;
},
methods: {
collect(logs) {
window.vm.track.collect(logs);
},
getAgainPay() {
const ua = navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
window.vm.$router.go(-1)
}else {
window.vm.$router.replace({name:'equity.index'})
}
window.vm.$router.go(-1)
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "支付成功",
event_name: '重新购买'
},
});
this.collect(logs);
},
getOrder() {
let { sessionId } = this.$store.state;
let [href] = window.location.href.split('/#/');
let url = `${href}/#/cardRoll/index?sessionId=${sessionId}`;
this.openWindows(url, 'cardRoll.index')
window.vm.$router.push({ name: 'cardRoll.index' })
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "支付成功",
event_name: '查看订单'
},
});
this.collect(logs);
}
}
}
......
......@@ -47,11 +47,28 @@ export default {
},
methods: {
jump () {
let [href] = window.location.href.split('/#/')
let url = `${href}/#/common/explain`
this.openWindows(url, 'common.explain')
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "激活权益",
event_name: "常见疑问",
},
});
window.vm.track.collect(logs);
window.vm.$router.push({ name: 'common.explain' })
},
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
if (!no) return
let target = 'activateBySn'
......@@ -77,16 +94,7 @@ export default {
if (window.__wxjs_environment === 'miniprogram') {
wx.miniProgram.navigateBack()
} else {
const ua = navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
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' }))
}
}
window.vm.$router.push({ name: 'equity.index' })
}
})
} else {
......@@ -100,6 +108,8 @@ export default {
<style scoped lang='scss'>
.main {
width: auto;
height: auto!important;
position: fixed;
top: 50%;
left: 50%;
......
......@@ -35,6 +35,7 @@ export default {
sms: "",
countDown: false,
countKey: new Date().getTime(),
countNum: 0,
day:0
};
},
......@@ -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() {
const params = this.getParams(window.location.href)
const appId = sessionStorage.getItem("GL_WX_APPID")
......@@ -91,6 +143,7 @@ export default {
if(!this.sms){
return
}
this.toCreateTrack('login','免费领取',{ mobile: this.tel, code: this.sms, count: this.countNum})
this.showLoading();
let para = {
mobile: this.tel,
......@@ -108,10 +161,7 @@ export default {
this.hideLoading()
this.setLocalStorage('codeAuth',false)
this.setLocalStorage('bindinfo',res)
if(res.code==-1&&res.errId==4052 || res.code==-1&&res.errId==1010 ||res.code==-1&&res.errId==10016){
this.showToast(res.message)
return
}
this.loginBuried(res.data)
window.location.href = `${window.location.href.split('?')[0]}#/equity/index?pageFrom=expcard`
})
}else{//非微信环境
......@@ -140,6 +190,7 @@ export default {
if(this.countDown){
return
}
this.countNum ++;
this.$store.commit(
"setVerificationCount",
Math.round(new Date() / 1000) + 60
......
......@@ -38,6 +38,7 @@ export default {
.main {
padding: 20px;
color: #2c2c2c;
window: auto;
.page {
margin-bottom: 30px;
.title {
......
......@@ -126,7 +126,14 @@ export default {
let [href] = window.location.href.split('/#/')
let url = `${href}/#/cardRoll/opening?sessionId=${sessionId}`
this.openWindows(url, 'cardRoll.opening');
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益中心",
event_name:'立即领取'
},
});
this.collect(logs);
} else {
this.equityLogin()
}
......@@ -143,7 +150,18 @@ 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 {
this.equityLogin()
}
......@@ -161,13 +179,25 @@ export default {
}
}
this.jumpLink(e)
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益中心",
event_name:e.brandName,
...e
},
});
this.collect(logs);
}else {
this.equityLogin()
}
},
willComeDialog() {
this.showToast('即将上线,敬请期待')
}
},
collect(logs) {
window.vm.track.collect(logs);
},
}
}
</script>
......
......@@ -80,7 +80,7 @@
</div>
</div>
</div>
<span @click="jump" class="know_btn">我知道了</span>
<span @click="jump(1)" class="know_btn">我知道了</span>
</div>
</template>
......@@ -143,10 +143,13 @@ export default {
},
methods: {
collect(logs) {
window.vm.track.collect(logs);
},
init() {
//如果能够获取到这个缓存,说明已经是登录过
// let isReload = this.getLocalStorage('reLoadIndex')
// console.log('时间搓',new Date().getTime());
// console.log('sessionId',isReload);
// if(isReload){
// this.removeLocalStorage('reLoadIndex')
......@@ -157,18 +160,8 @@ export default {
// }
// })
// }
// this.removeLocalStorage('showMydialog1')
// let urlParam = JSON.parse(sessionStorage.getItem('URL_PARAM'))
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' })
}
})
}
// let urlObj = JSON.parse(sessionStorage.getItem('URL_PARAM'))
// // let { sessionId, phone } = this.$store.state
// const ua = navigator.userAgent.toLowerCase()
// let sid = urlObj.sessionId
// console.log(sid);
......@@ -217,6 +210,14 @@ export default {
})
},
receive () {
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "首页",
event_name: "立即领取",
},
});
this.collect(logs);
let { sessionId, phone } = this.$store.state
const ua = navigator.userAgent.toLowerCase()
if (sessionId) {
......@@ -228,14 +229,12 @@ export default {
}
}
}
let [href] = window.location.href.split('/#/')
let url = `${href}/#/cardRoll/opening?sessionId=${sessionId}`
this.openWindows(url, 'cardRoll.opening')
this.$router.push({ name: 'cardRoll.opening'})
} else {
this.equityLogin()
}
},
jump () {
jump (str) {
// let { sessionId } = JSON.parse(
// sessionStorage.getItem("GL_EQUITY_USER_INFO")
// )
......@@ -245,6 +244,14 @@ export default {
// let url = `${href}/#/equity/index?sessionId=${sessionId}`
// this.openWindows(url, '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 {
// }
.main.marketing_page{
width: auto;
background-color: #FEFAED;
padding: 10px;
color: #2c2c2c;
......@@ -343,7 +351,7 @@ export default {
text-align: center;
font-size: 20px;
background-image: radial-gradient(86% 95%, #5E5E5E 0%, #2F2F2F 100%);
margin: 0 -10px -10px;
margin-bottom: 10px;
}
}
</style>
\ No newline at end of file
......@@ -149,6 +149,7 @@ export default {
tel: "",
sms: "",
countDown: false,
countNum: 0,
countKey: new Date().getTime(),
showReSend:false
};
......@@ -244,6 +245,7 @@ export default {
})
.then((res) => {
if (res) {
this.countNum++
let { code, message } = res;
if (code != 0) {
this.showToast(message);
......@@ -278,7 +280,8 @@ export default {
this.showToast("请填写正确的手机号");
return;
}
this.showLoading("登陆中...");
this.toCreateTrack('login','登录',{ mobile: tel, code: sms, count: this.countNum})
this.showLoading("登录中...");
common
.smsLogin({
mobile: tel,
......@@ -289,10 +292,13 @@ export default {
if (res) {
let { code, data, message } = res;
if (code == 0) {
sessionStorage.setItem("GL_EQUITY_USER_INFO",JSON.stringify(data));
sessionStorage.setItem("CODE_PAST_DUE",false);
this.loginBuried(data)
this.toCreateTrack('login_out_event','登录成功',data)
sessionStorage.setItem(
"GL_EQUITY_USER_INFO",
JSON.stringify(data)
);
this.$store.commit("setUserInfo", data);
// window.vm.$router.replace({ name: 'equity.index' });
let flag = window.location.href.indexOf('/#/')
if(flag!=-1){
window.location.href = `${window.location.href.split('/#/')[0]}/#/equity/index`
......@@ -300,11 +306,63 @@ export default {
window.location.href = `${window.location.href.split('?')[0]}#/equity/index`
}
} else {
this.toCreateTrack('login_out_event','登录失败',{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() {
let { sessionId, phone } = JSON.parse(
sessionStorage.getItem("GL_EQUITY_USER_INFO")
......@@ -312,7 +370,6 @@ export default {
? JSON.parse(sessionStorage.getItem("GL_EQUITY_USER_INFO"))
: this.$store.state;
const ua = navigator.userAgent.toLowerCase();
console.log(sessionId);
if (sessionId) {
if (!this.isMiniprogram) {
if (ua.match(/MicroMessenger/i) == "micromessenger") {
......@@ -322,7 +379,6 @@ export default {
}
}
}
sessionStorage.setItem("CODE_PAST_DUE",false);
this.$router.replace({ name: "equity.index" });
}
},
......@@ -340,6 +396,7 @@ export default {
<style scoped lang='scss'>
.main {
width: auto;
background-color: #fefaed;
padding: 10px;
color: #2c2c2c;
......
......@@ -16,9 +16,7 @@
</div>
<div class="info_wrapper">
<div class="user_name">
{{
userInfo.nickName ? userInfo.nickName : userInfo.memberName
}}
{{ userInfo.nickName ? userInfo.nickName : userInfo.memberName }}
</div>
<div v-if="ismember && userInfo.cardNo" style="height: 9px"></div>
<div class="user_date" v-if="ismember && userInfo.cardNo">
......@@ -32,7 +30,9 @@
<div class="fn_label">
<span class="fn_label_wrap" @click="jumpOrder">权益订单</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 v-if="!ismember" class="open_wrap">
<div class="open_icon"></div>
......@@ -59,7 +59,6 @@
</div>
<div class="box_foot_img"></div>
</div>
<!-- <div class="card-box">
<div class="sprite-icon icon-banner">
......@@ -91,7 +90,11 @@
</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">
<span class="invite_btn">我要分享</span>
<p>享推广佣金奖励</p>
......@@ -149,10 +152,10 @@
</div>
</div>
</template>
<script type='text/ecmascript-6'>
<script type="text/ecmascript-6">
import { indexMixin } from "@/mixins";
import { equity } from "@r/api.js";
import AMap from "AMap";
// import { Toast } from "vant";
export default {
name: "index",
......@@ -174,12 +177,15 @@ export default {
},
mixins: [indexMixin],
mounted() {
this.tabHideShow(1);
window.webkit.messageHandlers.jumpNativeApp.postMessage(JSON.stringify({type:2,show:1}))
console.log("更新页面时间:", new Date().format("hh:mm:ss"));
const ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger"){
this.isWXEnvironment = true
}else{
this.isWXEnvironment = false
this.getMapLocation();
}
// 标记已受过权,状态变为false,下次领取页需要重新授权
this.setLocalStorage("codeAuth", false);
......@@ -196,6 +202,31 @@ export default {
}
},
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() {
const urlObj = JSON.parse(sessionStorage.getItem("URL_PARAM"));
......@@ -252,9 +283,11 @@ export default {
data.time = new Date(data.validitDate).format("yyyy-MM-dd");
this.userInfo = data;
this.ismember = true;
localStorage.setItem('isVip',1)
} else {
this.ismember = false;
this.isOpen = 0;
localStorage.setItem('isVip',0)
}
// 重新获取头像,避免头像拿不到
//app那边可能拿不到头像---写这个重新获取一下
......@@ -273,7 +306,16 @@ export default {
"续费开通",
"不用了",
this.jumpOpenEquity,
() => {}
() => {
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益首页",
event_name:'不用了'
},
});
this.collect(logs);
}
);
}
}
......@@ -416,17 +458,30 @@ export default {
},
followAccount() {
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() {
let url = "http://m.s11.cn/tehui/sz/?order_cust_id=4892038";
this.openWindows(url);
},
jumpOrder() {
let { sessionId } = this.$store.state;
let [href] = window.location.href.split("/#/");
let url = `${href}/#/cardRoll/index?sessionId=${sessionId}`;
console.log(url);
this.openWindows(url, "cardRoll.index");
this.tabHideShow(0);
this.$router.push({ name: 'cardRoll.index'})
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益首页",
event_name:'权益订单'
},
});
this.collect(logs);
},
jumpOpenShop() {
this.openWindows("https://www.wjx.cn/m/89882107.aspx");
......@@ -437,6 +492,14 @@ export default {
} else {
this.showToast("尚未配置活动参数");
}
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益首页",
event_name:'查看奖励'
},
});
this.collect(logs);
},
jumpInvite() {
if (this.inviteUrl) {
......@@ -444,28 +507,46 @@ export default {
} else {
this.showToast("尚未配置活动参数");
}
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益首页",
event_name:'分享好友'
},
});
this.collect(logs);
},
willComeDialog() {
this.showToast("即将上线,敬请期待");
},
jumpOpenEquity() {
// let { sessionId } = this.$store.state;
// if(sessionId){
// window.vm.$router.push({ name: 'cardRoll.opening',query: {payStatus:1} })
// }else{
// this.equityLogin();
// }
let { sessionId } = this.$store.state;
let [href] = window.location.href.split("/#/");
let url = `${href}/#/cardRoll/opening?sessionId=${sessionId}`;
this.openWindows(url, "cardRoll.opening");
this.setLocalStorage("whereInOpen", "index");
this.tabHideShow(0);
this.$router.push({ name: 'cardRoll.opening'})
this.setLocalStorage('whereInOpen','index')
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "权益首页",
event_name:'开通'
},
});
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>
<style lang='scss'>
<style lang="scss">
@import "@a/scss/index.scss";
html,
body {
......@@ -864,7 +945,6 @@ body {
}
}
}
&.box_between {
display: flex;
justify-content: space-between;
......@@ -872,7 +952,6 @@ body {
}
}
}
.tab_content {
padding: 10px;
.icon-goods {
......@@ -881,7 +960,6 @@ body {
margin-bottom: 4px;
}
}
.content .box {
&.equity_box {
margin-bottom: 10px;
......
......@@ -30,7 +30,7 @@
</div>
<div
class="phone btn"
@click="makePhoneCall('4008060999')"
@click="toCall()"
>
<div class="sprite-icon icon-equity-phone"></div>
电话咨询
......@@ -49,6 +49,18 @@ export default {
mounted () {
},
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>
......
......@@ -2,7 +2,7 @@
<div class="main">
<div class="box" id="mapContainer">
<div class="de-header">
<img :src="detailInfo.gasLogoBig" alt="" />
<img v-lazy="detailInfo.gasLogoBig" alt="" />
</div>
<div class="box-detail">
<div class="de-desc">
......@@ -87,24 +87,13 @@ export default {
};
},
mounted() {
const ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
let { oilId, oilNo, longitude, latitude, distance } = this.$route.query;
this.oilId = oilId;
this.oilNo = oilNo;
this.oilSnoi = oilNo;
this.longitude = longitude;
this.latitude = latitude;
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;
}
let { oilId, oilNo, longitude, latitude, distance } = this.$route.query;
this.oilId = oilId;
this.oilNo = oilNo;
this.oilSnoi = oilNo;
this.longitude = longitude;
this.latitude = latitude;
this.distance = distance;
this.getOilDetail();
this.getCardInfo();
},
......@@ -114,13 +103,20 @@ export default {
name: "cardRoll.opening",
query: { payStatus: 1 },
});
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "开通权益",
},
});
this.collect(logs);
},
getCardInfo() {
equity.getCardInfo().then((res) => {
let { code, data } = res;
if (code == 0 && data) {
let { code } = res;
if (code == 0) {
this.isOpen = 1;
} else {
this.isOpen = 0;
}
......@@ -140,12 +136,15 @@ export default {
this.detailInfo = data;
this.gunNos = data.gunNos;
this.equityOilNoDTOList = data.equityOilNoDTOList;
// let img = new Image();
// img.src = data.gasLogoBig;
// img.onload = ()=> {
// this.hideLoading();
// }
} else {
this.showToast(message);
}
setTimeout(()=>{
this.hideLoading();
},1000)
this.hideLoading();
});
},
openLocation(val) {
......@@ -160,13 +159,21 @@ export default {
).then((res) => {
console.log(res);
});
}else{
}else {
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 {
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) {
if (this.oilSnoi == item) {
......@@ -176,9 +183,27 @@ export default {
this.oilNo = item;
this.oilSuni = null;
this.getOilDetail();
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "选择油号",
oilNo: item,
},
});
this.collect(logs);
},
changeOilSun(item) {
this.oilSuni = item;
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "选择油枪",
oilSuni: item,
},
});
this.collect(logs);
},
oilPay() {
let { oilId } = this.$route.query;
......@@ -195,6 +220,27 @@ export default {
oilNo: this.oilSnoi,
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();
let jumpUrl;
const ua = navigator.userAgent.toLowerCase();
......@@ -204,7 +250,6 @@ export default {
jumpUrl = "getStationAppPayUrl";
}
oilStation[jumpUrl](para).then((res) => {
console.log(res, "加油站");
this.hideLoading();
let { code, data, message } = res;
if (code == 0) {
......@@ -214,6 +259,10 @@ export default {
}
});
},
//埋点
collect(logs) {
window.vm.track.collect(logs);
},
},
};
</script>
......
......@@ -74,8 +74,18 @@ export default {
mounted() {
this.getRecord();
this.handleLocation();
this.listeningBack();
},
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() {
oilStation.getStationSearchList().then(res => {
this.hideLoading()
......@@ -88,6 +98,14 @@ export default {
})
},
clearEmpty() {
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "清空搜索记录",
},
});
this.collect(logs);
oilStation.getStationSearchDeleteAll().then(res => {
this.hideLoading()
let { code, message } = res
......@@ -102,6 +120,15 @@ export default {
let para = {
id: index
}
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "删除历史记录",
id:index
},
});
this.collect(logs);
oilStation.getStationSearchDelete(para).then(res => {
this.hideLoading()
let { code, message } = res
......@@ -120,6 +147,14 @@ export default {
}else {
this.getMapLocation();
}
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "重新定位",
},
});
this.collect(logs);
},
getMapLocation() {
let self = this;
......@@ -174,17 +209,53 @@ export default {
},
onCancel() {
this.localStatus = true;
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "取消搜索",
search:this.input
},
});
this.collect(logs);
},
onSearch(){
this.localStatus = false;
this.$refs.maps.onSearch();
let logs = window.vm.trackConfig({
event: "click_event",
properties: {
pagename: "加油站详情",
event_name: "搜索",
search:this.input
},
});
this.collect(logs);
},
selectItem(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() {
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) {
let para = {
......@@ -192,17 +263,30 @@ export default {
longitude: value.location.lng,
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 => {
this.hideLoading()
let { code, message } = res
if (code == 0) {
this.$store.commit('setAddress',para)
window.vm.$router.push({ path: '/oilStation/index'})
window.vm.$router.replace({ path: '/oilStation/index'})
} else {
this.showToast(message)
}
})
}
},
//埋点
collect(logs) {
window.vm.track.collect(logs);
},
}
}
</script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!