成功修改订单页面套餐金额 为 套餐金额/套餐小时 ,而不是固定的10元/小时
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
|||||||
node_modules
|
node_modules
|
||||||
|
|||||||
@@ -1,44 +1,44 @@
|
|||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
wxLogin,
|
wxLogin,
|
||||||
getUserInfo
|
getUserInfo
|
||||||
} from './util/index'
|
} from './util/index'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
onLaunch: function() {
|
onLaunch: function() {
|
||||||
console.log('App Launch')
|
console.log('App Launch')
|
||||||
|
|
||||||
},
|
},
|
||||||
onShow: async function() {
|
onShow: async function() {
|
||||||
console.log('App Show')
|
console.log('App Show')
|
||||||
await this.autoLogin()
|
await this.autoLogin()
|
||||||
|
|
||||||
},
|
},
|
||||||
onHide: function() {
|
onHide: function() {
|
||||||
console.log('App Hide')
|
console.log('App Hide')
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async autoLogin() {
|
async autoLogin() {
|
||||||
try {
|
try {
|
||||||
const loginResult = await wxLogin()
|
const loginResult = await wxLogin()
|
||||||
console.log('自动登录成功:', loginResult)
|
console.log('自动登录成功:', loginResult)
|
||||||
// await getUserInfo()
|
// await getUserInfo()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('自动登录失败:', error)
|
console.error('自动登录失败:', error)
|
||||||
// 登录失败的处理可以在 wxLogin 中统一处理
|
// 登录失败的处理可以在 wxLogin 中统一处理
|
||||||
// 这里可以添加特殊的错误处理逻辑
|
// 这里可以添加特殊的错误处理逻辑
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import "uview-ui/index.scss"
|
@import "uview-ui/index.scss"
|
||||||
|
|
||||||
/*每个页面公共css */
|
/*每个页面公共css */
|
||||||
</style>
|
</style>
|
||||||
+87
-87
@@ -1,88 +1,88 @@
|
|||||||
import {
|
import {
|
||||||
URL,
|
URL,
|
||||||
appid
|
appid
|
||||||
} from './url'
|
} from './url'
|
||||||
|
|
||||||
const request = (option) => {
|
const request = (option) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// 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) {
|
if (!option.hideLoading) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: option.loadingText || '加载中...',
|
title: option.loadingText || '加载中...',
|
||||||
mask: true
|
mask: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.request({
|
uni.request({
|
||||||
url: URL + option.url,
|
url: URL + option.url,
|
||||||
method: option.method,
|
method: option.method,
|
||||||
data: option.data,
|
data: option.data,
|
||||||
header: {
|
header: {
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
...option.headers,
|
...option.headers,
|
||||||
'appid': appid,
|
'appid': appid,
|
||||||
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
||||||
'Clientid': uni.getStorageSync('client_id')
|
'Clientid': uni.getStorageSync('client_id')
|
||||||
},
|
},
|
||||||
success(res) {
|
success(res) {
|
||||||
// 记录响应
|
// 记录响应
|
||||||
console.log(`请求响应: ${option.url}`, res)
|
console.log(`请求响应: ${option.url}`, res)
|
||||||
|
|
||||||
// 检查响应状态码
|
// 检查响应状态码
|
||||||
if (res.statusCode !== 200) {
|
if (res.statusCode !== 200) {
|
||||||
console.error(`HTTP状态码错误: ${res.statusCode}`, res.data)
|
console.error(`HTTP状态码错误: ${res.statusCode}`, res.data)
|
||||||
|
|
||||||
// 为了适应某些服务器的异常响应,我们仍然返回数据
|
// 为了适应某些服务器的异常响应,我们仍然返回数据
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
resolve(res.data)
|
resolve(res.data)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
reject({msg: `请求失败,状态码:${res.statusCode}`})
|
reject({msg: `请求失败,状态码:${res.statusCode}`})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查业务状态码
|
// 检查业务状态码
|
||||||
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 &&
|
if (option.ignoreEmptyError &&
|
||||||
(res.data.code === 500 && res.data.msg &&
|
(res.data.code === 500 && res.data.msg &&
|
||||||
(res.data.msg.includes('未找到') || res.data.msg.includes('不存在')))) {
|
(res.data.msg.includes('未找到') || res.data.msg.includes('不存在')))) {
|
||||||
// 对于指定需要忽略的错误,返回一个标准的"成功但数据为空"的响应
|
// 对于指定需要忽略的错误,返回一个标准的"成功但数据为空"的响应
|
||||||
resolve({
|
resolve({
|
||||||
code: 200,
|
code: 200,
|
||||||
msg: "操作成功",
|
msg: "操作成功",
|
||||||
data: []
|
data: []
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 仍然返回数据,由业务逻辑处理
|
// 仍然返回数据,由业务逻辑处理
|
||||||
resolve(res.data)
|
resolve(res.data)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve(res.data)
|
resolve(res.data)
|
||||||
},
|
},
|
||||||
fail(err) {
|
fail(err) {
|
||||||
// 网络请求本身失败
|
// 网络请求本身失败
|
||||||
console.error(`请求失败: ${option.url}`, err)
|
console.error(`请求失败: ${option.url}`, err)
|
||||||
reject(err)
|
reject(err)
|
||||||
},
|
},
|
||||||
complete() {
|
complete() {
|
||||||
// 隐藏加载提示
|
// 隐藏加载提示
|
||||||
if (!option.hideLoading) {
|
if (!option.hideLoading) {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export default request
|
export default request
|
||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
// export const URL = "https://unifans.gxfs123.com"
|
// export const URL = "https://unifans.gxfs123.com"
|
||||||
export const URL = "http://127.0.0.1:8080"
|
export const URL = "http://127.0.0.1:8080"
|
||||||
|
|
||||||
export const appid = "wxe752f45e7f7aa271"
|
export const appid = "wxe752f45e7f7aa271"
|
||||||
+38
-38
@@ -1,39 +1,39 @@
|
|||||||
// 帮助中心文案配置
|
// 帮助中心文案配置
|
||||||
export const HELP_CONTENT = {
|
export const HELP_CONTENT = {
|
||||||
// FAQ列表
|
// FAQ列表
|
||||||
FAQ_LIST: [
|
FAQ_LIST: [
|
||||||
{
|
{
|
||||||
question: '如何租借风扇?',
|
question: '如何租借风扇?',
|
||||||
answer: '点击首页"扫码租借"按钮,使用微信扫描设备上的二维码,按提示完成支付即可使用。'
|
answer: '点击首页"扫码租借"按钮,使用微信扫描设备上的二维码,按提示完成支付即可使用。'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
question: '收费标准是怎样的?',
|
question: '收费标准是怎样的?',
|
||||||
answer: '使用费用为2元/小时,不足1小时按1小时计算。押金99元,归还后自动退还。'
|
answer: '使用费用为2元/小时,不足1小时按1小时计算。押金99元,归还后自动退还。'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
question: '如何归还风扇?',
|
question: '如何归还风扇?',
|
||||||
answer: '将风扇带到任意归还点,点击首页"扫码归还"按钮,扫描归还点二维码即可完成归还。'
|
answer: '将风扇带到任意归还点,点击首页"扫码归还"按钮,扫描归还点二维码即可完成归还。'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
question: '押金多久能退还?',
|
question: '押金多久能退还?',
|
||||||
answer: '归还设备后押金将自动发起退款,预计0-7个工作日到账。'
|
answer: '归还设备后押金将自动发起退款,预计0-7个工作日到账。'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
question: '设备无法正常使用怎么办?',
|
question: '设备无法正常使用怎么办?',
|
||||||
answer: '您可以通过"我的-投诉与建议"提交故障反馈,或直接拨打客服电话处理。'
|
answer: '您可以通过"我的-投诉与建议"提交故障反馈,或直接拨打客服电话处理。'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
// 联系方式
|
// 联系方式
|
||||||
CONTACT: {
|
CONTACT: {
|
||||||
TITLE: '联系客服',
|
TITLE: '联系客服',
|
||||||
PHONE: {
|
PHONE: {
|
||||||
LABEL: '客服电话',
|
LABEL: '客服电话',
|
||||||
VALUE: '400-888-8888'
|
VALUE: '400-888-8888'
|
||||||
},
|
},
|
||||||
SERVICE_TIME: {
|
SERVICE_TIME: {
|
||||||
LABEL: '服务时间',
|
LABEL: '服务时间',
|
||||||
VALUE: '周一至周日 09:00-22:00'
|
VALUE: '周一至周日 09:00-22:00'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+54
-54
@@ -1,55 +1,55 @@
|
|||||||
/**
|
/**
|
||||||
* 订单状态映射
|
* 订单状态映射
|
||||||
*/
|
*/
|
||||||
export const OrderStatusMap = {
|
export const OrderStatusMap = {
|
||||||
waiting_for_payment: {
|
waiting_for_payment: {
|
||||||
text: '待支付',
|
text: '待支付',
|
||||||
class: 'status-waiting'
|
class: 'status-waiting'
|
||||||
},
|
},
|
||||||
payment_in_progress: {
|
payment_in_progress: {
|
||||||
text: '支付中',
|
text: '支付中',
|
||||||
class: 'status-progress'
|
class: 'status-progress'
|
||||||
},
|
},
|
||||||
payment_successful: {
|
payment_successful: {
|
||||||
text: '支付成功',
|
text: '支付成功',
|
||||||
class: 'status-success'
|
class: 'status-success'
|
||||||
},
|
},
|
||||||
in_used: {
|
in_used: {
|
||||||
text: '使用中',
|
text: '使用中',
|
||||||
class: 'status-using'
|
class: 'status-using'
|
||||||
},
|
},
|
||||||
payment_failed: {
|
payment_failed: {
|
||||||
text: '支付失败',
|
text: '支付失败',
|
||||||
class: 'status-failed'
|
class: 'status-failed'
|
||||||
},
|
},
|
||||||
order_cancelled: {
|
order_cancelled: {
|
||||||
text: '已取消',
|
text: '已取消',
|
||||||
class: 'status-cancelled'
|
class: 'status-cancelled'
|
||||||
},
|
},
|
||||||
used_done: {
|
used_done: {
|
||||||
text: '已完成',
|
text: '已完成',
|
||||||
class: 'status-finished'
|
class: 'status-finished'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单状态分类
|
* 订单状态分类
|
||||||
*/
|
*/
|
||||||
export const OrderStatusTabs = [
|
export const OrderStatusTabs = [
|
||||||
{
|
{
|
||||||
text: '全部',
|
text: '全部',
|
||||||
status: []
|
status: []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '待支付',
|
text: '待支付',
|
||||||
status: ['waiting_for_payment', 'payment_in_progress']
|
status: ['waiting_for_payment', 'payment_in_progress']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '使用中',
|
text: '使用中',
|
||||||
status: ['payment_successful', 'in_used']
|
status: ['payment_successful', 'in_used']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '已完成',
|
text: '已完成',
|
||||||
status: ['used_done', 'payment_failed', 'order_cancelled']
|
status: ['used_done', 'payment_failed', 'order_cancelled']
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
+20
-20
@@ -1,20 +1,20 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<script>
|
<script>
|
||||||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
||||||
CSS.supports('top: constant(a)'))
|
CSS.supports('top: constant(a)'))
|
||||||
document.write(
|
document.write(
|
||||||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
||||||
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||||
</script>
|
</script>
|
||||||
<title></title>
|
<title></title>
|
||||||
<!--preload-links-->
|
<!--preload-links-->
|
||||||
<!--app-context-->
|
<!--app-context-->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"><!--app-html--></div>
|
<div id="app"><!--app-html--></div>
|
||||||
<script type="module" src="/main.js"></script>
|
<script type="module" src="/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,35 +1,35 @@
|
|||||||
import App from './App'
|
import App from './App'
|
||||||
import { orderMonitor } from './utils/orderMonitor.js'
|
import { orderMonitor } from './utils/orderMonitor.js'
|
||||||
|
|
||||||
import uView from "uview-ui";
|
import uView from "uview-ui";
|
||||||
|
|
||||||
|
|
||||||
// #ifndef VUE3
|
// #ifndef VUE3
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import './uni.promisify.adaptor'
|
import './uni.promisify.adaptor'
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
// 注册全局订单监控服务
|
// 注册全局订单监控服务
|
||||||
Vue.prototype.$orderMonitor = orderMonitor
|
Vue.prototype.$orderMonitor = orderMonitor
|
||||||
|
|
||||||
App.mpType = 'app'
|
App.mpType = 'app'
|
||||||
Vue.use(uView)
|
Vue.use(uView)
|
||||||
const app = new Vue({
|
const app = new Vue({
|
||||||
...App
|
...App
|
||||||
})
|
})
|
||||||
app.$mount()
|
app.$mount()
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef VUE3
|
// #ifdef VUE3
|
||||||
import { createSSRApp } from 'vue'
|
import { createSSRApp } from 'vue'
|
||||||
export function createApp() {
|
export function createApp() {
|
||||||
const app = createSSRApp(App)
|
const app = createSSRApp(App)
|
||||||
|
|
||||||
// 注册全局订单监控服务到VUE3
|
// 注册全局订单监控服务到VUE3
|
||||||
app.config.globalProperties.$orderMonitor = orderMonitor
|
app.config.globalProperties.$orderMonitor = orderMonitor
|
||||||
|
|
||||||
return {
|
return {
|
||||||
app
|
app
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
Generated
+1757
-1757
File diff suppressed because it is too large
Load Diff
+11
-11
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.7.9",
|
"axios": "^1.7.9",
|
||||||
"axios-miniprogram-adapter": "0.3.4",
|
"axios-miniprogram-adapter": "0.3.4",
|
||||||
"uniapp-axios-adapter": "^0.3.2",
|
"uniapp-axios-adapter": "^0.3.2",
|
||||||
"uview-ui": "1.8.8"
|
"uview-ui": "1.8.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"sass": "^1.57.1",
|
"sass": "^1.57.1",
|
||||||
"sass-loader": "^13.2.0"
|
"sass-loader": "^13.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+112
-112
@@ -1,113 +1,113 @@
|
|||||||
{
|
{
|
||||||
"easycom": {
|
"easycom": {
|
||||||
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
|
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
|
||||||
},
|
},
|
||||||
"pages": [{
|
"pages": [{
|
||||||
"path": "pages/index/index",
|
"path": "pages/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "共享风扇"
|
"navigationBarTitleText": "共享风扇"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/my/index",
|
"path": "pages/my/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "个人中心"
|
"navigationBarTitleText": "个人中心"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/deposit/index",
|
"path": "pages/deposit/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "押金管理"
|
"navigationBarTitleText": "押金管理"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/order/index",
|
"path": "pages/order/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "租借记录"
|
"navigationBarTitleText": "租借记录"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/order/payment",
|
"path": "pages/order/payment",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "订单支付",
|
"navigationBarTitleText": "订单支付",
|
||||||
"navigationBarBackgroundColor": "#ffffff",
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
"navigationBarTextStyle": "black"
|
"navigationBarTextStyle": "black"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/feedback/index",
|
"path": "pages/feedback/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "投诉与建议"
|
"navigationBarTitleText": "投诉与建议"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/help/index",
|
"path": "pages/help/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "帮助中心"
|
"navigationBarTitleText": "帮助中心"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/device/detail",
|
"path": "pages/device/detail",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "设备详情",
|
"navigationBarTitleText": "设备详情",
|
||||||
"navigationBarBackgroundColor": "#ffffff",
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
"navigationBarTextStyle": "black"
|
"navigationBarTextStyle": "black"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"path": "pages/serve/bagCheck/index",
|
"path": "pages/serve/bagCheck/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "共享风扇"
|
"navigationBarTitleText": "共享风扇"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/return/index",
|
"path": "pages/return/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "归还设备",
|
"navigationBarTitleText": "归还设备",
|
||||||
"navigationBarBackgroundColor": "#ffffff",
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
"navigationBarTextStyle": "black"
|
"navigationBarTextStyle": "black"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/order/success",
|
"path": "pages/order/success",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "支付成功",
|
"navigationBarTitleText": "支付成功",
|
||||||
"navigationBarBackgroundColor": "#ffffff",
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
"navigationBarTextStyle": "black"
|
"navigationBarTextStyle": "black"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/order/return-success",
|
"path": "pages/order/return-success",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "归还成功",
|
"navigationBarTitleText": "归还成功",
|
||||||
"navigationBarBackgroundColor": "#ffffff",
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
"navigationBarTextStyle": "black"
|
"navigationBarTextStyle": "black"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
"navigationBarTextStyle": "black",
|
"navigationBarTextStyle": "black",
|
||||||
"navigationBarTitleText": "共享风扇",
|
"navigationBarTitleText": "共享风扇",
|
||||||
"navigationBarBackgroundColor": "#F8F8F8",
|
"navigationBarBackgroundColor": "#F8F8F8",
|
||||||
"backgroundColor": "#F8F8F8"
|
"backgroundColor": "#F8F8F8"
|
||||||
},
|
},
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
"color": "#999999",
|
"color": "#999999",
|
||||||
"selectedColor": "#1976D2",
|
"selectedColor": "#1976D2",
|
||||||
"backgroundColor": "#ffffff",
|
"backgroundColor": "#ffffff",
|
||||||
"list": [{
|
"list": [{
|
||||||
"pagePath": "pages/index/index",
|
"pagePath": "pages/index/index",
|
||||||
"text": "首页",
|
"text": "首页",
|
||||||
"iconPath": "static/home.png",
|
"iconPath": "static/home.png",
|
||||||
"selectedIconPath": "static/home-active.png"
|
"selectedIconPath": "static/home-active.png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/my/index",
|
"pagePath": "pages/my/index",
|
||||||
"text": "我的",
|
"text": "我的",
|
||||||
"iconPath": "static/user.png",
|
"iconPath": "static/user.png",
|
||||||
"selectedIconPath": "static/user-active.png"
|
"selectedIconPath": "static/user-active.png"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+335
-335
@@ -1,336 +1,336 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="deposit-container">
|
<view class="deposit-container">
|
||||||
<!-- 押金金额卡片 -->
|
<!-- 押金金额卡片 -->
|
||||||
<view class="deposit-card">
|
<view class="deposit-card">
|
||||||
<view class="title">押金余额</view>
|
<view class="title">押金余额</view>
|
||||||
<view class="amount">¥{{ depositAmount }}</view>
|
<view class="amount">¥{{ depositAmount }}</view>
|
||||||
<button class="withdraw-btn" @click="handleWithdraw" :disabled="depositAmount <= 0">提现</button>
|
<button class="withdraw-btn" @click="handleWithdraw" :disabled="depositAmount <= 0">提现</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 提现说明 -->
|
<!-- 提现说明 -->
|
||||||
<view class="notice-card">
|
<view class="notice-card">
|
||||||
<view class="notice-title">
|
<view class="notice-title">
|
||||||
<view class="dot"></view>
|
<view class="dot"></view>
|
||||||
<text>提现说明</text>
|
<text>提现说明</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="notice-content">
|
<view class="notice-content">
|
||||||
<view class="notice-item">1. 提现金额将原路退回支付账户</view>
|
<view class="notice-item">1. 提现金额将原路退回支付账户</view>
|
||||||
<view class="notice-item">2. 提现申请提交后预计0-7个工作日到账</view>
|
<view class="notice-item">2. 提现申请提交后预计0-7个工作日到账</view>
|
||||||
<view class="notice-item">3. 如超时未收到,请联系客服处理</view>
|
<view class="notice-item">3. 如超时未收到,请联系客服处理</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 押金记录 -->
|
<!-- 押金记录 -->
|
||||||
<view class="record-card" v-if="records.length > 0">
|
<view class="record-card" v-if="records.length > 0">
|
||||||
<view class="record-title">押金记录</view>
|
<view class="record-title">押金记录</view>
|
||||||
<view class="record-list">
|
<view class="record-list">
|
||||||
<view class="record-item" v-for="(item, index) in records" :key="index">
|
<view class="record-item" v-for="(item, index) in records" :key="index">
|
||||||
<view class="record-info">
|
<view class="record-info">
|
||||||
<text class="record-type">{{ item.type }}</text>
|
<text class="record-type">{{ item.type }}</text>
|
||||||
<text class="record-time">{{ item.time }}</text>
|
<text class="record-time">{{ item.time }}</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="record-amount" :class="item.type === '退还' ? 'refund' : ''">
|
<text class="record-amount" :class="item.type === '退还' ? 'refund' : ''">
|
||||||
{{ item.type === '退还' ? '+' : '-' }}¥{{ item.amount }}
|
{{ item.type === '退还' ? '+' : '-' }}¥{{ item.amount }}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getUserInfo } from '../../util/index.js'
|
import { getUserInfo } from '../../util/index.js'
|
||||||
import { withdrawDeposit,queryById } from '../../config/user.js'
|
import { withdrawDeposit,queryById } from '../../config/user.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
depositAmount: '0.00',
|
depositAmount: '0.00',
|
||||||
orderNo: '',
|
orderNo: '',
|
||||||
records: [],
|
records: [],
|
||||||
orderId:''
|
orderId:''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
// this.loadUserInfo()
|
// this.loadUserInfo()
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.loadUserInfo()
|
this.loadUserInfo()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async loadUserInfo() {
|
async loadUserInfo() {
|
||||||
try {
|
try {
|
||||||
const res = await getUserInfo()
|
const res = await getUserInfo()
|
||||||
console.log('loadUserInfo',res);
|
console.log('loadUserInfo',res);
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.depositAmount = res.data.balanceAmount || '0.00'
|
this.depositAmount = res.data.balanceAmount || '0.00'
|
||||||
this.orderNo = res.data.latestOrderNo || ''
|
this.orderNo = res.data.latestOrderNo || ''
|
||||||
this.orderId = res.data.latestOrderId||''
|
this.orderId = res.data.latestOrderId||''
|
||||||
|
|
||||||
// 如果存在余额,获取押金记录
|
// 如果存在余额,获取押金记录
|
||||||
if (parseFloat(this.depositAmount) > 0 && this.orderNo) {
|
if (parseFloat(this.depositAmount) > 0 && this.orderNo) {
|
||||||
this.records = [
|
this.records = [
|
||||||
{
|
{
|
||||||
type: '支付',
|
type: '支付',
|
||||||
time: this.formatDate(new Date()),
|
time: this.formatDate(new Date()),
|
||||||
amount: this.depositAmount
|
amount: this.depositAmount
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
this.records = []
|
this.records = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取用户信息失败:', error)
|
console.error('获取用户信息失败:', error)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '获取用户信息失败',
|
title: '获取用户信息失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async handleWithdraw() {
|
async handleWithdraw() {
|
||||||
if (parseFloat(this.depositAmount) <= 0) {
|
if (parseFloat(this.depositAmount) <= 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '无可提现余额',
|
title: '无可提现余额',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if(this.orderId.length!=0||this.orderNo.length!=0){
|
if(this.orderId.length!=0||this.orderNo.length!=0){
|
||||||
const res = await queryById(Number(this.orderId))
|
const res = await queryById(Number(this.orderId))
|
||||||
console.log(res);
|
console.log(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(this.orderNo.length!=0){
|
// if(this.orderNo.length!=0){
|
||||||
// uni.showToast({
|
// uni.showToast({
|
||||||
// title:'当前存在进行中的订单',
|
// title:'当前存在进行中的订单',
|
||||||
// icon:'none'
|
// icon:'none'
|
||||||
// })
|
// })
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
|
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '确认提现',
|
title: '确认提现',
|
||||||
content: '押金将原路退回,预计0-7个工作日到账',
|
content: '押金将原路退回,预计0-7个工作日到账',
|
||||||
success: async (res) => {
|
success: async (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '提现中...'
|
title: '提现中...'
|
||||||
})
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('发起提现请求,订单号:', this.orderNo)
|
console.log('发起提现请求,订单号:', this.orderNo)
|
||||||
const result = await withdrawDeposit(this.orderNo)
|
const result = await withdrawDeposit(this.orderNo)
|
||||||
console.log('提现响应:', result)
|
console.log('提现响应:', result)
|
||||||
|
|
||||||
if (result.code === 200) {
|
if (result.code === 200) {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '提现申请已提交',
|
title: '提现申请已提交',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
})
|
||||||
|
|
||||||
// 更新余额为0
|
// 更新余额为0
|
||||||
this.depositAmount = '0.00'
|
this.depositAmount = '0.00'
|
||||||
this.records.push({
|
this.records.push({
|
||||||
type: '退还',
|
type: '退还',
|
||||||
time: this.formatDate(new Date()),
|
time: this.formatDate(new Date()),
|
||||||
amount: this.depositAmount
|
amount: this.depositAmount
|
||||||
})
|
})
|
||||||
|
|
||||||
// 重新加载用户信息
|
// 重新加载用户信息
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.loadUserInfo()
|
this.loadUserInfo()
|
||||||
}, 1500)
|
}, 1500)
|
||||||
} else {
|
} else {
|
||||||
throw new Error(result.msg || '提现失败')
|
throw new Error(result.msg || '提现失败')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('提现失败:', error)
|
console.error('提现失败:', error)
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
|
|
||||||
// 更详细的错误处理
|
// 更详细的错误处理
|
||||||
let errorMessage = '提现失败,请稍后再试';
|
let errorMessage = '提现失败,请稍后再试';
|
||||||
|
|
||||||
// 如果有具体错误信息,使用它
|
// 如果有具体错误信息,使用它
|
||||||
if (error.message) {
|
if (error.message) {
|
||||||
// 常见错误消息处理
|
// 常见错误消息处理
|
||||||
if (error.message.includes('尚未归还')) {
|
if (error.message.includes('尚未归还')) {
|
||||||
errorMessage = '当前订单尚未归还,请归还后再提现';
|
errorMessage = '当前订单尚未归还,请归还后再提现';
|
||||||
} else if (error.message.includes('已退还')) {
|
} else if (error.message.includes('已退还')) {
|
||||||
errorMessage = '押金已退还,无需重复提现';
|
errorMessage = '押金已退还,无需重复提现';
|
||||||
} else if (error.message.includes('处理中')) {
|
} else if (error.message.includes('处理中')) {
|
||||||
errorMessage = '押金退还处理中,请耐心等待';
|
errorMessage = '押金退还处理中,请耐心等待';
|
||||||
} else if (error.message.includes('余额为0')) {
|
} else if (error.message.includes('余额为0')) {
|
||||||
errorMessage = '账户余额为0,无法提现';
|
errorMessage = '账户余额为0,无法提现';
|
||||||
} else {
|
} else {
|
||||||
// 使用后端返回的具体错误消息
|
// 使用后端返回的具体错误消息
|
||||||
errorMessage = error.message;
|
errorMessage = error.message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 显示错误提示
|
// 显示错误提示
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提现失败',
|
title: '提现失败',
|
||||||
content: errorMessage,
|
content: errorMessage,
|
||||||
showCancel: false
|
showCancel: false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
formatDate(date) {
|
formatDate(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')
|
||||||
const day = date.getDate().toString().padStart(2, '0')
|
const day = date.getDate().toString().padStart(2, '0')
|
||||||
const hours = date.getHours().toString().padStart(2, '0')
|
const hours = date.getHours().toString().padStart(2, '0')
|
||||||
const minutes = date.getMinutes().toString().padStart(2, '0')
|
const minutes = date.getMinutes().toString().padStart(2, '0')
|
||||||
|
|
||||||
return `${year}-${month}-${day} ${hours}:${minutes}`
|
return `${year}-${month}-${day} ${hours}:${minutes}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.deposit-container {
|
.deposit-container {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: #f8f8f8;
|
background: #f8f8f8;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
|
|
||||||
.deposit-card {
|
.deposit-card {
|
||||||
background: linear-gradient(135deg, #1976D2, #64B5F6);
|
background: linear-gradient(135deg, #1976D2, #64B5F6);
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
padding: 40rpx;
|
padding: 40rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
box-shadow: 0 4rpx 20rpx rgba(25,118,210,0.2);
|
box-shadow: 0 4rpx 20rpx rgba(25,118,210,0.2);
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.amount {
|
.amount {
|
||||||
font-size: 72rpx;
|
font-size: 72rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-bottom: 40rpx;
|
margin-bottom: 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.withdraw-btn {
|
.withdraw-btn {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
color: #1976D2;
|
color: #1976D2;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
line-height: 80rpx;
|
line-height: 80rpx;
|
||||||
border-radius: 40rpx;
|
border-radius: 40rpx;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
transform: scale(0.98);
|
transform: scale(0.98);
|
||||||
}
|
}
|
||||||
|
|
||||||
&[disabled] {
|
&[disabled] {
|
||||||
background: rgba(255,255,255,0.6);
|
background: rgba(255,255,255,0.6);
|
||||||
color: rgba(25,118,210,0.5);
|
color: rgba(25,118,210,0.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-card {
|
.notice-card {
|
||||||
margin-top: 30rpx;
|
margin-top: 30rpx;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
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 {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
|
|
||||||
.dot {
|
.dot {
|
||||||
width: 12rpx;
|
width: 12rpx;
|
||||||
height: 12rpx;
|
height: 12rpx;
|
||||||
background: #1976D2;
|
background: #1976D2;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
margin-right: 10rpx;
|
margin-right: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
text {
|
text {
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-content {
|
.notice-content {
|
||||||
.notice-item {
|
.notice-item {
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
line-height: 1.8;
|
line-height: 1.8;
|
||||||
padding-left: 22rpx;
|
padding-left: 22rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.record-card {
|
.record-card {
|
||||||
margin-top: 30rpx;
|
margin-top: 30rpx;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
|
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
|
||||||
|
|
||||||
.record-title {
|
.record-title {
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
border-left: 8rpx solid #1976D2;
|
border-left: 8rpx solid #1976D2;
|
||||||
padding-left: 20rpx;
|
padding-left: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.record-list {
|
.record-list {
|
||||||
.record-item {
|
.record-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 20rpx 0;
|
padding: 20rpx 0;
|
||||||
border-bottom: 1rpx solid #f5f5f5;
|
border-bottom: 1rpx solid #f5f5f5;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.record-info {
|
.record-info {
|
||||||
.record-type {
|
.record-type {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-bottom: 6rpx;
|
margin-bottom: 6rpx;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.record-time {
|
.record-time {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.record-amount {
|
.record-amount {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
|
||||||
&.refund {
|
&.refund {
|
||||||
color: #4CAF50;
|
color: #4CAF50;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
+176
-141
@@ -110,9 +110,28 @@
|
|||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
// console.log(options);
|
// console.log(options);
|
||||||
this.deviceId = options.deviceNo
|
this.deviceId = options.deviceNo
|
||||||
this.checkOrderStatus() // 新增状态检查
|
|
||||||
console.log(options.deviceNo);
|
// 如果URL中包含了feeConfig参数,直接使用它
|
||||||
this.getDeviceInfo()
|
if (options.feeConfig) {
|
||||||
|
try {
|
||||||
|
console.log('从URL获取到feeConfig:', options.feeConfig)
|
||||||
|
const feeConfigStr = decodeURIComponent(options.feeConfig)
|
||||||
|
// 存储到设备信息中,这样后续处理逻辑可以保持不变
|
||||||
|
this.deviceInfo = { ...this.deviceInfo, feeConfig: feeConfigStr }
|
||||||
|
// 马上解析feeConfig并生成套餐选项
|
||||||
|
this.parseFeeConfig()
|
||||||
|
} catch (e) {
|
||||||
|
console.error('解析URL中的feeConfig失败:', e)
|
||||||
|
// 如果解析失败,继续正常流程获取设备信息
|
||||||
|
this.checkOrderStatus()
|
||||||
|
this.getDeviceInfo()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 正常流程
|
||||||
|
this.checkOrderStatus() // 新增状态检查
|
||||||
|
console.log(options.deviceNo);
|
||||||
|
this.getDeviceInfo()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 检查登录状态和订单
|
// 检查登录状态和订单
|
||||||
@@ -148,133 +167,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解析feeConfig并生成套餐选项
|
// 使用抽取的方法解析feeConfig并生成套餐选项
|
||||||
if (this.deviceInfo.feeConfig) {
|
this.parseFeeConfig();
|
||||||
try {
|
|
||||||
const feeConfig = JSON.parse(this.deviceInfo.feeConfig);
|
|
||||||
|
|
||||||
// 检查是否为新格式 [{"hour":1,"timesPrice":4},{"hour":3,"timesPrice":10},{"hour":5,"timesPrice":15}]
|
|
||||||
if (feeConfig.length > 0 && 'hour' in feeConfig[0] && 'timesPrice' in feeConfig[0]) {
|
|
||||||
// 新格式处理 - 直接使用所有套餐
|
|
||||||
this.packages = feeConfig.map(pkg => {
|
|
||||||
const hour = pkg.hour;
|
|
||||||
const price = pkg.timesPrice;
|
|
||||||
const unitPrice = (price / hour).toFixed(2);
|
|
||||||
|
|
||||||
return {
|
|
||||||
time: `${hour}小时`,
|
|
||||||
price: price.toFixed(2),
|
|
||||||
unitPrice: unitPrice,
|
|
||||||
hour: hour // 添加小时信息,用于后续处理
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// 按小时排序
|
|
||||||
this.packages.sort((a, b) => a.hour - b.hour);
|
|
||||||
} 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'
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -355,16 +249,8 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedPkg = this.packages[this.selectedPackage]
|
// 直接提交订单,不显示确认对话框
|
||||||
uni.showModal({
|
this.submitRentOrder()
|
||||||
title: '确认租借',
|
|
||||||
content: `确认支付押金¥{{ depositAmount }}及${selectedPkg.time}套餐费用¥${selectedPkg.price}?`,
|
|
||||||
success: (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
this.submitRentOrder()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 提交租借订单
|
// 提交租借订单
|
||||||
@@ -424,7 +310,7 @@
|
|||||||
|
|
||||||
// 跳转到订单支付页面,传递订单ID、套餐信息和总金额
|
// 跳转到订单支付页面,传递订单ID、套餐信息和总金额
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pages/order/payment?orderId=${order.orderId}&packageTimeHours=${selectedPkg.time.replace('小时', '')}&packagePrice=${selectedPkg.price}&totalAmount=${totalAmount}&depositAmount=${this.depositAmount}`
|
url: `/pages/order/payment?orderId=${order.orderId}&packageTimeHours=${selectedPkg.time.replace('小时', '')}&packagePrice=${selectedPkg.price}&totalAmount=${totalAmount}&depositAmount=${this.depositAmount}${this.deviceInfo && this.deviceInfo.feeConfig ? '&feeConfig=' + encodeURIComponent(this.deviceInfo.feeConfig) : ''}`
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
@@ -433,6 +319,155 @@
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 单独抽取解析feeConfig的逻辑
|
||||||
|
parseFeeConfig() {
|
||||||
|
if (this.deviceInfo.feeConfig) {
|
||||||
|
try {
|
||||||
|
const feeConfig = JSON.parse(this.deviceInfo.feeConfig);
|
||||||
|
|
||||||
|
// 检查是否为新格式 [{"hour":1,"timesPrice":4},{"hour":3,"timesPrice":10},{"hour":5,"timesPrice":15}]
|
||||||
|
if (feeConfig.length > 0 && 'hour' in feeConfig[0] && 'timesPrice' in feeConfig[0]) {
|
||||||
|
// 新格式处理 - 直接使用所有套餐
|
||||||
|
this.packages = feeConfig.map(pkg => {
|
||||||
|
const hour = pkg.hour;
|
||||||
|
const price = pkg.timesPrice;
|
||||||
|
const unitPrice = (price / hour).toFixed(2);
|
||||||
|
|
||||||
|
return {
|
||||||
|
time: `${hour}小时`,
|
||||||
|
price: price.toFixed(2),
|
||||||
|
unitPrice: unitPrice,
|
||||||
|
hour: hour // 添加小时信息,用于后续处理
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
// 按小时排序
|
||||||
|
this.packages.sort((a, b) => a.hour - b.hour);
|
||||||
|
} 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),
|
||||||
|
hour: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: '6小时',
|
||||||
|
price: (hourPrice * 6).toFixed(2),
|
||||||
|
unitPrice: hourPrice.toFixed(2),
|
||||||
|
hour: 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: '12小时',
|
||||||
|
price: (hourPrice * 12).toFixed(2),
|
||||||
|
unitPrice: hourPrice.toFixed(2),
|
||||||
|
hour: 12
|
||||||
|
}
|
||||||
|
];
|
||||||
|
} else if (this.deviceInfo.feeType === 'times') {
|
||||||
|
// 按次收费
|
||||||
|
const timesPrice = commonConfig.timesPrice;
|
||||||
|
this.packages = [
|
||||||
|
{
|
||||||
|
time: '1次',
|
||||||
|
price: timesPrice.toFixed(2),
|
||||||
|
unitPrice: timesPrice.toFixed(2),
|
||||||
|
hour: 1
|
||||||
|
}
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
// 默认套餐
|
||||||
|
this.packages = [
|
||||||
|
{
|
||||||
|
time: '1小时',
|
||||||
|
price: '2.00',
|
||||||
|
unitPrice: '2.00',
|
||||||
|
hour: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: '6小时',
|
||||||
|
price: '10.00',
|
||||||
|
unitPrice: '1.67',
|
||||||
|
hour: 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: '12小时',
|
||||||
|
price: '15.00',
|
||||||
|
unitPrice: '1.25',
|
||||||
|
hour: 12
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 默认选中中间套餐
|
||||||
|
this.selectedPackage = Math.min(1, this.packages.length - 1);
|
||||||
|
} catch (e) {
|
||||||
|
console.error('解析设备费用配置失败:', e);
|
||||||
|
// 使用默认套餐
|
||||||
|
this.packages = [
|
||||||
|
{
|
||||||
|
time: '1小时',
|
||||||
|
price: '2.00',
|
||||||
|
unitPrice: '2.00',
|
||||||
|
hour: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: '6小时',
|
||||||
|
price: '10.00',
|
||||||
|
unitPrice: '1.67',
|
||||||
|
hour: 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: '12小时',
|
||||||
|
price: '15.00',
|
||||||
|
unitPrice: '1.25',
|
||||||
|
hour: 12
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// 默认选中中间套餐
|
||||||
|
this.selectedPackage = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 如果没有feeConfig,使用默认套餐
|
||||||
|
this.packages = [
|
||||||
|
{
|
||||||
|
time: '1小时',
|
||||||
|
price: '2.00',
|
||||||
|
unitPrice: '2.00',
|
||||||
|
hour: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: '6小时',
|
||||||
|
price: '10.00',
|
||||||
|
unitPrice: '1.67',
|
||||||
|
hour: 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: '12小时',
|
||||||
|
price: '15.00',
|
||||||
|
unitPrice: '1.25',
|
||||||
|
hour: 12
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// 默认选中中间套餐
|
||||||
|
this.selectedPackage = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+299
-299
@@ -1,300 +1,300 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="feedback-container">
|
<view class="feedback-container">
|
||||||
<!-- 问题类型选择 -->
|
<!-- 问题类型选择 -->
|
||||||
<view class="type-section">
|
<view class="type-section">
|
||||||
<view class="section-title">问题类型</view>
|
<view class="section-title">问题类型</view>
|
||||||
<view class="type-grid">
|
<view class="type-grid">
|
||||||
<view
|
<view
|
||||||
v-for="(type, index) in types"
|
v-for="(type, index) in types"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="type-item"
|
class="type-item"
|
||||||
:class="{ active: selectedType === index }"
|
:class="{ active: selectedType === index }"
|
||||||
@click="selectType(index)"
|
@click="selectType(index)"
|
||||||
>
|
>
|
||||||
{{ type }}
|
{{ type }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 问题描述 -->
|
<!-- 问题描述 -->
|
||||||
<view class="description-section">
|
<view class="description-section">
|
||||||
<view class="section-title">问题描述</view>
|
<view class="section-title">问题描述</view>
|
||||||
<textarea
|
<textarea
|
||||||
class="description-input"
|
class="description-input"
|
||||||
v-model="description"
|
v-model="description"
|
||||||
placeholder="请详细描述您遇到的问题,以便我们更好地为您解决"
|
placeholder="请详细描述您遇到的问题,以便我们更好地为您解决"
|
||||||
maxlength="500"
|
maxlength="500"
|
||||||
/>
|
/>
|
||||||
<view class="word-count">{{ description.length }}/500</view>
|
<view class="word-count">{{ description.length }}/500</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 图片上传 -->
|
<!-- 图片上传 -->
|
||||||
<view class="upload-section">
|
<view class="upload-section">
|
||||||
<view class="section-title">图片上传(选填)</view>
|
<view class="section-title">图片上传(选填)</view>
|
||||||
<view class="upload-grid">
|
<view class="upload-grid">
|
||||||
<view
|
<view
|
||||||
class="upload-item"
|
class="upload-item"
|
||||||
v-for="(img, index) in images"
|
v-for="(img, index) in images"
|
||||||
:key="index"
|
:key="index"
|
||||||
>
|
>
|
||||||
<image :src="img" mode="aspectFill" />
|
<image :src="img" mode="aspectFill" />
|
||||||
<view class="delete-btn" @click="deleteImage(index)">×</view>
|
<view class="delete-btn" @click="deleteImage(index)">×</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="upload-btn" @click="chooseImage" v-if="images.length < 3">
|
<view class="upload-btn" @click="chooseImage" v-if="images.length < 3">
|
||||||
<text class="plus">+</text>
|
<text class="plus">+</text>
|
||||||
<text class="tip">上传图片</text>
|
<text class="tip">上传图片</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 联系方式 -->
|
<!-- 联系方式 -->
|
||||||
<view class="contact-section">
|
<view class="contact-section">
|
||||||
<view class="section-title">联系方式</view>
|
<view class="section-title">联系方式</view>
|
||||||
<input
|
<input
|
||||||
class="contact-input"
|
class="contact-input"
|
||||||
v-model="contact"
|
v-model="contact"
|
||||||
placeholder="请留下您的手机号,方便我们联系您"
|
placeholder="请留下您的手机号,方便我们联系您"
|
||||||
type="number"
|
type="number"
|
||||||
maxlength="11"
|
maxlength="11"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 提交按钮 -->
|
<!-- 提交按钮 -->
|
||||||
<view class="submit-section">
|
<view class="submit-section">
|
||||||
<button class="submit-btn" @click="submitFeedback">提交反馈</button>
|
<button class="submit-btn" @click="submitFeedback">提交反馈</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
types: ['设备故障', '收费问题', '使用建议', '其他'],
|
types: ['设备故障', '收费问题', '使用建议', '其他'],
|
||||||
selectedType: -1,
|
selectedType: -1,
|
||||||
description: '',
|
description: '',
|
||||||
images: [],
|
images: [],
|
||||||
contact: ''
|
contact: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
selectType(index) {
|
selectType(index) {
|
||||||
this.selectedType = index
|
this.selectedType = index
|
||||||
},
|
},
|
||||||
chooseImage() {
|
chooseImage() {
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 3 - this.images.length,
|
count: 3 - this.images.length,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
this.images = [...this.images, ...res.tempFilePaths]
|
this.images = [...this.images, ...res.tempFilePaths]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
deleteImage(index) {
|
deleteImage(index) {
|
||||||
this.images.splice(index, 1)
|
this.images.splice(index, 1)
|
||||||
},
|
},
|
||||||
submitFeedback() {
|
submitFeedback() {
|
||||||
if (this.selectedType === -1) {
|
if (this.selectedType === -1) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请选择问题类型',
|
title: '请选择问题类型',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!this.description.trim()) {
|
if (!this.description.trim()) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请描述您的问题',
|
title: '请描述您的问题',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!this.contact) {
|
if (!this.contact) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请留下联系方式',
|
title: '请留下联系方式',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: 提交反馈
|
// TODO: 提交反馈
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '提交成功',
|
title: '提交成功',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.feedback-container {
|
.feedback-container {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: #f8f8f8;
|
background: #f8f8f8;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
|
|
||||||
.section-title {
|
.section-title {
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.type-section {
|
.type-section {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
|
|
||||||
.type-grid {
|
.type-grid {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
margin: 0 -10rpx;
|
margin: 0 -10rpx;
|
||||||
|
|
||||||
.type-item {
|
.type-item {
|
||||||
width: calc(50% - 20rpx);
|
width: calc(50% - 20rpx);
|
||||||
margin: 10rpx;
|
margin: 10rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
background: #f5f5f5;
|
background: #f5f5f5;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
background: #E3F2FD;
|
background: #E3F2FD;
|
||||||
color: #1976D2;
|
color: #1976D2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.description-section {
|
.description-section {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
|
|
||||||
.description-input {
|
.description-input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 240rpx;
|
height: 240rpx;
|
||||||
background: #f8f8f8;
|
background: #f8f8f8;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.word-count {
|
.word-count {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #999;
|
color: #999;
|
||||||
margin-top: 10rpx;
|
margin-top: 10rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.upload-section {
|
.upload-section {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
|
|
||||||
.upload-grid {
|
.upload-grid {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
||||||
.upload-item {
|
.upload-item {
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
height: 200rpx;
|
height: 200rpx;
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.delete-btn {
|
.delete-btn {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: -10rpx;
|
right: -10rpx;
|
||||||
top: -10rpx;
|
top: -10rpx;
|
||||||
width: 40rpx;
|
width: 40rpx;
|
||||||
height: 40rpx;
|
height: 40rpx;
|
||||||
background: rgba(0,0,0,0.5);
|
background: rgba(0,0,0,0.5);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.upload-btn {
|
.upload-btn {
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
height: 200rpx;
|
height: 200rpx;
|
||||||
background: #f5f5f5;
|
background: #f5f5f5;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: #999;
|
color: #999;
|
||||||
|
|
||||||
.plus {
|
.plus {
|
||||||
font-size: 60rpx;
|
font-size: 60rpx;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
margin-bottom: 10rpx;
|
margin-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tip {
|
.tip {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.contact-section {
|
.contact-section {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
margin-bottom: 40rpx;
|
margin-bottom: 40rpx;
|
||||||
|
|
||||||
.contact-input {
|
.contact-input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
background: #f8f8f8;
|
background: #f8f8f8;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
padding: 0 20rpx;
|
padding: 0 20rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.submit-section {
|
.submit-section {
|
||||||
padding: 0 40rpx;
|
padding: 0 40rpx;
|
||||||
|
|
||||||
.submit-btn {
|
.submit-btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 88rpx;
|
height: 88rpx;
|
||||||
background: #1976D2;
|
background: #1976D2;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 44rpx;
|
border-radius: 44rpx;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
transform: scale(0.98);
|
transform: scale(0.98);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
+162
-162
@@ -1,163 +1,163 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="help-container">
|
<view class="help-container">
|
||||||
<!-- 常见问题 -->
|
<!-- 常见问题 -->
|
||||||
<view class="faq-list">
|
<view class="faq-list">
|
||||||
<view
|
<view
|
||||||
class="faq-item"
|
class="faq-item"
|
||||||
v-for="(item, index) in faqList"
|
v-for="(item, index) in faqList"
|
||||||
:key="index"
|
:key="index"
|
||||||
@click="toggleFaq(index)"
|
@click="toggleFaq(index)"
|
||||||
>
|
>
|
||||||
<view class="faq-header">
|
<view class="faq-header">
|
||||||
<text class="question">{{ item.question }}</text>
|
<text class="question">{{ item.question }}</text>
|
||||||
<view class="arrow" :class="{ open: item.isOpen }"></view>
|
<view class="arrow" :class="{ open: item.isOpen }"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="answer" v-show="item.isOpen">
|
<view class="answer" v-show="item.isOpen">
|
||||||
{{ item.answer }}
|
{{ item.answer }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 联系客服 -->
|
<!-- 联系客服 -->
|
||||||
<view class="contact-card">
|
<view class="contact-card">
|
||||||
<view class="contact-title">{{ HELP_CONTENT.CONTACT.TITLE }}</view>
|
<view class="contact-title">{{ HELP_CONTENT.CONTACT.TITLE }}</view>
|
||||||
<view class="contact-content">
|
<view class="contact-content">
|
||||||
<view class="contact-item">
|
<view class="contact-item">
|
||||||
<text class="label">{{ HELP_CONTENT.CONTACT.PHONE.LABEL }}</text>
|
<text class="label">{{ HELP_CONTENT.CONTACT.PHONE.LABEL }}</text>
|
||||||
<text class="value" @click="makePhoneCall">{{ HELP_CONTENT.CONTACT.PHONE.VALUE }}</text>
|
<text class="value" @click="makePhoneCall">{{ HELP_CONTENT.CONTACT.PHONE.VALUE }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="contact-item">
|
<view class="contact-item">
|
||||||
<text class="label">{{ HELP_CONTENT.CONTACT.SERVICE_TIME.LABEL }}</text>
|
<text class="label">{{ HELP_CONTENT.CONTACT.SERVICE_TIME.LABEL }}</text>
|
||||||
<text class="value">{{ HELP_CONTENT.CONTACT.SERVICE_TIME.VALUE }}</text>
|
<text class="value">{{ HELP_CONTENT.CONTACT.SERVICE_TIME.VALUE }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { HELP_CONTENT } from '@/constants/help'
|
import { HELP_CONTENT } from '@/constants/help'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
HELP_CONTENT,
|
HELP_CONTENT,
|
||||||
faqList: HELP_CONTENT.FAQ_LIST.map(item => ({
|
faqList: HELP_CONTENT.FAQ_LIST.map(item => ({
|
||||||
...item,
|
...item,
|
||||||
isOpen: false
|
isOpen: false
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggleFaq(index) {
|
toggleFaq(index) {
|
||||||
this.faqList[index].isOpen = !this.faqList[index].isOpen
|
this.faqList[index].isOpen = !this.faqList[index].isOpen
|
||||||
},
|
},
|
||||||
makePhoneCall() {
|
makePhoneCall() {
|
||||||
uni.makePhoneCall({
|
uni.makePhoneCall({
|
||||||
phoneNumber: HELP_CONTENT.CONTACT.PHONE.VALUE
|
phoneNumber: HELP_CONTENT.CONTACT.PHONE.VALUE
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.help-container {
|
.help-container {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: #f8f8f8;
|
background: #f8f8f8;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
|
|
||||||
.faq-list {
|
.faq-list {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
|
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
|
||||||
|
|
||||||
.faq-item {
|
.faq-item {
|
||||||
border-bottom: 1rpx solid #f5f5f5;
|
border-bottom: 1rpx solid #f5f5f5;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.faq-header {
|
.faq-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 30rpx 20rpx;
|
padding: 30rpx 20rpx;
|
||||||
|
|
||||||
.question {
|
.question {
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding-right: 20rpx;
|
padding-right: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.arrow {
|
.arrow {
|
||||||
width: 16rpx;
|
width: 16rpx;
|
||||||
height: 16rpx;
|
height: 16rpx;
|
||||||
border-right: 4rpx solid #999;
|
border-right: 4rpx solid #999;
|
||||||
border-bottom: 4rpx solid #999;
|
border-bottom: 4rpx solid #999;
|
||||||
transform: rotate(45deg);
|
transform: rotate(45deg);
|
||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
|
|
||||||
&.open {
|
&.open {
|
||||||
transform: rotate(-135deg);
|
transform: rotate(-135deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.answer {
|
.answer {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
padding: 0 20rpx 30rpx;
|
padding: 0 20rpx 30rpx;
|
||||||
background: #f9f9f9;
|
background: #f9f9f9;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
margin: 0 20rpx 20rpx;
|
margin: 0 20rpx 20rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.contact-card {
|
.contact-card {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
|
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
|
||||||
|
|
||||||
.contact-title {
|
.contact-title {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
border-left: 8rpx solid #1976D2;
|
border-left: 8rpx solid #1976D2;
|
||||||
padding-left: 20rpx;
|
padding-left: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.contact-content {
|
.contact-content {
|
||||||
.contact-item {
|
.contact-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 20rpx 0;
|
padding: 20rpx 0;
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
.value {
|
.value {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
+395
-339
@@ -1,339 +1,395 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<!-- 宣传图片区域 -->
|
<!-- 宣传图片区域 -->
|
||||||
<view class="banner">
|
<view class="banner">
|
||||||
<view class="temp-banner">
|
<view class="temp-banner">
|
||||||
<text class="banner-text">共享风扇</text>
|
<text class="banner-text">共享风扇</text>
|
||||||
<text class="banner-subtitle">让清凉随身携带</text>
|
<text class="banner-subtitle">让清凉随身携带</text>
|
||||||
<view class="banner-bg"></view>
|
<view class="banner-bg"></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 扫码按钮区域 -->
|
<!-- 扫码按钮区域 -->
|
||||||
<view class="scan-area">
|
<view class="scan-area">
|
||||||
<view class="scan-btn" @click="handleScan">
|
<view class="scan-btn" @click="handleScan">
|
||||||
<view class="btn-content">
|
<view class="btn-content">
|
||||||
<image class="btn-icon" src="../../static/scan-icon.png" mode="aspectFit" />
|
<image class="btn-icon" src="../../static/scan-icon.png" mode="aspectFit" />
|
||||||
<text class="btn-text">扫一扫</text>
|
<text class="btn-text">扫一扫</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="btn-desc">扫描设备二维码使用或归还</text>
|
<text class="btn-desc">扫描设备二维码使用或归还</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 使用提示区域 -->
|
<!-- 使用提示区域 -->
|
||||||
<view class="tips-section">
|
<view class="tips-section">
|
||||||
<view class="tips-header">
|
<view class="tips-header">
|
||||||
<view class="tips-title">使用小贴士</view>
|
<view class="tips-title">使用小贴士</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="tips-list">
|
<view class="tips-list">
|
||||||
<view class="tip-item">
|
<view class="tip-item">
|
||||||
<view class="tip-dot"></view>
|
<view class="tip-dot"></view>
|
||||||
<text>租借时间:每次最长可租借12小时</text>
|
<text>租借时间:每次最长可租借12小时</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="tip-item">
|
<view class="tip-item">
|
||||||
<view class="tip-dot"></view>
|
<view class="tip-dot"></view>
|
||||||
<text>押金说明:租借需支付99元押金,归还后自动退还</text>
|
<text>押金说明:租借需支付99元押金,归还后自动退还</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="tip-item">
|
<view class="tip-item">
|
||||||
<view class="tip-dot"></view>
|
<view class="tip-dot"></view>
|
||||||
<text>收费标准:2元/小时,不足1小时按1小时计算</text>
|
<text>收费标准:2元/小时,不足1小时按1小时计算</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="tip-item">
|
<view class="tip-item">
|
||||||
<view class="tip-dot"></view>
|
<view class="tip-dot"></view>
|
||||||
<text>爱护提示:请勿将设备带离指定区域,保持设备清洁</text>
|
<text>爱护提示:请勿将设备带离指定区域,保持设备清洁</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getQueryString, wxLogin }from '@/util/index.js'
|
import {getQueryString, wxLogin }from '@/util/index.js'
|
||||||
import {
|
import {
|
||||||
URL
|
URL
|
||||||
}from"@/config/url.js"
|
}from"@/config/url.js"
|
||||||
export default {
|
import { getDeviceInfo } from '@/config/user.js'
|
||||||
methods: {
|
export default {
|
||||||
async handleScan() {
|
methods: {
|
||||||
try {
|
async handleScan() {
|
||||||
const scanResult = await new Promise((resolve, reject) => {
|
try {
|
||||||
uni.scanCode({
|
const scanResult = await new Promise((resolve, reject) => {
|
||||||
success: resolve,
|
uni.scanCode({
|
||||||
fail: reject
|
success: resolve,
|
||||||
})
|
fail: reject
|
||||||
})
|
})
|
||||||
|
})
|
||||||
let deviceNo = getQueryString(scanResult.path, 'deviceNo')
|
|
||||||
console.log('扫码路径:', scanResult.path)
|
let deviceNo = getQueryString(scanResult.path, 'deviceNo')
|
||||||
console.log('解析到的设备号:', deviceNo)
|
console.log('扫码路径:', scanResult.path)
|
||||||
|
console.log('解析到的设备号:', deviceNo)
|
||||||
if (!deviceNo) {
|
|
||||||
uni.showToast({
|
if (!deviceNo) {
|
||||||
title: '无效的设备二维码',
|
uni.showToast({
|
||||||
icon: 'none'
|
title: '无效的设备二维码',
|
||||||
})
|
icon: 'none'
|
||||||
return
|
})
|
||||||
}
|
return
|
||||||
|
}
|
||||||
// 直接在当前页面查询是否有使用中的订单,避免跳转到中间页面
|
|
||||||
if (!uni.getStorageSync('token')) {
|
// 直接在当前页面查询是否有使用中的订单,避免跳转到中间页面
|
||||||
await wxLogin()
|
if (!uni.getStorageSync('token')) {
|
||||||
}
|
await wxLogin()
|
||||||
|
}
|
||||||
// 检查是否有使用中的订单
|
|
||||||
const inUseRes = await uni.request({
|
// 检查是否有使用中的订单
|
||||||
url: `${URL || 'http://127.0.0.1:8080'}/app/order/inUse`,
|
const inUseRes = await uni.request({
|
||||||
method: 'GET',
|
url: `${URL || 'http://127.0.0.1:8080'}/app/order/inUse`,
|
||||||
header: {
|
method: 'GET',
|
||||||
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
header: {
|
||||||
'Clientid': uni.getStorageSync('client_id')
|
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
||||||
}
|
'Clientid': uni.getStorageSync('client_id')
|
||||||
})
|
}
|
||||||
|
})
|
||||||
console.log('使用中订单检查结果:', JSON.stringify(inUseRes))
|
|
||||||
|
console.log('使用中订单检查结果:', 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
|
// 存在使用中的订单,跳转到归还页面
|
||||||
console.log('检测到使用中订单,准备跳转:', inUseOrder)
|
const inUseOrder = inUseRes.data.data
|
||||||
|
console.log('检测到使用中订单,准备跳转:', inUseOrder)
|
||||||
// 直接使用reLaunch而不是navigateTo以确保页面跳转
|
|
||||||
uni.reLaunch({
|
// 直接使用reLaunch而不是navigateTo以确保页面跳转
|
||||||
url: `/pages/return/index?orderId=${inUseOrder.orderId}&deviceId=${deviceNo || inUseOrder.deviceNo}`
|
uni.reLaunch({
|
||||||
})
|
url: `/pages/return/index?orderId=${inUseOrder.orderId}&deviceId=${deviceNo || inUseOrder.deviceNo}`
|
||||||
console.log('已发起页面跳转')
|
})
|
||||||
return
|
console.log('已发起页面跳转')
|
||||||
}
|
return
|
||||||
|
}
|
||||||
// 检查是否有待支付订单
|
|
||||||
const orderRes = await uni.request({
|
// 检查是否有待支付订单
|
||||||
url: `${URL || 'http://127.0.0.1:8080'}/app/order/unpaid`,
|
const orderRes = await uni.request({
|
||||||
method: 'GET',
|
url: `${URL || 'http://127.0.0.1:8080'}/app/order/unpaid`,
|
||||||
header: {
|
method: 'GET',
|
||||||
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
header: {
|
||||||
'Clientid': uni.getStorageSync('client_id')
|
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
||||||
}
|
'Clientid': uni.getStorageSync('client_id')
|
||||||
})
|
}
|
||||||
|
})
|
||||||
console.log('待支付订单检查结果:', JSON.stringify(orderRes))
|
|
||||||
|
console.log('待支付订单检查结果:', 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
|
// 存在待支付订单,跳转到支付页面
|
||||||
console.log('检测到待支付订单,准备跳转:', unpaidOrder)
|
const unpaidOrder = orderRes.data.data
|
||||||
uni.navigateTo({
|
console.log('检测到待支付订单,准备跳转:', unpaidOrder)
|
||||||
url: `/pages/order/payment?orderId=${unpaidOrder.orderId}`
|
uni.navigateTo({
|
||||||
})
|
url: `/pages/order/payment?orderId=${unpaidOrder.orderId}`
|
||||||
} else {
|
})
|
||||||
// 查询设备信息并直接跳转到设备详情页面
|
} else {
|
||||||
console.log('无待支付订单,直接跳转到设备详情页面, deviceNo:', deviceNo)
|
// 修改:直接获取设备信息,而不是跳转到详情页面
|
||||||
uni.navigateTo({
|
console.log('无待支付订单,获取设备信息, deviceNo:', deviceNo)
|
||||||
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
|
||||||
})
|
try {
|
||||||
}
|
// 获取设备信息
|
||||||
} catch (error) {
|
const deviceInfoRes = await getDeviceInfo(deviceNo)
|
||||||
console.error('扫码处理失败:', error)
|
|
||||||
uni.showToast({
|
if (deviceInfoRes.code == 200 && deviceInfoRes.data && deviceInfoRes.data.device) {
|
||||||
title: '扫码失败',
|
const deviceInfo = deviceInfoRes.data.device
|
||||||
icon: 'none'
|
|
||||||
})
|
// 如果有feeConfig,直接解析并处理
|
||||||
}
|
if (deviceInfo.feeConfig) {
|
||||||
}
|
console.log('获取到设备feeConfig信息:', deviceInfo.feeConfig)
|
||||||
}
|
|
||||||
}
|
// 这里可以直接解析feeConfig并进行前端处理
|
||||||
</script>
|
try {
|
||||||
|
const feeConfig = JSON.parse(deviceInfo.feeConfig)
|
||||||
<style lang="scss" scoped>
|
|
||||||
.container {
|
// 根据解析后的feeConfig进行页面跳转并传递信息
|
||||||
height: 87.5vh;
|
uni.navigateTo({
|
||||||
background: #f8f8f8;
|
url: `/pages/device/detail?deviceNo=${deviceNo}&feeConfig=${encodeURIComponent(deviceInfo.feeConfig)}`
|
||||||
padding-bottom: 40rpx;
|
})
|
||||||
|
} catch (e) {
|
||||||
.banner {
|
console.error('解析feeConfig失败:', e)
|
||||||
padding: 30rpx;
|
|
||||||
|
// 解析失败时仍然跳转到详情页面,由详情页面处理
|
||||||
.temp-banner {
|
uni.navigateTo({
|
||||||
height: 300rpx;
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
background: linear-gradient(135deg, #1976D2, #42A5F5);
|
})
|
||||||
border-radius: 30rpx;
|
}
|
||||||
position: relative;
|
} else {
|
||||||
overflow: hidden;
|
// 没有feeConfig时,跳转到详情页面
|
||||||
display: flex;
|
uni.navigateTo({
|
||||||
flex-direction: column;
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
justify-content: center;
|
})
|
||||||
align-items: center;
|
}
|
||||||
color: #fff;
|
} else {
|
||||||
box-shadow: 0 8rpx 32rpx rgba(25, 118, 210, 0.2);
|
console.error('获取设备信息失败:', deviceInfoRes.msg || '未知错误')
|
||||||
|
uni.showToast({
|
||||||
.banner-text {
|
title: '获取设备信息失败',
|
||||||
font-size: 56rpx;
|
icon: 'none'
|
||||||
font-weight: bold;
|
})
|
||||||
margin-bottom: 20rpx;
|
|
||||||
position: relative;
|
// 失败时仍然跳转到详情页面
|
||||||
z-index: 1;
|
uni.navigateTo({
|
||||||
text-shadow: 0 2rpx 4rpx rgba(0,0,0,0.1);
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
}
|
})
|
||||||
|
}
|
||||||
.banner-subtitle {
|
} catch (error) {
|
||||||
font-size: 32rpx;
|
console.error('获取设备信息异常:', error)
|
||||||
opacity: 0.95;
|
uni.showToast({
|
||||||
position: relative;
|
title: '获取设备信息失败',
|
||||||
z-index: 1;
|
icon: 'none'
|
||||||
text-shadow: 0 2rpx 4rpx rgba(0,0,0,0.1);
|
})
|
||||||
}
|
|
||||||
|
// 异常时仍然跳转到详情页面
|
||||||
.banner-bg {
|
uni.navigateTo({
|
||||||
position: absolute;
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
right: -60rpx;
|
})
|
||||||
bottom: -60rpx;
|
}
|
||||||
width: 300rpx;
|
}
|
||||||
height: 300rpx;
|
} catch (error) {
|
||||||
background: rgba(255,255,255,0.1);
|
console.error('扫码处理失败:', error)
|
||||||
border-radius: 50%;
|
uni.showToast({
|
||||||
transform: rotate(-15deg);
|
title: '扫码失败',
|
||||||
}
|
icon: 'none'
|
||||||
|
})
|
||||||
&::after {
|
}
|
||||||
content: '';
|
}
|
||||||
position: absolute;
|
}
|
||||||
left: -80rpx;
|
}
|
||||||
top: -80rpx;
|
</script>
|
||||||
width: 240rpx;
|
|
||||||
height: 240rpx;
|
<style lang="scss" scoped>
|
||||||
background: rgba(255,255,255,0.08);
|
.container {
|
||||||
border-radius: 50%;
|
height: 87.5vh;
|
||||||
}
|
background: #f8f8f8;
|
||||||
}
|
padding-bottom: 40rpx;
|
||||||
}
|
|
||||||
|
.banner {
|
||||||
.scan-area {
|
padding: 30rpx;
|
||||||
padding: 20rpx 30rpx 40rpx;
|
|
||||||
display: flex;
|
.temp-banner {
|
||||||
justify-content: center;
|
height: 300rpx;
|
||||||
|
background: linear-gradient(135deg, #1976D2, #42A5F5);
|
||||||
.scan-btn {
|
border-radius: 30rpx;
|
||||||
width: 460rpx;
|
position: relative;
|
||||||
height: 200rpx;
|
overflow: hidden;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
justify-content: center;
|
||||||
justify-content: center;
|
align-items: center;
|
||||||
background: linear-gradient(135deg, #00C853, #69F0AE);
|
color: #fff;
|
||||||
border-radius: 30rpx;
|
box-shadow: 0 8rpx 32rpx rgba(25, 118, 210, 0.2);
|
||||||
box-shadow: 0 8rpx 32rpx rgba(0, 200, 83, 0.2);
|
|
||||||
transition: all 0.3s ease;
|
.banner-text {
|
||||||
position: relative;
|
font-size: 56rpx;
|
||||||
overflow: hidden;
|
font-weight: bold;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
&:active {
|
position: relative;
|
||||||
transform: scale(0.98);
|
z-index: 1;
|
||||||
box-shadow: 0 4rpx 16rpx rgba(0, 200, 83, 0.15);
|
text-shadow: 0 2rpx 4rpx rgba(0,0,0,0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
&::after {
|
.banner-subtitle {
|
||||||
content: '';
|
font-size: 32rpx;
|
||||||
position: absolute;
|
opacity: 0.95;
|
||||||
top: 0;
|
position: relative;
|
||||||
left: 0;
|
z-index: 1;
|
||||||
right: 0;
|
text-shadow: 0 2rpx 4rpx rgba(0,0,0,0.1);
|
||||||
bottom: 0;
|
}
|
||||||
background: linear-gradient(rgba(255,255,255,0.1), transparent);
|
|
||||||
}
|
.banner-bg {
|
||||||
|
position: absolute;
|
||||||
.btn-content {
|
right: -60rpx;
|
||||||
display: flex;
|
bottom: -60rpx;
|
||||||
align-items: center;
|
width: 300rpx;
|
||||||
justify-content: center;
|
height: 300rpx;
|
||||||
margin-bottom: 12rpx;
|
background: rgba(255,255,255,0.1);
|
||||||
position: relative;
|
border-radius: 50%;
|
||||||
z-index: 1;
|
transform: rotate(-15deg);
|
||||||
|
}
|
||||||
.btn-icon {
|
|
||||||
width: 48rpx;
|
&::after {
|
||||||
height: 48rpx;
|
content: '';
|
||||||
margin-right: 16rpx;
|
position: absolute;
|
||||||
}
|
left: -80rpx;
|
||||||
|
top: -80rpx;
|
||||||
.btn-text {
|
width: 240rpx;
|
||||||
font-size: 42rpx;
|
height: 240rpx;
|
||||||
font-weight: 600;
|
background: rgba(255,255,255,0.08);
|
||||||
color: #fff;
|
border-radius: 50%;
|
||||||
text-shadow: 0 2rpx 4rpx rgba(0,0,0,0.1);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-desc {
|
.scan-area {
|
||||||
font-size: 26rpx;
|
padding: 20rpx 30rpx 40rpx;
|
||||||
color: rgba(255, 255, 255, 0.95);
|
display: flex;
|
||||||
position: relative;
|
justify-content: center;
|
||||||
z-index: 1;
|
|
||||||
}
|
.scan-btn {
|
||||||
}
|
width: 460rpx;
|
||||||
}
|
height: 200rpx;
|
||||||
|
display: flex;
|
||||||
.tips-section {
|
flex-direction: column;
|
||||||
margin: 0 30rpx;
|
align-items: center;
|
||||||
background: #fff;
|
justify-content: center;
|
||||||
border-radius: 24rpx;
|
background: linear-gradient(135deg, #00C853, #69F0AE);
|
||||||
box-shadow: 0 8rpx 32rpx rgba(0,0,0,0.05);
|
border-radius: 30rpx;
|
||||||
overflow: hidden;
|
box-shadow: 0 8rpx 32rpx rgba(0, 200, 83, 0.2);
|
||||||
|
transition: all 0.3s ease;
|
||||||
.tips-header {
|
position: relative;
|
||||||
padding: 30rpx;
|
overflow: hidden;
|
||||||
background: linear-gradient(to right, #F5F9FF, #fff);
|
|
||||||
border-bottom: 2rpx solid #f0f0f0;
|
&:active {
|
||||||
|
transform: scale(0.98);
|
||||||
.tips-title {
|
box-shadow: 0 4rpx 16rpx rgba(0, 200, 83, 0.15);
|
||||||
font-size: 32rpx;
|
}
|
||||||
font-weight: 600;
|
|
||||||
color: #333;
|
&::after {
|
||||||
position: relative;
|
content: '';
|
||||||
padding-left: 24rpx;
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
&::before {
|
left: 0;
|
||||||
content: '';
|
right: 0;
|
||||||
position: absolute;
|
bottom: 0;
|
||||||
left: 0;
|
background: linear-gradient(rgba(255,255,255,0.1), transparent);
|
||||||
top: 50%;
|
}
|
||||||
transform: translateY(-50%);
|
|
||||||
width: 8rpx;
|
.btn-content {
|
||||||
height: 32rpx;
|
display: flex;
|
||||||
background: #1976D2;
|
align-items: center;
|
||||||
border-radius: 4rpx;
|
justify-content: center;
|
||||||
}
|
margin-bottom: 12rpx;
|
||||||
}
|
position: relative;
|
||||||
}
|
z-index: 1;
|
||||||
|
|
||||||
.tips-list {
|
.btn-icon {
|
||||||
padding: 20rpx 30rpx;
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
.tip-item {
|
margin-right: 16rpx;
|
||||||
display: flex;
|
}
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 24rpx;
|
.btn-text {
|
||||||
padding: 0 10rpx;
|
font-size: 42rpx;
|
||||||
|
font-weight: 600;
|
||||||
&:last-child {
|
color: #fff;
|
||||||
margin-bottom: 0;
|
text-shadow: 0 2rpx 4rpx rgba(0,0,0,0.1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
.tip-dot {
|
|
||||||
width: 12rpx;
|
.btn-desc {
|
||||||
height: 12rpx;
|
font-size: 26rpx;
|
||||||
background: #1976D2;
|
color: rgba(255, 255, 255, 0.95);
|
||||||
border-radius: 50%;
|
position: relative;
|
||||||
margin-right: 16rpx;
|
z-index: 1;
|
||||||
flex-shrink: 0;
|
}
|
||||||
box-shadow: 0 2rpx 6rpx rgba(25,118,210,0.2);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
text {
|
.tips-section {
|
||||||
font-size: 28rpx;
|
margin: 0 30rpx;
|
||||||
color: #666;
|
background: #fff;
|
||||||
line-height: 1.6;
|
border-radius: 24rpx;
|
||||||
}
|
box-shadow: 0 8rpx 32rpx rgba(0,0,0,0.05);
|
||||||
}
|
overflow: hidden;
|
||||||
}
|
|
||||||
}
|
.tips-header {
|
||||||
}
|
padding: 30rpx;
|
||||||
</style>
|
background: linear-gradient(to right, #F5F9FF, #fff);
|
||||||
|
border-bottom: 2rpx solid #f0f0f0;
|
||||||
|
|
||||||
|
.tips-title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
position: relative;
|
||||||
|
padding-left: 24rpx;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
width: 8rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
background: #1976D2;
|
||||||
|
border-radius: 4rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tips-list {
|
||||||
|
padding: 20rpx 30rpx;
|
||||||
|
|
||||||
|
.tip-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
padding: 0 10rpx;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tip-dot {
|
||||||
|
width: 12rpx;
|
||||||
|
height: 12rpx;
|
||||||
|
background: #1976D2;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 16rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
box-shadow: 0 2rpx 6rpx rgba(25,118,210,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
+501
-501
File diff suppressed because it is too large
Load Diff
+582
-610
File diff suppressed because it is too large
Load Diff
+337
-337
@@ -1,338 +1,338 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="success-container">
|
<view class="success-container">
|
||||||
<!-- 支付成功状态 -->
|
<!-- 支付成功状态 -->
|
||||||
<view class="status-card">
|
<view class="status-card">
|
||||||
<view class="status-icon success"></view>
|
<view class="status-icon success"></view>
|
||||||
<view class="status-text">支付成功</view>
|
<view class="status-text">支付成功</view>
|
||||||
<view class="status-desc">您的订单已支付成功</view>
|
<view class="status-desc">您的订单已支付成功</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 订单信息 -->
|
<!-- 订单信息 -->
|
||||||
<view class="order-card">
|
<view class="order-card">
|
||||||
<view class="card-title">订单信息</view>
|
<view class="card-title">订单信息</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="label">订单号</text>
|
<text class="label">订单号</text>
|
||||||
<text class="value">{{ orderInfo.orderNo || '-' }}</text>
|
<text class="value">{{ orderInfo.orderNo || '-' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="label">设备号</text>
|
<text class="label">设备号</text>
|
||||||
<text class="value">{{ orderInfo.deviceNo || '-' }}</text>
|
<text class="value">{{ orderInfo.deviceNo || '-' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="label">支付金额</text>
|
<text class="label">支付金额</text>
|
||||||
<text class="value">¥{{ orderInfo.amount || '0.00' }}</text>
|
<text class="value">¥{{ orderInfo.amount || '0.00' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="label">支付时间</text>
|
<text class="label">支付时间</text>
|
||||||
<text class="value">{{ orderInfo.payTime || '-' }}</text>
|
<text class="value">{{ orderInfo.payTime || '-' }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 设备状态 -->
|
<!-- 设备状态 -->
|
||||||
<view class="device-status">
|
<view class="device-status">
|
||||||
<view class="status-message">{{ deviceMessage }}</view>
|
<view class="status-message">{{ deviceMessage }}</view>
|
||||||
<view class="loading-animation" v-if="isLoading">
|
<view class="loading-animation" v-if="isLoading">
|
||||||
<view class="loading-circle"></view>
|
<view class="loading-circle"></view>
|
||||||
</view>
|
</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>
|
||||||
<button class="secondary-btn" @click="goToOrderList">查看订单</button>
|
<button class="secondary-btn" @click="goToOrderList">查看订单</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { queryById, confirmPaymentAndRent } from '@/config/user.js'
|
import { queryById, confirmPaymentAndRent } from '@/config/user.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
orderId: '',
|
orderId: '',
|
||||||
orderInfo: {},
|
orderInfo: {},
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
deviceMessage: '正在准备您的设备,请稍候...',
|
deviceMessage: '正在准备您的设备,请稍候...',
|
||||||
hasTriggeredDevice: false
|
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, () => {
|
uni.$once('orderSuccess:' + this.orderId, () => {
|
||||||
console.log('已经触发过弹出逻辑,不再重复触发')
|
console.log('已经触发过弹出逻辑,不再重复触发')
|
||||||
this.hasTriggeredDevice = true
|
this.hasTriggeredDevice = true
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '订单信息不存在',
|
title: '订单信息不存在',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.goToHome()
|
this.goToHome()
|
||||||
}, 1500)
|
}, 1500)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async loadOrderInfo() {
|
async loadOrderInfo() {
|
||||||
try {
|
try {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中'
|
title: '加载中'
|
||||||
})
|
})
|
||||||
|
|
||||||
const res = await queryById(this.orderId)
|
const res = await queryById(this.orderId)
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
const orderData = res.data
|
const orderData = res.data
|
||||||
this.orderInfo = {
|
this.orderInfo = {
|
||||||
orderNo: orderData.orderNo || orderData.orderId,
|
orderNo: orderData.orderNo || orderData.orderId,
|
||||||
deviceNo: orderData.deviceNo,
|
deviceNo: orderData.deviceNo,
|
||||||
amount: orderData.payAmount || orderData.amount,
|
amount: orderData.payAmount || orderData.amount,
|
||||||
payTime: orderData.payTime || this.formatTime(new Date())
|
payTime: orderData.payTime || this.formatTime(new Date())
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查订单状态
|
// 检查订单状态
|
||||||
if (orderData.orderStatus === 'IN_USED') {
|
if (orderData.orderStatus === 'IN_USED') {
|
||||||
// 如果已经是使用中状态,可能说明开锁已经完成
|
// 如果已经是使用中状态,可能说明开锁已经完成
|
||||||
this.deviceMessage = '设备已弹出,请取走您的充电宝'
|
this.deviceMessage = '设备已弹出,请取走您的充电宝'
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
|
|
||||||
// 如果是第一次加载页面且设备已弹出,记录状态,避免重复弹出
|
// 如果是第一次加载页面且设备已弹出,记录状态,避免重复弹出
|
||||||
if (!this.hasTriggeredDevice) {
|
if (!this.hasTriggeredDevice) {
|
||||||
uni.$emit('orderSuccess:' + this.orderId)
|
uni.$emit('orderSuccess:' + this.orderId)
|
||||||
this.hasTriggeredDevice = true
|
this.hasTriggeredDevice = true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 正常触发弹出逻辑
|
// 正常触发弹出逻辑
|
||||||
this.triggerDeviceEject()
|
this.triggerDeviceEject()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error('获取订单信息失败')
|
throw new Error('获取订单信息失败')
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: error.message || '获取订单信息失败',
|
title: error.message || '获取订单信息失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 触发弹出充电宝
|
// 触发弹出充电宝
|
||||||
async triggerDeviceEject() {
|
async triggerDeviceEject() {
|
||||||
if (this.hasTriggeredDevice) {
|
if (this.hasTriggeredDevice) {
|
||||||
console.log('已经触发过弹出充电宝,不重复触发')
|
console.log('已经触发过弹出充电宝,不重复触发')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hasTriggeredDevice = true
|
this.hasTriggeredDevice = true
|
||||||
uni.$emit('orderSuccess:' + this.orderId)
|
uni.$emit('orderSuccess:' + this.orderId)
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
this.deviceMessage = '正在准备您的设备,请稍候...'
|
this.deviceMessage = '正在准备您的设备,请稍候...'
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log(`准备触发弹出充电宝,orderId: ${this.orderId}`)
|
console.log(`准备触发弹出充电宝,orderId: ${this.orderId}`)
|
||||||
|
|
||||||
// 调用确认支付并弹出的方法
|
// 调用确认支付并弹出的方法
|
||||||
const result = await confirmPaymentAndRent(this.orderId)
|
const result = await confirmPaymentAndRent(this.orderId)
|
||||||
console.log('确认支付并弹出充电宝结果:', JSON.stringify(result))
|
console.log('确认支付并弹出充电宝结果:', JSON.stringify(result))
|
||||||
|
|
||||||
if (result && result.code === 200) {
|
if (result && result.code === 200) {
|
||||||
this.deviceMessage = '设备已弹出,请取走您的充电宝'
|
this.deviceMessage = '设备已弹出,请取走您的充电宝'
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '充电宝已弹出',
|
title: '充电宝已弹出',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
throw new Error((result && result.msg) || '弹出充电宝失败')
|
throw new Error((result && result.msg) || '弹出充电宝失败')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('弹出充电宝错误:', error)
|
console.error('弹出充电宝错误:', error)
|
||||||
this.deviceMessage = '弹出设备失败,请联系客服'
|
this.deviceMessage = '弹出设备失败,请联系客服'
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: error.message || '弹出充电宝失败,请联系客服',
|
title: error.message || '弹出充电宝失败,请联系客服',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
} finally {
|
} finally {
|
||||||
this.isLoading = false
|
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')
|
||||||
const day = date.getDate().toString().padStart(2, '0')
|
const day = date.getDate().toString().padStart(2, '0')
|
||||||
const hour = date.getHours().toString().padStart(2, '0')
|
const hour = date.getHours().toString().padStart(2, '0')
|
||||||
const minute = date.getMinutes().toString().padStart(2, '0')
|
const minute = date.getMinutes().toString().padStart(2, '0')
|
||||||
const second = date.getSeconds().toString().padStart(2, '0')
|
const second = date.getSeconds().toString().padStart(2, '0')
|
||||||
return `${year}-${month}-${day} ${hour}:${minute}:${second}`
|
return `${year}-${month}-${day} ${hour}:${minute}:${second}`
|
||||||
},
|
},
|
||||||
goToHome() {
|
goToHome() {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
goToOrderList() {
|
goToOrderList() {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pages/order/index'
|
url: '/pages/order/index'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.success-container {
|
.success-container {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-card {
|
.status-card {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
|
|
||||||
.status-icon {
|
.status-icon {
|
||||||
width: 60px;
|
width: 60px;
|
||||||
height: 60px;
|
height: 60px;
|
||||||
margin: 0 auto 16px;
|
margin: 0 auto 16px;
|
||||||
background-color: #07c160;
|
background-color: #07c160;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
width: 30px;
|
width: 30px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
border: 3px solid #fff;
|
border: 3px solid #fff;
|
||||||
border-top: none;
|
border-top: none;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
transform-origin: center;
|
transform-origin: center;
|
||||||
transform: translate(-50%, -70%) rotate(-45deg);
|
transform: translate(-50%, -70%) rotate(-45deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-text {
|
.status-text {
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #07c160;
|
color: #07c160;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-desc {
|
.status-desc {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-card {
|
.order-card {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
|
|
||||||
.card-title {
|
.card-title {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-item {
|
.info-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
color: #666;
|
color: #666;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.value {
|
.value {
|
||||||
color: #333;
|
color: #333;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.device-status {
|
.device-status {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
.status-message {
|
.status-message {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-animation {
|
.loading-animation {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
|
||||||
.loading-circle {
|
.loading-circle {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
border: 3px solid #f0f0f0;
|
border: 3px solid #f0f0f0;
|
||||||
border-top-color: #07c160;
|
border-top-color: #07c160;
|
||||||
animation: spin 1s linear infinite;
|
animation: spin 1s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes spin {
|
@keyframes spin {
|
||||||
0% { transform: rotate(0deg); }
|
0% { transform: rotate(0deg); }
|
||||||
100% { transform: rotate(360deg); }
|
100% { transform: rotate(360deg); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-group {
|
.button-group {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
|
|
||||||
.primary-btn {
|
.primary-btn {
|
||||||
background-color: #07c160;
|
background-color: #07c160;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 24px;
|
border-radius: 24px;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.secondary-btn {
|
.secondary-btn {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
color: #07c160;
|
color: #07c160;
|
||||||
border: 1px solid #07c160;
|
border: 1px solid #07c160;
|
||||||
border-radius: 24px;
|
border-radius: 24px;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
+136
-136
@@ -1,137 +1,137 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
wxLogin,
|
wxLogin,
|
||||||
} from '../../../util/index'
|
} from '../../../util/index'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getMyIndexInfo
|
getMyIndexInfo
|
||||||
} from "../../../config/user.js";
|
} from "../../../config/user.js";
|
||||||
import {
|
import {
|
||||||
queryHasOrder
|
queryHasOrder
|
||||||
} from "../../../config/user.js";
|
} from "../../../config/user.js";
|
||||||
import {
|
import {
|
||||||
checkOrdersByStatus
|
checkOrdersByStatus
|
||||||
} from "../../../config/user.js";
|
} from "../../../config/user.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async onLoad(option) {
|
async onLoad(option) {
|
||||||
console.log('bagCheck onLoad option:', option);
|
console.log('bagCheck onLoad option:', option);
|
||||||
try {
|
try {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '处理中...',
|
title: '处理中...',
|
||||||
mask: true
|
mask: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// 检查是否传入设备编号
|
// 检查是否传入设备编号
|
||||||
if (!option || !option.deviceNo) {
|
if (!option || !option.deviceNo) {
|
||||||
throw new Error('未识别到设备编号');
|
throw new Error('未识别到设备编号');
|
||||||
}
|
}
|
||||||
|
|
||||||
const deviceNo = option.deviceNo;
|
const deviceNo = option.deviceNo;
|
||||||
|
|
||||||
// 检查用户是否有进行中(in_used)或待支付(waiting_for_payment)的订单
|
// 检查用户是否有进行中(in_used)或待支付(waiting_for_payment)的订单
|
||||||
const statusesToCheck = ['in_used', 'waiting_for_payment'];
|
const statusesToCheck = ['in_used', 'waiting_for_payment'];
|
||||||
const res = await checkOrdersByStatus(deviceNo, statusesToCheck);
|
const res = await checkOrdersByStatus(deviceNo, statusesToCheck);
|
||||||
|
|
||||||
if (res.code === 200 && res.data && res.data.length > 0) {
|
if (res.code === 200 && res.data && res.data.length > 0) {
|
||||||
// 找到相关订单,取最新的一条
|
// 找到相关订单,取最新的一条
|
||||||
const latestOrder = res.data[0]; // 假设返回结果按时间倒序
|
const latestOrder = res.data[0]; // 假设返回结果按时间倒序
|
||||||
|
|
||||||
if (latestOrder.orderStatus === 'in_used') {
|
if (latestOrder.orderStatus === 'in_used') {
|
||||||
// 如果是使用中的订单,跳转到归还页面
|
// 如果是使用中的订单,跳转到归还页面
|
||||||
console.log('检测到使用中订单,跳转归还页:', latestOrder.orderId);
|
console.log('检测到使用中订单,跳转归还页:', latestOrder.orderId);
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pages/device/return?orderId=${latestOrder.orderId}`
|
url: `/pages/device/return?orderId=${latestOrder.orderId}`
|
||||||
});
|
});
|
||||||
} else if (latestOrder.orderStatus === 'waiting_for_payment') {
|
} else if (latestOrder.orderStatus === 'waiting_for_payment') {
|
||||||
// 如果是待支付订单,跳转到支付页面,并传递必要信息
|
// 如果是待支付订单,跳转到支付页面,并传递必要信息
|
||||||
console.log('检测到待支付订单,跳转支付页:', latestOrder.orderId);
|
console.log('检测到待支付订单,跳转支付页:', latestOrder.orderId);
|
||||||
|
|
||||||
// 获取套餐时间(分钟)
|
// 获取套餐时间(分钟)
|
||||||
const packageTimeMinutes = latestOrder.packageTime || 60;
|
const packageTimeMinutes = latestOrder.packageTime || 60;
|
||||||
|
|
||||||
// 套餐小时数
|
// 套餐小时数
|
||||||
const packageTimeHours = (packageTimeMinutes / 60).toFixed(1);
|
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 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}&packageTimeHours=${packageTimeHours}&packagePrice=${packagePrice}&hourlyRate=${hourlyRate}&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配置错误),默认到详情页
|
||||||
console.log('检测到其他状态订单,跳转详情页:', latestOrder.orderId);
|
console.log('检测到其他状态订单,跳转详情页:', latestOrder.orderId);
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 没有找到相关状态的订单,跳转到设备详情页进行租借
|
// 没有找到相关状态的订单,跳转到设备详情页进行租借
|
||||||
console.log('未检测到相关订单,跳转详情页');
|
console.log('未检测到相关订单,跳转详情页');
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 只处理真正的错误,不是"没有订单"的情况
|
// 只处理真正的错误,不是"没有订单"的情况
|
||||||
if (error.message && (
|
if (error.message && (
|
||||||
error.message.includes('未识别到设备编号') ||
|
error.message.includes('未识别到设备编号') ||
|
||||||
error.message.includes('网络请求失败') ||
|
error.message.includes('网络请求失败') ||
|
||||||
error.message.includes('服务器错误')
|
error.message.includes('服务器错误')
|
||||||
)) {
|
)) {
|
||||||
console.error('扫码检查订单失败:', error);
|
console.error('扫码检查订单失败:', error);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: error.message || '处理失败,请稍后重试',
|
title: error.message || '处理失败,请稍后重试',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 对于其他错误,包括"没有找到订单",直接跳转到详情页,不显示错误消息
|
// 对于其他错误,包括"没有找到订单",直接跳转到详情页,不显示错误消息
|
||||||
console.log('没有找到符合条件的订单或发生其他错误,直接跳转详情页');
|
console.log('没有找到符合条件的订单或发生其他错误,直接跳转详情页');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 无论什么情况,都跳转到一个可用页面
|
// 无论什么情况,都跳转到一个可用页面
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (option && option.deviceNo) {
|
if (option && option.deviceNo) {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pages/device/detail?deviceNo=${option.deviceNo}`
|
url: `/pages/device/detail?deviceNo=${option.deviceNo}`
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 如果连deviceNo都没有,则返回首页
|
// 如果连deviceNo都没有,则返回首页
|
||||||
uni.switchTab({ url: '/pages/index/index' });
|
uni.switchTab({ url: '/pages/index/index' });
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 2000);
|
||||||
} finally {
|
} finally {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
+229
-229
@@ -1,230 +1,230 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<!-- 用户信息卡片 -->
|
<!-- 用户信息卡片 -->
|
||||||
<view class="user-card">
|
<view class="user-card">
|
||||||
<view class="avatar">
|
<view class="avatar">
|
||||||
<image :src="userInfo.avatar || '/static/images/default-avatar.png'" mode="aspectFill"></image>
|
<image :src="userInfo.avatar || '/static/images/default-avatar.png'" mode="aspectFill"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="user-info">
|
<view class="user-info">
|
||||||
<text class="nickname">{{ userInfo.nickName || '未登录' }}</text>
|
<text class="nickname">{{ userInfo.nickName || '未登录' }}</text>
|
||||||
<text class="phone">{{ userInfo.phone || '未绑定手机号' }}</text>
|
<text class="phone">{{ userInfo.phone || '未绑定手机号' }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 余额卡片 -->
|
<!-- 余额卡片 -->
|
||||||
<view class="balance-card">
|
<view class="balance-card">
|
||||||
<view class="balance-title">余额</view>
|
<view class="balance-title">余额</view>
|
||||||
<view class="balance-amount">¥{{ userInfo.balanceAmount || '0.00' }}</view>
|
<view class="balance-amount">¥{{ userInfo.balanceAmount || '0.00' }}</view>
|
||||||
<view class="balance-desc">可用于租借设备</view>
|
<view class="balance-desc">可用于租借设备</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 功能菜单 -->
|
<!-- 功能菜单 -->
|
||||||
<view class="menu-list">
|
<view class="menu-list">
|
||||||
<view class="menu-item" @click="navigateTo('/pages/order/list')">
|
<view class="menu-item" @click="navigateTo('/pages/order/list')">
|
||||||
<text class="menu-icon">📋</text>
|
<text class="menu-icon">📋</text>
|
||||||
<text class="menu-text">我的订单</text>
|
<text class="menu-text">我的订单</text>
|
||||||
<text class="menu-arrow">></text>
|
<text class="menu-arrow">></text>
|
||||||
</view>
|
</view>
|
||||||
<view class="menu-item" @click="navigateTo('/pages/user/feedback')">
|
<view class="menu-item" @click="navigateTo('/pages/user/feedback')">
|
||||||
<text class="menu-icon">💬</text>
|
<text class="menu-icon">💬</text>
|
||||||
<text class="menu-text">意见反馈</text>
|
<text class="menu-text">意见反馈</text>
|
||||||
<text class="menu-arrow">></text>
|
<text class="menu-arrow">></text>
|
||||||
</view>
|
</view>
|
||||||
<view class="menu-item" @click="navigateTo('/pages/user/about')">
|
<view class="menu-item" @click="navigateTo('/pages/user/about')">
|
||||||
<text class="menu-icon">ℹ️</text>
|
<text class="menu-icon">ℹ️</text>
|
||||||
<text class="menu-text">关于我们</text>
|
<text class="menu-text">关于我们</text>
|
||||||
<text class="menu-arrow">></text>
|
<text class="menu-arrow">></text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 退出登录按钮 -->
|
<!-- 退出登录按钮 -->
|
||||||
<view class="logout-btn" @click="handleLogout" v-if="isLogin">
|
<view class="logout-btn" @click="handleLogout" v-if="isLogin">
|
||||||
<text>退出登录</text>
|
<text>退出登录</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getUserInfo } from '@/api/user'
|
import { getUserInfo } from '@/api/user'
|
||||||
import { URL } from '@/config/url'
|
import { URL } from '@/config/url'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
userInfo: {},
|
userInfo: {},
|
||||||
isLogin: false
|
isLogin: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.checkLoginStatus()
|
this.checkLoginStatus()
|
||||||
this.loadUserInfo()
|
this.loadUserInfo()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async loadUserInfo() {
|
async loadUserInfo() {
|
||||||
try {
|
try {
|
||||||
const res = await getUserInfo()
|
const res = await getUserInfo()
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.userInfo = res.data
|
this.userInfo = res.data
|
||||||
this.isLogin = true
|
this.isLogin = true
|
||||||
} else {
|
} else {
|
||||||
this.isLogin = false
|
this.isLogin = false
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '获取用户信息失败',
|
title: '获取用户信息失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('加载用户信息失败:', error)
|
console.error('加载用户信息失败:', error)
|
||||||
this.isLogin = false
|
this.isLogin = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkLoginStatus() {
|
checkLoginStatus() {
|
||||||
const token = uni.getStorageSync('token')
|
const token = uni.getStorageSync('token')
|
||||||
this.isLogin = !!token
|
this.isLogin = !!token
|
||||||
if (!this.isLogin) {
|
if (!this.isLogin) {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pages/login/index'
|
url: '/pages/login/index'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
navigateTo(url) {
|
navigateTo(url) {
|
||||||
uni.navigateTo({ url })
|
uni.navigateTo({ url })
|
||||||
},
|
},
|
||||||
handleLogout() {
|
handleLogout() {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '确定要退出登录吗?',
|
content: '确定要退出登录吗?',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
uni.removeStorageSync('token')
|
uni.removeStorageSync('token')
|
||||||
uni.removeStorageSync('userInfo')
|
uni.removeStorageSync('userInfo')
|
||||||
this.isLogin = false
|
this.isLogin = false
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pages/login/index'
|
url: '/pages/login/index'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.container {
|
.container {
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-card {
|
.user-card {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
width: 120rpx;
|
width: 120rpx;
|
||||||
height: 120rpx;
|
height: 120rpx;
|
||||||
border-radius: 60rpx;
|
border-radius: 60rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-right: 30rpx;
|
margin-right: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar image {
|
.avatar image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-info {
|
.user-info {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nickname {
|
.nickname {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-bottom: 10rpx;
|
margin-bottom: 10rpx;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.phone {
|
.phone {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
.balance-card {
|
.balance-card {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
.balance-title {
|
.balance-title {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.balance-amount {
|
.balance-amount {
|
||||||
font-size: 48rpx;
|
font-size: 48rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-bottom: 10rpx;
|
margin-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.balance-desc {
|
.balance-desc {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-list {
|
.menu-list {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-item {
|
.menu-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
border-bottom: 1rpx solid #f5f5f5;
|
border-bottom: 1rpx solid #f5f5f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-item:last-child {
|
.menu-item:last-child {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-icon {
|
.menu-icon {
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-text {
|
.menu-text {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-arrow {
|
.menu-arrow {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logout-btn {
|
.logout-btn {
|
||||||
margin-top: 40rpx;
|
margin-top: 40rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #ff4d4f;
|
color: #ff4d4f;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
uni.addInterceptor({
|
uni.addInterceptor({
|
||||||
returnValue (res) {
|
returnValue (res) {
|
||||||
if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) {
|
if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
res.then((res) => res[0] ? reject(res[0]) : resolve(res[1]));
|
res.then((res) => res[0] ? reject(res[0]) : resolve(res[1]));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -1,77 +1,77 @@
|
|||||||
/**
|
/**
|
||||||
* 这里是uni-app内置的常用样式变量
|
* 这里是uni-app内置的常用样式变量
|
||||||
*
|
*
|
||||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||||
*
|
*
|
||||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||||
*/
|
*/
|
||||||
@import 'uview-ui/theme.scss';
|
@import 'uview-ui/theme.scss';
|
||||||
|
|
||||||
/* 颜色变量 */
|
/* 颜色变量 */
|
||||||
|
|
||||||
/* 行为相关颜色 */
|
/* 行为相关颜色 */
|
||||||
$uni-color-primary: #007aff;
|
$uni-color-primary: #007aff;
|
||||||
$uni-color-success: #4cd964;
|
$uni-color-success: #4cd964;
|
||||||
$uni-color-warning: #f0ad4e;
|
$uni-color-warning: #f0ad4e;
|
||||||
$uni-color-error: #dd524d;
|
$uni-color-error: #dd524d;
|
||||||
|
|
||||||
/* 文字基本颜色 */
|
/* 文字基本颜色 */
|
||||||
$uni-text-color:#333;//基本色
|
$uni-text-color:#333;//基本色
|
||||||
$uni-text-color-inverse:#fff;//反色
|
$uni-text-color-inverse:#fff;//反色
|
||||||
$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息
|
$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息
|
||||||
$uni-text-color-placeholder: #808080;
|
$uni-text-color-placeholder: #808080;
|
||||||
$uni-text-color-disable:#c0c0c0;
|
$uni-text-color-disable:#c0c0c0;
|
||||||
|
|
||||||
/* 背景颜色 */
|
/* 背景颜色 */
|
||||||
$uni-bg-color:#ffffff;
|
$uni-bg-color:#ffffff;
|
||||||
$uni-bg-color-grey:#f8f8f8;
|
$uni-bg-color-grey:#f8f8f8;
|
||||||
$uni-bg-color-hover:#f1f1f1;//点击状态颜色
|
$uni-bg-color-hover:#f1f1f1;//点击状态颜色
|
||||||
$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
|
$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
|
||||||
|
|
||||||
/* 边框颜色 */
|
/* 边框颜色 */
|
||||||
$uni-border-color:#c8c7cc;
|
$uni-border-color:#c8c7cc;
|
||||||
|
|
||||||
/* 尺寸变量 */
|
/* 尺寸变量 */
|
||||||
|
|
||||||
/* 文字尺寸 */
|
/* 文字尺寸 */
|
||||||
$uni-font-size-sm:12px;
|
$uni-font-size-sm:12px;
|
||||||
$uni-font-size-base:14px;
|
$uni-font-size-base:14px;
|
||||||
$uni-font-size-lg:16px;
|
$uni-font-size-lg:16px;
|
||||||
|
|
||||||
/* 图片尺寸 */
|
/* 图片尺寸 */
|
||||||
$uni-img-size-sm:20px;
|
$uni-img-size-sm:20px;
|
||||||
$uni-img-size-base:26px;
|
$uni-img-size-base:26px;
|
||||||
$uni-img-size-lg:40px;
|
$uni-img-size-lg:40px;
|
||||||
|
|
||||||
/* Border Radius */
|
/* Border Radius */
|
||||||
$uni-border-radius-sm: 2px;
|
$uni-border-radius-sm: 2px;
|
||||||
$uni-border-radius-base: 3px;
|
$uni-border-radius-base: 3px;
|
||||||
$uni-border-radius-lg: 6px;
|
$uni-border-radius-lg: 6px;
|
||||||
$uni-border-radius-circle: 50%;
|
$uni-border-radius-circle: 50%;
|
||||||
|
|
||||||
/* 水平间距 */
|
/* 水平间距 */
|
||||||
$uni-spacing-row-sm: 5px;
|
$uni-spacing-row-sm: 5px;
|
||||||
$uni-spacing-row-base: 10px;
|
$uni-spacing-row-base: 10px;
|
||||||
$uni-spacing-row-lg: 15px;
|
$uni-spacing-row-lg: 15px;
|
||||||
|
|
||||||
/* 垂直间距 */
|
/* 垂直间距 */
|
||||||
$uni-spacing-col-sm: 4px;
|
$uni-spacing-col-sm: 4px;
|
||||||
$uni-spacing-col-base: 8px;
|
$uni-spacing-col-base: 8px;
|
||||||
$uni-spacing-col-lg: 12px;
|
$uni-spacing-col-lg: 12px;
|
||||||
|
|
||||||
/* 透明度 */
|
/* 透明度 */
|
||||||
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
|
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
|
||||||
|
|
||||||
/* 文章场景相关 */
|
/* 文章场景相关 */
|
||||||
$uni-color-title: #2C405A; // 文章标题颜色
|
$uni-color-title: #2C405A; // 文章标题颜色
|
||||||
$uni-font-size-title:20px;
|
$uni-font-size-title:20px;
|
||||||
$uni-color-subtitle: #555555; // 二级标题颜色
|
$uni-color-subtitle: #555555; // 二级标题颜色
|
||||||
$uni-font-size-subtitle:26px;
|
$uni-font-size-subtitle:26px;
|
||||||
$uni-color-paragraph: #3F536E; // 文章段落颜色
|
$uni-color-paragraph: #3F536E; // 文章段落颜色
|
||||||
$uni-font-size-paragraph:15px;
|
$uni-font-size-paragraph:15px;
|
||||||
|
|||||||
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":["pages/deposit/index.vue?type=page"],"sourcesContent":["import MiniProgramPage from '/Users/apple/Documents/subject/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":["pages/device/detail.vue?type=page"],"sourcesContent":["import MiniProgramPage from '/Users/apple/Documents/subject/locker-fans/uni-fans/pages/device/detail.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:/cGFnZXMvZmVlZGJhY2svaW5kZXgudnVl"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/feedback/index.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
{"version":3,"file":"index.js","sources":["pages/feedback/index.vue?type=page"],"sourcesContent":["import MiniProgramPage from '/Users/apple/Documents/subject/locker-fans/uni-fans/pages/feedback/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:/cGFnZXMvaGVscC9pbmRleC52dWU"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/help/index.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
{"version":3,"file":"index.js","sources":["pages/help/index.vue?type=page"],"sourcesContent":["import MiniProgramPage from '/Users/apple/Documents/subject/locker-fans/uni-fans/pages/help/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:/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":["pages/index/index.vue?type=page"],"sourcesContent":["import MiniProgramPage from '/Users/apple/Documents/subject/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:/cGFnZXMvbXkvaW5kZXgudnVl"],"sourcesContent":["import MiniProgramPage from 'C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/pages/my/index.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
{"version":3,"file":"index.js","sources":["pages/my/index.vue?type=page"],"sourcesContent":["import MiniProgramPage from '/Users/apple/Documents/subject/locker-fans/uni-fans/pages/my/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":["pages/order/index.vue?type=page"],"sourcesContent":["import MiniProgramPage from '/Users/apple/Documents/subject/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":["pages/order/payment.vue?type=page"],"sourcesContent":["import MiniProgramPage from '/Users/apple/Documents/subject/locker-fans/uni-fans/pages/order/payment.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
||||||
@@ -1 +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;"}
|
{"version":3,"file":"return-success.js","sources":["pages/order/return-success.vue?type=page"],"sourcesContent":["import MiniProgramPage from '/Users/apple/Documents/subject/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":["pages/order/success.vue?type=page"],"sourcesContent":["import MiniProgramPage from '/Users/apple/Documents/subject/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":["pages/return/index.vue?type=page"],"sourcesContent":["import MiniProgramPage from '/Users/apple/Documents/subject/locker-fans/uni-fans/pages/return/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:/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":["pages/serve/bagCheck/index.vue?type=page"],"sourcesContent":["import MiniProgramPage from '/Users/apple/Documents/subject/locker-fans/uni-fans/pages/serve/bagCheck/index.vue'\nwx.createPage(MiniProgramPage)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,GAAG,WAAW,eAAe;"}
|
||||||
+2
-2
@@ -6874,9 +6874,9 @@ function initOnError() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
function initRuntimeSocketService() {
|
function initRuntimeSocketService() {
|
||||||
const hosts = "192.168.1.15,127.0.0.1";
|
const hosts = "127.0.0.1,192.168.10.22,10.8.0.5";
|
||||||
const port = "8090";
|
const port = "8090";
|
||||||
const id = "mp-weixin_DyxEKd";
|
const id = "mp-weixin_PMV8-V";
|
||||||
const lazy = typeof swan !== "undefined";
|
const lazy = typeof swan !== "undefined";
|
||||||
let restoreError = lazy ? () => {
|
let restoreError = lazy ? () => {
|
||||||
} : initOnError();
|
} : initOnError();
|
||||||
|
|||||||
+149
-126
@@ -23,9 +23,22 @@ const _sfc_main = {
|
|||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.deviceId = options.deviceNo;
|
this.deviceId = options.deviceNo;
|
||||||
this.checkOrderStatus();
|
if (options.feeConfig) {
|
||||||
common_vendor.index.__f__("log", "at pages/device/detail.vue:114", options.deviceNo);
|
try {
|
||||||
this.getDeviceInfo();
|
common_vendor.index.__f__("log", "at pages/device/detail.vue:117", "从URL获取到feeConfig:", options.feeConfig);
|
||||||
|
const feeConfigStr = decodeURIComponent(options.feeConfig);
|
||||||
|
this.deviceInfo = { ...this.deviceInfo, feeConfig: feeConfigStr };
|
||||||
|
this.parseFeeConfig();
|
||||||
|
} catch (e) {
|
||||||
|
common_vendor.index.__f__("error", "at pages/device/detail.vue:124", "解析URL中的feeConfig失败:", e);
|
||||||
|
this.checkOrderStatus();
|
||||||
|
this.getDeviceInfo();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.checkOrderStatus();
|
||||||
|
common_vendor.index.__f__("log", "at pages/device/detail.vue:132", options.deviceNo);
|
||||||
|
this.getDeviceInfo();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 检查登录状态和订单
|
// 检查登录状态和订单
|
||||||
@@ -54,115 +67,7 @@ const _sfc_main = {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.deviceInfo.feeConfig) {
|
this.parseFeeConfig();
|
||||||
try {
|
|
||||||
const feeConfig = JSON.parse(this.deviceInfo.feeConfig);
|
|
||||||
if (feeConfig.length > 0 && "hour" in feeConfig[0] && "timesPrice" in feeConfig[0]) {
|
|
||||||
this.packages = feeConfig.map((pkg) => {
|
|
||||||
const hour = pkg.hour;
|
|
||||||
const price = pkg.timesPrice;
|
|
||||||
const unitPrice = (price / hour).toFixed(2);
|
|
||||||
return {
|
|
||||||
time: `${hour}小时`,
|
|
||||||
price: price.toFixed(2),
|
|
||||||
unitPrice,
|
|
||||||
hour
|
|
||||||
// 添加小时信息,用于后续处理
|
|
||||||
};
|
|
||||||
});
|
|
||||||
this.packages.sort((a, b) => a.hour - b.hour);
|
|
||||||
} 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:238", "解析设备费用配置失败:", 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"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 显示登录提示
|
// 显示登录提示
|
||||||
@@ -226,16 +131,7 @@ const _sfc_main = {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const selectedPkg = this.packages[this.selectedPackage];
|
this.submitRentOrder();
|
||||||
common_vendor.index.showModal({
|
|
||||||
title: "确认租借",
|
|
||||||
content: `确认支付押金¥{{ depositAmount }}及${selectedPkg.time}套餐费用¥${selectedPkg.price}?`,
|
|
||||||
success: (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
this.submitRentOrder();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
// 提交租借订单
|
// 提交租借订单
|
||||||
async submitRentOrder() {
|
async submitRentOrder() {
|
||||||
@@ -264,19 +160,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:406", "更新订单套餐信息失败:", updateRes.msg);
|
common_vendor.index.__f__("warn", "at pages/device/detail.vue:292", "更新订单套餐信息失败:", updateRes.msg);
|
||||||
} else {
|
} else {
|
||||||
common_vendor.index.__f__("log", "at pages/device/detail.vue:409", "订单套餐信息已提前更新");
|
common_vendor.index.__f__("log", "at pages/device/detail.vue:295", "订单套餐信息已提前更新");
|
||||||
}
|
}
|
||||||
} catch (updateError) {
|
} catch (updateError) {
|
||||||
common_vendor.index.__f__("error", "at pages/device/detail.vue:412", "更新订单套餐信息时出错:", updateError);
|
common_vendor.index.__f__("error", "at pages/device/detail.vue:298", "更新订单套餐信息时出错:", updateError);
|
||||||
}
|
}
|
||||||
const deposit = parseFloat(this.depositAmount);
|
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}&packageTimeHours=${selectedPkg.time.replace("小时", "")}&packagePrice=${selectedPkg.price}&totalAmount=${totalAmount}&depositAmount=${this.depositAmount}`
|
url: `/pages/order/payment?orderId=${order.orderId}&packageTimeHours=${selectedPkg.time.replace("小时", "")}&packagePrice=${selectedPkg.price}&totalAmount=${totalAmount}&depositAmount=${this.depositAmount}${this.deviceInfo && this.deviceInfo.feeConfig ? "&feeConfig=" + encodeURIComponent(this.deviceInfo.feeConfig) : ""}`
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
common_vendor.index.hideLoading();
|
common_vendor.index.hideLoading();
|
||||||
@@ -285,6 +181,133 @@ const _sfc_main = {
|
|||||||
icon: "none"
|
icon: "none"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
// 单独抽取解析feeConfig的逻辑
|
||||||
|
parseFeeConfig() {
|
||||||
|
if (this.deviceInfo.feeConfig) {
|
||||||
|
try {
|
||||||
|
const feeConfig = JSON.parse(this.deviceInfo.feeConfig);
|
||||||
|
if (feeConfig.length > 0 && "hour" in feeConfig[0] && "timesPrice" in feeConfig[0]) {
|
||||||
|
this.packages = feeConfig.map((pkg) => {
|
||||||
|
const hour = pkg.hour;
|
||||||
|
const price = pkg.timesPrice;
|
||||||
|
const unitPrice = (price / hour).toFixed(2);
|
||||||
|
return {
|
||||||
|
time: `${hour}小时`,
|
||||||
|
price: price.toFixed(2),
|
||||||
|
unitPrice,
|
||||||
|
hour
|
||||||
|
// 添加小时信息,用于后续处理
|
||||||
|
};
|
||||||
|
});
|
||||||
|
this.packages.sort((a, b) => a.hour - b.hour);
|
||||||
|
} 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),
|
||||||
|
hour: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: "6小时",
|
||||||
|
price: (hourPrice * 6).toFixed(2),
|
||||||
|
unitPrice: hourPrice.toFixed(2),
|
||||||
|
hour: 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: "12小时",
|
||||||
|
price: (hourPrice * 12).toFixed(2),
|
||||||
|
unitPrice: hourPrice.toFixed(2),
|
||||||
|
hour: 12
|
||||||
|
}
|
||||||
|
];
|
||||||
|
} else if (this.deviceInfo.feeType === "times") {
|
||||||
|
const timesPrice = commonConfig.timesPrice;
|
||||||
|
this.packages = [
|
||||||
|
{
|
||||||
|
time: "1次",
|
||||||
|
price: timesPrice.toFixed(2),
|
||||||
|
unitPrice: timesPrice.toFixed(2),
|
||||||
|
hour: 1
|
||||||
|
}
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
this.packages = [
|
||||||
|
{
|
||||||
|
time: "1小时",
|
||||||
|
price: "2.00",
|
||||||
|
unitPrice: "2.00",
|
||||||
|
hour: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: "6小时",
|
||||||
|
price: "10.00",
|
||||||
|
unitPrice: "1.67",
|
||||||
|
hour: 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: "12小时",
|
||||||
|
price: "15.00",
|
||||||
|
unitPrice: "1.25",
|
||||||
|
hour: 12
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.selectedPackage = Math.min(1, this.packages.length - 1);
|
||||||
|
} catch (e) {
|
||||||
|
common_vendor.index.__f__("error", "at pages/device/detail.vue:419", "解析设备费用配置失败:", e);
|
||||||
|
this.packages = [
|
||||||
|
{
|
||||||
|
time: "1小时",
|
||||||
|
price: "2.00",
|
||||||
|
unitPrice: "2.00",
|
||||||
|
hour: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: "6小时",
|
||||||
|
price: "10.00",
|
||||||
|
unitPrice: "1.67",
|
||||||
|
hour: 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: "12小时",
|
||||||
|
price: "15.00",
|
||||||
|
unitPrice: "1.25",
|
||||||
|
hour: 12
|
||||||
|
}
|
||||||
|
];
|
||||||
|
this.selectedPackage = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.packages = [
|
||||||
|
{
|
||||||
|
time: "1小时",
|
||||||
|
price: "2.00",
|
||||||
|
unitPrice: "2.00",
|
||||||
|
hour: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: "6小时",
|
||||||
|
price: "10.00",
|
||||||
|
unitPrice: "1.67",
|
||||||
|
hour: 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: "12小时",
|
||||||
|
price: "15.00",
|
||||||
|
unitPrice: "1.25",
|
||||||
|
hour: 12
|
||||||
|
}
|
||||||
|
];
|
||||||
|
this.selectedPackage = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+52
-12
@@ -2,6 +2,7 @@
|
|||||||
const common_vendor = require("../../common/vendor.js");
|
const common_vendor = require("../../common/vendor.js");
|
||||||
const util_index = require("../../util/index.js");
|
const util_index = require("../../util/index.js");
|
||||||
const config_url = require("../../config/url.js");
|
const config_url = require("../../config/url.js");
|
||||||
|
const config_user = require("../../config/user.js");
|
||||||
const common_assets = require("../../common/assets.js");
|
const common_assets = require("../../common/assets.js");
|
||||||
const _sfc_main = {
|
const _sfc_main = {
|
||||||
methods: {
|
methods: {
|
||||||
@@ -14,8 +15,8 @@ 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:67", "扫码路径:", scanResult.path);
|
common_vendor.index.__f__("log", "at pages/index/index.vue:68", "扫码路径:", scanResult.path);
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:68", "解析到的设备号:", deviceNo);
|
common_vendor.index.__f__("log", "at pages/index/index.vue:69", "解析到的设备号:", deviceNo);
|
||||||
if (!deviceNo) {
|
if (!deviceNo) {
|
||||||
common_vendor.index.showToast({
|
common_vendor.index.showToast({
|
||||||
title: "无效的设备二维码",
|
title: "无效的设备二维码",
|
||||||
@@ -34,14 +35,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:93", "使用中订单检查结果:", JSON.stringify(inUseRes));
|
common_vendor.index.__f__("log", "at pages/index/index.vue:94", "使用中订单检查结果:", 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:98", "检测到使用中订单,准备跳转:", inUseOrder);
|
common_vendor.index.__f__("log", "at pages/index/index.vue:99", "检测到使用中订单,准备跳转:", 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:104", "已发起页面跳转");
|
common_vendor.index.__f__("log", "at pages/index/index.vue:105", "已发起页面跳转");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const orderRes = await common_vendor.index.request({
|
const orderRes = await common_vendor.index.request({
|
||||||
@@ -52,21 +53,60 @@ 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:118", "待支付订单检查结果:", JSON.stringify(orderRes));
|
common_vendor.index.__f__("log", "at pages/index/index.vue:119", "待支付订单检查结果:", 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:123", "检测到待支付订单,准备跳转:", unpaidOrder);
|
common_vendor.index.__f__("log", "at pages/index/index.vue:124", "检测到待支付订单,准备跳转:", 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:129", "无待支付订单,直接跳转到设备详情页面, deviceNo:", deviceNo);
|
common_vendor.index.__f__("log", "at pages/index/index.vue:130", "无待支付订单,获取设备信息, deviceNo:", deviceNo);
|
||||||
common_vendor.index.navigateTo({
|
try {
|
||||||
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
const deviceInfoRes = await config_user.getDeviceInfo(deviceNo);
|
||||||
});
|
if (deviceInfoRes.code == 200 && deviceInfoRes.data && deviceInfoRes.data.device) {
|
||||||
|
const deviceInfo = deviceInfoRes.data.device;
|
||||||
|
if (deviceInfo.feeConfig) {
|
||||||
|
common_vendor.index.__f__("log", "at pages/index/index.vue:141", "获取到设备feeConfig信息:", deviceInfo.feeConfig);
|
||||||
|
try {
|
||||||
|
const feeConfig = JSON.parse(deviceInfo.feeConfig);
|
||||||
|
common_vendor.index.navigateTo({
|
||||||
|
url: `/pages/device/detail?deviceNo=${deviceNo}&feeConfig=${encodeURIComponent(deviceInfo.feeConfig)}`
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
common_vendor.index.__f__("error", "at pages/index/index.vue:152", "解析feeConfig失败:", e);
|
||||||
|
common_vendor.index.navigateTo({
|
||||||
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
common_vendor.index.navigateTo({
|
||||||
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
common_vendor.index.__f__("error", "at pages/index/index.vue:166", "获取设备信息失败:", deviceInfoRes.msg || "未知错误");
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: "获取设备信息失败",
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
common_vendor.index.navigateTo({
|
||||||
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
common_vendor.index.__f__("error", "at pages/index/index.vue:178", "获取设备信息异常:", error);
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: "获取设备信息失败",
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
common_vendor.index.navigateTo({
|
||||||
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
common_vendor.index.__f__("error", "at pages/index/index.vue:135", "扫码处理失败:", error);
|
common_vendor.index.__f__("error", "at pages/index/index.vue:191", "扫码处理失败:", error);
|
||||||
common_vendor.index.showToast({
|
common_vendor.index.showToast({
|
||||||
title: "扫码失败",
|
title: "扫码失败",
|
||||||
icon: "none"
|
icon: "none"
|
||||||
|
|||||||
+35
-49
@@ -30,6 +30,19 @@ const _sfc_main = {
|
|||||||
const deposit = parseFloat(this.orderInfo.deposit || this.passedDepositAmount || 99);
|
const deposit = parseFloat(this.orderInfo.deposit || this.passedDepositAmount || 99);
|
||||||
const packagePrice = parseFloat(this.packageInfo.price || 0);
|
const packagePrice = parseFloat(this.packageInfo.price || 0);
|
||||||
return (deposit + packagePrice).toFixed(2);
|
return (deposit + packagePrice).toFixed(2);
|
||||||
|
},
|
||||||
|
// 计算每小时的价格
|
||||||
|
hourlyRate() {
|
||||||
|
const price = parseFloat(this.packageInfo.price || 0);
|
||||||
|
let time = parseFloat(this.packageInfo.time || 1);
|
||||||
|
if (this.packageInfo.time && this.packageInfo.time.includes("分钟")) {
|
||||||
|
time = time / 60;
|
||||||
|
} else if (this.packageInfo.time && this.packageInfo.time.includes("次")) {
|
||||||
|
return price.toFixed(2);
|
||||||
|
}
|
||||||
|
if (time <= 0)
|
||||||
|
time = 1;
|
||||||
|
return (price / time).toFixed(2);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
@@ -41,6 +54,15 @@ const _sfc_main = {
|
|||||||
if (options.depositAmount) {
|
if (options.depositAmount) {
|
||||||
this.passedDepositAmount = options.depositAmount;
|
this.passedDepositAmount = options.depositAmount;
|
||||||
}
|
}
|
||||||
|
if (options.feeConfig) {
|
||||||
|
try {
|
||||||
|
common_vendor.index.__f__("log", "at pages/order/payment.vue:135", "从URL获取到feeConfig:", options.feeConfig);
|
||||||
|
const feeConfigStr = decodeURIComponent(options.feeConfig);
|
||||||
|
this.deviceInfo = { feeConfig: feeConfigStr };
|
||||||
|
} catch (e) {
|
||||||
|
common_vendor.index.__f__("error", "at pages/order/payment.vue:140", "解析URL中的feeConfig失败:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
this.loadOrderInfo();
|
this.loadOrderInfo();
|
||||||
} else {
|
} else {
|
||||||
common_vendor.index.showToast({
|
common_vendor.index.showToast({
|
||||||
@@ -72,7 +94,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:149", "时间格式化错误:", e);
|
common_vendor.index.__f__("error", "at pages/order/payment.vue:180", "时间格式化错误:", e);
|
||||||
formattedTime = this.formatTime(/* @__PURE__ */ new Date());
|
formattedTime = this.formatTime(/* @__PURE__ */ new Date());
|
||||||
}
|
}
|
||||||
this.orderInfo = {
|
this.orderInfo = {
|
||||||
@@ -82,6 +104,13 @@ const _sfc_main = {
|
|||||||
phone: orderData.phone,
|
phone: orderData.phone,
|
||||||
deposit: this.passedDepositAmount || orderData.depositAmount || "99.00"
|
deposit: this.passedDepositAmount || orderData.depositAmount || "99.00"
|
||||||
};
|
};
|
||||||
|
if (orderData.packageTime && orderData.packagePrice) {
|
||||||
|
const timeInHours = (parseFloat(orderData.packageTime) / 60).toFixed(1);
|
||||||
|
this.packageInfo = {
|
||||||
|
time: timeInHours.toString(),
|
||||||
|
price: orderData.packagePrice.toString()
|
||||||
|
};
|
||||||
|
}
|
||||||
this.deviceNo = orderData.deviceNo;
|
this.deviceNo = orderData.deviceNo;
|
||||||
await this.loadDeviceInfo();
|
await this.loadDeviceInfo();
|
||||||
} else {
|
} else {
|
||||||
@@ -96,7 +125,7 @@ const _sfc_main = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 加载设备信息并解析套餐
|
// 加载设备信息
|
||||||
async loadDeviceInfo() {
|
async loadDeviceInfo() {
|
||||||
if (!this.deviceNo)
|
if (!this.deviceNo)
|
||||||
return;
|
return;
|
||||||
@@ -104,55 +133,12 @@ const _sfc_main = {
|
|||||||
const res = await config_user.getDeviceInfo(this.deviceNo);
|
const res = await config_user.getDeviceInfo(this.deviceNo);
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
this.deviceInfo = res.data.device;
|
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] && "timesPrice" in feeConfig[0]) {
|
|
||||||
const allPackages = feeConfig.sort((a, b) => a.hour - b.hour);
|
|
||||||
const middleIndex = Math.floor(allPackages.length / 2);
|
|
||||||
const selectedPackage = allPackages[middleIndex];
|
|
||||||
this.packageInfo.time = selectedPackage.hour.toString();
|
|
||||||
this.packageInfo.price = selectedPackage.timesPrice.toString();
|
|
||||||
} else 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:252", "解析设备费用配置失败:", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.deviceInfo && this.deviceInfo.depositAmount) {
|
if (this.deviceInfo && this.deviceInfo.depositAmount) {
|
||||||
this.orderInfo.deposit = this.deviceInfo.depositAmount;
|
this.orderInfo.deposit = this.deviceInfo.depositAmount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
common_vendor.index.__f__("error", "at pages/order/payment.vue:262", "获取设备信息失败:", error);
|
common_vendor.index.__f__("error", "at pages/order/payment.vue:234", "获取设备信息失败:", error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 处理支付
|
// 处理支付
|
||||||
@@ -181,7 +167,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:299", "更新用户余额失败:", error);
|
common_vendor.index.__f__("warn", "at pages/order/payment.vue:271", "更新用户余额失败:", error);
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
common_vendor.index.redirectTo({
|
common_vendor.index.redirectTo({
|
||||||
@@ -190,7 +176,7 @@ const _sfc_main = {
|
|||||||
}, 1500);
|
}, 1500);
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
common_vendor.index.__f__("error", "at pages/order/payment.vue:310", "支付失败:", err);
|
common_vendor.index.__f__("error", "at pages/order/payment.vue:282", "支付失败:", err);
|
||||||
throw new Error("支付失败,请重试");
|
throw new Error("支付失败,请重试");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -287,7 +273,7 @@ const _sfc_main = {
|
|||||||
throw new Error("查询订单状态失败");
|
throw new Error("查询订单状态失败");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
common_vendor.index.__f__("error", "at pages/order/payment.vue:418", "查询订单状态错误:", error);
|
common_vendor.index.__f__("error", "at pages/order/payment.vue:390", "查询订单状态错误:", error);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+26
-26
@@ -1,29 +1,29 @@
|
|||||||
{
|
{
|
||||||
"description": "项目配置文件。",
|
"description": "项目配置文件。",
|
||||||
"packOptions": {
|
"packOptions": {
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"include": []
|
"include": []
|
||||||
},
|
},
|
||||||
"setting": {
|
"setting": {
|
||||||
"urlCheck": false,
|
"urlCheck": false,
|
||||||
"es6": true,
|
"es6": true,
|
||||||
"postcss": false,
|
"postcss": false,
|
||||||
"minified": false,
|
"minified": false,
|
||||||
"newFeature": true,
|
"newFeature": true,
|
||||||
"bigPackageSizeSupport": true,
|
"bigPackageSizeSupport": true,
|
||||||
"babelSetting": {
|
"babelSetting": {
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"disablePlugins": [],
|
"disablePlugins": [],
|
||||||
"outputPath": ""
|
"outputPath": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"compileType": "miniprogram",
|
||||||
|
"libVersion": "3.8.1",
|
||||||
|
"appid": "wxe752f45e7f7aa271",
|
||||||
|
"projectname": "fs",
|
||||||
|
"condition": {},
|
||||||
|
"editorSetting": {
|
||||||
|
"tabIndent": "insertSpaces",
|
||||||
|
"tabSize": 4
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"compileType": "miniprogram",
|
|
||||||
"libVersion": "3.8.0",
|
|
||||||
"appid": "wxe752f45e7f7aa271",
|
|
||||||
"projectname": "fs",
|
|
||||||
"condition": {},
|
|
||||||
"editorSetting": {
|
|
||||||
"tabIndent": "insertSpaces",
|
|
||||||
"tabSize": 2
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
||||||
"projectname": "fs",
|
"projectname": "fs",
|
||||||
"setting": {
|
"setting": {
|
||||||
"compileHotReLoad": true
|
"compileHotReLoad": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+83
-83
@@ -1,84 +1,84 @@
|
|||||||
import {
|
import {
|
||||||
login,
|
login,
|
||||||
getMyIndexInfo
|
getMyIndexInfo
|
||||||
} from "../config/user"
|
} from "../config/user"
|
||||||
|
|
||||||
// 微信登录方法
|
// 微信登录方法
|
||||||
export const wxLogin = () => {
|
export const wxLogin = () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// 1. 获取微信登录凭证
|
// 1. 获取微信登录凭证
|
||||||
uni.login({
|
uni.login({
|
||||||
provider: 'weixin',
|
provider: 'weixin',
|
||||||
success: async (loginRes) => {
|
success: async (loginRes) => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (loginRes.code) {
|
if (loginRes.code) {
|
||||||
// 2. 发送 code 到后端换取 token
|
// 2. 发送 code 到后端换取 token
|
||||||
const result = await login({
|
const result = await login({
|
||||||
code: loginRes.code,
|
code: loginRes.code,
|
||||||
appid: "wxe752f45e7f7aa271"
|
appid: "wxe752f45e7f7aa271"
|
||||||
})
|
})
|
||||||
|
|
||||||
if (result.code === 200) {
|
if (result.code === 200) {
|
||||||
// 3. 保存token和用户信息
|
// 3. 保存token和用户信息
|
||||||
|
|
||||||
uni.setStorageSync('token', result.data.LoginWxVo.access_token)
|
uni.setStorageSync('token', result.data.LoginWxVo.access_token)
|
||||||
uni.setStorageSync('client_id', result.data.LoginWxVo.client_id)
|
uni.setStorageSync('client_id', result.data.LoginWxVo.client_id)
|
||||||
|
|
||||||
resolve(result.data)
|
resolve(result.data)
|
||||||
} else {
|
} else {
|
||||||
throw new Error(result.message || '登录失败')
|
throw new Error(result.message || '登录失败')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error('获取微信登录凭证失败')
|
throw new Error('获取微信登录凭证失败')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: error.message || '登录失败',
|
title: error.message || '登录失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
reject(error)
|
reject(error)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (error) => {
|
fail: (error) => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '微信登录失败',
|
title: '微信登录失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
reject(error)
|
reject(error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查登录状态
|
// 检查登录状态
|
||||||
// export const checkLogin = () => {
|
// export const checkLogin = () => {
|
||||||
// const token = uni.getStorageSync('token')
|
// const token = uni.getStorageSync('token')
|
||||||
// return !!token
|
// return !!token
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
export const getUserInfo = () => {
|
export const getUserInfo = () => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return new Promise(async (res, rej) => {
|
return new Promise(async (res, rej) => {
|
||||||
|
|
||||||
const result = await getMyIndexInfo({
|
const result = await getMyIndexInfo({
|
||||||
isHide: false,
|
isHide: false,
|
||||||
})
|
})
|
||||||
res(result)
|
res(result)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const getQueryString = function (url, name) {
|
export const getQueryString = function (url, name) {
|
||||||
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
|
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
|
||||||
var r = url.substr(1).match(reg)
|
var r = url.substr(1).match(reg)
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
return r[2]
|
return r[2]
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
+221
-221
@@ -1,222 +1,222 @@
|
|||||||
import { queryById } from '@/config/user.js'
|
import { queryById } from '@/config/user.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单监控服务
|
* 订单监控服务
|
||||||
* 用于在后台监控订单状态变化,特别是归还完成状态
|
* 用于在后台监控订单状态变化,特别是归还完成状态
|
||||||
*/
|
*/
|
||||||
class OrderMonitor {
|
class OrderMonitor {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.activeOrders = new Map() // 存储活跃订单 Map<orderId, {orderData, pageName}>
|
this.activeOrders = new Map() // 存储活跃订单 Map<orderId, {orderData, pageName}>
|
||||||
this.timer = null
|
this.timer = null
|
||||||
this.checkInterval = 10000 // 10秒检查一次
|
this.checkInterval = 10000 // 10秒检查一次
|
||||||
this.isRunning = false
|
this.isRunning = false
|
||||||
this.currentPage = null // 当前活跃页面
|
this.currentPage = null // 当前活跃页面
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加订单到监控队列
|
* 添加订单到监控队列
|
||||||
* @param {Object} orderData 订单数据对象,必须包含orderId字段
|
* @param {Object} orderData 订单数据对象,必须包含orderId字段
|
||||||
* @param {String} pageName 关联的页面名称,默认为'return'
|
* @param {String} pageName 关联的页面名称,默认为'return'
|
||||||
*/
|
*/
|
||||||
addOrder(orderData, pageName = 'return') {
|
addOrder(orderData, pageName = 'return') {
|
||||||
if (!orderData || !orderData.orderId) {
|
if (!orderData || !orderData.orderId) {
|
||||||
console.error('添加订单监控失败:无效的订单数据')
|
console.error('添加订单监控失败:无效的订单数据')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`添加订单到监控队列: ${orderData.orderId}, 页面: ${pageName}`)
|
console.log(`添加订单到监控队列: ${orderData.orderId}, 页面: ${pageName}`)
|
||||||
this.activeOrders.set(orderData.orderId, {
|
this.activeOrders.set(orderData.orderId, {
|
||||||
...orderData,
|
...orderData,
|
||||||
pageName
|
pageName
|
||||||
})
|
})
|
||||||
|
|
||||||
// 如果监控服务尚未启动,则启动
|
// 如果监控服务尚未启动,则启动
|
||||||
if (!this.isRunning) {
|
if (!this.isRunning) {
|
||||||
this.start()
|
this.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移除订单的监控
|
* 移除订单的监控
|
||||||
* @param {Object} params 包含orderId或pageName的对象
|
* @param {Object} params 包含orderId或pageName的对象
|
||||||
*/
|
*/
|
||||||
removeOrder(params) {
|
removeOrder(params) {
|
||||||
if (!params) return
|
if (!params) return
|
||||||
|
|
||||||
// 如果提供了orderId,直接删除该订单
|
// 如果提供了orderId,直接删除该订单
|
||||||
if (params.orderId && this.activeOrders.has(params.orderId)) {
|
if (params.orderId && this.activeOrders.has(params.orderId)) {
|
||||||
console.log('从监控队列移除订单:', params.orderId)
|
console.log('从监控队列移除订单:', params.orderId)
|
||||||
this.activeOrders.delete(params.orderId)
|
this.activeOrders.delete(params.orderId)
|
||||||
}
|
}
|
||||||
// 如果提供了pageName,删除该页面关联的所有订单
|
// 如果提供了pageName,删除该页面关联的所有订单
|
||||||
else if (params.pageName) {
|
else if (params.pageName) {
|
||||||
console.log('从监控队列移除页面相关订单:', params.pageName)
|
console.log('从监控队列移除页面相关订单:', params.pageName)
|
||||||
for (const [orderId, data] of this.activeOrders.entries()) {
|
for (const [orderId, data] of this.activeOrders.entries()) {
|
||||||
if (data.pageName === params.pageName) {
|
if (data.pageName === params.pageName) {
|
||||||
this.activeOrders.delete(orderId)
|
this.activeOrders.delete(orderId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果没有订单需要监控了,停止服务
|
// 如果没有订单需要监控了,停止服务
|
||||||
if (this.activeOrders.size === 0) {
|
if (this.activeOrders.size === 0) {
|
||||||
this.stop()
|
this.stop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置当前活跃页面
|
* 设置当前活跃页面
|
||||||
* @param {String} pageName 页面名称
|
* @param {String} pageName 页面名称
|
||||||
*/
|
*/
|
||||||
setActivePage(pageName) {
|
setActivePage(pageName) {
|
||||||
this.currentPage = pageName
|
this.currentPage = pageName
|
||||||
console.log('设置当前活跃页面:', pageName)
|
console.log('设置当前活跃页面:', pageName)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动监控服务
|
* 启动监控服务
|
||||||
*/
|
*/
|
||||||
start() {
|
start() {
|
||||||
if (this.isRunning) return
|
if (this.isRunning) return
|
||||||
|
|
||||||
console.log('启动订单监控服务')
|
console.log('启动订单监控服务')
|
||||||
this.isRunning = true
|
this.isRunning = true
|
||||||
this.checkOrders()
|
this.checkOrders()
|
||||||
|
|
||||||
this.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
this.checkOrders()
|
this.checkOrders()
|
||||||
}, this.checkInterval)
|
}, this.checkInterval)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 停止监控服务
|
* 停止监控服务
|
||||||
*/
|
*/
|
||||||
stop() {
|
stop() {
|
||||||
if (!this.isRunning) return
|
if (!this.isRunning) return
|
||||||
|
|
||||||
console.log('停止订单监控服务')
|
console.log('停止订单监控服务')
|
||||||
this.isRunning = false
|
this.isRunning = false
|
||||||
|
|
||||||
if (this.timer) {
|
if (this.timer) {
|
||||||
clearInterval(this.timer)
|
clearInterval(this.timer)
|
||||||
this.timer = null
|
this.timer = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查所有活跃订单的状态
|
* 检查所有活跃订单的状态
|
||||||
*/
|
*/
|
||||||
async checkOrders() {
|
async checkOrders() {
|
||||||
if (this.activeOrders.size === 0) return
|
if (this.activeOrders.size === 0) return
|
||||||
|
|
||||||
console.log(`检查 ${this.activeOrders.size} 个活跃订单状态, 当前页面: ${this.currentPage}`)
|
console.log(`检查 ${this.activeOrders.size} 个活跃订单状态, 当前页面: ${this.currentPage}`)
|
||||||
|
|
||||||
// 只检查当前活跃页面关联的订单,或无页面关联的订单
|
// 只检查当前活跃页面关联的订单,或无页面关联的订单
|
||||||
for (const [orderId, data] of this.activeOrders.entries()) {
|
for (const [orderId, data] of this.activeOrders.entries()) {
|
||||||
try {
|
try {
|
||||||
// 只在归还页面(或页面未指定时)才执行轮询
|
// 只在归还页面(或页面未指定时)才执行轮询
|
||||||
if (!data.pageName || data.pageName === 'return') {
|
if (!data.pageName || data.pageName === 'return') {
|
||||||
if (this.currentPage === 'return' || this.currentPage === null) {
|
if (this.currentPage === 'return' || this.currentPage === null) {
|
||||||
await this.checkOrderStatus(orderId)
|
await this.checkOrderStatus(orderId)
|
||||||
} else {
|
} else {
|
||||||
console.log(`跳过订单状态检查: ${orderId}, 当前不在归还页面`)
|
console.log(`跳过订单状态检查: ${orderId}, 当前不在归还页面`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`检查订单状态失败: ${orderId}`, error)
|
console.error(`检查订单状态失败: ${orderId}`, error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查单个订单的状态
|
* 检查单个订单的状态
|
||||||
* @param {String} orderId 订单ID
|
* @param {String} orderId 订单ID
|
||||||
*/
|
*/
|
||||||
async checkOrderStatus(orderId) {
|
async checkOrderStatus(orderId) {
|
||||||
try {
|
try {
|
||||||
console.log(`检查订单 ${orderId} 的状态`)
|
console.log(`检查订单 ${orderId} 的状态`)
|
||||||
const result = await queryById(orderId)
|
const result = await queryById(orderId)
|
||||||
|
|
||||||
if (result.code === 200 && result.data) {
|
if (result.code === 200 && result.data) {
|
||||||
const orderData = result.data
|
const orderData = result.data
|
||||||
const existingData = this.activeOrders.get(orderId)
|
const existingData = this.activeOrders.get(orderId)
|
||||||
const pageName = existingData ? existingData.pageName : null
|
const pageName = existingData ? existingData.pageName : null
|
||||||
|
|
||||||
// 更新本地存储的订单数据,保留页面关联信息
|
// 更新本地存储的订单数据,保留页面关联信息
|
||||||
this.activeOrders.set(orderId, {
|
this.activeOrders.set(orderId, {
|
||||||
...orderData,
|
...orderData,
|
||||||
pageName
|
pageName
|
||||||
})
|
})
|
||||||
|
|
||||||
// 检查订单是否已完成
|
// 检查订单是否已完成
|
||||||
if (orderData.orderStatus === 'used_done' || orderData.orderStatus === 'used_down') {
|
if (orderData.orderStatus === 'used_done' || orderData.orderStatus === 'used_down') {
|
||||||
console.log(`订单 ${orderId} 已完成!`)
|
console.log(`订单 ${orderId} 已完成!`)
|
||||||
|
|
||||||
// 触发全局事件
|
// 触发全局事件
|
||||||
uni.$emit('orderCompleted', orderData)
|
uni.$emit('orderCompleted', orderData)
|
||||||
|
|
||||||
// 显示全局通知
|
// 显示全局通知
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '充电宝归还成功',
|
title: '充电宝归还成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
})
|
})
|
||||||
|
|
||||||
// 播放通知声音(如果需要)
|
// 播放通知声音(如果需要)
|
||||||
const innerAudioContext = uni.createInnerAudioContext()
|
const innerAudioContext = uni.createInnerAudioContext()
|
||||||
innerAudioContext.src = '/static/audio/return_success.mp3'
|
innerAudioContext.src = '/static/audio/return_success.mp3'
|
||||||
innerAudioContext.play()
|
innerAudioContext.play()
|
||||||
|
|
||||||
// 完成的订单不再需要监控
|
// 完成的订单不再需要监控
|
||||||
this.removeOrder({orderId})
|
this.removeOrder({orderId})
|
||||||
|
|
||||||
// 如果用户不在归还页面,则显示归还成功弹窗
|
// 如果用户不在归还页面,则显示归还成功弹窗
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '归还成功',
|
title: '归还成功',
|
||||||
content: '充电宝已归还成功,剩余押金将退还到您的账户',
|
content: '充电宝已归还成功,剩余押金将退还到您的账户',
|
||||||
confirmText: '查看详情',
|
confirmText: '查看详情',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
// 跳转到归还成功页面查看详情
|
// 跳转到归还成功页面查看详情
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pages/order/return-success?orderId=${orderId}`
|
url: `/pages/order/return-success?orderId=${orderId}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, 500)
|
}, 500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`检查订单 ${orderId} 状态出错:`, error)
|
console.error(`检查订单 ${orderId} 状态出错:`, error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出单例实例
|
// 导出单例实例
|
||||||
export const orderMonitor = new OrderMonitor()
|
export const orderMonitor = new OrderMonitor()
|
||||||
|
|
||||||
// 监听页面切换事件
|
// 监听页面切换事件
|
||||||
uni.onAppRoute((route) => {
|
uni.onAppRoute((route) => {
|
||||||
const pagePath = route.path || ''
|
const pagePath = route.path || ''
|
||||||
const pageSegments = pagePath.split('/')
|
const pageSegments = pagePath.split('/')
|
||||||
const pageName = pageSegments[pageSegments.length - 1]
|
const pageName = pageSegments[pageSegments.length - 1]
|
||||||
|
|
||||||
// 设置当前活跃页面
|
// 设置当前活跃页面
|
||||||
orderMonitor.setActivePage(pageName || null)
|
orderMonitor.setActivePage(pageName || null)
|
||||||
|
|
||||||
console.log('页面切换:', pagePath, '当前活跃页面:', pageName)
|
console.log('页面切换:', pagePath, '当前活跃页面:', pageName)
|
||||||
})
|
})
|
||||||
|
|
||||||
// 页面加载时自动恢复监控上次的活跃订单(如果有)
|
// 页面加载时自动恢复监控上次的活跃订单(如果有)
|
||||||
const initOrderMonitor = () => {
|
const initOrderMonitor = () => {
|
||||||
const lastActiveOrderId = uni.getStorageSync('activeOrderId')
|
const lastActiveOrderId = uni.getStorageSync('activeOrderId')
|
||||||
if (lastActiveOrderId) {
|
if (lastActiveOrderId) {
|
||||||
const lastOrderData = { orderId: lastActiveOrderId }
|
const lastOrderData = { orderId: lastActiveOrderId }
|
||||||
orderMonitor.addOrder(lastOrderData, 'return')
|
orderMonitor.addOrder(lastOrderData, 'return')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
initOrderMonitor()
|
initOrderMonitor()
|
||||||
Reference in New Issue
Block a user