| | |
| | | </view> |
| | | <view class="index_box"> |
| | | <view class="index_box_map"> |
| | | <map class="map" scale="15" :show-location="true" :markers="markers" :latitude="latitude" :longitude="longitude" /> |
| | | <map |
| | | id="mapId" |
| | | class="map" |
| | | scale="15" |
| | | :show-location="true" |
| | | :polygons="eleBusinessArea" |
| | | :markers="markers" |
| | | :latitude="latitude" |
| | | :longitude="longitude" /> |
| | | <view class="index_box_map_type"> |
| | | <view class="index_box_map_type_row active">自行车</view> |
| | | <view class="index_box_map_type_row">电动车</view> |
| | | <view :class="type === item.id ? 'index_box_map_type_row active' : 'index_box_map_type_row'" v-for="(item, index) in types" :key="index" @click="clickType(item.id)">{{item.name}}</view> |
| | | </view> |
| | | <view class="index_box_icon" @click="jumpMap"> |
| | | <image src="@/static/icon/ic_fullscreen@2x.png" mode="widthFix"></image> |
| | |
| | | <text @click="jumpTC">更多优惠 ></text> |
| | | </view> |
| | | <scroll-view scroll-x class="scrollView"> |
| | | <view class="index_box_vip_row" v-for="(item, index) in 3" :key="index"> |
| | | <view class="index_box_vip_row" v-for="(item, index) in tcList" :key="index"> |
| | | <view class="vip1"> |
| | | <text>电单车年卡</text> |
| | | <text>365</text> |
| | | <view class="vip1_left"> |
| | | {{item.name || ''}} |
| | | </view> |
| | | <view class="vip1_right"> |
| | | {{item.price || ''}} |
| | | </view> |
| | | </view> |
| | | <view class="vip2"> |
| | | <text>365天畅骑,享受骑车乐趣</text> |
| | | <u>¥699</u> |
| | | <text>{{item.descs || ''}}</text> |
| | | <u>¥{{item.linePrice || ''}}</u> |
| | | </view> |
| | | <view class="vip3"> |
| | | <view class="vip3_info">低至1元/天</view> |
| | | <view class="vip3_button">购买</view> |
| | | <view class="vip3_info">低至{{item.dayPrice}}元/天</view> |
| | | <view class="vip3_button" @click="purchase(item.id)">购买</view> |
| | | </view> |
| | | </view> |
| | | </scroll-view> |
| | |
| | | <!-- 自行车-确认结算弹框 --> |
| | | <u-modal :show="show7" title="提示" content='确认结算吗?' :showCancelButton="true" cancelText="取消" @confirm="settlement1" @cancel="show7 = false"></u-modal> |
| | | <!-- 广告 --> |
| | | <u-popup :show="show" mode="center" :closeOnClickOverlay="false" overlayStyle="z-index: 10075;" bgColor="transparent" :round="10" @close="show = false"> |
| | | <u-popup :show="show" mode="center" :closeOnClickOverlay="false" zIndex="99999" bgColor="transparent" :round="10" @close="show = false"> |
| | | <view class="popupbox"> |
| | | <view class="advertisement"> |
| | | <image :src="info.adList[0].imgfullurl" mode="widthFix"></image> |
| | |
| | | </image> |
| | | </view> |
| | | </u-popup> |
| | | |
| | | <!-- 电车 --> |
| | | <tram ref="d_tram" @unlockDoor="refresh" /> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | import { |
| | | mapState |
| | | } from 'vuex' |
| | | |
| | | import tram from '@/components/tram/tram.vue' |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | content: '', |
| | | |
| | | timer: null, |
| | | isDisabled: true |
| | | isDisabled: true, |
| | | |
| | | tcList: [], |
| | | type: 1, |
| | | types: [ |
| | | { name: '自行车', id: 1 }, |
| | | { name: '电动车', id: 2 } |
| | | ], |
| | | eleBusinessArea: [ |
| | | { |
| | | points: [], |
| | | fillColor: "#0077FF12", |
| | | strokeColor: "#0077FF", |
| | | strokeWidth: 3, |
| | | zIndex: 7 |
| | | } |
| | | ], |
| | | onPullDownRefresh: false |
| | | } |
| | | }, |
| | | components: { tram }, |
| | | computed: { |
| | | ...mapState(['navHeight', 'statusbarHeight', 'userInfo']) |
| | | }, |
| | |
| | | // this.carRentalCopy(decodeURIComponent(options.scene)) |
| | | // } |
| | | }, |
| | | onPullDownRefresh() { |
| | | this.onPullDownRefresh = true |
| | | this.refresh() |
| | | }, |
| | | onShow() { |
| | | this.refresh() |
| | | }, |
| | | onPageScroll(e) { |
| | | this.top = e.scrollTop |
| | | }, |
| | | methods: { |
| | | clickcontrol(){ |
| | | let mapObjs = uni.createMapContext('mapId', this) |
| | | mapObjs.moveToLocation({ |
| | | complete: res => { |
| | | console.log('移动完成:', res) |
| | | } |
| | | }) |
| | | }, |
| | | async getEleBikeList() { |
| | | let res = await this.$u.api.eleBikeList({}) |
| | | if (res.code === 200) { |
| | | this.markers = [] |
| | | res.data.forEach((item, index) => { |
| | | this.markers.push({ |
| | | id: index, |
| | | width: 40, |
| | | height: 40, |
| | | latitude: item.latitude, |
| | | longitude: item.longitude, |
| | | title: item.name, |
| | | iconPath: '/static/icon/ic_bike@2x.png' |
| | | }) |
| | | }) |
| | | this.clickcontrol() |
| | | } |
| | | }, |
| | | clickType(id) { |
| | | this.type = id |
| | | if (id === 1) { |
| | | this.getSite() |
| | | } else { |
| | | this.getEleBikeList() |
| | | } |
| | | }, |
| | | purchase(id) { |
| | | uni.navigateTo({ |
| | | url: `/pages/packageDetails/packageDetails?id=${id}` |
| | | }); |
| | | }, |
| | | jumpTC() { |
| | | uni.navigateTo({ |
| | | url: '/pages/setMenu/setMenu' |
| | |
| | | }, |
| | | jumpMap() { |
| | | uni.navigateTo({ |
| | | url: '/pages/maps/maps' |
| | | url: `/pages/maps/maps?type=${this.type}` |
| | | }); |
| | | }, |
| | | // 计价规则 |
| | |
| | | addr: item.addr |
| | | }) |
| | | }) |
| | | this.clickcontrol() |
| | | } |
| | | }) |
| | | }, |
| | |
| | | }, |
| | | fail(err) { |
| | | that.disable = false |
| | | console.log(err) |
| | | } |
| | | }) |
| | | } |
| | |
| | | }, |
| | | // 扫码租车 |
| | | async carRental() { |
| | | var that = this; |
| | | // 刷新首页信息 |
| | | await this.refresh() |
| | | // 判断有没有交押金 |
| | | if (this.info.depositStatus === 0) { |
| | |
| | | uni.showToast({ title: '结算申请提交成功,请耐心等待退款!', icon: 'none', duration: 2000 }); |
| | | return; |
| | | } |
| | | var that = this; |
| | | if (!that.disable) { |
| | | that.disable = true |
| | | // 扫码解锁骑行 |
| | | uni.scanCode({ |
| | | success: async function(result) { |
| | | let text = decodeURIComponent(result.path) |
| | | text = text.substring(text.lastIndexOf('?') + 7, text.length) |
| | | // 打开开锁弹框 |
| | | that.show5 = true |
| | | // 调用开锁接口 |
| | | let res = await that.$u.api.openLock({ |
| | | code: text |
| | | }) |
| | | if (res.code === 200) { |
| | | that.disable = false |
| | | that.show6 = false |
| | | // 自行车 |
| | | if (this.type === 1) { |
| | | if (!that.disable) { |
| | | that.disable = true |
| | | // 扫码解锁骑行 |
| | | uni.scanCode({ |
| | | success: async function(result) { |
| | | let text = decodeURIComponent(result.path) |
| | | text = text.substring(text.lastIndexOf('?') + 7, text.length) |
| | | // 打开开锁弹框 |
| | | that.show5 = true |
| | | // 循环次数 |
| | | var num = 1 |
| | | // 循环查看解锁结果 |
| | | let timer = setInterval(async () => { |
| | | num += 1 |
| | | let res1 = await that.$u.api.refreshLock({ |
| | | id: res.data.id |
| | | }) |
| | | // 开锁成功 |
| | | if (res1.data.status === 1) { |
| | | that.refresh() |
| | | clearInterval(timer) |
| | | that.show5 = false |
| | | setTimeout(() => { |
| | | that.show2 = true |
| | | }, 500) |
| | | } |
| | | // 开锁失败 |
| | | if (res1.data.status === 3) { |
| | | that.refresh() |
| | | clearInterval(timer) |
| | | that.show5 = false |
| | | uni.showToast({ title: '开锁失败', icon: 'error', duration: 2000 }); |
| | | } |
| | | // 开锁超时 |
| | | if (num === 180) { |
| | | that.refresh() |
| | | clearInterval(timer) |
| | | that.show5 = false |
| | | uni.showToast({ title: '开锁超时', icon: 'error', duration: 2000 }); |
| | | } |
| | | }, 1000) |
| | | } else { |
| | | that.show5 = false |
| | | // 调用开锁接口 |
| | | let res = await that.$u.api.openLock({ |
| | | code: text |
| | | }) |
| | | if (res.code === 200) { |
| | | that.disable = false |
| | | that.show6 = false |
| | | that.show5 = true |
| | | // 循环次数 |
| | | var num = 1 |
| | | // 循环查看解锁结果 |
| | | let timer = setInterval(async () => { |
| | | num += 1 |
| | | let res1 = await that.$u.api.refreshLock({ |
| | | id: res.data.id |
| | | }) |
| | | // 开锁成功 |
| | | if (res1.data.status === 1) { |
| | | that.refresh() |
| | | clearInterval(timer) |
| | | that.show5 = false |
| | | setTimeout(() => { |
| | | that.show2 = true |
| | | }, 500) |
| | | } |
| | | // 开锁失败 |
| | | if (res1.data.status === 3) { |
| | | that.refresh() |
| | | clearInterval(timer) |
| | | that.show5 = false |
| | | uni.showToast({ title: '开锁失败', icon: 'error', duration: 2000 }); |
| | | } |
| | | // 开锁超时 |
| | | if (num === 180) { |
| | | that.refresh() |
| | | clearInterval(timer) |
| | | that.show5 = false |
| | | uni.showToast({ title: '开锁超时', icon: 'error', duration: 2000 }); |
| | | } |
| | | }, 1000) |
| | | } else { |
| | | that.show5 = false |
| | | that.disable = false |
| | | } |
| | | }, |
| | | fail() { |
| | | that.disable = false |
| | | } |
| | | }, |
| | | fail() { |
| | | that.disable = false |
| | | }); |
| | | } |
| | | } else { |
| | | uni.scanCode({ |
| | | success: async function(result) { |
| | | let res = await that.$u.api.getBikeChargingRule({ |
| | | code: result.result |
| | | }) |
| | | if (res.code === 200) { |
| | | that.$refs.d_tram.info = res.data |
| | | that.$refs.d_tram.d_show1 = true |
| | | } |
| | | } |
| | | }); |
| | | }) |
| | | } |
| | | }, |
| | | // 获取经纬度 |
| | |
| | | }, |
| | | // 获取首页信息 |
| | | getHomeInfo() { |
| | | var that = this |
| | | this.$u.api.home() |
| | | .then(res => { |
| | | .then(async res => { |
| | | if (res.code === 200) { |
| | | this.info = res.data |
| | | // 是否弹出广告图 |
| | | if (res.data.adList.length > 0) { |
| | | if (res.data.adList.length > 0 && !res.data.memberRidesResponse) { |
| | | this.show = true |
| | | } |
| | | // 解锁中 |
| | | if (res.data.rideStatus === 0) { |
| | | this.show5 = true |
| | | // 循环次数 |
| | | var num = 1 |
| | | // 循环查看解锁结果 |
| | | let timer = setInterval(async () => { |
| | | num += 1 |
| | | let res1 = await this.$u.api.refreshLock({ |
| | | id: res.data.memberRidesResponse.rideId |
| | | }) |
| | | // 开锁成功 |
| | | if (res1.data.status === 1) { |
| | | clearInterval(timer) |
| | | this.show5 = false |
| | | setTimeout(() => { |
| | | this.show2 = true |
| | | }, 500) |
| | | } |
| | | // 开锁失败 |
| | | if (res1.data.status === 3) { |
| | | clearInterval(timer) |
| | | this.show5 = false |
| | | uni.showToast({ title: '开锁失败', icon: 'error', duration: 2000 }); |
| | | } |
| | | // 开锁超时 |
| | | if (num === 180) { |
| | | clearInterval(timer) |
| | | this.show5 = false |
| | | uni.showToast({ title: '开锁超时', icon: 'error', duration: 2000 }); |
| | | } |
| | | }, 1000) |
| | | } |
| | | // 骑行中 |
| | | if (res.data.rideStatus === 1) { |
| | | this.show2 = true |
| | | this.refreshStatus() |
| | | } |
| | | if (res.data.rideStatus === 5) { |
| | | this.show5 = true |
| | | } |
| | | if (res.data.rideStatus === 2) { |
| | | this.show6 = true |
| | | this.refreshStatus() |
| | | // 自行车 |
| | | if (res.data.memberRidesResponse && res.data.memberRidesResponse.ridesType === 0) { |
| | | this.type = 1 |
| | | // 解锁中 |
| | | if (res.data.rideStatus === 0) { |
| | | this.show5 = true |
| | | // 循环次数 |
| | | var num = 1 |
| | | // 循环查看解锁结果 |
| | | let timer = setInterval(async () => { |
| | | num += 1 |
| | | let res1 = await this.$u.api.refreshLock({ |
| | | id: res.data.memberRidesResponse.rideId |
| | | }) |
| | | // 开锁成功 |
| | | if (res1.data.status === 1) { |
| | | clearInterval(timer) |
| | | this.show5 = false |
| | | setTimeout(() => { |
| | | this.show2 = true |
| | | }, 500) |
| | | } |
| | | // 开锁失败 |
| | | if (res1.data.status === 3) { |
| | | clearInterval(timer) |
| | | this.show5 = false |
| | | uni.showToast({ title: '开锁失败', icon: 'error', duration: 2000 }); |
| | | } |
| | | // 开锁超时 |
| | | if (num === 180) { |
| | | clearInterval(timer) |
| | | this.show5 = false |
| | | uni.showToast({ title: '开锁超时', icon: 'error', duration: 2000 }); |
| | | } |
| | | }, 1000) |
| | | } |
| | | // 骑行中 |
| | | if (res.data.rideStatus === 1) { |
| | | this.show2 = true |
| | | this.refreshStatus() |
| | | } |
| | | if (res.data.rideStatus === 5) { |
| | | this.show5 = true |
| | | } |
| | | if (res.data.rideStatus === 2) { |
| | | this.show6 = true |
| | | this.refreshStatus() |
| | | } |
| | | } else if (res.data.memberRidesResponse && res.data.memberRidesResponse.ridesType === 1) { |
| | | this.type = 2 |
| | | that.$refs.d_tram.info = { |
| | | ...res.data.memberRidesResponse.discountMember, |
| | | ...res.data.memberRidesResponse, |
| | | deposit: res.data.deposit, |
| | | goodsOrderId: res.data.goodsOrderId |
| | | } |
| | | // 骑行中 |
| | | if (res.data.rideStatus === 1) { |
| | | that.$refs.d_tram.d_show3 = true |
| | | } |
| | | // 临时锁车 |
| | | if (res.data.rideStatus === 4) { |
| | | that.$refs.d_tram.d_show4 = true |
| | | } |
| | | } |
| | | // 是否营业 |
| | | if (res.data.isBusiness === 0) { |
| | |
| | | this.content = res.data.stopServeTips |
| | | this.show4 = true |
| | | } |
| | | this.tcList = res.data.discountList |
| | | let arr = JSON.parse(res.data.eleBusinessArea) |
| | | this.eleBusinessArea[0].points = arr.map(item => { |
| | | return { |
| | | latitude: item.lat, |
| | | longitude: item.lng |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | |
| | | refresh() { |
| | | this.$u.api.home() |
| | | .then(res => { |
| | | uni.stopPullDownRefresh() |
| | | if (res.code === 200) { |
| | | this.info = res.data |
| | | // 解锁中 |
| | | if (res.data.rideStatus === 0) { |
| | | this.show5 = true |
| | | // 循环次数 |
| | | var num = 1 |
| | | // 循环查看解锁结果 |
| | | let timer = setInterval(async () => { |
| | | num += 1 |
| | | let res1 = await this.$u.api.refreshLock({ |
| | | id: res.data.memberRidesResponse.rideId |
| | | }) |
| | | // 开锁成功 |
| | | if (res1.data.status === 1) { |
| | | clearInterval(timer) |
| | | this.show5 = false |
| | | setTimeout(() => { |
| | | this.show2 = true |
| | | }, 500) |
| | | } |
| | | // 开锁失败 |
| | | if (res1.data.status === 3) { |
| | | clearInterval(timer) |
| | | this.show5 = false |
| | | uni.showToast({ title: '开锁失败', icon: 'error', duration: 2000 }); |
| | | } |
| | | // 开锁超时 |
| | | if (num === 180) { |
| | | clearInterval(timer) |
| | | this.show5 = false |
| | | uni.showToast({ title: '开锁超时', icon: 'error', duration: 2000 }); |
| | | } |
| | | }, 1000) |
| | | // 未查到骑行订单 |
| | | if (!res.data.memberRidesResponse && this.onPullDownRefresh) { |
| | | this.show1 = false |
| | | this.show2 = false |
| | | this.show3 = false |
| | | this.show4 = false |
| | | this.show5 = false |
| | | this.show6 = false |
| | | this.show7 = false |
| | | |
| | | that.$refs.d_tram.d_show = false |
| | | that.$refs.d_tram.d_show1 = false |
| | | that.$refs.d_tram.d_show2 = false |
| | | that.$refs.d_tram.d_show3 = false |
| | | that.$refs.d_tram.d_show4 = false |
| | | that.$refs.d_tram.d_show5 = false |
| | | that.$refs.d_tram.d_show6 = false |
| | | that.$refs.d_tram.d_show7 = false |
| | | that.$refs.d_tram.d_show8 = false |
| | | that.$refs.d_tram.d_show9 = false |
| | | this.onPullDownRefresh = false |
| | | return |
| | | } |
| | | if (res.data.rideStatus === 1) { |
| | | this.show2 = true |
| | | this.refreshStatus() |
| | | } |
| | | if (res.data.rideStatus === 5) { |
| | | this.show5 = true |
| | | } |
| | | if (res.data.rideStatus === 2) { |
| | | this.show6 = true |
| | | // 自行车 |
| | | if (res.data.memberRidesResponse.ridesType === 0) { |
| | | // 解锁中 |
| | | if (res.data.rideStatus === 0) { |
| | | this.show5 = true |
| | | // 循环次数 |
| | | var num = 1 |
| | | // 循环查看解锁结果 |
| | | let timer = setInterval(async () => { |
| | | num += 1 |
| | | let res1 = await this.$u.api.refreshLock({ |
| | | id: res.data.memberRidesResponse.rideId |
| | | }) |
| | | // 开锁成功 |
| | | if (res1.data.status === 1) { |
| | | clearInterval(timer) |
| | | this.show5 = false |
| | | setTimeout(() => { |
| | | this.show2 = true |
| | | }, 500) |
| | | } |
| | | // 开锁失败 |
| | | if (res1.data.status === 3) { |
| | | clearInterval(timer) |
| | | this.show5 = false |
| | | uni.showToast({ title: '开锁失败', icon: 'error', duration: 2000 }); |
| | | } |
| | | // 开锁超时 |
| | | if (num === 180) { |
| | | clearInterval(timer) |
| | | this.show5 = false |
| | | uni.showToast({ title: '开锁超时', icon: 'error', duration: 2000 }); |
| | | } |
| | | }, 1000) |
| | | } |
| | | if (res.data.rideStatus === 1) { |
| | | this.show2 = true |
| | | this.refreshStatus() |
| | | } |
| | | if (res.data.rideStatus === 5) { |
| | | this.show5 = true |
| | | } |
| | | if (res.data.rideStatus === 2) { |
| | | this.show6 = true |
| | | } |
| | | } else if (res.data.memberRidesResponse.ridesType === 1) { |
| | | this.type = 2 |
| | | this.$refs.d_tram.info = { |
| | | ...res.data.memberRidesResponse.discountMember, |
| | | ...res.data.memberRidesResponse, |
| | | deposit: res.data.deposit, |
| | | goodsOrderId: res.data.goodsOrderId |
| | | } |
| | | // 骑行中 |
| | | if (res.data.rideStatus === 1) { |
| | | this.$refs.d_tram.d_show3 = true |
| | | } |
| | | // 临时锁车 |
| | | if (res.data.rideStatus === 4) { |
| | | this.$refs.d_tram.d_show4 = true |
| | | } |
| | | } |
| | | } |
| | | }) |
| | |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | text { |
| | | &:nth-child(1) { |
| | | font-weight: 500; |
| | | font-size: 32rpx; |
| | | color: #303030; |
| | | } |
| | | &:nth-child(2) { |
| | | .vip1_left { |
| | | flex: 1; |
| | | font-weight: 500; |
| | | font-size: 32rpx; |
| | | color: #303030; |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | } |
| | | .vip1_right { |
| | | flex-shrink: 0; |
| | | margin-left: 30rpx; |
| | | font-weight: 400; |
| | | font-size: 40rpx; |
| | | color: #FF5A31; |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | &:before { |
| | | content: '¥'; |
| | | font-weight: 400; |
| | | font-size: 40rpx; |
| | | font-size: 26rpx; |
| | | color: #FF5A31; |
| | | &:before { |
| | | content: '¥'; |
| | | font-weight: 400; |
| | | font-size: 26rpx; |
| | | color: #FF5A31; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | margin-top: 10rpx; |
| | | margin-bottom: 16rpx; |
| | | text { |
| | | flex: 1; |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | font-weight: 400; |
| | | font-size: 26rpx; |
| | | color: #777777; |
| | | } |
| | | u { |
| | | flex-shrink: 0; |
| | | font-weight: 400; |
| | | font-size: 24rpx; |
| | | color: #999999; |
| | | text-decoration: line-through; |
| | | } |
| | | } |
| | | .vip3 { |