This commit is contained in:
tx 2024-08-06 17:15:17 +08:00
parent 062c925581
commit 2a081c7166
11 changed files with 487 additions and 298 deletions

View File

@ -1,9 +1,6 @@
const install = (Vue, vm) => { const install = (Vue, vm) => {
// Vue.prototype.$u.http.setConfig({ // Vue.prototype.$u.http.setConfig({
// baseURL: 'https://yruibao.com/admin', // baseURL: 'https://yruibao.com/admin',
// // baseUrl: 'http://192.168.10.104:8088', // // baseUrl: 'http://192.168.10.104:8088',
// method: 'POST', // method: 'POST',
// // 设置为json返回后会对数据进行一次JSON.parse() // // 设置为json返回后会对数据进行一次JSON.parse()
@ -16,9 +13,9 @@ const install = (Vue, vm) => {
// // 配置请求头信息 // // 配置请求头信息
// header: { // header: {
// 'content-type': 'application/json;charset=UTF-8', // 'content-type': 'application/json;charset=UTF-8',
// }, // },
// }); // });
uni.setStorageSync('deptId', 100); uni.setStorageSync('deptId', 100);
Vue.prototype.$u.http.setConfig({ Vue.prototype.$u.http.setConfig({
// baseUrl: 'http://61.174.243.28:15861', // baseUrl: 'http://61.174.243.28:15861',
@ -27,18 +24,14 @@ const install = (Vue, vm) => {
// baseUrl: 'https://dianche.chuantewulian.cn/prod-api', // baseUrl: 'https://dianche.chuantewulian.cn/prod-api',
baseUrl: 'https://dche.ccttiot.com/prod-api', baseUrl: 'https://dche.ccttiot.com/prod-api',
loadingText: '努力加载中~', loadingText: '努力加载中~',
loadingTime: 50000, loadingTime: 10000,
// 设置自定义头部content-type // 设置自定义头部content-type
header: { header: {
'content-type': 'application/json;charset=UTF-8', 'content-type': 'application/json;charset=UTF-8',
}, },
// ......
}); });
// 创享 wx3428c498d5061192
// 嵛山岛 wx4d178f8c80348214 // 请求拦截部分
// 请求拦截部分,如配置,每次请求前都会执行
Vue.prototype.$u.http.interceptor.request = (config) => { Vue.prototype.$u.http.interceptor.request = (config) => {
// 引用token // 引用token
// 方式一存放在vuex的token假设使用了uView封装的vuex方式 // 方式一存放在vuex的token假设使用了uView封装的vuex方式
@ -60,10 +53,10 @@ const install = (Vue, vm) => {
config.header.Authorization = token; config.header.Authorization = token;
// config.header.Tenant-Id=1 // config.header.Tenant-Id=1
// #ifdef H5 // #ifdef H5
config.header.Authorization = 'Bearer '+token; config.header.Authorization = 'Bearer ' + token;
// #endif // #endif
// 可以对某个url进行特别处理此url参数为this.$u.get(url)中的url值 // 可以对某个url进行特别处理此url参数为this.$u.get(url)中的url值
if(config.url == '/user/login') config.header.noToken = true; if (config.url == '/user/login') config.header.noToken = true;
// 最后需要将config进行return // 最后需要将config进行return
return config; return config;
@ -71,7 +64,7 @@ const install = (Vue, vm) => {
// if(config.url == '/user/rest') return false; // 取消某次请求 // if(config.url == '/user/rest') return false; // 取消某次请求
} }
// 响应拦截,如配置,每次请求结束都会执行本方法 // 响应拦截部分
Vue.prototype.$u.http.interceptor.response = (res) => { Vue.prototype.$u.http.interceptor.response = (res) => {
// if(res.code == 10022 || res.code == 10023) { // if(res.code == 10022 || res.code == 10023) {
// // res为服务端返回值可能有coderesult等字段 // // res为服务端返回值可能有coderesult等字段
@ -88,63 +81,57 @@ const install = (Vue, vm) => {
// }) // })
// // return res.result; // // return res.result;
// } // }
if(res.code == 401) { if (res.code == 401) {
wx.login({ wx.login({
success(res) { success(res) {
if (res.code) { if (res.code) {
console.log('登录!', res); console.log('登录!', res);
let data = { let areaId = uni.getStorageSync('areaId');
wxOpenId: res.code, if (areaId) {
vm.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + areaId).then(
}; res => {
let areaId=uni.getStorageSync('areaId');
if(areaId){
vm.$u.post('/loginByopenid?jsCode='+res.code+'&areaId='+areaId).then(res=>{
uni.hideLoading(); uni.hideLoading();
if (res.code == 200) { if (res.code == 200) {
uni.setStorageSync('token', res.token); uni.setStorageSync('token', res.token);
// uni.navigateTo({ } else if (res.code == 501) {
// url:'/pages/index/index'
// })
}else if(res.code == 501){
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
}else { } else {
// console.log("老用户登录",res.data)
uni.navigateTo({ uni.navigateTo({
url:'/pages/login/login' url: '/pages/login/login'
}) })
} }
}); });
} }
} }
}, },
}); });
} }
return res; return res;
// else if(res.code == 201) {
// // 假设201为token失效这里跳转登录
// vm.$u.toast('验证失败,请重新登录');
// setTimeout(() => {
// // 此为uView的方法详见路由相关文档
// vm.$u.route('/pages/user/login')
// }, 1500)
// return false;
// } else {
// // 如果返回false则会调用Promise的reject回调
// // 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中res为服务端的返回值
// return false;
// }
} }
// 手动实现超时控制
const originalRequest = Vue.prototype.$u.http.request;
Vue.prototype.$u.http.request = (options) => {
return new Promise((resolve, reject) => {
const timeout = 20000; // 10秒超时
const timer = setTimeout(() => {
resolve( { code: 500, msg: '请求超时' } );
}, timeout);
// 执行原始请求
originalRequest.call(Vue.prototype.$u.http, options).then(response => {
clearTimeout(timer);
resolve(response);
}).catch(error => {
clearTimeout(timer);
reject(error);
});
});
};
} }
export default { export default {

View File

@ -54,7 +54,7 @@
"appid" : "wx3428c498d5061192", "appid" : "wx3428c498d5061192",
"setting" : { "setting" : {
"urlCheck" : false, "urlCheck" : false,
"minified" : false "minified" : true
}, },
"usingComponents" : true, "usingComponents" : true,
"optimization" : { "optimization" : {

37
page_vip/Vip_index.vue Normal file
View File

@ -0,0 +1,37 @@
<template>
<view class="page">
<u-navbar title="编号开锁" :border-bottom="false" :background="bgc" title-color='#000' title-size='36' height='45'></u-navbar>
</view>
</template>
<script>
export default {
data() {
return {
bgc: {
backgroundColor: '#fff'
},
sn:'',
istrue:false
}
},
methods: {
}
}
</script>
<style lang="scss" >
page{
background-color: #fff;
}
.page{
width: 750rpx;
}
</style>

View File

@ -29,26 +29,10 @@
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},
{
"path": "pages/bind_sn",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path" : "pages/bind_mac",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
} }
], ],
"subPackages": [{ "subPackages": [{
@ -104,6 +88,23 @@
"enablePullDownRefresh" : false "enablePullDownRefresh" : false
} }
}, },
{
"path": "worke/bind_sn",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path" : "worke/bind_mac",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{ {
"path" : "worke/worke_income", "path" : "worke/worke_income",
"style" : "style" :
@ -199,6 +200,22 @@
} }
// ... A
]
},
{
"root": "page_vip", // A
"pages": [
{
"path": "Vip_index",
"style": {
"navigationBarTitleText": "上传",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
// ... A // ... A
] ]
}, },

View File

@ -4410,7 +4410,7 @@
} }
if (this.sn) { if (this.sn) {
setTimeout(()=>{ setTimeout(()=>{
this.deviceInfo(0) this.deviceInfo(1)
this.qParam = null this.qParam = null
},500) },500)
@ -4817,7 +4817,7 @@
}); });
} else if (this.deviceInfos.status == 1) { } else if (this.deviceInfos.status == 1) {
if (this.areaId != res.data.areaId) { if (this.areaInfo.areaId != res.data.areaId) {
this.getArea() this.getArea()
} }
// this.routePlanning(res.data.latitude, res.data.longitude) // this.routePlanning(res.data.latitude, res.data.longitude)
@ -4825,7 +4825,7 @@
this.showdevice = true this.showdevice = true
this.type = 1; this.type = 1;
this.deviceIndex = 1; this.deviceIndex = 1;
}, 500) }, 600)
} }
} }
@ -4949,7 +4949,7 @@
// this.routePlanning(res.data // this.routePlanning(res.data
// .latitude, res.data // .latitude, res.data
// .longitude) // .longitude)
if (this.areaId != res.data if (this.areaInfo != res.data
.areaId) { .areaId) {
this.getArea() this.getArea()
} }
@ -4958,7 +4958,7 @@
this.showdevice = true this.showdevice = true
this.type = 1; this.type = 1;
this.deviceIndex = 1; this.deviceIndex = 1;
}, 500) }, 600)
} }
} }
} else { } else {

View File

@ -174,7 +174,7 @@
}) })
}else if(num==5){ }else if(num==5){
uni.navigateTo({ uni.navigateTo({
url:'/pages/bind_sn' url:'/pages_admin/worke/bind_sn'
}) })
// uni.scanCode({ // uni.scanCode({
// onlyFromCamera: true, // onlyFromCamera: true,

View File

@ -1167,6 +1167,7 @@
}, },
deviceInfo() { deviceInfo() {
this.$u.get('/app/device/info?sn=' + this.sn).then((res) => { this.$u.get('/app/device/info?sn=' + this.sn).then((res) => {
console.log(res,'rererer');
if (res.code === 200) { if (res.code === 200) {
this.deviceInfos = res.data this.deviceInfos = res.data
if(this.getnum==0){ if(this.getnum==0){
@ -1337,6 +1338,12 @@
} }
this.$forceUpdate() this.$forceUpdate()
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
} }
}) })
}, },

