版本1.2.3

This commit is contained in:
xk_guohonglei
2020-10-14 11:40:08 +08:00
parent 80d2a48dec
commit 9320a99366
26 changed files with 2136 additions and 852 deletions

View File

@@ -1,184 +1,93 @@
<template>
<view class="content my-bg">
<cu-custom class="main-topbar bg-main-oil" bgColor="bg-main-oil">
<block slot="content">星油加油站</block>
</cu-custom>
<view class="main-money bg-main-oil">
<view class="padding-xs flex align-center">
<view class="flex-sub text-center padding-top-lg">
<view class="txet-xxs">
<text class="text-white">今日收款</text>
</view>
<view class=" text-sl padding padding-top-xs"><text class="text-white">{{userAccount.totalMoney|numberFilter}}</text></view>
</view>
</view>
<view class="page-content " :class="(PageCur=='home'||PageCur=='scan')?'my-bg':''">
<home v-if="PageCur=='home'||PageCur=='scan'" :user-account="userAccount" :site="site"></home>
<setup v-if="PageCur=='setup'"></setup>
<view class="action text-gray add-action" @tap="scanCode1" data-cur="scan">
<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>
</view>
<view class="bg-main-oil bg-main-color main-money">
</view>
<view class="bg-white radius margin-left margin-right to-top">
<view class=" flex ">
<view class="padding text-center flex-sub" @tap="routerTo('/pages/orderList/dailyOrder/dailyOrder')">
<text>今日收款笔数</text>
<view class="padding-sm">
<text class="oil-main-color">{{userAccount.totalCount}}</text>
</view>
<!-- <button class="cu-btn bg-main-oil text-white text-sm ">
查看明细
</button> -->
</view>
<view class="padding text-center flex-sub">
<text>账户余额</text>
<view class="padding-sm">
<view class="bottom-view">
<text class="oil-main-color">{{userAccount.totalMoney|numberFilter}}</text>
<view class="padding-top radius shadow bottom-bar-fixed">
<view class="cu-bar tabbar bg-white">
<view class="action text-gray" @tap="NavChange" data-cur="home">
<view class="cuIcon-homefill sl" :class="PageCur=='home'?'text-red':'text-gray'"></view>
<text :class="PageCur=='home'?'text-red':'text-gray'">
加油站
</text>
</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>
<text :class="PageCur=='scan'?'text-red':'text-gray'">
一键扫码
</text>
</view>
<!-- <button class="cu-btn bg-main-oil text-white text-sm ">
查看明细
</button> -->
</view>
</view>
</view>
<view class="cu-list grid col-3 no-border margin radius ">
<view class="cu-item" @tap="routerTo('/pages/station-info/station-info')">
<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>
<view class="action text-gray" @tap="NavChange" data-cur="setup">
<view class="cuIcon-peoplefill sl" :class="PageCur=='setup'?'text-red':'text-gray'"></view>
<text :class="PageCur=='setup'?'text-red':'text-gray'">
我的
</text>
</view>
</view>
<text>{{ cuIconList[0].name }}</text>
</view>
<view class="cu-item" v-for="(item,index) in userMenu" :key="item.menuId" @tap="routerTo(item.path,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>
</view>
</view>
<text>{{ item.name }}</text>
</view>
<!-- <view class="cu-item" @tap="routerTo('/pages/orderList/orderList')">
<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>
</view>
</view>
<text>{{ cuIconList[1].name }}</text>
</view>
<view class="cu-item">
<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>
<text>{{ cuIconList[2].name }}</text>
</view>
<view class="cu-item" @tap="scanQr">
<view :class="['cuIcon-' + cuIconList[3].cuIcon, 'text-' + cuIconList[3].color]" class="text-sl">
<view class="cu-tag badge" v-if="cuIconList[3].badge != 0">
<block v-if="cuIconList[3].badge != 1">{{ cuIconList[3].badge > 99 ? '99+' : cuIconList[3].badge }}</block>
</view>
</view>
<text>{{ cuIconList[3].name }}</text>
</view>
<view class="cu-item" @tap="routerTo('/pages/qrcode/QrCode_xy')">
<view :class="['cuIcon-' + cuIconList[4].cuIcon, 'text-' + cuIconList[4].color]" class="text-sl">
<view class="cu-tag badge" v-if="cuIconList[4].badge != 0">
<block v-if="cuIconList[4].badge != 1">{{ cuIconList[4].badge > 99 ? '99+' : cuIconList[4].badge }}</block>
</view>
</view>
<text>{{ cuIconList[4].name }}</text>
</view>-->
<view class="padding-bottom-xl">
</view>
</view>
</view>
</template>
<script>
import staffApi from '@/api/staff.js'
import cloudSiteApi from '@/api/cloud-site.js'
export default {
data() {
return {
PageCur: 'home',
userAccount: {
totalCount: 0,
totalMoney: 0.00
},
scanUrl: '',
userMenu: uni.getStorageSync('userMenu'),
loginUser: uni.getStorageSync('loginUser'),
title: 'Hello',
cuIconList: [{
cuIcon: 'location',
path: '/pages/station-info/station-info',
color: 'red',
badge: 0,
name: '油站信息'
},
{
cuIcon: 'form',
color: 'orange',
path: '/pages/orderList/orderList',
badge: 0,
name: '加油订单'
},
{
cuIcon: 'new',
path: '暂无',
color: 'yellow',
badge: 0,
name: '经营分析'
},
{
cuIcon: 'scan',
path: '/pages/stationDetail/stationDetail',
color: 'olive',
badge: 0,
name: '扫码加油'
},
{
cuIcon: 'qr_code',
color: 'cyan',
badge: 0,
path: '/pages/qrcode/QrCode_xy',
name: '油站二维码'
},
{
cuIcon: 'expressman',
color: 'red',
path: '暂无',
badge: 0,
name: '员工管理'
}
]
};
},
onLoad() {
uni.showShareMenu()
},
onShow() {
this.getUserInfo()
this.getSiteInfo()
site: {},
userMenu: uni.getStorageSync('userMenu')
}
},
onPullDownRefresh() {
this.getUserInfo()
},
filters: {
numberFilter(value) {
if (value) {
value = value - 1 + 1
return value.toFixed(2)
} else {
return '0.00'
}
onShow() {
const token = uni.getStorageSync('Authorization')
const openid = uni.getStorageSync('device')
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);
}
},
methods: {
scanCode1(){
uni.navigateTo({
url:'/pages/station-info/scan-camera/scan-camera'
})
},
getSiteInfo() {
cloudSiteApi.getSiteDetail().then(res => {
if (res.code === 20000) {
@@ -202,74 +111,50 @@
})
},
NavChange: function(e) {
this.PageCur = e.currentTarget.dataset.cur
if (this.PageCur == "scan") {
this.scanQr()
}
},
scanQr() {
var that = this
uni.scanCode({
onlyFromCamera: true,
success: function(res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
uni.setStorageSync('qrCode', res.result)
uni.navigateTo({
url: that.scanUrl,
fail: (err) => {
console.log(err)
},
success: (res) => {
console.log('chengg', res)
var scanUrl
this.userMenu.forEach((item, index) => {
if (item.name === '扫码加油') {
scanUrl = item.path
uni.scanCode({
onlyFromCamera: true,
success: function(res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
uni.setStorageSync('qrCode', res.result)
uni.navigateTo({
url: scanUrl,
fail: (err) => {
console.log(err)
},
success: (res) => {
console.log('chengg', res)
}
})
}
})
},
// 方便测试
// complete: () => {
// uni.setStorageSync('qrCode', 'XM&1309328197641433088')
// uni.navigateTo({
// url: that.scanUrl,
// fail: (err) => {
// console.log(err)
// },
// success: (res) => {
// console.log('chengg', res)
// }
// })
// }
}
if ((index == this.userMenu.length - 1) && !scanUrl) {
uni.showToast({
title: '抱歉,您没有扫码权限',
icon: 'none'
})
}
})
},
// 方便开发
// scanQr() {
// uni.setStorageSync('qrCode', 'XM&1299257961238990848')
// uni.navigateTo({
// url: '/pages/stationDetail/stationDetail',
// fail: (err) => {
// console.log(err)
// },
// success: (res) => {
// console.log('chengg', res)
// }
// })
// },
routerTo(url, name) {
if (name === '扫码加油') {
this.scanUrl = url
this.scanQr()
} else {
uni.navigateTo({
url: url
})
}
}
}
};
}
</script>
<style scoped>
.content {
height: 100%;
}
.bottom-bar {
position: relative;
padding-top: 50px;
@@ -277,15 +162,6 @@
margin-top: 0;
}
.main-topbar>>>.cu-bar {
height: 380rpx !important;
z-index: 0 !important;
}
.main-topbar>>>.cu-bar .content {
padding-bottom: 300rpx;
}
.bottom-bar-fixed {
position: fixed;
bottom: 0;
@@ -293,40 +169,7 @@
width: 100%;
}
.main-money {
position: relative;
z-index: 1;
}
.van-tag {
display: inline-block;
padding: 0.3rem 0.4rem;
position: absolute;
right: 1px;
font-size: 12px;
top: 25%;
background-color: #b9ffca;
border-radius: 10rem 0 0 10rem;
border-color: transparent;
}
.bg-main-color {
min-height: 160rpx;
}
.to-top {
position: relative;
top: -140rpx;
z-index: 1;
}
.cu-list {
position: relative;
top: -140rpx;
z-index: 1;
}
.cu-list.grid>.cu-item [class*=cuIcon] {
font-size: 75rpx;
.bottom-view {
max-height: 200rpx;
}
</style>