如果扫描用户,没有订单,不需要返回任何信息给用户

完成套餐从数据库中提取
This commit is contained in:
8vd8
2025-04-22 18:08:52 +08:00
parent 8431cdf2d6
commit d9e70d4eaf
21 changed files with 591 additions and 145 deletions
+27
View File
@@ -8,6 +8,14 @@ const request = (option) => {
// Debug request info // Debug request info
console.log(`发起请求: ${option.method} ${URL + option.url}`, option.data) console.log(`发起请求: ${option.method} ${URL + option.url}`, option.data)
// 默认不显示加载中提示
if (!option.hideLoading) {
uni.showLoading({
title: option.loadingText || '加载中...',
mask: true
})
}
uni.request({ uni.request({
url: URL + option.url, url: URL + option.url,
method: option.method, method: option.method,
@@ -41,6 +49,19 @@ const request = (option) => {
if (res.data && res.data.code !== 200) { if (res.data && res.data.code !== 200) {
console.warn(`业务状态码错误: ${res.data.code}`, res.data) console.warn(`业务状态码错误: ${res.data.code}`, res.data)
// 判断是否需要忽略数据为空的错误
if (option.ignoreEmptyError &&
(res.data.code === 500 && res.data.msg &&
(res.data.msg.includes('未找到') || res.data.msg.includes('不存在')))) {
// 对于指定需要忽略的错误,返回一个标准的"成功但数据为空"的响应
resolve({
code: 200,
msg: "操作成功",
data: []
})
return
}
// 仍然返回数据,由业务逻辑处理 // 仍然返回数据,由业务逻辑处理
resolve(res.data) resolve(res.data)
return return
@@ -52,6 +73,12 @@ const request = (option) => {
// 网络请求本身失败 // 网络请求本身失败
console.error(`请求失败: ${option.url}`, err) console.error(`请求失败: ${option.url}`, err)
reject(err) reject(err)
},
complete() {
// 隐藏加载提示
if (!option.hideLoading) {
uni.hideLoading()
}
} }
}) })
}) })
+2 -1
View File
@@ -53,7 +53,8 @@ export const checkOrdersByStatus = (deviceNo, statuses) => {
return request({ return request({
url: `/app/order/list?deviceNo=${deviceNo}&orderStatus=${statusQuery}`, url: `/app/order/list?deviceNo=${deviceNo}&orderStatus=${statusQuery}`,
method: 'get', method: 'get',
hideLoading: true // 隐藏加载提示,避免干扰用户 hideLoading: true, // 隐藏加载提示,避免干扰用户
ignoreEmptyError: true // 添加标记,表示即使返回空数据也不视为错误
}) })
} }
+5 -2
View File
@@ -96,8 +96,11 @@ export default {
}) })
return return
} }
const res = await queryById(Number(this.orderNo)) if(this.orderId.length!=0||this.orderNo.length!=0){
console.log(res); const res = await queryById(Number(this.orderId))
console.log(res);
}
// if(this.orderNo.length!=0){ // if(this.orderNo.length!=0){
// uni.showToast({ // uni.showToast({
// title:'当前存在进行中的订单', // title:'当前存在进行中的订单',
+158 -21
View File
@@ -73,7 +73,7 @@
<view class="bottom-bar"> <view class="bottom-bar">
<view class="price-info" v-if="!hasActiveOrder"> <view class="price-info" v-if="!hasActiveOrder">
<text class="deposit-text">押金</text> <text class="deposit-text">押金</text>
<text class="deposit-amount">99</text> <text class="deposit-amount">{{ depositAmount }}</text>
</view> </view>
<button class="action-btn" :class="hasActiveOrder ? 'return' : 'rent'" @click="handleRent"> <button class="action-btn" :class="hasActiveOrder ? 'return' : 'rent'" @click="handleRent">
{{ hasActiveOrder ? '归还设备' : '立即租借' }} {{ hasActiveOrder ? '归还设备' : '立即租借' }}
@@ -101,22 +101,8 @@
class: 'available' class: 'available'
}, },
selectedPackage: 1, selectedPackage: 1,
packages: [{ packages: [],
time: '1小时', depositAmount: "99.00", // 默认押金金额
price: '2.00',
unitPrice: '2.00'
},
{
time: '4小时',
price: '6.00',
unitPrice: '1.50'
},
{
time: '12小时',
price: '15.00',
unitPrice: '1.25'
}
],
isLoggedIn: true, isLoggedIn: true,
phoneNumber: '' phoneNumber: ''
} }
@@ -133,7 +119,158 @@
async getDeviceInfo() { async getDeviceInfo() {
const res = await getDeviceInfo(this.deviceId); const res = await getDeviceInfo(this.deviceId);
if (res.code == 200) { if (res.code == 200) {
this.deviceInfo = res.data this.deviceInfo = res.data.device || {};
// 更新设备位置信息
if (this.deviceInfo.deviceLocation) {
this.deviceLocation = this.deviceInfo.deviceLocation;
} else if (res.data.position && res.data.position.name) {
this.deviceLocation = res.data.position.name;
}
// 获取押金金额
if (this.deviceInfo.depositAmount) {
this.depositAmount = this.deviceInfo.depositAmount;
}
// 更新设备状态
if (this.deviceInfo.status) {
if (this.deviceInfo.status === 'online') {
this.deviceStatus = {
text: '可使用',
class: 'available'
};
} else if (this.deviceInfo.status === 'offline') {
this.deviceStatus = {
text: '离线',
class: 'offline'
};
}
}
// 解析feeConfig并生成套餐选项
if (this.deviceInfo.feeConfig) {
try {
const feeConfig = JSON.parse(this.deviceInfo.feeConfig);
// 检查是否为新格式 [{"Hour":1,"Price":4},{"Hour":3,"Price":10},{"Hour":5,"Price":15}]
if (feeConfig.length > 0 && 'Hour' in feeConfig[0] && 'Price' in feeConfig[0]) {
// 新格式处理
this.packages = feeConfig.map(pkg => {
const hour = pkg.Hour;
const price = pkg.Price;
const unitPrice = (price / hour).toFixed(2);
return {
time: `${hour}${hour > 1 ? '小时' : '小时'}`,
price: price.toFixed(2),
unitPrice: unitPrice
};
});
} else {
// 旧格式处理
// 通常使用common规格的配置
const commonConfig = feeConfig.find(item => item.specCode === 'common') || feeConfig[0];
if (commonConfig) {
// 根据收费类型生成套餐
if (this.deviceInfo.feeType === 'hour') {
// 按小时收费
const hourPrice = commonConfig.hourPrice > 0 ? commonConfig.hourPrice : commonConfig.timesPrice / 6;
this.packages = [
{
time: '1小时',
price: hourPrice.toFixed(2),
unitPrice: hourPrice.toFixed(2)
},
{
time: '6小时',
price: (hourPrice * 6).toFixed(2),
unitPrice: hourPrice.toFixed(2)
},
{
time: '12小时',
price: (hourPrice * 12).toFixed(2),
unitPrice: hourPrice.toFixed(2)
}
];
} else if (this.deviceInfo.feeType === 'times') {
// 按次收费
const timesPrice = commonConfig.timesPrice;
this.packages = [
{
time: '1次',
price: timesPrice.toFixed(2),
unitPrice: timesPrice.toFixed(2)
}
];
} else {
// 默认套餐
this.packages = [
{
time: '1小时',
price: '2.00',
unitPrice: '2.00'
},
{
time: '6小时',
price: '10.00',
unitPrice: '1.67'
},
{
time: '12小时',
price: '15.00',
unitPrice: '1.25'
}
];
}
}
}
// 默认选中中间套餐
this.selectedPackage = Math.min(1, this.packages.length - 1);
} catch (e) {
console.error('解析设备费用配置失败:', e);
// 使用默认套餐
this.packages = [
{
time: '1小时',
price: '2.00',
unitPrice: '2.00'
},
{
time: '6小时',
price: '10.00',
unitPrice: '1.67'
},
{
time: '12小时',
price: '15.00',
unitPrice: '1.25'
}
];
}
} else {
// 如果没有feeConfig,使用默认套餐
this.packages = [
{
time: '1小时',
price: '2.00',
unitPrice: '2.00'
},
{
time: '6小时',
price: '10.00',
unitPrice: '1.67'
},
{
time: '12小时',
price: '15.00',
unitPrice: '1.25'
}
];
}
} }
}, },
@@ -217,7 +354,7 @@
const selectedPkg = this.packages[this.selectedPackage] const selectedPkg = this.packages[this.selectedPackage]
uni.showModal({ uni.showModal({
title: '确认租借', title: '确认租借',
content: `确认支付押金¥99.00${selectedPkg.time}套餐费用¥${selectedPkg.price}`, content: `确认支付押金¥{{ depositAmount }}${selectedPkg.time}套餐费用¥${selectedPkg.price}`,
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
this.submitRentOrder() this.submitRentOrder()
@@ -274,7 +411,7 @@
// --- 更新结束 --- // --- 更新结束 ---
// --- 新增:计算总金额 --- // --- 新增:计算总金额 ---
const deposit = 99.00; // 固定押金 const deposit = parseFloat(this.depositAmount);
const packagePrice = parseFloat(selectedPkg.price); const packagePrice = parseFloat(selectedPkg.price);
const totalAmount = (deposit + packagePrice).toFixed(2); const totalAmount = (deposit + packagePrice).toFixed(2);
// --- 计算结束 --- // --- 计算结束 ---
@@ -283,7 +420,7 @@
// 跳转到订单支付页面,传递订单ID、套餐信息和总金额 // 跳转到订单支付页面,传递订单ID、套餐信息和总金额
uni.redirectTo({ uni.redirectTo({
url: `/pages/order/payment?orderId=${order.orderId}&packageTime=${selectedPkg.time}&packagePrice=${selectedPkg.price}&totalAmount=${totalAmount}` url: `/pages/order/payment?orderId=${order.orderId}&packageTimeHours=${selectedPkg.time.replace('小时', '')}&packagePrice=${selectedPkg.price}&totalAmount=${totalAmount}&depositAmount=${this.depositAmount}`
}) })
} catch (error) { } catch (error) {
uni.hideLoading() uni.hideLoading()
+88 -23
View File
@@ -37,11 +37,7 @@
</view> </view>
<view class="price-item"> <view class="price-item">
<text class="label">套餐</text> <text class="label">套餐</text>
<text class="value">{{ packageInfo.time }} ({{ packageInfo.price }})</text> <text class="value">{{ packageInfo.price }}/{{ packageInfo.time }}小时</text>
</view>
<view class="price-item">
<text class="label">租借费用</text>
<text class="value">{{ orderInfo.amount || packageInfo.price }}</text>
</view> </view>
<view class="price-item total"> <view class="price-item total">
<text class="label">合计</text> <text class="label">合计</text>
@@ -65,6 +61,7 @@
<script> <script>
import { queryById } from '@/config/user.js' import { queryById } from '@/config/user.js'
import { getDeviceInfo } from '@/config/user.js'
import { updateOrderPackage } from '@/config/user.js' import { updateOrderPackage } from '@/config/user.js'
import { updateUserBalance } from '@/config/user.js' import { updateUserBalance } from '@/config/user.js'
import { import {
@@ -75,11 +72,13 @@ export default {
data() { data() {
return { return {
orderId: null, orderId: null,
deviceNo: null,
orderInfo: {}, orderInfo: {},
packageInfo: { packageInfo: {
time: '', time: '',
price: '0.00' price: '0.00'
}, },
deviceInfo: null,
passedTotalAmount: null, passedTotalAmount: null,
passedDepositAmount: null, passedDepositAmount: null,
orderStatus: { orderStatus: {
@@ -94,23 +93,15 @@ export default {
if (this.passedTotalAmount !== null) { if (this.passedTotalAmount !== null) {
return parseFloat(this.passedTotalAmount).toFixed(2); return parseFloat(this.passedTotalAmount).toFixed(2);
} }
const deposit = parseFloat(this.orderInfo.deposit || 99) const deposit = parseFloat(this.orderInfo.deposit || this.passedDepositAmount || 99)
const amount = parseFloat(this.orderInfo.amount || this.packageInfo.price || 0) const packagePrice = parseFloat(this.packageInfo.price || 0)
return (deposit + amount).toFixed(2) return (deposit + packagePrice).toFixed(2)
} }
}, },
onLoad(options) { onLoad(options) {
if (options && options.orderId) { if (options && options.orderId) {
this.orderId = options.orderId this.orderId = options.orderId
// 获取传递的套餐信息
if (options.packageTime && options.packagePrice) {
this.packageInfo = {
time: options.packageTime,
price: options.packagePrice
}
}
if (options.totalAmount) { if (options.totalAmount) {
this.passedTotalAmount = options.totalAmount; this.passedTotalAmount = options.totalAmount;
} }
@@ -164,15 +155,12 @@ export default {
deviceNo: orderData.deviceNo, deviceNo: orderData.deviceNo,
createTime: formattedTime, createTime: formattedTime,
phone: orderData.phone, phone: orderData.phone,
deposit: this.passedDepositAmount || orderData.depositAmount || '99.00', // 优先使用传递的押金,然后是订单中的押金,最后默认99元 deposit: this.passedDepositAmount || orderData.depositAmount || '99.00',
amount: orderData.amount || this.packageInfo.price || '0.00'
} }
// 如果订单中没有套餐信息,但URL参数中有,则使用URL参数中的套餐信息 // 获取设备信息并解析套餐
if (!orderData.packageTime && this.packageInfo.time) { this.deviceNo = orderData.deviceNo;
this.orderInfo.packageTime = this.packageInfo.time await this.loadDeviceInfo();
this.orderInfo.packagePrice = this.packageInfo.price
}
} else { } else {
throw new Error('获取订单信息失败') throw new Error('获取订单信息失败')
} }
@@ -187,6 +175,83 @@ export default {
} }
}, },
// 加载设备信息并解析套餐
async loadDeviceInfo() {
if (!this.deviceNo) return;
try {
const res = await getDeviceInfo(this.deviceNo);
if (res.code === 200 && res.data) {
this.deviceInfo = res.data.device;
// 解析feeConfig获取套餐信息
if (this.deviceInfo && this.deviceInfo.feeConfig) {
try {
const feeConfig = JSON.parse(this.deviceInfo.feeConfig);
// 检查是否为新格式 [{"Hour":1,"Price":4},{"Hour":3,"Price":10},{"Hour":5,"Price":15}]
if (feeConfig.length > 0 && 'Hour' in feeConfig[0] && 'Price' in feeConfig[0]) {
// 尝试找到对应包时长的套餐
// 默认使用6小时或最接近的套餐
const targetHours = 6;
let closestPackage = feeConfig[0];
// 找出最接近目标时长的套餐
feeConfig.forEach(pkg => {
if (Math.abs(pkg.Hour - targetHours) < Math.abs(closestPackage.Hour - targetHours)) {
closestPackage = pkg;
}
});
this.packageInfo.time = closestPackage.Hour.toString();
this.packageInfo.price = closestPackage.Price.toString();
} else {
// 旧格式处理
// 通常使用common配置
const selectedConfig = feeConfig.find(item => item.specCode === 'common') || feeConfig[0];
if (selectedConfig) {
// 套餐时间
const packageHours = 6; // 默认6小时
// 如果是按次收费,则直接使用timesPrice
if (this.deviceInfo.feeType === 'times') {
this.packageInfo.price = selectedConfig.timesPrice.toString();
this.packageInfo.time = '1次';
}
// 如果是按小时收费
else if (this.deviceInfo.feeType === 'hour') {
if (selectedConfig.hourPrice > 0) {
// 如果有设置小时价格,计算套餐价格
this.packageInfo.price = (selectedConfig.hourPrice * packageHours).toString();
} else {
// 否则使用timesPrice作为套餐价格
this.packageInfo.price = selectedConfig.timesPrice.toString();
}
this.packageInfo.time = packageHours.toString();
}
// 如果是其他收费类型,使用timesPrice
else {
this.packageInfo.price = selectedConfig.timesPrice.toString();
this.packageInfo.time = packageHours.toString();
}
}
}
} catch (e) {
console.error('解析设备费用配置失败:', e);
}
}
// 设置存款金额
if (this.deviceInfo && this.deviceInfo.depositAmount) {
this.orderInfo.deposit = this.deviceInfo.depositAmount;
}
}
} catch (error) {
console.error('获取设备信息失败:', error);
}
},
// 处理支付 // 处理支付
async handlePayment() { async handlePayment() {
try { try {
+34 -9
View File
@@ -57,13 +57,27 @@
} else if (latestOrder.orderStatus === 'waiting_for_payment') { } else if (latestOrder.orderStatus === 'waiting_for_payment') {
// 如果是待支付订单,跳转到支付页面,并传递必要信息 // 如果是待支付订单,跳转到支付页面,并传递必要信息
console.log('检测到待支付订单,跳转支付页:', latestOrder.orderId); console.log('检测到待支付订单,跳转支付页:', latestOrder.orderId);
const packageTime = latestOrder.packageTime ? `${latestOrder.packageTime / 60}小时` : '默认套餐'; // 示例转换
// 获取套餐时间(分钟)
const packageTimeMinutes = latestOrder.packageTime || 60;
// 套餐小时数
const packageTimeHours = (packageTimeMinutes / 60).toFixed(1);
// 套餐价格
const packagePrice = latestOrder.packagePrice || '0.00'; const packagePrice = latestOrder.packagePrice || '0.00';
// 计算每小时费率
const hourlyRate = (parseFloat(packagePrice) / (packageTimeMinutes / 60)).toFixed(2);
// 押金金额
const depositAmount = latestOrder.depositAmount || '99.00'; const depositAmount = latestOrder.depositAmount || '99.00';
// 计算总金额(套餐+押金)
const totalAmount = (parseFloat(depositAmount) + parseFloat(packagePrice)).toFixed(2); const totalAmount = (parseFloat(depositAmount) + parseFloat(packagePrice)).toFixed(2);
uni.redirectTo({ uni.redirectTo({
url: `/pages/order/payment?orderId=${latestOrder.orderId}&packageTime=${packageTime}&packagePrice=${packagePrice}&totalAmount=${totalAmount}&depositAmount=${depositAmount}` url: `/pages/order/payment?orderId=${latestOrder.orderId}&packageTimeHours=${packageTimeHours}&packagePrice=${packagePrice}&hourlyRate=${hourlyRate}&totalAmount=${totalAmount}&depositAmount=${depositAmount}`
}); });
} else { } else {
// 其他状态(理论上不应该到这里,除非statusesToCheck配置错误),默认到详情页 // 其他状态(理论上不应该到这里,除非statusesToCheck配置错误),默认到详情页
@@ -80,13 +94,24 @@
}); });
} }
} catch (error) { } catch (error) {
console.error('扫码检查订单失败:', error); // 只处理真正的错误,不是"没有订单"的情况
uni.showToast({ if (error.message && (
title: error.message || '处理失败,请稍后重试', error.message.includes('未识别到设备编号') ||
icon: 'none', error.message.includes('网络请求失败') ||
duration: 2000 error.message.includes('服务器错误')
}); )) {
// 错误时也尝试跳转到详情页,给用户一个操作入口 console.error('扫码检查订单失败:', error);
uni.showToast({
title: error.message || '处理失败,请稍后重试',
icon: 'none',
duration: 2000
});
} else {
// 对于其他错误,包括"没有找到订单",直接跳转到详情页,不显示错误消息
console.log('没有找到符合条件的订单或发生其他错误,直接跳转详情页');
}
// 无论什么情况,都跳转到一个可用页面
setTimeout(() => { setTimeout(() => {
if (option && option.deviceNo) { if (option && option.deviceNo) {
uni.redirectTo({ uni.redirectTo({
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"http.js","sources":["config/http.js"],"sourcesContent":["import {\r\n\tURL,\r\n\tappid\r\n} from './url'\r\n\r\nconst request = (option) => {\r\n\treturn new Promise((resolve, reject) => {\r\n\t\t// Debug request info\r\n\t\tconsole.log(`发起请求: ${option.method} ${URL + option.url}`, option.data)\r\n\t\t\r\n\t\tuni.request({\r\n\t\t\turl: URL + option.url,\r\n\t\t\tmethod: option.method,\r\n\t\t\tdata: option.data,\r\n\t\t\theader: {\r\n\t\t\t\t\"Content-Type\": \"application/x-www-form-urlencoded\",\r\n\t\t\t\t\t...option.headers,\r\n\t\t\t\t'appid': appid,\r\n\t\t\t\t'Authorization': \"Bearer \" + uni.getStorageSync('token'),\r\n\t\t\t\t'Clientid': uni.getStorageSync('client_id')\r\n\t\t\t},\r\n\t\t\tsuccess(res) {\r\n\t\t\t\t// 记录响应\r\n\t\t\t\tconsole.log(`请求响应: ${option.url}`, res)\r\n\t\t\t\t\r\n\t\t\t\t// 检查响应状态码\r\n\t\t\t\tif (res.statusCode !== 200) {\r\n\t\t\t\t\tconsole.error(`HTTP状态码错误: ${res.statusCode}`, res.data)\r\n\t\t\t\t\t\r\n\t\t\t\t\t// 为了适应某些服务器的异常响应,我们仍然返回数据\r\n\t\t\t\t\tif (res.data) {\r\n\t\t\t\t\t\tresolve(res.data)\r\n\t\t\t\t\t\treturn\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\treject({msg: `请求失败,状态码:${res.statusCode}`})\r\n\t\t\t\t\treturn\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// 检查业务状态码\r\n\t\t\t\tif (res.data && res.data.code !== 200) {\r\n\t\t\t\t\tconsole.warn(`业务状态码错误: ${res.data.code}`, res.data)\r\n\t\t\t\t\t\r\n\t\t\t\t\t// 仍然返回数据,由业务逻辑处理\r\n\t\t\t\t\tresolve(res.data)\r\n\t\t\t\t\treturn\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tresolve(res.data)\r\n\t\t\t},\r\n\t\t\tfail(err) {\r\n\t\t\t\t// 网络请求本身失败\r\n\t\t\t\tconsole.error(`请求失败: ${option.url}`, err)\r\n\t\t\t\treject(err)\r\n\t\t\t}\r\n\t\t})\r\n\t})\r\n}\r\n\r\n\r\nexport default request"],"names":["uni","URL","appid"],"mappings":";;;AAKK,MAAC,UAAU,CAAC,WAAW;AAC3B,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AAEvCA,kBAAA,MAAA,MAAA,OAAA,uBAAY,SAAS,OAAO,MAAM,IAAIC,WAAAA,MAAM,OAAO,GAAG,IAAI,OAAO,IAAI;AAErED,kBAAAA,MAAI,QAAQ;AAAA,MACX,KAAKC,WAAAA,MAAM,OAAO;AAAA,MAClB,QAAQ,OAAO;AAAA,MACf,MAAM,OAAO;AAAA,MACb,QAAQ;AAAA,QACP,gBAAgB;AAAA,QACf,GAAG,OAAO;AAAA,QACX,SAASC,WAAK;AAAA,QACd,iBAAiB,YAAYF,oBAAI,eAAe,OAAO;AAAA,QACvD,YAAYA,cAAAA,MAAI,eAAe,WAAW;AAAA,MAC1C;AAAA,MACD,QAAQ,KAAK;AAEZA,4BAAA,MAAA,OAAA,wBAAY,SAAS,OAAO,GAAG,IAAI,GAAG;AAGtC,YAAI,IAAI,eAAe,KAAK;AAC3BA,wBAAAA,6CAAc,cAAc,IAAI,UAAU,IAAI,IAAI,IAAI;AAGtD,cAAI,IAAI,MAAM;AACb,oBAAQ,IAAI,IAAI;AAChB;AAAA,UACA;AAED,iBAAO,EAAC,KAAK,YAAY,IAAI,UAAU,GAAE,CAAC;AAC1C;AAAA,QACA;AAGD,YAAI,IAAI,QAAQ,IAAI,KAAK,SAAS,KAAK;AACtCA,wBAAAA,MAAa,MAAA,QAAA,wBAAA,YAAY,IAAI,KAAK,IAAI,IAAI,IAAI,IAAI;AAGlD,kBAAQ,IAAI,IAAI;AAChB;AAAA,QACA;AAED,gBAAQ,IAAI,IAAI;AAAA,MAChB;AAAA,MACD,KAAK,KAAK;AAETA,4BAAA,MAAA,SAAA,wBAAc,SAAS,OAAO,GAAG,IAAI,GAAG;AACxC,eAAO,GAAG;AAAA,MACV;AAAA,IACJ,CAAG;AAAA,EACH,CAAE;AACF;;"} {"version":3,"file":"http.js","sources":["config/http.js"],"sourcesContent":["import {\r\n\tURL,\r\n\tappid\r\n} from './url'\r\n\r\nconst request = (option) => {\r\n\treturn new Promise((resolve, reject) => {\r\n\t\t// Debug request info\r\n\t\tconsole.log(`发起请求: ${option.method} ${URL + option.url}`, option.data)\r\n\t\t\r\n\t\t// 默认不显示加载中提示\r\n\t\tif (!option.hideLoading) {\r\n\t\t\tuni.showLoading({\r\n\t\t\t\ttitle: option.loadingText || '加载中...',\r\n\t\t\t\tmask: true\r\n\t\t\t})\r\n\t\t}\r\n\t\t\r\n\t\tuni.request({\r\n\t\t\turl: URL + option.url,\r\n\t\t\tmethod: option.method,\r\n\t\t\tdata: option.data,\r\n\t\t\theader: {\r\n\t\t\t\t\"Content-Type\": \"application/x-www-form-urlencoded\",\r\n\t\t\t\t\t...option.headers,\r\n\t\t\t\t'appid': appid,\r\n\t\t\t\t'Authorization': \"Bearer \" + uni.getStorageSync('token'),\r\n\t\t\t\t'Clientid': uni.getStorageSync('client_id')\r\n\t\t\t},\r\n\t\t\tsuccess(res) {\r\n\t\t\t\t// 记录响应\r\n\t\t\t\tconsole.log(`请求响应: ${option.url}`, res)\r\n\t\t\t\t\r\n\t\t\t\t// 检查响应状态码\r\n\t\t\t\tif (res.statusCode !== 200) {\r\n\t\t\t\t\tconsole.error(`HTTP状态码错误: ${res.statusCode}`, res.data)\r\n\t\t\t\t\t\r\n\t\t\t\t\t// 为了适应某些服务器的异常响应,我们仍然返回数据\r\n\t\t\t\t\tif (res.data) {\r\n\t\t\t\t\t\tresolve(res.data)\r\n\t\t\t\t\t\treturn\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\treject({msg: `请求失败,状态码:${res.statusCode}`})\r\n\t\t\t\t\treturn\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// 检查业务状态码\r\n\t\t\t\tif (res.data && res.data.code !== 200) {\r\n\t\t\t\t\tconsole.warn(`业务状态码错误: ${res.data.code}`, res.data)\r\n\t\t\t\t\t\r\n\t\t\t\t\t// 判断是否需要忽略数据为空的错误\r\n\t\t\t\t\tif (option.ignoreEmptyError && \r\n\t\t\t\t\t\t(res.data.code === 500 && res.data.msg && \r\n\t\t\t\t\t\t(res.data.msg.includes('未找到') || res.data.msg.includes('不存在')))) {\r\n\t\t\t\t\t\t// 对于指定需要忽略的错误,返回一个标准的\"成功但数据为空\"的响应\r\n\t\t\t\t\t\tresolve({\r\n\t\t\t\t\t\t\tcode: 200,\r\n\t\t\t\t\t\t\tmsg: \"操作成功\",\r\n\t\t\t\t\t\t\tdata: []\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t\treturn\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t// 仍然返回数据,由业务逻辑处理\r\n\t\t\t\t\tresolve(res.data)\r\n\t\t\t\t\treturn\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tresolve(res.data)\r\n\t\t\t},\r\n\t\t\tfail(err) {\r\n\t\t\t\t// 网络请求本身失败\r\n\t\t\t\tconsole.error(`请求失败: ${option.url}`, err)\r\n\t\t\t\treject(err)\r\n\t\t\t},\r\n\t\t\tcomplete() {\r\n\t\t\t\t// 隐藏加载提示\r\n\t\t\t\tif (!option.hideLoading) {\r\n\t\t\t\t\tuni.hideLoading()\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t})\r\n\t})\r\n}\r\n\r\n\r\nexport default request"],"names":["uni","URL","appid"],"mappings":";;;AAKK,MAAC,UAAU,CAAC,WAAW;AAC3B,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AAEvCA,kBAAA,MAAA,MAAA,OAAA,uBAAY,SAAS,OAAO,MAAM,IAAIC,WAAAA,MAAM,OAAO,GAAG,IAAI,OAAO,IAAI;AAGrE,QAAI,CAAC,OAAO,aAAa;AACxBD,oBAAAA,MAAI,YAAY;AAAA,QACf,OAAO,OAAO,eAAe;AAAA,QAC7B,MAAM;AAAA,MACV,CAAI;AAAA,IACD;AAEDA,kBAAAA,MAAI,QAAQ;AAAA,MACX,KAAKC,WAAAA,MAAM,OAAO;AAAA,MAClB,QAAQ,OAAO;AAAA,MACf,MAAM,OAAO;AAAA,MACb,QAAQ;AAAA,QACP,gBAAgB;AAAA,QACf,GAAG,OAAO;AAAA,QACX,SAASC,WAAK;AAAA,QACd,iBAAiB,YAAYF,oBAAI,eAAe,OAAO;AAAA,QACvD,YAAYA,cAAAA,MAAI,eAAe,WAAW;AAAA,MAC1C;AAAA,MACD,QAAQ,KAAK;AAEZA,4BAAA,MAAA,OAAA,wBAAY,SAAS,OAAO,GAAG,IAAI,GAAG;AAGtC,YAAI,IAAI,eAAe,KAAK;AAC3BA,wBAAAA,6CAAc,cAAc,IAAI,UAAU,IAAI,IAAI,IAAI;AAGtD,cAAI,IAAI,MAAM;AACb,oBAAQ,IAAI,IAAI;AAChB;AAAA,UACA;AAED,iBAAO,EAAC,KAAK,YAAY,IAAI,UAAU,GAAE,CAAC;AAC1C;AAAA,QACA;AAGD,YAAI,IAAI,QAAQ,IAAI,KAAK,SAAS,KAAK;AACtCA,wBAAAA,MAAa,MAAA,QAAA,wBAAA,YAAY,IAAI,KAAK,IAAI,IAAI,IAAI,IAAI;AAGlD,cAAI,OAAO,qBACT,IAAI,KAAK,SAAS,OAAO,IAAI,KAAK,QAClC,IAAI,KAAK,IAAI,SAAS,KAAK,KAAK,IAAI,KAAK,IAAI,SAAS,KAAK,KAAK;AAEjE,oBAAQ;AAAA,cACP,MAAM;AAAA,cACN,KAAK;AAAA,cACL,MAAM,CAAE;AAAA,YACf,CAAO;AACD;AAAA,UACA;AAGD,kBAAQ,IAAI,IAAI;AAChB;AAAA,QACA;AAED,gBAAQ,IAAI,IAAI;AAAA,MAChB;AAAA,MACD,KAAK,KAAK;AAETA,4BAAA,MAAA,SAAA,wBAAc,SAAS,OAAO,GAAG,IAAI,GAAG;AACxC,eAAO,GAAG;AAAA,MACV;AAAA,MACD,WAAW;AAEV,YAAI,CAAC,OAAO,aAAa;AACxBA,wBAAAA,MAAI,YAAa;AAAA,QACjB;AAAA,MACD;AAAA,IACJ,CAAG;AAAA,EACH,CAAE;AACF;;"}
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
{"version":3,"file":"index.js","sources":["E:/迅雷下载/HBuilderX.4.57.2025032507/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvZGVwb3NpdC9pbmRleC52dWU"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/deposit/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:/cGFnZXMvZGVwb3NpdC9pbmRleC52dWU"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/deposit/index.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
@@ -1 +1 @@
{"version":3,"file":"detail.js","sources":["E:/迅雷下载/HBuilderX.4.57.2025032507/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvZGV2aWNlL2RldGFpbC52dWU"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/device/detail.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"} {"version":3,"file":"detail.js","sources":["E:/迅雷下载/HBuilderX.4.57.2025032507/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvZGV2aWNlL2RldGFpbC52dWU"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/device/detail.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;"}
@@ -1 +1 @@
{"version":3,"file":"index.js","sources":["E:/迅雷下载/HBuilderX.4.57.2025032507/HBuilderX/plugins/uniapp-cli-vite/uniPage:/cGFnZXMvc2VydmUvYmFnQ2hlY2svaW5kZXgudnVl"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/serve/bagCheck/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:/cGFnZXMvc2VydmUvYmFnQ2hlY2svaW5kZXgudnVl"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/serve/bagCheck/index.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
+2 -2
View File
@@ -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_WlfuId"; const id = "mp-weixin_DyxEKd";
const lazy = typeof swan !== "undefined"; const lazy = typeof swan !== "undefined";
let restoreError = lazy ? () => { let restoreError = lazy ? () => {
} : initOnError(); } : initOnError();
+23 -4
View File
@@ -4,6 +4,12 @@ const config_url = require("./url.js");
const request = (option) => { const request = (option) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
common_vendor.index.__f__("log", "at config/http.js:9", `发起请求: ${option.method} ${config_url.URL + option.url}`, option.data); common_vendor.index.__f__("log", "at config/http.js:9", `发起请求: ${option.method} ${config_url.URL + option.url}`, option.data);
if (!option.hideLoading) {
common_vendor.index.showLoading({
title: option.loadingText || "加载中...",
mask: true
});
}
common_vendor.index.request({ common_vendor.index.request({
url: config_url.URL + option.url, url: config_url.URL + option.url,
method: option.method, method: option.method,
@@ -16,9 +22,9 @@ const request = (option) => {
"Clientid": common_vendor.index.getStorageSync("client_id") "Clientid": common_vendor.index.getStorageSync("client_id")
}, },
success(res) { success(res) {
common_vendor.index.__f__("log", "at config/http.js:24", `请求响应: ${option.url}`, res); common_vendor.index.__f__("log", "at config/http.js:32", `请求响应: ${option.url}`, res);
if (res.statusCode !== 200) { if (res.statusCode !== 200) {
common_vendor.index.__f__("error", "at config/http.js:28", `HTTP状态码错误: ${res.statusCode}`, res.data); common_vendor.index.__f__("error", "at config/http.js:36", `HTTP状态码错误: ${res.statusCode}`, res.data);
if (res.data) { if (res.data) {
resolve(res.data); resolve(res.data);
return; return;
@@ -27,15 +33,28 @@ const request = (option) => {
return; return;
} }
if (res.data && res.data.code !== 200) { if (res.data && res.data.code !== 200) {
common_vendor.index.__f__("warn", "at config/http.js:42", `业务状态码错误: ${res.data.code}`, res.data); common_vendor.index.__f__("warn", "at config/http.js:50", `业务状态码错误: ${res.data.code}`, res.data);
if (option.ignoreEmptyError && (res.data.code === 500 && res.data.msg && (res.data.msg.includes("未找到") || res.data.msg.includes("不存在")))) {
resolve({
code: 200,
msg: "操作成功",
data: []
});
return;
}
resolve(res.data); resolve(res.data);
return; return;
} }
resolve(res.data); resolve(res.data);
}, },
fail(err) { fail(err) {
common_vendor.index.__f__("error", "at config/http.js:53", `请求失败: ${option.url}`, err); common_vendor.index.__f__("error", "at config/http.js:74", `请求失败: ${option.url}`, err);
reject(err); reject(err);
},
complete() {
if (!option.hideLoading) {
common_vendor.index.hideLoading();
}
} }
}); });
}); });
+6 -4
View File
@@ -36,8 +36,10 @@ const checkOrdersByStatus = (deviceNo, statuses) => {
return config_http.request({ return config_http.request({
url: `/app/order/list?deviceNo=${deviceNo}&orderStatus=${statusQuery}`, url: `/app/order/list?deviceNo=${deviceNo}&orderStatus=${statusQuery}`,
method: "get", method: "get",
hideLoading: true hideLoading: true,
// 隐藏加载提示,避免干扰用户 // 隐藏加载提示,避免干扰用户
ignoreEmptyError: true
// 添加标记,表示即使返回空数据也不视为错误
}); });
}; };
const getDeviceInfo = (deviceNo) => { const getDeviceInfo = (deviceNo) => {
@@ -47,7 +49,7 @@ const getDeviceInfo = (deviceNo) => {
}); });
}; };
const queryById = (id) => { const queryById = (id) => {
common_vendor.index.__f__("log", "at config/user.js:80", `查询订单详情, orderId: ${id}`); common_vendor.index.__f__("log", "at config/user.js:81", `查询订单详情, orderId: ${id}`);
return config_http.request({ return config_http.request({
url: `/app/order/${id}`, url: `/app/order/${id}`,
method: "get", method: "get",
@@ -62,14 +64,14 @@ const rentPowerBank = (deviceNo, phone) => {
}); });
}; };
const confirmPaymentAndRent = (orderId) => { const confirmPaymentAndRent = (orderId) => {
common_vendor.index.__f__("log", "at config/user.js:119", `确认支付并弹出充电宝, orderId: ${orderId}`); common_vendor.index.__f__("log", "at config/user.js:120", `确认支付并弹出充电宝, orderId: ${orderId}`);
return config_http.request({ return config_http.request({
url: `/app/device/confirmPaymentAndRent?orderId=${orderId}`, url: `/app/device/confirmPaymentAndRent?orderId=${orderId}`,
method: "post" method: "post"
}); });
}; };
const updateOrderPackage = (data) => { const updateOrderPackage = (data) => {
common_vendor.index.__f__("log", "at config/user.js:158", "更新订单套餐信息:", data); common_vendor.index.__f__("log", "at config/user.js:159", "更新订单套餐信息:", data);
return config_http.request({ return config_http.request({
url: "/app/device/updateOrderPackage", url: "/app/device/updateOrderPackage",
method: "post", method: "post",
+9 -7
View File
@@ -53,20 +53,22 @@ const _sfc_main = {
}); });
return; return;
} }
const res = await config_user.queryById(Number(this.orderNo)); if (this.orderId.length != 0 || this.orderNo.length != 0) {
common_vendor.index.__f__("log", "at pages/deposit/index.vue:100", res); const res = await config_user.queryById(Number(this.orderId));
common_vendor.index.__f__("log", "at pages/deposit/index.vue:101", res);
}
common_vendor.index.showModal({ common_vendor.index.showModal({
title: "确认提现", title: "确认提现",
content: "押金将原路退回,预计0-7个工作日到账", content: "押金将原路退回,预计0-7个工作日到账",
success: async (res2) => { success: async (res) => {
if (res2.confirm) { if (res.confirm) {
common_vendor.index.showLoading({ common_vendor.index.showLoading({
title: "提现中..." title: "提现中..."
}); });
try { try {
common_vendor.index.__f__("log", "at pages/deposit/index.vue:119", "发起提现请求,订单号:", this.orderNo); common_vendor.index.__f__("log", "at pages/deposit/index.vue:122", "发起提现请求,订单号:", this.orderNo);
const result = await config_user.withdrawDeposit(this.orderNo); const result = await config_user.withdrawDeposit(this.orderNo);
common_vendor.index.__f__("log", "at pages/deposit/index.vue:121", "提现响应:", result); common_vendor.index.__f__("log", "at pages/deposit/index.vue:124", "提现响应:", result);
if (result.code === 200) { if (result.code === 200) {
common_vendor.index.hideLoading(); common_vendor.index.hideLoading();
common_vendor.index.showToast({ common_vendor.index.showToast({
@@ -86,7 +88,7 @@ const _sfc_main = {
throw new Error(result.msg || "提现失败"); throw new Error(result.msg || "提现失败");
} }
} catch (error) { } catch (error) {
common_vendor.index.__f__("error", "at pages/deposit/index.vue:146", "提现失败:", error); common_vendor.index.__f__("error", "at pages/deposit/index.vue:149", "提现失败:", error);
common_vendor.index.hideLoading(); common_vendor.index.hideLoading();
let errorMessage = "提现失败,请稍后再试"; let errorMessage = "提现失败,请稍后再试";
if (error.message) { if (error.message) {
+144 -29
View File
@@ -14,23 +14,9 @@ const _sfc_main = {
class: "available" class: "available"
}, },
selectedPackage: 1, selectedPackage: 1,
packages: [ packages: [],
{ depositAmount: "99.00",
time: "1小时", // 默认押金金额
price: "2.00",
unitPrice: "2.00"
},
{
time: "4小时",
price: "6.00",
unitPrice: "1.50"
},
{
time: "12小时",
price: "15.00",
unitPrice: "1.25"
}
],
isLoggedIn: true, isLoggedIn: true,
phoneNumber: "" phoneNumber: ""
}; };
@@ -38,7 +24,7 @@ const _sfc_main = {
onLoad(options) { onLoad(options) {
this.deviceId = options.deviceNo; this.deviceId = options.deviceNo;
this.checkOrderStatus(); this.checkOrderStatus();
common_vendor.index.__f__("log", "at pages/device/detail.vue:128", options.deviceNo); common_vendor.index.__f__("log", "at pages/device/detail.vue:114", options.deviceNo);
this.getDeviceInfo(); this.getDeviceInfo();
}, },
methods: { methods: {
@@ -46,7 +32,134 @@ const _sfc_main = {
async getDeviceInfo() { async getDeviceInfo() {
const res = await config_user.getDeviceInfo(this.deviceId); const res = await config_user.getDeviceInfo(this.deviceId);
if (res.code == 200) { if (res.code == 200) {
this.deviceInfo = res.data; this.deviceInfo = res.data.device || {};
if (this.deviceInfo.deviceLocation) {
this.deviceLocation = this.deviceInfo.deviceLocation;
} else if (res.data.position && res.data.position.name) {
this.deviceLocation = res.data.position.name;
}
if (this.deviceInfo.depositAmount) {
this.depositAmount = this.deviceInfo.depositAmount;
}
if (this.deviceInfo.status) {
if (this.deviceInfo.status === "online") {
this.deviceStatus = {
text: "可使用",
class: "available"
};
} else if (this.deviceInfo.status === "offline") {
this.deviceStatus = {
text: "离线",
class: "offline"
};
}
}
if (this.deviceInfo.feeConfig) {
try {
const feeConfig = JSON.parse(this.deviceInfo.feeConfig);
if (feeConfig.length > 0 && "Hour" in feeConfig[0] && "Price" in feeConfig[0]) {
this.packages = feeConfig.map((pkg) => {
const hour = pkg.Hour;
const price = pkg.Price;
const unitPrice = (price / hour).toFixed(2);
return {
time: `${hour}${hour > 1 ? "小时" : "小时"}`,
price: price.toFixed(2),
unitPrice
};
});
} else {
const commonConfig = feeConfig.find((item) => item.specCode === "common") || feeConfig[0];
if (commonConfig) {
if (this.deviceInfo.feeType === "hour") {
const hourPrice = commonConfig.hourPrice > 0 ? commonConfig.hourPrice : commonConfig.timesPrice / 6;
this.packages = [
{
time: "1小时",
price: hourPrice.toFixed(2),
unitPrice: hourPrice.toFixed(2)
},
{
time: "6小时",
price: (hourPrice * 6).toFixed(2),
unitPrice: hourPrice.toFixed(2)
},
{
time: "12小时",
price: (hourPrice * 12).toFixed(2),
unitPrice: hourPrice.toFixed(2)
}
];
} else if (this.deviceInfo.feeType === "times") {
const timesPrice = commonConfig.timesPrice;
this.packages = [
{
time: "1次",
price: timesPrice.toFixed(2),
unitPrice: timesPrice.toFixed(2)
}
];
} else {
this.packages = [
{
time: "1小时",
price: "2.00",
unitPrice: "2.00"
},
{
time: "6小时",
price: "10.00",
unitPrice: "1.67"
},
{
time: "12小时",
price: "15.00",
unitPrice: "1.25"
}
];
}
}
}
this.selectedPackage = Math.min(1, this.packages.length - 1);
} catch (e) {
common_vendor.index.__f__("error", "at pages/device/detail.vue:234", "解析设备费用配置失败:", e);
this.packages = [
{
time: "1小时",
price: "2.00",
unitPrice: "2.00"
},
{
time: "6小时",
price: "10.00",
unitPrice: "1.67"
},
{
time: "12小时",
price: "15.00",
unitPrice: "1.25"
}
];
}
} else {
this.packages = [
{
time: "1小时",
price: "2.00",
unitPrice: "2.00"
},
{
time: "6小时",
price: "10.00",
unitPrice: "1.67"
},
{
time: "12小时",
price: "15.00",
unitPrice: "1.25"
}
];
}
} }
}, },
// 显示登录提示 // 显示登录提示
@@ -113,7 +226,7 @@ const _sfc_main = {
const selectedPkg = this.packages[this.selectedPackage]; const selectedPkg = this.packages[this.selectedPackage];
common_vendor.index.showModal({ common_vendor.index.showModal({
title: "确认租借", title: "确认租借",
content: `确认支付押金¥99.00${selectedPkg.time}套餐费用¥${selectedPkg.price}`, content: `确认支付押金¥{{ depositAmount }}${selectedPkg.time}套餐费用¥${selectedPkg.price}`,
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
this.submitRentOrder(); this.submitRentOrder();
@@ -148,19 +261,19 @@ const _sfc_main = {
packagePrice: parseFloat(selectedPkg.price) packagePrice: parseFloat(selectedPkg.price)
}); });
if (updateRes.code !== 200) { if (updateRes.code !== 200) {
common_vendor.index.__f__("warn", "at pages/device/detail.vue:265", "更新订单套餐信息失败:", updateRes.msg); common_vendor.index.__f__("warn", "at pages/device/detail.vue:402", "更新订单套餐信息失败:", updateRes.msg);
} else { } else {
common_vendor.index.__f__("log", "at pages/device/detail.vue:268", "订单套餐信息已提前更新"); common_vendor.index.__f__("log", "at pages/device/detail.vue:405", "订单套餐信息已提前更新");
} }
} catch (updateError) { } catch (updateError) {
common_vendor.index.__f__("error", "at pages/device/detail.vue:271", "更新订单套餐信息时出错:", updateError); common_vendor.index.__f__("error", "at pages/device/detail.vue:408", "更新订单套餐信息时出错:", updateError);
} }
const deposit = 99; const deposit = parseFloat(this.depositAmount);
const packagePrice = parseFloat(selectedPkg.price); const packagePrice = parseFloat(selectedPkg.price);
const totalAmount = (deposit + packagePrice).toFixed(2); const totalAmount = (deposit + packagePrice).toFixed(2);
common_vendor.index.hideLoading(); common_vendor.index.hideLoading();
common_vendor.index.redirectTo({ common_vendor.index.redirectTo({
url: `/pages/order/payment?orderId=${order.orderId}&packageTime=${selectedPkg.time}&packagePrice=${selectedPkg.price}&totalAmount=${totalAmount}` url: `/pages/order/payment?orderId=${order.orderId}&packageTimeHours=${selectedPkg.time.replace("小时", "")}&packagePrice=${selectedPkg.price}&totalAmount=${totalAmount}&depositAmount=${this.depositAmount}`
}); });
} catch (error) { } catch (error) {
common_vendor.index.hideLoading(); common_vendor.index.hideLoading();
@@ -198,10 +311,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
j: common_vendor.o(($event) => $data.phoneNumber = $event.detail.value) j: common_vendor.o(($event) => $data.phoneNumber = $event.detail.value)
} : {}, { } : {}, {
k: !$data.hasActiveOrder k: !$data.hasActiveOrder
}, !$data.hasActiveOrder ? {} : {}, { }, !$data.hasActiveOrder ? {
l: common_vendor.t($data.hasActiveOrder ? "归还设备" : "立即租借"), l: common_vendor.t($data.depositAmount)
m: common_vendor.n($data.hasActiveOrder ? "return" : "rent"), } : {}, {
n: common_vendor.o((...args) => $options.handleRent && $options.handleRent(...args)) m: common_vendor.t($data.hasActiveOrder ? "归还设备" : "立即租借"),
n: common_vendor.n($data.hasActiveOrder ? "return" : "rent"),
o: common_vendor.o((...args) => $options.handleRent && $options.handleRent(...args))
}); });
} }
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-d65de3a7"]]); const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-d65de3a7"]]);
+1 -1
View File
@@ -1 +1 @@
<view class="detail-container data-v-d65de3a7"><view class="device-card data-v-d65de3a7"><view class="device-header data-v-d65de3a7"><view class="device-title data-v-d65de3a7"><text class="name data-v-d65de3a7">共享风扇</text><text class="id data-v-d65de3a7">设备号:{{a}}</text></view><view class="{{['status', 'data-v-d65de3a7', c]}}">{{b}}</view></view><view class="device-info data-v-d65de3a7"><view class="info-item data-v-d65de3a7"><text class="label data-v-d65de3a7">设备位置</text><text class="value data-v-d65de3a7">{{d}}</text></view><view class="info-item data-v-d65de3a7"><text class="label data-v-d65de3a7">电池电量</text><text class="value data-v-d65de3a7">{{e}}%</text></view></view></view><view wx:if="{{f}}" class="package-section data-v-d65de3a7"><view class="section-title data-v-d65de3a7">选择套餐</view><view class="package-list data-v-d65de3a7"><view wx:for="{{g}}" wx:for-item="pkg" wx:key="d" class="{{['package-item', 'data-v-d65de3a7', pkg.e && 'active']}}" bindtap="{{pkg.f}}"><view class="package-content data-v-d65de3a7"><text class="time data-v-d65de3a7">{{pkg.a}}</text><text class="price data-v-d65de3a7">¥{{pkg.b}}</text></view><text class="unit-price data-v-d65de3a7">约{{pkg.c}}元/小时</text></view></view></view><view wx:if="{{h}}" class="phone-section data-v-d65de3a7"><view class="section-title data-v-d65de3a7">联系方式</view><view class="phone-input-wrap data-v-d65de3a7"><input type="number" class="phone-input data-v-d65de3a7" maxlength="11" placeholder="请输入手机号码" value="{{i}}" bindinput="{{j}}"/></view></view><view class="notice-section data-v-d65de3a7"><view class="section-title data-v-d65de3a7">使用说明</view><view class="notice-list data-v-d65de3a7"><view class="notice-item data-v-d65de3a7"><view class="dot data-v-d65de3a7"></view><text class="data-v-d65de3a7">请在使用前检查设备是否完好</text></view><view class="notice-item data-v-d65de3a7"><view class="dot data-v-d65de3a7"></view><text class="data-v-d65de3a7">超出使用时间将自动按小时计费</text></view><view class="notice-item data-v-d65de3a7"><view class="dot data-v-d65de3a7"></view><text class="data-v-d65de3a7">请在指定区域内使用设备</text></view></view></view><view class="bottom-bar data-v-d65de3a7"><view wx:if="{{k}}" class="price-info data-v-d65de3a7"><text class="deposit-text data-v-d65de3a7">押金:</text><text class="deposit-amount data-v-d65de3a7">¥99</text></view><button class="{{['action-btn', 'data-v-d65de3a7', m]}}" bindtap="{{n}}">{{l}}</button></view></view> <view class="detail-container data-v-d65de3a7"><view class="device-card data-v-d65de3a7"><view class="device-header data-v-d65de3a7"><view class="device-title data-v-d65de3a7"><text class="name data-v-d65de3a7">共享风扇</text><text class="id data-v-d65de3a7">设备号:{{a}}</text></view><view class="{{['status', 'data-v-d65de3a7', c]}}">{{b}}</view></view><view class="device-info data-v-d65de3a7"><view class="info-item data-v-d65de3a7"><text class="label data-v-d65de3a7">设备位置</text><text class="value data-v-d65de3a7">{{d}}</text></view><view class="info-item data-v-d65de3a7"><text class="label data-v-d65de3a7">电池电量</text><text class="value data-v-d65de3a7">{{e}}%</text></view></view></view><view wx:if="{{f}}" class="package-section data-v-d65de3a7"><view class="section-title data-v-d65de3a7">选择套餐</view><view class="package-list data-v-d65de3a7"><view wx:for="{{g}}" wx:for-item="pkg" wx:key="d" class="{{['package-item', 'data-v-d65de3a7', pkg.e && 'active']}}" bindtap="{{pkg.f}}"><view class="package-content data-v-d65de3a7"><text class="time data-v-d65de3a7">{{pkg.a}}</text><text class="price data-v-d65de3a7">¥{{pkg.b}}</text></view><text class="unit-price data-v-d65de3a7">约{{pkg.c}}元/小时</text></view></view></view><view wx:if="{{h}}" class="phone-section data-v-d65de3a7"><view class="section-title data-v-d65de3a7">联系方式</view><view class="phone-input-wrap data-v-d65de3a7"><input type="number" class="phone-input data-v-d65de3a7" maxlength="11" placeholder="请输入手机号码" value="{{i}}" bindinput="{{j}}"/></view></view><view class="notice-section data-v-d65de3a7"><view class="section-title data-v-d65de3a7">使用说明</view><view class="notice-list data-v-d65de3a7"><view class="notice-item data-v-d65de3a7"><view class="dot data-v-d65de3a7"></view><text class="data-v-d65de3a7">请在使用前检查设备是否完好</text></view><view class="notice-item data-v-d65de3a7"><view class="dot data-v-d65de3a7"></view><text class="data-v-d65de3a7">超出使用时间将自动按小时计费</text></view><view class="notice-item data-v-d65de3a7"><view class="dot data-v-d65de3a7"></view><text class="data-v-d65de3a7">请在指定区域内使用设备</text></view></view></view><view class="bottom-bar data-v-d65de3a7"><view wx:if="{{k}}" class="price-info data-v-d65de3a7"><text class="deposit-text data-v-d65de3a7">押金:</text><text class="deposit-amount data-v-d65de3a7">¥{{l}}</text></view><button class="{{['action-btn', 'data-v-d65de3a7', n]}}" bindtap="{{o}}">{{m}}</button></view></view>
+69 -25
View File
@@ -6,11 +6,13 @@ const _sfc_main = {
data() { data() {
return { return {
orderId: null, orderId: null,
deviceNo: null,
orderInfo: {}, orderInfo: {},
packageInfo: { packageInfo: {
time: "", time: "",
price: "0.00" price: "0.00"
}, },
deviceInfo: null,
passedTotalAmount: null, passedTotalAmount: null,
passedDepositAmount: null, passedDepositAmount: null,
orderStatus: { orderStatus: {
@@ -25,20 +27,14 @@ const _sfc_main = {
if (this.passedTotalAmount !== null) { if (this.passedTotalAmount !== null) {
return parseFloat(this.passedTotalAmount).toFixed(2); return parseFloat(this.passedTotalAmount).toFixed(2);
} }
const deposit = parseFloat(this.orderInfo.deposit || 99); const deposit = parseFloat(this.orderInfo.deposit || this.passedDepositAmount || 99);
const amount = parseFloat(this.orderInfo.amount || this.packageInfo.price || 0); const packagePrice = parseFloat(this.packageInfo.price || 0);
return (deposit + amount).toFixed(2); return (deposit + packagePrice).toFixed(2);
} }
}, },
onLoad(options) { onLoad(options) {
if (options && options.orderId) { if (options && options.orderId) {
this.orderId = options.orderId; this.orderId = options.orderId;
if (options.packageTime && options.packagePrice) {
this.packageInfo = {
time: options.packageTime,
price: options.packagePrice
};
}
if (options.totalAmount) { if (options.totalAmount) {
this.passedTotalAmount = options.totalAmount; this.passedTotalAmount = options.totalAmount;
} }
@@ -76,7 +72,7 @@ const _sfc_main = {
formattedTime = this.formatTime(/* @__PURE__ */ new Date()); formattedTime = this.formatTime(/* @__PURE__ */ new Date());
} }
} catch (e) { } catch (e) {
common_vendor.index.__f__("error", "at pages/order/payment.vue:158", "时间格式化错误:", e); common_vendor.index.__f__("error", "at pages/order/payment.vue:149", "时间格式化错误:", e);
formattedTime = this.formatTime(/* @__PURE__ */ new Date()); formattedTime = this.formatTime(/* @__PURE__ */ new Date());
} }
this.orderInfo = { this.orderInfo = {
@@ -84,14 +80,10 @@ const _sfc_main = {
deviceNo: orderData.deviceNo, deviceNo: orderData.deviceNo,
createTime: formattedTime, createTime: formattedTime,
phone: orderData.phone, phone: orderData.phone,
deposit: this.passedDepositAmount || orderData.depositAmount || "99.00", deposit: this.passedDepositAmount || orderData.depositAmount || "99.00"
// 优先使用传递的押金,然后是订单中的押金,最后默认99元
amount: orderData.amount || this.packageInfo.price || "0.00"
}; };
if (!orderData.packageTime && this.packageInfo.time) { this.deviceNo = orderData.deviceNo;
this.orderInfo.packageTime = this.packageInfo.time; await this.loadDeviceInfo();
this.orderInfo.packagePrice = this.packageInfo.price;
}
} else { } else {
throw new Error("获取订单信息失败"); throw new Error("获取订单信息失败");
} }
@@ -104,6 +96,59 @@ const _sfc_main = {
}); });
} }
}, },
// 加载设备信息并解析套餐
async loadDeviceInfo() {
if (!this.deviceNo)
return;
try {
const res = await config_user.getDeviceInfo(this.deviceNo);
if (res.code === 200 && res.data) {
this.deviceInfo = res.data.device;
if (this.deviceInfo && this.deviceInfo.feeConfig) {
try {
const feeConfig = JSON.parse(this.deviceInfo.feeConfig);
if (feeConfig.length > 0 && "Hour" in feeConfig[0] && "Price" in feeConfig[0]) {
const targetHours = 6;
let closestPackage = feeConfig[0];
feeConfig.forEach((pkg) => {
if (Math.abs(pkg.Hour - targetHours) < Math.abs(closestPackage.Hour - targetHours)) {
closestPackage = pkg;
}
});
this.packageInfo.time = closestPackage.Hour.toString();
this.packageInfo.price = closestPackage.Price.toString();
} else {
const selectedConfig = feeConfig.find((item) => item.specCode === "common") || feeConfig[0];
if (selectedConfig) {
const packageHours = 6;
if (this.deviceInfo.feeType === "times") {
this.packageInfo.price = selectedConfig.timesPrice.toString();
this.packageInfo.time = "1次";
} else if (this.deviceInfo.feeType === "hour") {
if (selectedConfig.hourPrice > 0) {
this.packageInfo.price = (selectedConfig.hourPrice * packageHours).toString();
} else {
this.packageInfo.price = selectedConfig.timesPrice.toString();
}
this.packageInfo.time = packageHours.toString();
} else {
this.packageInfo.price = selectedConfig.timesPrice.toString();
this.packageInfo.time = packageHours.toString();
}
}
}
} catch (e) {
common_vendor.index.__f__("error", "at pages/order/payment.vue:241", "解析设备费用配置失败:", e);
}
}
if (this.deviceInfo && this.deviceInfo.depositAmount) {
this.orderInfo.deposit = this.deviceInfo.depositAmount;
}
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/order/payment.vue:251", "获取设备信息失败:", error);
}
},
// 处理支付 // 处理支付
async handlePayment() { async handlePayment() {
try { try {
@@ -130,7 +175,7 @@ const _sfc_main = {
try { try {
await config_user.updateUserBalance(this.orderId); await config_user.updateUserBalance(this.orderId);
} catch (error) { } catch (error) {
common_vendor.index.__f__("warn", "at pages/order/payment.vue:223", "更新用户余额失败:", error); common_vendor.index.__f__("warn", "at pages/order/payment.vue:288", "更新用户余额失败:", error);
} }
setTimeout(() => { setTimeout(() => {
common_vendor.index.redirectTo({ common_vendor.index.redirectTo({
@@ -139,7 +184,7 @@ const _sfc_main = {
}, 1500); }, 1500);
}, },
fail: (err) => { fail: (err) => {
common_vendor.index.__f__("error", "at pages/order/payment.vue:234", "支付失败:", err); common_vendor.index.__f__("error", "at pages/order/payment.vue:299", "支付失败:", err);
throw new Error("支付失败,请重试"); throw new Error("支付失败,请重试");
} }
}); });
@@ -236,7 +281,7 @@ const _sfc_main = {
throw new Error("查询订单状态失败"); throw new Error("查询订单状态失败");
} }
} catch (error) { } catch (error) {
common_vendor.index.__f__("error", "at pages/order/payment.vue:342", "查询订单状态错误:", error); common_vendor.index.__f__("error", "at pages/order/payment.vue:407", "查询订单状态错误:", error);
return null; return null;
} }
} }
@@ -252,12 +297,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
f: common_vendor.t($data.orderInfo.createTime || "-"), f: common_vendor.t($data.orderInfo.createTime || "-"),
g: common_vendor.t($data.orderInfo.phone || "-"), g: common_vendor.t($data.orderInfo.phone || "-"),
h: common_vendor.t($data.orderInfo.deposit || "99.00"), h: common_vendor.t($data.orderInfo.deposit || "99.00"),
i: common_vendor.t($data.packageInfo.time), i: common_vendor.t($data.packageInfo.price),
j: common_vendor.t($data.packageInfo.price), j: common_vendor.t($data.packageInfo.time),
k: common_vendor.t($data.orderInfo.amount || $data.packageInfo.price), k: common_vendor.t($options.totalAmount),
l: common_vendor.t($options.totalAmount), l: common_vendor.t($options.totalAmount),
m: common_vendor.t($options.totalAmount), m: common_vendor.o((...args) => $options.handlePayment && $options.handlePayment(...args))
n: common_vendor.o((...args) => $options.handlePayment && $options.handlePayment(...args))
}; };
} }
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-13c3fb22"]]); const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-13c3fb22"]]);
+1 -1
View File
@@ -1 +1 @@
<view class="payment-container data-v-13c3fb22"><view class="status-card data-v-13c3fb22"><view class="{{['status-icon', 'data-v-13c3fb22', a]}}"></view><view class="status-text data-v-13c3fb22">{{b}}</view><view class="status-desc data-v-13c3fb22">{{c}}</view></view><view class="order-card data-v-13c3fb22"><view class="card-title data-v-13c3fb22">订单信息</view><view class="info-item data-v-13c3fb22"><text class="label data-v-13c3fb22">订单号</text><text class="value data-v-13c3fb22">{{d}}</text></view><view class="info-item data-v-13c3fb22"><text class="label data-v-13c3fb22">设备号</text><text class="value data-v-13c3fb22">{{e}}</text></view><view class="info-item data-v-13c3fb22"><text class="label data-v-13c3fb22">创建时间</text><text class="value data-v-13c3fb22">{{f}}</text></view><view class="info-item data-v-13c3fb22"><text class="label data-v-13c3fb22">联系电话</text><text class="value data-v-13c3fb22">{{g}}</text></view></view><view class="price-card data-v-13c3fb22"><view class="card-title data-v-13c3fb22">费用信息</view><view class="price-item data-v-13c3fb22"><text class="label data-v-13c3fb22">押金</text><text class="value data-v-13c3fb22">¥{{h}}</text></view><view class="price-item data-v-13c3fb22"><text class="label data-v-13c3fb22">套餐</text><text class="value data-v-13c3fb22">{{i}} (¥{{j}})</text></view><view class="price-item data-v-13c3fb22"><text class="label data-v-13c3fb22">租借费用</text><text class="value data-v-13c3fb22">¥{{k}}</text></view><view class="price-item total data-v-13c3fb22"><text class="label data-v-13c3fb22">合计</text><text class="value data-v-13c3fb22">¥{{l}}</text></view></view><view class="bottom-bar data-v-13c3fb22"><view class="total-amount data-v-13c3fb22"><text class="data-v-13c3fb22">合计:</text><text class="amount data-v-13c3fb22">¥{{m}}</text></view><button class="pay-btn data-v-13c3fb22" bindtap="{{n}}">立即支付</button></view></view> <view class="payment-container data-v-13c3fb22"><view class="status-card data-v-13c3fb22"><view class="{{['status-icon', 'data-v-13c3fb22', a]}}"></view><view class="status-text data-v-13c3fb22">{{b}}</view><view class="status-desc data-v-13c3fb22">{{c}}</view></view><view class="order-card data-v-13c3fb22"><view class="card-title data-v-13c3fb22">订单信息</view><view class="info-item data-v-13c3fb22"><text class="label data-v-13c3fb22">订单号</text><text class="value data-v-13c3fb22">{{d}}</text></view><view class="info-item data-v-13c3fb22"><text class="label data-v-13c3fb22">设备号</text><text class="value data-v-13c3fb22">{{e}}</text></view><view class="info-item data-v-13c3fb22"><text class="label data-v-13c3fb22">创建时间</text><text class="value data-v-13c3fb22">{{f}}</text></view><view class="info-item data-v-13c3fb22"><text class="label data-v-13c3fb22">联系电话</text><text class="value data-v-13c3fb22">{{g}}</text></view></view><view class="price-card data-v-13c3fb22"><view class="card-title data-v-13c3fb22">费用信息</view><view class="price-item data-v-13c3fb22"><text class="label data-v-13c3fb22">押金</text><text class="value data-v-13c3fb22">¥{{h}}</text></view><view class="price-item data-v-13c3fb22"><text class="label data-v-13c3fb22">套餐</text><text class="value data-v-13c3fb22">{{i}}元/{{j}}小时</text></view><view class="price-item total data-v-13c3fb22"><text class="label data-v-13c3fb22">合计</text><text class="value data-v-13c3fb22">¥{{k}}</text></view></view><view class="bottom-bar data-v-13c3fb22"><view class="total-amount data-v-13c3fb22"><text class="data-v-13c3fb22">合计:</text><text class="amount data-v-13c3fb22">¥{{l}}</text></view><button class="pay-btn data-v-13c3fb22" bindtap="{{m}}">立即支付</button></view></view>
+16 -10
View File
@@ -27,32 +27,38 @@ const _sfc_main = {
}); });
} else if (latestOrder.orderStatus === "waiting_for_payment") { } else if (latestOrder.orderStatus === "waiting_for_payment") {
common_vendor.index.__f__("log", "at pages/serve/bagCheck/index.vue:59", "检测到待支付订单,跳转支付页:", latestOrder.orderId); common_vendor.index.__f__("log", "at pages/serve/bagCheck/index.vue:59", "检测到待支付订单,跳转支付页:", latestOrder.orderId);
const packageTime = latestOrder.packageTime ? `${latestOrder.packageTime / 60}小时` : "默认套餐"; const packageTimeMinutes = latestOrder.packageTime || 60;
const packageTimeHours = (packageTimeMinutes / 60).toFixed(1);
const packagePrice = latestOrder.packagePrice || "0.00"; const packagePrice = latestOrder.packagePrice || "0.00";
const hourlyRate = (parseFloat(packagePrice) / (packageTimeMinutes / 60)).toFixed(2);
const depositAmount = latestOrder.depositAmount || "99.00"; const depositAmount = latestOrder.depositAmount || "99.00";
const totalAmount = (parseFloat(depositAmount) + parseFloat(packagePrice)).toFixed(2); const totalAmount = (parseFloat(depositAmount) + parseFloat(packagePrice)).toFixed(2);
common_vendor.index.redirectTo({ common_vendor.index.redirectTo({
url: `/pages/order/payment?orderId=${latestOrder.orderId}&packageTime=${packageTime}&packagePrice=${packagePrice}&totalAmount=${totalAmount}&depositAmount=${depositAmount}` url: `/pages/order/payment?orderId=${latestOrder.orderId}&packageTimeHours=${packageTimeHours}&packagePrice=${packagePrice}&hourlyRate=${hourlyRate}&totalAmount=${totalAmount}&depositAmount=${depositAmount}`
}); });
} else { } else {
common_vendor.index.__f__("log", "at pages/serve/bagCheck/index.vue:70", "检测到其他状态订单,跳转详情页:", latestOrder.orderId); common_vendor.index.__f__("log", "at pages/serve/bagCheck/index.vue:84", "检测到其他状态订单,跳转详情页:", latestOrder.orderId);
common_vendor.index.redirectTo({ common_vendor.index.redirectTo({
url: `/pages/device/detail?deviceNo=${deviceNo}` url: `/pages/device/detail?deviceNo=${deviceNo}`
}); });
} }
} else { } else {
common_vendor.index.__f__("log", "at pages/serve/bagCheck/index.vue:77", "未检测到相关订单,跳转详情页"); common_vendor.index.__f__("log", "at pages/serve/bagCheck/index.vue:91", "未检测到相关订单,跳转详情页");
common_vendor.index.redirectTo({ common_vendor.index.redirectTo({
url: `/pages/device/detail?deviceNo=${deviceNo}` url: `/pages/device/detail?deviceNo=${deviceNo}`
}); });
} }
} catch (error) { } catch (error) {
common_vendor.index.__f__("error", "at pages/serve/bagCheck/index.vue:83", "扫码检查订单失败:", error); if (error.message && (error.message.includes("未识别到设备编号") || error.message.includes("网络请求失败") || error.message.includes("服务器错误"))) {
common_vendor.index.showToast({ common_vendor.index.__f__("error", "at pages/serve/bagCheck/index.vue:103", "扫码检查订单失败:", error);
title: error.message || "处理失败,请稍后重试", common_vendor.index.showToast({
icon: "none", title: error.message || "处理失败,请稍后重试",
duration: 2e3 icon: "none",
}); duration: 2e3
});
} else {
common_vendor.index.__f__("log", "at pages/serve/bagCheck/index.vue:111", "没有找到符合条件的订单或发生其他错误,直接跳转详情页");
}
setTimeout(() => { setTimeout(() => {
if (option && option.deviceNo) { if (option && option.deviceNo) {
common_vendor.index.redirectTo({ common_vendor.index.redirectTo({