View File

@ -64,15 +64,27 @@
</view> </view>
</view> </view>
<view class="info_li"> <view class="info_li">
<!-- <view class="half_infoli"> <view class="half_infoli" v-if="deviceInfos.onlineStatus==0">
车辆编号<span>{{orderInfo.device.areaName}}</span> 网络状态<span >离线</span>
</view> --> </view>
<view class="half_infoli" v-if="deviceInfos.onlineStatus==1">
网络状态<span >在线</span>
</view>
<view class="half_infoli"> <view class="half_infoli">
运营区域: 运营区域:
<span v-if="orderInfo.area">{{orderInfo.area}}</span> <span v-if="orderInfo.area">{{orderInfo.area}}</span>
<span v-else>--</span> <span v-else>--</span>
</view> </view>
</view> </view>
<view class="info_li">
<view class="half_infoli" v-if="deviceInfos.lockStatus==0">
锁状态<span >关锁</span>
</view>
<view class="half_infoli" v-if="deviceInfos.lockStatus==1">
锁状态<span >开锁</span>
</view>
</view>
</view> </view>
</view> </view>
@ -104,11 +116,20 @@
骑行费用<span>{{orderInfo.ridingFee}}</span> 骑行费用<span>{{orderInfo.ridingFee}}</span>
</view> </view>
</view> </view>
<view class="info_li">
<view class="half_infoli">
停车点外调度费<span>{{orderInfo.manageFee}}</span>
</view>
<view class="half_infoli">
骑行费用<span>{{orderInfo.ridingFee}}</span>
</view>
</view>
<view class="info_li"> <view class="info_li">
实收<span>{{orderInfo.totalFee}}</span> 实收<span>{{orderInfo.totalFee}}</span>
</view> </view>
<view class="info_li"> <view class="info_li">
支付方式<span>微信支付</span> 支付方式<span v-if="orderInfo.payType=='yj'">押金抵扣</span><span v-if="orderInfo.payType=='wx'">微信支付</span>
</view> </view>
<view class="info_li" v-if="orderInfo.rule" style="display: inline-block;"> <view class="info_li" v-if="orderInfo.rule" style="display: inline-block;">
计费模板<span>{{orderInfo.rule.name}}</span> 计费模板<span>{{orderInfo.rule.name}}</span>
@ -266,7 +287,15 @@
<view class="btn" @click="pass()" v-if="orderInfo.status==5"> <view class="btn" @click="pass()" v-if="orderInfo.status==5">
审核通过 审核通过
</view> </view>
<view class="btn" @click="yjdkBtn()" v-if="orderInfo.status==3">
押金抵扣
</view>
<view class="btn" @click="openBtn()" v-if="orderInfo.status==2">
开锁
</view>
<view class="btn" @click="closeBtn()" v-if="orderInfo.status==2">
关锁
</view>
<view class="btn" @click="unpass" v-if="orderInfo.status==5"> <view class="btn" @click="unpass" v-if="orderInfo.status==5">
有损坏 有损坏
@ -490,7 +519,8 @@
areaNum: 1, areaNum: 1,
showload:false, showload:false,
showfzhc:false, showfzhc:false,
showgj:false showgj:false,
deviceInfos:{}
} }
}, },
@ -542,6 +572,116 @@
}, },
methods: { methods: {
status() {
// if (this.deviceInfos.onlineStatus == 0) {
// return '线'
// } else {
// }
if (this.deviceInfos.status == 0) {
return '仓库中'
} else if (this.deviceInfos.status == 1) {
return '待租'
} else if (this.deviceInfos.status == 2) {
return '预约中'
} else if (this.deviceInfos.status == 3) {
return '骑行中'
} else if (this.deviceInfos.status == 4) {
return '临时锁车中'
}else if (this.deviceInfos.status == 6) {
return '调度中'
} else if (this.deviceInfos.status == 8) {
return '下线'
}
},
deviceInfo() {
this.$u.get('/app/device/info?sn=' + this.orderInfo.sn).then((res) => {
console.log(res,'rererer');
if (res.code === 200) {
this.deviceInfos = res.data
this.$forceUpdate()
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
})
},
//
openBtn(){
this.$u.post('/appVerify/admin/unlocking?sn=' + this.orderInfo.sn).then((res) => {
if (res.code == 200) {
// 线
uni.showToast({
title: '操作成功',
icon: 'none',
duration: 2000
});
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
},
//
closBtn(){
this.$u.post('/appVerify/admin/lock?sn=' + this.orderInfo.sn).then((res) => {
if (res.code == 200) {
// 线
uni.showToast({
title: '操作成功',
icon: 'none',
duration: 2000
});
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
},
//
yjdkBtn(){
let data = {
orderNo: this.orderInfo.orderNo,
}
this.$u.post('/appVerify/order/deduction', data).then((res) => {
if (res.code === 200) {
// 线
this.getOrderDetail()
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
}).catch(error => {
console.error("Error fetching area data:", error);
});
},
// //
changeMoney() { changeMoney() {
let data = { let data = {
@ -1011,8 +1151,9 @@
this.areaNum = this.areaNum + 1 this.areaNum = this.areaNum + 1
if (this.areaNum != 0) { if (this.areaNum != 0) {
this.getArea() this.getArea()
}
}
this.deviceInfo()
this.loading = true this.loading = true
this.latitude = parseFloat(this.orderInfo.latitude) this.latitude = parseFloat(this.orderInfo.latitude)

View File

@ -92,12 +92,12 @@
list: [], list: [],
pageNum: 1, pageNum: 1,
pageSize: 25, pageSize: 25,
info:{}, info: {},
price:0, price: 0,
realprice:0, realprice: 0,
Quantity:0, Quantity: 0,
border: false, border: false,
isThrottled:false isThrottled: false
} }
}, },
onLoad(e) { onLoad(e) {
@ -119,14 +119,14 @@
methods: { methods: {
ckinpt() { ckinpt() {
if( parseFloat(this.amount)> parseFloat(this.info.balance)){ if (parseFloat(this.amount) > parseFloat(this.info.balance)) {
uni.showToast({ uni.showToast({
title: '提现金额不能大于账户余额', title: '提现金额不能大于账户余额',
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
this.amount='' this.amount = ''
} }
const floatValue = parseFloat(this.amount); const floatValue = parseFloat(this.amount);
const decimalPart = this.amount.split('.')[1]; const decimalPart = this.amount.split('.')[1];
@ -143,18 +143,18 @@
// checkPrice() // checkPrice()
this.checkPrice(); this.checkPrice();
}, },
checkPrice(){ checkPrice() {
if(this.amount!=''){ if (this.amount != '') {
this.price= parseFloat(this.amount); this.price = parseFloat(this.amount);
}else{ } else {
this.price=0.00 this.price = 0.00
} }
let abb=this.amount * (parseFloat(this.info.handlingCharge)/1000) let abb = this.amount * (parseFloat(this.info.handlingCharge) / 1000)
this.Quantity= abb.toFixed(2) this.Quantity = abb.toFixed(2)
let aaa =this.amount-this.Quantity let aaa = this.amount - this.Quantity
this.realprice=aaa.toFixed(2) this.realprice = aaa.toFixed(2)
}, },
status(type) { status(type) {
if (type == 1) { if (type == 1) {
@ -163,13 +163,13 @@
return '押金订单' return '押金订单'
} else if (type == 3) { } else if (type == 3) {
return '押金订单退款' return '押金订单退款'
} else if (type ==4 ) { } else if (type == 4) {
return '骑行订单退款' return '骑行订单退款'
} else if (type == 5) { } else if (type == 5) {
return '提现' return '提现'
} else if (type == 6) { } else if (type == 6) {
return '提现失败' return '提现失败'
}else if (type == 7) { } else if (type == 7) {
return '车损收入' return '车损收入'
} }
@ -249,12 +249,12 @@
}, },
getareaInfo() { getareaInfo() {
let data={ let data = {
areaId: this.areaId areaId: this.areaId
} }
this.$u.get('/appVerify/getDept',data).then((res) => { this.$u.get('/appVerify/getDept', data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.info=res.data this.info = res.data
} }
}).catch(error => { }).catch(error => {
console.error("Error fetching area data:", error); console.error("Error fetching area data:", error);

View File

@ -154,7 +154,7 @@
console.log(e); console.log(e);
let Bluetoothmac = e.name.substring(5) let Bluetoothmac = e.name.substring(5)
uni.navigateTo({ uni.navigateTo({
url:'/pages/bind_mac?mac='+Bluetoothmac url:'/pages_admin/worke/bind_mac?mac='+Bluetoothmac
}) })
}, },
send(){ send(){