1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525 |
- <template>
- <view>
- <!-- 头部图片 -->
- <view class="banner">
- <u-swiper bg-color="#fff"
- :img-mode="'scaleToFill'" height="320"
- :list="bannerList" @click="clickBanner" :name="'picUrl'" >
- </u-swiper>
-
- <!-- <img :src="indexLogo?indexLogo:'static/img/banner1.jpg'" alt="">
- -->
- </view>
- <!-- 选项列表 -->
- <view class="option-list">
- <view class="list-item" @click="getScanCode">
- <view class="icon iconfont" style="background-color:#59d96e;">
- 
- </view>
- <view class="text oldTextjp2" oldstyle="font-size: 18px;">
- 扫码充电
- </view>
- </view>
- <view class="list-item" @click="fastRecharge">
- <view class="icon iconfont" style="background-color:#4BD2C0;">
- 
- </view>
- <view class="text oldTextjp2" oldstyle="font-size: 18px;">
- 快速充值
- </view>
- </view>
- <view class="list-item" @click="chargingRecord">
- <view class="icon iconfont" style="background-color: #6FA5FF;">
- 
- </view>
- <view class="text oldTextjp2" oldstyle="font-size: 18px;">
- 充电记录
- </view>
- </view>
- <view class="list-item" @click="toSearchPile">
- <view class="icon iconfont" style="background-color: #9D9FFF;">
- 
- </view>
- <view class="text oldTextjp2" oldstyle="font-size: 18px;">
- 附近站点
- </view>
- </view>
- </view>
- <!-- 模式选择 -->
- <u-mask :show="show">
- <view class="wrap">
- <view class="shema" @tap.stop>
- <view class="title">
- 设置浏览模式
- </view>
- <view class="">
- <u-radio-group v-model="value">
- <u-radio v-for="(item, index) in list" :key="index" :name="item.name" :disabled="item.disabled" active-color="#00B962">
- {{item.name}}
- <p v-if="item.name == '长辈模式'">字体更大 看的清楚</p>
- <p v-if="item.name == '标准模式'">信息丰富 功能全面</p>
- </u-radio>
- </u-radio-group>
- </view>
- <view class="hint">可在 {{""}}我的-设置 {{""}}页面中切换</view>
- <view class="btn-box">
- <u-button class="choice-btn" type="success" shape="circle" @click="elderClick">我选好了</u-button>
- </view>
- </view>
- </view>
- </u-mask>
- <view style="height:50px"></view>
-
- <!-- 充值活动 -->
- <view class=" top-up" v-if="activityList.length > 0 && description == '0:0:0'">
- <view class="top-up-title oldTextjp" oldstyle="font-size:20px;"><text class="line"></text>最新活动</view>
- <view class="img-box">
- <view class="img-1" v-for="(item,index) in activityList" :key="item.id"
- @click="rechargeActivity(index)">
- <img :src="item.picUrl" alt="">
- </view>
- </view>
- </view>
- <!-- 最新活动 -->
- <view class=" top-up" v-if="description != '0:0:0'">
- <view class="top-up-title oldTextjp" oldstyle="font-size:20px;"><text class="line"></text>最新活动</view>
- <view class="img-box2">
- <view class="left-image" @click="gotoUrl('pages/monthlyCardActivity/monthlyCardBuy')">
- <p>充电免服务费包月卡</p>
- <view class="time-activities">
- 距活动结束仅剩 <text class="time">{{description}}</text>
- </view>
- </view>
- <view class="right-image">
-
- <!-- <img class="margin-bottom" v-for="(item,index) in activityList" :key="item.id"
- @click="rechargeActivity(index)" :src="item.picUrl" alt=""> -->
- <img class="margin-bottom" src="../../assets/img/topup2.png" alt="" @click="rechargeActivity(0)">
- <img class="margin-bottom" src="../../assets/img/topup3.png" alt="" @click="rechargeActivity(1)">
- </view>
-
- </view>
- </view>
- <template v-if="message == 'getLocation:ok' && stationList.length != 0 && chargeList.length == 0">
-
-
- <view class=" top-up" >
- <view class="top-up-title oldTextjp" oldstyle="font-size:20px;"><text class="line"></text>附近站点
- <view class="pack-up" v-show="!listShow" @click="listShow=true" >
- 收起<text class="iconfont"></text>
- </view>
- <view class="pack-up" v-if="listShow" @click="listShow=false" >
- 展开<text class="iconfont"></text>
- </view>
- </view>
-
- </view>
- <!-- 附近站点 -->
- <view class="station" v-for="(stationData,i) in stationList" :key="i"
- v-show="!listShow||i==0"
- @click="gotoUrl('pages/searchPile/stationAndPile/stationDetails?id=' + stationData.id)">
- <view class="text">
- <view class="station-title">
- <text class="title-left oldTextjp2" oldstyle="font-size: 14px;background-color: #9D9FFF;" v-if="stationData.type == '1'" style="background-color: #9D9FFF;">快充</text>
- <text class="title-left oldTextjp2" oldstyle="font-size: 14px;background-color: #00B962;" v-if="stationData.type == '2'" style="background-color: #00B962;">慢充</text>
- <text class="title-left oldTextjp2" oldstyle="font-size: 14px;background-color: #00BAC8;" v-if="stationData.type == '1,2'" style="background-color: #00BAC8;">快/慢</text>
- <text class="title-right oldTextjp" oldstyle="font-size: 20px;">{{stationData.name}}</text>
- </view>
- <view class="station-price">
- <view class="flex">
- <view class="price-left">{{stationData.costPrice}}</view>
- <view class="price-right">
- 元/度 起
- </view>
- </view>
- <view class="count-left">
- <span class="oldTextjp2 free-conut" oldstyle="font-size: 16px;" >空闲{{stationData.availableNum}}/</span>
- <span class="oldTextjp" oldstyle="font-size: 16px;">总数{{stationData.totalNum}}</span>
- </view>
- </view>
-
- <view class="park">
- <view class="flex">
- <view class="park-p">p</view>
- <view class="park-text oldTextjp2" oldstyle="font-size: 14px;">2小时停车免费</view>
- </view>
- <view class="count-right oldTextjp" oldstyle="font-size: 16px;">
- <text class="iconfont" style="color: #00B962;"></text>
-
- {{stationData.distance!=null&&stationData.distance>0.1 ? stationData.distance.toFixed(1)+'公里':'小于100米'}}
- </view>
- </view>
- </view>
-
- </view>
- <!-- 站点 -->
- <!-- <view class="station" v-for="(stationData,i) in stationList" :key="i"
- @click="gotoUrl('pages/searchPile/stationAndPile/stationDetails?id=' + stationData.id)">
- <view class="img-box">
- <img src="static/img/Frame 198 (1).png" alt="">
- </view>
- <view class="text">
-
- <view class="station-title">
- <text class="title-left oldTextjp2" oldstyle="font-size: 14px;background-color: #9D9FFF;" v-if="stationData.type == '1'" style="background-color: #9D9FFF;">快充</text>
- <text class="title-left oldTextjp2" oldstyle="font-size: 14px;background-color: #00B962;" v-if="stationData.type == '2'" style="background-color: #00B962;">慢充</text>
- <text class="title-left oldTextjp2" oldstyle="font-size: 14px;background-color: #00BAC8;" v-if="stationData.type == '1,2'" style="background-color: #00BAC8;">快/慢</text>
- <text class="title-right oldTextjp" oldstyle="font-size: 20px;">{{stationData.name}}</text>
- </view>
-
- <view class="station-price">
- <view class="price-left">{{stationData.costPrice}}</view>
- <view class="price-right">
- 元/度 起
- </view>
- </view>
-
- <view class="park">
- <text class="park-p">p</text>
- <text class="park-text oldTextjp2" oldstyle="font-size: 14px;">2小时停车免费</text>
- </view>
- <view class="count">
- <view class="count-left">
- <span class="oldTextjp2" oldstyle="font-size: 16px;">空闲{{stationData.availableNum}}/</span>
- <span class="oldTextjp" oldstyle="font-size: 16px;">总数{{stationData.totalNum}}</span>
- </view>
- <view class="count-right oldTextjp" oldstyle="font-size: 16px;">
- <text class="iconfont"></text>
- {{stationData.distance!=null&&stationData.distance>0.1 ? stationData.distance.toFixed(1)+'公里':'小于100米'}}
- </view>
- </view>
- </view>
- </view> -->
-
- </template>
- <!-- 定位 -->
- <view class="location-box" v-if="message != 'getLocation:ok' && stationList.length == 0 && chargeList.length == 0">
- <view class="location">
- <view class="location-text">
- <view class="text-1 oldTextjp" oldstyle="font-size: 20px;">
- 定位中...
- </view>
- <view class="text-2 oldTextjp2" oldstyle="font-size: 16px;">
- 授权定位后可查询附近充电站
- </view>
- <view class="text-3 oldTextjp2" oldstyle="font-size: 16px;" @click="getPoint()">
- 重新定位
- </view>
- </view>
- <view class="img-box">
- <img src="static/img/暂无网络信号-缺省页 1.png">
- </view>
- </view>
- </view>
- <!-- 充电状态 -->
- <view class="state1 state" v-if="chargeList.length > 0" v-for="(item,index) in chargeList" :key="item.id"
- @click="gotoUrl('pages/searchPile/chargeProcess/dcCharging?id=' + item.id)">
- <view class="state-text">
- <view class="text-1 oldTextjp" oldstyle="font-size: 20px;">
- {{item.statusText}}
- </view>
- <view v-if="item.status == '0'" class="text-2 oldTextjp2" oldstyle="font-size: 16px;">
- 启动中
- </view>
- <view v-if="item.status == '1'" class="text-2 oldTextjp2" oldstyle="font-size: 16px;">
- 已充{{item.dueFee != null ? item.dueFee : '0.00'}}元
- </view>
- <!-- <view v-if="item.status == '2'" class="text-2" style="color: red;">
- 超出时间将收取占位费
- </view> -->
- <view v-if="item.status == '4'" class="text-2 oldTextjp2" oldstyle="font-size: 16px;">
- <span v-if="item.waitNum==1">请耐心等待</span>
- <span v-else >前方等待{{item.waitNum-1}}位</span>
- </view>
- <view class="text-3 oldTextjp2" oldstyle="font-size: 16px;">
- {{item.deviceName}}<!-- /<br />{{item.deviceNo}} -->
- </view>
- </view>
- <view class="img-box">
- <img v-if="item.status == '0'" src="static/img/等待中-缺省页.png">
- <img v-if="item.status == '1'" src="static/img/充电中-缺省页.png">
- <img v-if="item.status == '2'" src="static/img/已充满-缺省页.png">
- <img v-if="item.status == '4'" src="static/img/等待中-缺省页.png">
- </view>
- </view>
-
-
- <!-- 新闻 -->
- <view class="news-title" v-if="newsList.length > 0">
- <view class="news-title-left oldTextjp" oldstyle="font-size:20px;">
- <view class="line" style="margin-top:4px;"></view>新闻公告
- </view>
- <view class="more oldTextjp2" oldstyle="font-size:16px;" @click="toNewsNotice">更多<view class="more-icon iconfont"> </view>
- </view>
- </view>
- <view class="news">
- <view class="news-content" v-for="(item,index) in newsList" :key="item.id"
- @click="gotoUrl('pages/article/articleDetails?id=' + item.id)">
- <view class="content-text">
- <view class="content-title oldTextjp2" oldstyle="font-size: 18px;">{{item.title}}</view>
- <view class="news-time">{{item.createTime?item.createTime.slice(5,10):''}}</view>
- </view>
- <view class="content-img">
- <img :src="item.pic ? item.pic : 'static/img/image_default.png'" alt="">
- </view>
- </view>
- </view>
- <view class="bottom" v-if="newsList.length == recordsTotal && newsList.length != 0">
- <view class="bot">
- <view class="bot-line"></view>
- <view class="bot-text oldTextjp2" oldstyle="font-size: 14px;">已经到底了</view>
- <view class="bot-line"></view>
- </view>
- </view>
- <!-- 导航栏 -->
- <view class="navigation">
- <view class="login-prompt" v-if="!userId">
- 登录显示更多会员服务
- <text class="button" @click="toLogin">登录/注册</text>
- </view>
- </view>
- <Tabbar :current="0" ref="tabbarMain" :elderStatus="elderStatus"></Tabbar>
- </view>
- </template>
- <script>
- import * as API from '@/apis/index.js'
- import * as newsApi from '@/apis/news.js'
- import * as WxJsApi from '@/utils/wxJsApi.js'
- import * as siteApi from '@/apis/site.js'
- import * as loginApi from '@/apis/login.js'
- import MapLoader from '@/utils/AMap'
- import Tabbar from '@/components/Tabbar.vue'
- import {
- newDate,
- secondsDistance,
- hourDistanceArr
- } from '@/utils'
- export default {
- components: {
- Tabbar
- },
- data() {
- return {
- listShow:false,
- stationList: [],
- bannerList:[],
- timeOut: false,
- pointTimeOut: true,
-
- chargeList: [],
- activityList: [],
- userId: '',
- newsList: [],
- pageIndex: 1,
- recordsTotal: 0,
- longitude: '',
- latitude: '',
- message: '',
- indexLogo: '',
- show: false,
- list: [{
- name: '长辈模式',
- disabled: false
- },
- {
- name: '标准模式',
- disabled: false
- },
- ],
- // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
- value: '长辈模式',
- elderStatus: false,
- fontMode: '',
- description: '0:0:0'
- }
- },
- onLoad(op) {
-
- if (op.jpcode) {
- var k = API.codeOperation(op.jpcode)
- if (k) {
- uni.navigateTo({
- url: k
- })
- }
- }
-
-
-
-
- },
- onUnload() {
- this.timeOut = false;
- this.pointTimeOut = false;
- },
- onHide() {
- this.timeOut = false;
- this.pointTimeOut = false;
- },
- onReachBottom() {
- if (this.newsList.length < this.recordsTotal) {
- this.myLoadmore();
- }
- },
- onShow() {
- if(this.$refs.tabbarMain){
- this.$refs.tabbarMain.setcount(0);
- }
-
-
- },
- onReady() {
- if (this.carhelp.get("getElderModeClass")) {
- if(this.carhelp.get("getElderModeClass") == "长辈模式") {
- this.fontMode = '1';
- } else {
- this.fontMode = '0';
- }
- API.changeFont({fontMode: this.fontMode}).then((res) => {
-
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- }
-
- this.getUserInfo();
-
- WxJsApi.getWxConfig(['getLocation', 'addEventListener', 'scanQRCode']).then((res) => {
- // //(res)
- }).catch(error => {
- //(res)
- })
- this.getBannerInfo("homepage")
- this.getPointTimeOut();
- this.getNewsList();
- this.getActivityInfoList();
- this.getDescriptionTime();
- },
- methods: {
- getDescriptionTime() {
- var date = '2022/08/08 00:00:00';
- var dateMonth1 = new Date().getMonth()+1;
- var dateDay1 = new Date().getDate();
- var dateMonth2 = parseInt(date.slice(5,7));
- var dateDay2 = parseInt(date.slice(8,10));
- if(dateMonth1 < dateMonth2) {
- var days = new Date(new Date().getFullYear(), dateMonth1, 0).getDate();
- dateDay2 = dateDay2 + days;
- console.log(dateDay2)
- }
-
- if(dateDay1 < dateDay2-2) {
- this.description = dateDay2 - dateDay1 + '天'
- } else {
- var dateTime2=new Date(date).getTime()
- var c=hourDistanceArr(new Date(),new Date(dateTime2))
- this.description = c[0]+':'+c[1]+':'+c[2];
- setTimeout(()=>{
- this.getDescriptionTime();
- },1000)
- }
- },
- getUserInfo() {
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- loginApi.findByOpenId({
- openId: this.carhelp.getOpenId(),
- noerror:true,
- }).then((res) => {
- uni.hideLoading();
-
- if (res.code == 200&&res.result) {
-
- var token = res ? res.data.token : '';
- this.carhelp.setPersonInfo(res.data.regUser );
- this.carhelp.setToken(token);
- this.carhelp.setPersonInfoPlus(res.data);
-
- }
-
- console.log("--------------")
- if (res.data.regUser) {
- if(res.data.regUser.fontMode == null) {
- this.show = true;
- } else {
- this.show = false;
- this.fontMode = res.data.regUser.fontMode;
- if(this.fontMode == '1') {
- this.carhelp.set("getElderModeClass", "长辈模式");
- } else {
- this.carhelp.set("getElderModeClass", "标准模式");
- }
- }
-
- this.userId = res.data.regUser.id;
- this.getFindChargeData();
-
-
- if (this.carhelp.get("getElderModeClass")) {
- if(this.carhelp.get("getElderModeClass") == "长辈模式") {
- this.elderStatus = true;
- } else {
- this.elderStatus = false;
- }
- }
- }else{
- this.carhelp.set("getElderModeClass", "长辈模式");
- this.elderStatus = true;
-
- var obj=this.carhelp.get("friends_invitation")
- // this.carhelp.set("friends_invitation",{
- // op:op,
- // date:new Date().getTime()
- // })
- if(obj){
- if(obj.date+1000*60*60*24 > new Date().getTime() ){
-
- this.friendsInvitation(obj)
- }
-
- }
- }
-
-
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- friendsInvitation(obj){
-
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
-
- API.findActivity({
- id:obj.op.id,
- code:obj.op.icode
- }).then((res) => {
- uni.hideLoading()
- obj.activityInfo=res.data.activityInfo;
- var name=res.data.activityInfo.name;
- var title="参与活动"
- var okbtn="前往注册"
- var endTime=res.data.activityInfo.endTime;
-
- if(endTime&&secondsDistance(newDate(endTime))>0){
- name="活动已结束"
- okbtn="继续注册"
- title="提示"
- obj=null
- }
- this.carhelp.set("friends_invitation",obj)
- uni.showModal({
- title:title,
- content:name,
- confirmText:okbtn,
- success: res1 => {
- if (res1.confirm) {
- uni.navigateTo({
- url: '/pages/login/login'
- })
- } else if (res1.cancel) {
- //('用户点击取消');
- }
- }
- })
-
-
- }).catch(error => {
- uni.showToast({
-
- title: error,icon: "none"
- })
- })
- },
- clickBanner(index){
- var uurl="";
- var mod = this.bannerList[index]
- mod.clickUrl=mod.linkUrl
- if (mod.clickUrl == null) {
-
- } else if (mod.clickUrl.slice(-5) == 'login' && this.userId) {
-
- } else if (mod.clickUrl.indexOf('http') == 0) {
- window.location = mod.clickUrl+uurl;
-
- } else if (mod.clickUrl.indexOf('#/') == 0) {
- if (mod.clickUrl.indexOf("?") == -1) {
- mod.clickUrl += '?';
- }
- var url=mod.clickUrl.split("#")[1]
- //window.location = mod.clickUrl;
- uni.navigateTo({
- url: url+uurl
- })
- } else if (mod.clickUrl == '#' || mod.clickUrl == '') {
-
- } else {
- uni.navigateTo({
- url: mod.clickUrl+uurl
- })
- }
- },
- getBannerInfo(code){
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- newsApi.getBannerInfo(code).then((res) => {
- this.bannerList =res.data;
- uni.hideLoading()
- document.getElementsByClassName("uni-swiper-wrapper")[0].parentNode.style="background-color: rgb(255, 255, 255); height: 160px;"
- }).catch(error => {
- uni.showToast({
-
- title: error,icon: "none"
- })
- })
- },
- elderClick() {
- if(this.value == "长辈模式") {
- this.elderStatus = true;
- this.carhelp.set("getElderModeClass", "长辈模式");
- this.fontMode = '1';
- } else {
- this.elderStatus = false;
- this.carhelp.set("getElderModeClass", "标准模式");
- this.fontMode = '0';
- }
-
- API.changeFont({fontMode: this.fontMode}).then((res) => {
- this.show = false;
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- getPointTimeOut() {
- setTimeout(() => {
- if (this.pointTimeOut) {
- this.getPoint();
- }
- }, 1000)
- },
- getFindChargeData() {
- API.findChargeData().then((res) => {
- this.chargeList = res.data.chargingRecordList;
- var list = res.data.chargingRecordList;
- for (var i = 0; i < list.length; i++) {
- if (list[i].status == '1' || list[i].status == '4') {
- this.timeOut = true;
- }
- }
- if (this.timeOut) {
- setTimeout(() => {
- this.getFindChargeData();
- }, 5000)
- }
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- toSearchPile() {
- uni.navigateTo({
- url: '/pages/searchPile/searchPile'
- })
- },
- toLogin() {
- uni.navigateTo({
- url: '/pages/login/login'
- })
- },
- toNewsNotice() {
- uni.navigateTo({
- url: '/pages/article/newsNotice'
- })
- },
- //微信扫二维码
- getScanCode() {
- if (this.userId) {
- WxJsApi.scanQRCode(1).then(res => {
- //("scanQRCode------" + res)
- if (res) {
- API.scanCode(res).then((response) => {
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- }
- }).catch(error => {
- })
- } else {
- uni.navigateTo({
- url: '/pages/login/login'
- })
- }
- },
- fastRecharge() {
- if (this.userId) {
- uni.navigateTo({
- url: '/pages/user/finance/recharge'
- })
- } else {
- uni.navigateTo({
- url: '/pages/login/login'
- })
- }
- },
- chargingRecord() {
- if (this.userId) {
- uni.navigateTo({
- url: '/pages/record/index'
- })
- } else {
- uni.navigateTo({
- url: '/pages/login/login'
- })
- }
- },
- rechargeActivity(index) {
- if (this.userId) {
- var uurl="&uid="+this.userId;
-
- var mod = this.activityList[index]
-
- if (mod.clickUrl == null) {
-
- } else if (mod.clickUrl.indexOf('http') == 0) {
- window.location = mod.clickUrl+uurl;
- } else if (mod.clickUrl.indexOf('#/') == 0) {
- if (mod.clickUrl.indexOf("?") == -1) {
- mod.clickUrl += '?';
- }
- var url=mod.clickUrl.split("#")[1]
- //window.location = mod.clickUrl;
- uni.navigateTo({
- url: url+uurl
- })
- } else if (mod.clickUrl == '#' || mod.clickUrl == '') {
-
- } else {
- uni.navigateTo({
- url: mod.clickUrl+uurl
- })
- }
- } else {
- uni.navigateTo({
- url: '/pages/login/login'
- })
- }
- },
- getActivityInfoList() {
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- API.activityInfoList({
- pageIndex: 1,
- pageSize: 10
- }).then((res) => {
- uni.hideLoading()
- this.activityList = res.data.data;
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- getPoint() {
- WxJsApi.getLocation().then((res) => {
-
- this.latitude = parseFloat(res.latitude);
- this.longitude = parseFloat(res.longitude);
- this.message = res.errMsg;
- if (res.errMsg != 'getLocation:ok') {
- uni.showToast({
- title: res
- })
- } else {
- siteApi.searchStationData({
- longitude: this.longitude,
- latitude: this.latitude,
- pageSize:5
- }).then((response) => {
- this.stationList = response.data.data;
-
- if(response.data.data.length){
- var stationDataList = response.data.data;
-
- for(var i in stationDataList){
- var item=stationDataList[i]
- MapLoader().then(AMap1 => {
- var lnglat = new AMap.LngLat(this.longitude,this.latitude);
- var myDistance = lnglat.distance([item.longitude,item.latitude]);
- item.distance = myDistance/1000;
- })
- }
-
- //this.stationData = stationDataList;
- }
-
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- }
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- getNewsList(bl) {
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- if (bl) {
- this.newsList = [];
- this.pageIndex = 1;
- }
- newsApi.newsInfoList({
- pageIndex: 1,
- pageSize: 10
- }).then((res) => {
- uni.hideLoading()
- this.newsList = [
- ...this.newsList,
- ...res.data.data
- ];
- this.recordsTotal = res.data.recordsTotal
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- myLoadmore() {
- this.pageIndex += 1;
- this.getNewsList()
- },
- }
- }
- </script>
- <style lang="scss" scoped>
-
- // 头部图片
- img {
- width: 100%;
- height: 100%;
- }
- .banner {
- width: 100%;
- height: 160px;
- }
- // 选项列表
- .option-list {
- width: 91.4%;
- padding-top: 10px;
- height: 90px;
- line-height: 20px;
- border-radius: 8px;
- text-align: center;
- background-color: #fff;
- position: absolute;
- top: 120px;
- left: 0;
- right: 0;
- margin: auto;
- display: flex;
- justify-content: space-around;
- .list-item {
- // 图标
- .icon {
- width: 40px;
- height: 40px;
- border-radius: 99px;
- line-height: 40px;
- font-size: 24px;
- text-align: center;
- margin: auto;
- color: #ffffff;
- }
- }
- }
- .flex{
- display: flex;
- }
- // 站点
- .pack-up{
- float: right;
- font-size: 16px;
- color: rgba(119, 119, 119, 100);
- }
- .station {
- width: 91.4%;
- border-radius: 8px;
- padding: 12px 0px 12px 11px;
-
- background-color: #fff;
- margin: 8px auto 0;
- // position: relative;
- .img-box {
- width: 100%;
- height: 100%;
- border-radius: 8px;
- overflow: hidden;
- }
- img {
- width: 100%;
- height: 100%;
- }
-
- .text {
- width: 91.4%;
- // position: absolute;
- // top: 0;
- // left: 20px;
- // 头部
- .station-title {
- display: flex;
-
- .title-left {
- display: inline-block;
- height: 20px;
- width: 44px;
- // margin-left: 12px;
- line-height: 20px;
- border-radius: 50px;
- background-color: rgba(133, 140, 255, 100);
- color: rgba(255, 255, 255, 100);
- font-size: 12px;
- text-align: center;
- font-family: Arial;
- }
- .title-right {
- display: inline-block;
- margin-left: 4px;
- margin-top: 2px;
- width: 271px;
- height: 16px;
- line-height: 16px;
- color: rgba(16, 16, 16, 100);
- font-size: 16px;
- text-align: left;
- font-family: AlibabaPuHui-regular;
- }
- }
- // 价格
- .station-price {
- margin-top: 8px;
- display: flex;
- justify-content: space-between;
- .price-left {
- width: 40px;
- height: 20px;
- line-height: 20px;
- color: rgba(255, 98, 0, 100);
- font-size: 20px;
- text-align: left;
- font-family: Roboto-medium;
- }
- .price-right {
- height: 20px;
-
- margin-left: 4px;
- margin-top: 3px;
- color: rgba(102, 102, 102, 100);
- font-size: 14px;
- text-align: left;
- font-family: AlibabaPuHui-regular;
- }
- .free-conut{
- color: #009143;
- }
- }
-
- // park
- .park {
- margin-top: 8px;
- display: flex;
- justify-content: space-between;
- .park-p {
-
- width: 20px;
- height: 20px;
- line-height: 12px;
- text-align: center;
- background-color: #00b962;
- color: #fff;
- }
- .park-text {
-
- height: 20px;
- line-height: 20px;
- color: rgba(102, 102, 102, 100);
- font-size: 14px;
- text-align: left;
- margin-left: 4px;
-
- }
- }
- // 数量
- .count {
- margin-top: 14px !important;
- width: 91.4%;
- display: flex;
- justify-content: space-between;
- white-space: nowrap;
- overflow: hidden;
- }
- }
- }
- //定位
- .location {
- width: 91.4%;
- background-color: #ffffff;
- height: 120px;
- display: flex;
- justify-content: space-between;
- margin: 20px auto 0;
- border-radius: 8px;
- border: #F2F4F4 1px;
- .location-text {
- padding: 24px 0 0 28px;
- .text-1 {
- height: 16px;
- line-height: 16px;
- color: rgba(16, 16, 16, 100);
- font-size: 16px;
- text-align: left;
- }
- .text-2 {
- height: 17px;
- line-height: 17px;
- color: rgba(102, 102, 102, 100);
- font-size: 12px;
- text-align: left;
- margin-top: 4px;
- white-space: nowrap; //强制不换行
- text-overflow: ellipsis; //文本超出出现省略号
- overflow: hidden;
- }
- .text-3 {
- width: 80px;
- height: 24px;
- line-height: 22px;
- border-radius: 50px;
- color: rgba(0, 185, 98, 100);
- font-size: 12px;
- text-align: center;
- border: 1px solid rgba(0, 185, 98, 100);
- margin-top: 11px;
- }
- }
- .img-box {
- width: 120px;
- height: 120px;
- margin-right: 20px;
- }
- }
- .state {
- width: 91.4%;
- background-color: #ffffff;
- height: 120px;
- display: flex;
- margin: 20px auto 0;
- border-radius: 8px;
- border: #F2F4F4 1px;
- .state-text {
- width: 61.8%;
- padding: 24px 0 0 28px;
- .text-1 {
- height: 16px;
- line-height: 16px;
- color: blueviolet;
- font-size: 16px;
- text-align: left;
- }
- .text-2 {
- height: 17px;
- line-height: 17px;
- color: #101010;
- text-align: left;
- margin-top: 12px;
- }
- .text-3 {
- font-size: 12px;
- line-height: 20px;
- margin-top: 6px;
- color: #999999;
- }
- }
- .img-box {
- width: 120px;
- height: 120px;
- margin-right: 20px;
- }
- }
- //充值
- .top-up {
- margin-left: 16px;
- margin-top: 17px;
- padding-right: 16px;
- .top-up-title {
- color: rgba(16, 16, 16, 100);
- font-size: 16px;
- }
- .img-box {
- margin-top: 12px;
- width: 95%;
- height: 146px;
- display: flex;
- justify-content: space-between;
- .img-1 {
- width: 166px;
- height: 146px;
- position: relative;
- .img-text {
- position: absolute;
- top: 12px;
- left: 12px;
- height: 33px;
- color: #ff4444;
- font-size: 24px;
- text-align: left;
- margin-left: 12px;
- .img-text2 {
- font-size: 14px
- }
- }
- }
- img {
- width: 100%;
- height: 100%;
- }
- }
- .img-box2{
- margin-top: 12px;
- display: flex;
- justify-content: space-between;
- img{
- width: 100%;
- height: 100%;
- }
- .left-image{
- width: 48.3%;
- height: 166px;
- padding: 8px 0 0 12px;
- background: url(@/assets/img/topup1.png);
- background-repeat: no-repeat;
- background-position: 30% 10%;
- background-size: cover;
- p{
- color: rgba(56, 47, 33, 100);
- font-size: 24px;
- line-height: 28px;
- font-weight: 600;
-
- }
- .time-activities{
- color: rgba(56, 39, 14, 100);
- font-size: 16px;
- line-height: 22px;
- margin-top: 4px;
- .time{
- margin-left: 4px;
- color: #fa3534;
- font-weight: bold;
- }
- }
- }
- .right-image{
- width: 48.3%;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
-
- .margin-top{
- margin-top: 12px;
- }
-
- img{
- height: 77px;
-
- }
- };
- }
-
- }
- // 小竖线
- .line {
- display: inline-block;
- width: 3px;
- height: 12px;
- margin-right: 7px;
- background-color: rgba(0, 145, 67, 100);
- }
- // 新闻公告
- .news-title {
- padding: 0 16px;
- margin-top: 12px;
- color: rgba(16, 16, 16, 100);
- font-size: 16px;
- display: flex;
- justify-content: space-between;
- background-color: #F2F4F4;
- .news-title-left {
- display: flex;
- }
- .more {
- font-size: 14px;
- color: #777777;
- display: flex;
- line-height: 20px;
- .more-icon {
- font-size: 24px
- }
- }
- }
- .news {
- background-color: #fff;
- width: 91.4%;
- margin: 12px auto 0;
- border-radius: 8px;
- .news-content {
- display: flex;
- justify-content: space-between;
- padding: 12px;
- .content-text {
- width: 56.2%;
- height: 100%;
- line-height: 21px;
- color: #101010;
- text-align: left;
- font-size: 14px;
- }
- .content-title {
- width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 3;
- }
- .content-img {
- width: 40.57%;
- height: 100%;
- border-radius: 4px;
- overflow: hidden;
- img {
- width: 100%;
- height: 80%;
- }
- }
- .news-time {
- margin-top: 5%;
- color: #999999;
- width: 80px;
- height: 20px;
- font-size: 14px;
- }
- }
- }
- .bottom {
- width: 100%;
- height: 100px;
- .bot {
- width: 100%;
- margin: 0 auto;
- padding: 0 17.3%;
- justify-content: space-between;
- display: flex;
- .bot-line {
- margin-top: 20px;
- width: 21.3%;
- height: 0px;
- border: 1px solid rgba(207, 210, 213, 100);
- }
- .bot-text {
- white-space: nowrap;
- height: 17px;
- margin-top: 13px;
- margin-left: 12px;
- margin-right: 12px;
- font-size: 12px;
- text-align: center;
- color: rgba(182, 189, 195, 100);
- }
- }
- }
- // 导航栏
- .navigation {
- width: 100%;
- // height: 40px;
- padding: 10px 0;
- background-color: #fff;
- position: fixed;
- bottom: 0;
- left: 0;
- display: flex;
- justify-content: space-around;
- text-align: center;
- color: #999999;
- .nav-icon {
- width: 54px;
- font-size: 24px
- }
- .nav-text {
- font-size: 14px;
- }
- }
- .shema {
- width: 70%;
- padding-bottom: 20px;
- border-radius: 16px;
- background-color: #fff;
- position: fixed;
- top: 100px;
- left: 0;
- right: 0;
- margin: 0 auto;
- z-index: 9999;
- .title {
- height: 33px;
- color: rgba(16, 16, 16, 100);
- font-size: 24px;
- text-align: center;
- padding: 16px 0;
- }
- .u-radio-group {
- margin: 16px 5vw;
- }
- /deep/.u-radio {
- width: 60vw !important;
- padding: 24px 24px 40px;
- line-height: 20px;
- border-radius: 16px;
- text-align: center;
- border: #101010 1px solid;
- margin-top: 12px;
- }
- /deep/ .u-radio__label {
- text-align: left;
- height: 24px;
- // color: rgba(0, 185, 98, 100);
- font-size: 24px;
- }
- p {
- height: 22px;
- color: rgba(102, 102, 102, 100);
- font-size: 14px;
- margin-top: 12px;
- white-space: nowrap
- }
- .hint {
- text-align: center;
- }
- .btn-box {
- margin-top: 20px;
- .choice-btn {
- width: 80%;
- }
- }
- }
- .wrap {
- display: flex;
- align-items: center;
- justify-content: center;
- height: 100%;
- }
- // 登录提示
- .login-prompt {
- width: 91.4%;
- height: 40px;
- line-height: 40px;
- border-radius: 50px;
- text-align: left;
- padding-left: 16px;
- padding-right: 4px;
- background-color: rgba(0, 0, 0, 0.6);
- position: fixed;
- bottom: 75px;
- color: #ffffff;
- .button {
- width: 88px;
- height: 32px;
- line-height: 32px;
- border-radius: 50px;
- background-color: rgba(0, 185, 98, 100);
- text-align: center;
- float: right;
- margin-top: 4px;
- }
- }
- </style>
|