123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962 |
- <template>
- <view>
- <!-- 头部图片 -->
- <view class="banner">
- <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">
- 扫码充电
- </view>
- </view>
- <view class="list-item" @click="fastRecharge">
- <view class="icon iconfont" style="background-color:#4BD2C0;">
- 
- </view>
- <view class="text">
- 快速充值
- </view>
- </view>
- <view class="list-item" @click="chargingRecord">
- <view class="icon iconfont" style="background-color: #6FA5FF;">
- 
- </view>
- <view class="text">
- 充电记录
- </view>
- </view>
- <view class="list-item" @click="toSearchPile">
- <view class="icon iconfont" style="background-color: #9D9FFF;">
- 
- </view>
- <view class="text">
- 附近站点
- </view>
- </view>
- </view>
-
- <view style="height:50px"></view>
- <!-- 站点 -->
- <view class="station" v-if="message == 'getLocation:ok' && chargeList.length == 0" @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" v-if="stationData.type == '1'">快充</text>
- <text class="title-left" v-if="stationData.type == '2'">慢充</text>
- <text class="title-left" v-if="stationData.type == '1,2'">快充&慢充</text>
- <text class="title-right">{{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">2小时免费停车</text>
- </view>
- <view class="count">
- <view class="count-left">空闲{{stationData.availableNum}}/总数{{stationData.totalNum}}</view>
- <view class="count-right"><text class="iconfont"></text>{{stationData.distance}}公里</view>
- </view>
- </view>
- </view>
- <!-- 定位 -->
- <view class="location-box" v-if="message != 'getLocation:ok' && chargeList.length == 0">
- <view class="location">
- <view class="location-text">
- <view class="text-1">
- 定位中...
- </view>
- <view class="text-2">
- 授权定位后可查询附近充电站
- </view>
- <view class="text-3" @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">
- {{item.statusText}}
- </view>
- <view v-if="item.status == '0'" class="text-2">
- 启动中
- </view>
- <view v-if="item.status == '1'" class="text-2">
- 已充{{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">
- 前方等待{{item.waitNum}}位
- </view>
- <view class="text-3">
- {{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="state2 state">
- <view class="state-text">
- <view class="text-1" style="color: green">
- 充电中
- </view>
- <view class="text-2">
- 前方等待两位
- </view>
- <view class="text-3">
- 荆鹏软件园充电站/1号有序充电桩
- </view>
- </view>
- <view class="img-box">
- <img src="static/img/充电中-缺省页.png">
- </view>
- </view> -->
- <!-- <view class="state3 state">
- <view class="state-text">
- <view class="text-1" style="color: red;">
- 已充满
- </view>
- <view class="text-2" style="color: red;">
- 超出时间将收取占位费
- </view>
- <view class="text-3">
- 荆鹏软件园充电站/1号有序充电桩
- </view>
- </view>
- <view class="img-box">
- <img src="static/img/已充满-缺省页.png">
- </view>
- </view> -->
- <!-- 充值活动 -->
- <view class=" top-up" v-if="activityList.length > 0">
- <view class="top-up-title"><text class="line"></text>充值活动</view>
- <view class="img-box">
- <view class="img-1" v-for="(item,index) in activityList" :key="item.id" @click="rechargeActivity">
- <img :src="item.picUrl" alt="">
- </view>
- </view>
- </view>
- <!-- 新闻 -->
- <view class="news-title" v-if="newsList.length > 0">
- <view class="news-title-left">
- <view class="line" style="margin-top:4px;"></view>新闻公告
- </view>
- <view class="more" @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">
- {{item.title}}
- <view class="news-time">{{item.createTime?item.createTime.slice(5):''}}</view>
- </view>
- <view class="content-img">
- <img :src="item.pic" 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">已经到底了</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"></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 MapLoader from '@/utils/AMap'
- import Tabbar from '@/components/Tabbar.vue'
- export default {
- components: {
- Tabbar
- },
- data() {
- return {
- stationData: {},
- chargeList: [],
- activityList: [],
- userId: '',
- newsList: [],
- pageIndex: 1,
- recordsTotal: 0,
- longitude: '',
- latitude: '',
- message: '',
- indexLogo:''
- }
- },
- onLoad(op) {
- var indexLogo=this.carhelp.getConfig().indexLogo
- // img="https://yktwechat.xiaoxinda.com/config/xxd2021.jpg"
- if(indexLogo){
- this.indexLogo=indexLogo;
- }
- if(op.jpcode){
- var k=API.codeOperation(op.jpcode);
- if(k){
- uni.navigateTo({
- url:k
- })
- }
- }
- },
- onReachBottom() {
- if (this.newsList.length < this.recordsTotal) {
- this.myLoadmore();
- }
- },
- onReady() {
- if (this.carhelp.getPersonInfo()) {
- this.userId = this.carhelp.getPersonInfo().id;
- this.getFindChargeData();
- }
- WxJsApi.getWxConfig(['getLocation', 'addEventListener', 'scanQRCode']).then((res) => {
- // console.log(res)
- }).catch(error => {
- console.log(res)
- })
- this.getPoint();
- this.getNewsList();
- this.getActivityInfoList();
- },
- methods: {
- getFindChargeData() {
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
-
- API.findChargeData().then((res) => {
- uni.hideLoading();
- // var list1 = res.data.chargingRecordList;
- // var list2 = [];
- // for(var i=0;i<list1.length;i++) {
- // if(list1[i].status != '0') {
- // list2.push(list1[i]);
- // }
- // }
- // this.chargeList = list2;
- this.chargeList = res.data.chargingRecordList;
- }).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 => {
- 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() {
- if (this.userId) {
- uni.navigateTo({
- url: '/pages/user/finance/recharge'
- })
- } 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
- }).then((response) => {
- this.stationData = response.data.data[0];
- }).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: 300px;
- }
- // 选项列表
- .option-list {
- width: 91.4%;
- padding-top: 18px;
- height: 100px;
- line-height: 20px;
- border-radius: 8px;
- text-align: center;
- background-color: #fff;
- position: absolute;
- top: 260px;
- 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;
- }
- }
- }
- // 站点
- .station {
- width:91.4%;
- height: 120px;
- margin: 20px auto 0 ;
- position: relative;
- .img-box {
- width: 100%;
- height: 100%;
- border-radius: 8px;
- overflow: hidden;
- }
- img {
- width: 100%;
- height: 100%;
- }
- .text {
- position: absolute;
- top: 0;
- left: 20px;
- // 头部
- .station-title {
- display: flex;
- margin-top: 12px;
- .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: 4px;
- display: flex;
- .price-left {
- width: 40px;
- height: 20px;
- color: rgba(255, 98, 0, 100);
- font-size: 20px;
- text-align: left;
- font-family: Roboto-medium;
- }
- .price-right {
- height: 20px;
- line-height: 20px;
- margin-left: 2px;
- margin-top: 3px;
- color: rgba(102, 102, 102, 100);
- font-size: 14px;
- text-align: left;
- font-family: AlibabaPuHui-regular;
- }
- }
- // park
- .park {
- margin-top: 4px;
- display: flex;
- .park-p {
- display: inline-block;
- width: 20px;
- height: 18px;
- line-height: 12px;
- text-align: center;
- background-color: rgba(125, 177, 255, 100);
- color: #fff;
- }
- .park-text {
- display: inline-block;
- width: 300px;
- height: 17px;
- color: rgba(102, 102, 102, 100);
- font-size: 12px;
- text-align: left;
- margin-left: 2px;
- margin-top: 2px;
- }
- }
- // 数量
- .count {
- margin-top: 14px !important;
- width: 100%;
- display: flex;
- justify-content: space-between;
- padding: 0 5px;
- }
- }
- }
- //定位
- .location {
- width: 91.4%;
- background-color: #ffffff;
- height: 120px;
- display: flex;
- margin: 20px auto 0;
- border-radius: 8px;
- border: #F2F4F4 1px;
- .location-text {
- padding: 24px 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;
- }
- .text-3 {
- width: 80px;
- height: 24px;
- border-radius: 50px;
- color: rgba(0, 185, 98, 100);
- font-size: 12px;
- text-align: center;
- font-family: Microsoft Yahei;
- border: 1px solid rgba(0, 185, 98, 100);
- margin-top: 11px;
- }
- }
- .img-box {
- width: 120px;
- height: 120px;
- float: right;
- }
- }
-
- .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;
- float: right;
- }
- }
- //充值
- .top-up {
- margin-left: 16px;
- margin-top: 17px;
- .top-up-title {
- color: rgba(16, 16, 16, 100);
- font-size: 16px;
- }
- .img-box {
- margin-top: 12px;
- width: 345px;
- 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%;
- }
- }
- }
- // 小竖线
- .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: 42px;
- line-height: 21px;
- color: #101010;
- text-align: left;
- font-size: 14px
- }
- ;
- .content-img {
- width: 26.7%;
- height: 80px;
- background-color: #777777;
- border-radius: 4px;
- overflow: hidden;
- img {
- width: 100%;
- height: 100%;
- }
- }
- .news-time {
- margin-top: 12px;
- color: #999999;
- width: 80px;
- height: 20px;
- font-size: 14px;
- }
- }
- }
- .bottom {
- width: 100%;
- height: 100px;
- .bot {
- width: 100%;
- padding-left: 66px;
- display: flex;
- .bot-line {
- margin-top: 20px;
- width: 80px;
- height: 0px;
- border: 1px solid rgba(207, 210, 213, 100);
- }
- .bot-text {
- width: 60px;
- 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;
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- // 登录提示
- .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>
|