更新
@@ -57,7 +57,7 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
console.log(this.data.tags, 'data.tags')
|
// console.log(this.data.tags, 'data.tags')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goDetails() {
|
goDetails() {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
import ChargingStation from "../ChargingStation/index.vue"
|
import ChargingStation from "../ChargingStation/index.vue"
|
||||||
import order from "../order/index.vue"
|
import order from "../order/index.vue"
|
||||||
import personal from "../personal/index.vue"
|
import personal from "../personal/index.vue"
|
||||||
import x from "./index.js"
|
import x from "./index.js"
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
tabBar,
|
tabBar,
|
||||||
@@ -36,69 +36,71 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
tabBarIndex(n,o) {
|
tabBarIndex(n, o) {
|
||||||
let that = this
|
let that = this
|
||||||
if(n==1){
|
if (n == 1) {
|
||||||
this.$refs.ChargingStation.onshow()
|
this.$refs.ChargingStation.onshow()
|
||||||
}else if(n==2){
|
} else if (n == 2) {
|
||||||
this.readyScanCode({
|
this.readyScanCode({
|
||||||
success(){
|
success() {
|
||||||
that.scanCode();
|
that.scanCode();
|
||||||
},
|
},
|
||||||
fail(){
|
fail() {
|
||||||
if(n!==o) that.tabBarIndex = o;
|
if (n !== o) that.tabBarIndex = o;
|
||||||
if(n==o) that.tabBarIndex=0;
|
if (n == o) that.tabBarIndex = 0;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.init()
|
this.init()
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.onOrderUpdate();
|
this.onOrderUpdate();
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.showInit()
|
this.showInit()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
readyScanCode({success,fail}){
|
readyScanCode({
|
||||||
if(!this.user){
|
success,
|
||||||
|
fail
|
||||||
|
}) {
|
||||||
|
if (!this.user) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '登录后才可扫码下单哦',
|
content: '登录后才可扫码下单哦',
|
||||||
confirmText:'去登陆',
|
confirmText: '去登陆',
|
||||||
success: function (res) {
|
success: function(res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/login/index'
|
url: '/pages/login/index'
|
||||||
})
|
})
|
||||||
} else if (res.cancel) {
|
} else if (res.cancel) {
|
||||||
fail()
|
fail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
try{
|
try {
|
||||||
success()
|
success()
|
||||||
}catch(e){
|
} catch (e) {
|
||||||
fail()
|
fail()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async scanCode() {
|
async scanCode() {
|
||||||
|
let res = await this.tool.scanCode().catch(err => {
|
||||||
let res = await this.tool.scanCode().catch(err=>{
|
// console.log('取消');
|
||||||
console.log('取消');
|
this.tabBarIndex = 0
|
||||||
this.tabBarIndex = 0
|
|
||||||
});
|
});
|
||||||
if (res?.result) {
|
if (res?.result) {
|
||||||
let routingParameter = this.tool.routingParameterGeneration({
|
let routingParameter = this.tool.routingParameterGeneration({
|
||||||
type:'qrCode',
|
type: 'qrCode',
|
||||||
qrCode:encodeURIComponent(res.result),
|
qrCode: encodeURIComponent(res.result),
|
||||||
pointTo:'activeScanCode'
|
pointTo: 'activeScanCode'
|
||||||
})
|
})
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/ChargingStation/pages/placeOrder/index${routingParameter}`
|
url: `/ChargingStation/pages/placeOrder/index${routingParameter}`
|
||||||
@@ -114,8 +116,8 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
showInit() {
|
showInit() {
|
||||||
this.tool.getCards();
|
this.tool.getCards();
|
||||||
if(this.tabBarIndex==2){
|
if (this.tabBarIndex == 2) {
|
||||||
this.tabBarIndex = 0
|
this.tabBarIndex = 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,12 +16,12 @@
|
|||||||
this.init(e)
|
this.init(e)
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.imgURL = `${this.baseImgURL}/start.png`
|
this.imgURL = `${this.baseImgURL}/start-color.png`
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
Interceptor(id) {
|
Interceptor(id) {
|
||||||
let taht = this
|
let taht = this
|
||||||
console.log(`%c 检测到参数拦截器启动`, 'color:red;font-size:50px');
|
// console.log(`%c 检测到参数拦截器启动`, 'color:red;font-size:50px');
|
||||||
wxCode.getQrCodeType({
|
wxCode.getQrCodeType({
|
||||||
qrCode: id
|
qrCode: id
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
@@ -46,6 +46,7 @@
|
|||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url:'/pages/index/index'
|
url:'/pages/index/index'
|
||||||
})
|
})
|
||||||
|
|
||||||
// uni.redirectTo({
|
// uni.redirectTo({
|
||||||
// url:'/pages/login/index'
|
// url:'/pages/login/index'
|
||||||
// })
|
// })
|
||||||
|
|||||||
BIN
static/Scan.png
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.5 KiB |
BIN
static/logo.png
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 9.9 KiB |
|
Before Width: | Height: | Size: 899 B After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 855 B After Width: | Height: | Size: 2.1 KiB |
131
utils/tool.js
@@ -15,7 +15,7 @@ class Anticorrosive {
|
|||||||
this.configure = configure;
|
this.configure = configure;
|
||||||
return this.chenk();
|
return this.chenk();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 递归 生成数据结构
|
// 递归 生成数据结构
|
||||||
generate(data, configure) {
|
generate(data, configure) {
|
||||||
// 通过传入的源数据生成相应的数据结构
|
// 通过传入的源数据生成相应的数据结构
|
||||||
@@ -101,19 +101,19 @@ class Anticorrosive {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
Anticorrosive,
|
Anticorrosive,
|
||||||
getPhone(e){
|
getPhone(e) {
|
||||||
return new Promise((re,rj)=>{
|
return new Promise((re, rj) => {
|
||||||
const data1 = {
|
const data1 = {
|
||||||
...e.detail,
|
...e.detail,
|
||||||
sessionKey: uni.getStorageSync('sessionKey'),
|
sessionKey: uni.getStorageSync('sessionKey'),
|
||||||
unionId: uni.getStorageSync('unionid'),
|
unionId: uni.getStorageSync('unionid'),
|
||||||
openId: uni.getStorageSync('openid'),
|
openId: uni.getStorageSync('openid'),
|
||||||
appId: 'wxed3e2914d6aa4d52'
|
appId: 'wxed3e2914d6aa4d52'
|
||||||
};
|
};
|
||||||
oilIdentityApi.ackPhone(data1).then(resj => {
|
oilIdentityApi.ackPhone(data1).then(resj => {
|
||||||
re(resj.data)
|
re(resj.data)
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async WXlogin(e) {
|
async WXlogin(e) {
|
||||||
return new Promise((re, rj) => {
|
return new Promise((re, rj) => {
|
||||||
@@ -141,16 +141,16 @@ export default {
|
|||||||
title: '微信登录失败提醒',
|
title: '微信登录失败提醒',
|
||||||
content: `${res.msg}如有疑问,请联系客服处理`
|
content: `${res.msg}如有疑问,请联系客服处理`
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '登陆失败',
|
title: '登陆失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
fail: err => {},
|
fail: err => {},
|
||||||
})
|
})
|
||||||
@@ -216,11 +216,12 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
userLocationChenk(){
|
userLocationChenk() {
|
||||||
return new Promise((re,rj)=>{
|
return new Promise((re, rj) => {
|
||||||
wx.getSetting({
|
wx.getSetting({
|
||||||
success(res) {
|
success(res) {
|
||||||
if (typeof(res.authSetting['scope.userLocation']) != 'undefined' && !res.authSetting[
|
if (typeof(res.authSetting['scope.userLocation']) != 'undefined' && !res
|
||||||
|
.authSetting[
|
||||||
'scope.userLocation']) {
|
'scope.userLocation']) {
|
||||||
// 用户没有授权
|
// 用户没有授权
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
@@ -246,41 +247,41 @@ export default {
|
|||||||
rj('openSetting调用失败')
|
rj('openSetting调用失败')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
rj('取消授权')
|
rj('取消授权')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
re()
|
re()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail(err){
|
fail(err) {
|
||||||
rj(err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
ReverseAddress(latitude,longitude){
|
|
||||||
const qqmapsdk = new QQMapWX({
|
|
||||||
key: 'NYEBZ-YURY3-XTU3N-YBR54-PKW6E-ROB2F'
|
|
||||||
});
|
|
||||||
return new Promise((re,rj)=>{
|
|
||||||
qqmapsdk.reverseGeocoder({
|
|
||||||
location: {
|
|
||||||
latitude:latitude,
|
|
||||||
longitude: longitude
|
|
||||||
},
|
|
||||||
success(addressRes){
|
|
||||||
re(addressRes)
|
|
||||||
},
|
|
||||||
fail(err){
|
|
||||||
rj(err)
|
rj(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
ReverseAddress(latitude, longitude) {
|
||||||
|
const qqmapsdk = new QQMapWX({
|
||||||
|
key: 'NYEBZ-YURY3-XTU3N-YBR54-PKW6E-ROB2F'
|
||||||
|
});
|
||||||
|
return new Promise((re, rj) => {
|
||||||
|
qqmapsdk.reverseGeocoder({
|
||||||
|
location: {
|
||||||
|
latitude: latitude,
|
||||||
|
longitude: longitude
|
||||||
|
},
|
||||||
|
success(addressRes) {
|
||||||
|
re(addressRes)
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
rj(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
getLocation() {
|
getLocation() {
|
||||||
return new Promise((re, rj) => {
|
return new Promise((re, rj) => {
|
||||||
@@ -296,16 +297,16 @@ export default {
|
|||||||
latitude: res.latitude,
|
latitude: res.latitude,
|
||||||
longitude: res.longitude
|
longitude: res.longitude
|
||||||
},
|
},
|
||||||
success(addressRes){
|
success(addressRes) {
|
||||||
var address = addressRes.result.formatted_addresses.recommend;
|
var address = addressRes.result.formatted_addresses.recommend;
|
||||||
let location = {
|
let location = {
|
||||||
...res,
|
...res,
|
||||||
address
|
address
|
||||||
}
|
}
|
||||||
uni.setStorageSync('location',location );
|
uni.setStorageSync('location', location);
|
||||||
re(location)
|
re(location)
|
||||||
},
|
},
|
||||||
fail(err){
|
fail(err) {
|
||||||
rj(err)
|
rj(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -318,33 +319,33 @@ export default {
|
|||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
routingParameterGeneration(parameter){
|
routingParameterGeneration(parameter) {
|
||||||
if(parameter==null||parameter==undefined) return;
|
if (parameter == null || parameter == undefined) return;
|
||||||
const parameterType = typeof parameter;
|
const parameterType = typeof parameter;
|
||||||
if( parameterType== 'string'){
|
if (parameterType == 'string') {
|
||||||
let obj = {};
|
let obj = {};
|
||||||
let splitParameter = parameter.split('?');
|
let splitParameter = parameter.split('?');
|
||||||
if(splitParameter.length<=1){
|
if (splitParameter.length <= 1) {
|
||||||
console.warn("暂无路径参数");
|
console.warn("暂无路径参数");
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
splitParameter[1].split('&').forEach(item=>{
|
splitParameter[1].split('&').forEach(item => {
|
||||||
if(item.indexOf('=')!==-1){
|
if (item.indexOf('=') !== -1) {
|
||||||
let splitItem = item.split('=')
|
let splitItem = item.split('=')
|
||||||
obj[splitItem[0]] = splitItem[1]
|
obj[splitItem[0]] = splitItem[1]
|
||||||
}else{
|
} else {
|
||||||
console.warn("error");
|
console.warn("routingParameterGeneration error", item);
|
||||||
console.log(item)
|
// console.log(item)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return obj
|
return obj
|
||||||
}else if(parameterType == 'object'){
|
} else if (parameterType == 'object') {
|
||||||
let stringParameter = '?'
|
let stringParameter = '?'
|
||||||
let parameterEntries = Object.entries(parameter);
|
let parameterEntries = Object.entries(parameter);
|
||||||
parameterEntries.forEach((key,index)=>{
|
parameterEntries.forEach((key, index) => {
|
||||||
let itemString = `${key[0]}=${key[1]}${ parameterEntries.length-1==index?'':'&' }`;
|
let itemString = `${key[0]}=${key[1]}${ parameterEntries.length-1==index?'':'&' }`;
|
||||||
stringParameter += itemString
|
stringParameter += itemString
|
||||||
})
|
})
|
||||||
return stringParameter
|
return stringParameter
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -359,7 +360,7 @@ export default {
|
|||||||
rj(err)
|
rj(err)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
loginOut() {
|
loginOut() {
|
||||||
return new Promise((re, rj) => {
|
return new Promise((re, rj) => {
|
||||||
@@ -523,7 +524,7 @@ export default {
|
|||||||
getnum(num, size = 2) {
|
getnum(num, size = 2) {
|
||||||
if (String(num).indexOf('.') == -1 || String(num).split('.')[1].length < 2) return Number(num).toFixed(size);
|
if (String(num).indexOf('.') == -1 || String(num).split('.')[1].length < 2) return Number(num).toFixed(size);
|
||||||
var s = num.toString();
|
var s = num.toString();
|
||||||
var result = s.substring(0, s.indexOf(".") + 1 + size);
|
var result = s.substring(0, s.indexOf(".") + 1 + size);
|
||||||
return result
|
return result
|
||||||
},
|
},
|
||||||
//数据转为两位小数
|
//数据转为两位小数
|
||||||
|
|||||||