更新
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<template>
|
||||
<view class="page-content " :class="(PageCur=='home'||PageCur=='scan')?'my-bg':''">
|
||||
<!-- <uni-nav-bar left-icon="back" left-text="返回" right-text="菜单" title="导航栏组件"></uni-nav-bar> -->
|
||||
<home ref='homecheck' v-if="PageCur=='home'||PageCur=='scan'" :user-account="userAccount" @changMenus='changMenus' :site="userAccount" :menusList = 'menusList' :checkUser = 'checkUser'></home>
|
||||
<home ref='homecheck' v-if="PageCur=='home'||PageCur=='scan'" :user-account="userAccount"
|
||||
@changMenus='changMenus' :site="userAccount" :checkUser='checkUser'></home>
|
||||
<setup v-if="PageCur=='setup'"></setup>
|
||||
<view class="bottom-view">
|
||||
<view class="padding-top radius shadow bottom-bar-fixed">
|
||||
@@ -14,7 +15,8 @@
|
||||
</view>
|
||||
|
||||
<view class="action text-gray add-action" @tap="NavChange" data-cur="scan">
|
||||
<button class="cu-btn cuIcon-scan sl shadow" :class="PageCur=='scan'?'bg-main-oil':'bg-gradual-orange'"></button>
|
||||
<button class="cu-btn cuIcon-scan sl shadow"
|
||||
:class="PageCur=='scan'?'bg-main-oil':'bg-gradual-orange'"></button>
|
||||
<text :class="PageCur=='scan'?'text-red':'text-gray'">
|
||||
一键扫码
|
||||
</text>
|
||||
@@ -31,27 +33,27 @@
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script>
|
||||
import cloudSiteApi from '@/api/cloud-site.js'
|
||||
import oliSiteApi from '@/api/oli-site.js'
|
||||
import oliUserApi from '@/api/oli-user.js'
|
||||
export default {
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
checkUser:false,
|
||||
changeChannel:{
|
||||
username:'',
|
||||
channelId:'',
|
||||
unionId:''
|
||||
checkUser: false,
|
||||
changeChannel: {
|
||||
username: '',
|
||||
channelId: '',
|
||||
unionId: ''
|
||||
},
|
||||
PageCur: 'home',
|
||||
userAccount: {
|
||||
totalCount: 0,
|
||||
totalMoney: 0.00
|
||||
},
|
||||
loginUser: uni.getStorageSync('loginUser'),
|
||||
channelId:uni.getStorageSync('channelId'),
|
||||
menusList:[],
|
||||
loginUser: uni.getStorageSync('loginUser'),
|
||||
channelId: uni.getStorageSync('channelId'),
|
||||
menusList: [],
|
||||
site: {},
|
||||
userMenu: uni.getStorageSync('userMenu')
|
||||
}
|
||||
@@ -64,7 +66,7 @@
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
uni.setStorageSync('orderType',null)
|
||||
uni.setStorageSync('orderType', null)
|
||||
// uni.preloadPage({url: "/pages/station-info/scan-camera/scan-camera"});
|
||||
const token = uni.getStorageSync('Authorization')
|
||||
const openid = uni.getStorageSync('device')
|
||||
@@ -92,21 +94,30 @@
|
||||
},
|
||||
onLoad() {
|
||||
const token = uni.getStorageSync('Authorization')
|
||||
if(!token) return
|
||||
let _that =this
|
||||
const Menus = uni.getStorageSync('userMenu')
|
||||
let menusList = []
|
||||
Menus.forEach((item,index,Menus)=>{
|
||||
if(item.roleName != 'ROOT' ){
|
||||
menusList.push(this.Splicing(item))
|
||||
}
|
||||
})
|
||||
let check = uni.getStorageSync('checkFirst')
|
||||
if(check){
|
||||
_that.checkUser = true
|
||||
if (!token) return
|
||||
let check = uni.getStorageSync('checkFirst')
|
||||
if (check) {
|
||||
this.checkUser = true
|
||||
}
|
||||
uni.setStorageSync('menusChangeList',menusList)
|
||||
this.menusList = menusList
|
||||
|
||||
this.menusList = uni.getStorageSync('menusChangeList') || []
|
||||
|
||||
// const Menus = uni.getStorageSync('userMenu')
|
||||
// let menusList = []
|
||||
// Menus.forEach((item, index, Menus) => {
|
||||
// if (item.roleName != 'ROOT') {
|
||||
// menusList.push(this.Splicing(item))
|
||||
// }
|
||||
// })
|
||||
// let check = uni.getStorageSync('checkFirst')
|
||||
// if (check) {
|
||||
// _that.checkUser = true
|
||||
// }
|
||||
// uni.setStorageSync('menusChangeList', menusList)
|
||||
// this.menusList = menusList
|
||||
|
||||
|
||||
|
||||
this.longiCheck()
|
||||
this.getPosition()
|
||||
},
|
||||
@@ -129,124 +140,108 @@
|
||||
}
|
||||
return true
|
||||
},
|
||||
getPosition(){
|
||||
console.log('getPositiongetPositiongetPositiongetPosition')
|
||||
getPosition() {
|
||||
// console.log('getPositiongetPositiongetPositiongetPosition')
|
||||
let that = this
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
success: function(res) {
|
||||
uni.setStorage({
|
||||
key:'location',
|
||||
data:res
|
||||
key: 'location',
|
||||
data: res
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
changMenus(data){
|
||||
this.menusList =data
|
||||
changMenus(data) {
|
||||
this.menusList = data
|
||||
},
|
||||
longiCheck(){
|
||||
let userInfo = uni.getStorageSync('loginUser'),
|
||||
_that =this
|
||||
oliUserApi.getByPhone(userInfo.userPhone).then((res)=>{
|
||||
if(res.code == 20000){
|
||||
_that.checkList = 'show'
|
||||
_that.oliList = res.data
|
||||
_that.changeChannel.username = _that.loginUser.userPhone
|
||||
_that.changeChannel.unionId = uni.getStorageSync('unionId')
|
||||
}else{
|
||||
longiCheck() {
|
||||
let userInfo = uni.getStorageSync('loginUser')
|
||||
oliUserApi.getByPhone(userInfo.userPhone).then((res) => {
|
||||
if (res.code == 20000) {
|
||||
this.checkList = 'show'
|
||||
this.oliList = res.data
|
||||
this.changeChannel.username = this.loginUser.userPhone
|
||||
this.changeChannel.unionId = uni.getStorageSync('unionId')
|
||||
} else {
|
||||
uni.showToast({
|
||||
title:'请求失败,请稍后再试',
|
||||
icon:'none'
|
||||
title: '请求失败,请稍后再试',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
},
|
||||
Splicing(list){
|
||||
Splicing(list) {
|
||||
let obj = {
|
||||
cuIcon: '',
|
||||
path: '',
|
||||
color: '',
|
||||
badge: 0,
|
||||
name:''
|
||||
name: ''
|
||||
}
|
||||
if(list.roleName == '扫码加油'){
|
||||
if (list.roleName == '扫码加油') {
|
||||
obj.cuIcon = 'scan',
|
||||
obj.path= '/pages/station-info/scan-camera/scan-camera',
|
||||
obj.color= 'olive',
|
||||
obj.badge= 0,
|
||||
obj.name=list.roleName
|
||||
}else if(list.roleName == '经营分析'){
|
||||
obj.path = '/pages/station-info/scan-camera/scan-camera',
|
||||
obj.color = 'olive',
|
||||
obj.badge = 0,
|
||||
obj.name = list.roleName
|
||||
} else if (list.roleName == '经营分析') {
|
||||
obj.cuIcon = 'new',
|
||||
obj.path= '',
|
||||
obj.color= 'orange',
|
||||
obj.badge= 0,
|
||||
obj.name=list.roleName
|
||||
}else if(list.roleName == '加油订单'){
|
||||
obj.path = '',
|
||||
obj.color = 'orange',
|
||||
obj.badge = 0,
|
||||
obj.name = list.roleName
|
||||
} else if (list.roleName == '加油订单') {
|
||||
obj.cuIcon = 'form',
|
||||
obj.path= '/packageOrders/pages/orderList/orderList',
|
||||
obj.color= 'yellow',
|
||||
obj.badge= 0,
|
||||
obj.name=list.roleName
|
||||
}else if(list.roleName == '油站二维码'){
|
||||
obj.path = '/packageOrders/pages/orderList/orderList',
|
||||
obj.color = 'yellow',
|
||||
obj.badge = 0,
|
||||
obj.name = list.roleName
|
||||
} else if (list.roleName == '油站二维码') {
|
||||
obj.cuIcon = 'qr_code',
|
||||
obj.path= '/packageQr/pages/qrsite/QrCode_xy',
|
||||
obj.color= 'cyan',
|
||||
obj.badge= 0,
|
||||
obj.name=list.roleName
|
||||
}else if(list.roleName == '员工管理'){
|
||||
obj.path = '/packageQr/pages/qrsite/QrCode_xy',
|
||||
obj.color = 'cyan',
|
||||
obj.badge = 0,
|
||||
obj.name = list.roleName
|
||||
} else if (list.roleName == '员工管理') {
|
||||
obj.cuIcon = 'expressman',
|
||||
obj.path= '/packageStaff/pages/staff/List/List',
|
||||
obj.color= 'mauve',
|
||||
obj.badge= 0,
|
||||
obj.name=list.roleName
|
||||
}else if(list.roleName == '油站信息'){
|
||||
obj.path = '/packageStaff/pages/staff/List/List',
|
||||
obj.color = 'mauve',
|
||||
obj.badge = 0,
|
||||
obj.name = list.roleName
|
||||
} else if (list.roleName == '油站信息') {
|
||||
obj.cuIcon = 'punch',
|
||||
obj.path= '/packageQr/pages/partnership/partnership',
|
||||
obj.color= 'blue',
|
||||
obj.badge= 0,
|
||||
obj.name=list.roleName
|
||||
}else if(list.roleName == '交易统计'){
|
||||
obj.path = '/packageQr/pages/partnership/partnership',
|
||||
obj.color = 'blue',
|
||||
obj.badge = 0,
|
||||
obj.name = list.roleName
|
||||
} else if (list.roleName == '交易统计') {
|
||||
obj.cuIcon = 'punch',
|
||||
obj.path= '/pages/TransactionStatistics/TransactionStatistics',
|
||||
obj.color= 'blue',
|
||||
obj.badge= 0,
|
||||
obj.name=list.roleName
|
||||
}else if(list.roleName == '星油云站超级管理员'){
|
||||
obj.path = '/pages/TransactionStatistics/TransactionStatistics',
|
||||
obj.color = 'blue',
|
||||
obj.badge = 0,
|
||||
obj.name = list.roleName
|
||||
} else if (list.roleName == '星油云站超级管理员') {
|
||||
obj.cuIcon = 'punch',
|
||||
obj.path= ' ',
|
||||
obj.color= 'blue',
|
||||
obj.badge= 0,
|
||||
obj.name=list.roleName
|
||||
obj.path = ' ',
|
||||
obj.color = 'blue',
|
||||
obj.badge = 0,
|
||||
obj.name = list.roleName
|
||||
}
|
||||
return obj
|
||||
},
|
||||
// getSiteInfo() {
|
||||
// //获取油站基本资料
|
||||
// oliSiteApi.getSiteDetail(this.channelId).then(res => {
|
||||
// //console.log('油站基本资料', res)
|
||||
// uni.stopPullDownRefresh();
|
||||
// if (res.code === 20000) {
|
||||
// // this.userAccount = res.data.oil
|
||||
// this.site = res.data.site
|
||||
// }
|
||||
// })
|
||||
// oliSiteApi.getSiteDetail(this.channelId)
|
||||
// },
|
||||
// getUserInfo() {
|
||||
// // 获取云站当前登录用户的基础资料
|
||||
// oliSiteApi.getSiteBasicData(this.channelId).then(res => {
|
||||
// //console.log('用户资料', res)
|
||||
// uni.stopPullDownRefresh();
|
||||
// if (res.code === 20000) {
|
||||
// uni.setStorageSync('ueserList',res.data)
|
||||
// this.userAccount = res.data
|
||||
// }
|
||||
// })
|
||||
|
||||
// oliSiteApi.getSiteBasicData(this.channelId)
|
||||
// },
|
||||
NavChange: function(e) {
|
||||
if(!this.checkLogin()) return
|
||||
if (!this.checkLogin()) return
|
||||
this.PageCur = e.currentTarget.dataset.cur
|
||||
if (this.PageCur == "scan") {
|
||||
this.scanQr()
|
||||
@@ -254,19 +249,12 @@
|
||||
},
|
||||
|
||||
scanQr() {
|
||||
var scanUrl
|
||||
let _that = this
|
||||
let scanUrl = ""
|
||||
this.menusList.forEach((item, index) => {
|
||||
if (item.name === '扫码加油') {
|
||||
scanUrl = '/pages/station-info/scan-camera/scan-camera'
|
||||
uni.navigateTo({
|
||||
url: scanUrl,
|
||||
fail: (err) => {
|
||||
|
||||
},
|
||||
success: (res) => {
|
||||
|
||||
}
|
||||
url: scanUrl
|
||||
})
|
||||
}
|
||||
if ((index == this.userMenu.length - 1) && !scanUrl) {
|
||||
|
||||
Reference in New Issue
Block a user