|
@@ -1,30 +1,24 @@
|
|
|
<template>
|
|
|
<view class="content">
|
|
|
<!-- 顶部导航 -->
|
|
|
- <uni-nav-bar
|
|
|
- :border="false"
|
|
|
- @clickLeft="toUserCenter"
|
|
|
- background-color="#fff"
|
|
|
- title="智能快洗"
|
|
|
- :status-bar="true"
|
|
|
- :fixed="true"
|
|
|
+ <uni-nav-bar :border="false" @clickLeft="toUserCenter" background-color="#fff" title="智能快洗" :status-bar="true" :fixed="true"
|
|
|
color="rgb(255,0,0)">
|
|
|
- <view style="padding-left: 20rpx;" slot="left">
|
|
|
- <u-image width="40rpx" height="60rpx" mode="aspectFit" src="/static/img/person.png"></u-image>
|
|
|
- </view>
|
|
|
+ <view style="padding-left: 20rpx;" slot="left">
|
|
|
+ <u-image width="40rpx" height="60rpx" mode="aspectFit" src="/static/img/person.png"></u-image>
|
|
|
+ </view>
|
|
|
</uni-nav-bar>
|
|
|
<!-- 页面主体 -->
|
|
|
<view class="pageContent">
|
|
|
<map id="map" :latitude="lat" :longitude="lng" scale="10" show-compass :markers="markers" @markertap="markertap"
|
|
|
show-location style="width: 100%; height:100%;">
|
|
|
- <!-- 信息提示 -->
|
|
|
- <cover-view class="work-message" v-if="workStatus!='stop'" @click="toWork">
|
|
|
- <cover-view class="work-message-in">
|
|
|
- <cover-view class="view">洗车机正在工作中...</cover-view>
|
|
|
- <cover-view class="view">点击进入</cover-view>
|
|
|
- </cover-view>
|
|
|
- </cover-view>
|
|
|
- <!-- 左边控件 -->
|
|
|
+ <!-- 信息提示 -->
|
|
|
+ <cover-view class="work-message" v-if="workStatus!='stop'" @click="toWork">
|
|
|
+ <cover-view class="work-message-in">
|
|
|
+ <cover-view class="view">洗车机正在工作中...</cover-view>
|
|
|
+ <cover-view class="view">点击进入</cover-view>
|
|
|
+ </cover-view>
|
|
|
+ </cover-view>
|
|
|
+ <!-- 左边控件 -->
|
|
|
<view class="cover-view">
|
|
|
<view class="flex-wrp">
|
|
|
<cover-view @click="intoList" class="flex-item">
|
|
@@ -47,11 +41,14 @@
|
|
|
</view>
|
|
|
<view class="cover-bottom">
|
|
|
<button @click="scanCode" type="warn">
|
|
|
- <u-icon name="scan" color="#fff" size="38"></u-icon>
|
|
|
+ <u-icon name="scan" color="#fff" size="38"></u-icon>
|
|
|
扫码洗车
|
|
|
</button>
|
|
|
</view>
|
|
|
</map>
|
|
|
+ <!-- 用户未授权提示框 -->
|
|
|
+ <u-modal v-model="showPop" @confirm="intoSetting" :show-cancel-button='false'
|
|
|
+ confirm-text="设置" title="温馨提示" content="无法获取位置信息,请设置允许使用位置信息" width="70%"></u-modal>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -59,20 +56,28 @@
|
|
|
<script>
|
|
|
import uniNavBar from "@/components/uni-nav-bar/uni-nav-bar.vue"
|
|
|
import uniPopup from '@/components/uni-popup/uni-popup.vue'
|
|
|
- import {checkLogin} from '@/api/login.js'
|
|
|
- import {getMapStoreList} from '@/api/store.js'
|
|
|
- import {getLookUpDatas} from '@/api/data.js'
|
|
|
+ import {
|
|
|
+ checkLogin
|
|
|
+ } from '@/api/login.js'
|
|
|
+ import {
|
|
|
+ getMapStoreList
|
|
|
+ } from '@/api/store.js'
|
|
|
+ import {
|
|
|
+ getLookUpDatas
|
|
|
+ } from '@/api/data.js'
|
|
|
export default {
|
|
|
components: {
|
|
|
- uniNavBar, uniPopup
|
|
|
+ uniNavBar,
|
|
|
+ uniPopup
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- workStatus:'',
|
|
|
+ workStatus: '',
|
|
|
mapCtx: null, // 地图对象
|
|
|
markers: [], // 标注点
|
|
|
lng: '',
|
|
|
lat: '',
|
|
|
+ showPop: false // 是否显示用户未授权提示框
|
|
|
}
|
|
|
},
|
|
|
onReady() {
|
|
@@ -80,9 +85,9 @@
|
|
|
},
|
|
|
onShow() {
|
|
|
this.workStatus = this.$store.state.vuex_workStatus
|
|
|
+ this.getUserLocation()
|
|
|
},
|
|
|
onLoad() {
|
|
|
- this.getUserLocation()
|
|
|
// 获取订单状态数据字典
|
|
|
this.getCodeList('ORDER_STATUS')
|
|
|
// 获取支付方式数据字典
|
|
@@ -92,19 +97,21 @@
|
|
|
},
|
|
|
methods: {
|
|
|
// 获取数据字典
|
|
|
- getCodeList (code) {
|
|
|
- getLookUpDatas({type:code}).then(res =>{
|
|
|
+ getCodeList(code) {
|
|
|
+ getLookUpDatas({
|
|
|
+ type: code
|
|
|
+ }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- console.log(res.data,'res.data')
|
|
|
- switch (code){
|
|
|
+ console.log(res.data, 'res.data')
|
|
|
+ switch (code) {
|
|
|
case 'ORDER_STATUS':
|
|
|
- this.$u.vuex('vuex_payStatus', res.data)
|
|
|
+ this.$u.vuex('vuex_payStatus', res.data)
|
|
|
break;
|
|
|
case 'PAY_TYPE':
|
|
|
- this.$u.vuex('vuex_payType', res.data)
|
|
|
+ this.$u.vuex('vuex_payType', res.data)
|
|
|
break;
|
|
|
case 'STORE_LABEL':
|
|
|
- this.$u.vuex('vuex_storeLabel', res.data)
|
|
|
+ this.$u.vuex('vuex_storeLabel', res.data)
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
@@ -113,7 +120,7 @@
|
|
|
})
|
|
|
},
|
|
|
// 如果机器正在运行,提示并点击跳转的运行界面
|
|
|
- toWork(){
|
|
|
+ toWork() {
|
|
|
uni.navigateTo({
|
|
|
url: "/pages/work/index/index"
|
|
|
})
|
|
@@ -129,15 +136,13 @@
|
|
|
if (!res.authSetting['scope.userLocation']) {
|
|
|
uni.authorize({
|
|
|
scope: 'scope.userLocation',
|
|
|
- success() {
|
|
|
+ success(res) {
|
|
|
// 用户已经同意小程序使用位置信息,后续调用 uni.getLocation 接口不会弹窗询问
|
|
|
_this.getLocation()
|
|
|
},
|
|
|
// 用户拒绝授权位置信息时默认展示青海西宁位置地图
|
|
|
fail: (err) => {
|
|
|
- _this.lng = '101.760521'
|
|
|
- _this.lat = '36.636193'
|
|
|
- _this.markers = _this.getMarkersData()
|
|
|
+ _this.showPop = true
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
@@ -147,12 +152,32 @@
|
|
|
})
|
|
|
// #endif
|
|
|
},
|
|
|
+ // 打开位置设置界面
|
|
|
+ intoSetting () {
|
|
|
+ let _this = this
|
|
|
+ uni.openSetting({
|
|
|
+ success(res) {
|
|
|
+ console.log(res,'222')
|
|
|
+ let data = res.authSetting
|
|
|
+ if (data['scope.userLocation']) {
|
|
|
+ _this.showPop = false
|
|
|
+ _this.getLocation()
|
|
|
+ } else {
|
|
|
+ _this.showPop = true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail() {
|
|
|
+ _this.showPop = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 获取用户位置
|
|
|
- getLocation () {
|
|
|
+ getLocation() {
|
|
|
uni.getLocation({
|
|
|
- type: 'gcj02',
|
|
|
+ type: 'gcj02',
|
|
|
success: (res) => {
|
|
|
- console.log(res,'rrrr')
|
|
|
+ console.log(res, 'rrrr')
|
|
|
+ this.showPop = false
|
|
|
let latitude = res.latitude;
|
|
|
let longitude = res.longitude;
|
|
|
this.lng = longitude
|
|
@@ -183,7 +208,7 @@
|
|
|
lat: this.lat,
|
|
|
lng: this.lng
|
|
|
}
|
|
|
- getMapStoreList(params).then(res=>{
|
|
|
+ getMapStoreList(params).then(res => {
|
|
|
uni.hideLoading()
|
|
|
if (res.status == 200) {
|
|
|
let markData = res.data
|
|
@@ -193,28 +218,28 @@
|
|
|
markers.push(marker)
|
|
|
}
|
|
|
this.markers = markers
|
|
|
- console.log(this.markers,'111111')
|
|
|
+ console.log(this.markers, '111111')
|
|
|
} else {
|
|
|
this.toashMsg(res.message)
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
// 点击回到定位坐标点
|
|
|
- moveToLocation () {
|
|
|
+ moveToLocation() {
|
|
|
this.mapCtx.moveToLocation()
|
|
|
},
|
|
|
// 进入个人中心
|
|
|
- toUserCenter () {
|
|
|
+ toUserCenter() {
|
|
|
// 检验是否登录或登录是否过期
|
|
|
- checkLogin().then(res =>{
|
|
|
- if (res.status == '200'){
|
|
|
+ checkLogin().then(res => {
|
|
|
+ if (res.status == '200') {
|
|
|
uni.navigateTo({
|
|
|
- url: '/pages/userCenter/index'
|
|
|
+ url: '/pages/userCenter/index'
|
|
|
})
|
|
|
- } else if(res.status=='9001') {
|
|
|
+ } else if (res.status == '9001') {
|
|
|
uni.navigateTo({
|
|
|
- url:`/pages/login/login?lanuch=${false}&path=` + encodeURIComponent('/pages/userCenter/index')
|
|
|
+ url: `/pages/login/login?lanuch=${false}&path=` + encodeURIComponent('/pages/userCenter/index')
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@@ -222,33 +247,33 @@
|
|
|
// 打开网点列表
|
|
|
intoList() {
|
|
|
uni.navigateTo({
|
|
|
- url: '/pages/store/storeList'
|
|
|
+ url: '/pages/store/storeList'
|
|
|
})
|
|
|
},
|
|
|
// 联系客服
|
|
|
openPop() {
|
|
|
- let _this = this
|
|
|
- uni.showActionSheet({
|
|
|
- itemList: ['电话客服'],
|
|
|
- success: function (res) {
|
|
|
- //电话客服
|
|
|
- if(res.tapIndex == 0){
|
|
|
- _this.callPhone()
|
|
|
- }
|
|
|
- },
|
|
|
- fail: function (res) {
|
|
|
- console.log(res.errMsg);
|
|
|
- }
|
|
|
- });
|
|
|
+ let _this = this
|
|
|
+ uni.showActionSheet({
|
|
|
+ itemList: ['电话客服'],
|
|
|
+ success: function(res) {
|
|
|
+ //电话客服
|
|
|
+ if (res.tapIndex == 0) {
|
|
|
+ _this.callPhone()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: function(res) {
|
|
|
+ console.log(res.errMsg);
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
// 电话客服
|
|
|
- callPhone () {
|
|
|
+ callPhone() {
|
|
|
uni.makePhoneCall({
|
|
|
- phoneNumber: '114'
|
|
|
+ phoneNumber: '114'
|
|
|
})
|
|
|
},
|
|
|
// 扫码洗车
|
|
|
- scanCode () {
|
|
|
+ scanCode() {
|
|
|
// uni.scanCode({
|
|
|
// success: function (res) {
|
|
|
// console.log('条码类型:' + res.scanType);
|
|
@@ -264,9 +289,9 @@
|
|
|
let latitude = point.lat;
|
|
|
let longitude = point.lng;
|
|
|
let iconPath = ''
|
|
|
- if (point.businessStatus==='CLOSED') {
|
|
|
+ if (point.businessStatus === 'CLOSED') {
|
|
|
iconPath = '/static/img/store-dky.png'
|
|
|
- } else if (point.businessStatus==='OPEN') {
|
|
|
+ } else if (point.businessStatus === 'OPEN') {
|
|
|
iconPath = '/static/img/store.png'
|
|
|
} else {
|
|
|
iconPath = '/static/img/store-zt.png'
|
|
@@ -302,25 +327,29 @@
|
|
|
.pageContent {
|
|
|
width: 100%;
|
|
|
flex: 1;
|
|
|
- .work-message{
|
|
|
+
|
|
|
+ .work-message {
|
|
|
position: absolute;
|
|
|
top: 6%;
|
|
|
width: 80%;
|
|
|
left: 50%;
|
|
|
margin-left: -40%;
|
|
|
- background: rgba(0,0,0,0.6);
|
|
|
+ background: rgba(0, 0, 0, 0.6);
|
|
|
border-radius: 100rpx;
|
|
|
color: #eee;
|
|
|
- .work-message-in{
|
|
|
+
|
|
|
+ .work-message-in {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
padding: 26rpx;
|
|
|
- .view{
|
|
|
- &:first-child{
|
|
|
+
|
|
|
+ .view {
|
|
|
+ &:first-child {
|
|
|
flex-grow: 1;
|
|
|
text-align: center;
|
|
|
}
|
|
|
- &:last-child{
|
|
|
+
|
|
|
+ &:last-child {
|
|
|
font-size: 24rpx;
|
|
|
color: #fff;
|
|
|
display: flex;
|
|
@@ -329,10 +358,12 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.cover-view {
|
|
|
position: absolute;
|
|
|
top: calc(60% - 150rpx);
|
|
|
left: calc(50% - 360rpx);
|
|
|
+
|
|
|
.flex-wrp {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
@@ -340,6 +371,7 @@
|
|
|
border-radius: 10rpx;
|
|
|
padding: 10rpx 0;
|
|
|
}
|
|
|
+
|
|
|
.flex-item {
|
|
|
width: 110rpx;
|
|
|
height: 110rpx;
|
|
@@ -349,6 +381,7 @@
|
|
|
flex-direction: column;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
+
|
|
|
.img {
|
|
|
width: 50rpx;
|
|
|
height: 50rpx;
|
|
@@ -356,30 +389,35 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .cover-location{
|
|
|
+
|
|
|
+ .cover-location {
|
|
|
position: absolute;
|
|
|
top: calc(75%);
|
|
|
left: calc(85%);
|
|
|
- .img{
|
|
|
+
|
|
|
+ .img {
|
|
|
width: 80rpx;
|
|
|
height: 80rpx;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.cover-bottom {
|
|
|
position: absolute;
|
|
|
bottom: calc(60rpx);
|
|
|
width: 80%;
|
|
|
left: calc(9%);
|
|
|
- uni-button[type=warn]{
|
|
|
+
|
|
|
+ uni-button[type=warn] {
|
|
|
background: red;
|
|
|
- u-icon{
|
|
|
+
|
|
|
+ u-icon {
|
|
|
margin-right: 15rpx;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
</style>
|