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