xiaozy_星油统一加油码
xiaozhiyong 2 years ago
parent 6150eb2b67
commit 1f3346e209
  1. 98
      pages/home/home.vue
  2. 88
      pages/index/index.vue

@ -12,7 +12,8 @@
<text class="text-white">今日收款</text>
</view>
<!-- <view class="" @tap='changess'>butns</view> -->
<view class=" text-sl padding padding-top-xs"><text class="text-white">{{userAccount.totalMoney|numberFilter}}</text></view>
<view class=" text-sl padding padding-top-xs"><text
class="text-white">{{userAccount.totalMoney|numberFilter}}</text></view>
</view>
</view>
</view>
@ -24,7 +25,7 @@
@tap="routerTo('/packageOrders/pages/orderList/dailyOrder/dailyOrder')">
<text>今日收款笔数</text>
<view class="padding-sm">
<text class="oil-main-color">{{userAccount.totalCount}}</text>
<text class="oil-main-color">{{userAccount.totalCount || 0}}</text>
</view>
<!-- <button class="cu-btn bg-main-oil text-white text-sm ">
查看明细
@ -43,11 +44,15 @@
</view>
<view class="showMainBox cu-list bg-white margin radius " style='z-index: 0;'>
<view class="foldOrExpand" v-if='SiteOliInfo.length>2'>
<view class="fold checkF" v-if='checkForE' @click='showOrNo(false) '>折叠 <image src="../../static/img/zdU.png" mode="" class="showMainBox_item_top_img"></image></view>
<view class="Expand checkF" v-if='!checkForE' @click='showOrNo(true) '>展开 <image src="../../static/img/zdD.png" mode="" class="showMainBox_item_top_img"></image></view>
<view class="fold checkF" v-if='checkForE' @click='showOrNo(false) '>折叠 <image
src="../../static/img/zdU.png" mode="" class="showMainBox_item_top_img"></image>
</view>
<view class="showMainBox_main" :style="{ height: showHeight}" >
<view class="showMainBox_item" v-for='(item,i) in SiteOliInfo' :key='i' v-if='SiteOliInfo.length'>
<view class="Expand checkF" v-if='!checkForE' @click='showOrNo(true) '>展开 <image
src="../../static/img/zdD.png" mode="" class="showMainBox_item_top_img"></image>
</view>
</view>
<view v-if='SiteOliInfo.length' class="showMainBox_main" :style="{ height: showHeight}">
<view class="showMainBox_item" v-for='(item,i) in SiteOliInfo' :key='i'>
<view class="showMainBox_item_left">
<view class="showMainBox_item_left_title">{{item.oilProductCode}} </view>
<view class="showMainBox_item_left_tag">
@ -70,12 +75,14 @@
<view :class="['cuIcon-' + cuIconList[0].cuIcon, 'text-' + cuIconList[0].color]" class="text-sl">
<view class="cu-tag badge" v-if="cuIconList[0].badge != 0">
<block v-if="cuIconList[0].badge != 1">
{{ cuIconList[0].badge > 99 ? '99+' : cuIconList[0].badge }}</block>
{{ cuIconList[0].badge > 99 ? '99+' : cuIconList[0].badge }}
</block>
</view>
</view>
<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 != "星油云站超级管理员"' >
<view class="cu-item" v-for="(item,index) in menusList" :key="index" @tap="routerTo(item.path)"
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>
@ -87,12 +94,14 @@
<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">
{{ cuIconList[1].badge > 99 ? '99+' : cuIconList[1].badge }}</block>
{{ cuIconList[1].badge > 99 ? '99+' : cuIconList[1].badge }}
</block>
</view>
</view>
<text>{{ cuIconList[1].name }}</text>
</view>
<view style="height: 180rpx;display: flex;justify-content: flex-end;" class="cu-item" @tap="routerTo('/pages/escalation/escalation')">
<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">
@ -141,10 +150,12 @@
</view>
</view>
<view class="text-left padding-xl padding-bottom padding-top bg-white">
<view class="flex align-center justify-between margin-bottom-sm " v-for="(list,i) in oliList" :key='list'>
<view class="flex align-center justify-between margin-bottom-sm " v-for="(list,i) in oliList"
:key='list'>
<view class=""> {{list.otherSiteName}}</view>
<view class="">
<view class=" bg-red cu-btn text-white text-center btn-radius-10 text-sm" @tap="checkLists(list)">
<view class=" bg-red cu-btn text-white text-center btn-radius-10 text-sm"
@tap="checkLists(list)">
进入
</view>
</view>
@ -163,10 +174,12 @@
</view>
</view>
<view class="text-left padding-xl padding-bottom padding-top bg-white">
<view class="flex align-center justify-between margin-bottom-sm " v-for="(list,i) in oliList" :key='list'>
<view class="flex align-center justify-between margin-bottom-sm " v-for="(list,i) in oliList"
:key='list'>
<view class=""> {{list.otherSiteName}}</view>
<view class="">
<view class=" bg-red cu-btn text-white text-center btn-radius-10 text-sm" @tap="checkLists(list)">
<view class=" bg-red cu-btn text-white text-center btn-radius-10 text-sm"
@tap="checkLists(list)">
进入
</view>
</view>
@ -332,20 +345,14 @@
},
changeMenuList(data) { // menus
const Menus = data
console.log(data,'1111111111111111111111111111111111111111')
console.log('这里是接收menus处',Menus)
let menusList = []
Menus.forEach((item, index, Menus) => {
if (item.roleName != 'ROOT') {
// this.Splicing(item)
menusList.push(this.Splicing(item)) //menus
}
})
uni.setStorageSync('menusChangeList', menusList)
this.menusList = uni.getStorageSync('menusChangeList')
// this.$emit('changMenus',menusList)
//console.log('',menusList)
},
Splicing(list) {
let obj = {
@ -433,19 +440,16 @@
})
},
hidecheckList() {
//console.log('')
this.checkList = ''
this.checkFirst = false
},
checkLists(items) {
// //console.log(items)
let id = items.channelId
this.changeChannel.channelId = items.channelId
this.changeChannel.unionId = uni.getStorageSync('unionId')
this.changeChannel.username = this.loginUser.userPhone
uni.setStorageSync('channelId', items.channelId)
oilIdentityApi.changeChannelLogin(this.changeChannel).then((res) => {
// //console.log(res)
if (res.code == 20000) {
uni.setStorageSync('siteOli', items.otherSiteName)
this.accountName = items.otherSiteName
@ -460,7 +464,6 @@
name: res.data.authTokenDTO.loginUser.name,
userPhone: res.data.authTokenDTO.loginUser.userPhone
})
//console.log(res.data.authTokenDTO.loginUser.channelId)
this.getSiteInfo(res.data.authTokenDTO.loginUser.channelId)
this.getUserInfo(id)
this.changeMenuList(res.data.authTokenDTO.loginUser.roleMenus)
@ -473,10 +476,8 @@
},
//
getUserInfo(id) {
console.log('获取油站基本资料')
//
oliSiteApi.getSiteBasicData(id).then(res => {
//console.log('', res)
uni.stopPullDownRefresh();
if (res.code === 20000) {
uni.setStorageSync('ueserList', res.data)
@ -485,14 +486,11 @@
})
},
showLists() {
if (!this.checkLogin()) return
let phoneNumber = this.loginUser.userPhone,
_that = this
oliUserApi.getByPhone(phoneNumber).then((res) => {
//console.log('')
//console.log('',res)
if (res.code == 20000) {
//console.log(res.data.length)
if (res.data.length < 2) {
uni.showToast({
title: '当前只有一个油站,不可切换',
@ -513,7 +511,6 @@
}
})
//console.log(this.loginUser)
},
scanQr() {
var scanUrl
@ -541,9 +538,26 @@
// }
// })
// },
checkLogin() {
const token = uni.getStorageSync('Authorization')
if (!token) {
uni.showModal({
content: '您还没有登录哦',
confirmText: '前往登录',
success: res => {
if (res.confirm) {
uni.reLaunch({
url: '/pages/login/boforeLogin/boforeLogin'
})
}
}
})
return false
}
return true
},
routerTo(url, name) {
//console.log(url,name)
console.log(url)
if (!this.checkLogin()) return
if (url == '') {
uni.showToast({
title: '暂时无法使用...',
@ -561,8 +575,8 @@
}
}
}
,onShow() {
},
onShow() {
//console.log('show')
},
watch: {
@ -594,38 +608,45 @@
.showMainBox_main {
width: 100%;
}
.showMainBox_item_top_img {
width: 40rpx;
height: 40rpx;
margin-left: 2%;
}
.foldOrExpand {
width: 100%;
padding: 2% 3%;
border-bottom: 1px solid #eeee;
}
.foldOrExpand .checkF {
display: flex;
justify-content: flex-end;
align-items: center;
transition: all linear .3s;
}
.color-red {
color: #f70e0e;
font-weight: 700;
font-size: 35rpx;
margin-left: 3%;
}
.showMainBox_item_right_img {
width: 70rpx;
height: 70rpx;
}
.showMainBox_item_left_tag_money {
font-size: 25rpx;
width: 47%;
}
.showMainBox_item {
display: flex;
justify-content: space-between;
@ -635,6 +656,7 @@
box-sizing: border-box;
border-bottom: 2rpx solid #eee;
}
.showMainBox_item_left_tag {
display: flex;
justify-content: space-between;
@ -642,11 +664,13 @@
width: 90%;
margin-top: 2%;
}
.showMainBox_item_left_title {
color: #333;
font-size: 36rpx;
}
.showMainBox_item_left {
display: flex;
justify-content: flex-start;
@ -655,20 +679,24 @@
width: 90%;
flex: 0 0 auto;
}
.showMainBox {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
}
.content {
height: 100%;
}
.listBox {
display: flex;
justify-content: flex-start;
align-items: center;
}
.bottom-bar {
position: relative;
padding-top: 50px;

@ -64,75 +64,73 @@
})
},
onShow() {
// uni.showToast({
// title:'show'
// })
//console.log('indexonshow')
uni.setStorageSync('orderType',null)
// uni.preloadPage({url: "/pages/station-info/scan-camera/scan-camera"});
const token = uni.getStorageSync('Authorization')
const openid = uni.getStorageSync('device')
// //console.log('++++++++++++')
// //console.log(token)
// //console.log(openid)
// //console.log('++++++++++++')
if (token && openid) {
// this.getUserInfo()
// this.getSiteInfo()
} else {
uni.showToast({
title: '您还没有登录哦',
icon: "none"
})
setTimeout(function() {
uni.reLaunch({
url: '/pages/login/boforeLogin/boforeLogin',
success: () => {
//console.log('')
},
fail: (err) => {
//console.log(err)
}
})
}, 1500);
// uni.showToast({
// title: '',
// icon: "none"
// })
// setTimeout(function() {
// uni.reLaunch({
// url: '/pages/login/boforeLogin/boforeLogin',
// success: () => {
// //console.log('')
// },
// fail: (err) => {
// //console.log(err)
// }
// })
// }, 1500);
}
},
onLoad() {
// uni.showToast({
// title:'onLoad'
// })
// uni.navigateTo({
// url:'/pages/stationDetail/ZYSite'
// })
const token = uni.getStorageSync('Authorization')
if(!token) return
let _that =this
const Menus = uni.getStorageSync('userMenu')
//console.log('menus',Menus)
let menusList = []
Menus.forEach((item,index,Menus)=>{
if(item.roleName != 'ROOT' ){
// this.Splicing(item)
menusList.push(this.Splicing(item))
}
})
//console.log('menusLisPush',menusList)
// uni.setStorageSync('menusLists',menusList)
let check = uni.getStorageSync('checkFirst')
//console.log(check)
if(check){
_that.checkUser = true
}
uni.setStorageSync('menusChangeList',menusList)
this.menusList = menusList
//console.log('menusfor',this.menusList)
// this.getUserInfo()
this.longiCheck()
// //console.log('++++++++')
//console.log('menus',this.menusList)
this.getPosition()
},
methods: {
checkLogin() {
const token = uni.getStorageSync('Authorization')
if (!token) {
uni.showModal({
content: '您还没有登录哦',
confirmText: '前往登录',
success: res => {
if (res.confirm) {
uni.reLaunch({
url: '/pages/login/boforeLogin/boforeLogin'
})
}
}
})
return false
}
return true
},
getPosition(){
console.log('getPositiongetPositiongetPositiongetPosition')
let that = this
uni.getLocation({
type: 'gcj02',
@ -145,15 +143,12 @@
});
},
changMenus(data){
//console.log('+++++',data)
this.menusList =data
},
longiCheck(){
let userInfo = uni.getStorageSync('loginUser'),
_that =this
//console.log(userInfo)
oliUserApi.getByPhone(userInfo.userPhone).then((res)=>{
//console.log('')
if(res.code == 20000){
_that.checkList = 'show'
_that.oliList = res.data
@ -251,6 +246,7 @@
// },
NavChange: function(e) {
if(!this.checkLogin()) return
this.PageCur = e.currentTarget.dataset.cur
if (this.PageCur == "scan") {
this.scanQr()
@ -261,21 +257,15 @@
var scanUrl
let _that = this
this.menusList.forEach((item, index) => {
//console.log('1')
//console.log(index)
//console.log(_that.userMenu)
//console.log(item.name)
//console.log('2')
if (item.name === '扫码加油') {
// scanUrl = item.path
scanUrl = '/pages/station-info/scan-camera/scan-camera'
uni.navigateTo({
url: scanUrl,
fail: (err) => {
// //console.log(err)
},
success: (res) => {
// //console.log('chengg', res)
}
})
}

Loading…
Cancel
Save