pull/2/head
xiaozhiyong 2 years ago
parent c50f14f14c
commit 4164ce1b5c
  1. 3
      .env.development
  2. 4
      public/index.html
  3. 51
      src/App.vue
  4. 1
      src/permission.js
  5. 9
      src/utils/auth.js
  6. 4
      src/utils/request.js
  7. 3
      src/views/cashier/cashierIndex.vue
  8. 118
      src/views/cashier/paymentl.vue

@ -12,8 +12,9 @@ VUE_APP_UPLOAD_PRIVATE_URL = '/api/oil-dict/imageHandler/uploadProtectedImg'
VUE_APP_DOMAIN = '192.168.0.150:38080' VUE_APP_DOMAIN = '192.168.0.150:38080'
# 开发环境,不会进行加密,会打印出数据 # 开发环境,不会进行加密,会打印出数据
VUE_APP_ENV = 'development' VUE_APP_ENV = 'production'
#production #production
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true
# http://192.168.1.86:9528/h5/#/home?token=0fbdf930-21b8-47f6-be6e-fc9c65045424

@ -31,8 +31,8 @@
}) })
</script> </script>
<script src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.9.0/vconsole.min.js"></script> <!-- <script src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.9.0/vconsole.min.js"></script>
<script> <script>
var vConsole = new VConsole() var vConsole = new VConsole()
console.log('Hello world') console.log('Hello world')
</script> </script> -->

