111
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

287 lines
6.0 KiB

<template>
<view class="page-content">
<cu-custom class="bg-main-oil" bgColor="bg-main-oil">
<block slot="content">星油云</block>
</cu-custom>
<view class="margin-top-lg">
<swiper class="screen-swiper text-center square-dot" :indicator-dots="true"
:circular="true" interval="3000" duration="500">
<swiper-item v-for="item in 4" :key="item">
<image class="margin-center" :src="imgURL+'start-center.png'" mode="heightFix">
</image>
</swiper-item>
</swiper>
</view>
<view class="content" :class="{'active':active}">
<view class="tabbar-box-wrap">
<view class="tabbar-box">
<view class="tabbar-box-item" @tap="scan">
<text class="cuIcon-scan text-blue text-bold padding-right-xs"></text>
<text class="explain">扫码加油</text>
</view>
<view class="tabbar-box-item" @tap="qrFn">
<text class="cuIcon-qr_code text-orange text-bold padding-right-xs"></text>
<text class="explain">付款码</text>
</view>
<view class="tabbar-box-item" @click="goToPage('/BagAuth/pages/agreeMent/OperationGuide')">
<text class="cuIcon-creative text-olive text-bold padding-right-xs"></text>
<text class="explain">操作指南</text>
</view>
</view>
</view>
</view>
<three-sites @hideOneModal="showThreeSites=false" :showThreeSites="showThreeSites"></three-sites>
</view>
</template>
<script>
import threeSites from '@/components/three-sites.vue'
import oilSiteApi from '@/api/oil-site.js'
export default {
components: {
threeSites
},
data() {
return {
siteInfo: {
},
siteId: '',
showThreeSites: false,
active: false,
imgURL: this.global.imgURL + 'other/',
};
},
onLoad() {},
onShow() {
// setTimeout(() => {
this.active = true;
// }, 500);
},
onHide() {
this.active = false;
},
methods: {
qrFn(){
if(!uni.getStorageSync('user')){
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
uni.reLaunch({
url: '../../../BagAuth/pages/login/login'
})
}
}
})
return
}
this.showThreeSites=true
},
goToPage(url) {
if (!url) return;
uni.navigateTo({
url
});
},
// 扫码逻辑开始
getSiteInfo(id) {
let data2 = {
...uni.getStorageSync('location'),
siteId: id
}
oilSiteApi.getSiteDetails(data2).then(res => {
if (res.code == 20000) {
this.siteInfo = res.data
if (res.data.oilSiteChannelDetailsVos.length == 1 && res.data.oilSiteChannelDetailsVos[0]
.activePay) {
uni.setStorageSync('tempScanSite', this.siteInfo)
this.makePay()
} else {
this.toDetail()
}
}
})
},
toDetail() {
uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?siteId=${this.siteId}&customerJump=false`,
fail: (err) => {
// console.log(err)
},
success: () => {
// console.log('err')
}
})
},
makePay() {
uni.navigateTo({
url: `/BagStation/pages/makeOrder/makeOrder?siteId=${this.siteId}`
})
},
getScanRes(code) {
let data2 = {
qrCode: code
}
oilSiteApi.getScanRes(data2).then(res => {
if (res.code == 20000) {
this.siteId = res.data.siteId
this.getSiteInfo(this.siteId)
}
})
},
scan1() {
// 测试用
this.getScanRes('fixed_1371293944539422720')
},
scan() {
if(!uni.getStorageSync('user')){
uni.showModal({
title: '请您登录',
content: "登录星油加油才可以加油 |˛˙꒳˙)♡",
confirmText: '去登陆',
success: (res) => {
if (res.confirm) {
uni.reLaunch({
url: '../../../BagAuth/pages/login/login'
})
}
}
})
return
}
uni.scanCode({
scanType: 'qrCode',
onlyFromCamera: true,
success: (res) => {
console.log(res.result)
this.getScanRes(res.result)
},
fail: (err) => {
uni.showToast({
title: err
})
}
})
}
//结束
}
};
</script>
<style lang="scss" scoped>
.content {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
/* #ifdef H5 */
height: calc(100vh - var(--window-bottom) - var(--window-top));
/* #endif */
/* #ifndef H5 */
// height: 100vh;
/* #endif */
transition: opacity 0.3s;
// background: #999;
opacity: 0;
&.active {
opacity: 1;
}
.logo {
position: relative;
top: 300upx;
width: 500upx;
height: 500upx;
// z-index: -1;
opacity: 0;
transition: opacity 0.3s;
&.active {
opacity: 1;
}
}
}
.tabbar-box-wrap {
position: absolute;
width: 100%;
padding: 50upx;
box-sizing: border-box;
bottom: 0;
left: 0;
.tabbar-box {
position: relative;
display: flex;
width: 100%;
background: #fff;
border-radius: 20upx;
padding: 15upx 20upx;
box-sizing: border-box;
z-index: 2;
box-shadow: 0px 2px 5px 2px rgba(0, 0, 0, 0.1);
&:after {
content: '';
position: absolute;
bottom: -16upx;
left: 0;
right: 0;
margin: auto;
width: 50upx;
height: 50upx;
transform: rotate(45deg);
background: #fff;
z-index: 1;
box-shadow: 2px 2px 5px 1px rgba(0, 0, 0, 0.1);
border-radius: 2px;
}
&:before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #ffffff;
border-radius: 20upx;
z-index: 2;
}
.tabbar-box-item {
// position: relative;
width: 100%;
z-index: 3;
margin: 10upx;
color: $uni-color-subtitle;
text-align: center;
font-size: $uni-font-size-base;
.box-image {
width: 100%;
height: $uni-img-size-lg;
}
}
}
}
// .my-bg{
// background-color: #F1F2DE;
// }
.page-content {
min-height: 100vh;
background-color: #F1F2DE;
}
.margin-center {
margin: auto !important;
}
</style>