小鹿骑行 优化蓝牙连接
This commit is contained in:
parent
fcb3927a4b
commit
15b3a7d7f0
|
@ -171,15 +171,20 @@
|
|||
url:'/page_fenbao/storedlist/trueorder?modelId=' + this.modelId + '&sn=' + this.sn
|
||||
})
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: '当前车辆不可用',
|
||||
icon: 'none'
|
||||
})
|
||||
console.log('前台');
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '当前车辆不可用',
|
||||
showCancel: false,
|
||||
confirmText: '知道了'
|
||||
})
|
||||
}
|
||||
}else{
|
||||
console.log('系统');
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
icon: 'none',
|
||||
duration:2000
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
|
@ -379,18 +379,24 @@
|
|||
sn: '',
|
||||
tit: '',
|
||||
logoflag: false,
|
||||
devicesarr: [],
|
||||
ver_dataflag: 1,
|
||||
deviceId: '',
|
||||
name: '',
|
||||
mac: '',
|
||||
zhezhaoflag:true,
|
||||
tit:' ',
|
||||
actiobj:{},
|
||||
countdown:1
|
||||
countdown:1,
|
||||
|
||||
ver_dataflag: 1,
|
||||
mac: '',
|
||||
deviceid: '',
|
||||
devicename: '',
|
||||
devicesarr: [],
|
||||
findDeviceTimer: null,
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
xBlufi.initXBlufi(1)
|
||||
console.log(option)
|
||||
if (option.modelId) {
|
||||
uni.showLoading({
|
||||
|
@ -419,7 +425,6 @@
|
|||
})
|
||||
},1000)
|
||||
} else {
|
||||
// this.zhezhaoflag = true
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
|
@ -448,9 +453,15 @@
|
|||
this.sn = getQueryParam(decodedValue, 's')
|
||||
this.$u.get(`/app/device/availableDetail?sn=${this.sn}`).then((res) => {
|
||||
if (res.code == 200) {
|
||||
console.log(res.data);
|
||||
if (res.data) {
|
||||
this.bikeobj = res.data
|
||||
this.modelId = res.data.modelId
|
||||
if(res.data.onlineStatus == 0){
|
||||
this.mac = res.data.mac
|
||||
console.log(this.mac)
|
||||
this.findDevice()
|
||||
}
|
||||
this.gettaocan()
|
||||
this.getcheliang()
|
||||
} else {
|
||||
|
@ -467,7 +478,7 @@
|
|||
} else { //不是则返回上一级
|
||||
uni.navigateBack()
|
||||
}
|
||||
}, 1500)
|
||||
}, 2000)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -488,8 +499,14 @@
|
|||
this.$u.get(`/app/device/availableDetail?sn=${this.sn}`).then((res) => {
|
||||
if (res.code == 200) {
|
||||
if (res.data) {
|
||||
console.log(res.data);
|
||||
this.bikeobj = res.data
|
||||
this.modelId = res.data.modelId
|
||||
if(res.data.onlineStatus == 0){
|
||||
this.mac = res.data.mac
|
||||
console.log(this.mac);
|
||||
this.findDevice()
|
||||
}
|
||||
this.gettaocan()
|
||||
this.getcheliang()
|
||||
} else {
|
||||
|
@ -518,7 +535,85 @@
|
|||
this.getgg()
|
||||
},1500)
|
||||
},
|
||||
onShow() {
|
||||
xBlufi.notifyStartDiscoverBle({
|
||||
'isStart': true
|
||||
})
|
||||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
||||
},
|
||||
methods: {
|
||||
// 判断离线连接蓝牙
|
||||
findDevice() {
|
||||
// 使用 find 方法查找匹配的设备
|
||||
console.log(this.devicesarr);
|
||||
const matchedDevice = this.devicesarr.find(device => {
|
||||
// console.log(device.name, this.mac, '111')
|
||||
return device.name.slice(-12) == this.mac.slice(-12)
|
||||
})
|
||||
if (matchedDevice) {
|
||||
// 找到匹配的设备
|
||||
xBlufi.notifyStartDiscoverBle({
|
||||
'isStart': false
|
||||
})
|
||||
xBlufi.notifyConnectBle({
|
||||
isStart: true,
|
||||
deviceId: matchedDevice.deviceId,
|
||||
name: matchedDevice.name
|
||||
})
|
||||
this.deviceid = matchedDevice.deviceId
|
||||
this.devicename = matchedDevice.name
|
||||
console.log(this.deviceid, '11221')
|
||||
} else {
|
||||
this.findDeviceTimer = setTimeout(this.findDevice.bind(this), 1000) // 使用 bind 保持 this 上下文
|
||||
}
|
||||
},
|
||||
// 获取附近蓝牙设备列表
|
||||
funListenDeviceMsgEvent: function(options) {
|
||||
switch (options.type) {
|
||||
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED:
|
||||
if (!options.result) {
|
||||
console.log('断开');
|
||||
this.ver_dataflag = 1
|
||||
console.log(this.ver_dataflag,'断开断开');
|
||||
}
|
||||
break;
|
||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
|
||||
if (options.result) {
|
||||
this.devicesarr = options.data
|
||||
}
|
||||
break;
|
||||
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
|
||||
console.log("连接回调:" + JSON.stringify(options))
|
||||
if (options.result == true) {
|
||||
setTimeout(() => {
|
||||
this.ver_dataflag = 3
|
||||
uni.hideLoading()
|
||||
}, 2000)
|
||||
xBlufi.notifyInitBleEsp32({
|
||||
deviceId: this.deviceid
|
||||
})
|
||||
this.deviceid = options.data.deviceId
|
||||
this.name = this.name
|
||||
}else{
|
||||
uni.hideLoading()
|
||||
this.findDevice()
|
||||
}
|
||||
break;
|
||||
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
||||
console.log("1收到设备发来的自定义数据结果:", options.data)
|
||||
break;
|
||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
||||
if (!options.result) {
|
||||
console.log('蓝牙未开启')
|
||||
return
|
||||
} else {
|
||||
this.lanyaflag = false
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
startCountdown() {
|
||||
const timer = setInterval(() => {
|
||||
if (this.countdown <= 0) {
|
||||
|
@ -562,6 +657,154 @@
|
|||
},
|
||||
// 点击进行支付
|
||||
btnzhifu() {
|
||||
if(this.bikeobj.onlineStatus == 0){
|
||||
if(this.ver_dataflag == 3){
|
||||
this.getlyzf()
|
||||
}else{
|
||||
uni.showLoading({
|
||||
title: '车辆连接中...',
|
||||
mask: true
|
||||
})
|
||||
}
|
||||
}else{
|
||||
if (this.bikeobj.areaAuthentication == true) { //判断是否需要实名认证
|
||||
this.$u.get("/getInfo").then(res => {
|
||||
if (res.code == 200) {
|
||||
if (res.user.isReal == false) { //未实名需要去实名才能进行下单
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您当前还未实名认证,是否前去实名认证?',
|
||||
showCancel: true,
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: '/page_user/shiming'
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}else{
|
||||
if (this.checked == false) {
|
||||
let that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您是否已经阅读完,并且同意此《电动车租赁协议》?',
|
||||
showCancel: true,
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
that.checked = true
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
})
|
||||
that.$u.get(`/app/channel/list?appId=${that.$store.state.appid}`).then((
|
||||
res) => {
|
||||
if (res.code == 200) {
|
||||
that.channelId = res.data[0].channelId
|
||||
that.getzf()
|
||||
} else if (res.code == 401) {
|
||||
uni.hideLoading()
|
||||
that.logoflag = true
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('取消') // 用户点击取消
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
})
|
||||
this.$u.get(`/app/channel/list?appId=${this.$store.state.appid}`).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.channelId = res.data[0].channelId
|
||||
this.getzf()
|
||||
} else if (res.code == 401) {
|
||||
uni.hideLoading()
|
||||
this.logoflag = true
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}else if(res.code == 401){
|
||||
this.logoflag = true
|
||||
}
|
||||
})
|
||||
} else if (this.checked == false) {
|
||||
let that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您是否已经阅读完,并且同意此《电动车租赁协议》?',
|
||||
showCancel: true,
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
that.checked = true
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
})
|
||||
that.$u.get(`/app/channel/list?appId=${that.$store.state.appid}`).then((
|
||||
res) => {
|
||||
if (res.code == 200) {
|
||||
that.channelId = res.data[0].channelId
|
||||
that.getzf()
|
||||
} else if (res.code == 401) {
|
||||
uni.hideLoading()
|
||||
that.logoflag = true
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('取消') // 用户点击取消
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
})
|
||||
this.$u.get(`/app/channel/list?appId=${this.$store.state.appid}`).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.channelId = res.data[0].channelId
|
||||
this.getzf()
|
||||
} else if (res.code == 401) {
|
||||
uni.hideLoading()
|
||||
this.logoflag = true
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
// 蓝牙支付
|
||||
getlyzf(){
|
||||
if (this.bikeobj.areaAuthentication == true) { //判断是否需要实名认证
|
||||
this.$u.get("/getInfo").then(res => {
|
||||
if (res.code == 200) {
|
||||
|
@ -576,7 +819,7 @@
|
|||
url: '/page_user/shiming'
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -585,7 +828,7 @@
|
|||
let that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '《电动车租赁协议》您是否已阅读并同意?',
|
||||
content: '您是否已经阅读完,并且同意此《电动车租赁协议》?',
|
||||
showCancel: true,
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
|
@ -594,11 +837,10 @@
|
|||
title: '加载中...',
|
||||
mask: true
|
||||
})
|
||||
that.$u.get(`/app/channel/list?appId=${that.$store.state.appid}`).then((
|
||||
res) => {
|
||||
that.$u.get(`/app/channel/list?appId=${that.$store.state.appid}`).then((res) => {
|
||||
if (res.code == 200) {
|
||||
that.channelId = res.data[0].channelId
|
||||
that.getzf()
|
||||
that.getlyxd()
|
||||
} else if (res.code == 401) {
|
||||
uni.hideLoading()
|
||||
that.logoflag = true
|
||||
|
@ -623,7 +865,7 @@
|
|||
this.$u.get(`/app/channel/list?appId=${this.$store.state.appid}`).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.channelId = res.data[0].channelId
|
||||
this.getzf()
|
||||
this.getlyxd()
|
||||
} else if (res.code == 401) {
|
||||
uni.hideLoading()
|
||||
this.logoflag = true
|
||||
|
@ -645,7 +887,7 @@
|
|||
let that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '《电动车租赁协议》您是否已阅读并同意?',
|
||||
content: '您是否已经阅读完,并且同意此《电动车租赁协议》?',
|
||||
showCancel: true,
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
|
@ -658,7 +900,7 @@
|
|||
res) => {
|
||||
if (res.code == 200) {
|
||||
that.channelId = res.data[0].channelId
|
||||
that.getzf()
|
||||
that.getlyxd()
|
||||
} else if (res.code == 401) {
|
||||
uni.hideLoading()
|
||||
that.logoflag = true
|
||||
|
@ -683,7 +925,7 @@
|
|||
this.$u.get(`/app/channel/list?appId=${this.$store.state.appid}`).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.channelId = res.data[0].channelId
|
||||
this.getzf()
|
||||
this.getlyxd()
|
||||
} else if (res.code == 401) {
|
||||
uni.hideLoading()
|
||||
this.logoflag = true
|
||||
|
@ -697,7 +939,65 @@
|
|||
})
|
||||
}
|
||||
},
|
||||
|
||||
// 蓝牙下单
|
||||
getlyxd(){
|
||||
let data = {
|
||||
deviceId: this.bikeobj.id,
|
||||
suitId: this.suitId,
|
||||
price: this.yucobj,
|
||||
appId: this.$store.state.appid,
|
||||
channelId: this.channelId
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
})
|
||||
this.$u.post(`/app/order`, data).then((resp) => {
|
||||
if (resp.code == 200) {
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
timeStamp: resp.data.payParams.timeStamp,
|
||||
nonceStr: resp.data.payParams.nonceStr,
|
||||
package: resp.data.payParams.packageVal,
|
||||
signType: resp.data.payParams.signType,
|
||||
paySign: resp.data.payParams.paySign,
|
||||
success: (respc) => {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "11open@"
|
||||
})
|
||||
console.log(respc, '支付成功')
|
||||
// xBlufi.notifySendCustomData({
|
||||
// customData: "11open@"
|
||||
// })
|
||||
this.$u.put(`/app/pay/refreshPayResult?no=${resp.data.pay.no}`).then((
|
||||
res) => {
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/myorder/returned/index?orderid=' + resp.data.pay.bstId + '&vate=' + this.devicesarr
|
||||
})
|
||||
uni.hideLoading()
|
||||
}, 1000)
|
||||
}) //刷新支付结果
|
||||
},
|
||||
fail(err) {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
}, 1000)
|
||||
console.log('取消或者支付失败')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: resp.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
}).catch(e => {
|
||||
uni.hideLoading()
|
||||
})
|
||||
},
|
||||
// 下单
|
||||
getzf() {
|
||||
let data = {
|
||||
|
@ -758,6 +1058,10 @@
|
|||
this.$u.get(`/app/device/availableDetail?sn=${this.sn}`).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.bikeobj = res.data
|
||||
if(res.data.onlineStatus == 0){
|
||||
this.mac = res.data.mac
|
||||
this.findDevice()
|
||||
}
|
||||
console.log(res.data,'020202');
|
||||
this.$u.put(`/app/user/bindArea?areaId=${res.data.areaId}`).then(resp =>{})
|
||||
}
|
||||
|
@ -765,6 +1069,10 @@
|
|||
} else {
|
||||
this.$u.get(`/app/device/availableDetail?sn=${this.chesn}`).then((res) => {
|
||||
if (res.code == 200) {
|
||||
if(res.data.onlineStatus == 0){
|
||||
this.mac = res.data.mac
|
||||
this.findDevice()
|
||||
}
|
||||
this.bikeobj = res.data
|
||||
}
|
||||
})
|
||||
|
@ -775,8 +1083,10 @@
|
|||
this.$u.get(`/app/suit/listByModel?modelId=${this.modelId}`).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.taocanlist = res.data
|
||||
this.suitId = res.data[0].id
|
||||
this.actiobj = res.data[0]
|
||||
if(this.suitId == ''){
|
||||
this.suitId = res.data[0].id
|
||||
this.actiobj = res.data[0]
|
||||
}
|
||||
this.getjisuan()
|
||||
}
|
||||
})
|
||||
|
@ -858,6 +1168,7 @@
|
|||
if (res.code == 200) {
|
||||
wx.setStorageSync('token', res.token)
|
||||
this.gettaocan()
|
||||
// this.fanganindex = 0
|
||||
this.tit = '确认订单页'
|
||||
this.logoflag = false
|
||||
} else {
|
||||
|
|
|
@ -425,6 +425,7 @@
|
|||
let sceneValue = res.result
|
||||
let decodedValue = decodeURIComponent(sceneValue)
|
||||
this.sn = getQueryParam(decodedValue, 's')
|
||||
console.log(this.sn,'....');
|
||||
if (this.sn != '') {
|
||||
this.$u.get('/bst/device?sn=' + this.sn).then((res) => {
|
||||
if (res.code === 200) {
|
||||
|
|
|
@ -9,15 +9,15 @@
|
|||
账户总余额
|
||||
</view>
|
||||
<view class="num">
|
||||
¥{{userInfo.balance == null ? '0.00' : userInfo.balance.toFixed(2)}}元
|
||||
¥{{userInfo.balance == null ? '0.00' : (Number(userInfo.balance) + Number(waitDivideAmount)).toFixed(2)}}元
|
||||
</view>
|
||||
</view>
|
||||
<view class="li_box">
|
||||
<view class="txt">
|
||||
待结算金额
|
||||
累计提现
|
||||
</view>
|
||||
<view class="num">
|
||||
¥{{waitDivideAmount == null ? '0.00' : waitDivideAmount.toFixed(2)}}元
|
||||
¥{{successAmount == null ? '0.00' : successAmount.toFixed(2)}}元
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -162,7 +162,8 @@
|
|||
channelId:'',
|
||||
objobj:{},
|
||||
total:0,
|
||||
waitDivideAmount:''
|
||||
waitDivideAmount:'',
|
||||
successAmount:''
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
|
@ -209,7 +210,8 @@
|
|||
if (res.code == 200) {
|
||||
this.userInfo = res.user
|
||||
this.gettxfs()
|
||||
this.waitDivideAmount = res.stat.bonus.waitDivideAmount
|
||||
this.successAmount = res.stat.withdraw.successAmount == null ? 0 : res.stat.withdraw.successAmount
|
||||
this.waitDivideAmount = res.stat.bonus.waitDivideAmount == null ? 0 : res.stat.bonus.waitDivideAmount
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
@ -22,17 +22,12 @@
|
|||
<view v-if="item.ridingRule==1 && item.startRule" class="charging-card">
|
||||
<view class="charging-item">
|
||||
<text class="label">起步价:</text>
|
||||
<text class="value">{{item.startRule.startingPrice || '--'}}元(含{{item.startRule.startingTime || '--'}}<span
|
||||
v-if="item.rentalUnit=='minutes'">分钟</span><span
|
||||
v-if="item.rentalUnit=='hours'">小时</span><span
|
||||
v-if="item.rentalUnit=='day'">天</span>)</text>
|
||||
<text class="value" style="display: flex;">{{item.startRule.startingPrice || '--'}}元(含{{item.startRule.startingTime || '--'}}{{item.rentalUnit == 'minutes' ? '分钟' : item.rentalUnit == 'hours' ? '小时' : '天'}})</text>
|
||||
</view>
|
||||
<view class="charging-item">
|
||||
<text class="label">时长费:</text>
|
||||
<text class="value">{{item.startRule.timeoutPrice || '--'}}元/{{ item.startRule.timeoutTime || '--'}}<span
|
||||
v-if="item.rentalUnit=='minutes'">分钟</span><span
|
||||
v-if="item.rentalUnit=='hours'">小时</span><span
|
||||
v-if="item.rentalUnit=='day'">天</span></text>
|
||||
<text class="value" style="display: flex;">{{item.startRule.timeoutPrice || '--'}}元/{{ item.startRule.timeoutTime || '--'}}{{item.rentalUnit == 'minutes' ? '分钟' : item.rentalUnit == 'hours' ? '小时' : '天'}}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
@ -92,12 +87,12 @@
|
|||
</view> -->
|
||||
<view class="line" ></view>
|
||||
<view class="btn_li">
|
||||
<view class="btn1" @click="del(item)">
|
||||
删除
|
||||
</view>
|
||||
<view class="btn2" @click="todetail(item)">
|
||||
编辑
|
||||
</view>
|
||||
<view class="btn1" @click="del(item)">
|
||||
删除
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="" style="width: 100%;text-align: center;color: #ccc;margin-top: 30rpx;">
|
||||
|
@ -436,7 +431,7 @@
|
|||
|
||||
.btn1 {
|
||||
color: #ff4d4f;
|
||||
border-right: 1rpx solid #f0f0f0;
|
||||
border-left: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.btn2 {
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
<view class="" style="background: #FFFFFF;width: 750rpx;padding-top: 20rpx;box-sizing: border-box;">
|
||||
<view class="top_box">
|
||||
<view class="sear_ipt">
|
||||
<input type="text" v-model="searchKeyword" placeholder="请输入SN码或车牌号" class="input" placeholder-style="color:#C7CDD3" >
|
||||
<view class="" @click="search">
|
||||
<input type="text" v-model="searchKeyword" placeholder="请输入SN码或车牌号" class="input" @input="search" placeholder-style="color:#C7CDD3" >
|
||||
<!-- <view class="" @click="search">
|
||||
搜索
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -576,7 +576,7 @@ page {
|
|||
color: #fff;
|
||||
}
|
||||
.input {
|
||||
width:540rpx !important;
|
||||
width:680rpx !important;
|
||||
font-size: 28rpx;
|
||||
color: #1a1a1a;
|
||||
border: 1px solid #ccc;
|
||||
|
|
|
@ -75,10 +75,10 @@
|
|||
<view class="order_info">
|
||||
<view class="info_li">
|
||||
<view class="half_info_li" v-if="item.status=='PROCESSING'">
|
||||
实收金额:<span>0元</span>
|
||||
实收金额:<span style="color:orange;">0元</span>
|
||||
</view>
|
||||
<view class="half_info_li" v-else>
|
||||
实收金额:<span>{{ formatPayedAmount(item.payedAmount, item.payRefunded, item.payRefunding) }}</span>
|
||||
实收金额:<span style="color: orange;">{{ formatPayedAmount(item.payedAmount, item.payRefunded, item.payRefunding) }}</span>
|
||||
</view>
|
||||
<view class="half_info_li">
|
||||
用户手机号:<span>{{item.userPhone == null ? '--' : item.userPhone}}</span>
|
||||
|
@ -105,9 +105,12 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="info_li">
|
||||
<view class="half_info_li">
|
||||
<view class="half_info_li" v-if="item.startTime">
|
||||
开始时间:<span>{{formatDate(item.startTime)}}</span>
|
||||
</view>
|
||||
<view class="half_info_li" v-else>
|
||||
开始时间:<span>无</span>
|
||||
</view>
|
||||
<view class="half_info_li">
|
||||
<!-- 租赁时长:<span>{{computedList(item.duration)}}</span> -->
|
||||
租赁时长:<span>{{formatDatess(item.startTime,item.endTime)}}</span>
|
||||
|
|
|
@ -237,8 +237,8 @@
|
|||
<view class="one">
|
||||
最后租车客户: <span @click="btntel" style="color: #4C97E7;"><image src="https://api.ccttiot.com/smartmeter/img/static/uCa86z0tr5WHiymtRJYt" mode=""></image>{{deviceInfos.orderUserPhone == null ? '--' : deviceInfos.orderUserPhone}}</span>
|
||||
</view>
|
||||
<view class="one">
|
||||
最后租车订单: <span>{{deviceInfos.orderNo == null ? '--' : deviceInfos.orderNo}}</span>
|
||||
<view class="one" @click="btndd">
|
||||
最后租车订单: <span style="color: #4C97E7;">{{deviceInfos.orderNo == null ? '--' : deviceInfos.orderNo}}</span>
|
||||
</view>
|
||||
<view class="one">
|
||||
最后用车时间: <span v-if="deviceInfos.orderDeviceStatus == 'USING'">使用中</span> <span v-else>{{deviceInfos.orderDeviceEndTime == null ? '--' : deviceInfos.orderDeviceEndTime}}</span>
|
||||
|
@ -461,6 +461,12 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
// 点击跳转到订单详情
|
||||
btndd(){
|
||||
uni.navigateTo({
|
||||
url:'/page_shanghu/guanli/order_detail?orid=' + this.deviceInfos.orderId + '&id=' + this.deviceInfos.sn
|
||||
})
|
||||
},
|
||||
// 点击提示什么声音模式
|
||||
btnsy(){
|
||||
if(this.deviceInfos.music == 0){
|
||||
|
|
|
@ -64,9 +64,8 @@
|
|||
<span v-else>¥0.00</span>
|
||||
</view>
|
||||
<view class="dingdanli" style="position: relative;" @click="btnflagxs">
|
||||
调度费用:<span v-if="orderxqobj.dispatchFee">¥{{orderxqobj.dispatchFee}}</span>
|
||||
<span v-if="orderxqobj.manageFee">¥{{orderxqobj.manageFee}}</span>
|
||||
<span v-else>¥0.00</span>
|
||||
调度费用:<span v-if="orderxqobj.dispatchFee > 0">¥{{orderxqobj.dispatchFee}}</span>
|
||||
<span v-else>¥{{orderxqobj.manageFee}}</span>
|
||||
<image v-if="orderxqobj.dispatchFee || orderxqobj.manageFee" style="width: 20rpx;height: 20rpx;margin-left: 16rpx;" src="https://api.ccttiot.com/smartmeter/img/static/ubRtJnZqaAxybajDMLSG" mode=""></image>
|
||||
<view class="" v-if="flagdiaodu" style="width: 166rpx;height: 82rpx;background-color: #F3F3F3;position: absolute;top: 40rpx;right: 0;text-align: center;border-radius: 4rpx;">
|
||||
<view class="" style="font-size: 20rpx;color: #808080;width: 100%;margin-top: 8rpx;">
|
||||
|
@ -418,6 +417,7 @@
|
|||
|
||||
currentPolyline:[],
|
||||
trackPoints: [], // 存储轨迹点数据
|
||||
tkje:true
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
|
@ -662,28 +662,40 @@
|
|||
|
||||
// 点击退款
|
||||
btntuikuan(){
|
||||
let data = {
|
||||
orderId:this.orid,
|
||||
amount:this.amount
|
||||
}
|
||||
this.$u.put(`/bst/order/refund`,data).then(res =>{
|
||||
if(res.code == 200){
|
||||
uni.showToast({
|
||||
title: '退款成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.tkflag = false
|
||||
this.deviceInfo()
|
||||
this.getorderxq()
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
if(this.tkje == true){
|
||||
this.tkje = false
|
||||
let data = {
|
||||
orderId:this.orid,
|
||||
amount:this.amount
|
||||
}
|
||||
})
|
||||
this.$u.put(`/bst/order/refund`,data).then(res =>{
|
||||
if(res.code == 200){
|
||||
uni.showToast({
|
||||
title: '退款成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.tkflag = false
|
||||
this.deviceInfo()
|
||||
this.getorderxq()
|
||||
setTimeout(()=>{
|
||||
this.tkje = true
|
||||
},2000)
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
this.tkflag = false
|
||||
setTimeout(()=>{
|
||||
this.tkje = true
|
||||
},2000)
|
||||
}
|
||||
})
|
||||
}else{
|
||||
console.log(11);
|
||||
}
|
||||
},
|
||||
// 点击辅助还车
|
||||
btnfuzhu(){
|
||||
|
@ -2516,7 +2528,7 @@
|
|||
view{
|
||||
width: 50%;
|
||||
margin-top: 10rpx;
|
||||
font-size: 24rpx;
|
||||
font-size: 26rpx;
|
||||
color: #979797;
|
||||
span{
|
||||
color: #000;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
账户余额(元)
|
||||
</view>
|
||||
<view class="price">
|
||||
{{infoobj.balance == null ? '¥0.00' : '¥' + infoobj.balance.toFixed(2)}}
|
||||
¥{{infoobj.balance == null ? '0.00' : (Number(infoobj.balance) + Number(waitDivideAmount)).toFixed(2)}}
|
||||
</view>
|
||||
<view class="ljtx">
|
||||
累积提现:{{successAmount == null ? '¥0.00' : '¥' + successAmount.toFixed(2)}}
|
||||
|
@ -38,7 +38,7 @@
|
|||
<view class="leiji">
|
||||
<view class="li">
|
||||
<view class="top">
|
||||
{{qbobj.user.count == null ? '0人' : qbobj.user.count + '人'}}
|
||||
{{qbobj.orderUserCount == null ? '0人' : qbobj.orderUserCount + '人'}}
|
||||
</view>
|
||||
<view class="bot">
|
||||
累计用户
|
||||
|
@ -46,15 +46,17 @@
|
|||
</view>
|
||||
<view class="li">
|
||||
<view class="top">
|
||||
{{(Number(qbobj.bonus.amount) - Number(qbobj.bonusRefund.amount)).toFixed(2) == null ? '¥0.00' : '¥' + (Number(qbobj.bonus.amount) - Number(qbobj.bonusRefund.amount)).toFixed(2)}}
|
||||
<!-- {{(Number(qbobj.bonus.amount) - Number(qbobj.bonusRefund.amount)).toFixed(2) == null ? '¥0.00' : '¥' + (Number(qbobj.bonus.amount) - Number(qbobj.bonusRefund.amount)).toFixed(2)}} -->
|
||||
¥{{qbobj.bonusActualAmount == null ? 0 : qbobj.bonusActualAmount}}
|
||||
</view>
|
||||
<view class="bot">
|
||||
累计分成
|
||||
累计收益
|
||||
</view>
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="top">
|
||||
{{(Number(qbobj.order.payAmount) - Number(qbobj.orderRefund.amount)).toFixed(2) == null ? '¥0.00' : '¥' + (Number(qbobj.order.payAmount) - Number(qbobj.orderRefund.amount)).toFixed(2)}}
|
||||
<!-- {{(Number(qbobj.order.payAmount) - Number(qbobj.orderRefund.amount)).toFixed(2) == null ? '¥0.00' : '¥' + (Number(qbobj.order.payAmount) - Number(qbobj.orderRefund.amount)).toFixed(2)}} -->
|
||||
¥{{qbobj.orderActualTotalAmount == null ? 0 : qbobj.orderActualTotalAmount}}
|
||||
</view>
|
||||
<view class="bot">
|
||||
订单金额
|
||||
|
@ -62,7 +64,7 @@
|
|||
</view>
|
||||
<view class="li">
|
||||
<view class="top">
|
||||
{{qbobj.order.count == null ? '0' : qbobj.order.count + '笔'}}
|
||||
{{qbobj.orderCount == null ? '0' : qbobj.orderCount}}笔
|
||||
</view>
|
||||
<view class="bot">
|
||||
订单数量
|
||||
|
@ -99,146 +101,102 @@
|
|||
上月
|
||||
</view>
|
||||
</view>
|
||||
<view class="ordertj">
|
||||
<view class="one">
|
||||
<view class="two">
|
||||
¥{{yunyingobj.orderActualTotalAmount == null ? 0 : yunyingobj.orderActualTotalAmount}}
|
||||
</view>
|
||||
<view class="thr">
|
||||
订单总金额
|
||||
</view>
|
||||
</view>
|
||||
<view class="one">
|
||||
<view class="two">
|
||||
{{yunyingobj.orderCount == null ? 0 : yunyingobj.orderCount}}笔
|
||||
</view>
|
||||
<view class="thr">
|
||||
订单总数
|
||||
</view>
|
||||
</view>
|
||||
<view class="one">
|
||||
<view class="two">
|
||||
{{yunyingobj.finishedOrderCount == null ? 0 : yunyingobj.finishedOrderCount}}笔
|
||||
</view>
|
||||
<view class="thr">
|
||||
已完成订单
|
||||
</view>
|
||||
</view>
|
||||
<view class="one">
|
||||
<view class="two">
|
||||
{{yunyingobj.orderStatusMap.PROCESSING == null ? 0 : yunyingobj.orderStatusMap.PROCESSING}}笔
|
||||
</view>
|
||||
<view class="thr">
|
||||
进行中订单
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="yinshouqk">
|
||||
<view class="name">
|
||||
营收情况
|
||||
我的收入<text style="color: rgb(242,75,23);margin-left: 10rpx;font-size: 32rpx;">{{yunyingobj.bonusActualAmount == null ? 0 : yunyingobj.bonusActualAmount}}</text>元
|
||||
</view>
|
||||
<view class="zongfy">
|
||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uUjJxrOO6zHPzjT0Srl4" mode=""></image>
|
||||
<view class="top">
|
||||
<view class="topwz">
|
||||
{{yunyingobj.order.count == null ? '0' : yunyingobj.order.count + '笔'}}
|
||||
</view>
|
||||
<view class="botwz">
|
||||
订单数量
|
||||
</view>
|
||||
</view>
|
||||
<view class="top">
|
||||
<view class="topwz">
|
||||
{{yunyingobj.order.payAmount == null ? '¥0.00' : '¥' + ((yunyingobj.order.payAmount - yunyingobj.orderRefund.amount).toFixed(2))}}
|
||||
</view>
|
||||
<view class="botwz">
|
||||
订单金额
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="top">
|
||||
<view class="topwz">
|
||||
3652
|
||||
</view>
|
||||
<view class="botwz">
|
||||
总营收
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="name" style="margin-top: 10rpx;">
|
||||
订单收入<text style="color: rgb(242,75,23);margin-left: 10rpx;font-size: 32rpx;">{{yunyingobj.orderActualAmount == null ? 0 : yunyingobj.orderActualAmount}}</text>元
|
||||
</view>
|
||||
<view class="zongfy">
|
||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uCWFSrIsbEaQdKHWZv7U" mode=""></image>
|
||||
<view class="top">
|
||||
<view class="topwz">
|
||||
{{yunyingobj.bonus.count == null ? '0' : yunyingobj.bonus.count + '笔'}}
|
||||
</view>
|
||||
<view class="botwz">
|
||||
分成数量
|
||||
</view>
|
||||
</view>
|
||||
<view class="top">
|
||||
<view class="topwz">
|
||||
{{(Number(yunyingobj.bonus.amount) - Number(yunyingobj.bonusRefund.amount)).toFixed(2) == null ? '¥0.00' : '¥' + (Number(yunyingobj.bonus.amount) - Number(yunyingobj.bonusRefund.amount)).toFixed(2)}}
|
||||
</view>
|
||||
<view class="botwz">
|
||||
分成金额
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="top">
|
||||
<view class="topwz">
|
||||
3652
|
||||
</view>
|
||||
<view class="botwz">
|
||||
已退款
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<!-- <view class="zupibox">
|
||||
<view class="zupibox">
|
||||
<view class="zupi">
|
||||
<view class="one">
|
||||
<view class="onewz">
|
||||
租赁费
|
||||
骑行费
|
||||
</view>
|
||||
<view class="twowz">
|
||||
已支付:¥0.00
|
||||
</view>
|
||||
<view class="twowz">
|
||||
已退款:¥0.00
|
||||
¥{{yunyingobj.orderRiddingFee == null ? 0 : yunyingobj.orderRiddingFee}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="one">
|
||||
<view class="onewz">
|
||||
调度费(运营区外)
|
||||
调度费
|
||||
</view>
|
||||
<view class="twowz">
|
||||
已支付:¥0.00
|
||||
¥{{yunyingobj.orderDispatchFee == null ? 0 : yunyingobj.orderDispatchFee}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="one">
|
||||
<view class="onewz">
|
||||
管理费
|
||||
</view>
|
||||
<view class="twowz">
|
||||
已退款:¥0.00
|
||||
¥{{yunyingobj.orderManageFee == null ? 0 : yunyingobj.orderManageFee}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="zupi" style="margin-top: 30rpx;">
|
||||
<view class="one">
|
||||
<view class="onewz">
|
||||
预约费
|
||||
车损费
|
||||
</view>
|
||||
<view class="twowz">
|
||||
已支付:¥0.00
|
||||
</view>
|
||||
<view class="twowz">
|
||||
已退款:¥0.00
|
||||
¥{{yunyingobj.orderDeductionFee == null ? 0 : yunyingobj.orderDeductionFee}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="one">
|
||||
<view class="onewz">
|
||||
调度费(停车区外)
|
||||
自动退款
|
||||
</view>
|
||||
<view class="twowz">
|
||||
已支付:¥0.00
|
||||
¥{{yunyingobj.orderAutoRefundAmount == null ? 0 : yunyingobj.orderAutoRefundAmount}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="one">
|
||||
<view class="onewz">
|
||||
人工退款
|
||||
</view>
|
||||
<view class="twowz">
|
||||
已退款:¥0.00
|
||||
¥{{yunyingobj.orderAdminRefundAmount == null ? 0 : yunyingobj.orderAdminRefundAmount}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="cheliang">
|
||||
<view class="name">
|
||||
车辆概况
|
||||
</view>
|
||||
<view class="dabox">
|
||||
<view class="li">
|
||||
<view class="bfb">
|
||||
100%
|
||||
</view>
|
||||
<view class="cl">
|
||||
车辆健康率
|
||||
</view>
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="bfb">
|
||||
0%
|
||||
</view>
|
||||
<view class="cl">
|
||||
车辆亏电率
|
||||
</view>
|
||||
</view>
|
||||
<view class="li">
|
||||
<view class="bfb">
|
||||
3256
|
||||
</view>
|
||||
<view class="cl">
|
||||
可骑行车辆
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 运维类 -->
|
||||
|
@ -412,7 +370,8 @@
|
|||
yunyingobj:{},
|
||||
qbobj:{},
|
||||
infoobj:{},
|
||||
areaId:''
|
||||
areaId:'',
|
||||
waitDivideAmount:''
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
@ -442,7 +401,8 @@
|
|||
this.$u.get(`/getInfo`).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.infoobj = res.user
|
||||
this.successAmount = res.stat.withdraw.successAmount
|
||||
this.successAmount = res.stat.withdraw.successAmount == null ? 0 : res.stat.withdraw.successAmount
|
||||
this.waitDivideAmount = res.stat.bonus.waitDivideAmount == null ? 0 : res.stat.bonus.waitDivideAmount
|
||||
this.gettongji()
|
||||
this.getqb()
|
||||
}
|
||||
|
@ -450,8 +410,9 @@
|
|||
},
|
||||
// 请求全部运营统计数据
|
||||
getqb() {
|
||||
let StatKeys = 'order_user_count,order_count,order_pay_amount,order_refund_amount,bonus_count,bonus_amount,bonus_refund_amount,bonus_refund_amount,user_balance'
|
||||
this.$u.get(`/dashboard/stat?keys=${StatKeys}&dateRange=&bonusUserId=${this.infoobj.userId}&areaId=${this.areaId}`).then(res => {
|
||||
|
||||
let StatKeys = 'order_user_count,bonus_actual_amount,order_actual_amount,order_count'
|
||||
this.$u.get(`/dashboard/revenueStat?keys=${StatKeys}&dateRange=&userId=${this.infoobj.userId}&areaId=${this.areaId}`).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.qbobj = res.data
|
||||
}
|
||||
|
@ -459,8 +420,8 @@
|
|||
},
|
||||
// 请求筛选运营统计数据
|
||||
gettongji() {
|
||||
let StatKeys = 'order_user_count,order_count,order_pay_amount,order_refund_amount,bonus_count,bonus_amount,bonus_refund_amount,bonus_refund_amount,user_balance'
|
||||
this.$u.get(`/dashboard/stat?keys=${StatKeys}&dateRange=${this.kstime + ',' + this.jstime}&bonusUserId=${this.infoobj.userId}&areaId=${this.areaId}`).then(res => {
|
||||
let StatKeys = 'order_actual_amount,order_count,order_end_status_count,order_status_count,bonus_actual_amount,order_ridding_fee,order_deduction_fee,order_dispatch_fee,order_manage_fee,order_refund_amount'
|
||||
this.$u.get(`/dashboard/revenueStat?keys=${StatKeys}&dateRange=${this.kstime + ',' + this.jstime}&userId=${this.infoobj.userId}&areaId=${this.areaId}`).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.yunyingobj = res.data
|
||||
}
|
||||
|
@ -551,6 +512,30 @@
|
|||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.ordertj{
|
||||
width: 696rpx;
|
||||
max-height: 300rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 30rpx;
|
||||
margin: auto;
|
||||
margin-top: 30rpx;
|
||||
padding: 30rpx 34rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.one{
|
||||
text-align: center;
|
||||
.two{
|
||||
font-weight: 600;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.thr{
|
||||
margin-top: 10rpx;
|
||||
color: #808080;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
page {
|
||||
background: #F7F7F7;
|
||||
}
|
||||
|
@ -629,17 +614,20 @@
|
|||
}
|
||||
.zupibox{
|
||||
width: 630rpx;
|
||||
height: 360rpx;
|
||||
max-height: 360rpx;
|
||||
background: #F5FAFF;
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
margin: auto;
|
||||
margin-top: 44rpx;
|
||||
padding: 30rpx 40rpx;
|
||||
margin-top: 24rpx;
|
||||
padding: 30rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
.zupi{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
justify-content: center;
|
||||
.one{
|
||||
width: 33%;
|
||||
text-align: center;
|
||||
.onewz{
|
||||
font-size: 28rpx;
|
||||
color: #4297F3;
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
var xBlufi = require("@/components/blufi/xBlufi.js")
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
@ -133,7 +134,8 @@ export default {
|
|||
latitude:'',
|
||||
longitude:'',
|
||||
videoPath:'',
|
||||
|
||||
deviceid:'',
|
||||
devicename:''
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
|
@ -143,6 +145,8 @@ export default {
|
|||
this.getQiniuToken()
|
||||
this.getdingdan()
|
||||
this.getfeiyong()
|
||||
this.deviceid = e.deviceid
|
||||
this.devicename = e.devicename
|
||||
},
|
||||
onShow() {
|
||||
uni.getLocation({
|
||||
|
@ -197,8 +201,6 @@ export default {
|
|||
let str = JSON.parse(res.data)
|
||||
console.log(str.key)
|
||||
_this.videoUrl = 'https://api.ccttiot.com/' + str.key
|
||||
// console.log(_this.userImgs)
|
||||
// _this.imglist.push(_this.userImgs)
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -214,9 +216,6 @@ export default {
|
|||
}else{
|
||||
reason = 'DEVICE_FAULT'
|
||||
}
|
||||
// if(this.imglist.length > 0){
|
||||
// faultPicture = this.imglist.join(',')
|
||||
// }
|
||||
let data = {
|
||||
orderId:this.orderid,
|
||||
deviceSn:this.bikesn,
|
||||
|
@ -234,7 +233,15 @@ export default {
|
|||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "11close@"
|
||||
})
|
||||
setTimeout(()=>{
|
||||
xBlufi.notifyConnectBle({
|
||||
isStart: false,
|
||||
deviceId: this.deviceid,
|
||||
name: this.devicename
|
||||
})
|
||||
uni.navigateBack()
|
||||
},1000)
|
||||
}else{
|
||||
|
|
|
@ -134,7 +134,13 @@
|
|||
setTimeout(()=>{
|
||||
uni.navigateBack()
|
||||
},1500)
|
||||
}else{
|
||||
}else if(res.code == 500){
|
||||
uni.showToast({
|
||||
title: '未知错误,请联系管理员',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
} else{
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
|
|
|
@ -187,7 +187,16 @@
|
|||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
uni.getLocation({
|
||||
type: 'gcj02', // 国内地图更兼容
|
||||
isHighAccuracy: true,
|
||||
success: (res) => {
|
||||
console.log('精确坐标:', res);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('获取位置失败:', err);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 分享到好友(会话)
|
||||
onShareAppMessage: function() {
|
||||
|
|
|
@ -216,19 +216,33 @@
|
|||
findDeviceTimer: null,
|
||||
name: '',
|
||||
kefuflag:false,
|
||||
kefulist:[]
|
||||
kefulist:[],
|
||||
ljflag:true
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
xBlufi.initXBlufi(1)
|
||||
if (option.id) {
|
||||
this.cheflag = false
|
||||
}else{
|
||||
|
||||
}
|
||||
console.log(option);
|
||||
if(option.vate){
|
||||
this.ver_dataflag = 3
|
||||
this.devicesarr = option.vate
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
xBlufi.notifyStartDiscoverBle({
|
||||
'isStart': true
|
||||
})
|
||||
setTimeout(()=>{
|
||||
if(this.ver_dataflag == 3){
|
||||
console.log('11');
|
||||
}else{
|
||||
xBlufi.initXBlufi(1)
|
||||
xBlufi.notifyStartDiscoverBle({
|
||||
'isStart': true
|
||||
})
|
||||
}
|
||||
},500)
|
||||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
||||
setTimeout(() => {
|
||||
this.getorderdevice()
|
||||
|
@ -248,9 +262,6 @@
|
|||
onHide() {
|
||||
// 页面隐藏时清除定时器
|
||||
this.clearTimer();
|
||||
xBlufi.notifyStartDiscoverBle({
|
||||
'isStart': false
|
||||
})
|
||||
if (this.findDeviceTimer) {
|
||||
clearTimeout(this.findDeviceTimer)
|
||||
this.findDeviceTimer = null
|
||||
|
@ -260,9 +271,6 @@
|
|||
onUnload() {
|
||||
// 页面卸载时清除定时器(防止内存泄漏)
|
||||
this.clearTimer();
|
||||
xBlufi.notifyStartDiscoverBle({
|
||||
'isStart': false
|
||||
})
|
||||
if (this.findDeviceTimer) {
|
||||
clearTimeout(this.findDeviceTimer)
|
||||
this.findDeviceTimer = null
|
||||
|
@ -311,7 +319,15 @@
|
|||
if (res.code == 200) {
|
||||
if (res.data) {
|
||||
this.mac = res.data.deviceMac
|
||||
this.findDevice()
|
||||
if(this.ver_dataflag != 3){
|
||||
console.log('离线离线');
|
||||
setTimeout(()=>{
|
||||
if(this.ljflag == true){
|
||||
this.ljflag = false
|
||||
this.findDevice()
|
||||
}
|
||||
},1000)
|
||||
}
|
||||
this.cheflag = false
|
||||
this.orderAreaReturnVerify = res.data.orderAreaReturnVerify
|
||||
this.deivceobj = res.data
|
||||
|
@ -350,7 +366,6 @@
|
|||
switch (options.type) {
|
||||
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED:
|
||||
if (!options.result) {
|
||||
console.log('断开');
|
||||
this.ver_dataflag = 1
|
||||
console.log(this.ver_dataflag,'断开断开');
|
||||
}
|
||||
|
@ -365,6 +380,7 @@
|
|||
if (options.result == true) {
|
||||
setTimeout(() => {
|
||||
this.ver_dataflag = 3
|
||||
this.ljflag = true
|
||||
}, 2000)
|
||||
xBlufi.notifyInitBleEsp32({
|
||||
deviceId: this.deviceid
|
||||
|
@ -406,6 +422,7 @@
|
|||
that.deivceobj.deviceLockStatus = 1
|
||||
that.getorderdevice()
|
||||
} else if (res.code == 20001) {
|
||||
console.log(that.ver_dataflag,'thatthat');
|
||||
if (that.ver_dataflag == 3) {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "11open@"
|
||||
|
@ -460,7 +477,8 @@
|
|||
that.deivceobj.deviceLockStatus = 0
|
||||
that.getorderdevice()
|
||||
} else if (res.code == 20001) {
|
||||
if (this.ver_dataflag == 3) {
|
||||
console.log(that.ver_dataflag,'thatthat');
|
||||
if (that.ver_dataflag == 3) {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "11close@"
|
||||
})
|
||||
|
@ -489,7 +507,6 @@
|
|||
},
|
||||
// 点击鸣笛寻车
|
||||
btnfm() {
|
||||
|
||||
this.$u.put(`/app/device/iot/ring?id=${this.deivceobj.deviceId}`).then((res) => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
|
@ -520,9 +537,23 @@
|
|||
},
|
||||
// 点击去进行换车
|
||||
btnghbike() {
|
||||
uni.navigateTo({
|
||||
url: '/page_user/huanbike?sn=' + this.deivceobj.deviceSn + '&orderid=' + this.deivceobj.orderId
|
||||
})
|
||||
if(this.deivceobj.deviceOnlineStatus == 0){
|
||||
if(this.ver_dataflag == 3){
|
||||
uni.navigateTo({
|
||||
url: '/page_user/huanbike?sn=' + this.deivceobj.deviceSn + '&orderid=' + this.deivceobj.orderId + '&deviceid=' + this.deviceid + '&devicename=' + this.devicename
|
||||
})
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: "设备离线,暂不支持换车",
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
}else{
|
||||
uni.navigateTo({
|
||||
url: '/page_user/huanbike?sn=' + this.deivceobj.deviceSn + '&orderid=' + this.deivceobj.orderId + '&deviceid=' + this.deviceid + '&devicename=' + this.devicename
|
||||
})
|
||||
}
|
||||
},
|
||||
// 每过一分钟去请求车辆最新状态
|
||||
executeTask() {
|
||||
|
@ -549,19 +580,25 @@
|
|||
url: '/page_user/hcshenhe?sn=' + this.deivceobj.deviceSn + '&orderid=' + this.deivceobj.orderId + '&orderAreaId=' + this.deivceobj.orderAreaId
|
||||
})
|
||||
} else {
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
this.lat = res.latitude
|
||||
this.lon = res.longitude
|
||||
this.getfeiyong()
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('获取位置失败:', err)
|
||||
this.getfeiyong()
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '还车中...',
|
||||
mask: true
|
||||
})
|
||||
uni.getLocation({
|
||||
type: 'gcj02', // 国内地图更兼容
|
||||
isHighAccuracy: true,
|
||||
success: (res) => {
|
||||
console.log('精确坐标:', res);
|
||||
this.lat = res.latitude;
|
||||
this.lon = res.longitude;
|
||||
this.getfeiyong();
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('获取位置失败:', err);
|
||||
uni.showToast({ title: '定位失败,请重试', icon: 'none' });
|
||||
this.getfeiyong(); // 降级处理
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -569,8 +606,8 @@
|
|||
getfeiyong() {
|
||||
let data = {
|
||||
orderId: this.deivceobj.orderId,
|
||||
lon: this.lat,
|
||||
lat: this.lon,
|
||||
lon: this.lon,
|
||||
lat: this.lat,
|
||||
checkLocation:true
|
||||
}
|
||||
this.$u.post(`/app/order/calcFee`, data).then(res => {
|
||||
|
@ -578,10 +615,12 @@
|
|||
this.fajinobj = res.data
|
||||
if (res.data.manageFee > 0 || res.data.dispatchFee > 0) {
|
||||
this.fjflag = true
|
||||
uni.hideLoading()
|
||||
} else {
|
||||
this.gethuan()
|
||||
}
|
||||
}else{
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
|
@ -620,47 +659,129 @@
|
|||
},
|
||||
// 还车统一调用
|
||||
gethuan() {
|
||||
let that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定要还车吗?',
|
||||
showCancel: true,
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
let data = {
|
||||
orderId: that.deivceobj.orderId,
|
||||
picture: that.imgs,
|
||||
lon: that.lon,
|
||||
lat: that.lat
|
||||
if(this.deivceobj.deviceOnlineStatus == 0){
|
||||
if(this.ver_dataflag != 3){
|
||||
uni.showToast({
|
||||
title: '设备离线',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
}else{
|
||||
let that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定要还车吗?',
|
||||
showCancel: true,
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
let data = {
|
||||
orderId: that.deivceobj.orderId,
|
||||
picture: that.imgs,
|
||||
lon: that.lon,
|
||||
lat: that.lat
|
||||
}
|
||||
that.$u.put(`/app/order/end`, data).then(res => {
|
||||
if (res.code == 200) {
|
||||
if(res.data.iot == true){
|
||||
that.cheflag = true
|
||||
that.fjflag = false
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '还车成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
setTimeout(()=>{
|
||||
that.getorderdevice()
|
||||
},1000)
|
||||
}else{
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "11close@"
|
||||
})
|
||||
setTimeout(()=>{
|
||||
that.getorderdevice()
|
||||
},1000)
|
||||
}
|
||||
}else if(res.msg == null) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '未知错误',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
|
||||
}
|
||||
}
|
||||
that.$u.put(`/app/order/end`, data).then(res => {
|
||||
if (res.code == 200) {
|
||||
if(res.data.iot == true){
|
||||
that.cheflag = true
|
||||
that.fjflag = false
|
||||
})
|
||||
}
|
||||
}else{
|
||||
let that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定要还车吗?',
|
||||
showCancel: true,
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
let data = {
|
||||
orderId: that.deivceobj.orderId,
|
||||
picture: that.imgs,
|
||||
lon: that.lon,
|
||||
lat: that.lat
|
||||
}
|
||||
that.$u.put(`/app/order/end`, data).then(res => {
|
||||
if (res.code == 200) {
|
||||
if(res.data.iot == true){
|
||||
that.cheflag = true
|
||||
that.fjflag = false
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '还车成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
setTimeout(()=>{
|
||||
that.getorderdevice()
|
||||
},1000)
|
||||
}else{
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "11close@"
|
||||
})
|
||||
setTimeout(()=>{
|
||||
that.getorderdevice()
|
||||
},1000)
|
||||
}
|
||||
}else if(res.msg == null) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '还车成功',
|
||||
icon: 'success',
|
||||
title: '未知错误',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}else{
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "11close@"
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
// 点击跳转到最近停车点
|
||||
btntcd() {
|
||||
|
@ -674,106 +795,6 @@
|
|||
url: '/page_fenbao/storedlist/xuzubike'
|
||||
})
|
||||
},
|
||||
// 点击启动and关闭
|
||||
btnqd() {
|
||||
if (this.deivceobj.deviceLockStatus == 0) {
|
||||
let that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您是否要解锁车辆?',
|
||||
showCancel: true,
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
that.$u.put(`/app/order/openDevice?orderId=${that.deivceobj.orderId}`).then((res) => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: '解锁成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
that.deivceobj.deviceLockStatus = 1
|
||||
that.getorderdevice()
|
||||
} else if (res.code == 20001) {
|
||||
if (that.ver_dataflag == 3) {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "11open@"
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '设备离线',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('取消'); // 用户点击取消
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if (this.deivceobj.deviceLockStatus == 1) {
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
this.lat = res.latitude
|
||||
this.lon = res.longitude
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('获取位置失败:', err)
|
||||
}
|
||||
})
|
||||
let that = this
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您是否要临时锁车?',
|
||||
showCancel: true,
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
that.$u.put(`/app/order/closeDevice?orderId=${that.deivceobj.orderId}&lat=${that.lat}&lon=${that.lon}`).then((res) => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: '临时锁车成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
that.deivceobj.deviceLockStatus = 0
|
||||
that.getorderdevice()
|
||||
} else if (res.code == 20001) {
|
||||
if (this.ver_dataflag == 3) {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "11close@"
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '设备离线',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('取消'); // 用户点击取消
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
// 点击按钮跳转到订单详情
|
||||
btndd() {
|
||||
uni.navigateTo({
|
||||
|
|
|
@ -591,7 +591,8 @@
|
|||
})
|
||||
} else {
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
type: 'gcj02', // 国内地图更兼容
|
||||
isHighAccuracy: true,
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
this.latsc = res.latitude
|
||||
|
@ -609,8 +610,8 @@
|
|||
getfeiyong() {
|
||||
let data = {
|
||||
orderId: this.orderobj.orderId,
|
||||
lon: this.latsc,
|
||||
lat: this.lonsc,
|
||||
lon: this.lonsc,
|
||||
lat: this.latsc,
|
||||
checkLocation:true
|
||||
}
|
||||
this.$u.post(`/app/order/calcFee`, data).then(res => {
|
||||
|
|
36
uni_modules/ksp-cropper/changelog.md
Normal file
36
uni_modules/ksp-cropper/changelog.md
Normal file
|
@ -0,0 +1,36 @@
|
|||
## 1.1.13(2023-10-26)
|
||||
优化图片初始化逻辑
|
||||
修护已知bug
|
||||
## 1.1.12(2023-06-27)
|
||||
修护vue3小程序下报错的bug
|
||||
## 1.1.11(2023-05-29)
|
||||
修护了在vue3下报错的bug
|
||||
## 1.1.10(2023-05-26)
|
||||
修改了已知bug
|
||||
暂时取消了vue3的支持
|
||||
## 1.1.9(2023-03-24)
|
||||
修护bug
|
||||
## 1.1.8(2023-03-24)
|
||||
修护bug
|
||||
## 1.1.7(2022-12-08)
|
||||
修护bug
|
||||
## 1.1.6(2022-11-18)
|
||||
修好app无法拖动问题
|
||||
## 1.1.5(2022-06-14)
|
||||
填新版HBuilderX的坑,简单测试是没问题了。
|
||||
## 1.1.4(2022-02-15)
|
||||
修护ios下微信小程序第一次裁剪的bug
|
||||
## 1.1.3(2022-02-10)
|
||||
修护APP点击无效的bug
|
||||
## 1.1.2(2022-01-24)
|
||||
优化一些细节
|
||||
## 1.1.1(2022-01-19)
|
||||
更新示例项目
|
||||
## 1.1.0(2022-01-18)
|
||||
新增旋转功能
|
||||
## 1.0.2(2022-01-13)
|
||||
修护mode="fixed"模式无效的bug
|
||||
## 1.0.1(2021-12-20)
|
||||
修护IOS下,小程序点击没反应的bug
|
||||
## 1.0.0(2021-12-06)
|
||||
图片裁剪工具
|
1004
uni_modules/ksp-cropper/components/ksp-cropper/ksp-cropper.vue
Normal file
1004
uni_modules/ksp-cropper/components/ksp-cropper/ksp-cropper.vue
Normal file
File diff suppressed because it is too large
Load Diff
81
uni_modules/ksp-cropper/package.json
Normal file
81
uni_modules/ksp-cropper/package.json
Normal file
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
"id": "ksp-cropper",
|
||||
"displayName": "ksp-cropper",
|
||||
"version": "1.1.13",
|
||||
"description": "高性能图片裁剪工具",
|
||||
"keywords": [
|
||||
"头像",
|
||||
"图片",
|
||||
"裁剪"
|
||||
],
|
||||
"repository": "",
|
||||
"engines": {
|
||||
"HBuilderX": "^3.1.0"
|
||||
},
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "插件不采集任何数据",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "y"
|
||||
},
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"app-nvue": "u"
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "y",
|
||||
"Android Browser": "y",
|
||||
"微信浏览器(Android)": "y",
|
||||
"QQ浏览器(Android)": "y"
|
||||
},
|
||||
"H5-pc": {
|
||||
"Chrome": "u",
|
||||
"IE": "u",
|
||||
"Edge": "u",
|
||||
"Firefox": "u",
|
||||
"Safari": "u"
|
||||
},
|
||||
"小程序": {
|
||||
"微信": {
|
||||
"minVersion": "2.9.0"
|
||||
},
|
||||
"阿里": "n",
|
||||
"百度": "n",
|
||||
"字节跳动": "n",
|
||||
"QQ": "u"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
78
uni_modules/ksp-cropper/readme.md
Normal file
78
uni_modules/ksp-cropper/readme.md
Normal file
|
@ -0,0 +1,78 @@
|
|||
# ksp-cropper
|
||||
|
||||
## 高性能图片裁剪工具
|
||||
|
||||
### 属性说明
|
||||
|属性 |类型 |默认 |备注 |
|
||||
| :--------: | :-----: | :----: | :----: |
|
||||
| url |String | "" | 需要裁剪的图片路径,为空时控件隐藏,不为空时控件显示|
|
||||
| mode |String | "free" | 裁剪模式|
|
||||
| width |Number | 200 | 图片裁剪后的宽度,固定大小时有效|
|
||||
| height |Number | 200 | 图片裁剪后的高度,固定大小时有效|
|
||||
| maxWidth |Number | 1024 | 图片裁剪后的最大宽度 |
|
||||
| maxHeight |Number | 1024 | 图片裁剪后的最大高度 |
|
||||
|
||||
### mode有效值
|
||||
|
||||
| 模式 |值 |说明 |
|
||||
| :-----: | :-----: | :----: |
|
||||
| 固定模式 |fixed | 裁剪出指定大小的图片,一般用于头像上传 |
|
||||
| 等比缩放 |ratio | 限定宽高比,裁剪大小不固定 |
|
||||
| 自由模式 |free | 不限定宽高比,裁剪大小不固定 |
|
||||
|
||||
### 事件说明
|
||||
|事件名称 |说明 |返回 |
|
||||
| :--------: | :-----: | :----: |
|
||||
| ok |点击确定按钮 | e:{path} |
|
||||
| cancel |点击取消按钮 | - |
|
||||
|
||||
|
||||
### 示例
|
||||
|
||||
```html
|
||||
|
||||
<template>
|
||||
<view>
|
||||
<button @click="select">选择图片</button>
|
||||
<image mode="widthFix" :src="path"/>
|
||||
<ksp-cropper mode="free" :width="200" :height="140" :maxWidth="1024" :maxHeight="1024" :url="url" @cancel="oncancel" @ok="onok"></ksp-cropper>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
url: "",
|
||||
path: ""
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
},
|
||||
methods: {
|
||||
select() {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
success: (rst) => {
|
||||
// 设置url的值,显示控件
|
||||
this.url = rst.tempFilePaths[0];
|
||||
}
|
||||
});
|
||||
},
|
||||
onok(ev) {
|
||||
this.url = "";
|
||||
this.path = ev.path;
|
||||
},
|
||||
oncancel() {
|
||||
// url设置为空,隐藏控件
|
||||
this.url = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
### 注意
|
||||
1.微信小程序从基础库 2.21.0 开始, wx.chooseImage 停止维护,请使用 uni.chooseMedia 代替。<br/>
|
||||
2.微信小程序真机调试会报错,但正常运行是不会有问题的。<br/>
|
||||
3.uni-app版本不断更新,插件有时无法适应新版本,感谢大家及时提交bug,但希望大家手下留情,不要轻易给差评。
|
Loading…
Reference in New Issue
Block a user