Commit 1d280c08 by 李伟康

修复BUG

1 parent cee9fb4c
<template> <template>
<div id="app"> <div id="app">
<router-view /> <template v-if="showWindow">
<transition name="fade">
<keep-alive v-if="$route.meta.keepAlive">
<router-view></router-view>
</keep-alive>
</transition>
<transition name="fade">
<router-view v-if="!$route.meta.keepAlive"></router-view>
</transition>
<template v-if="$route.meta.isTab && entry != 'normal'">
<tab-bar :data="tabList"></tab-bar>
</template>
</template>
</div> </div>
</template> </template>
<script> <script>
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
export default { export default {
name: 'App' name: 'App',
data() {
return {
entry: IS_PROD ? 'normal' :'chat_attachment',
tabList: [
{
title: '卡券',
name: 'coupon',
active: require('@/assets/images/tabbar/coupon_active.png'),
inactive: require('@/assets/images/tabbar/coupon.png')
},
{
title: '活动',
name: 'activity',
active: require('@/assets/images/tabbar/activity_active.png'),
inactive: require('@/assets/images/tabbar/activity.png')
}
]
}
},
watch: {
watchFlag: {
immediate: true,
handler(newval) {
this.showWindow = newval
this.hideLoading()
}
}
},
computed: {
watchFlag() {
return this.$store.state.app.showWindow
}
},
mounted() {
console.log()
},
methods: {}
} }
</script> </script>
<style lang="scss"></style> <style lang="scss" scoped>
.isTab {
padding-bottom: 50px;
box-sizing: border-box;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -3,7 +3,7 @@ const { environment } = window.$fetchConfig ...@@ -3,7 +3,7 @@ const { environment } = window.$fetchConfig
export default { export default {
data() { data() {
return { return {
entry: '' entry: 'normal'
} }
}, },
mounted() { mounted() {
...@@ -41,7 +41,7 @@ export default { ...@@ -41,7 +41,7 @@ export default {
}, },
sendMessage(i) { sendMessage(i) {
let { merchantId, merchantName, userName, channelType } = this.getLocalStorage('dj_scrm_userInfo') let { merchantId, merchantName, userName, channelType } = this.getLocalStorage('dj_scrm_userInfo')
let { tabIndex, entry, tabList } = this let { tabIndex, entry } = this
let { name } = this.$route let { name } = this.$route
let { userId, id, couponName, activityName, packageName, goodsName, goodsImage, discountType } = i let { userId, id, couponName, activityName, packageName, goodsName, goodsImage, discountType } = i
let shopmall_appId = environment == 'beta' ? 'wx9f91c1ec493eb425' : 'wxe10067a63c1856ac' let shopmall_appId = environment == 'beta' ? 'wx9f91c1ec493eb425' : 'wxe10067a63c1856ac'
...@@ -51,7 +51,8 @@ export default { ...@@ -51,7 +51,8 @@ export default {
case 'coupon': { case 'coupon': {
let desc = '您的专属服务顾问为您发来了优惠券,请点击领取~' let desc = '您的专属服务顾问为您发来了优惠券,请点击领取~'
let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-yh-10004.png' let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-yh-10004.png'
if (tabIndex == 0 && tabList.length > 1) { console.log(entry)
if (tabIndex == 0 ) {
if (entry != 'normal') if (entry != 'normal')
this.sendChatMessage({ this.sendChatMessage({
// channelType 1 嘀加 2:广汇 // channelType 1 嘀加 2:广汇
...@@ -61,6 +62,7 @@ export default { ...@@ -61,6 +62,7 @@ export default {
page: `/packageMine/pages/boutique/gift/gift.html?id=${id}&userId=${userId}&employName=${this.toUnicode(i.employeeName)}` page: `/packageMine/pages/boutique/gift/gift.html?id=${id}&userId=${userId}&employName=${this.toUnicode(i.employeeName)}`
}) })
else { else {
console.log('?')
boutiquecouponApi.getBoutiqueCoupon({ id }).then(res => { boutiquecouponApi.getBoutiqueCoupon({ id }).then(res => {
this.shareAppMessage(res, desc, couponName, imgUrl) this.shareAppMessage(res, desc, couponName, imgUrl)
}) })
......
const pages = [ const pages = {
coupon: [{
name: 'index',
meta: {
isTab: true
}
},
{ {
name: 'coupon', name: 'verificationList',
meta: { meta: {
isTab: true, title: '核销列表',
keepAlive: true keepAlive: true
}, }
children: [
{
name: 'verificationList',
meta: {
title: '核销列表',
keepAlive: true
}
},
{
name: 'verificationDetail',
meta: {
title: '核销详情',
keepAlive: true
}
},
{
name: 'goodsVerification',
meta: {
title: '核销订单',
keepAlive: true
}
}
]
}, },
{ {
name: 'activity', name: 'verificationDetail',
meta: { meta: {
isTab: true, title: '核销详情',
keepAlive: true, keepAlive: true
backgroundColor: '#F7F7F7' }
},
children: []
}, },
{ {
name: 'merchant', name: 'goodsVerification',
meta: { meta: {
keepAlive: true, title: '核销订单',
isIndex: true, keepAlive: true
backgroundColor: '#F7F7F7', }
title: '店铺中心'
},
children: []
} }
] ],
const keepAlives = [] activity: [
const setChildren = (e, parent) => { {
let arr = [] name: 'index',
e.children.map(child => { meta: {
const { children, meta } = child isTab: true,
let url = `${parent}/${child.name}` keepAlive: true,
let name = url.replace(/\//g, '.') backgroundColor: '#F7F7F7'
let route = { },
path: `/${url}`,
name,
meta: meta || {},
component: resolve => require([`views/${url}.vue`], resolve)
} }
if (meta && meta.keepAlive) keepAlives.push(name) ],
if (children) route.children = setChildren(child, url) merchant: [
arr.push(route) {
}) name: 'index',
return arr meta: {
keepAlive: true,
isIndex: true,
backgroundColor: '#F7F7F7',
title: '店铺中心'
}
}
]
} }
const getPages = () => { let routes = []
let router = { const keepAlives = []
path: '/', Object.keys(pages).map(parent => {
name: 'home', pages[parent].map(val => {
redirect: '/coupon', let childrenPath = `${parent}/${val.name}`
component: resolve => require([`views/home.vue`], resolve) let { meta } = val
} const path = `/${val.name == 'index' ? parent : childrenPath}`
router.children = pages.map(e => { const name = val.name == 'index' ? parent : childrenPath.replace('/', '.')
let name = `${e.name}` if (meta && meta.keepAlive) keepAlives.push(name)
let route = { let route = {
path: `/${name}`, component: resolve => require([`views/${childrenPath}.vue`], resolve),
path,
name, name,
meta: e.meta || {}, meta
component: resolve => require([`views/${name}/index.vue`], resolve)
} }
if (e.children) route.children = setChildren(e, name) routes.push(route)
if (e.meta && e.meta.keepAlive) keepAlives.push(name)
return route
}) })
return [router] })
} console.log(routes)
export const keeps = keepAlives export const keeps = keepAlives
export default getPages() export default routes
\ No newline at end of file \ No newline at end of file
...@@ -84,7 +84,7 @@ const couponObj = [ ...@@ -84,7 +84,7 @@ const couponObj = [
{ {
label: '类型', label: '类型',
format (item) { format (item) {
return window.$discountType[item.discountType] return `${window.$discountType[item.discountType]}券`
} }
}, },
{ {
......
...@@ -199,6 +199,7 @@ export default { ...@@ -199,6 +199,7 @@ export default {
name: '', name: '',
data () { data () {
return { return {
test: '',
tab: [ tab: [
['', '', ''], ['', '', ''],
['', ''], ['', ''],
...@@ -231,7 +232,6 @@ export default { ...@@ -231,7 +232,6 @@ export default {
} }
}, },
beforeRouteEnter (to, from, next) { beforeRouteEnter (to, from, next) {
console.log('from', from)
let { params: { discountType, isGoods } } = from let { params: { discountType, isGoods } } = from
next(vm => { next(vm => {
if (discountType) { if (discountType) {
...@@ -260,13 +260,12 @@ export default { ...@@ -260,13 +260,12 @@ export default {
}) })
}, },
activated () { activated () {
},
mounted () {
this.getTabNum() this.getTabNum()
window.$wx = wxConfig window.$wx = wxConfig
window.$wx.init(['scanQRCode']) window.$wx.init(['scanQRCode'])
}, },
mounted () {
},
methods: { methods: {
getTabNum () { getTabNum () {
this.showLoading() this.showLoading()
......
<!-- home -->
<template>
<div class="container">
<template v-if="showWindow">
<transition name="fade">
<keep-alive v-if="$route.meta.keepAlive">
<router-view></router-view>
</keep-alive>
</transition>
<transition name="fade">
<router-view v-if="!$route.meta.keepAlive"></router-view>
</transition>
<template v-if="$route.meta.isTab && entry != 'normal'">
<tab-bar :data="tabList"></tab-bar>
</template>
</template>
</div>
</template>
<script>
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
export default {
data() {
return {
entry: IS_PROD ? 'normal' :'chat_attachment',
tabList: [
{
title: '卡券',
name: 'coupon',
active: require('@/assets/images/tabbar/coupon_active.png'),
inactive: require('@/assets/images/tabbar/coupon.png')
},
{
title: '活动',
name: 'activity',
active: require('@/assets/images/tabbar/activity_active.png'),
inactive: require('@/assets/images/tabbar/activity.png')
}
]
}
},
watch: {
watchFlag: {
immediate: true,
handler(newval) {
this.showWindow = newval
this.hideLoading()
}
}
},
computed: {
watchFlag() {
return this.$store.state.app.showWindow
}
},
mounted() {},
methods: {}
}
</script>
<style lang="scss" scoped>
.isTab {
padding-bottom: 50px;
box-sizing: border-box;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!