feat: 添加归还成功页面及相关功能
在 `pages.json` 中新增归还成功页面的配置,并在 `order/success.vue` 中实现设备状态提示和加载动画。同时,更新了订单支付逻辑,确保在支付成功后能够正确弹出充电宝。优化了订单状态查询和处理逻辑,提升用户体验。
This commit is contained in:
@@ -56,9 +56,11 @@ export const createOrder = (data) => {
|
|||||||
|
|
||||||
//查询订单
|
//查询订单
|
||||||
export const queryById = (id) => {
|
export const queryById = (id) => {
|
||||||
|
console.log(`查询订单详情, orderId: ${id}`)
|
||||||
return request({
|
return request({
|
||||||
url: `/app/order/${id}`,
|
url: `/app/order/${id}`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
hideLoading: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,6 +93,23 @@ export const rentPowerBank = (deviceNo, phone) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//确认支付并弹出充电宝
|
||||||
|
export const confirmPaymentAndRent = (orderId) => {
|
||||||
|
console.log(`确认支付并弹出充电宝, orderId: ${orderId}`)
|
||||||
|
return request({
|
||||||
|
url: `/app/device/confirmPaymentAndRent?orderId=${orderId}`,
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//备用方法:直接发送租借指令
|
||||||
|
export const sendRentCommand = (orderId) => {
|
||||||
|
console.log(`直接发送租借指令, orderId: ${orderId}`)
|
||||||
|
return request({
|
||||||
|
url: `/app/device/sendRentCommand?orderId=${orderId}`,
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
//投诉反馈
|
//投诉反馈
|
||||||
export const addUserFeedback = (data) => {
|
export const addUserFeedback = (data) => {
|
||||||
@@ -100,3 +119,12 @@ export const addUserFeedback = (data) => {
|
|||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//强制打开空格子
|
||||||
|
export const forcefOpenEmptyGrid = (deviceNo) => {
|
||||||
|
console.log(`强制打开空格子, deviceNo: ${deviceNo}`)
|
||||||
|
return request({
|
||||||
|
url: `/app/device/forcef/${deviceNo}`,
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -76,6 +76,14 @@
|
|||||||
"navigationBarBackgroundColor": "#ffffff",
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
"navigationBarTextStyle": "black"
|
"navigationBarTextStyle": "black"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/order/return-success",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "归还成功",
|
||||||
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
|
"navigationBarTextStyle": "black"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
|
|||||||
+17
-4
@@ -48,7 +48,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getQueryString }from '@/util/index.js'
|
import {getQueryString, wxLogin }from '@/util/index.js'
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
async handleScan() {
|
async handleScan() {
|
||||||
@@ -64,6 +64,19 @@
|
|||||||
console.log('扫码路径:', scanResult.path)
|
console.log('扫码路径:', scanResult.path)
|
||||||
console.log('解析到的设备号:', deviceNo)
|
console.log('解析到的设备号:', deviceNo)
|
||||||
|
|
||||||
|
if (!deviceNo) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '无效的设备二维码',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 直接在当前页面查询是否有使用中的订单,避免跳转到中间页面
|
||||||
|
if (!uni.getStorageSync('token')) {
|
||||||
|
await wxLogin()
|
||||||
|
}
|
||||||
|
|
||||||
// 检查是否有使用中的订单
|
// 检查是否有使用中的订单
|
||||||
const inUseRes = await uni.request({
|
const inUseRes = await uni.request({
|
||||||
url: `${uni.getStorageSync('baseUrl') || 'http://127.0.0.1:8080'}/app/order/inUse`,
|
url: `${uni.getStorageSync('baseUrl') || 'http://127.0.0.1:8080'}/app/order/inUse`,
|
||||||
@@ -109,10 +122,10 @@
|
|||||||
url: `/pages/order/payment?orderId=${unpaidOrder.orderId}`
|
url: `/pages/order/payment?orderId=${unpaidOrder.orderId}`
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// 无待支付订单,正常跳转到设备检查页面
|
// 查询设备信息并直接跳转到设备详情页面
|
||||||
console.log('无待支付订单,跳转到设备检查页面, deviceNo:', deviceNo)
|
console.log('无待支付订单,直接跳转到设备详情页面, deviceNo:', deviceNo)
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/serve/bagCheck/index?deviceNo=${deviceNo}`
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
+29
-10
@@ -73,14 +73,22 @@ export default {
|
|||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
// 将获取到的订单添加到列表中
|
// 将获取到的订单添加到列表中
|
||||||
const orderData = res.data;
|
const orderData = res.data;
|
||||||
|
console.log('特定订单数据:', JSON.stringify(orderData));
|
||||||
|
console.log('特定订单的开始时间:', orderData.startTime);
|
||||||
|
console.log('特定订单的创建时间:', orderData.createTime);
|
||||||
|
|
||||||
|
// 使用实际的startTime字段,如果没有则尝试使用createTime
|
||||||
|
const orderStartTime = orderData.startTime || orderData.createTime || '';
|
||||||
|
console.log('特定订单最终显示的开始时间:', orderStartTime);
|
||||||
|
|
||||||
// 格式化订单数据
|
// 格式化订单数据
|
||||||
const formattedOrder = {
|
const formattedOrder = {
|
||||||
orderNo: orderData.orderId,
|
orderNo: orderData.orderId,
|
||||||
status: orderData.orderStatus,
|
status: orderData.orderStatus,
|
||||||
deviceId: orderData.deviceNo,
|
deviceId: orderData.deviceNo,
|
||||||
startTime: orderData.createTime,
|
startTime: orderStartTime,
|
||||||
endTime: orderData.endTime || '',
|
endTime: orderData.endTime || '',
|
||||||
amount: orderData.amount || '0.00'
|
amount: orderData.payAmount || orderData.actualDeviceAmount || '0.00'
|
||||||
};
|
};
|
||||||
|
|
||||||
// 将订单添加到列表开头
|
// 将订单添加到列表开头
|
||||||
@@ -107,15 +115,26 @@ export default {
|
|||||||
try {
|
try {
|
||||||
const res = await getOrderList(statusList);
|
const res = await getOrderList(statusList);
|
||||||
if (res.code === 200 && res.data && res.data.records) {
|
if (res.code === 200 && res.data && res.data.records) {
|
||||||
|
console.log('API返回的订单列表数据:', JSON.stringify(res.data.records));
|
||||||
|
|
||||||
// 处理订单列表数据
|
// 处理订单列表数据
|
||||||
this.orderList = res.data.records.map(item => ({
|
this.orderList = res.data.records.map(item => {
|
||||||
orderNo: item.orderId,
|
console.log(`订单 ${item.orderId} 的开始时间:`, item.startTime);
|
||||||
status: item.orderStatus,
|
console.log(`订单 ${item.orderId} 的创建时间:`, item.createTime);
|
||||||
deviceId: item.deviceNo,
|
|
||||||
startTime: item.createTime,
|
// 使用实际的startTime字段,如果没有则尝试使用createTime
|
||||||
endTime: item.endTime || '',
|
const orderStartTime = item.startTime || item.createTime || '';
|
||||||
amount: item.amount || '0.00'
|
console.log(`订单 ${item.orderId} 最终显示的开始时间:`, orderStartTime);
|
||||||
}));
|
|
||||||
|
return {
|
||||||
|
orderNo: item.orderId,
|
||||||
|
status: item.orderStatus,
|
||||||
|
deviceId: item.deviceNo,
|
||||||
|
startTime: orderStartTime,
|
||||||
|
endTime: item.endTime || '',
|
||||||
|
amount: item.payAmount || item.actualDeviceAmount || '0.00'
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取订单列表失败:', error);
|
console.error('获取订单列表失败:', error);
|
||||||
|
|||||||
+95
-104
@@ -203,26 +203,69 @@ export default {
|
|||||||
title: '处理中'
|
title: '处理中'
|
||||||
})
|
})
|
||||||
|
|
||||||
// 调用后端创建微信支付订单接口
|
console.log('开始处理支付,订单号:', this.orderId)
|
||||||
|
|
||||||
|
// 调用后端支付API
|
||||||
const res = await uni.request({
|
const res = await uni.request({
|
||||||
url: `${uni.getStorageSync('baseUrl') || 'http://127.0.0.1:8080'}/app/wx-payment/create/${this.orderInfo.orderNo}`,
|
url: `${uni.getStorageSync('baseUrl') || 'http://127.0.0.1:8080'}/app/payment/${this.orderInfo.orderNo}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
header: {
|
header: {
|
||||||
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
'Authorization': 'Bearer ' + uni.getStorageSync('token'),
|
||||||
'Clientid': uni.getStorageSync('client_id')
|
'Clientid': uni.getStorageSync('client_id')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
console.log('支付API返回结果:', res.data)
|
||||||
|
|
||||||
if (res.statusCode === 200 && res.data.code === 200) {
|
if (res.statusCode === 200 && res.data.code === 200) {
|
||||||
// 支付成功,跳转到支付成功页面
|
// 获取微信支付所需参数
|
||||||
uni.hideLoading()
|
const payParams = res.data.data
|
||||||
uni.redirectTo({
|
|
||||||
url: `/pages/order/success?orderId=${this.orderId}`
|
console.log('准备调用微信支付,参数:', payParams)
|
||||||
|
|
||||||
|
// 验证支付参数是否完整
|
||||||
|
if (!payParams.timeStamp || !payParams.nonceStr ||
|
||||||
|
!payParams.packageValue || !payParams.paySign) {
|
||||||
|
console.error('支付参数不完整:', payParams)
|
||||||
|
throw new Error('支付参数不完整,请联系客服')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用微信支付API
|
||||||
|
uni.requestPayment({
|
||||||
|
provider: 'wxpay',
|
||||||
|
timeStamp: payParams.timeStamp,
|
||||||
|
nonceStr: payParams.nonceStr,
|
||||||
|
package: payParams.packageValue, // 后端返回的是packageValue字段
|
||||||
|
signType: payParams.signType || 'MD5',
|
||||||
|
paySign: payParams.paySign,
|
||||||
|
success: (payRes) => {
|
||||||
|
console.log('支付成功:', payRes)
|
||||||
|
uni.hideLoading()
|
||||||
|
// 支付成功后开始轮询订单状态
|
||||||
|
this.pollOrderStatus()
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('支付失败:', err)
|
||||||
|
uni.hideLoading()
|
||||||
|
// 用户取消支付的情况,不显示错误提示
|
||||||
|
if (err.errMsg === 'requestPayment:fail cancel') {
|
||||||
|
console.log('用户取消了支付')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
uni.showToast({
|
||||||
|
title: err.errMsg || '支付失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
complete: () => {
|
||||||
|
console.log('支付流程结束')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
throw new Error(res.data.msg || '支付失败')
|
throw new Error(res.data?.msg || '支付请求失败')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('支付处理错误:', error)
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: error.message || '支付失败',
|
title: error.message || '支付失败',
|
||||||
@@ -231,105 +274,32 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 发送租借指令
|
|
||||||
async sendRentCommand() {
|
|
||||||
try {
|
|
||||||
uni.showLoading({
|
|
||||||
title: '处理中'
|
|
||||||
})
|
|
||||||
|
|
||||||
// 调用发送租借指令的接口
|
|
||||||
const res = await this.sendRentRequest()
|
|
||||||
|
|
||||||
if (res.code === 200) {
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: '租借成功',
|
|
||||||
icon: 'success'
|
|
||||||
})
|
|
||||||
|
|
||||||
// 跳转到订单列表页面
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: `/pages/order/index?orderId=${this.orderId}`
|
|
||||||
})
|
|
||||||
}, 1500)
|
|
||||||
} else {
|
|
||||||
throw new Error(res.msg || '租借失败')
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: error.message || '租借失败',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 发送租借请求
|
|
||||||
sendRentRequest() {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
uni.request({
|
|
||||||
url: `${uni.getStorageSync('baseUrl') || 'http://127.0.0.1:8080'}/app/device/sendRentCommand`,
|
|
||||||
method: 'POST',
|
|
||||||
data: {
|
|
||||||
orderId: this.orderId
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
|
||||||
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
|
||||||
'Clientid': uni.getStorageSync('client_id')
|
|
||||||
},
|
|
||||||
success(res) {
|
|
||||||
if (res.statusCode === 200) {
|
|
||||||
resolve(res.data)
|
|
||||||
} else {
|
|
||||||
reject(new Error('请求失败'))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail(err) {
|
|
||||||
reject(err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 格式化时间
|
|
||||||
formatTime(date) {
|
|
||||||
const year = date.getFullYear()
|
|
||||||
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
|
||||||
const day = date.getDate().toString().padStart(2, '0')
|
|
||||||
const hour = date.getHours().toString().padStart(2, '0')
|
|
||||||
const minute = date.getMinutes().toString().padStart(2, '0')
|
|
||||||
|
|
||||||
return `${year}-${month}-${day} ${hour}:${minute}`
|
|
||||||
},
|
|
||||||
|
|
||||||
// 轮询订单状态
|
// 轮询订单状态
|
||||||
async pollOrderStatus() {
|
async pollOrderStatus() {
|
||||||
let retryCount = 0;
|
let retryCount = 0;
|
||||||
const maxRetries = 10;
|
const maxRetries = 30; // 增加最大重试次数,允许更长时间检测
|
||||||
const interval = 1000; // 1秒间隔
|
const interval = 2000; // 调整为2秒间隔
|
||||||
|
|
||||||
const checkStatus = async () => {
|
const checkStatus = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await uni.request({
|
// 使用queryById方法直接查询订单状态
|
||||||
url: `${uni.getStorageSync('baseUrl') || 'http://127.0.0.1:8080'}/app/payment/status/${this.orderInfo.orderNo}`,
|
const res = await queryById(this.orderId);
|
||||||
method: 'GET',
|
console.log('轮询订单状态结果:', res);
|
||||||
header: {
|
|
||||||
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
|
||||||
'Clientid': uni.getStorageSync('client_id')
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (res.statusCode === 200 && res.data.code === 200) {
|
if (res.code === 200 && res.data) {
|
||||||
const orderData = res.data.data;
|
const orderData = res.data;
|
||||||
if (orderData.orderStatus === 'IN_USED') {
|
// 检查订单是否已支付成功
|
||||||
// 支付成功,订单已开始使用
|
if (orderData.orderStatus === 'IN_USED' ||
|
||||||
|
orderData.orderStatus === 'PAYMENT_SUCCESSFUL') {
|
||||||
|
console.log('支付成功,订单状态:', orderData.orderStatus);
|
||||||
|
// 显示弹出充电宝的提示
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '支付成功',
|
title: '支付成功,充电宝已弹出',
|
||||||
icon: 'success'
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 延迟跳转到支付成功页面
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pages/order/success?orderId=${this.orderId}`
|
url: `/pages/order/success?orderId=${this.orderId}`
|
||||||
@@ -341,18 +311,39 @@ export default {
|
|||||||
|
|
||||||
if (retryCount < maxRetries) {
|
if (retryCount < maxRetries) {
|
||||||
retryCount++;
|
retryCount++;
|
||||||
|
console.log(`第${retryCount}次轮询,等待订单状态更新...`);
|
||||||
setTimeout(checkStatus, interval);
|
setTimeout(checkStatus, interval);
|
||||||
} else {
|
} else {
|
||||||
throw new Error('订单状态查询超时');
|
console.error('轮询订单状态超时');
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '订单状态查询超时,请在"我的订单"中查看订单状态',
|
||||||
|
showCancel: false,
|
||||||
|
success: function(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/order/index'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.showToast({
|
console.error('查询订单状态失败:', error);
|
||||||
title: error.message || '查询订单状态失败',
|
// 出错时继续轮询,不要中断
|
||||||
icon: 'none'
|
if (retryCount < maxRetries) {
|
||||||
});
|
retryCount++;
|
||||||
|
setTimeout(checkStatus, interval);
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '查询订单状态失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 开始轮询
|
||||||
checkStatus();
|
checkStatus();
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,298 @@
|
|||||||
|
<template>
|
||||||
|
<view class="success-container">
|
||||||
|
<!-- 支付成功状态 -->
|
||||||
|
<view class="status-card">
|
||||||
|
<view class="status-icon success"></view>
|
||||||
|
<view class="status-text">归还成功</view>
|
||||||
|
<view class="status-desc">您的充电宝已归还,押金已退回</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 订单信息 -->
|
||||||
|
<view class="order-card">
|
||||||
|
<view class="card-title">订单信息</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">订单号</text>
|
||||||
|
<text class="value">{{ orderInfo.orderNo || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">设备号</text>
|
||||||
|
<text class="value">{{ orderInfo.deviceNo || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">使用时长</text>
|
||||||
|
<text class="value">{{ orderInfo.usedTime || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">费用</text>
|
||||||
|
<text class="value">¥{{ orderInfo.currentFee || '0.00' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">归还时间</text>
|
||||||
|
<text class="value">{{ orderInfo.endTime || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 退还信息 -->
|
||||||
|
<view class="refund-card">
|
||||||
|
<view class="card-title">退还信息</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">押金</text>
|
||||||
|
<text class="value">¥{{ orderInfo.deposit || '99.00' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">退还金额</text>
|
||||||
|
<text class="value highlight">¥{{ orderInfo.refundAmount || '99.00' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">退还状态</text>
|
||||||
|
<text class="value success">已退还</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 操作按钮 -->
|
||||||
|
<view class="button-group">
|
||||||
|
<button class="primary-btn" @click="goToHome">返回首页</button>
|
||||||
|
<button class="secondary-btn" @click="goToOrderList">查看订单</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { queryById } from '@/config/user.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
orderId: '',
|
||||||
|
orderInfo: {
|
||||||
|
orderNo: '',
|
||||||
|
deviceNo: '',
|
||||||
|
startTime: '',
|
||||||
|
usedTime: '',
|
||||||
|
currentFee: '0.00',
|
||||||
|
deposit: '99.00',
|
||||||
|
refundAmount: '99.00',
|
||||||
|
endTime: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(options) {
|
||||||
|
if (options && options.orderId) {
|
||||||
|
this.orderId = options.orderId
|
||||||
|
this.loadOrderInfo()
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '订单信息不存在',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
this.goToHome()
|
||||||
|
}, 1500)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async loadOrderInfo() {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中'
|
||||||
|
})
|
||||||
|
|
||||||
|
const res = await queryById(this.orderId)
|
||||||
|
console.log('归还成功页面获取的订单数据:', JSON.stringify(res.data))
|
||||||
|
|
||||||
|
if (res.code === 200 && res.data) {
|
||||||
|
const orderData = res.data
|
||||||
|
console.log('订单的开始时间:', orderData.startTime)
|
||||||
|
console.log('订单的创建时间:', orderData.createTime)
|
||||||
|
|
||||||
|
// 计算退还金额 (押金 - 费用)
|
||||||
|
const deposit = 99.00
|
||||||
|
const fee = parseFloat(orderData.currentFee || orderData.actualDeviceAmount || orderData.payAmount || '0')
|
||||||
|
const refundAmount = (deposit - fee).toFixed(2)
|
||||||
|
|
||||||
|
this.orderInfo = {
|
||||||
|
orderNo: orderData.orderNo || orderData.orderId,
|
||||||
|
deviceNo: orderData.deviceNo,
|
||||||
|
startTime: orderData.startTime || orderData.createTime || '-',
|
||||||
|
usedTime: orderData.usedTime || '-',
|
||||||
|
currentFee: orderData.currentFee || orderData.actualDeviceAmount || orderData.payAmount || '0.00',
|
||||||
|
deposit: deposit.toFixed(2),
|
||||||
|
refundAmount: refundAmount,
|
||||||
|
endTime: orderData.endTime || this.formatTime(new Date())
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('处理后的订单信息:', JSON.stringify(this.orderInfo))
|
||||||
|
} else {
|
||||||
|
throw new Error('获取订单信息失败')
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.hideLoading()
|
||||||
|
} catch (error) {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: error.message || '获取订单信息失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
formatTime(date) {
|
||||||
|
const year = date.getFullYear()
|
||||||
|
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
||||||
|
const day = date.getDate().toString().padStart(2, '0')
|
||||||
|
const hour = date.getHours().toString().padStart(2, '0')
|
||||||
|
const minute = date.getMinutes().toString().padStart(2, '0')
|
||||||
|
const second = date.getSeconds().toString().padStart(2, '0')
|
||||||
|
return `${year}-${month}-${day} ${hour}:${minute}:${second}`
|
||||||
|
},
|
||||||
|
|
||||||
|
goToHome() {
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
goToOrderList() {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/order/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.success-container {
|
||||||
|
padding: 20px;
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 30px;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.04);
|
||||||
|
|
||||||
|
.status-icon {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
margin: 0 auto 16px;
|
||||||
|
|
||||||
|
&.success {
|
||||||
|
background-color: #07c160;
|
||||||
|
border-radius: 50%;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
width: 30px;
|
||||||
|
height: 20px;
|
||||||
|
border: 3px solid #fff;
|
||||||
|
border-top: none;
|
||||||
|
border-right: none;
|
||||||
|
transform-origin: center;
|
||||||
|
transform: translate(-50%, -70%) rotate(-45deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-text {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #07c160;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-desc {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-card, .refund-card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.04);
|
||||||
|
|
||||||
|
.card-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
color: #333;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-item {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
color: #666;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
color: #333;
|
||||||
|
font-size: 14px;
|
||||||
|
|
||||||
|
&.highlight {
|
||||||
|
color: #ff6b00;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.success {
|
||||||
|
color: #07c160;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-group {
|
||||||
|
margin-top: 30px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
|
||||||
|
.primary-btn {
|
||||||
|
background-color: #07c160;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
border-radius: 24px;
|
||||||
|
padding: 12px;
|
||||||
|
font-size: 16px;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.secondary-btn {
|
||||||
|
background-color: #fff;
|
||||||
|
color: #07c160;
|
||||||
|
border: 1px solid #07c160;
|
||||||
|
border-radius: 24px;
|
||||||
|
padding: 12px;
|
||||||
|
font-size: 16px;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
+121
-4
@@ -28,6 +28,14 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 设备状态 -->
|
||||||
|
<view class="device-status">
|
||||||
|
<view class="status-message">{{ deviceMessage }}</view>
|
||||||
|
<view class="loading-animation" v-if="isLoading">
|
||||||
|
<view class="loading-circle"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 操作按钮 -->
|
<!-- 操作按钮 -->
|
||||||
<view class="button-group">
|
<view class="button-group">
|
||||||
<button class="primary-btn" @click="goToHome">返回首页</button>
|
<button class="primary-btn" @click="goToHome">返回首页</button>
|
||||||
@@ -37,19 +45,28 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { queryById } from '@/config/user.js'
|
import { queryById, confirmPaymentAndRent, sendRentCommand } from '@/config/user.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
orderId: '',
|
orderId: '',
|
||||||
orderInfo: {}
|
orderInfo: {},
|
||||||
|
isLoading: true,
|
||||||
|
deviceMessage: '正在准备您的设备,请稍候...',
|
||||||
|
hasTriggeredDevice: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
if (options && options.orderId) {
|
if (options && options.orderId) {
|
||||||
this.orderId = options.orderId
|
this.orderId = options.orderId
|
||||||
this.loadOrderInfo()
|
this.loadOrderInfo()
|
||||||
|
|
||||||
|
// 添加页面显示监听,防止页面切换后重复触发弹出
|
||||||
|
uni.$once('orderSuccess:' + this.orderId, () => {
|
||||||
|
console.log('已经触发过弹出逻辑,不再重复触发')
|
||||||
|
this.hasTriggeredDevice = true
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '订单信息不存在',
|
title: '订单信息不存在',
|
||||||
@@ -73,8 +90,24 @@ export default {
|
|||||||
this.orderInfo = {
|
this.orderInfo = {
|
||||||
orderNo: orderData.orderNo || orderData.orderId,
|
orderNo: orderData.orderNo || orderData.orderId,
|
||||||
deviceNo: orderData.deviceNo,
|
deviceNo: orderData.deviceNo,
|
||||||
amount: orderData.amount,
|
amount: orderData.payAmount || orderData.amount,
|
||||||
payTime: this.formatTime(new Date())
|
payTime: orderData.payTime || this.formatTime(new Date())
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查订单状态
|
||||||
|
if (orderData.orderStatus === 'IN_USED') {
|
||||||
|
// 如果已经是使用中状态,可能说明开锁已经完成
|
||||||
|
this.deviceMessage = '设备已弹出,请取走您的充电宝'
|
||||||
|
this.isLoading = false
|
||||||
|
|
||||||
|
// 如果是第一次加载页面且设备已弹出,记录状态,避免重复弹出
|
||||||
|
if (!this.hasTriggeredDevice) {
|
||||||
|
uni.$emit('orderSuccess:' + this.orderId)
|
||||||
|
this.hasTriggeredDevice = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 正常触发弹出逻辑
|
||||||
|
this.triggerDeviceEject()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error('获取订单信息失败')
|
throw new Error('获取订单信息失败')
|
||||||
@@ -89,6 +122,55 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 触发弹出充电宝
|
||||||
|
async triggerDeviceEject() {
|
||||||
|
if (this.hasTriggeredDevice) {
|
||||||
|
console.log('已经触发过弹出充电宝,不重复触发')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.hasTriggeredDevice = true
|
||||||
|
uni.$emit('orderSuccess:' + this.orderId)
|
||||||
|
this.isLoading = true
|
||||||
|
this.deviceMessage = '正在准备您的设备,请稍候...'
|
||||||
|
|
||||||
|
try {
|
||||||
|
console.log(`准备触发弹出充电宝,orderId: ${this.orderId}`)
|
||||||
|
|
||||||
|
// 先尝试使用确认支付并弹出的方法
|
||||||
|
let result
|
||||||
|
try {
|
||||||
|
result = await confirmPaymentAndRent(this.orderId)
|
||||||
|
console.log('确认支付并弹出充电宝结果:', JSON.stringify(result))
|
||||||
|
} catch (error) {
|
||||||
|
console.error('确认支付并弹出失败,尝试备用方法:', error)
|
||||||
|
// 如果第一种方法失败,尝试使用备用方法直接发送租借指令
|
||||||
|
result = await sendRentCommand(this.orderId)
|
||||||
|
console.log('发送租借指令结果:', JSON.stringify(result))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result && result.code === 200) {
|
||||||
|
this.deviceMessage = '设备已弹出,请取走您的充电宝'
|
||||||
|
uni.showToast({
|
||||||
|
title: '充电宝已弹出',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
throw new Error((result && result.msg) || '弹出充电宝失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('弹出充电宝错误:', error)
|
||||||
|
this.deviceMessage = '弹出设备失败,请联系客服'
|
||||||
|
uni.showToast({
|
||||||
|
title: error.message || '弹出充电宝失败,请联系客服',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} finally {
|
||||||
|
this.isLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
formatTime(date) {
|
formatTime(date) {
|
||||||
const year = date.getFullYear()
|
const year = date.getFullYear()
|
||||||
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
||||||
@@ -194,6 +276,41 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.device-status {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.status-message {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-animation {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 40px;
|
||||||
|
|
||||||
|
.loading-circle {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 3px solid #f0f0f0;
|
||||||
|
border-top-color: #07c160;
|
||||||
|
animation: spin 1s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
0% { transform: rotate(0deg); }
|
||||||
|
100% { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.button-group {
|
.button-group {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
+220
-142
@@ -3,7 +3,7 @@
|
|||||||
<!-- 订单信息卡片 -->
|
<!-- 订单信息卡片 -->
|
||||||
<view class="order-card">
|
<view class="order-card">
|
||||||
<view class="order-header">
|
<view class="order-header">
|
||||||
<text class="title">使用中</text>
|
<text class="title">{{ getOrderStatusText() }}</text>
|
||||||
<text class="order-no">订单号:{{ orderInfo.orderId }}</text>
|
<text class="order-no">订单号:{{ orderInfo.orderId }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -26,6 +26,14 @@
|
|||||||
<text class="value">¥{{ orderInfo.currentFee }}</text>
|
<text class="value">¥{{ orderInfo.currentFee }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 调试信息(仅在开发环境显示) -->
|
||||||
|
<view class="debug-info" v-if="false">
|
||||||
|
<view class="debug-title">调试信息</view>
|
||||||
|
<view class="debug-item">原始开始时间: {{ this.orderInfo._rawStartTime }}</view>
|
||||||
|
<view class="debug-item">处理后开始时间: {{ this.orderInfo.startTime }}</view>
|
||||||
|
<view class="debug-item">订单状态: {{ this.orderInfo.orderStatus }}</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 归还说明 -->
|
<!-- 归还说明 -->
|
||||||
@@ -38,26 +46,29 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="notice-item">
|
<view class="notice-item">
|
||||||
<view class="dot"></view>
|
<view class="dot"></view>
|
||||||
<text>请在指定区域内归还设备</text>
|
<text>将充电宝插入原位置或空闲插口</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="notice-item">
|
<view class="notice-item">
|
||||||
<view class="dot"></view>
|
<view class="dot"></view>
|
||||||
<text>归还后押金将自动退还</text>
|
<text>系统将自动检测归还并处理退款</text>
|
||||||
|
</view>
|
||||||
|
<view class="notice-item">
|
||||||
|
<view class="dot"></view>
|
||||||
|
<text>归还成功后将自动跳转到成功页面</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 底部操作栏 -->
|
<!-- 底部操作栏 -->
|
||||||
<view class="bottom-bar">
|
<view class="bottom-bar">
|
||||||
<button class="unlock-btn" @click="handleUnlock" :disabled="unlocking">
|
<button class="secondary-btn" @click="checkReturnStatus">刷新状态</button>
|
||||||
{{ unlocking ? '开锁中...' : '开锁归还' }}
|
<button class="primary-btn" @click="goToHome">返回首页</button>
|
||||||
</button>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { queryById, overOrderById } from '@/config/user.js'
|
import { queryById } from '@/config/user.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -66,11 +77,16 @@ export default {
|
|||||||
orderInfo: {
|
orderInfo: {
|
||||||
orderId: '',
|
orderId: '',
|
||||||
startTime: '',
|
startTime: '',
|
||||||
|
_rawStartTime: '', // 用于调试
|
||||||
usedTime: '0分钟',
|
usedTime: '0分钟',
|
||||||
currentFee: '0.00'
|
currentFee: '0.00',
|
||||||
|
orderStatus: 'in_used' // 默认状态为使用中
|
||||||
},
|
},
|
||||||
unlocking: false,
|
timer: null,
|
||||||
timer: null
|
statusCheckTimer: null,
|
||||||
|
maxStatusChecks: 30, // 最多检查30次
|
||||||
|
currentStatusChecks: 0,
|
||||||
|
statusCheckInterval: 5000 // 5秒检查一次
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
@@ -78,7 +94,7 @@ export default {
|
|||||||
|
|
||||||
// 获取传递的参数
|
// 获取传递的参数
|
||||||
this.orderInfo.orderId = options.orderId || ''
|
this.orderInfo.orderId = options.orderId || ''
|
||||||
this.deviceId = options.deviceId || ''
|
this.deviceId = options.deviceNo || options.deviceId || ''
|
||||||
|
|
||||||
console.log(`初始化参数: orderId=${this.orderInfo.orderId}, deviceId=${this.deviceId}`)
|
console.log(`初始化参数: orderId=${this.orderInfo.orderId}, deviceId=${this.deviceId}`)
|
||||||
|
|
||||||
@@ -90,6 +106,8 @@ export default {
|
|||||||
this.getOrderDetails()
|
this.getOrderDetails()
|
||||||
// 启动定时器更新使用时长
|
// 启动定时器更新使用时长
|
||||||
this.startTimer()
|
this.startTimer()
|
||||||
|
// 启动状态检查定时器
|
||||||
|
this.startStatusCheckTimer()
|
||||||
} else {
|
} else {
|
||||||
// 缺少必要参数
|
// 缺少必要参数
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -99,17 +117,32 @@ export default {
|
|||||||
|
|
||||||
// 返回首页
|
// 返回首页
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.reLaunch({
|
this.goToHome()
|
||||||
url: '/pages/index/index'
|
|
||||||
})
|
|
||||||
}, 1500)
|
}, 1500)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
// 页面卸载时清除定时器
|
// 页面卸载时清除定时器
|
||||||
this.clearTimer()
|
this.clearTimer()
|
||||||
|
this.clearStatusCheckTimer()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 根据订单状态获取对应的文字显示
|
||||||
|
getOrderStatusText() {
|
||||||
|
const statusMap = {
|
||||||
|
'waiting_for_payment': '待支付',
|
||||||
|
'payment_in_progress': '支付中',
|
||||||
|
'payment_successful': '支付成功',
|
||||||
|
'in_used': '使用中',
|
||||||
|
'payment_failed': '支付失败',
|
||||||
|
'order_cancelled': '订单取消',
|
||||||
|
'used_done': '订单完成',
|
||||||
|
'used_down': '订单完成'
|
||||||
|
}
|
||||||
|
|
||||||
|
return statusMap[this.orderInfo.orderStatus] || '使用中'
|
||||||
|
},
|
||||||
|
|
||||||
// 获取订单详情
|
// 获取订单详情
|
||||||
async getOrderDetails() {
|
async getOrderDetails() {
|
||||||
try {
|
try {
|
||||||
@@ -125,32 +158,33 @@ export default {
|
|||||||
|
|
||||||
if (result.code === 200 && result.data) {
|
if (result.code === 200 && result.data) {
|
||||||
const orderData = result.data
|
const orderData = result.data
|
||||||
console.log('订单数据:', JSON.stringify(orderData))
|
console.log('订单原始数据:', orderData)
|
||||||
|
console.log('开始时间字段:', orderData.startTime, typeof orderData.startTime)
|
||||||
|
|
||||||
// 更新订单信息
|
// 更新订单状态
|
||||||
|
if (orderData.orderStatus) {
|
||||||
|
this.orderInfo.orderStatus = orderData.orderStatus
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查订单状态,如果已完成,跳转到归还成功页面
|
||||||
|
if (orderData.orderStatus && orderData.orderStatus === 'used_down') {
|
||||||
|
// 清理定时器
|
||||||
|
this.clearTimer()
|
||||||
|
this.clearStatusCheckTimer()
|
||||||
|
|
||||||
|
// 跳转到归还成功页面
|
||||||
|
console.log('订单已完成,准备跳转到归还成功页面')
|
||||||
|
uni.redirectTo({
|
||||||
|
url: `/pages/order/return-success?orderId=${this.orderInfo.orderId}`
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新订单信息 (包括开始时间)
|
||||||
this.updateOrderInfo(orderData)
|
this.updateOrderInfo(orderData)
|
||||||
|
|
||||||
// 格式化开始时间
|
// 更新后检查是否成功设置了startTime
|
||||||
const rawTime = orderData.startTime
|
console.log('更新后的开始时间:', this.orderInfo.startTime)
|
||||||
console.log('开始时间:', rawTime)
|
|
||||||
|
|
||||||
if (rawTime) {
|
|
||||||
try {
|
|
||||||
// 尝试格式化时间
|
|
||||||
const date = new Date(rawTime.replace(' ', 'T'))
|
|
||||||
if (!isNaN(date.getTime())) {
|
|
||||||
this.orderInfo.startTime = this.formatTime(date)
|
|
||||||
} else {
|
|
||||||
// 如果时间解析失败,直接使用原始时间字符串
|
|
||||||
this.orderInfo.startTime = rawTime
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('时间格式化错误:', e)
|
|
||||||
this.orderInfo.startTime = rawTime
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.orderInfo.startTime = '未知'
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error(result.msg || '获取订单详情失败')
|
throw new Error(result.msg || '获取订单详情失败')
|
||||||
}
|
}
|
||||||
@@ -163,9 +197,7 @@ export default {
|
|||||||
|
|
||||||
// 如果获取订单失败,返回首页
|
// 如果获取订单失败,返回首页
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.reLaunch({
|
this.goToHome()
|
||||||
url: '/pages/index/index'
|
|
||||||
})
|
|
||||||
}, 1500)
|
}, 1500)
|
||||||
} finally {
|
} finally {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
@@ -186,8 +218,41 @@ export default {
|
|||||||
// 使用后端返回的使用时长和费用数据
|
// 使用后端返回的使用时长和费用数据
|
||||||
updateOrderInfo(orderData) {
|
updateOrderInfo(orderData) {
|
||||||
console.log('更新订单信息:', JSON.stringify(orderData))
|
console.log('更新订单信息:', JSON.stringify(orderData))
|
||||||
|
|
||||||
|
// 处理使用时长
|
||||||
this.orderInfo.usedTime = orderData.usedTime || '0分钟';
|
this.orderInfo.usedTime = orderData.usedTime || '0分钟';
|
||||||
this.orderInfo.currentFee = orderData.currentFee || '0.00';
|
|
||||||
|
// 处理当前费用
|
||||||
|
this.orderInfo.currentFee = orderData.currentFee || orderData.actualDeviceAmount || orderData.payAmount || '0.00';
|
||||||
|
|
||||||
|
// 更新订单状态
|
||||||
|
if (orderData.orderStatus) {
|
||||||
|
this.orderInfo.orderStatus = orderData.orderStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存原始开始时间用于调试
|
||||||
|
this.orderInfo._rawStartTime = orderData.startTime;
|
||||||
|
|
||||||
|
// 处理开始时间
|
||||||
|
if (orderData.startTime) {
|
||||||
|
try {
|
||||||
|
console.log('API返回的开始时间:', orderData.startTime);
|
||||||
|
// 尝试直接显示API返回的时间字符串
|
||||||
|
this.orderInfo.startTime = orderData.startTime;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('更新开始时间错误:', e);
|
||||||
|
this.orderInfo.startTime = '未知';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn('API返回的订单数据中没有startTime字段');
|
||||||
|
// 尝试使用createTime作为备选
|
||||||
|
if (orderData.createTime) {
|
||||||
|
console.log('使用createTime作为备选:', orderData.createTime);
|
||||||
|
this.orderInfo.startTime = orderData.createTime;
|
||||||
|
} else {
|
||||||
|
this.orderInfo.startTime = '未知';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 如果有设备号,更新设备号
|
// 如果有设备号,更新设备号
|
||||||
if (orderData.deviceNo && !this.deviceId) {
|
if (orderData.deviceNo && !this.deviceId) {
|
||||||
@@ -211,65 +276,37 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 处理开锁归还
|
// 清除状态检查定时器
|
||||||
async handleUnlock() {
|
clearStatusCheckTimer() {
|
||||||
if (this.unlocking) return
|
if (this.statusCheckTimer) {
|
||||||
|
clearInterval(this.statusCheckTimer)
|
||||||
try {
|
this.statusCheckTimer = null
|
||||||
this.unlocking = true
|
|
||||||
uni.showLoading({ title: '开锁中' })
|
|
||||||
|
|
||||||
// 确认是否归还
|
|
||||||
const confirmResult = await new Promise((resolve) => {
|
|
||||||
uni.showModal({
|
|
||||||
title: '确认归还',
|
|
||||||
content: '确定要归还设备吗?',
|
|
||||||
success: (res) => {
|
|
||||||
resolve(res.confirm)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!confirmResult) {
|
|
||||||
this.unlocking = false
|
|
||||||
uni.hideLoading()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`准备结束订单, orderId: ${this.orderInfo.orderId}`)
|
|
||||||
|
|
||||||
// 调用结束订单接口
|
|
||||||
const result = await overOrderById(this.orderInfo.orderId)
|
|
||||||
|
|
||||||
console.log('结束订单结果:', JSON.stringify(result))
|
|
||||||
|
|
||||||
if (result.code === 200) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '归还成功',
|
|
||||||
icon: 'success'
|
|
||||||
})
|
|
||||||
|
|
||||||
// 归还成功后,返回首页
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.reLaunch({
|
|
||||||
url: '/pages/index/index'
|
|
||||||
})
|
|
||||||
}, 1500)
|
|
||||||
} else {
|
|
||||||
throw new Error(result.msg || '归还失败')
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('归还操作错误:', error)
|
|
||||||
uni.showToast({
|
|
||||||
title: error.message || '归还失败,请重试',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
} finally {
|
|
||||||
this.unlocking = false
|
|
||||||
uni.hideLoading()
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 开始状态检查定时器
|
||||||
|
startStatusCheckTimer() {
|
||||||
|
this.currentStatusChecks = 0
|
||||||
|
this.clearStatusCheckTimer()
|
||||||
|
|
||||||
|
this.statusCheckTimer = setInterval(() => {
|
||||||
|
this.currentStatusChecks++
|
||||||
|
this.checkReturnStatus()
|
||||||
|
|
||||||
|
// 如果超过最大检查次数,停止定时器
|
||||||
|
if (this.currentStatusChecks >= this.maxStatusChecks) {
|
||||||
|
this.clearStatusCheckTimer()
|
||||||
|
|
||||||
|
// 提示用户手动刷新
|
||||||
|
uni.showToast({
|
||||||
|
title: '请手动刷新查看归还状态',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, this.statusCheckInterval)
|
||||||
|
},
|
||||||
|
|
||||||
// 通过设备号查询使用中的订单
|
// 通过设备号查询使用中的订单
|
||||||
async getOrderByDevice() {
|
async getOrderByDevice() {
|
||||||
try {
|
try {
|
||||||
@@ -293,13 +330,28 @@ export default {
|
|||||||
|
|
||||||
if (inUseRes.statusCode === 200 && inUseRes.data.code === 200 && inUseRes.data.data) {
|
if (inUseRes.statusCode === 200 && inUseRes.data.code === 200 && inUseRes.data.data) {
|
||||||
const inUseOrder = inUseRes.data.data
|
const inUseOrder = inUseRes.data.data
|
||||||
|
console.log('使用中的订单:', inUseOrder)
|
||||||
|
|
||||||
// 更新订单ID
|
// 更新订单ID
|
||||||
this.orderInfo.orderId = inUseOrder.orderId
|
this.orderInfo.orderId = inUseOrder.orderId
|
||||||
|
|
||||||
|
// 如果有订单状态,更新订单状态
|
||||||
|
if (inUseOrder.orderStatus) {
|
||||||
|
this.orderInfo.orderStatus = inUseOrder.orderStatus
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果有开始时间,直接更新
|
||||||
|
if (inUseOrder.startTime) {
|
||||||
|
console.log('inUse API返回的开始时间:', inUseOrder.startTime)
|
||||||
|
this.orderInfo.startTime = inUseOrder.startTime
|
||||||
|
}
|
||||||
|
|
||||||
// 获取详细订单信息
|
// 获取详细订单信息
|
||||||
this.getOrderDetails()
|
this.getOrderDetails()
|
||||||
// 启动定时器
|
// 启动定时器
|
||||||
this.startTimer()
|
this.startTimer()
|
||||||
|
// 启动状态检查定时器
|
||||||
|
this.startStatusCheckTimer()
|
||||||
} else {
|
} else {
|
||||||
throw new Error('未找到使用中的订单')
|
throw new Error('未找到使用中的订单')
|
||||||
}
|
}
|
||||||
@@ -312,13 +364,27 @@ export default {
|
|||||||
|
|
||||||
// 如果获取订单失败,返回首页
|
// 如果获取订单失败,返回首页
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.reLaunch({
|
this.goToHome()
|
||||||
url: '/pages/index/index'
|
|
||||||
})
|
|
||||||
}, 1500)
|
}, 1500)
|
||||||
} finally {
|
} finally {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 检查归还状态
|
||||||
|
async checkReturnStatus() {
|
||||||
|
try {
|
||||||
|
await this.getOrderDetails()
|
||||||
|
} catch (error) {
|
||||||
|
console.error('检查归还状态失败:', error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 返回首页
|
||||||
|
goToHome() {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -346,9 +412,9 @@ export default {
|
|||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 36rpx;
|
font-size: 32rpx;
|
||||||
font-weight: 600;
|
font-weight: bold;
|
||||||
color: #1976D2;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-no {
|
.order-no {
|
||||||
@@ -358,15 +424,15 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.device-info {
|
.device-info {
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 30rpx;
|
||||||
|
|
||||||
.device-name {
|
.device-name {
|
||||||
font-size: 32rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 500;
|
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-right: 20rpx;
|
display: block;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.device-id {
|
.device-id {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
@@ -374,27 +440,32 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.time-info {
|
.time-info {
|
||||||
|
background: #f9f9f9;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 20rpx;
|
||||||
|
|
||||||
.time-item {
|
.time-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
font-size: 28rpx;
|
font-size: 26rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
.value {
|
.value {
|
||||||
font-size: 28rpx;
|
font-size: 26rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
|
|
||||||
&.highlight {
|
&.highlight {
|
||||||
color: #1976D2;
|
color: #ff6b00;
|
||||||
font-weight: 500;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -409,18 +480,18 @@ export default {
|
|||||||
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
|
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
|
||||||
|
|
||||||
.notice-title {
|
.notice-title {
|
||||||
font-size: 32rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 600;
|
font-weight: bold;
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-list {
|
.notice-list {
|
||||||
.notice-item {
|
.notice-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: flex-start;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
@@ -428,13 +499,15 @@ export default {
|
|||||||
.dot {
|
.dot {
|
||||||
width: 12rpx;
|
width: 12rpx;
|
||||||
height: 12rpx;
|
height: 12rpx;
|
||||||
background: #1976D2;
|
background: #07c160;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
margin-top: 10rpx;
|
||||||
margin-right: 16rpx;
|
margin-right: 16rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
text {
|
text {
|
||||||
font-size: 28rpx;
|
font-size: 26rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
@@ -447,33 +520,38 @@ export default {
|
|||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
padding: 30rpx;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 20rpx 30rpx;
|
|
||||||
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
box-shadow: 0 -4rpx 16rpx rgba(0,0,0,0.04);
|
box-shadow: 0 -4rpx 16rpx rgba(0,0,0,0.04);
|
||||||
|
z-index: 10;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 20rpx;
|
||||||
|
|
||||||
.unlock-btn {
|
.primary-btn, .secondary-btn {
|
||||||
width: 100%;
|
|
||||||
height: 88rpx;
|
height: 88rpx;
|
||||||
border-radius: 44rpx;
|
line-height: 88rpx;
|
||||||
background: linear-gradient(135deg, #FF9800, #FFB74D);
|
|
||||||
color: #fff;
|
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: 600;
|
border-radius: 44rpx;
|
||||||
display: flex;
|
text-align: center;
|
||||||
align-items: center;
|
flex: 1;
|
||||||
justify-content: center;
|
}
|
||||||
border: none;
|
|
||||||
|
.primary-btn {
|
||||||
|
background: #07c160;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
transform: scale(0.98);
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
&:disabled {
|
|
||||||
opacity: 0.7;
|
.secondary-btn {
|
||||||
|
background: #f0f0f0;
|
||||||
|
color: #333;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"app.js","sources":["App.vue"],"sourcesContent":["<script>\r\n\timport {\r\n\t\twxLogin,\r\n\t\tgetUserInfo\r\n\t} from './util/index'\r\n\r\n\r\n\texport default {\r\n\t\tonLaunch: function() {\r\n\t\t\tconsole.log('App Launch')\r\n\t\t\t\r\n\t\t},\r\n\t\tonShow: async function() {\r\n\t\t\tconsole.log('App Show')\r\n\t\t\tawait this.autoLogin()\r\n\r\n\t\t},\r\n\t\tonHide: function() {\r\n\t\t\tconsole.log('App Hide')\r\n\t\t},\r\n\r\n\r\n\r\n\t\tmethods: {\r\n\t\t\tasync autoLogin() {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst loginResult = await wxLogin()\r\n\t\t\t\t\tconsole.log('自动登录成功:', loginResult)\r\n\t\t\t\t\t// await getUserInfo()\r\n\t\t\t\t} catch (error) {\r\n\t\t\t\t\tconsole.error('自动登录失败:', error)\r\n\t\t\t\t\t// 登录失败的处理可以在 wxLogin 中统一处理\r\n\t\t\t\t\t// 这里可以添加特殊的错误处理逻辑\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n</script>\r\n\r\n<style lang=\"scss\">\r\n\t@import \"uview-ui/index.scss\"\r\n\r\n\t/*每个页面公共css */\r\n</style>"],"names":["uni","wxLogin"],"mappings":";;;;;;;;;;;;;;;;;AAOC,MAAK,YAAU;AAAA,EACd,UAAU,WAAW;AACpBA,kBAAAA,MAAA,MAAA,OAAA,iBAAY,YAAY;AAAA,EAExB;AAAA,EACD,QAAQ,iBAAiB;AACxBA,kBAAAA,MAAY,MAAA,OAAA,iBAAA,UAAU;AACtB,UAAM,KAAK,UAAU;AAAA,EAErB;AAAA,EACD,QAAQ,WAAW;AAClBA,kBAAAA,MAAY,MAAA,OAAA,iBAAA,UAAU;AAAA,EACtB;AAAA,EAID,SAAS;AAAA,IACR,MAAM,YAAY;AACjB,UAAI;AACH,cAAM,cAAc,MAAMC,mBAAQ;AAClCD,sBAAAA,MAAY,MAAA,OAAA,iBAAA,WAAW,WAAW;AAAA,MAEjC,SAAO,OAAO;AACfA,sBAAAA,sCAAc,WAAW,KAAK;AAAA,MAG/B;AAAA,IACD;AAAA,EACD;AACD;;;;;;;;;"}
|
{"version":3,"file":"app.js","sources":["App.vue"],"sourcesContent":["<script>\r\n\timport {\r\n\t\twxLogin,\r\n\t\tgetUserInfo\r\n\t} from './util/index'\r\n\r\n\r\n\texport default {\r\n\t\tonLaunch: function() {\r\n\t\t\tconsole.log('App Launch')\r\n\t\t\t\r\n\t\t},\r\n\t\tonShow: async function() {\r\n\t\t\tconsole.log('App Show')\r\n\t\t\tawait this.autoLogin()\r\n\r\n\t\t},\r\n\t\tonHide: function() {\r\n\t\t\tconsole.log('App Hide')\r\n\t\t},\r\n\r\n\r\n\r\n\t\tmethods: {\r\n\t\t\tasync autoLogin() {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst loginResult = await wxLogin()\r\n\t\t\t\t\tconsole.log('自动登录成功:', loginResult)\r\n\t\t\t\t\t// await getUserInfo()\r\n\t\t\t\t} catch (error) {\r\n\t\t\t\t\tconsole.error('自动登录失败:', error)\r\n\t\t\t\t\t// 登录失败的处理可以在 wxLogin 中统一处理\r\n\t\t\t\t\t// 这里可以添加特殊的错误处理逻辑\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n</script>\r\n\r\n<style lang=\"scss\">\r\n\t@import \"uview-ui/index.scss\"\r\n\r\n\t/*每个页面公共css */\r\n</style>"],"names":["uni","wxLogin"],"mappings":";;;;;;;;;;;;;;;;;;AAOC,MAAK,YAAU;AAAA,EACd,UAAU,WAAW;AACpBA,kBAAAA,MAAA,MAAA,OAAA,iBAAY,YAAY;AAAA,EAExB;AAAA,EACD,QAAQ,iBAAiB;AACxBA,kBAAAA,MAAY,MAAA,OAAA,iBAAA,UAAU;AACtB,UAAM,KAAK,UAAU;AAAA,EAErB;AAAA,EACD,QAAQ,WAAW;AAClBA,kBAAAA,MAAY,MAAA,OAAA,iBAAA,UAAU;AAAA,EACtB;AAAA,EAID,SAAS;AAAA,IACR,MAAM,YAAY;AACjB,UAAI;AACH,cAAM,cAAc,MAAMC,mBAAQ;AAClCD,sBAAAA,MAAY,MAAA,OAAA,iBAAA,WAAW,WAAW;AAAA,MAEjC,SAAO,OAAO;AACfA,sBAAAA,sCAAc,WAAW,KAAK;AAAA,MAG/B;AAAA,IACD;AAAA,EACD;AACD;;;;;;;;;"}
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"user.js","sources":["config/user.js"],"sourcesContent":["import request from './http'\r\n\r\n\r\nexport const login = (data) => {\r\n return request({\r\n url: '/app/user/login',\r\n method: 'get',\r\n data\r\n })\r\n}\r\n\r\n\r\nexport const getMyIndexInfo = (data) => {\r\n return request({\r\n url: '/app/user/userInfo',\r\n method: 'get',\r\n data,\r\n })\r\n}\r\n\r\n//获取所有全部订单\r\nexport const getOrderList = (data) => {\r\n return request({\r\n url: '/app/order/list',\r\n method: 'get',\r\n data,\r\n hideLoading:true\r\n })\r\n}\r\n\r\n//查询是否有订单\r\nexport const queryHasOrder = (deviceNo) => {\r\n return request({\r\n url: `/app/order/list?deviceNo=${deviceNo}&orderStatus=in_used`,\r\n method: 'get',\r\n })\r\n}\r\n\r\n//设备查询\r\nexport const getDeviceInfo = (deviceNo) => {\r\n return request({\r\n url: `/app/device/${deviceNo}`,\r\n method: 'get',\r\n })\r\n}\r\n\r\n\r\n//创建订单\r\nexport const createOrder = (data) => {\r\n return request({\r\n url: '/app/order/add',\r\n method: 'post',\r\n data,\r\n })\r\n}\r\n\r\n//查询订单\r\nexport const queryById = (id) => {\r\n return request({\r\n url: `/app/order/${id}`,\r\n method: 'get',\r\n })\r\n}\r\n\r\n\r\n//取消订单\r\nexport const cancelOrder = (data) => {\r\n return request({\r\n url: '/orderInfo/cancelOrder',\r\n method: 'get',\r\n data,\r\n })\r\n}\r\n\r\n\r\n//结束订单\r\nexport const overOrderById = (orderId) => {\r\n console.log(`调用结束订单API, orderId: ${orderId}`)\r\n return request({\r\n url: `/app/order/close/${orderId}`,\r\n method: 'get',\r\n })\r\n}\r\n\r\n//立即租借\r\nexport const rentPowerBank = (deviceNo, phone) => {\r\n return request({\r\n url: '/app/device/rentPowerBank',\r\n method: 'post',\r\n data: { deviceNo, phone }\r\n })\r\n}\r\n\r\n\r\n//投诉反馈\r\nexport const addUserFeedback = (data) => {\r\n return request({\r\n url: '/app/feedback/add',\r\n method: 'post',\r\n data,\r\n })\r\n}\r\n"],"names":["request","uni"],"mappings":";;;AAGY,MAAC,QAAQ,CAAC,SAAS;AAC3B,SAAOA,oBAAQ;AAAA,IACX,KAAK;AAAA,IACL,QAAQ;AAAA,IACR;AAAA,EACR,CAAK;AACL;AAGY,MAAC,iBAAiB,CAAC,SAAS;AACpC,SAAOA,oBAAQ;AAAA,IACX,KAAK;AAAA,IACL,QAAQ;AAAA,IACR;AAAA,EACR,CAAK;AACL;AAGY,MAAC,eAAe,CAAC,SAAS;AAClC,SAAOA,oBAAQ;AAAA,IACX,KAAK;AAAA,IACL,QAAQ;AAAA,IACR;AAAA,IACA,aAAY;AAAA,EACpB,CAAK;AACL;AAGY,MAAC,gBAAgB,CAAC,aAAa;AACvC,SAAOA,oBAAQ;AAAA,IACX,KAAK,4BAA4B,QAAQ;AAAA,IACzC,QAAQ;AAAA,EAChB,CAAK;AACL;AAGY,MAAC,gBAAgB,CAAC,aAAa;AACvC,SAAOA,oBAAQ;AAAA,IACX,KAAK,eAAe,QAAQ;AAAA,IAC5B,QAAQ;AAAA,EAChB,CAAK;AACL;AAaY,MAAC,YAAY,CAAC,OAAO;AAC7B,SAAOA,oBAAQ;AAAA,IACX,KAAK,cAAc,EAAE;AAAA,IACrB,QAAQ;AAAA,EAChB,CAAK;AACL;AAcY,MAAC,gBAAgB,CAAC,YAAY;AACtCC,gBAAY,MAAA,MAAA,OAAA,wBAAA,uBAAuB,OAAO,EAAE;AAC5C,SAAOD,oBAAQ;AAAA,IACX,KAAK,oBAAoB,OAAO;AAAA,IAChC,QAAQ;AAAA,EAChB,CAAK;AACL;AAGY,MAAC,gBAAgB,CAAC,UAAU,UAAU;AAC9C,SAAOA,oBAAQ;AAAA,IACX,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,MAAM,EAAE,UAAU,MAAO;AAAA,EACjC,CAAK;AACL;;;;;;;;;"}
|
{"version":3,"file":"user.js","sources":["config/user.js"],"sourcesContent":["import request from './http'\n\n\nexport const login = (data) => {\n return request({\n url: '/app/user/login',\n method: 'get',\n data\n })\n}\n\n\nexport const getMyIndexInfo = (data) => {\n return request({\n url: '/app/user/userInfo',\n method: 'get',\n data,\n })\n}\n\n//获取所有全部订单\nexport const getOrderList = (data) => {\n return request({\n url: '/app/order/list',\n method: 'get',\n data,\n hideLoading:true\n })\n}\n\n//查询是否有订单\nexport const queryHasOrder = (deviceNo) => {\n return request({\n url: `/app/order/list?deviceNo=${deviceNo}&orderStatus=in_used`,\n method: 'get',\n })\n}\n\n//设备查询\nexport const getDeviceInfo = (deviceNo) => {\n return request({\n url: `/app/device/${deviceNo}`,\n method: 'get',\n })\n}\n\n\n//创建订单\nexport const createOrder = (data) => {\n return request({\n url: '/app/order/add',\n method: 'post',\n data,\n })\n}\n\n//查询订单\nexport const queryById = (id) => {\n console.log(`查询订单详情, orderId: ${id}`)\n return request({\n url: `/app/order/${id}`,\n method: 'get',\n hideLoading: true\n })\n}\n\n\n//取消订单\nexport const cancelOrder = (data) => {\n return request({\n url: '/orderInfo/cancelOrder',\n method: 'get',\n data,\n })\n}\n\n\n//结束订单\nexport const overOrderById = (orderId) => {\n console.log(`调用结束订单API, orderId: ${orderId}`)\n return request({\n url: `/app/order/close/${orderId}`,\n method: 'get',\n })\n}\n\n//立即租借\nexport const rentPowerBank = (deviceNo, phone) => {\n return request({\n url: '/app/device/rentPowerBank',\n method: 'post',\n data: { deviceNo, phone }\n })\n}\n\n//确认支付并弹出充电宝\nexport const confirmPaymentAndRent = (orderId) => {\n console.log(`确认支付并弹出充电宝, orderId: ${orderId}`)\n return request({\n url: `/app/device/confirmPaymentAndRent?orderId=${orderId}`,\n method: 'post'\n })\n}\n\n//备用方法:直接发送租借指令\nexport const sendRentCommand = (orderId) => {\n console.log(`直接发送租借指令, orderId: ${orderId}`)\n return request({\n url: `/app/device/sendRentCommand?orderId=${orderId}`,\n method: 'post'\n })\n}\n\n//投诉反馈\nexport const addUserFeedback = (data) => {\n return request({\n url: '/app/feedback/add',\n method: 'post',\n data,\n })\n}\n\n//强制打开空格子\nexport const forcefOpenEmptyGrid = (deviceNo) => {\n console.log(`强制打开空格子, deviceNo: ${deviceNo}`)\n return request({\n url: `/app/device/forcef/${deviceNo}`,\n method: 'post'\n })\n}\n"],"names":["request","uni"],"mappings":";;;AAGY,MAAC,QAAQ,CAAC,SAAS;AAC3B,SAAOA,oBAAQ;AAAA,IACX,KAAK;AAAA,IACL,QAAQ;AAAA,IACR;AAAA,EACR,CAAK;AACL;AAGY,MAAC,iBAAiB,CAAC,SAAS;AACpC,SAAOA,oBAAQ;AAAA,IACX,KAAK;AAAA,IACL,QAAQ;AAAA,IACR;AAAA,EACR,CAAK;AACL;AAGY,MAAC,eAAe,CAAC,SAAS;AAClC,SAAOA,oBAAQ;AAAA,IACX,KAAK;AAAA,IACL,QAAQ;AAAA,IACR;AAAA,IACA,aAAY;AAAA,EACpB,CAAK;AACL;AAGY,MAAC,gBAAgB,CAAC,aAAa;AACvC,SAAOA,oBAAQ;AAAA,IACX,KAAK,4BAA4B,QAAQ;AAAA,IACzC,QAAQ;AAAA,EAChB,CAAK;AACL;AAGY,MAAC,gBAAgB,CAAC,aAAa;AACvC,SAAOA,oBAAQ;AAAA,IACX,KAAK,eAAe,QAAQ;AAAA,IAC5B,QAAQ;AAAA,EAChB,CAAK;AACL;AAaY,MAAC,YAAY,CAAC,OAAO;AAC7BC,gBAAA,MAAA,MAAA,OAAA,wBAAY,oBAAoB,EAAE,EAAE;AACpC,SAAOD,oBAAQ;AAAA,IACX,KAAK,cAAc,EAAE;AAAA,IACrB,QAAQ;AAAA,IACR,aAAa;AAAA,EACrB,CAAK;AACL;AAuBY,MAAC,gBAAgB,CAAC,UAAU,UAAU;AAC9C,SAAOA,oBAAQ;AAAA,IACX,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,MAAM,EAAE,UAAU,MAAO;AAAA,EACjC,CAAK;AACL;AAGY,MAAC,wBAAwB,CAAC,YAAY;AAC9CC,gBAAY,MAAA,MAAA,OAAA,wBAAA,wBAAwB,OAAO,EAAE;AAC7C,SAAOD,oBAAQ;AAAA,IACX,KAAK,6CAA6C,OAAO;AAAA,IACzD,QAAQ;AAAA,EAChB,CAAK;AACL;AAGY,MAAC,kBAAkB,CAAC,YAAY;AACxCC,gBAAA,MAAA,MAAA,OAAA,yBAAY,sBAAsB,OAAO,EAAE;AAC3C,SAAOD,oBAAQ;AAAA,IACX,KAAK,uCAAuC,OAAO;AAAA,IACnD,QAAQ;AAAA,EAChB,CAAK;AACL;;;;;;;;;;"}
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.js","sources":["E:/迅雷下载/HBuilderX.4.57.2025032507/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvaW5kZXgvaW5kZXgudnVl"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/index/index.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
{"version":3,"file":"index.js","sources":["E:/迅雷下载/HBuilderX.4.57.2025032507/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvaW5kZXgvaW5kZXgudnVl"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/index/index.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.js","sources":["E:/迅雷下载/HBuilderX.4.57.2025032507/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvb3JkZXIvaW5kZXgudnVl"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/order/index.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
{"version":3,"file":"index.js","sources":["E:/迅雷下载/HBuilderX.4.57.2025032507/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvb3JkZXIvaW5kZXgudnVl"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/order/index.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"payment.js","sources":["E:/迅雷下载/HBuilderX.4.57.2025032507/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvb3JkZXIvcGF5bWVudC52dWU"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/order/payment.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
{"version":3,"file":"payment.js","sources":["E:/迅雷下载/HBuilderX.4.57.2025032507/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvb3JkZXIvcGF5bWVudC52dWU"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/order/payment.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"return-success.js","sources":["E:/迅雷下载/HBuilderX.4.57.2025032507/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvb3JkZXIvcmV0dXJuLXN1Y2Nlc3MudnVl"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/order/return-success.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"success.js","sources":["E:/迅雷下载/HBuilderX.4.57.2025032507/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvb3JkZXIvc3VjY2Vzcy52dWU"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/order/success.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
{"version":3,"file":"success.js","sources":["E:/迅雷下载/HBuilderX.4.57.2025032507/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvb3JkZXIvc3VjY2Vzcy52dWU"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/order/success.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.js","sources":["E:/迅雷下载/HBuilderX.4.57.2025032507/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvcmV0dXJuL2luZGV4LnZ1ZQ"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/return/index.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
{"version":3,"file":"index.js","sources":["E:/迅雷下载/HBuilderX.4.57.2025032507/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvcmV0dXJuL2luZGV4LnZ1ZQ"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/return/index.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
||||||
Vendored
+1
@@ -14,6 +14,7 @@ if (!Math) {
|
|||||||
"./pages/serve/bagCheck/index.js";
|
"./pages/serve/bagCheck/index.js";
|
||||||
"./pages/return/index.js";
|
"./pages/return/index.js";
|
||||||
"./pages/order/success.js";
|
"./pages/order/success.js";
|
||||||
|
"./pages/order/return-success.js";
|
||||||
}
|
}
|
||||||
const _sfc_main = {
|
const _sfc_main = {
|
||||||
onLaunch: function() {
|
onLaunch: function() {
|
||||||
|
|||||||
+2
-1
@@ -10,7 +10,8 @@
|
|||||||
"pages/device/detail",
|
"pages/device/detail",
|
||||||
"pages/serve/bagCheck/index",
|
"pages/serve/bagCheck/index",
|
||||||
"pages/return/index",
|
"pages/return/index",
|
||||||
"pages/order/success"
|
"pages/order/success",
|
||||||
|
"pages/order/return-success"
|
||||||
],
|
],
|
||||||
"window": {
|
"window": {
|
||||||
"navigationBarTextStyle": "black",
|
"navigationBarTextStyle": "black",
|
||||||
|
|||||||
+2
-2
@@ -6874,9 +6874,9 @@ function initOnError() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
function initRuntimeSocketService() {
|
function initRuntimeSocketService() {
|
||||||
const hosts = "10.8.0.5,192.168.1.15,127.0.0.1";
|
const hosts = "192.168.1.15,127.0.0.1";
|
||||||
const port = "8090";
|
const port = "8090";
|
||||||
const id = "mp-weixin_07I937";
|
const id = "mp-weixin_JcUW_t";
|
||||||
const lazy = typeof swan !== "undefined";
|
const lazy = typeof swan !== "undefined";
|
||||||
let restoreError = lazy ? () => {
|
let restoreError = lazy ? () => {
|
||||||
} : initOnError();
|
} : initOnError();
|
||||||
|
|||||||
+19
-9
@@ -36,16 +36,11 @@ const getDeviceInfo = (deviceNo) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
const queryById = (id) => {
|
const queryById = (id) => {
|
||||||
|
common_vendor.index.__f__("log", "at config/user.js:59", `查询订单详情, orderId: ${id}`);
|
||||||
return config_http.request({
|
return config_http.request({
|
||||||
url: `/app/order/${id}`,
|
url: `/app/order/${id}`,
|
||||||
method: "get"
|
method: "get",
|
||||||
});
|
hideLoading: true
|
||||||
};
|
|
||||||
const overOrderById = (orderId) => {
|
|
||||||
common_vendor.index.__f__("log", "at config/user.js:78", `调用结束订单API, orderId: ${orderId}`);
|
|
||||||
return config_http.request({
|
|
||||||
url: `/app/order/close/${orderId}`,
|
|
||||||
method: "get"
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const rentPowerBank = (deviceNo, phone) => {
|
const rentPowerBank = (deviceNo, phone) => {
|
||||||
@@ -55,12 +50,27 @@ const rentPowerBank = (deviceNo, phone) => {
|
|||||||
data: { deviceNo, phone }
|
data: { deviceNo, phone }
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
const confirmPaymentAndRent = (orderId) => {
|
||||||
|
common_vendor.index.__f__("log", "at config/user.js:98", `确认支付并弹出充电宝, orderId: ${orderId}`);
|
||||||
|
return config_http.request({
|
||||||
|
url: `/app/device/confirmPaymentAndRent?orderId=${orderId}`,
|
||||||
|
method: "post"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const sendRentCommand = (orderId) => {
|
||||||
|
common_vendor.index.__f__("log", "at config/user.js:107", `直接发送租借指令, orderId: ${orderId}`);
|
||||||
|
return config_http.request({
|
||||||
|
url: `/app/device/sendRentCommand?orderId=${orderId}`,
|
||||||
|
method: "post"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
exports.confirmPaymentAndRent = confirmPaymentAndRent;
|
||||||
exports.getDeviceInfo = getDeviceInfo;
|
exports.getDeviceInfo = getDeviceInfo;
|
||||||
exports.getMyIndexInfo = getMyIndexInfo;
|
exports.getMyIndexInfo = getMyIndexInfo;
|
||||||
exports.getOrderList = getOrderList;
|
exports.getOrderList = getOrderList;
|
||||||
exports.login = login;
|
exports.login = login;
|
||||||
exports.overOrderById = overOrderById;
|
|
||||||
exports.queryById = queryById;
|
exports.queryById = queryById;
|
||||||
exports.queryHasOrder = queryHasOrder;
|
exports.queryHasOrder = queryHasOrder;
|
||||||
exports.rentPowerBank = rentPowerBank;
|
exports.rentPowerBank = rentPowerBank;
|
||||||
|
exports.sendRentCommand = sendRentCommand;
|
||||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/config/user.js.map
|
//# sourceMappingURL=../../.sourcemap/mp-weixin/config/user.js.map
|
||||||
|
|||||||
+18
-8
@@ -15,6 +15,16 @@ const _sfc_main = {
|
|||||||
let deviceNo = util_index.getQueryString(scanResult.path, "deviceNo");
|
let deviceNo = util_index.getQueryString(scanResult.path, "deviceNo");
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:64", "扫码路径:", scanResult.path);
|
common_vendor.index.__f__("log", "at pages/index/index.vue:64", "扫码路径:", scanResult.path);
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:65", "解析到的设备号:", deviceNo);
|
common_vendor.index.__f__("log", "at pages/index/index.vue:65", "解析到的设备号:", deviceNo);
|
||||||
|
if (!deviceNo) {
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: "无效的设备二维码",
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!common_vendor.index.getStorageSync("token")) {
|
||||||
|
await util_index.wxLogin();
|
||||||
|
}
|
||||||
const inUseRes = await common_vendor.index.request({
|
const inUseRes = await common_vendor.index.request({
|
||||||
url: `${common_vendor.index.getStorageSync("baseUrl") || "http://127.0.0.1:8080"}/app/order/inUse`,
|
url: `${common_vendor.index.getStorageSync("baseUrl") || "http://127.0.0.1:8080"}/app/order/inUse`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -23,14 +33,14 @@ const _sfc_main = {
|
|||||||
"Clientid": common_vendor.index.getStorageSync("client_id")
|
"Clientid": common_vendor.index.getStorageSync("client_id")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:77", "使用中订单检查结果:", JSON.stringify(inUseRes));
|
common_vendor.index.__f__("log", "at pages/index/index.vue:90", "使用中订单检查结果:", JSON.stringify(inUseRes));
|
||||||
if (inUseRes.statusCode === 200 && inUseRes.data.code === 200 && inUseRes.data.data) {
|
if (inUseRes.statusCode === 200 && inUseRes.data.code === 200 && inUseRes.data.data) {
|
||||||
const inUseOrder = inUseRes.data.data;
|
const inUseOrder = inUseRes.data.data;
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:82", "检测到使用中订单,准备跳转:", inUseOrder);
|
common_vendor.index.__f__("log", "at pages/index/index.vue:95", "检测到使用中订单,准备跳转:", inUseOrder);
|
||||||
common_vendor.index.reLaunch({
|
common_vendor.index.reLaunch({
|
||||||
url: `/pages/return/index?orderId=${inUseOrder.orderId}&deviceId=${deviceNo || inUseOrder.deviceNo}`
|
url: `/pages/return/index?orderId=${inUseOrder.orderId}&deviceId=${deviceNo || inUseOrder.deviceNo}`
|
||||||
});
|
});
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:88", "已发起页面跳转");
|
common_vendor.index.__f__("log", "at pages/index/index.vue:101", "已发起页面跳转");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const orderRes = await common_vendor.index.request({
|
const orderRes = await common_vendor.index.request({
|
||||||
@@ -41,21 +51,21 @@ const _sfc_main = {
|
|||||||
"Clientid": common_vendor.index.getStorageSync("client_id")
|
"Clientid": common_vendor.index.getStorageSync("client_id")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:102", "待支付订单检查结果:", JSON.stringify(orderRes));
|
common_vendor.index.__f__("log", "at pages/index/index.vue:115", "待支付订单检查结果:", JSON.stringify(orderRes));
|
||||||
if (orderRes.statusCode === 200 && orderRes.data.code === 200 && orderRes.data.data) {
|
if (orderRes.statusCode === 200 && orderRes.data.code === 200 && orderRes.data.data) {
|
||||||
const unpaidOrder = orderRes.data.data;
|
const unpaidOrder = orderRes.data.data;
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:107", "检测到待支付订单,准备跳转:", unpaidOrder);
|
common_vendor.index.__f__("log", "at pages/index/index.vue:120", "检测到待支付订单,准备跳转:", unpaidOrder);
|
||||||
common_vendor.index.navigateTo({
|
common_vendor.index.navigateTo({
|
||||||
url: `/pages/order/payment?orderId=${unpaidOrder.orderId}`
|
url: `/pages/order/payment?orderId=${unpaidOrder.orderId}`
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:113", "无待支付订单,跳转到设备检查页面, deviceNo:", deviceNo);
|
common_vendor.index.__f__("log", "at pages/index/index.vue:126", "无待支付订单,直接跳转到设备详情页面, deviceNo:", deviceNo);
|
||||||
common_vendor.index.navigateTo({
|
common_vendor.index.navigateTo({
|
||||||
url: `/pages/serve/bagCheck/index?deviceNo=${deviceNo}`
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
common_vendor.index.__f__("error", "at pages/index/index.vue:119", "扫码处理失败:", error);
|
common_vendor.index.__f__("error", "at pages/index/index.vue:132", "扫码处理失败:", error);
|
||||||
common_vendor.index.showToast({
|
common_vendor.index.showToast({
|
||||||
title: "扫码失败",
|
title: "扫码失败",
|
||||||
icon: "none"
|
icon: "none"
|
||||||
|
|||||||
+24
-12
@@ -17,13 +17,18 @@ const _sfc_main = {
|
|||||||
const res = await config_user.queryById(options.orderId);
|
const res = await config_user.queryById(options.orderId);
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
const orderData = res.data;
|
const orderData = res.data;
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/index.vue:76", "特定订单数据:", JSON.stringify(orderData));
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/index.vue:77", "特定订单的开始时间:", orderData.startTime);
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/index.vue:78", "特定订单的创建时间:", orderData.createTime);
|
||||||
|
const orderStartTime = orderData.startTime || orderData.createTime || "";
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/index.vue:82", "特定订单最终显示的开始时间:", orderStartTime);
|
||||||
const formattedOrder = {
|
const formattedOrder = {
|
||||||
orderNo: orderData.orderId,
|
orderNo: orderData.orderId,
|
||||||
status: orderData.orderStatus,
|
status: orderData.orderStatus,
|
||||||
deviceId: orderData.deviceNo,
|
deviceId: orderData.deviceNo,
|
||||||
startTime: orderData.createTime,
|
startTime: orderStartTime,
|
||||||
endTime: orderData.endTime || "",
|
endTime: orderData.endTime || "",
|
||||||
amount: orderData.amount || "0.00"
|
amount: orderData.payAmount || orderData.actualDeviceAmount || "0.00"
|
||||||
};
|
};
|
||||||
this.orderList = [formattedOrder, ...this.orderList];
|
this.orderList = [formattedOrder, ...this.orderList];
|
||||||
const tabIndex = this.OrderStatusTabs.findIndex(
|
const tabIndex = this.OrderStatusTabs.findIndex(
|
||||||
@@ -34,7 +39,7 @@ const _sfc_main = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
common_vendor.index.__f__("error", "at pages/order/index.vue:98", "获取订单详情失败:", error);
|
common_vendor.index.__f__("error", "at pages/order/index.vue:106", "获取订单详情失败:", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await this.getOrderList();
|
await this.getOrderList();
|
||||||
@@ -44,17 +49,24 @@ const _sfc_main = {
|
|||||||
try {
|
try {
|
||||||
const res = await config_user.getOrderList(statusList);
|
const res = await config_user.getOrderList(statusList);
|
||||||
if (res.code === 200 && res.data && res.data.records) {
|
if (res.code === 200 && res.data && res.data.records) {
|
||||||
this.orderList = res.data.records.map((item) => ({
|
common_vendor.index.__f__("log", "at pages/order/index.vue:118", "API返回的订单列表数据:", JSON.stringify(res.data.records));
|
||||||
orderNo: item.orderId,
|
this.orderList = res.data.records.map((item) => {
|
||||||
status: item.orderStatus,
|
common_vendor.index.__f__("log", "at pages/order/index.vue:122", `订单 ${item.orderId} 的开始时间:`, item.startTime);
|
||||||
deviceId: item.deviceNo,
|
common_vendor.index.__f__("log", "at pages/order/index.vue:123", `订单 ${item.orderId} 的创建时间:`, item.createTime);
|
||||||
startTime: item.createTime,
|
const orderStartTime = item.startTime || item.createTime || "";
|
||||||
endTime: item.endTime || "",
|
common_vendor.index.__f__("log", "at pages/order/index.vue:127", `订单 ${item.orderId} 最终显示的开始时间:`, orderStartTime);
|
||||||
amount: item.amount || "0.00"
|
return {
|
||||||
}));
|
orderNo: item.orderId,
|
||||||
|
status: item.orderStatus,
|
||||||
|
deviceId: item.deviceNo,
|
||||||
|
startTime: orderStartTime,
|
||||||
|
endTime: item.endTime || "",
|
||||||
|
amount: item.payAmount || item.actualDeviceAmount || "0.00"
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
common_vendor.index.__f__("error", "at pages/order/index.vue:121", "获取订单列表失败:", error);
|
common_vendor.index.__f__("error", "at pages/order/index.vue:140", "获取订单列表失败:", error);
|
||||||
common_vendor.index.showToast({
|
common_vendor.index.showToast({
|
||||||
title: "获取订单列表失败",
|
title: "获取订单列表失败",
|
||||||
icon: "none"
|
icon: "none"
|
||||||
|
|||||||
+75
-90
@@ -98,27 +98,62 @@ const _sfc_main = {
|
|||||||
},
|
},
|
||||||
// 处理支付
|
// 处理支付
|
||||||
async handlePayment() {
|
async handlePayment() {
|
||||||
|
var _a;
|
||||||
try {
|
try {
|
||||||
common_vendor.index.showLoading({
|
common_vendor.index.showLoading({
|
||||||
title: "处理中"
|
title: "处理中"
|
||||||
});
|
});
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/payment.vue:206", "开始处理支付,订单号:", this.orderId);
|
||||||
const res = await common_vendor.index.request({
|
const res = await common_vendor.index.request({
|
||||||
url: `${common_vendor.index.getStorageSync("baseUrl") || "http://127.0.0.1:8080"}/app/wx-payment/create/${this.orderInfo.orderNo}`,
|
url: `${common_vendor.index.getStorageSync("baseUrl") || "http://127.0.0.1:8080"}/app/payment/${this.orderInfo.orderNo}`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
header: {
|
header: {
|
||||||
"Authorization": "Bearer " + common_vendor.index.getStorageSync("token"),
|
"Authorization": "Bearer " + common_vendor.index.getStorageSync("token"),
|
||||||
"Clientid": common_vendor.index.getStorageSync("client_id")
|
"Clientid": common_vendor.index.getStorageSync("client_id")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/payment.vue:218", "支付API返回结果:", res.data);
|
||||||
if (res.statusCode === 200 && res.data.code === 200) {
|
if (res.statusCode === 200 && res.data.code === 200) {
|
||||||
common_vendor.index.hideLoading();
|
const payParams = res.data.data;
|
||||||
common_vendor.index.redirectTo({
|
common_vendor.index.__f__("log", "at pages/order/payment.vue:224", "准备调用微信支付,参数:", payParams);
|
||||||
url: `/pages/order/success?orderId=${this.orderId}`
|
if (!payParams.timeStamp || !payParams.nonceStr || !payParams.packageValue || !payParams.paySign) {
|
||||||
|
common_vendor.index.__f__("error", "at pages/order/payment.vue:229", "支付参数不完整:", payParams);
|
||||||
|
throw new Error("支付参数不完整,请联系客服");
|
||||||
|
}
|
||||||
|
common_vendor.index.requestPayment({
|
||||||
|
provider: "wxpay",
|
||||||
|
timeStamp: payParams.timeStamp,
|
||||||
|
nonceStr: payParams.nonceStr,
|
||||||
|
package: payParams.packageValue,
|
||||||
|
// 后端返回的是packageValue字段
|
||||||
|
signType: payParams.signType || "MD5",
|
||||||
|
paySign: payParams.paySign,
|
||||||
|
success: (payRes) => {
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/payment.vue:242", "支付成功:", payRes);
|
||||||
|
common_vendor.index.hideLoading();
|
||||||
|
this.pollOrderStatus();
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
common_vendor.index.__f__("error", "at pages/order/payment.vue:248", "支付失败:", err);
|
||||||
|
common_vendor.index.hideLoading();
|
||||||
|
if (err.errMsg === "requestPayment:fail cancel") {
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/payment.vue:252", "用户取消了支付");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: err.errMsg || "支付失败",
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
},
|
||||||
|
complete: () => {
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/payment.vue:261", "支付流程结束");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
throw new Error(res.data.msg || "支付失败");
|
throw new Error(((_a = res.data) == null ? void 0 : _a.msg) || "支付请求失败");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
common_vendor.index.__f__("error", "at pages/order/payment.vue:268", "支付处理错误:", error);
|
||||||
common_vendor.index.hideLoading();
|
common_vendor.index.hideLoading();
|
||||||
common_vendor.index.showToast({
|
common_vendor.index.showToast({
|
||||||
title: error.message || "支付失败",
|
title: error.message || "支付失败",
|
||||||
@@ -126,92 +161,23 @@ const _sfc_main = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 发送租借指令
|
|
||||||
async sendRentCommand() {
|
|
||||||
try {
|
|
||||||
common_vendor.index.showLoading({
|
|
||||||
title: "处理中"
|
|
||||||
});
|
|
||||||
const res = await this.sendRentRequest();
|
|
||||||
if (res.code === 200) {
|
|
||||||
common_vendor.index.hideLoading();
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: "租借成功",
|
|
||||||
icon: "success"
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
common_vendor.index.redirectTo({
|
|
||||||
url: `/pages/order/index?orderId=${this.orderId}`
|
|
||||||
});
|
|
||||||
}, 1500);
|
|
||||||
} else {
|
|
||||||
throw new Error(res.msg || "租借失败");
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
common_vendor.index.hideLoading();
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: error.message || "租借失败",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 发送租借请求
|
|
||||||
sendRentRequest() {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
common_vendor.index.request({
|
|
||||||
url: `${common_vendor.index.getStorageSync("baseUrl") || "http://127.0.0.1:8080"}/app/device/sendRentCommand`,
|
|
||||||
method: "POST",
|
|
||||||
data: {
|
|
||||||
orderId: this.orderId
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
|
||||||
"Authorization": "Bearer " + common_vendor.index.getStorageSync("token"),
|
|
||||||
"Clientid": common_vendor.index.getStorageSync("client_id")
|
|
||||||
},
|
|
||||||
success(res) {
|
|
||||||
if (res.statusCode === 200) {
|
|
||||||
resolve(res.data);
|
|
||||||
} else {
|
|
||||||
reject(new Error("请求失败"));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail(err) {
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 格式化时间
|
|
||||||
formatTime(date) {
|
|
||||||
const year = date.getFullYear();
|
|
||||||
const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
||||||
const day = date.getDate().toString().padStart(2, "0");
|
|
||||||
const hour = date.getHours().toString().padStart(2, "0");
|
|
||||||
const minute = date.getMinutes().toString().padStart(2, "0");
|
|
||||||
return `${year}-${month}-${day} ${hour}:${minute}`;
|
|
||||||
},
|
|
||||||
// 轮询订单状态
|
// 轮询订单状态
|
||||||
async pollOrderStatus() {
|
async pollOrderStatus() {
|
||||||
let retryCount = 0;
|
let retryCount = 0;
|
||||||
const maxRetries = 10;
|
const maxRetries = 30;
|
||||||
const interval = 1e3;
|
const interval = 2e3;
|
||||||
const checkStatus = async () => {
|
const checkStatus = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await common_vendor.index.request({
|
const res = await config_user.queryById(this.orderId);
|
||||||
url: `${common_vendor.index.getStorageSync("baseUrl") || "http://127.0.0.1:8080"}/app/payment/status/${this.orderInfo.orderNo}`,
|
common_vendor.index.__f__("log", "at pages/order/payment.vue:287", "轮询订单状态结果:", res);
|
||||||
method: "GET",
|
if (res.code === 200 && res.data) {
|
||||||
header: {
|
const orderData = res.data;
|
||||||
"Authorization": "Bearer " + common_vendor.index.getStorageSync("token"),
|
if (orderData.orderStatus === "IN_USED" || orderData.orderStatus === "PAYMENT_SUCCESSFUL") {
|
||||||
"Clientid": common_vendor.index.getStorageSync("client_id")
|
common_vendor.index.__f__("log", "at pages/order/payment.vue:294", "支付成功,订单状态:", orderData.orderStatus);
|
||||||
}
|
|
||||||
});
|
|
||||||
if (res.statusCode === 200 && res.data.code === 200) {
|
|
||||||
const orderData = res.data.data;
|
|
||||||
if (orderData.orderStatus === "IN_USED") {
|
|
||||||
common_vendor.index.showToast({
|
common_vendor.index.showToast({
|
||||||
title: "支付成功",
|
title: "支付成功,充电宝已弹出",
|
||||||
icon: "success"
|
icon: "success",
|
||||||
|
duration: 2e3
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
common_vendor.index.redirectTo({
|
common_vendor.index.redirectTo({
|
||||||
@@ -223,15 +189,34 @@ const _sfc_main = {
|
|||||||
}
|
}
|
||||||
if (retryCount < maxRetries) {
|
if (retryCount < maxRetries) {
|
||||||
retryCount++;
|
retryCount++;
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/payment.vue:314", `第${retryCount}次轮询,等待订单状态更新...`);
|
||||||
setTimeout(checkStatus, interval);
|
setTimeout(checkStatus, interval);
|
||||||
} else {
|
} else {
|
||||||
throw new Error("订单状态查询超时");
|
common_vendor.index.__f__("error", "at pages/order/payment.vue:317", "轮询订单状态超时");
|
||||||
|
common_vendor.index.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: '订单状态查询超时,请在"我的订单"中查看订单状态',
|
||||||
|
showCancel: false,
|
||||||
|
success: function(res2) {
|
||||||
|
if (res2.confirm) {
|
||||||
|
common_vendor.index.redirectTo({
|
||||||
|
url: "/pages/order/index"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
common_vendor.index.showToast({
|
common_vendor.index.__f__("error", "at pages/order/payment.vue:332", "查询订单状态失败:", error);
|
||||||
title: error.message || "查询订单状态失败",
|
if (retryCount < maxRetries) {
|
||||||
icon: "none"
|
retryCount++;
|
||||||
});
|
setTimeout(checkStatus, interval);
|
||||||
|
} else {
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: "查询订单状态失败",
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
checkStatus();
|
checkStatus();
|
||||||
|
|||||||
@@ -0,0 +1,108 @@
|
|||||||
|
"use strict";
|
||||||
|
const common_vendor = require("../../common/vendor.js");
|
||||||
|
const config_user = require("../../config/user.js");
|
||||||
|
const _sfc_main = {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
orderId: "",
|
||||||
|
orderInfo: {
|
||||||
|
orderNo: "",
|
||||||
|
deviceNo: "",
|
||||||
|
startTime: "",
|
||||||
|
usedTime: "",
|
||||||
|
currentFee: "0.00",
|
||||||
|
deposit: "99.00",
|
||||||
|
refundAmount: "99.00",
|
||||||
|
endTime: ""
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad(options) {
|
||||||
|
if (options && options.orderId) {
|
||||||
|
this.orderId = options.orderId;
|
||||||
|
this.loadOrderInfo();
|
||||||
|
} else {
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: "订单信息不存在",
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
this.goToHome();
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async loadOrderInfo() {
|
||||||
|
try {
|
||||||
|
common_vendor.index.showLoading({
|
||||||
|
title: "加载中"
|
||||||
|
});
|
||||||
|
const res = await config_user.queryById(this.orderId);
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/return-success.vue:101", "归还成功页面获取的订单数据:", JSON.stringify(res.data));
|
||||||
|
if (res.code === 200 && res.data) {
|
||||||
|
const orderData = res.data;
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/return-success.vue:105", "订单的开始时间:", orderData.startTime);
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/return-success.vue:106", "订单的创建时间:", orderData.createTime);
|
||||||
|
const deposit = 99;
|
||||||
|
const fee = parseFloat(orderData.currentFee || orderData.actualDeviceAmount || orderData.payAmount || "0");
|
||||||
|
const refundAmount = (deposit - fee).toFixed(2);
|
||||||
|
this.orderInfo = {
|
||||||
|
orderNo: orderData.orderNo || orderData.orderId,
|
||||||
|
deviceNo: orderData.deviceNo,
|
||||||
|
startTime: orderData.startTime || orderData.createTime || "-",
|
||||||
|
usedTime: orderData.usedTime || "-",
|
||||||
|
currentFee: orderData.currentFee || orderData.actualDeviceAmount || orderData.payAmount || "0.00",
|
||||||
|
deposit: deposit.toFixed(2),
|
||||||
|
refundAmount,
|
||||||
|
endTime: orderData.endTime || this.formatTime(/* @__PURE__ */ new Date())
|
||||||
|
};
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/return-success.vue:124", "处理后的订单信息:", JSON.stringify(this.orderInfo));
|
||||||
|
} else {
|
||||||
|
throw new Error("获取订单信息失败");
|
||||||
|
}
|
||||||
|
common_vendor.index.hideLoading();
|
||||||
|
} catch (error) {
|
||||||
|
common_vendor.index.hideLoading();
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: error.message || "获取订单信息失败",
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
formatTime(date) {
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
||||||
|
const day = date.getDate().toString().padStart(2, "0");
|
||||||
|
const hour = date.getHours().toString().padStart(2, "0");
|
||||||
|
const minute = date.getMinutes().toString().padStart(2, "0");
|
||||||
|
const second = date.getSeconds().toString().padStart(2, "0");
|
||||||
|
return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
|
||||||
|
},
|
||||||
|
goToHome() {
|
||||||
|
common_vendor.index.switchTab({
|
||||||
|
url: "/pages/index/index"
|
||||||
|
});
|
||||||
|
},
|
||||||
|
goToOrderList() {
|
||||||
|
common_vendor.index.redirectTo({
|
||||||
|
url: "/pages/order/index"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||||
|
return {
|
||||||
|
a: common_vendor.t($data.orderInfo.orderNo || "-"),
|
||||||
|
b: common_vendor.t($data.orderInfo.deviceNo || "-"),
|
||||||
|
c: common_vendor.t($data.orderInfo.usedTime || "-"),
|
||||||
|
d: common_vendor.t($data.orderInfo.currentFee || "0.00"),
|
||||||
|
e: common_vendor.t($data.orderInfo.endTime || "-"),
|
||||||
|
f: common_vendor.t($data.orderInfo.deposit || "99.00"),
|
||||||
|
g: common_vendor.t($data.orderInfo.refundAmount || "99.00"),
|
||||||
|
h: common_vendor.o((...args) => $options.goToHome && $options.goToHome(...args)),
|
||||||
|
i: common_vendor.o((...args) => $options.goToOrderList && $options.goToOrderList(...args))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-eb1f1ee2"]]);
|
||||||
|
wx.createPage(MiniProgramPage);
|
||||||
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/order/return-success.js.map
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "归还成功",
|
||||||
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
|
"navigationBarTextStyle": "black",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<view class="success-container data-v-eb1f1ee2"><view class="status-card data-v-eb1f1ee2"><view class="status-icon success data-v-eb1f1ee2"></view><view class="status-text data-v-eb1f1ee2">归还成功</view><view class="status-desc data-v-eb1f1ee2">您的充电宝已归还,押金已退回</view></view><view class="order-card data-v-eb1f1ee2"><view class="card-title data-v-eb1f1ee2">订单信息</view><view class="info-item data-v-eb1f1ee2"><text class="label data-v-eb1f1ee2">订单号</text><text class="value data-v-eb1f1ee2">{{a}}</text></view><view class="info-item data-v-eb1f1ee2"><text class="label data-v-eb1f1ee2">设备号</text><text class="value data-v-eb1f1ee2">{{b}}</text></view><view class="info-item data-v-eb1f1ee2"><text class="label data-v-eb1f1ee2">使用时长</text><text class="value data-v-eb1f1ee2">{{c}}</text></view><view class="info-item data-v-eb1f1ee2"><text class="label data-v-eb1f1ee2">费用</text><text class="value data-v-eb1f1ee2">¥{{d}}</text></view><view class="info-item data-v-eb1f1ee2"><text class="label data-v-eb1f1ee2">归还时间</text><text class="value data-v-eb1f1ee2">{{e}}</text></view></view><view class="refund-card data-v-eb1f1ee2"><view class="card-title data-v-eb1f1ee2">退还信息</view><view class="info-item data-v-eb1f1ee2"><text class="label data-v-eb1f1ee2">押金</text><text class="value data-v-eb1f1ee2">¥{{f}}</text></view><view class="info-item data-v-eb1f1ee2"><text class="label data-v-eb1f1ee2">退还金额</text><text class="value highlight data-v-eb1f1ee2">¥{{g}}</text></view><view class="info-item data-v-eb1f1ee2"><text class="label data-v-eb1f1ee2">退还状态</text><text class="value success data-v-eb1f1ee2">已退还</text></view></view><view class="button-group data-v-eb1f1ee2"><button class="primary-btn data-v-eb1f1ee2" bindtap="{{h}}">返回首页</button><button class="secondary-btn data-v-eb1f1ee2" bindtap="{{i}}">查看订单</button></view></view>
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
/**
|
||||||
|
* 这里是uni-app内置的常用样式变量
|
||||||
|
*
|
||||||
|
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||||
|
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||||
|
*
|
||||||
|
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||||
|
*/
|
||||||
|
/* 颜色变量 */
|
||||||
|
/* 行为相关颜色 */
|
||||||
|
/* 文字基本颜色 */
|
||||||
|
/* 背景颜色 */
|
||||||
|
/* 边框颜色 */
|
||||||
|
/* 尺寸变量 */
|
||||||
|
/* 文字尺寸 */
|
||||||
|
/* 图片尺寸 */
|
||||||
|
/* Border Radius */
|
||||||
|
/* 水平间距 */
|
||||||
|
/* 垂直间距 */
|
||||||
|
/* 透明度 */
|
||||||
|
/* 文章场景相关 */
|
||||||
|
.success-container.data-v-eb1f1ee2 {
|
||||||
|
padding: 20px;
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
.status-card.data-v-eb1f1ee2 {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 30px;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
||||||
|
}
|
||||||
|
.status-card .status-icon.data-v-eb1f1ee2 {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
margin: 0 auto 16px;
|
||||||
|
}
|
||||||
|
.status-card .status-icon.success.data-v-eb1f1ee2 {
|
||||||
|
background-color: #07c160;
|
||||||
|
border-radius: 50%;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.status-card .status-icon.success.data-v-eb1f1ee2::after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
width: 30px;
|
||||||
|
height: 20px;
|
||||||
|
border: 3px solid #fff;
|
||||||
|
border-top: none;
|
||||||
|
border-right: none;
|
||||||
|
transform-origin: center;
|
||||||
|
transform: translate(-50%, -70%) rotate(-45deg);
|
||||||
|
}
|
||||||
|
.status-card .status-text.data-v-eb1f1ee2 {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #07c160;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
.status-card .status-desc.data-v-eb1f1ee2 {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.order-card.data-v-eb1f1ee2, .refund-card.data-v-eb1f1ee2 {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
||||||
|
}
|
||||||
|
.order-card .card-title.data-v-eb1f1ee2, .refund-card .card-title.data-v-eb1f1ee2 {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
color: #333;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
.order-card .info-item.data-v-eb1f1ee2, .refund-card .info-item.data-v-eb1f1ee2 {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
.order-card .info-item.data-v-eb1f1ee2:last-child, .refund-card .info-item.data-v-eb1f1ee2:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.order-card .info-item .label.data-v-eb1f1ee2, .refund-card .info-item .label.data-v-eb1f1ee2 {
|
||||||
|
color: #666;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.order-card .info-item .value.data-v-eb1f1ee2, .refund-card .info-item .value.data-v-eb1f1ee2 {
|
||||||
|
color: #333;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.order-card .info-item .value.highlight.data-v-eb1f1ee2, .refund-card .info-item .value.highlight.data-v-eb1f1ee2 {
|
||||||
|
color: #ff6b00;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
.order-card .info-item .value.success.data-v-eb1f1ee2, .refund-card .info-item .value.success.data-v-eb1f1ee2 {
|
||||||
|
color: #07c160;
|
||||||
|
}
|
||||||
|
.button-group.data-v-eb1f1ee2 {
|
||||||
|
margin-top: 30px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
.button-group .primary-btn.data-v-eb1f1ee2 {
|
||||||
|
background-color: #07c160;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
border-radius: 24px;
|
||||||
|
padding: 12px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
.button-group .primary-btn.data-v-eb1f1ee2:active {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
.button-group .secondary-btn.data-v-eb1f1ee2 {
|
||||||
|
background-color: #fff;
|
||||||
|
color: #07c160;
|
||||||
|
border: 1px solid #07c160;
|
||||||
|
border-radius: 24px;
|
||||||
|
padding: 12px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
.button-group .secondary-btn.data-v-eb1f1ee2:active {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
+68
-7
@@ -5,13 +5,20 @@ const _sfc_main = {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
orderId: "",
|
orderId: "",
|
||||||
orderInfo: {}
|
orderInfo: {},
|
||||||
|
isLoading: true,
|
||||||
|
deviceMessage: "正在准备您的设备,请稍候...",
|
||||||
|
hasTriggeredDevice: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
if (options && options.orderId) {
|
if (options && options.orderId) {
|
||||||
this.orderId = options.orderId;
|
this.orderId = options.orderId;
|
||||||
this.loadOrderInfo();
|
this.loadOrderInfo();
|
||||||
|
common_vendor.index.$once("orderSuccess:" + this.orderId, () => {
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/success.vue:67", "已经触发过弹出逻辑,不再重复触发");
|
||||||
|
this.hasTriggeredDevice = true;
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
common_vendor.index.showToast({
|
common_vendor.index.showToast({
|
||||||
title: "订单信息不存在",
|
title: "订单信息不存在",
|
||||||
@@ -34,9 +41,19 @@ const _sfc_main = {
|
|||||||
this.orderInfo = {
|
this.orderInfo = {
|
||||||
orderNo: orderData.orderNo || orderData.orderId,
|
orderNo: orderData.orderNo || orderData.orderId,
|
||||||
deviceNo: orderData.deviceNo,
|
deviceNo: orderData.deviceNo,
|
||||||
amount: orderData.amount,
|
amount: orderData.payAmount || orderData.amount,
|
||||||
payTime: this.formatTime(/* @__PURE__ */ new Date())
|
payTime: orderData.payTime || this.formatTime(/* @__PURE__ */ new Date())
|
||||||
};
|
};
|
||||||
|
if (orderData.orderStatus === "IN_USED") {
|
||||||
|
this.deviceMessage = "设备已弹出,请取走您的充电宝";
|
||||||
|
this.isLoading = false;
|
||||||
|
if (!this.hasTriggeredDevice) {
|
||||||
|
common_vendor.index.$emit("orderSuccess:" + this.orderId);
|
||||||
|
this.hasTriggeredDevice = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.triggerDeviceEject();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error("获取订单信息失败");
|
throw new Error("获取订单信息失败");
|
||||||
}
|
}
|
||||||
@@ -49,6 +66,47 @@ const _sfc_main = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 触发弹出充电宝
|
||||||
|
async triggerDeviceEject() {
|
||||||
|
if (this.hasTriggeredDevice) {
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/success.vue:129", "已经触发过弹出充电宝,不重复触发");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.hasTriggeredDevice = true;
|
||||||
|
common_vendor.index.$emit("orderSuccess:" + this.orderId);
|
||||||
|
this.isLoading = true;
|
||||||
|
this.deviceMessage = "正在准备您的设备,请稍候...";
|
||||||
|
try {
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/success.vue:139", `准备触发弹出充电宝,orderId: ${this.orderId}`);
|
||||||
|
let result;
|
||||||
|
try {
|
||||||
|
result = await config_user.confirmPaymentAndRent(this.orderId);
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/success.vue:145", "确认支付并弹出充电宝结果:", JSON.stringify(result));
|
||||||
|
} catch (error) {
|
||||||
|
common_vendor.index.__f__("error", "at pages/order/success.vue:147", "确认支付并弹出失败,尝试备用方法:", error);
|
||||||
|
result = await config_user.sendRentCommand(this.orderId);
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/success.vue:150", "发送租借指令结果:", JSON.stringify(result));
|
||||||
|
}
|
||||||
|
if (result && result.code === 200) {
|
||||||
|
this.deviceMessage = "设备已弹出,请取走您的充电宝";
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: "充电宝已弹出",
|
||||||
|
icon: "success"
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
throw new Error(result && result.msg || "弹出充电宝失败");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
common_vendor.index.__f__("error", "at pages/order/success.vue:163", "弹出充电宝错误:", error);
|
||||||
|
this.deviceMessage = "弹出设备失败,请联系客服";
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: error.message || "弹出充电宝失败,请联系客服",
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
this.isLoading = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
formatTime(date) {
|
formatTime(date) {
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
||||||
@@ -71,14 +129,17 @@ const _sfc_main = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||||
return {
|
return common_vendor.e({
|
||||||
a: common_vendor.t($data.orderInfo.orderNo || "-"),
|
a: common_vendor.t($data.orderInfo.orderNo || "-"),
|
||||||
b: common_vendor.t($data.orderInfo.deviceNo || "-"),
|
b: common_vendor.t($data.orderInfo.deviceNo || "-"),
|
||||||
c: common_vendor.t($data.orderInfo.amount || "0.00"),
|
c: common_vendor.t($data.orderInfo.amount || "0.00"),
|
||||||
d: common_vendor.t($data.orderInfo.payTime || "-"),
|
d: common_vendor.t($data.orderInfo.payTime || "-"),
|
||||||
e: common_vendor.o((...args) => $options.goToHome && $options.goToHome(...args)),
|
e: common_vendor.t($data.deviceMessage),
|
||||||
f: common_vendor.o((...args) => $options.goToOrderList && $options.goToOrderList(...args))
|
f: $data.isLoading
|
||||||
};
|
}, $data.isLoading ? {} : {}, {
|
||||||
|
g: common_vendor.o((...args) => $options.goToHome && $options.goToHome(...args)),
|
||||||
|
h: common_vendor.o((...args) => $options.goToOrderList && $options.goToOrderList(...args))
|
||||||
|
});
|
||||||
}
|
}
|
||||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2795c576"]]);
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2795c576"]]);
|
||||||
wx.createPage(MiniProgramPage);
|
wx.createPage(MiniProgramPage);
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
<view class="success-container data-v-2795c576"><view class="status-card data-v-2795c576"><view class="status-icon success data-v-2795c576"></view><view class="status-text data-v-2795c576">支付成功</view><view class="status-desc data-v-2795c576">您的订单已支付成功</view></view><view class="order-card data-v-2795c576"><view class="card-title data-v-2795c576">订单信息</view><view class="info-item data-v-2795c576"><text class="label data-v-2795c576">订单号</text><text class="value data-v-2795c576">{{a}}</text></view><view class="info-item data-v-2795c576"><text class="label data-v-2795c576">设备号</text><text class="value data-v-2795c576">{{b}}</text></view><view class="info-item data-v-2795c576"><text class="label data-v-2795c576">支付金额</text><text class="value data-v-2795c576">¥{{c}}</text></view><view class="info-item data-v-2795c576"><text class="label data-v-2795c576">支付时间</text><text class="value data-v-2795c576">{{d}}</text></view></view><view class="button-group data-v-2795c576"><button class="primary-btn data-v-2795c576" bindtap="{{e}}">返回首页</button><button class="secondary-btn data-v-2795c576" bindtap="{{f}}">查看订单</button></view></view>
|
<view class="success-container data-v-2795c576"><view class="status-card data-v-2795c576"><view class="status-icon success data-v-2795c576"></view><view class="status-text data-v-2795c576">支付成功</view><view class="status-desc data-v-2795c576">您的订单已支付成功</view></view><view class="order-card data-v-2795c576"><view class="card-title data-v-2795c576">订单信息</view><view class="info-item data-v-2795c576"><text class="label data-v-2795c576">订单号</text><text class="value data-v-2795c576">{{a}}</text></view><view class="info-item data-v-2795c576"><text class="label data-v-2795c576">设备号</text><text class="value data-v-2795c576">{{b}}</text></view><view class="info-item data-v-2795c576"><text class="label data-v-2795c576">支付金额</text><text class="value data-v-2795c576">¥{{c}}</text></view><view class="info-item data-v-2795c576"><text class="label data-v-2795c576">支付时间</text><text class="value data-v-2795c576">{{d}}</text></view></view><view class="device-status data-v-2795c576"><view class="status-message data-v-2795c576">{{e}}</view><view wx:if="{{f}}" class="loading-animation data-v-2795c576"><view class="loading-circle data-v-2795c576"></view></view></view><view class="button-group data-v-2795c576"><button class="primary-btn data-v-2795c576" bindtap="{{g}}">返回首页</button><button class="secondary-btn data-v-2795c576" bindtap="{{h}}">查看订单</button></view></view>
|
||||||
@@ -93,6 +93,40 @@
|
|||||||
color: #333;
|
color: #333;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
.device-status.data-v-2795c576 {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.device-status .status-message.data-v-2795c576 {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
.device-status .loading-animation.data-v-2795c576 {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
.device-status .loading-animation .loading-circle.data-v-2795c576 {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 3px solid #f0f0f0;
|
||||||
|
border-top-color: #07c160;
|
||||||
|
animation: spin-2795c576 1s linear infinite;
|
||||||
|
}
|
||||||
|
@keyframes spin-2795c576 {
|
||||||
|
0% {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
.button-group.data-v-2795c576 {
|
.button-group.data-v-2795c576 {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
+133
-96
@@ -8,39 +8,62 @@ const _sfc_main = {
|
|||||||
orderInfo: {
|
orderInfo: {
|
||||||
orderId: "",
|
orderId: "",
|
||||||
startTime: "",
|
startTime: "",
|
||||||
|
_rawStartTime: "",
|
||||||
|
// 用于调试
|
||||||
usedTime: "0分钟",
|
usedTime: "0分钟",
|
||||||
currentFee: "0.00"
|
currentFee: "0.00",
|
||||||
|
orderStatus: "in_used"
|
||||||
|
// 默认状态为使用中
|
||||||
},
|
},
|
||||||
unlocking: false,
|
timer: null,
|
||||||
timer: null
|
statusCheckTimer: null,
|
||||||
|
maxStatusChecks: 30,
|
||||||
|
// 最多检查30次
|
||||||
|
currentStatusChecks: 0,
|
||||||
|
statusCheckInterval: 5e3
|
||||||
|
// 5秒检查一次
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
common_vendor.index.__f__("log", "at pages/return/index.vue:77", "Return page loaded with options:", JSON.stringify(options));
|
common_vendor.index.__f__("log", "at pages/return/index.vue:93", "Return page loaded with options:", JSON.stringify(options));
|
||||||
this.orderInfo.orderId = options.orderId || "";
|
this.orderInfo.orderId = options.orderId || "";
|
||||||
this.deviceId = options.deviceId || "";
|
this.deviceId = options.deviceNo || options.deviceId || "";
|
||||||
common_vendor.index.__f__("log", "at pages/return/index.vue:83", `初始化参数: orderId=${this.orderInfo.orderId}, deviceId=${this.deviceId}`);
|
common_vendor.index.__f__("log", "at pages/return/index.vue:99", `初始化参数: orderId=${this.orderInfo.orderId}, deviceId=${this.deviceId}`);
|
||||||
if (!this.orderInfo.orderId && this.deviceId) {
|
if (!this.orderInfo.orderId && this.deviceId) {
|
||||||
this.getOrderByDevice();
|
this.getOrderByDevice();
|
||||||
} else if (this.orderInfo.orderId) {
|
} else if (this.orderInfo.orderId) {
|
||||||
this.getOrderDetails();
|
this.getOrderDetails();
|
||||||
this.startTimer();
|
this.startTimer();
|
||||||
|
this.startStatusCheckTimer();
|
||||||
} else {
|
} else {
|
||||||
common_vendor.index.showToast({
|
common_vendor.index.showToast({
|
||||||
title: "缺少订单信息",
|
title: "缺少订单信息",
|
||||||
icon: "none"
|
icon: "none"
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
common_vendor.index.reLaunch({
|
this.goToHome();
|
||||||
url: "/pages/index/index"
|
|
||||||
});
|
|
||||||
}, 1500);
|
}, 1500);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
this.clearTimer();
|
this.clearTimer();
|
||||||
|
this.clearStatusCheckTimer();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 根据订单状态获取对应的文字显示
|
||||||
|
getOrderStatusText() {
|
||||||
|
const statusMap = {
|
||||||
|
"waiting_for_payment": "待支付",
|
||||||
|
"payment_in_progress": "支付中",
|
||||||
|
"payment_successful": "支付成功",
|
||||||
|
"in_used": "使用中",
|
||||||
|
"payment_failed": "支付失败",
|
||||||
|
"order_cancelled": "订单取消",
|
||||||
|
"used_done": "订单完成",
|
||||||
|
"used_down": "订单完成"
|
||||||
|
};
|
||||||
|
return statusMap[this.orderInfo.orderStatus] || "使用中";
|
||||||
|
},
|
||||||
// 获取订单详情
|
// 获取订单详情
|
||||||
async getOrderDetails() {
|
async getOrderDetails() {
|
||||||
try {
|
try {
|
||||||
@@ -48,43 +71,38 @@ const _sfc_main = {
|
|||||||
if (!this.orderInfo.orderId) {
|
if (!this.orderInfo.orderId) {
|
||||||
throw new Error("订单ID不能为空");
|
throw new Error("订单ID不能为空");
|
||||||
}
|
}
|
||||||
common_vendor.index.__f__("log", "at pages/return/index.vue:122", "请求订单详情, orderId:", this.orderInfo.orderId);
|
common_vendor.index.__f__("log", "at pages/return/index.vue:155", "请求订单详情, orderId:", this.orderInfo.orderId);
|
||||||
const result = await config_user.queryById(this.orderInfo.orderId);
|
const result = await config_user.queryById(this.orderInfo.orderId);
|
||||||
common_vendor.index.__f__("log", "at pages/return/index.vue:124", "订单详情结果:", JSON.stringify(result));
|
common_vendor.index.__f__("log", "at pages/return/index.vue:157", "订单详情结果:", JSON.stringify(result));
|
||||||
if (result.code === 200 && result.data) {
|
if (result.code === 200 && result.data) {
|
||||||
const orderData = result.data;
|
const orderData = result.data;
|
||||||
common_vendor.index.__f__("log", "at pages/return/index.vue:128", "订单数据:", JSON.stringify(orderData));
|
common_vendor.index.__f__("log", "at pages/return/index.vue:161", "订单原始数据:", orderData);
|
||||||
this.updateOrderInfo(orderData);
|
common_vendor.index.__f__("log", "at pages/return/index.vue:162", "开始时间字段:", orderData.startTime, typeof orderData.startTime);
|
||||||
const rawTime = orderData.startTime;
|
if (orderData.orderStatus) {
|
||||||
common_vendor.index.__f__("log", "at pages/return/index.vue:135", "开始时间:", rawTime);
|
this.orderInfo.orderStatus = orderData.orderStatus;
|
||||||
if (rawTime) {
|
|
||||||
try {
|
|
||||||
const date = new Date(rawTime.replace(" ", "T"));
|
|
||||||
if (!isNaN(date.getTime())) {
|
|
||||||
this.orderInfo.startTime = this.formatTime(date);
|
|
||||||
} else {
|
|
||||||
this.orderInfo.startTime = rawTime;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
common_vendor.index.__f__("error", "at pages/return/index.vue:148", "时间格式化错误:", e);
|
|
||||||
this.orderInfo.startTime = rawTime;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.orderInfo.startTime = "未知";
|
|
||||||
}
|
}
|
||||||
|
if (orderData.orderStatus && orderData.orderStatus === "used_down") {
|
||||||
|
this.clearTimer();
|
||||||
|
this.clearStatusCheckTimer();
|
||||||
|
common_vendor.index.__f__("log", "at pages/return/index.vue:176", "订单已完成,准备跳转到归还成功页面");
|
||||||
|
common_vendor.index.redirectTo({
|
||||||
|
url: `/pages/order/return-success?orderId=${this.orderInfo.orderId}`
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.updateOrderInfo(orderData);
|
||||||
|
common_vendor.index.__f__("log", "at pages/return/index.vue:187", "更新后的开始时间:", this.orderInfo.startTime);
|
||||||
} else {
|
} else {
|
||||||
throw new Error(result.msg || "获取订单详情失败");
|
throw new Error(result.msg || "获取订单详情失败");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
common_vendor.index.__f__("error", "at pages/return/index.vue:158", "获取订单详情错误:", error);
|
common_vendor.index.__f__("error", "at pages/return/index.vue:192", "获取订单详情错误:", error);
|
||||||
common_vendor.index.showToast({
|
common_vendor.index.showToast({
|
||||||
title: error.message || "获取订单信息失败",
|
title: error.message || "获取订单信息失败",
|
||||||
icon: "none"
|
icon: "none"
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
common_vendor.index.reLaunch({
|
this.goToHome();
|
||||||
url: "/pages/index/index"
|
|
||||||
});
|
|
||||||
}, 1500);
|
}, 1500);
|
||||||
} finally {
|
} finally {
|
||||||
common_vendor.index.hideLoading();
|
common_vendor.index.hideLoading();
|
||||||
@@ -101,9 +119,30 @@ const _sfc_main = {
|
|||||||
},
|
},
|
||||||
// 使用后端返回的使用时长和费用数据
|
// 使用后端返回的使用时长和费用数据
|
||||||
updateOrderInfo(orderData) {
|
updateOrderInfo(orderData) {
|
||||||
common_vendor.index.__f__("log", "at pages/return/index.vue:188", "更新订单信息:", JSON.stringify(orderData));
|
common_vendor.index.__f__("log", "at pages/return/index.vue:220", "更新订单信息:", JSON.stringify(orderData));
|
||||||
this.orderInfo.usedTime = orderData.usedTime || "0分钟";
|
this.orderInfo.usedTime = orderData.usedTime || "0分钟";
|
||||||
this.orderInfo.currentFee = orderData.currentFee || "0.00";
|
this.orderInfo.currentFee = orderData.currentFee || orderData.actualDeviceAmount || orderData.payAmount || "0.00";
|
||||||
|
if (orderData.orderStatus) {
|
||||||
|
this.orderInfo.orderStatus = orderData.orderStatus;
|
||||||
|
}
|
||||||
|
this.orderInfo._rawStartTime = orderData.startTime;
|
||||||
|
if (orderData.startTime) {
|
||||||
|
try {
|
||||||
|
common_vendor.index.__f__("log", "at pages/return/index.vue:239", "API返回的开始时间:", orderData.startTime);
|
||||||
|
this.orderInfo.startTime = orderData.startTime;
|
||||||
|
} catch (e) {
|
||||||
|
common_vendor.index.__f__("error", "at pages/return/index.vue:243", "更新开始时间错误:", e);
|
||||||
|
this.orderInfo.startTime = "未知";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
common_vendor.index.__f__("warn", "at pages/return/index.vue:247", "API返回的订单数据中没有startTime字段");
|
||||||
|
if (orderData.createTime) {
|
||||||
|
common_vendor.index.__f__("log", "at pages/return/index.vue:250", "使用createTime作为备选:", orderData.createTime);
|
||||||
|
this.orderInfo.startTime = orderData.createTime;
|
||||||
|
} else {
|
||||||
|
this.orderInfo.startTime = "未知";
|
||||||
|
}
|
||||||
|
}
|
||||||
if (orderData.deviceNo && !this.deviceId) {
|
if (orderData.deviceNo && !this.deviceId) {
|
||||||
this.deviceId = orderData.deviceNo;
|
this.deviceId = orderData.deviceNo;
|
||||||
}
|
}
|
||||||
@@ -121,54 +160,30 @@ const _sfc_main = {
|
|||||||
this.timer = null;
|
this.timer = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 处理开锁归还
|
// 清除状态检查定时器
|
||||||
async handleUnlock() {
|
clearStatusCheckTimer() {
|
||||||
if (this.unlocking)
|
if (this.statusCheckTimer) {
|
||||||
return;
|
clearInterval(this.statusCheckTimer);
|
||||||
try {
|
this.statusCheckTimer = null;
|
||||||
this.unlocking = true;
|
|
||||||
common_vendor.index.showLoading({ title: "开锁中" });
|
|
||||||
const confirmResult = await new Promise((resolve) => {
|
|
||||||
common_vendor.index.showModal({
|
|
||||||
title: "确认归还",
|
|
||||||
content: "确定要归还设备吗?",
|
|
||||||
success: (res) => {
|
|
||||||
resolve(res.confirm);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
if (!confirmResult) {
|
|
||||||
this.unlocking = false;
|
|
||||||
common_vendor.index.hideLoading();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
common_vendor.index.__f__("log", "at pages/return/index.vue:239", `准备结束订单, orderId: ${this.orderInfo.orderId}`);
|
|
||||||
const result = await config_user.overOrderById(this.orderInfo.orderId);
|
|
||||||
common_vendor.index.__f__("log", "at pages/return/index.vue:244", "结束订单结果:", JSON.stringify(result));
|
|
||||||
if (result.code === 200) {
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: "归还成功",
|
|
||||||
icon: "success"
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
common_vendor.index.reLaunch({
|
|
||||||
url: "/pages/index/index"
|
|
||||||
});
|
|
||||||
}, 1500);
|
|
||||||
} else {
|
|
||||||
throw new Error(result.msg || "归还失败");
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
common_vendor.index.__f__("error", "at pages/return/index.vue:262", "归还操作错误:", error);
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: error.message || "归还失败,请重试",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
this.unlocking = false;
|
|
||||||
common_vendor.index.hideLoading();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 开始状态检查定时器
|
||||||
|
startStatusCheckTimer() {
|
||||||
|
this.currentStatusChecks = 0;
|
||||||
|
this.clearStatusCheckTimer();
|
||||||
|
this.statusCheckTimer = setInterval(() => {
|
||||||
|
this.currentStatusChecks++;
|
||||||
|
this.checkReturnStatus();
|
||||||
|
if (this.currentStatusChecks >= this.maxStatusChecks) {
|
||||||
|
this.clearStatusCheckTimer();
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: "请手动刷新查看归还状态",
|
||||||
|
icon: "none",
|
||||||
|
duration: 3e3
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, this.statusCheckInterval);
|
||||||
|
},
|
||||||
// 通过设备号查询使用中的订单
|
// 通过设备号查询使用中的订单
|
||||||
async getOrderByDevice() {
|
async getOrderByDevice() {
|
||||||
try {
|
try {
|
||||||
@@ -184,43 +199,65 @@ const _sfc_main = {
|
|||||||
"Clientid": common_vendor.index.getStorageSync("client_id")
|
"Clientid": common_vendor.index.getStorageSync("client_id")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
common_vendor.index.__f__("log", "at pages/return/index.vue:292", "通过设备号查询订单结果:", JSON.stringify(inUseRes));
|
common_vendor.index.__f__("log", "at pages/return/index.vue:329", "通过设备号查询订单结果:", JSON.stringify(inUseRes));
|
||||||
if (inUseRes.statusCode === 200 && inUseRes.data.code === 200 && inUseRes.data.data) {
|
if (inUseRes.statusCode === 200 && inUseRes.data.code === 200 && inUseRes.data.data) {
|
||||||
const inUseOrder = inUseRes.data.data;
|
const inUseOrder = inUseRes.data.data;
|
||||||
|
common_vendor.index.__f__("log", "at pages/return/index.vue:333", "使用中的订单:", inUseOrder);
|
||||||
this.orderInfo.orderId = inUseOrder.orderId;
|
this.orderInfo.orderId = inUseOrder.orderId;
|
||||||
|
if (inUseOrder.orderStatus) {
|
||||||
|
this.orderInfo.orderStatus = inUseOrder.orderStatus;
|
||||||
|
}
|
||||||
|
if (inUseOrder.startTime) {
|
||||||
|
common_vendor.index.__f__("log", "at pages/return/index.vue:345", "inUse API返回的开始时间:", inUseOrder.startTime);
|
||||||
|
this.orderInfo.startTime = inUseOrder.startTime;
|
||||||
|
}
|
||||||
this.getOrderDetails();
|
this.getOrderDetails();
|
||||||
this.startTimer();
|
this.startTimer();
|
||||||
|
this.startStatusCheckTimer();
|
||||||
} else {
|
} else {
|
||||||
throw new Error("未找到使用中的订单");
|
throw new Error("未找到使用中的订单");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
common_vendor.index.__f__("error", "at pages/return/index.vue:307", "通过设备号查询订单失败:", error);
|
common_vendor.index.__f__("error", "at pages/return/index.vue:359", "通过设备号查询订单失败:", error);
|
||||||
common_vendor.index.showToast({
|
common_vendor.index.showToast({
|
||||||
title: error.message || "获取订单信息失败",
|
title: error.message || "获取订单信息失败",
|
||||||
icon: "none"
|
icon: "none"
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
common_vendor.index.reLaunch({
|
this.goToHome();
|
||||||
url: "/pages/index/index"
|
|
||||||
});
|
|
||||||
}, 1500);
|
}, 1500);
|
||||||
} finally {
|
} finally {
|
||||||
common_vendor.index.hideLoading();
|
common_vendor.index.hideLoading();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
// 检查归还状态
|
||||||
|
async checkReturnStatus() {
|
||||||
|
try {
|
||||||
|
await this.getOrderDetails();
|
||||||
|
} catch (error) {
|
||||||
|
common_vendor.index.__f__("error", "at pages/return/index.vue:379", "检查归还状态失败:", error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 返回首页
|
||||||
|
goToHome() {
|
||||||
|
common_vendor.index.reLaunch({
|
||||||
|
url: "/pages/index/index"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||||
return {
|
return common_vendor.e({
|
||||||
a: common_vendor.t($data.orderInfo.orderId),
|
a: common_vendor.t($options.getOrderStatusText()),
|
||||||
b: common_vendor.t($data.deviceId),
|
b: common_vendor.t($data.orderInfo.orderId),
|
||||||
c: common_vendor.t($data.orderInfo.startTime),
|
c: common_vendor.t($data.deviceId),
|
||||||
d: common_vendor.t($data.orderInfo.usedTime),
|
d: common_vendor.t($data.orderInfo.startTime),
|
||||||
e: common_vendor.t($data.orderInfo.currentFee),
|
e: common_vendor.t($data.orderInfo.usedTime),
|
||||||
f: common_vendor.t($data.unlocking ? "开锁中..." : "开锁归还"),
|
f: common_vendor.t($data.orderInfo.currentFee)
|
||||||
g: common_vendor.o((...args) => $options.handleUnlock && $options.handleUnlock(...args)),
|
}, {}, {
|
||||||
h: $data.unlocking
|
j: common_vendor.o((...args) => $options.checkReturnStatus && $options.checkReturnStatus(...args)),
|
||||||
};
|
k: common_vendor.o((...args) => $options.goToHome && $options.goToHome(...args))
|
||||||
|
});
|
||||||
}
|
}
|
||||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-6d22bdf8"]]);
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-6d22bdf8"]]);
|
||||||
wx.createPage(MiniProgramPage);
|
wx.createPage(MiniProgramPage);
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
<view class="return-container data-v-6d22bdf8"><view class="order-card data-v-6d22bdf8"><view class="order-header data-v-6d22bdf8"><text class="title data-v-6d22bdf8">使用中</text><text class="order-no data-v-6d22bdf8">订单号:{{a}}</text></view><view class="device-info data-v-6d22bdf8"><text class="device-name data-v-6d22bdf8">共享风扇</text><text class="device-id data-v-6d22bdf8">设备号:{{b}}</text></view><view class="time-info data-v-6d22bdf8"><view class="time-item data-v-6d22bdf8"><text class="label data-v-6d22bdf8">开始时间</text><text class="value data-v-6d22bdf8">{{c}}</text></view><view class="time-item data-v-6d22bdf8"><text class="label data-v-6d22bdf8">已使用时长</text><text class="value highlight data-v-6d22bdf8">{{d}}</text></view><view class="time-item data-v-6d22bdf8"><text class="label data-v-6d22bdf8">当前费用</text><text class="value data-v-6d22bdf8">¥{{e}}</text></view></view></view><view class="notice-card data-v-6d22bdf8"><view class="notice-title data-v-6d22bdf8">归还说明</view><view class="notice-list data-v-6d22bdf8"><view class="notice-item data-v-6d22bdf8"><view class="dot data-v-6d22bdf8"></view><text class="data-v-6d22bdf8">请确保设备完好无损</text></view><view class="notice-item data-v-6d22bdf8"><view class="dot data-v-6d22bdf8"></view><text class="data-v-6d22bdf8">请在指定区域内归还设备</text></view><view class="notice-item data-v-6d22bdf8"><view class="dot data-v-6d22bdf8"></view><text class="data-v-6d22bdf8">归还后押金将自动退还</text></view></view></view><view class="bottom-bar data-v-6d22bdf8"><button class="unlock-btn data-v-6d22bdf8" bindtap="{{g}}" disabled="{{h}}">{{f}}</button></view></view>
|
<view class="return-container data-v-6d22bdf8"><view class="order-card data-v-6d22bdf8"><view class="order-header data-v-6d22bdf8"><text class="title data-v-6d22bdf8">{{a}}</text><text class="order-no data-v-6d22bdf8">订单号:{{b}}</text></view><view class="device-info data-v-6d22bdf8"><text class="device-name data-v-6d22bdf8">共享风扇</text><text class="device-id data-v-6d22bdf8">设备号:{{c}}</text></view><view class="time-info data-v-6d22bdf8"><view class="time-item data-v-6d22bdf8"><text class="label data-v-6d22bdf8">开始时间</text><text class="value data-v-6d22bdf8">{{d}}</text></view><view class="time-item data-v-6d22bdf8"><text class="label data-v-6d22bdf8">已使用时长</text><text class="value highlight data-v-6d22bdf8">{{e}}</text></view><view class="time-item data-v-6d22bdf8"><text class="label data-v-6d22bdf8">当前费用</text><text class="value data-v-6d22bdf8">¥{{f}}</text></view></view><view wx:if="{{false}}" class="debug-info data-v-6d22bdf8"><view class="debug-title data-v-6d22bdf8">调试信息</view><view class="debug-item data-v-6d22bdf8">原始开始时间: {{g}}</view><view class="debug-item data-v-6d22bdf8">处理后开始时间: {{h}}</view><view class="debug-item data-v-6d22bdf8">订单状态: {{i}}</view></view></view><view class="notice-card data-v-6d22bdf8"><view class="notice-title data-v-6d22bdf8">归还说明</view><view class="notice-list data-v-6d22bdf8"><view class="notice-item data-v-6d22bdf8"><view class="dot data-v-6d22bdf8"></view><text class="data-v-6d22bdf8">请确保设备完好无损</text></view><view class="notice-item data-v-6d22bdf8"><view class="dot data-v-6d22bdf8"></view><text class="data-v-6d22bdf8">将充电宝插入原位置或空闲插口</text></view><view class="notice-item data-v-6d22bdf8"><view class="dot data-v-6d22bdf8"></view><text class="data-v-6d22bdf8">系统将自动检测归还并处理退款</text></view><view class="notice-item data-v-6d22bdf8"><view class="dot data-v-6d22bdf8"></view><text class="data-v-6d22bdf8">归还成功后将自动跳转到成功页面</text></view></view></view><view class="bottom-bar data-v-6d22bdf8"><button class="secondary-btn data-v-6d22bdf8" bindtap="{{j}}">刷新状态</button><button class="primary-btn data-v-6d22bdf8" bindtap="{{k}}">返回首页</button></view></view>
|
||||||
+49
-38
@@ -44,46 +44,52 @@
|
|||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
}
|
}
|
||||||
.return-container .order-card .order-header .title.data-v-6d22bdf8 {
|
.return-container .order-card .order-header .title.data-v-6d22bdf8 {
|
||||||
font-size: 36rpx;
|
font-size: 32rpx;
|
||||||
font-weight: 600;
|
font-weight: bold;
|
||||||
color: #1976D2;
|
color: #333;
|
||||||
}
|
}
|
||||||
.return-container .order-card .order-header .order-no.data-v-6d22bdf8 {
|
.return-container .order-card .order-header .order-no.data-v-6d22bdf8 {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
.return-container .order-card .device-info.data-v-6d22bdf8 {
|
.return-container .order-card .device-info.data-v-6d22bdf8 {
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 30rpx;
|
||||||
}
|
}
|
||||||
.return-container .order-card .device-info .device-name.data-v-6d22bdf8 {
|
.return-container .order-card .device-info .device-name.data-v-6d22bdf8 {
|
||||||
font-size: 32rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 500;
|
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-right: 20rpx;
|
display: block;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
.return-container .order-card .device-info .device-id.data-v-6d22bdf8 {
|
.return-container .order-card .device-info .device-id.data-v-6d22bdf8 {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
.return-container .order-card .time-info.data-v-6d22bdf8 {
|
||||||
|
background: #f9f9f9;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 20rpx;
|
||||||
|
}
|
||||||
.return-container .order-card .time-info .time-item.data-v-6d22bdf8 {
|
.return-container .order-card .time-info .time-item.data-v-6d22bdf8 {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
}
|
}
|
||||||
.return-container .order-card .time-info .time-item.data-v-6d22bdf8:last-child {
|
.return-container .order-card .time-info .time-item.data-v-6d22bdf8:last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
.return-container .order-card .time-info .time-item .label.data-v-6d22bdf8 {
|
.return-container .order-card .time-info .time-item .label.data-v-6d22bdf8 {
|
||||||
font-size: 28rpx;
|
font-size: 26rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
.return-container .order-card .time-info .time-item .value.data-v-6d22bdf8 {
|
.return-container .order-card .time-info .time-item .value.data-v-6d22bdf8 {
|
||||||
font-size: 28rpx;
|
font-size: 26rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
.return-container .order-card .time-info .time-item .value.highlight.data-v-6d22bdf8 {
|
.return-container .order-card .time-info .time-item .value.highlight.data-v-6d22bdf8 {
|
||||||
color: #1976D2;
|
color: #ff6b00;
|
||||||
font-weight: 500;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
.return-container .notice-card.data-v-6d22bdf8 {
|
.return-container .notice-card.data-v-6d22bdf8 {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
@@ -93,14 +99,14 @@
|
|||||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||||
}
|
}
|
||||||
.return-container .notice-card .notice-title.data-v-6d22bdf8 {
|
.return-container .notice-card .notice-title.data-v-6d22bdf8 {
|
||||||
font-size: 32rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 600;
|
font-weight: bold;
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 20rpx;
|
||||||
}
|
}
|
||||||
.return-container .notice-card .notice-list .notice-item.data-v-6d22bdf8 {
|
.return-container .notice-card .notice-list .notice-item.data-v-6d22bdf8 {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: flex-start;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
}
|
}
|
||||||
.return-container .notice-card .notice-list .notice-item.data-v-6d22bdf8:last-child {
|
.return-container .notice-card .notice-list .notice-item.data-v-6d22bdf8:last-child {
|
||||||
@@ -109,12 +115,14 @@
|
|||||||
.return-container .notice-card .notice-list .notice-item .dot.data-v-6d22bdf8 {
|
.return-container .notice-card .notice-list .notice-item .dot.data-v-6d22bdf8 {
|
||||||
width: 12rpx;
|
width: 12rpx;
|
||||||
height: 12rpx;
|
height: 12rpx;
|
||||||
background: #1976D2;
|
background: #07c160;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
margin-top: 10rpx;
|
||||||
margin-right: 16rpx;
|
margin-right: 16rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
.return-container .notice-card .notice-list .notice-item text.data-v-6d22bdf8 {
|
.return-container .notice-card .notice-list .notice-item text.data-v-6d22bdf8 {
|
||||||
font-size: 28rpx;
|
font-size: 26rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
@@ -123,30 +131,33 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
padding: 30rpx;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 20rpx 30rpx;
|
|
||||||
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.04);
|
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||||
}
|
z-index: 10;
|
||||||
.return-container .bottom-bar .unlock-btn.data-v-6d22bdf8 {
|
|
||||||
width: 100%;
|
|
||||||
height: 88rpx;
|
|
||||||
border-radius: 44rpx;
|
|
||||||
background: linear-gradient(135deg, #FF9800, #FFB74D);
|
|
||||||
color: #fff;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: 600;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
justify-content: space-between;
|
||||||
justify-content: center;
|
gap: 20rpx;
|
||||||
border: none;
|
|
||||||
}
|
}
|
||||||
.return-container .bottom-bar .unlock-btn.data-v-6d22bdf8:active {
|
.return-container .bottom-bar .primary-btn.data-v-6d22bdf8, .return-container .bottom-bar .secondary-btn.data-v-6d22bdf8 {
|
||||||
transform: scale(0.98);
|
height: 88rpx;
|
||||||
|
line-height: 88rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
border-radius: 44rpx;
|
||||||
|
text-align: center;
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
.return-container .bottom-bar .unlock-btn.data-v-6d22bdf8:disabled {
|
.return-container .bottom-bar .primary-btn.data-v-6d22bdf8 {
|
||||||
opacity: 0.7;
|
background: #07c160;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.return-container .bottom-bar .primary-btn.data-v-6d22bdf8:active {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
.return-container .bottom-bar .secondary-btn.data-v-6d22bdf8 {
|
||||||
|
background: #f0f0f0;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.return-container .bottom-bar .secondary-btn.data-v-6d22bdf8:active {
|
||||||
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user