@ -1,20 +1,26 @@
<template> <template>
<div id="app"> <div id="app">
<van-nav-bar v-if="!$route.meta?.closeNavBar" <van-nav-bar
style="background-color: #ff6700 !important;color: #ffffff !important;" :title="navData.meta.title" v-if="!$route.meta?.closeNavBar"
:border="false" :left-arrow="navData.path == '/' ? false : true" @click-left="onClickLeft" style="background-color: #ff6700 !important; color: #ffffff !important"
@click-right="onClickRight" /> :title="navData.meta.title"
:border="false"
:left-arrow="navData.path == '/' ? false : true"
@click-left="onClickLeft"
@click-right="onClickRight"
/>
<transition :name="silderName"> <transition :name="silderName">
<keep-alive :include="['HomeView']" > <keep-alive :include="['HomeView']">
<router-view :style="{ height: navData.path == '/' ? '' : 'calc(100vh - 46px)' }" class="routerView" ></router-view> <router-view :style="{ height: navData.path == '/' ? '' : 'calc(100vh - 46px)' }" class="routerView"></router-view>
</keep-alive> </keep-alive>
</transition> </transition>
<!-- <transition :name="silderName"> <!-- <transition :name="silderName">
<router-view :style="{ height: navData.path == '/' ? '' : 'calc(100vh - 46px)' }" class="routerView"></router-view> <router-view :style="{ height: navData.path == '/' ? '' : 'calc(100vh - 46px)' }" class="routerView"></router-view>
</transition> --> </transition> -->
</div> </div>
</template> </template>
<script> <script>
// import encode from 'utils/encode.js'
export default { export default {
data() { data() {
return { return {
@ -28,37 +34,42 @@ export default {
msg: process.env.VUE_APP_ENV msg: process.env.VUE_APP_ENV
} }
}, },
created() { // created() {
}, // console.log(
mounted() { // encode.encrypt(
}, // JSON.stringify({
// phone: '15098877777',
// companyId: '1644149961976160256'
// })
// )
// )
// console.log(encode.decrypt('PS3WM/yuXTO39U3trxsIv3MR6bQet5PgwiSo/BpGoEC7oQ4a8dtxItMPtba5ho/O5xU3x2NsNr4H6OkELDRKFxDn9OsDQq7CsMXiu/MUMKw='))
// },
mounted() {},
watch: { watch: {
$route: function (t, f) { $route: function (t, f) {
this.navData = t this.navData = t
if (t.meta.index > f.meta.index) { if (t.meta.index > f.meta.index) {
this.silderName = 'slide-right'; this.silderName = 'slide-right'
} else { } else {
this.silderName = 'slide-left'; this.silderName = 'slide-left'
} }
} }
}, },
methods: { methods: {
routerBar(){ routerBar() {},
},
onClickLeft() { onClickLeft() {
this.$router.back() this.$router.back()
// this.$notify(''); // this.$notify('');
}, },
onClickRight() { onClickRight() {
console.log('点击按钮') console.log('点击按钮')
}, }
}, }
} }
</script> </script>
<style> <style>
.sa{ .sa {
justify-content: space-around; justify-content: space-around;
} }
.bw { .bw {

@ -31,6 +31,7 @@ router.beforeEach(async (to, from, next) => {
// ) // )
let paramsTarget = obtainUrlPathParameterTarget(location.href) let paramsTarget = obtainUrlPathParameterTarget(location.href)
if (paramsTarget.token) { if (paramsTarget.token) {
// sessionStorage.setItem('h5Token',)
setToken(paramsTarget.token) setToken(paramsTarget.token)
store.getUser() store.getUser()
next() next()

@ -1,21 +1,22 @@
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
const TokenKey = 'Authorization' let tokenKey = 'h5Token'
// const TokenKey = 'Authorization'
// const NetWorkId = 'networkId' // const NetWorkId = 'networkId'
// const UserName = 'username' // const UserName = 'username'
// const PassWord = 'password' // const PassWord = 'password'
// const Checked = 'checked' // const Checked = 'checked'
export function getToken() { export function getToken() {
return Cookies.get(TokenKey) return sessionStorage.getItem(tokenKey)
} }
export function setToken(token) { export function setToken(token) {
return Cookies.set(TokenKey, token, { expires: 1 }) sessionStorage.setItem(tokenKey, token)
} }
export function removeToken() { export function removeToken() {
return Cookies.remove(TokenKey) sessionStorage.removeItem(tokenKey)
} }
// export function setNet(networkId) { // export function setNet(networkId) {

@ -54,7 +54,7 @@ service.interceptors.response.use(
// if (!contentType.includes('application/json')) return res // if (!contentType.includes('application/json')) return res
if (env === 'production') { if (env === 'production') {
res.data = JSON.parse(encode.decrypt(res.data)) res.data = res.data ? JSON.parse(encode.decrypt(res.data)) : {}
} }
if (res && res.code) { if (res && res.code) {
@ -73,7 +73,7 @@ service.interceptors.response.use(
}) })
return return
} }
if (![20000].includes(res.code)) { if (![20000, 40000].includes(res.code)) {
console.log('code码:' + res.code) console.log('code码:' + res.code)
Notify({ Notify({
message: res.msg || '操作失败', message: res.msg || '操作失败',

@ -93,7 +93,6 @@ export default {
}, },
created() { created() {
this.orderData = JSON.parse(this.$route.query.order) this.orderData = JSON.parse(this.$route.query.order)
console.log('this.orderData', this.orderData)
this.time = this.getCountDownTime(this.orderData.createTime) this.time = this.getCountDownTime(this.orderData.createTime)
this.updateDetails() this.updateDetails()
@ -102,7 +101,6 @@ export default {
methods: { methods: {
cardListFn() { cardListFn() {
let networkId = this.$pinia.state.value.user.user?.networkId let networkId = this.$pinia.state.value.user.user?.networkId
// console.log('this.$pinia.value', networkId)
let company = this.orderData.companyAccounts let company = this.orderData.companyAccounts
? this.orderData.companyAccounts ? this.orderData.companyAccounts
.filter(item => { .filter(item => {
@ -123,7 +121,6 @@ export default {
return item return item
}) })
: [] : []
console.log('other', other)
this.cardList = [...company, ...other] this.cardList = [...company, ...other]
}, },
updateDetails() { updateDetails() {

@ -1,18 +1,18 @@
<template> <template>
<div class="paymentl"> <div class="paymentl">
<detailsCardHeader :countTimer='countTimer' :codeTpe="codeTpe" ></detailsCardHeader> <detailsCardHeader :countTimer="countTimer" :codeTpe="codeTpe"></detailsCardHeader>
<detailsCard :detailsList="detailsList"></detailsCard> <detailsCard :detailsList="detailsList"></detailsCard>
<div @click="goHome" class="paymentl-footer flex ac jc">返回首页</div> <div @click="goHome" class="paymentl-footer flex ac jc">返回首页</div>
</div> </div>
</template> </template>
<script> <script>
import vueQr from 'vue-qr' import vueQr from 'vue-qr'
import detailsCard from "./components/detailsCard.vue"; import detailsCard from './components/detailsCard.vue'
import detailsCardHeader from "./components/detailsCardHeader.vue"; import detailsCardHeader from './components/detailsCardHeader.vue'
import oilSiteApi from '@/api/oil-site.js'; import oilSiteApi from '@/api/oil-site.js'
import useStore from '@/store/piniaIndex'; import useStore from '@/store/piniaIndex'
let store = useStore(); let store = useStore()
export default { export default {
components: { components: {
detailsCard, detailsCard,
@ -21,13 +21,13 @@ export default {
}, },
data() { data() {
return { return {
user:store.user, user: store.user,
countTimer:180, countTimer: 180,
timer:null, timer: null,
codeTpe:{ codeTpe: {
switch:false, switch: false,
codeValue:'', codeValue: '',
imgType:true imgType: true
}, },
detailsCardTitle: {}, detailsCardTitle: {},
detailsList: [ detailsList: [
@ -38,7 +38,7 @@ export default {
valueStyle: { valueStyle: {
color: '' color: ''
} }
}, }
], ],
[ [
{ {
@ -56,7 +56,7 @@ export default {
{ {
lable: '加油员:', lable: '加油员:',
value: '李某' value: '李某'
}, }
// { // {
// lable: '', // lable: '',
// value: ' ' // value: ' '
@ -81,7 +81,7 @@ export default {
valueStyle: { valueStyle: {
color: '#FF0000' color: '#FF0000'
} }
}, }
], ],
[ [
{ {
@ -90,73 +90,71 @@ export default {
}, },
{ {
lable: '加油司机:', lable: '加油司机:',
value: (store.user&&store.user.name)||'---', value: (store.user && store.user.name) || '---'
}, },
{ {
lable: '油卡性质:', lable: '油卡性质:',
value: '企业油卡', value: '企业油卡'
}, }
], ]
] ]
}; }
}, },
created(){ created() {
console.log(this.user,'user') // console.log(this.user,'user')
this.init() this.init()
}, },
watch:{ watch: {
countTimer:function(n){ countTimer: function (n) {}
}
}, },
methods:{ methods: {
init(){ init() {
this.orderData = JSON.parse(this.$route.query.orderData) this.orderData = JSON.parse(this.$route.query.orderData)
this.codeTpe.imgType = JSON.parse(this.$route.query.type) this.codeTpe.imgType = JSON.parse(this.$route.query.type)
console.log(this.codeTpe.imgType) console.log(this.codeTpe)
this.getCode(); this.getCode()
this.updateDetails(); this.updateDetails()
}, },
Timekeeping(){ Timekeeping() {
this.countTimer = 180000 this.countTimer = 180000
this.timer = setInterval(()=>{ this.timer = setInterval(() => {
if(this.countTimer==0){ if (this.countTimer == 0) {
clearInterval(this.timer); clearInterval(this.timer)
this.getCode() this.getCode()
return return
} }
this.countTimer-=10; this.countTimer -= 10
},10) }, 10)
}, },
goHome(){ goHome() {
this.$router.push('/') this.$router.push('/')
}, },
updateDetails(){ updateDetails() {
this.detailsList[0][0].value = this.orderData.orderSerialNumber; this.detailsList[0][0].value = this.orderData.orderSerialNumber
this.detailsList[1][0].value = this.orderData.siteName ; this.detailsList[1][0].value = this.orderData.siteName
this.detailsList[1][1].value = `${this.orderData.oilsCode} ${this.orderData.oilsBar}号枪`; this.detailsList[1][1].value = `${this.orderData.oilsCode} ${this.orderData.oilsBar}号枪`
this.detailsList[1][2].value = `${Number(this.orderData.volume).toFixed(2)}L`; this.detailsList[1][2].value = `${Number(this.orderData.volume).toFixed(2)}L`
this.detailsList[1][3].value = this.orderData.siteUserName ; this.detailsList[1][3].value = this.orderData.siteUserName
this.detailsList[2][0].value = '¥'+this.orderData.realAmount ; this.detailsList[2][0].value = '¥' + this.orderData.realAmount
this.detailsList[2][1].value = '¥'+ Number(this.orderData.oilDiscountAmount).toFixed(2) ; this.detailsList[2][1].value = '¥' + Number(this.orderData.oilDiscountAmount).toFixed(2)
this.detailsList[3][0].value = this.orderData.plateNumber ; this.detailsList[3][0].value = this.orderData.plateNumber
// this.detailsList[3][2].value = ''+this.orderData.plateNumber ; // this.detailsList[3][2].value = ''+this.orderData.plateNumber ;
}, },
getCode(){ getCode() {
console.log( this.orderData) // console.log(this.orderData)
oilSiteApi.getOrderQrCode(this.orderData.orderSerialNumber).then(res=>{ oilSiteApi.getOrderQrCode(this.orderData.orderSerialNumber).then(res => {
if(res.code==20000){ if (res.code == 20000) {
this.codeTpe.codeValue = '' this.codeTpe.codeValue = ''
this.$nextTick(function(){ this.$nextTick(function () {
this.codeTpe.switch = true; this.codeTpe.switch = true
this.codeTpe.codeValue = res.data.codeStr; this.codeTpe.codeValue = res.data.codeStr
this.Timekeeping() this.Timekeeping()
}) })
} }
}) })
} }
} }
}; }
</script> </script>
<style scoped> <style scoped>
@ -188,4 +186,4 @@ export default {
color: #333333; color: #333333;
margin: 50px auto; margin: 50px auto;
} }
</style> </style>

Loading…
Cancel
Save