This commit is contained in:
tx 2024-12-26 15:52:44 +08:00
parent 468e1e154c
commit f10a3eead1
3 changed files with 1147 additions and 1127 deletions

View File

@ -412,8 +412,8 @@
money: this.areaInfo.deposit, money: this.areaInfo.deposit,
mark: "押金充值", mark: "押金充值",
type: '4', type: '4',
areaId: id areaId: id,
platform: "2" // 2
} }
let that = this let that = this
@ -422,13 +422,8 @@
// this.freList=res.rows // this.freList=res.rows
let orderNo = res.data.orderNo let orderNo = res.data.orderNo
this.orderNo = res.data.orderNo this.orderNo = res.data.orderNo
uni.requestPayment({ my.tradePay ({
provider: 'wxpay', tradeNO: res.data.tradeNO,
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.packageVal,
signType: res.data.signType,
paySign: res.data.paySign,
success(res) { success(res) {
// //
// uni.showLoading({ // uni.showLoading({
@ -480,6 +475,8 @@
}, },
fail(err) { fail(err) {
console.log(err,'err');
that.ispaid = false that.ispaid = false
// //
uni.showToast({ uni.showToast({
@ -783,12 +780,13 @@
.tip_box { .tip_box {
position: fixed; position: fixed;
left: 72rpx; left: 72rpx;
top: 628rpx; top: 50%;
transform: translateY(-50%);
width: 610rpx; width: 610rpx;
height: 282rpx;
background: #FFFFFF; background: #FFFFFF;
border-radius: 30rpx 30rpx 30rpx 30rpx; border-radius: 30rpx;
z-index: 110; z-index: 110;
overflow: hidden;
.top { .top {
padding: 52rpx 38rpx 42rpx 36rpx; padding: 52rpx 38rpx 42rpx 36rpx;
@ -799,40 +797,32 @@
font-weight: 500; font-weight: 500;
font-size: 32rpx; font-size: 32rpx;
color: #3D3D3D; color: #3D3D3D;
line-height: 1.5;
} }
} }
.bot { .bot {
border-top: 2rpx solid #D8D8D8;
display: flex; display: flex;
flex-wrap: nowrap; border-top: 2rpx solid #D8D8D8;
height: 100%;
.bot_left { .bot_left, .bot_right {
width: 50%; flex: 1;
height: 98rpx; height: 98rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-weight: 500; font-weight: 500;
font-size: 36rpx; font-size: 36rpx;
}
.bot_left {
color: #3D3D3D; color: #3D3D3D;
} }
.bot_right { .bot_right {
width: 50%;
height: 98rpx;
display: flex;
align-items: center;
justify-content: center;
border-left: 2rpx solid #D8D8D8;
font-weight: 500;
font-size: 36rpx;
color: #1E807A; color: #1E807A;
border-left: 2rpx solid #D8D8D8;
} }
} }
} }

View File

@ -1118,7 +1118,7 @@ export default {
islogin: true, islogin: true,
mapKey: 0, mapKey: 0,
toJSON: null,
} }
}, },
watch: { watch: {
@ -1141,7 +1141,7 @@ export default {
my.hideBackHome() my.hideBackHome()
const systemInfo = my.getSystemInfoSync(); const systemInfo = my.getSystemInfoSync();
this.statusBarHeight = systemInfo.statusBarHeight * 1; this.statusBarHeight = systemInfo.statusBarHeight * 1;
console.log(this.statusBarHeight, 'this.statusBarHeight'); // console.log(this.statusBarHeight, 'this.statusBarHeight');
// this.navBarHeight = this.statusBarHeight * 1; // this.navBarHeight = this.statusBarHeight * 1;
@ -1155,7 +1155,7 @@ export default {
if (e.q) { if (e.q) {
this.qParam = e.q this.qParam = e.q
} }
console.log(e, 'e.qParame.qParam'); // console.log(e, 'e.qParame.qParam');
if (e.qParam) { if (e.qParam) {
this.qParam = e.qParam this.qParam = e.qParam
@ -1237,12 +1237,12 @@ export default {
console.log('获取蓝牙状态失败', err); console.log('获取蓝牙状态失败', err);
} }
}); });
console.log(this.seeDetail, 'this.seeDetailthis.seeDetail'); // console.log(this.seeDetail, 'this.seeDetailthis.seeDetail');
if (this.seeDetail == false) { if (this.seeDetail == false) {
let that = this let that = this
uni.getNetworkType({ uni.getNetworkType({
success: function (res) { success: function (res) {
console.log(res.networkType); // "wifi", "4g", "3g", "2g", "none"
if (res.networkType == 'none') { if (res.networkType == 'none') {
that.netonlines = false that.netonlines = false
@ -1319,8 +1319,7 @@ export default {
this.getinfo() this.getinfo()
setTimeout(() => { setTimeout(() => {
console.log(this.userinfo.balance, this.deviceIndex, this.showdevice, this.tozf,
'this.userinfo.balancethis.userinfo.balancethis.userinfo.balance');
if (this.userinfo.balance != 0 && this.deviceIndex == 1 && this if (this.userinfo.balance != 0 && this.deviceIndex == 1 && this
.showdevice == true && this.tozf == true) { .showdevice == true && this.tozf == true) {
this.tozf = false this.tozf = false
@ -1744,7 +1743,7 @@ export default {
// console.log(that.mappolyline, 'that.mappolylinethat.mappolyline'); // console.log(that.mappolyline, 'that.mappolylinethat.mappolyline');
}, },
fail(res) { fail(res) {
console.log('resresresresresresres', res)
} }
}) })
}, },
@ -1755,7 +1754,7 @@ export default {
}, },
onMapTap(event) { onMapTap(event) {
console.log('onMapTap', event);
this.showdevice = false this.showdevice = false
this.deviceIndex = 0 this.deviceIndex = 0
// this.sn = '' // this.sn = ''
@ -1820,39 +1819,36 @@ export default {
} }
}, },
onMarkerTap(e) { onMarkerTap(e) {
this.showdevice = false;
this.deviceIndex = 0;
this.type = 0;
// this.freeInfo = {};
// this.freeListIndex = 0;
this.parkinfo = {}
this.showparkinfo = false
if (e.type === 'markerTap') { if (e.type === 'markerTap') {
//
let parkmark = this.parkingList.some(item => item.parkingId == e.markerId); let parkmark = this.parkingList.some(item => item.parkingId == e.markerId);
if (parkmark) { if (parkmark) {
const matchingItem = this.parkingList.find(item => item.parkingId == e.markerId); const matchingItem = this.parkingList.find(item => item.parkingId == e.markerId);
this.showparkinfo = true this.showparkinfo = true;
this.parkinfo = matchingItem this.parkinfo = matchingItem;
console.log(matchingItem, 'parkmarkparkmark');
e.stopPropagation(); e.stopPropagation();
return;
} }
// const markerExists = this.listData.some(item => item.sn == e.markerId); //
const markerExists = true const markerExists = this.listData.some(item => item.sn == e.markerId);
if (markerExists) {
//
if (this.orderinfo.sn) { if (this.orderinfo.sn) {
uni.showToast({ uni.showToast({
title: '有进行中的订单,无法查看', title: '有进行中的订单,无法查看',
icon: 'none' icon: 'none'
}); });
} else { return;
if (markerExists) { }
console.log(e, 'e.markerId');
this.sn = e.markerId;
this.deviceInfo(0);
// Revert the last clicked marker to the default image and zIndex // UI
this.showdevice = true;
this.deviceIndex = 1;
this.type = 1;
this.sn = e.markerId;
//
if (this.lastClickedMarkerId !== null) { if (this.lastClickedMarkerId !== null) {
this.markers = this.markers.map(marker => { this.markers = this.markers.map(marker => {
if (marker.id === this.lastClickedMarkerId) { if (marker.id === this.lastClickedMarkerId) {
@ -1860,15 +1856,14 @@ export default {
...marker, ...marker,
iconPath: this.defaultMarkerIconPath, iconPath: this.defaultMarkerIconPath,
width: 40, width: 40,
height: 28, height: 28
// zIndex: 1 // Reset to default zIndex
}; };
} }
return marker; return marker;
}); });
} }
this.lastClickedMarkerId = e.markerId;
// Update the clicked marker's image and zIndex //
this.markers = this.markers.map(marker => { this.markers = this.markers.map(marker => {
if (marker.id === e.markerId) { if (marker.id === e.markerId) {
return { return {
@ -1876,39 +1871,42 @@ export default {
iconPath: this.clickedMarkerIconPath, iconPath: this.clickedMarkerIconPath,
width: 50, width: 50,
height: 35 height: 35
// zIndex: 999 // Higher zIndex to bring it to the front
}; };
} }
return marker; return marker;
}); });
// Store the ID of the currently clicked marker this.lastClickedMarkerId = e.markerId;
//
this.deviceInfo(1);
// Get the latitude and longitude of the clicked marker // 线
const clickedMarker = this.markers.find(marker => marker.id === e.markerId); const clickedMarker = this.markers.find(marker => marker.id === e.markerId);
if (clickedMarker) { if (clickedMarker) {
const { const { latitude, longitude } = clickedMarker;
latitude, this.routePlanning(latitude, longitude);
longitude
} = clickedMarker;
console.log(`Clicked marker location - Latitude: ${latitude}, Longitude: ${longitude}`);
this.routePlanning(latitude, longitude)
// Find nearby markers
// this.getNearbyMarkers(latitude, longitude);
}
// console.log(this.markers, 'Updated markers');
} else {
console.log('Marker ID does not exist in the list data');
} }
} }
e.stopPropagation();
// Prevent event bubbling
// e.stopPropagation();
} }
}, },
// showDeviceInfo
showDeviceInfo(device) {
if (this.orderinfo.status) {
this.showtcs = true;
return;
}
this.deviceIndex = 1;
this.type = 1;
this.showdevice = true;
//
this.deviceInfo(0);
},
getNearbyMarkers(clickedLat, clickedLon) { getNearbyMarkers(clickedLat, clickedLon) {
const nearbyMarkers = this.listData.filter(item => { const nearbyMarkers = this.listData.filter(item => {
if (item.latitude && item.longitude) { if (item.latitude && item.longitude) {
@ -2286,21 +2284,28 @@ export default {
}, },
Binddevice() { Binddevice() {
console.log('Binddevice'); xBlufi.initXBlufi(0);
// //
my.getBluetoothAdapterState({ uni.openBluetoothAdapter({
success: (res) => { success(res) {
console.log('蓝牙状态:', res.available); console.log(res, 'resresresres');
if (!res.available) { }, fail: (res) => {
uni.showToast({ console.log(res, 'resresresres');
title: '请打开手机蓝牙', // this.maskepage = 5;
icon: 'none' // this.buletxt = '';
});
return;
} }
})
// my.getBluetoothAdapterState({
// success: (res) => {
// console.log(res, 'resresresres');
// // if (!res.available) {
// this.maskepage = 5;
// this.buletxt = '';
// return;
// }
//
this.maskloading = true; this.maskloading = true;
this.devicesList = []; this.devicesList = [];
this.maskepage = 4; this.maskepage = 4;
@ -2308,17 +2313,115 @@ export default {
// //
xBlufi.initXBlufi(0); xBlufi.initXBlufi(0);
console.log("xBlufi", xBlufi.XMQTT_SYSTEM); xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
// //
xBlufi.notifyStartDiscoverBle({
'isStart': true
});
//
setTimeout(() => {
xBlufi.notifyStartDiscoverBle({
'isStart': false
});
setTimeout(() => {
console.log(this.devicesList, 'this.devicesListthis.devicesList');
if (this.devicesList.length == 0) {
this.maskepage = 5;
this.buletxt = '未发现设备';
return;
}
//
let uniqueDevicesList = Array.from(new Set(this.devicesList));
this.devicesList = uniqueDevicesList.filter(device =>
device.name && device.name.startsWith('BBLE')
);
//
let istrue = false;
this.mac = 'FD51BB7A4EE0'
// this.devicesList.forEach(device => {
// let macFromName = device.name.substring(device.name.length - 12);
// if (macFromName === this.mac) {
// this.deviceInfoss = device;
// istrue = true;
// xBlufi.notifyConnectBle({
// connect: true,
// deviceId: device.deviceId,
// name: device.name
// });
// }
// });
const targetDevice = this.devicesList.find(device => {
const macFromName = device.name.substring(device.name.length - 12);
return macFromName === this.mac;
});
//
if(targetDevice){
// this.deviceInfoss = targetDevice;
this.connectToDevice(targetDevice);
}else{
this.buletxt = '蓝牙连接失败';
setTimeout(() => {
this.maskepage = 5;
}, 500);
}
}, 200);
}, 5000);
// },
// fail: (res) => {
// console.log(res, 'resresresres');
// this.maskepage = 5;
// this.buletxt = '';
// }
// });
},
//
connectToDevice(device) {
xBlufi.notifyConnectBle({
connect: true,
deviceId: device.deviceId,
name: device.name
});
//
xBlufi.listenDeviceMsgEvent(true, (res) => { xBlufi.listenDeviceMsgEvent(true, (res) => {
console.log("设备消息:", res);
if (res.type === xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED) { if (res.type === xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED) {
if (res.result) { if (res.result) {
this.carstause = true; this.carstause = true;
if (this.maskloading && this.maskepage === 4) { if (this.maskloading && this.maskepage === 4) {
if (!this.buleback && !this.buleopen && !this.buleclose && !this.bulebindcar) {
if (this.buletxt == '蓝牙连接中') {
this.buletxt = '蓝牙连接成功!'; this.buletxt = '蓝牙连接成功!';
} }
}
//
if (this.buleclose) {
this.buleclose = false;
this.loackdevice();
}
if (this.buleopen) {
this.buleopen = false;
this.unloackdevices();
}
if (this.buleback) {
this.buleback = false;
this.cheackgps();
}
if (this.bulepayback) {
this.bulepayback = false;
this.payback();
}
if (this.bulebindcar) {
this.bulebindcar = false;
this.bluesub1();
}
}
} else { } else {
this.carstause = false; this.carstause = false;
if (this.maskepage === 4) { if (this.maskepage === 4) {
@ -2331,69 +2434,181 @@ export default {
} }
}); });
// //
xBlufi.notifyStartDiscoverBle({ setTimeout(() => {
'isStart': true xBlufi.notifyInitBleEsp32({
deviceId: device.deviceId
});
}, 1000);
},
//
// funListenDeviceMsgEvent: function (options) {
// switch (options.type) {
// case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
// if (options.data) {
// this.carstause = true;
// if (this.maskloading && this.maskepage == 4) {
// if (this.buleclose == false && this.buleopen == false &&
// this.bulerebort == false && this.bulering == false) {
// if (this.buletxt == '') {
// this.buletxt = '';
// }
// }
// if (this.buleclose) {
// this.buleclose = false;
// this.closecar();
// }
// if (this.buleopen) {
// this.buleopen = false;
// this.unloackdevices();
// }
// }
// } else {
// this.carstause = false;
// if (this.maskepage == 4) {
// this.buletxt = '';
// setTimeout(() => {
// this.maskepage = 5;
// }, 800);
// }
// }
// break;
// case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED:
// if (options.result == false) {
// this.carstause = false;
// if (this.maskepage == 4) {
// this.buletxt = '';
// setTimeout(() => {
// this.maskepage = 5;
// }, 800);
// }
// }
// break;
// }
// },
funListenDeviceMsgEvent: function (options) {
switch (options.type) {
//
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
if (options.result) {
let devicesarr = options.data;
devicesarr.forEach(device => {
this.devicesList.push(device);
});
//
this.devicesList = Array.from(new Set(this.devicesList));
}
break;
//
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
console.log("连接回调:" + JSON.stringify(options));
if (options.result) {
// ESP32
xBlufi.notifyInitBleEsp32({
deviceId: options.data.deviceId
}); });
// 5 //
let systemInfo = uni.getSystemInfoSync();
if (systemInfo.platform === 'android') {
// Android
} else if (systemInfo.platform === 'ios') {
// iOS
}
} else {
this.carstause = false;
if (this.maskepage == 4) {
this.buletxt = '设备连接失败';
setTimeout(() => { setTimeout(() => {
xBlufi.notifyStartDiscoverBle({
'isStart': false
});
setTimeout(() => {
if (this.devicesList.length === 0) {
this.maskepage = 5; this.maskepage = 5;
this.buletxt = '暂无发现对应设备,请靠近设备'; }, 800);
return; }
}
break;
//
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
if (options.data) {
this.carstause = true;
if (this.maskloading && this.maskepage == 4) {
//
if (!this.buleback && !this.buleopen && !this.buleclose && !this.bulebindcar) {
if (this.buletxt == '蓝牙连接中') {
this.buletxt = '蓝牙连接成功!';
}
} }
// //
if (this.buleclose) {
this.buleclose = false;
this.loackdevice();
}
if (this.buleopen) {
this.buleopen = false;
this.unloackdevices();
}
if (this.buleback) {
this.buleback = false;
this.cheackgps();
}
if (this.bulepayback) {
this.bulepayback = false;
this.payback();
}
if (this.bulebindcar) {
this.bulebindcar = false;
this.bluesub1();
}
}
} else {
this.carstause = false;
if (this.maskepage == 4) {
this.buletxt = '设备连接失败';
setTimeout(() => {
this.maskepage = 5;
}, 800);
}
}
console.log("收到设备发来的自定义数据:", options.data);
break;
//
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED:
console.log('连接状态:', options.result);
if (options.result == false) {
this.carstause = false;
if (this.maskepage == 4) {
this.buletxt = '设备连接失败';
setTimeout(() => {
this.maskepage = 5;
}, 800);
}
}
break;
//
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
if (options.result) {
//
let uniqueDevicesList = Array.from(new Set(this.devicesList)); let uniqueDevicesList = Array.from(new Set(this.devicesList));
this.devicesList = uniqueDevicesList;
console.log(this.devicesList, 'devicesList');
// // BBLE
let istrue = false; this.devicesList = uniqueDevicesList.filter(device =>
this.devicesList.forEach(device => { device.name && device.name.substring(0, 4) === "BBLE"
let macFromName = device.name.substring(device.name.length - 12); );
console.log(macFromName, 'macFromName');
if (macFromName === this.mac) {
console.log('找到匹配设备:', device);
this.deviceInfoss = device;
istrue = true;
//
xBlufi.notifyConnectBle({
connect: true,
deviceId: device.deviceId,
name: device.name
});
} }
}); this.searching = false;
break;
//
setTimeout(() => {
if (!istrue) {
this.buletxt = '蓝牙连接失败';
setTimeout(() => {
this.maskepage = 5;
}, 500);
} }
}, 500);
}, 200);
}, 5000);
},
fail: () => {
uni.showToast({
title: '获取蓝牙状态失败',
icon: 'none'
});
}
});
}, },
cheackgps() { cheackgps() {
let that = this let that = this
uni.getLocation({ uni.getLocation({
@ -2933,7 +3148,7 @@ export default {
// 使this.$setVue // 使this.$setVue
this.$set(this, 'markers', this.markers); this.$set(this, 'markers', this.markers);
} }
console.log(this.markers, 'aaaaaaaaaaa'); // console.log(this.markers, 'aaaaaaaaaaa');
} }
}).catch(error => { }).catch(error => {
@ -2957,7 +3172,7 @@ export default {
uni.createMapContext("map", this).getCenterLocation({ uni.createMapContext("map", this).getCenterLocation({
type: 'gcj02', type: 'gcj02',
success: (res) => { success: (res) => {
console.log("当前地图中心的经纬度", res)
that.deviceGps.latitude = res.latitude; that.deviceGps.latitude = res.latitude;
that.deviceGps.longitude = res.longitude; that.deviceGps.longitude = res.longitude;
// that.getmarks() // that.getmarks()
@ -3339,165 +3554,6 @@ export default {
this.titleflag = false this.titleflag = false
}, },
//
funListenDeviceMsgEvent: function (options) {
switch (options.type) {
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
if (options.result) {
let devicesarr = options.data
// this.devicesList = options.data
devicesarr.forEach(device => {
// this.$u.get(`/app/device/${mac}/isBind`, data).then((res) => {
// if (res.data == false) {
this.devicesList.push(device);
let uniqueDevicesList = Array.from(new Set(this.devicesList));
// this.devicesList
this.devicesList = uniqueDevicesList;
});
}
break;
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
console.log("连接回调:" + JSON.stringify(options));
if (options.result) {
// uni.hideLoading();
xBlufi.notifyInitBleEsp32({
deviceId: options.data.deviceId
});
let systemInfo = uni.getSystemInfoSync();
if (systemInfo.platform === 'android') {
// Android
} else if (systemInfo.platform === 'ios') {
}
}
if (options.result == false) {
// this.loadingmask=false
this.carstause = false
if (this.maskepage == 4) {
this.buletxt = '设备连接失败'
setTimeout(() => {
this.maskepage = 5
}, 800)
}
}
break;
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
// this.ver_data = this.parseCustomData(options.data)
if (options.data) {
this.carstause = true
if (this.maskloading && this.maskepage == 4) {
// setTimeout(() => {
// this.maskloading = false
// }, 700)
if (this.buleback == false && this.buleopen == false && this.buleclose == false && this
.bulebindcar == false) {
if (this.buletxt == '蓝牙连接中') {
this.buletxt = '蓝牙连接成功!'
}
}
if (this.buleclose) {
this.buleclose = false
this.loackdevice()
}
if (this.buleopen) {
this.buleopen = false
this.unloackdevices()
}
if (this.buleback) {
this.buleback = false
this.cheackgps()
}
if (this.bulepayback) {
this.bulepayback = false
this.payback()
}
if (this.bulebindcar) {
this.bulebindcar = false
this.bluesub1()
}
}
} else {
this.carstause = false
if (this.maskepage == 4) {
this.buletxt = '设备连接失败'
setTimeout(() => {
this.maskepage = 5
}, 800)
}
}
console.log("1收到设备发来的自定义数据结果", options.data);
break;
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED: {
console.log('状态', options.result)
if (options.result == false) {
this.carstause = false
if (this.maskepage == 4) {
this.buletxt = '设备连接失败'
setTimeout(() => {
this.maskepage = 5
}, 800)
}
}
}
break;
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
if (options.result) {
let uniqueDevicesList = Array.from(new Set(this.devicesList));
// "CTPOW"
let filteredDevices = uniqueDevicesList.filter(device => device.name.substring(0,
4) ===
"BBLE");
// this.devicesList
this.devicesList = filteredDevices;
// console.log('ok',this.devicesList);
} else {
//
// console.log('');
}
this.searching = false
// _this.setData({
// searching: false
// });
break;
}
},
//4 //4
@ -3713,7 +3769,7 @@ export default {
}, },
startCountdown() { startCountdown() {
console.log('调用了');
const interval = setInterval(() => { const interval = setInterval(() => {
if (this.countdown > 0) { if (this.countdown > 0) {
this.countdown--; this.countdown--;
@ -3957,7 +4013,7 @@ export default {
userId: this.userId, userId: this.userId,
sn: this.orderinfo.sn, sn: this.orderinfo.sn,
orderNo: this.orderinfo.orderNo, orderNo: this.orderinfo.orderNo,
platform: "2", // 2
// money: this.freeInfo.fee, // money: this.freeInfo.fee,
mark: "订单支付", mark: "订单支付",
type: '2' type: '2'
@ -3971,20 +4027,16 @@ export default {
let that = this let that = this
this.$u.post('/appVerify/pre/order', data).then((res) => { this.$u.post('/appVerify/pre/order', data).then((res) => {
if (res.code === 200) { if (res.code === 200) {
uni.hideLoading() my.tradePay()
// this.freList=res.rows // this.freList=res.rows
uni.requestPayment({ uni.requestPayment({
provider: 'wxpay', provider: 'wxpay',
timeStamp: res.data.timeStamp, tradeNO: res.data.tradeNo,
nonceStr: res.data.nonceStr,
package: res.data.packageVal,
signType: res.data.signType,
paySign: res.data.paySign,
success(res) { success(res) {
// //
that.getisInOrder() that.getisInOrder()
let data = { let data = {
orderNo: that.orderinfo.orderNo orderNo: res.data.orderNo
} }
that.$u.get("/appVerify/queryResultByOrderNo?", data).then((res) => { that.$u.get("/appVerify/queryResultByOrderNo?", data).then((res) => {
@ -4029,7 +4081,7 @@ export default {
userId: this.userId, userId: this.userId,
sn: this.orderinfo.sn, sn: this.orderinfo.sn,
orderNo: this.orderinfo.orderNo, orderNo: this.orderinfo.orderNo,
platform: "2", // 2
// money: this.freeInfo.fee, // money: this.freeInfo.fee,
mark: "订单支付", mark: "订单支付",
type: '1' type: '1'
@ -4037,19 +4089,14 @@ export default {
} }
console.log('点击了', this.ispaid);
let that = this let that = this
this.$u.post('/appVerify/pre/order', data).then((res) => { this.$u.post('/appVerify/pre/order', data).then((res) => {
if (res.code === 200) { if (res.code === 200) {
uni.hideLoading() uni.hideLoading()
// this.freList=res.rows // this.freList=res.rows
uni.requestPayment({ my.tradePay({
provider: 'wxpay', tradeNO: res.data.tradeNo,
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.packageVal,
signType: res.data.signType,
paySign: res.data.paySign,
success(res) { success(res) {
that.ispaid = false that.ispaid = false
console.log('支付成功'); console.log('支付成功');
@ -4060,7 +4107,7 @@ export default {
that.deviceIndex = 0 that.deviceIndex = 0
that.getisInOrder() that.getisInOrder()
let data = { let data = {
orderNo: that.orderinfo.orderNo orderNo: res.data.orderNo
} }
that.$u.get("/appVerify/queryResultByOrderNo?", data).then((res) => { that.$u.get("/appVerify/queryResultByOrderNo?", data).then((res) => {
@ -4158,20 +4205,16 @@ export default {
// money: this.freeInfo.fee, // money: this.freeInfo.fee,
isAppointment: false, isAppointment: false,
mark: "套餐开锁", mark: "套餐开锁",
type: '3' type: '3',
platform: "2", // 2
} }
this.$u.post('/appVerify/pre/order', data).then((res) => { this.$u.post('/appVerify/pre/order', data).then((res) => {
if (res.code === 200) { if (res.code === 200) {
// this.freList=res.rows // this.freList=res.rows
uni.requestPayment({ my.tradePay({
provider: 'wxpay', tradeNO: res.data.tradeNo,
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.packageVal,
signType: res.data.signType,
paySign: res.data.paySign,
success(res) { success(res) {
// //
this.showdevice = false this.showdevice = false
@ -4334,6 +4377,9 @@ export default {
},
toJSON() {
return this;
}, },
// //
sub4() { sub4() {
@ -4345,7 +4391,8 @@ export default {
isAppointment: true, isAppointment: true,
// money: this.freeInfo.fee, // money: this.freeInfo.fee,
mark: "预约购买套餐", mark: "预约购买套餐",
type: '3' type: '3',
platform: "2", // 2
} }
@ -4353,13 +4400,8 @@ export default {
this.$u.post('/appVerify/pre/order', data).then((res) => { this.$u.post('/appVerify/pre/order', data).then((res) => {
if (res.code === 200) { if (res.code === 200) {
// this.freList=res.rows // this.freList=res.rows
uni.requestPayment({ my.tradePay({
provider: 'wxpay', tradeNO: res.data.tradeNo,
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.packageVal,
signType: res.data.signType,
paySign: res.data.paySign,
success(res) { success(res) {
// //
@ -5188,38 +5230,6 @@ page {
} }
// .order_tips {
// display: flex;
// flex-wrap: nowrap;
// align-items: center;
// margin-right: auto;
// // margin: 0 auto;
// margin-top: 38rpx;
// padding: 28rpx 41rpx;
// width: 688rpx;
// height: 110rpx;
// background: #3D3D3D;
// box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(0, 0, 0, 0.3);
// border-radius: 53rpx 53rpx 53rpx 53rpx;
// image {
// margin-right: 34rpx;
// width: 44rpx;
// height: 51rpx;
// }
// .order_tips_txt {
// font-weight: 400;
// font-size: 36rpx;
// color: #FFFFFF;
// }
// .icon-xiangyou1 {
// margin-left: auto;
// font-size: 36rpx;
// color: #FFFFFF;
// }
// }
.order_tips { .order_tips {
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: nowrap;

View File

@ -16,20 +16,34 @@
</button> </button>
</view> --> </view> -->
<view class="pages2" v-if="deptId==100&&pageindex==0"> <view class="pages2" v-if="deptId == 100 && pageindex == 0">
<view class="imgbox"> <view class="imgbox">
<image src="https://lxnapi.ccttiot.com/bike/img/static/umJTSzDVtnfpyYrZY0VJ" mode="aspectFit"></image> <image src="https://lxnapi.ccttiot.com/bike/img/static/umJTSzDVtnfpyYrZY0VJ" mode="aspectFit"></image>
</view> </view>
<button class="button" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" <!-- <button class="button" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"
style="margin-top: 30rpx;"> style="margin-top: 30rpx;">
<!-- <image src="https://lxnapi.ccttiot.com/bike/img/static/uka0jHcbyy1we0qwbiov" mode="aspectFit"></image> -->
快捷登录 快捷登录
</button> -->
<button class="button" style="margin-top:30rpx" open-type="getAuthorize" scope='phoneNumber'
@getAuthorize="getPhoneNumber" error="getPhoneError">
手机号码授权
</button> </button>
<!-- <button
open-type="getAuthorize"
scope="phoneNumber"
@getAuthorize="getPhoneNumber"
onError="getPhoneError"
>
手机号码授权
</button> -->
<!-- <view class="button" style="margin-top: 20rpx;" @click="pageindex=1"> <!-- <view class="button" style="margin-top: 20rpx;" @click="pageindex=1">
<image src="https://lxnapi.ccttiot.com/bike/img/static/ubSJ6aNMOUfPf80iotGv" mode="aspectFit"></image> <image src="https://lxnapi.ccttiot.com/bike/img/static/ubSJ6aNMOUfPf80iotGv" mode="aspectFit"></image>
验证码登录 验证码登录
</view> --> </view> -->
<view class="tipss" @click="pageindex=1" style="width: 100%;text-align: center;margin-top: 50rpx;color: #ccc;"> <view class="tipss" @click="pageindex = 1"
style="width: 100%;text-align: center;margin-top: 50rpx;color: #ccc;">
手机号登录 手机号登录
</view> </view>
<!-- <view class="button1" @click="back"> <!-- <view class="button1" @click="back">
@ -84,11 +98,12 @@
<view class="lines"></view> <view class="lines"></view>
</view> </view>
<view class="wxbtn"> <view class="wxbtn">
<image @click="towx()" src="https://lxnapi.ccttiot.com/bike/img/static/uUCvpOwGG8McfpYSUye4" mode="aspectFit"> <image @click="towx()" src="https://lxnapi.ccttiot.com/bike/img/static/uUCvpOwGG8McfpYSUye4"
mode="aspectFit">
</image> </image>
</view> </view>
</view> </view>
<view class="page3" v-if="pageindex==1"> <view class="page3" v-if="pageindex == 1">
<view class="tit"> <view class="tit">
登录 登录
</view> </view>
@ -130,12 +145,13 @@
<view class="lines"></view> <view class="lines"></view>
</view> </view>
<view class="wxbtn"> <view class="wxbtn">
<image @click="towx()" src="https://lxnapi.ccttiot.com/bike/img/static/uUCvpOwGG8McfpYSUye4" mode="aspectFit"> <image @click="towx()" src="https://lxnapi.ccttiot.com/bike/img/static/uUCvpOwGG8McfpYSUye4"
mode="aspectFit">
</image> </image>
</view> </view>
</view> </view>
<view class="page3" v-if="pageindex==3"> <view class="page3" v-if="pageindex == 3">
<view class="tit_li" style="margin-top: 104rpx;"> <view class="tit_li" style="margin-top: 104rpx;">
<image src="https://lxnapi.ccttiot.com/bike/img/static/u3swF9YhZbUCuhGmrMrk" mode="aspectFit"></image> <image src="https://lxnapi.ccttiot.com/bike/img/static/u3swF9YhZbUCuhGmrMrk" mode="aspectFit"></image>
@ -168,7 +184,7 @@
<input type="number" class="ips" v-model="password2" placeholder=" 请输入新密码" <input type="number" class="ips" v-model="password2" placeholder=" 请输入新密码"
placeholder-style='font-weight: 400;font-size: 36rpx;color: #808080;' /> placeholder-style='font-weight: 400;font-size: 36rpx;color: #808080;' />
</view> </view>
<view class="tit_li" > <view class="tit_li">
<image src="https://lxnapi.ccttiot.com/bike/img/static/uYkqUlpkl5VuksJhaPlW" mode="aspectFit" <image src="https://lxnapi.ccttiot.com/bike/img/static/uYkqUlpkl5VuksJhaPlW" mode="aspectFit"
style="width: rpx;height: 54rpx;margin-right: 26rpx;"></image> style="width: rpx;height: 54rpx;margin-right: 26rpx;"></image>
确认密码 确认密码
@ -192,7 +208,7 @@
</view> </view>
<view class="pages2" v-if="deptId==101"> <view class="pages2" v-if="deptId == 101">
<view class="imgbox"> <view class="imgbox">
<image src="https://lxnapi.ccttiot.com/bike/img/static/uX6A5Dlyr4lvGFNuqfPK" mode="aspectFit"></image> <image src="https://lxnapi.ccttiot.com/bike/img/static/uX6A5Dlyr4lvGFNuqfPK" mode="aspectFit"></image>
</view> </view>
@ -211,7 +227,7 @@
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
bgc: { bgc: {
@ -232,28 +248,28 @@
uuid: '', uuid: '',
isSubButtonActive: false, isSubButtonActive: false,
isSubButtonActive1: false, isSubButtonActive1: false,
isSubButtonActive2:false, isSubButtonActive2: false,
phone1:'', phone1: '',
password1:'', password1: '',
interval:null, interval: null,
phone2:'', phone2: '',
phoneCode2:'', phoneCode2: '',
password2:'', password2: '',
subpassword2:'', subpassword2: '',
isCodeButtonDisabled2: false, isCodeButtonDisabled2: false,
codeButtonText2: '获取验证码', codeButtonText2: '获取验证码',
countdown2: 60, countdown2: 60,
openCode:null, openCode: null,
isindex:false, isindex: false,
areaId:'16' areaId: '16'
} }
}, },
onLoad(e) { onLoad(e) {
this.deptId = uni.getStorageSync('deptId'); this.deptId = uni.getStorageSync('deptId');
if(e.isindex=='true'){ if (e.isindex == 'true') {
this.isindex=true this.isindex = true
} }
// this.deptId = 101 // this.deptId = 101
@ -265,13 +281,13 @@
}, },
onShow() { onShow() {
if( uni.getStorageSync('areaId')){ if (uni.getStorageSync('areaId')) {
this.areaId = uni.getStorageSync('areaId'); this.areaId = uni.getStorageSync('areaId');
} }
wx.login({ wx.login({
success(res) { success(res) {
if (res.code) { if (res.code) {
this.openCode=res.code this.openCode = res.code
} }
}, },
@ -287,20 +303,20 @@
password() { password() {
this.checkInputFields(); this.checkInputFields();
}, },
phone1(){ phone1() {
this.checkInputFields1(); this.checkInputFields1();
}, },
password1() { password1() {
this.checkInputFields1(); this.checkInputFields1();
}, },
phone2(){ phone2() {
this.checkInputFields2(); this.checkInputFields2();
}, },
phoneCode2() { phoneCode2() {
this.checkInputFields2(); this.checkInputFields2();
}, },
password2(){ password2() {
this.checkInputFields2(); this.checkInputFields2();
}, },
subpassword2() { subpassword2() {
@ -308,27 +324,27 @@
}, },
}, },
methods: { methods: {
page3(){ page3() {
this.pageindex=3 this.pageindex = 3
this.phone1='' this.phone1 = ''
this.password1='' this.password1 = ''
}, },
page1(){ page1() {
// clearInterval(this.interval) // clearInterval(this.interval)
this.pageindex=2 this.pageindex = 2
this.phone1='' this.phone1 = ''
this.password1='' this.password1 = ''
}, },
page2(){ page2() {
// clearInterval(this.interval) // clearInterval(this.interval)
this.pageindex=1 this.pageindex = 1
this.phone='' this.phone = ''
this.phoneCode='' this.phoneCode = ''
this.password='' this.password = ''
}, },
sub3(){ sub3() {
if (!this.phone2 || !this.phoneCode2|| !this.password2|| !this.subpassword2) { if (!this.phone2 || !this.phoneCode2 || !this.password2 || !this.subpassword2) {
uni.showToast({ uni.showToast({
title: '请完整填写信息', title: '请完整填写信息',
@ -354,15 +370,15 @@
}); });
return; return;
} }
this.$u.put("/app/forgetAppPwd?phone="+this.phone2+'&newPassword='+this.password2+'&phoneCode='+this.phoneCode2+'&uuid='+this.uuid).then((res) => { this.$u.put("/app/forgetAppPwd?phone=" + this.phone2 + '&newPassword=' + this.password2 + '&phoneCode=' + this.phoneCode2 + '&uuid=' + this.uuid).then((res) => {
if (res.code == 200) { if (res.code == 200) {
// //
this.pageindex=2 this.pageindex = 2
this.phone2='' this.phone2 = ''
this.phoneCode2='' this.phoneCode2 = ''
this.uuid='' this.uuid = ''
this.password2='' this.password2 = ''
this.subpassword2='' this.subpassword2 = ''
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
@ -373,7 +389,7 @@
}); });
}, },
// //
sub2(){ sub2() {
if (!this.phone1 || !this.password1) { if (!this.phone1 || !this.password1) {
uni.showToast({ uni.showToast({
@ -414,7 +430,7 @@
}); });
}, },
checkInputFields2() { checkInputFields2() {
if (this.phone2&& this.phoneCode2 && this.password2&&this.subpassword2) { if (this.phone2 && this.phoneCode2 && this.password2 && this.subpassword2) {
this.isSubButtonActive2 = true; this.isSubButtonActive2 = true;
} else { } else {
this.isSubButtonActive2 = false; this.isSubButtonActive2 = false;
@ -557,7 +573,7 @@
areaId: this.areaId, areaId: this.areaId,
phoneCode: this.phoneCode, phoneCode: this.phoneCode,
uuid: this.uuid, uuid: this.uuid,
openid:this.openCode openid: this.openCode
} }
this.$u.post("/appCodeLogin", data).then((res) => { this.$u.post("/appCodeLogin", data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
@ -591,70 +607,74 @@
delta: 1 // delta1 delta: 1 // delta1
}); });
}, },
getPhoneNumber(e) {
let that = this;
console.log("eeeeeeee", e); getPhoneNumber() {
const wxLoginAsync = () => {
return new Promise((resolve, reject) => {
wx.login({ my.getPhoneNumber({
success(res) { success: (res) => {
if (res.code) {
console.log('登录!', res); const encryptedData = res.response
let data = { let data = {
jscode: res.code, mobileCiphertext: encryptedData, //
// userType: that.usertype, areaId: this.areaId
mobileCode: e.detail.code,
}; };
resolve(data); my.getAuthCode({
} else { scopes: 'auth_user',
reject(res.errMsg); success: (res) => {
} if (res.authCode) {
}, //
fail(err) { data.loginCode = res.authCode
reject(err); this.$u.post("/aliLogin", data).then((res) => {
} console.log(res,'res');
});
});
};
wxLoginAsync()
.then(async (data) => {
// let areaId = uni.getStorageSync('areaId');
this.$u.post("/wxlogin?mobileCode=" + data.mobileCode + '&jsCode=' + data.jscode +
'&areaId=' + this.areaId).then((res) => {
// this.$forceUpdate()
if (res.code == 200) { if (res.code == 200) {
console.log(res, 'resres'); // token
wx.setStorageSync('token', res.token); uni.setStorageSync('token', res.token);
that.ceshi() this.ceshi();
// uni.switchTab({
// url: '/pages/index/index'
// })
} else { } else {
uni.showToast({ my.showToast({
title: res.msg, content: res.msg,
icon: 'none', type: 'none',
duration: 2000 duration: 2000
}); });
} }
}); });
}
},
fail: (err) => {
//
console.error('获取授权码失败:', err);
}
});
})
.catch((err) => { //
console.error(err);
},
fail: (res) => {
uni.showToast({
title: "授权手机号码失败"
}); });
}, },
});
},
getPhoneError() {
uni.showToast({
title: "取消手机号码授权"
});
},
async ceshi() { async ceshi() {
this.$u.get("/getAppInfo").then((res) => { this.$u.get("/getAppInfo").then((res) => {
console.log('进入跳转'); console.log('进入跳转');
if(this.isindex==true){ if (this.isindex == true) {
uni.navigateBack({ uni.navigateBack({
delta: 1 // delta1 delta: 1 // delta1
}); });
}else{ } else {
uni.navigateTo({ uni.navigateTo({
url: '/pages/index/index' url: '/pages/index/index'
}) })
@ -663,15 +683,15 @@
}); });
}, },
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
page { page {
background: #FFFFFF; background: #FFFFFF;
} }
.page { .page {
position: relative; position: relative;
/* 添加相对定位 */ /* 添加相对定位 */
@ -912,9 +932,9 @@
} }
} }
} }
.tip { .tip {
margin-top: 128rpx; margin-top: 128rpx;
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: nowrap;
@ -928,5 +948,5 @@
width: 26rpx; width: 26rpx;
height: 26rpx; height: 26rpx;
} }
} }
</style> </style>