This commit is contained in:
xiaozhiyong
2023-12-12 15:05:37 +08:00
parent 3bd60fe2bd
commit d2878369d4
6 changed files with 612 additions and 177 deletions

View File

@@ -82,7 +82,7 @@
<text>{{ cuIconList[0].name }}</text>
</view>
<view class="cu-item" v-for="(item,index) in menusList" :key="index" @tap="routerTo(item.path)"
v-if=' item.name != "星油云站超级管理员"'>
v-if='item.name != "星油云站超级管理员"'>
<view :class="['cuIcon-' + item.cuIcon, 'text-' + cuIconList[index+1].color]" class="text-sl">
<view class="cu-tag badge" v-if="item.badge != 0">
<block v-if="item.badge != 1">{{ item.badge > 99 ? '99+' : item.badge }}</block>
@@ -90,7 +90,7 @@
</view>
<text>{{ item.name }}</text>
</view>
<view class="cu-item" @tap="routerTo('/pages/station-price/station-price')">
<!-- <view class="cu-item" @tap="routerTo('/pages/station-price/station-price')">
<view :class="['cuIcon-' + cuIconList[1].cuIcon, 'text-' + cuIconList[1].color]" class="text-sl">
<view class="cu-tag badge" v-if="cuIconList[1].badge != 0">
<block v-if="cuIconList[1].badge != 1">
@@ -99,15 +99,10 @@
</view>
</view>
<text>{{ cuIconList[1].name }}</text>
</view>
</view> -->
<view style="height: 180rpx;display: flex;justify-content: flex-end;" class="cu-item"
@tap="routerTo('/pages/escalation/escalation')">
<!-- <view :class="['cuIcon-' + cuIconList[2].cuIcon, 'text-' + cuIconList[2].color]" class="text-sl">
<view class="cu-tag badge" v-if="cuIconList[2].badge != 0">
<block v-if="cuIconList[2].badge != 1">
{{ cuIconList[2].badge > 99 ? '99+' : cuIconList[2].badge }}</block>
</view>
</view> -->
<view>
<image style="width: 50rpx;height: 50rpx;" src="/static/img/dzsb.png"></image>
</view>
@@ -279,7 +274,6 @@
path: '/packageQr/pages/qrsite/QrCode_xy',
name: '油站二维码'
},
{
cuIcon: 'punch',
path: '/packageQr/pages/partnership/partnership',
@@ -301,16 +295,18 @@
badge: 0,
name: '交易统计'
},
]
};
},
onLoad() {
//console.log('这里是home')
const Menus = uni.getStorageSync('userMenu')
this.fistCheck()
// created() {
// let a = uni.getStorageSync('menusChangeList')
// console.log('aaaaaaaaa',a)
// },
created() {
let a = uni.getStorageSync('menusChangeList')
console.log('aaaaaaaaa',a)
this.checkInfo()
},
filters: {
numberFilter(value) {
@@ -346,6 +342,7 @@
changeMenuList(data) { //这里是切换处 更新权限menus处
const Menus = data
let menusList = []
// console.log('data',data)
Menus.forEach((item, index, Menus) => {
if (item.roleName != 'ROOT') {
menusList.push(this.Splicing(item)) //根据menus做处理
@@ -353,6 +350,7 @@
})
uni.setStorageSync('menusChangeList', menusList)
this.menusList = uni.getStorageSync('menusChangeList')
this.$emit('changMenus', this.menusList)
},
Splicing(list) {
let obj = {
@@ -374,6 +372,13 @@
obj.color = 'orange',
obj.badge = 0,
obj.name = list.roleName
} else if (list.roleName == '促销优惠') {
obj.cuIcon = 'moneybag',
obj.path = '',
// /pages/station-price/station-price
obj.color = 'orange',
obj.badge = 0,
obj.name = list.roleName
} else if (list.roleName == '加油订单') {
obj.cuIcon = 'form',
obj.path = '/packageOrders/pages/orderList/orderList',
@@ -410,6 +415,12 @@
obj.color = 'blue',
obj.badge = 0,
obj.name = list.roleName
} else if (list.roleName == '账单推送') {
obj.cuIcon = 'punch',
obj.path = '/packageBill/push/index',
obj.color = 'blue',
obj.badge = 0
obj.name = list.roleName
}
return obj
},
@@ -426,7 +437,7 @@
oliSiteApi.getSiteDetail(channelId).then(res => {
// //console.log(res)
if (res.code === 20000) {
console.log(res.data.oil)
// console.log(res.data.oil)
this.sitInfo = res.data.site
this.SiteOliInfo = res.data.oil
if (res.data.oil.length < 3) {
@@ -467,6 +478,9 @@
this.getSiteInfo(res.data.authTokenDTO.loginUser.channelId)
this.getUserInfo(id)
this.changeMenuList(res.data.authTokenDTO.loginUser.roleMenus)
} else if (res.code == 40000) {
uni.navigateTo({
url: '/pages/login/boforeLogin/boforeLogin'
@@ -513,8 +527,7 @@
})
},
scanQr() {
var scanUrl
scanUrl = '/pages/station-info/scan-camera/scan-camera'
let scanUrl = '/pages/station-info/scan-camera/scan-camera'
uni.navigateTo({
url: scanUrl,
fail: (err) => {
@@ -525,19 +538,7 @@
},
})
},
// 方便开发
// scanQr() {
// uni.setStorageSync('qrCode', 'XM&1299257961238990848')
// uni.navigateTo({
// url: '/pages/stationDetail/stationDetail',
// fail: (err) => {
// //console.log(err)
// },
// success: (res) => {
// //console.log('chengg', res)
// }
// })
// },
checkLogin() {
const token = uni.getStorageSync('Authorization')
if (!token) {
@@ -592,13 +593,6 @@
}
}
},
created() {
// 此页面onshow无法执行生命周期需要,需要走created
//console.log('这里是created')
//console.log(this.menusList)
this.checkInfo()
}
};

View File

@@ -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) {

View File

@@ -105,7 +105,7 @@
scanType: 'qrCode',
onlyFromCamera: false,
success: (resResult) => {
console.log('%c 扫码结果↓','color:red;font-size:30px')
console.log('%c 扫码结果↓', 'color:red;font-size:30px')
console.log(resResult)
// innerAudioContext.play()
console.log('play滴~')
@@ -117,38 +117,38 @@
// console.log('这里是顺丰测试',res.substring(0,7))
const tag = res.substring(0, 2);
// 老星油 XM HT G7 则一 ZEYI 新星油 XOIL new则一 XINGYOU
if (res.indexOf('fykc') != -1 ){
url = '/pages/stationDetail/ZYSite?type=fykc'
console.log('这里是测试福佑' ,res.substring(0,7))
}else if (tag == "SP") {
url = '/pages/stationDetail/ZYSite?type=G7'
} else if (tag == "XM" || tag == "HT" || tag == "G7") {
if (res.indexOf('fykc') != -1) {
url = '/pages/stationDetail/ZYSite?type=fykc'
console.log('这里是测试福佑', res.substring(0, 7))
} else if (tag == "SP") {
url = '/pages/stationDetail/ZYSite?type=G7'
} else if (tag == "XM" || tag == "HT" || tag == "G7") {
url = '/pages/stationDetail/stationDetail?type=G7'
} else if (res.indexOf('ZEYI') != -1 ){
console.log('这里是测试则一sss' ,res.substring(0,7))
url = '/pages/stationDetail/ZYSite?type=ZEYI'
} else if (res.substring(0, 4) == 'XING' || res.substring(0, 4) == 'XOIL' ) {
console.log('这里是测试XING' ,res.substring(0,7))
url = '/pages/stationDetail/ZYSite?type=xoli'
} else if (res.substring(0,8) == 'SHUNFENG') {
} else if (res.indexOf('ZEYI') != -1) {
console.log('这里是测试则一sss', res.substring(0, 7))
url = '/pages/stationDetail/ZYSite?type=ZEYI'
} else if (res.substring(0, 4) == 'XING' || res.substring(0, 4) == 'XOIL') {
console.log('这里是测试XING', res.substring(0, 7))
url = '/pages/stationDetail/ZYSite?type=xoli'
} else if (res.substring(0, 8) == 'SHUNFENG') {
console.log('这里是顺丰')
url = '/pages/stationDetail/ZYSite?type=shunfeng'
} else if (res.substring(0, 4) == 'RIRI'){
url = '/pages/stationDetail/ZYSite?type=RIRISHUN'
} else if (res.indexOf('OP') != -1 ){
url = '/pages/stationDetail/openStationDetail'
}else{
} else if (res.substring(0, 4) == 'RIRI') {
url = '/pages/stationDetail/ZYSite?type=RIRISHUN'
} else if (res.indexOf('OP') != -1) {
url = '/pages/stationDetail/openStationDetail'
} else {
uni.showToast({
title: '未知二维码',
icon: 'none'
})
setTimeout(() => {
uni.navigateBack({
})
uni.navigateBack({})
}, 800)
return false;
}
console.log(tag)
// url = '/pages/stationDetail/openStationDetail'
// console.log(tag)
uni.redirectTo({
// url: `/pages/stationDetail/stationDetail`,
url: url,