|
@@ -1,13 +1,6 @@
|
|
<template>
|
|
<template>
|
|
<view class="container" :style="{ paddingTop: navbarHeight + 'px' }">
|
|
<view class="container" :style="{ paddingTop: navbarHeight + 'px' }">
|
|
<!-- 自定义返回 -->
|
|
<!-- 自定义返回 -->
|
|
- <header-back
|
|
|
|
- :systeminfo="systeminfo"
|
|
|
|
- :navbar-data="nvabarData"
|
|
|
|
- :headerBtnPosi="headerBtnPosi"
|
|
|
|
- :isDelete="isDelete"
|
|
|
|
- @navigatePath="handlNavigatePath"
|
|
|
|
- />
|
|
|
|
<tui-skeleton
|
|
<tui-skeleton
|
|
v-if="skeletonShow"
|
|
v-if="skeletonShow"
|
|
backgroundColor="#fafafa"
|
|
backgroundColor="#fafafa"
|
|
@@ -16,6 +9,14 @@
|
|
:loadingType="5"
|
|
:loadingType="5"
|
|
/>
|
|
/>
|
|
<template v-else>
|
|
<template v-else>
|
|
|
|
+ <header-back
|
|
|
|
+ :systeminfo="systeminfo"
|
|
|
|
+ :navbar-data="nvabarData"
|
|
|
|
+ :headerBtnPosi="headerBtnPosi"
|
|
|
|
+ :isDelete="isDelete"
|
|
|
|
+ :isShare="isShare"
|
|
|
|
+ @navigatePath="handlNavigatePath"
|
|
|
|
+ />
|
|
<view class="order-section-top" :style="{ marginTop: navbarHeight + 'px' }">
|
|
<view class="order-section-top" :style="{ marginTop: navbarHeight + 'px' }">
|
|
<scroll-view scroll-x scroll-with-animation class="tab-view" :scroll-left="scrollLeft">
|
|
<scroll-view scroll-x scroll-with-animation class="tab-view" :scroll-left="scrollLeft">
|
|
<view
|
|
<view
|
|
@@ -45,7 +46,7 @@
|
|
v-if="tabItem.loaded === true && tabItem.orderList.length === 0"
|
|
v-if="tabItem.loaded === true && tabItem.orderList.length === 0"
|
|
:typeIndex="currentTab"
|
|
:typeIndex="currentTab"
|
|
:navbarHeight="navbarHeight"
|
|
:navbarHeight="navbarHeight"
|
|
- ></empty>
|
|
|
|
|
|
+ />
|
|
<!-- 列表 -->
|
|
<!-- 列表 -->
|
|
<view v-else class="tui-order-content">
|
|
<view v-else class="tui-order-content">
|
|
<view
|
|
<view
|
|
@@ -167,6 +168,9 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import { mapState, mapMutations } from 'vuex'
|
|
|
|
+import authorize from '@/common/config/authorize.js'
|
|
|
|
+import wxLogin from '@/common/config/wxLogin.js'
|
|
import headerBack from '@/components/cm-module/headerNavbar/header-back' //自定义导航
|
|
import headerBack from '@/components/cm-module/headerNavbar/header-back' //自定义导航
|
|
import cmListButton from './components/cm-list-button' //按钮
|
|
import cmListButton from './components/cm-list-button' //按钮
|
|
import modalLayer from '@/components/modal-layer'
|
|
import modalLayer from '@/components/modal-layer'
|
|
@@ -213,6 +217,7 @@ export default {
|
|
scrollTop: 0,
|
|
scrollTop: 0,
|
|
skeletonShow: true,
|
|
skeletonShow: true,
|
|
isDelete: false,
|
|
isDelete: false,
|
|
|
|
+ isShare: false,
|
|
isClickChange: false,
|
|
isClickChange: false,
|
|
isShareModal: false, //控制分享弹窗
|
|
isShareModal: false, //控制分享弹窗
|
|
isModalLayer: false,
|
|
isModalLayer: false,
|
|
@@ -245,15 +250,26 @@ export default {
|
|
]
|
|
]
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ computed: {
|
|
|
|
+ ...mapState(['hasLogin'])
|
|
|
|
+ },
|
|
onLoad(e) {
|
|
onLoad(e) {
|
|
if (e.type === 'detele') {
|
|
if (e.type === 'detele') {
|
|
this.isDelete = true
|
|
this.isDelete = true
|
|
}
|
|
}
|
|
- this.currentTab = e.state
|
|
|
|
- console.log('currentTab', this.currentTab)
|
|
|
|
|
|
+ this.currentTab = e.state ? e.state : 0
|
|
|
|
+ if (getCurrentPages().length === 1) {
|
|
|
|
+ // 当只有一个页面时
|
|
|
|
+ this.isShare = true // 获取是否是通过分享进入的小程序
|
|
|
|
+ } else {
|
|
|
|
+ this.isShare = false // 获取是否是通过分享进入的小程序
|
|
|
|
+ }
|
|
this.isOnloadFlag = true
|
|
this.isOnloadFlag = true
|
|
this.getHeaderTopHeight() //设置自定义导航高度
|
|
this.getHeaderTopHeight() //设置自定义导航高度
|
|
- this.initStorage()
|
|
|
|
|
|
+ setTimeout(()=>{
|
|
|
|
+ console.log('hasLogin', this.hasLogin)
|
|
|
|
+ this.initStorage()
|
|
|
|
+ },2000)
|
|
},
|
|
},
|
|
filters: {
|
|
filters: {
|
|
NumFormat(value) {
|
|
NumFormat(value) {
|
|
@@ -284,9 +300,16 @@ export default {
|
|
methods: {
|
|
methods: {
|
|
async initStorage() {
|
|
async initStorage() {
|
|
//初始化
|
|
//初始化
|
|
- const usrInfo = await this.$api.getStorage()
|
|
|
|
- this.listQuery.userId = usrInfo.userId ? usrInfo.userId : 0
|
|
|
|
- this.getOrderDatainit(this.currentTab)
|
|
|
|
|
|
+ if(this.hasLogin){
|
|
|
|
+ const usrInfo = await this.$api.getStorage()
|
|
|
|
+ this.listQuery.userId = usrInfo.userId ? usrInfo.userId : 0
|
|
|
|
+ this.getOrderDatainit(this.currentTab)
|
|
|
|
+ }else{
|
|
|
|
+ this.modal = true
|
|
|
|
+ this.skeletonShow = false
|
|
|
|
+ this.contentModalText = '您还未登录,请先登录!'
|
|
|
|
+ this.handleModelEven = 99
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// 滚动切换标签样式
|
|
// 滚动切换标签样式
|
|
onChange: function(e) {
|
|
onChange: function(e) {
|
|
@@ -473,10 +496,20 @@ export default {
|
|
case 4: //确认订单
|
|
case 4: //确认订单
|
|
this.affirmOrder()
|
|
this.affirmOrder()
|
|
break
|
|
break
|
|
|
|
+ case 99: //未登录跳转
|
|
|
|
+ this.handleNavLogin()
|
|
|
|
+ break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.modal = false
|
|
this.modal = false
|
|
},
|
|
},
|
|
|
|
+ //未登录跳转
|
|
|
|
+ handleNavLogin(){
|
|
|
|
+ const pages = getCurrentPages()
|
|
|
|
+ const page = pages[pages.length - 1]
|
|
|
|
+ uni.setStorageSync('LOGIN_REDIRECT_URL', page.$page.fullPath)
|
|
|
|
+ this.$api.redirectTo('/pages/login/login')
|
|
|
|
+ },
|
|
async confirmReceipt() {
|
|
async confirmReceipt() {
|
|
//确认收货
|
|
//确认收货
|
|
try {
|
|
try {
|
|
@@ -528,6 +561,8 @@ export default {
|
|
handlNavigatePath(data) {
|
|
handlNavigatePath(data) {
|
|
if(data.type === 'navigateTo'){
|
|
if(data.type === 'navigateTo'){
|
|
this.$api.navigateTo(data.url)
|
|
this.$api.navigateTo(data.url)
|
|
|
|
+ }else if(data.type === 'switchTab'){
|
|
|
|
+ this.$api.switchTabTo(data.url)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
handButtonShareConfirm(data) {
|
|
handButtonShareConfirm(data) {
|
|
@@ -610,6 +645,7 @@ export default {
|
|
},
|
|
},
|
|
onShow() {
|
|
onShow() {
|
|
this.isModalLayer = false
|
|
this.isModalLayer = false
|
|
|
|
+ wxLogin.wxLoginAuthorize()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|