@@ -0,0 +1,300 @@
|
|||||||
|
# Uni-Fans API 接口文档
|
||||||
|
|
||||||
|
本文档详细说明了 Uni-Fans 应用中使用的所有接口,包括参数说明和使用示例。
|
||||||
|
|
||||||
|
## 目录
|
||||||
|
|
||||||
|
1. [订单查询接口](#1-订单查询接口)
|
||||||
|
2. [设备信息查询接口](#2-设备信息查询接口)
|
||||||
|
3. [订单套餐更新接口](#3-订单套餐更新接口)
|
||||||
|
4. [用户余额更新接口](#4-用户余额更新接口)
|
||||||
|
5. [微信支付订单创建接口](#5-微信支付订单创建接口)
|
||||||
|
6. [设备租借指令接口](#6-设备租借指令接口)
|
||||||
|
|
||||||
|
## 1. 订单查询接口
|
||||||
|
|
||||||
|
### 描述
|
||||||
|
根据订单ID查询订单详细信息。
|
||||||
|
|
||||||
|
### 接口信息
|
||||||
|
- **方法名**: `queryById`
|
||||||
|
- **请求方式**: GET
|
||||||
|
- **URL**: `/app/order/query/{orderId}`
|
||||||
|
|
||||||
|
### 请求参数
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必须 | 描述 |
|
||||||
|
| ----- | ---- | ---- | ---- |
|
||||||
|
| orderId | String | 是 | 订单ID |
|
||||||
|
|
||||||
|
### 响应参数
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"code": 200,
|
||||||
|
"msg": "操作成功",
|
||||||
|
"data": {
|
||||||
|
"orderId": "订单ID",
|
||||||
|
"orderNo": "订单编号",
|
||||||
|
"deviceNo": "设备编号",
|
||||||
|
"createTime": "创建时间",
|
||||||
|
"phone": "联系电话",
|
||||||
|
"depositAmount": "押金金额",
|
||||||
|
"packageTime": "套餐时间(分钟)",
|
||||||
|
"packagePrice": "套餐价格"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 使用示例
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const orderInfo = await queryById('12345');
|
||||||
|
if (orderInfo.code === 200) {
|
||||||
|
// 处理订单信息
|
||||||
|
console.log(orderInfo.data);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2. 设备信息查询接口
|
||||||
|
|
||||||
|
### 描述
|
||||||
|
根据设备编号查询设备详细信息。
|
||||||
|
|
||||||
|
### 接口信息
|
||||||
|
- **方法名**: `getDeviceInfo`
|
||||||
|
- **请求方式**: GET
|
||||||
|
- **URL**: `/app/device/info/{deviceNo}`
|
||||||
|
|
||||||
|
### 请求参数
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必须 | 描述 |
|
||||||
|
| ----- | ---- | ---- | ---- |
|
||||||
|
| deviceNo | String | 是 | 设备编号 |
|
||||||
|
|
||||||
|
### 响应参数
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"code": 200,
|
||||||
|
"msg": "操作成功",
|
||||||
|
"data": {
|
||||||
|
"device": {
|
||||||
|
"deviceNo": "设备编号",
|
||||||
|
"deviceName": "设备名称",
|
||||||
|
"deviceStatus": "设备状态",
|
||||||
|
"depositAmount": "押金金额",
|
||||||
|
"feeType": "收费类型(hour/times)",
|
||||||
|
"feeConfig": "费用配置JSON字符串"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 使用示例
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const deviceInfo = await getDeviceInfo('D001');
|
||||||
|
if (deviceInfo.code === 200) {
|
||||||
|
// 处理设备信息
|
||||||
|
console.log(deviceInfo.data.device);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 3. 订单套餐更新接口
|
||||||
|
|
||||||
|
### 描述
|
||||||
|
更新订单的套餐信息。
|
||||||
|
|
||||||
|
### 接口信息
|
||||||
|
- **方法名**: `updateOrderPackage`
|
||||||
|
- **请求方式**: POST
|
||||||
|
- **URL**: `/app/order/update-package`
|
||||||
|
|
||||||
|
### 请求参数
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必须 | 描述 |
|
||||||
|
| ----- | ---- | ---- | ---- |
|
||||||
|
| orderId | String | 是 | 订单ID |
|
||||||
|
| packageTime | Number | 是 | 套餐时间(分钟) |
|
||||||
|
| packagePrice | Number | 是 | 套餐价格 |
|
||||||
|
|
||||||
|
### 响应参数
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"code": 200,
|
||||||
|
"msg": "操作成功",
|
||||||
|
"data": null
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 使用示例
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const result = await updateOrderPackage({
|
||||||
|
orderId: '12345',
|
||||||
|
packageTime: 360, // 6小时(分钟)
|
||||||
|
packagePrice: 30 // 30元
|
||||||
|
});
|
||||||
|
if (result.code === 200) {
|
||||||
|
console.log('套餐更新成功');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 4. 用户余额更新接口
|
||||||
|
|
||||||
|
### 描述
|
||||||
|
支付成功后更新用户余额信息。
|
||||||
|
|
||||||
|
### 接口信息
|
||||||
|
- **方法名**: `updateUserBalance`
|
||||||
|
- **请求方式**: POST
|
||||||
|
- **URL**: `/app/user/update-balance`
|
||||||
|
|
||||||
|
### 请求参数
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必须 | 描述 |
|
||||||
|
| ----- | ---- | ---- | ---- |
|
||||||
|
| orderId | String | 是 | 订单ID |
|
||||||
|
|
||||||
|
### 响应参数
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"code": 200,
|
||||||
|
"msg": "操作成功",
|
||||||
|
"data": {
|
||||||
|
"userId": "用户ID",
|
||||||
|
"balance": "更新后余额"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 使用示例
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const result = await updateUserBalance('12345');
|
||||||
|
if (result.code === 200) {
|
||||||
|
console.log('用户余额更新成功');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 5. 微信支付订单创建接口
|
||||||
|
|
||||||
|
### 描述
|
||||||
|
创建微信支付订单。
|
||||||
|
|
||||||
|
### 接口信息
|
||||||
|
- **请求方式**: GET
|
||||||
|
- **URL**: `/app/wx-payment/create/{orderNo}`
|
||||||
|
|
||||||
|
### 请求参数
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必须 | 描述 |
|
||||||
|
| ----- | ---- | ---- | ---- |
|
||||||
|
| orderNo | String | 是 | 订单编号 |
|
||||||
|
|
||||||
|
### 请求头
|
||||||
|
|
||||||
|
| 参数名 | 必须 | 描述 |
|
||||||
|
| ----- | ---- | ---- |
|
||||||
|
| Authorization | 是 | Bearer 认证令牌 |
|
||||||
|
| Clientid | 是 | 客户端ID |
|
||||||
|
|
||||||
|
### 响应参数
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"code": 200,
|
||||||
|
"msg": "操作成功",
|
||||||
|
"data": {
|
||||||
|
"appId": "微信应用ID",
|
||||||
|
"timeStamp": "时间戳",
|
||||||
|
"nonceStr": "随机字符串",
|
||||||
|
"package": "预支付交易会话标识",
|
||||||
|
"signType": "签名类型",
|
||||||
|
"paySign": "签名"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 使用示例
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const res = await uni.request({
|
||||||
|
url: `${URL}/app/wx-payment/create/${orderNo}`,
|
||||||
|
method: 'GET',
|
||||||
|
header: {
|
||||||
|
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
||||||
|
'Clientid': uni.getStorageSync('client_id')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.statusCode === 200 && res.data.code === 200) {
|
||||||
|
const payParams = res.data.data;
|
||||||
|
await uni.requestPayment({
|
||||||
|
...payParams,
|
||||||
|
success: () => {
|
||||||
|
console.log('支付成功');
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('支付失败:', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 6. 设备租借指令接口
|
||||||
|
|
||||||
|
### 描述
|
||||||
|
发送设备租借指令。
|
||||||
|
|
||||||
|
### 接口信息
|
||||||
|
- **请求方式**: POST
|
||||||
|
- **URL**: `/app/device/sendRentCommand`
|
||||||
|
|
||||||
|
### 请求参数
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必须 | 描述 |
|
||||||
|
| ----- | ---- | ---- | ---- |
|
||||||
|
| orderId | String | 是 | 订单ID |
|
||||||
|
|
||||||
|
### 请求头
|
||||||
|
|
||||||
|
| 参数名 | 必须 | 描述 |
|
||||||
|
| ----- | ---- | ---- |
|
||||||
|
| Content-Type | 是 | application/x-www-form-urlencoded |
|
||||||
|
| Authorization | 是 | Bearer 认证令牌 |
|
||||||
|
| Clientid | 是 | 客户端ID |
|
||||||
|
|
||||||
|
### 响应参数
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"code": 200,
|
||||||
|
"msg": "操作成功",
|
||||||
|
"data": null
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 使用示例
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const res = await uni.request({
|
||||||
|
url: `${URL}/app/device/sendRentCommand`,
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
orderId: '12345'
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
||||||
|
'Clientid': uni.getStorageSync('client_id')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.statusCode === 200 && res.data.code === 200) {
|
||||||
|
console.log('租借指令发送成功');
|
||||||
|
}
|
||||||
|
```
|
||||||
@@ -8,6 +8,14 @@ const request = (option) => {
|
|||||||
// Debug request info
|
// Debug request info
|
||||||
console.log(`发起请求: ${option.method} ${URL + option.url}`, option.data)
|
console.log(`发起请求: ${option.method} ${URL + option.url}`, option.data)
|
||||||
|
|
||||||
|
// 默认不显示加载中提示
|
||||||
|
if (!option.hideLoading) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: option.loadingText || '加载中...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
uni.request({
|
uni.request({
|
||||||
url: URL + option.url,
|
url: URL + option.url,
|
||||||
method: option.method,
|
method: option.method,
|
||||||
@@ -41,6 +49,19 @@ const request = (option) => {
|
|||||||
if (res.data && res.data.code !== 200) {
|
if (res.data && res.data.code !== 200) {
|
||||||
console.warn(`业务状态码错误: ${res.data.code}`, res.data)
|
console.warn(`业务状态码错误: ${res.data.code}`, res.data)
|
||||||
|
|
||||||
|
// 判断是否需要忽略数据为空的错误
|
||||||
|
if (option.ignoreEmptyError &&
|
||||||
|
(res.data.code === 500 && res.data.msg &&
|
||||||
|
(res.data.msg.includes('未找到') || res.data.msg.includes('不存在')))) {
|
||||||
|
// 对于指定需要忽略的错误,返回一个标准的"成功但数据为空"的响应
|
||||||
|
resolve({
|
||||||
|
code: 200,
|
||||||
|
msg: "操作成功",
|
||||||
|
data: []
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 仍然返回数据,由业务逻辑处理
|
// 仍然返回数据,由业务逻辑处理
|
||||||
resolve(res.data)
|
resolve(res.data)
|
||||||
return
|
return
|
||||||
@@ -52,6 +73,12 @@ const request = (option) => {
|
|||||||
// 网络请求本身失败
|
// 网络请求本身失败
|
||||||
console.error(`请求失败: ${option.url}`, err)
|
console.error(`请求失败: ${option.url}`, err)
|
||||||
reject(err)
|
reject(err)
|
||||||
|
},
|
||||||
|
complete() {
|
||||||
|
// 隐藏加载提示
|
||||||
|
if (!option.hideLoading) {
|
||||||
|
uni.hideLoading()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// export const URL = "https://notify.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 = "wx3ae63fb09936b379"
|
export const appid = "wxe752f45e7f7aa271"
|
||||||
@@ -18,6 +18,16 @@ export const getMyIndexInfo = (data) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加押金提现API
|
||||||
|
export const withdrawDeposit = (orderNo) => {
|
||||||
|
console.log('调用提现API,订单号:', orderNo)
|
||||||
|
return request({
|
||||||
|
url: `/app/withdraw/add/${orderNo}`,
|
||||||
|
method: 'get',
|
||||||
|
hideLoading: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
//获取所有全部订单
|
//获取所有全部订单
|
||||||
export const getOrderList = (data) => {
|
export const getOrderList = (data) => {
|
||||||
return request({
|
return request({
|
||||||
@@ -36,6 +46,18 @@ export const queryHasOrder = (deviceNo) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询指定设备号下,特定状态的订单列表
|
||||||
|
export const checkOrdersByStatus = (deviceNo, statuses) => {
|
||||||
|
// statuses 是一个包含状态字符串的数组,例如 ['in_used', 'waiting_for_payment']
|
||||||
|
const statusQuery = statuses.join(','); // 后端需要支持逗号分隔的状态查询
|
||||||
|
return request({
|
||||||
|
url: `/app/order/list?deviceNo=${deviceNo}&orderStatus=${statusQuery}`,
|
||||||
|
method: 'get',
|
||||||
|
hideLoading: true, // 隐藏加载提示,避免干扰用户
|
||||||
|
ignoreEmptyError: true // 添加标记,表示即使返回空数据也不视为错误
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
//设备查询
|
//设备查询
|
||||||
export const getDeviceInfo = (deviceNo) => {
|
export const getDeviceInfo = (deviceNo) => {
|
||||||
return request({
|
return request({
|
||||||
@@ -56,9 +78,11 @@ export const createOrder = (data) => {
|
|||||||
|
|
||||||
//查询订单
|
//查询订单
|
||||||
export const queryById = (id) => {
|
export const queryById = (id) => {
|
||||||
|
console.log(`查询订单详情, orderId: ${id}`)
|
||||||
return request({
|
return request({
|
||||||
url: `/app/order/${id}`,
|
url: `/app/order/${id}`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
hideLoading: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,6 +115,16 @@ export const rentPowerBank = (deviceNo, phone) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//确认支付并弹出充电宝
|
||||||
|
export const confirmPaymentAndRent = (orderId) => {
|
||||||
|
console.log(`确认支付并弹出充电宝, orderId: ${orderId}`)
|
||||||
|
return request({
|
||||||
|
url: `/app/device/confirmPaymentAndRent?orderId=${orderId}`,
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//投诉反馈
|
//投诉反馈
|
||||||
export const addUserFeedback = (data) => {
|
export const addUserFeedback = (data) => {
|
||||||
@@ -100,3 +134,41 @@ export const addUserFeedback = (data) => {
|
|||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//强制打开空格子
|
||||||
|
export const forcefOpenEmptyGrid = (deviceNo) => {
|
||||||
|
console.log(`强制打开空格子, deviceNo: ${deviceNo}`)
|
||||||
|
return request({
|
||||||
|
url: `/app/device/forcef/${deviceNo}`,
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通过订单号获取订单信息
|
||||||
|
export const getOrderByOrderNo = (orderNo) => {
|
||||||
|
console.log('通过订单号获取订单信息:', orderNo)
|
||||||
|
return request({
|
||||||
|
url: `/app/order/byOrderNo/${orderNo}`,
|
||||||
|
method: 'get',
|
||||||
|
hideLoading: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新订单套餐信息
|
||||||
|
export const updateOrderPackage = (data) => {
|
||||||
|
console.log('更新订单套餐信息:', data)
|
||||||
|
return request({
|
||||||
|
url: '/app/device/updateOrderPackage',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新用户余额
|
||||||
|
export const updateUserBalance = (orderId) => {
|
||||||
|
return request({
|
||||||
|
url: `/app/user/updateBalance/${orderId}`,
|
||||||
|
method: 'post',
|
||||||
|
hideLoading: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import App from './App'
|
import App from './App'
|
||||||
|
import { orderMonitor } from './utils/orderMonitor.js'
|
||||||
|
|
||||||
import uView from "uview-ui";
|
import uView from "uview-ui";
|
||||||
|
|
||||||
@@ -7,6 +8,10 @@ import uView from "uview-ui";
|
|||||||
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
|
||||||
|
|
||||||
App.mpType = 'app'
|
App.mpType = 'app'
|
||||||
Vue.use(uView)
|
Vue.use(uView)
|
||||||
const app = new Vue({
|
const app = new Vue({
|
||||||
@@ -20,6 +25,9 @@ import { createSSRApp } from 'vue'
|
|||||||
export function createApp() {
|
export function createApp() {
|
||||||
const app = createSSRApp(App)
|
const app = createSSRApp(App)
|
||||||
|
|
||||||
|
// 注册全局订单监控服务到VUE3
|
||||||
|
app.config.globalProperties.$orderMonitor = orderMonitor
|
||||||
|
|
||||||
return {
|
return {
|
||||||
app
|
app
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "fs",
|
"name" : "fs",
|
||||||
"appid" : "__UNI__66470C9",
|
"appid" : "__UNI__4630191",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "1.0.0",
|
"versionName" : "1.0.0",
|
||||||
"versionCode" : "100",
|
"versionCode" : "100",
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
"quickapp" : {},
|
"quickapp" : {},
|
||||||
/* 小程序特有相关 */
|
/* 小程序特有相关 */
|
||||||
"mp-weixin" : {
|
"mp-weixin" : {
|
||||||
"appid" : "wx3ae63fb09936b379",
|
"appid" : "wxe752f45e7f7aa271",
|
||||||
"setting" : {
|
"setting" : {
|
||||||
"urlCheck" : false
|
"urlCheck" : false
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -76,6 +76,14 @@
|
|||||||
"navigationBarBackgroundColor": "#ffffff",
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
"navigationBarTextStyle": "black"
|
"navigationBarTextStyle": "black"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/order/return-success",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "归还成功",
|
||||||
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
|
"navigationBarTextStyle": "black"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<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">提现</button>
|
<button class="withdraw-btn" @click="handleWithdraw" :disabled="depositAmount <= 0">提现</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 提现说明 -->
|
<!-- 提现说明 -->
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 押金记录 -->
|
<!-- 押金记录 -->
|
||||||
<view class="record-card">
|
<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">
|
||||||
@@ -39,30 +39,155 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getUserInfo } from '../../util/index.js'
|
||||||
|
import { withdrawDeposit,queryById } from '../../config/user.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
depositAmount: '99.00',
|
depositAmount: '0.00',
|
||||||
records: [
|
orderNo: '',
|
||||||
{ type: '支付', time: '2024-03-20 15:30', amount: '99.00' },
|
records: [],
|
||||||
{ type: '退还', time: '2024-03-19 12:00', amount: '99.00' },
|
orderId:''
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onLoad() {
|
||||||
|
// this.loadUserInfo()
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.loadUserInfo()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleWithdraw() {
|
async loadUserInfo() {
|
||||||
|
try {
|
||||||
|
const res = await getUserInfo()
|
||||||
|
console.log('loadUserInfo',res);
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.depositAmount = res.data.balanceAmount || '0.00'
|
||||||
|
this.orderNo = res.data.latestOrderNo || ''
|
||||||
|
this.orderId = res.data.latestOrderId||''
|
||||||
|
|
||||||
|
// 如果存在余额,获取押金记录
|
||||||
|
if (parseFloat(this.depositAmount) > 0 && this.orderNo) {
|
||||||
|
this.records = [
|
||||||
|
{
|
||||||
|
type: '支付',
|
||||||
|
time: this.formatDate(new Date()),
|
||||||
|
amount: this.depositAmount
|
||||||
|
}
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
this.records = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取用户信息失败:', error)
|
||||||
|
uni.showToast({
|
||||||
|
title: '获取用户信息失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async handleWithdraw() {
|
||||||
|
if (parseFloat(this.depositAmount) <= 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '无可提现余额',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(this.orderId.length!=0||this.orderNo.length!=0){
|
||||||
|
const res = await queryById(Number(this.orderId))
|
||||||
|
console.log(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if(this.orderNo.length!=0){
|
||||||
|
// uni.showToast({
|
||||||
|
// title:'当前存在进行中的订单',
|
||||||
|
// icon:'none'
|
||||||
|
// })
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '确认提现',
|
title: '确认提现',
|
||||||
content: '押金将原路退回,预计0-7个工作日到账',
|
content: '押金将原路退回,预计0-7个工作日到账',
|
||||||
success: (res) => {
|
success: async (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '提现中...'
|
||||||
|
})
|
||||||
|
|
||||||
|
try {
|
||||||
|
console.log('发起提现请求,订单号:', this.orderNo)
|
||||||
|
const result = await withdrawDeposit(this.orderNo)
|
||||||
|
console.log('提现响应:', result)
|
||||||
|
|
||||||
|
if (result.code === 200) {
|
||||||
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '提现申请已提交',
|
title: '提现申请已提交',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 更新余额为0
|
||||||
|
this.depositAmount = '0.00'
|
||||||
|
this.records.push({
|
||||||
|
type: '退还',
|
||||||
|
time: this.formatDate(new Date()),
|
||||||
|
amount: this.depositAmount
|
||||||
|
})
|
||||||
|
|
||||||
|
// 重新加载用户信息
|
||||||
|
setTimeout(() => {
|
||||||
|
this.loadUserInfo()
|
||||||
|
}, 1500)
|
||||||
|
} else {
|
||||||
|
throw new Error(result.msg || '提现失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('提现失败:', error)
|
||||||
|
uni.hideLoading()
|
||||||
|
|
||||||
|
// 更详细的错误处理
|
||||||
|
let errorMessage = '提现失败,请稍后再试';
|
||||||
|
|
||||||
|
// 如果有具体错误信息,使用它
|
||||||
|
if (error.message) {
|
||||||
|
// 常见错误消息处理
|
||||||
|
if (error.message.includes('尚未归还')) {
|
||||||
|
errorMessage = '当前订单尚未归还,请归还后再提现';
|
||||||
|
} else if (error.message.includes('已退还')) {
|
||||||
|
errorMessage = '押金已退还,无需重复提现';
|
||||||
|
} else if (error.message.includes('处理中')) {
|
||||||
|
errorMessage = '押金退还处理中,请耐心等待';
|
||||||
|
} else if (error.message.includes('余额为0')) {
|
||||||
|
errorMessage = '账户余额为0,无法提现';
|
||||||
|
} else {
|
||||||
|
// 使用后端返回的具体错误消息
|
||||||
|
errorMessage = error.message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 显示错误提示
|
||||||
|
uni.showModal({
|
||||||
|
title: '提现失败',
|
||||||
|
content: errorMessage,
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
formatDate(date) {
|
||||||
|
const year = date.getFullYear()
|
||||||
|
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
||||||
|
const day = date.getDate().toString().padStart(2, '0')
|
||||||
|
const hours = date.getHours().toString().padStart(2, '0')
|
||||||
|
const minutes = date.getMinutes().toString().padStart(2, '0')
|
||||||
|
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,6 +233,11 @@ export default {
|
|||||||
&:active {
|
&:active {
|
||||||
transform: scale(0.98);
|
transform: scale(0.98);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&[disabled] {
|
||||||
|
background: rgba(255,255,255,0.6);
|
||||||
|
color: rgba(25,118,210,0.5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@
|
|||||||
<view class="bottom-bar">
|
<view class="bottom-bar">
|
||||||
<view class="price-info" v-if="!hasActiveOrder">
|
<view class="price-info" v-if="!hasActiveOrder">
|
||||||
<text class="deposit-text">押金:</text>
|
<text class="deposit-text">押金:</text>
|
||||||
<text class="deposit-amount">¥99</text>
|
<text class="deposit-amount">¥{{ depositAmount }}</text>
|
||||||
</view>
|
</view>
|
||||||
<button class="action-btn" :class="hasActiveOrder ? 'return' : 'rent'" @click="handleRent">
|
<button class="action-btn" :class="hasActiveOrder ? 'return' : 'rent'" @click="handleRent">
|
||||||
{{ hasActiveOrder ? '归还设备' : '立即租借' }}
|
{{ hasActiveOrder ? '归还设备' : '立即租借' }}
|
||||||
@@ -85,7 +85,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
getDeviceInfo,
|
getDeviceInfo,
|
||||||
rentPowerBank
|
rentPowerBank,
|
||||||
|
updateOrderPackage
|
||||||
} from '@/config/user.js'
|
} from '@/config/user.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -100,22 +101,8 @@
|
|||||||
class: 'available'
|
class: 'available'
|
||||||
},
|
},
|
||||||
selectedPackage: 1,
|
selectedPackage: 1,
|
||||||
packages: [{
|
packages: [],
|
||||||
time: '1小时',
|
depositAmount: "99.00", // 默认押金金额
|
||||||
price: '2.00',
|
|
||||||
unitPrice: '2.00'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
time: '4小时',
|
|
||||||
price: '6.00',
|
|
||||||
unitPrice: '1.50'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
time: '12小时',
|
|
||||||
price: '15.00',
|
|
||||||
unitPrice: '1.25'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
isLoggedIn: true,
|
isLoggedIn: true,
|
||||||
phoneNumber: ''
|
phoneNumber: ''
|
||||||
}
|
}
|
||||||
@@ -123,15 +110,65 @@
|
|||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
// console.log(options);
|
// console.log(options);
|
||||||
this.deviceId = options.deviceNo
|
this.deviceId = options.deviceNo
|
||||||
|
|
||||||
|
// 如果URL中包含了feeConfig参数,直接使用它
|
||||||
|
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);
|
console.log(options.deviceNo);
|
||||||
this.getDeviceInfo()
|
this.getDeviceInfo()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 检查登录状态和订单
|
// 检查登录状态和订单
|
||||||
async getDeviceInfo() {
|
async getDeviceInfo() {
|
||||||
const res = await getDeviceInfo(this.deviceId);
|
const res = await getDeviceInfo(this.deviceId);
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.deviceInfo = res.data
|
this.deviceInfo = res.data.device || {};
|
||||||
|
|
||||||
|
// 更新设备位置信息
|
||||||
|
if (this.deviceInfo.deviceLocation) {
|
||||||
|
this.deviceLocation = this.deviceInfo.deviceLocation;
|
||||||
|
} else if (res.data.position && res.data.position.name) {
|
||||||
|
this.deviceLocation = res.data.position.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取押金金额
|
||||||
|
if (this.deviceInfo.depositAmount) {
|
||||||
|
this.depositAmount = this.deviceInfo.depositAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新设备状态
|
||||||
|
if (this.deviceInfo.status) {
|
||||||
|
if (this.deviceInfo.status === 'online') {
|
||||||
|
this.deviceStatus = {
|
||||||
|
text: '可使用',
|
||||||
|
class: 'available'
|
||||||
|
};
|
||||||
|
} else if (this.deviceInfo.status === 'offline') {
|
||||||
|
this.deviceStatus = {
|
||||||
|
text: '离线',
|
||||||
|
class: 'offline'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用抽取的方法解析feeConfig并生成套餐选项
|
||||||
|
this.parseFeeConfig();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -162,11 +199,23 @@
|
|||||||
const result = await this.$api.checkActiveOrder()
|
const result = await this.$api.checkActiveOrder()
|
||||||
|
|
||||||
if (result.hasOrder) {
|
if (result.hasOrder) {
|
||||||
|
const order = result.order; // 假设后端返回 order 对象
|
||||||
|
|
||||||
|
// 检查订单状态
|
||||||
|
if (order.status === 'waiting_for_payment') {
|
||||||
|
// 跳转支付页面,带上订单ID
|
||||||
|
uni.redirectTo({
|
||||||
|
url: `/pages/order/payment?orderId=${order.orderId}&deviceId=${this.deviceId}`
|
||||||
|
})
|
||||||
|
}else if(order.status === 'in_used'){
|
||||||
// 如果有正在进行的订单,跳转到归还页面,带上设备ID
|
// 如果有正在进行的订单,跳转到归还页面,带上设备ID
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pages/device/return?deviceId=${this.deviceId}`
|
url: `/pages/device/return?deviceId=${this.deviceId}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '订单状态查询失败',
|
title: '订单状态查询失败',
|
||||||
@@ -200,16 +249,8 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedPkg = this.packages[this.selectedPackage]
|
// 直接提交订单,不显示确认对话框
|
||||||
uni.showModal({
|
|
||||||
title: '确认租借',
|
|
||||||
content: `确认支付押金¥99.00及${selectedPkg.time}套餐费用¥${selectedPkg.price}?`,
|
|
||||||
success: (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
this.submitRentOrder()
|
this.submitRentOrder()
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 提交租借订单
|
// 提交租借订单
|
||||||
@@ -231,11 +272,45 @@
|
|||||||
// 获取后端返回的订单信息
|
// 获取后端返回的订单信息
|
||||||
const order = rentResult.data
|
const order = rentResult.data
|
||||||
|
|
||||||
|
// --- 新增:立即更新订单套餐信息 ---
|
||||||
|
try {
|
||||||
|
let packageTimeMinutes = 0;
|
||||||
|
if (selectedPkg.time.includes('小时')) {
|
||||||
|
packageTimeMinutes = parseInt(selectedPkg.time) * 60;
|
||||||
|
} else if (selectedPkg.time.includes('分钟')) {
|
||||||
|
packageTimeMinutes = parseInt(selectedPkg.time);
|
||||||
|
} else {
|
||||||
|
packageTimeMinutes = parseInt(selectedPkg.time) * 60; // 默认按小时处理
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateRes = await updateOrderPackage({
|
||||||
|
orderId: order.orderId,
|
||||||
|
packageTime: packageTimeMinutes,
|
||||||
|
packagePrice: parseFloat(selectedPkg.price)
|
||||||
|
});
|
||||||
|
if (updateRes.code !== 200) {
|
||||||
|
console.warn("更新订单套餐信息失败:", updateRes.msg);
|
||||||
|
// 这里可以选择是否提示用户或阻止流程,当前不阻止
|
||||||
|
} else {
|
||||||
|
console.log("订单套餐信息已提前更新");
|
||||||
|
}
|
||||||
|
} catch (updateError) {
|
||||||
|
console.error("更新订单套餐信息时出错:", updateError);
|
||||||
|
// 即使更新失败,也继续尝试跳转支付,让用户完成支付
|
||||||
|
}
|
||||||
|
// --- 更新结束 ---
|
||||||
|
|
||||||
|
// --- 新增:计算总金额 ---
|
||||||
|
const deposit = parseFloat(this.depositAmount);
|
||||||
|
const packagePrice = parseFloat(selectedPkg.price);
|
||||||
|
const totalAmount = (deposit + packagePrice).toFixed(2);
|
||||||
|
// --- 计算结束 ---
|
||||||
|
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
|
|
||||||
// 跳转到订单支付页面,传递订单ID和套餐信息
|
// 跳转到订单支付页面,传递订单ID、套餐信息和总金额
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pages/order/payment?orderId=${order.orderId}&packageTime=${selectedPkg.time}&packagePrice=${selectedPkg.price}`
|
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()
|
||||||
@@ -244,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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,11 +115,44 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: 提交反馈
|
// 构建反馈数据
|
||||||
|
const feedbackData = {
|
||||||
|
type: this.types[this.selectedType],
|
||||||
|
content: this.description,
|
||||||
|
phone: this.contact,
|
||||||
|
images: this.images
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用提交接口
|
||||||
|
uni.request({
|
||||||
|
url: '/app/feedback/add',
|
||||||
|
method: 'POST',
|
||||||
|
data: feedbackData,
|
||||||
|
success: (res) => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '提交成功',
|
title: '提交成功',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
})
|
||||||
|
// 清空表单
|
||||||
|
this.selectedType = -1
|
||||||
|
this.description = ''
|
||||||
|
this.contact = ''
|
||||||
|
this.images = []
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '提交失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '提交失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getQueryString }from '@/util/index.js'
|
import {getQueryString, wxLogin }from '@/util/index.js'
|
||||||
|
import {
|
||||||
|
URL
|
||||||
|
}from"@/config/url.js"
|
||||||
|
import { getDeviceInfo } from '@/config/user.js'
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
async handleScan() {
|
async handleScan() {
|
||||||
@@ -64,9 +68,22 @@
|
|||||||
console.log('扫码路径:', scanResult.path)
|
console.log('扫码路径:', scanResult.path)
|
||||||
console.log('解析到的设备号:', deviceNo)
|
console.log('解析到的设备号:', deviceNo)
|
||||||
|
|
||||||
|
if (!deviceNo) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '无效的设备二维码',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 直接在当前页面查询是否有使用中的订单,避免跳转到中间页面
|
||||||
|
if (!uni.getStorageSync('token')) {
|
||||||
|
await wxLogin()
|
||||||
|
}
|
||||||
|
|
||||||
// 检查是否有使用中的订单
|
// 检查是否有使用中的订单
|
||||||
const inUseRes = await uni.request({
|
const inUseRes = await uni.request({
|
||||||
url: `${uni.getStorageSync('baseUrl') || 'http://127.0.0.1:8080'}/app/order/inUse`,
|
url: `${URL || 'http://127.0.0.1:8080'}/app/order/inUse`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
header: {
|
header: {
|
||||||
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
||||||
@@ -76,7 +93,7 @@
|
|||||||
|
|
||||||
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
|
const inUseOrder = inUseRes.data.data
|
||||||
console.log('检测到使用中订单,准备跳转:', inUseOrder)
|
console.log('检测到使用中订单,准备跳转:', inUseOrder)
|
||||||
@@ -91,7 +108,7 @@
|
|||||||
|
|
||||||
// 检查是否有待支付订单
|
// 检查是否有待支付订单
|
||||||
const orderRes = await uni.request({
|
const orderRes = await uni.request({
|
||||||
url: `${uni.getStorageSync('baseUrl') || 'http://127.0.0.1:8080'}/app/order/unpaid`,
|
url: `${URL || 'http://127.0.0.1:8080'}/app/order/unpaid`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
header: {
|
header: {
|
||||||
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
||||||
@@ -101,7 +118,7 @@
|
|||||||
|
|
||||||
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
|
const unpaidOrder = orderRes.data.data
|
||||||
console.log('检测到待支付订单,准备跳转:', unpaidOrder)
|
console.log('检测到待支付订单,准备跳转:', unpaidOrder)
|
||||||
@@ -109,11 +126,66 @@
|
|||||||
url: `/pages/order/payment?orderId=${unpaidOrder.orderId}`
|
url: `/pages/order/payment?orderId=${unpaidOrder.orderId}`
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// 无待支付订单,正常跳转到设备检查页面
|
// 修改:直接获取设备信息,而不是跳转到详情页面
|
||||||
console.log('无待支付订单,跳转到设备检查页面, deviceNo:', deviceNo)
|
console.log('无待支付订单,获取设备信息, deviceNo:', deviceNo)
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 获取设备信息
|
||||||
|
const deviceInfoRes = await getDeviceInfo(deviceNo)
|
||||||
|
|
||||||
|
if (deviceInfoRes.code == 200 && deviceInfoRes.data && deviceInfoRes.data.device) {
|
||||||
|
const deviceInfo = deviceInfoRes.data.device
|
||||||
|
|
||||||
|
// 如果有feeConfig,直接解析并处理
|
||||||
|
if (deviceInfo.feeConfig) {
|
||||||
|
console.log('获取到设备feeConfig信息:', deviceInfo.feeConfig)
|
||||||
|
|
||||||
|
// 这里可以直接解析feeConfig并进行前端处理
|
||||||
|
try {
|
||||||
|
const feeConfig = JSON.parse(deviceInfo.feeConfig)
|
||||||
|
|
||||||
|
// 根据解析后的feeConfig进行页面跳转并传递信息
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/serve/bagCheck/index?deviceNo=${deviceNo}`
|
url: `/pages/device/detail?deviceNo=${deviceNo}&feeConfig=${encodeURIComponent(deviceInfo.feeConfig)}`
|
||||||
})
|
})
|
||||||
|
} catch (e) {
|
||||||
|
console.error('解析feeConfig失败:', e)
|
||||||
|
|
||||||
|
// 解析失败时仍然跳转到详情页面,由详情页面处理
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 没有feeConfig时,跳转到详情页面
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.error('获取设备信息失败:', deviceInfoRes.msg || '未知错误')
|
||||||
|
uni.showToast({
|
||||||
|
title: '获取设备信息失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
|
||||||
|
// 失败时仍然跳转到详情页面
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取设备信息异常:', error)
|
||||||
|
uni.showToast({
|
||||||
|
title: '获取设备信息失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
|
||||||
|
// 异常时仍然跳转到详情页面
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('扫码处理失败:', error)
|
console.error('扫码处理失败:', error)
|
||||||
|
|||||||
@@ -73,14 +73,22 @@ export default {
|
|||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
// 将获取到的订单添加到列表中
|
// 将获取到的订单添加到列表中
|
||||||
const orderData = res.data;
|
const orderData = res.data;
|
||||||
|
console.log('特定订单数据:', JSON.stringify(orderData));
|
||||||
|
console.log('特定订单的开始时间:', orderData.startTime);
|
||||||
|
console.log('特定订单的创建时间:', orderData.createTime);
|
||||||
|
|
||||||
|
// 使用实际的startTime字段,如果没有则尝试使用createTime
|
||||||
|
const orderStartTime = orderData.startTime || orderData.createTime || '';
|
||||||
|
console.log('特定订单最终显示的开始时间:', orderStartTime);
|
||||||
|
|
||||||
// 格式化订单数据
|
// 格式化订单数据
|
||||||
const formattedOrder = {
|
const formattedOrder = {
|
||||||
orderNo: orderData.orderId,
|
orderNo: orderData.orderId,
|
||||||
status: orderData.orderStatus,
|
status: orderData.orderStatus,
|
||||||
deviceId: orderData.deviceNo,
|
deviceId: orderData.deviceNo,
|
||||||
startTime: orderData.createTime,
|
startTime: orderStartTime,
|
||||||
endTime: orderData.endTime || '',
|
endTime: orderData.endTime || '',
|
||||||
amount: orderData.amount || '0.00'
|
amount: orderData.payAmount || orderData.actualDeviceAmount || '0.00'
|
||||||
};
|
};
|
||||||
|
|
||||||
// 将订单添加到列表开头
|
// 将订单添加到列表开头
|
||||||
@@ -107,15 +115,26 @@ export default {
|
|||||||
try {
|
try {
|
||||||
const res = await getOrderList(statusList);
|
const res = await getOrderList(statusList);
|
||||||
if (res.code === 200 && res.data && res.data.records) {
|
if (res.code === 200 && res.data && res.data.records) {
|
||||||
|
console.log('API返回的订单列表数据:', JSON.stringify(res.data.records));
|
||||||
|
|
||||||
// 处理订单列表数据
|
// 处理订单列表数据
|
||||||
this.orderList = res.data.records.map(item => ({
|
this.orderList = res.data.records.map(item => {
|
||||||
|
console.log(`订单 ${item.orderId} 的开始时间:`, item.startTime);
|
||||||
|
console.log(`订单 ${item.orderId} 的创建时间:`, item.createTime);
|
||||||
|
|
||||||
|
// 使用实际的startTime字段,如果没有则尝试使用createTime
|
||||||
|
const orderStartTime = item.startTime || item.createTime || '';
|
||||||
|
console.log(`订单 ${item.orderId} 最终显示的开始时间:`, orderStartTime);
|
||||||
|
|
||||||
|
return {
|
||||||
orderNo: item.orderId,
|
orderNo: item.orderId,
|
||||||
status: item.orderStatus,
|
status: item.orderStatus,
|
||||||
deviceId: item.deviceNo,
|
deviceId: item.deviceNo,
|
||||||
startTime: item.createTime,
|
startTime: orderStartTime,
|
||||||
endTime: item.endTime || '',
|
endTime: item.endTime || '',
|
||||||
amount: item.amount || '0.00'
|
amount: item.payAmount || item.actualDeviceAmount || '0.00'
|
||||||
}));
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取订单列表失败:', error);
|
console.error('获取订单列表失败:', error);
|
||||||
|
|||||||
@@ -31,17 +31,13 @@
|
|||||||
<!-- 费用信息 -->
|
<!-- 费用信息 -->
|
||||||
<view class="price-card">
|
<view class="price-card">
|
||||||
<view class="card-title">费用信息</view>
|
<view class="card-title">费用信息</view>
|
||||||
<view class="price-item">
|
<view class="pric 为了回馈他家新近三月公共努力公司决定五一假期22月1号减少,你喜欢这种什么嘿Siri换一个换一个App吃幼儿园那他那e-item">
|
||||||
<text class="label">押金</text>
|
<text class="label">押金</text>
|
||||||
<text class="value">¥{{ orderInfo.deposit || '99.00' }}</text>
|
<text class="value">¥{{ orderInfo.deposit || '99.00' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="price-item">
|
<view class="price-item">
|
||||||
<text class="label">套餐</text>
|
<text class="label">套餐</text>
|
||||||
<text class="value">{{ packageInfo.time }} (¥{{ packageInfo.price }})</text>
|
<text class="value">{{ packageInfo.price }}元/{{ packageInfo.time }}小时</text>
|
||||||
</view>
|
|
||||||
<view class="price-item">
|
|
||||||
<text class="label">租借费用</text>
|
|
||||||
<text class="value">¥{{ orderInfo.amount || packageInfo.price }}</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="price-item total">
|
<view class="price-item total">
|
||||||
<text class="label">合计</text>
|
<text class="label">合计</text>
|
||||||
@@ -49,21 +45,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 支付方式 -->
|
|
||||||
<view class="payment-methods">
|
|
||||||
<view class="card-title">支付方式</view>
|
|
||||||
<view
|
|
||||||
v-for="(method, index) in paymentMethods"
|
|
||||||
:key="index"
|
|
||||||
class="method-item"
|
|
||||||
:class="{ active: selectedMethod === index }"
|
|
||||||
@click="selectMethod(index)"
|
|
||||||
>
|
|
||||||
<view class="method-icon" :class="method.icon"></view>
|
|
||||||
<view class="method-name">{{ method.name }}</view>
|
|
||||||
<view class="method-check"></view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 底部操作栏 -->
|
<!-- 底部操作栏 -->
|
||||||
<view class="bottom-bar">
|
<view class="bottom-bar">
|
||||||
@@ -73,69 +56,88 @@
|
|||||||
</view>
|
</view>
|
||||||
<button class="pay-btn" @click="handlePayment">立即支付</button>
|
<button class="pay-btn" @click="handlePayment">立即支付</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="back-btn" @click="navigateBack">
|
|
||||||
<text>返回设备详情</text>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
|
|
||||||
|
|
||||||
navigateBack() {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: `/pages/device/detail?deviceId=${this.deviceId}`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { queryById } from '@/config/user.js'
|
import { queryById } from '@/config/user.js'
|
||||||
|
import { getDeviceInfo } from '@/config/user.js'
|
||||||
|
import { updateOrderPackage } from '@/config/user.js'
|
||||||
|
import { updateUserBalance } from '@/config/user.js'
|
||||||
|
import {
|
||||||
|
URL
|
||||||
|
}from"@/config/url.js"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
orderId: null,
|
orderId: null,
|
||||||
|
deviceNo: null,
|
||||||
orderInfo: {},
|
orderInfo: {},
|
||||||
packageInfo: {
|
packageInfo: {
|
||||||
time: '',
|
time: '',
|
||||||
price: '0.00'
|
price: '0.00'
|
||||||
},
|
},
|
||||||
|
deviceInfo: null,
|
||||||
|
passedTotalAmount: null,
|
||||||
|
passedDepositAmount: null,
|
||||||
orderStatus: {
|
orderStatus: {
|
||||||
text: '等待支付',
|
text: '等待支付',
|
||||||
desc: '请在15分钟内完成支付',
|
desc: '请在15分钟内完成支付',
|
||||||
class: 'waiting'
|
class: 'waiting'
|
||||||
},
|
|
||||||
paymentMethods: [
|
|
||||||
{
|
|
||||||
name: '微信支付',
|
|
||||||
icon: 'wechat'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '支付宝',
|
|
||||||
icon: 'alipay'
|
|
||||||
}
|
}
|
||||||
],
|
|
||||||
selectedMethod: 0
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
totalAmount() {
|
totalAmount() {
|
||||||
const deposit = parseFloat(this.orderInfo.deposit || 99)
|
if (this.passedTotalAmount !== null) {
|
||||||
const amount = parseFloat(this.orderInfo.amount || this.packageInfo.price || 0)
|
return parseFloat(this.passedTotalAmount).toFixed(2);
|
||||||
return (deposit + amount).toFixed(2)
|
}
|
||||||
|
const deposit = parseFloat(this.orderInfo.deposit || this.passedDepositAmount || 99)
|
||||||
|
const packagePrice = parseFloat(this.packageInfo.price || 0)
|
||||||
|
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) {
|
||||||
if (options && options.orderId) {
|
if (options && options.orderId) {
|
||||||
this.orderId = options.orderId
|
this.orderId = options.orderId
|
||||||
|
|
||||||
// 获取传递的套餐信息
|
if (options.totalAmount) {
|
||||||
if (options.packageTime && options.packagePrice) {
|
this.passedTotalAmount = options.totalAmount;
|
||||||
this.packageInfo = {
|
}
|
||||||
time: options.packageTime,
|
|
||||||
price: options.packagePrice
|
if (options.depositAmount) {
|
||||||
|
this.passedDepositAmount = options.depositAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果URL中包含了feeConfig参数,保存它
|
||||||
|
if (options.feeConfig) {
|
||||||
|
try {
|
||||||
|
console.log('从URL获取到feeConfig:', options.feeConfig)
|
||||||
|
const feeConfigStr = decodeURIComponent(options.feeConfig)
|
||||||
|
// 创建一个临时的deviceInfo对象保存feeConfig
|
||||||
|
this.deviceInfo = { feeConfig: feeConfigStr }
|
||||||
|
} catch (e) {
|
||||||
|
console.error('解析URL中的feeConfig失败:', e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,20 +165,43 @@ export default {
|
|||||||
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
|
||||||
|
|
||||||
|
// 处理创建时间,确保显示的是格式化后的时间
|
||||||
|
let formattedTime;
|
||||||
|
try {
|
||||||
|
// 如果orderData.createTime存在并且是有效的日期字符串/时间戳,则格式化它
|
||||||
|
if (orderData.createTime) {
|
||||||
|
formattedTime = this.formatTime(new Date(orderData.createTime));
|
||||||
|
} else {
|
||||||
|
// 如果createTime不存在,使用当前时间作为创建时间
|
||||||
|
formattedTime = this.formatTime(new Date());
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('时间格式化错误:', e);
|
||||||
|
formattedTime = this.formatTime(new Date());
|
||||||
|
}
|
||||||
|
|
||||||
this.orderInfo = {
|
this.orderInfo = {
|
||||||
orderNo: orderData.orderNo || orderData.orderId,
|
orderNo: orderData.orderNo || orderData.orderId,
|
||||||
deviceNo: orderData.deviceNo,
|
deviceNo: orderData.deviceNo,
|
||||||
createTime: orderData.createTime,
|
createTime: formattedTime,
|
||||||
phone: orderData.phone,
|
phone: orderData.phone,
|
||||||
deposit: '99.00', // 假设押金固定为99元
|
deposit: this.passedDepositAmount || orderData.depositAmount || '99.00',
|
||||||
amount: orderData.amount || this.packageInfo.price || '0.00'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果订单中没有套餐信息,但URL参数中有,则使用URL参数中的套餐信息
|
// 直接从订单数据中获取套餐信息
|
||||||
if (!orderData.packageTime && this.packageInfo.time) {
|
if (orderData.packageTime && orderData.packagePrice) {
|
||||||
this.orderInfo.packageTime = this.packageInfo.time
|
// 将分钟转换为小时
|
||||||
this.orderInfo.packagePrice = this.packageInfo.price
|
const timeInHours = (parseFloat(orderData.packageTime) / 60).toFixed(1);
|
||||||
|
this.packageInfo = {
|
||||||
|
time: timeInHours.toString(),
|
||||||
|
price: orderData.packagePrice.toString()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取设备信息(但不再用于设置套餐信息)
|
||||||
|
this.deviceNo = orderData.deviceNo;
|
||||||
|
await this.loadDeviceInfo();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('获取订单信息失败')
|
throw new Error('获取订单信息失败')
|
||||||
}
|
}
|
||||||
@@ -191,9 +216,23 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 选择支付方式
|
// 加载设备信息
|
||||||
selectMethod(index) {
|
async loadDeviceInfo() {
|
||||||
this.selectedMethod = index
|
if (!this.deviceNo) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await getDeviceInfo(this.deviceNo);
|
||||||
|
if (res.code === 200 && res.data) {
|
||||||
|
this.deviceInfo = res.data.device;
|
||||||
|
|
||||||
|
// 设置存款金额
|
||||||
|
if (this.deviceInfo && this.deviceInfo.depositAmount) {
|
||||||
|
this.orderInfo.deposit = this.deviceInfo.depositAmount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取设备信息失败:', error);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 处理支付
|
// 处理支付
|
||||||
@@ -205,7 +244,7 @@ export default {
|
|||||||
|
|
||||||
// 调用后端创建微信支付订单接口
|
// 调用后端创建微信支付订单接口
|
||||||
const res = await uni.request({
|
const res = await uni.request({
|
||||||
url: `${uni.getStorageSync('baseUrl') || 'http://127.0.0.1:8080'}/app/wx-payment/create/${this.orderInfo.orderNo}`,
|
url: `${URL || 'http://127.0.0.1:8080'}/app/wx-payment/create/${this.orderInfo.orderNo}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
header: {
|
header: {
|
||||||
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
||||||
@@ -214,13 +253,38 @@ export default {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (res.statusCode === 200 && res.data.code === 200) {
|
if (res.statusCode === 200 && res.data.code === 200) {
|
||||||
// 支付成功,跳转到支付成功页面
|
const payParams = res.data.data
|
||||||
uni.hideLoading()
|
|
||||||
|
// 调用微信支付
|
||||||
|
await uni.requestPayment({
|
||||||
|
...payParams,
|
||||||
|
success: async () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付成功',
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
|
||||||
|
// 更新用户余额
|
||||||
|
try {
|
||||||
|
await updateUserBalance(this.orderId);
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('更新用户余额失败:', error);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支付成功后直接跳转到订单页面,不再轮询
|
||||||
|
setTimeout(() => {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pages/order/success?orderId=${this.orderId}`
|
url: `/pages/order/index?orderId=${this.orderId}`
|
||||||
|
});
|
||||||
|
}, 1500);
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('支付失败:', err)
|
||||||
|
throw new Error('支付失败,请重试')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
throw new Error(res.data.msg || '支付失败')
|
throw new Error(res.data.msg || '创建支付订单失败')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
@@ -270,7 +334,7 @@ export default {
|
|||||||
sendRentRequest() {
|
sendRentRequest() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.request({
|
uni.request({
|
||||||
url: `${uni.getStorageSync('baseUrl') || 'http://127.0.0.1:8080'}/app/device/sendRentCommand`,
|
url: `${URL || 'http://127.0.0.1:8080'}/app/device/sendRentCommand`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {
|
data: {
|
||||||
orderId: this.orderId
|
orderId: this.orderId
|
||||||
@@ -305,16 +369,11 @@ export default {
|
|||||||
return `${year}-${month}-${day} ${hour}:${minute}`
|
return `${year}-${month}-${day} ${hour}:${minute}`
|
||||||
},
|
},
|
||||||
|
|
||||||
// 轮询订单状态
|
// 检查订单状态(单次查询,不轮询)
|
||||||
async pollOrderStatus() {
|
async checkOrderStatus() {
|
||||||
let retryCount = 0;
|
|
||||||
const maxRetries = 10;
|
|
||||||
const interval = 1000; // 1秒间隔
|
|
||||||
|
|
||||||
const checkStatus = async () => {
|
|
||||||
try {
|
try {
|
||||||
const res = await uni.request({
|
const res = await uni.request({
|
||||||
url: `${uni.getStorageSync('baseUrl') || 'http://127.0.0.1:8080'}/app/payment/status/${this.orderInfo.orderNo}`,
|
url: `${URL || 'http://127.0.0.1:8080'}/app/wx-payment/status/${this.orderInfo.orderNo}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
header: {
|
header: {
|
||||||
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
||||||
@@ -323,37 +382,14 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (res.statusCode === 200 && res.data.code === 200) {
|
if (res.statusCode === 200 && res.data.code === 200) {
|
||||||
const orderData = res.data.data;
|
return res.data.data;
|
||||||
if (orderData.orderStatus === 'IN_USED') {
|
|
||||||
// 支付成功,订单已开始使用
|
|
||||||
uni.showToast({
|
|
||||||
title: '支付成功',
|
|
||||||
icon: 'success'
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: `/pages/order/success?orderId=${this.orderId}`
|
|
||||||
});
|
|
||||||
}, 1500);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (retryCount < maxRetries) {
|
|
||||||
retryCount++;
|
|
||||||
setTimeout(checkStatus, interval);
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error('订单状态查询超时');
|
throw new Error('查询订单状态失败');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.showToast({
|
console.error('查询订单状态错误:', error);
|
||||||
title: error.message || '查询订单状态失败',
|
return null;
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
checkStatus();
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -478,43 +514,14 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.payment-methods {
|
.wechat-tip {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 24rpx;
|
border-radius: 24rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
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);
|
||||||
|
|
||||||
.method-item {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 30rpx 20rpx;
|
|
||||||
border-bottom: 1px solid #f5f5f5;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.active {
|
|
||||||
background: #F5F5F5;
|
|
||||||
|
|
||||||
.method-check {
|
|
||||||
background: #1976D2;
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
left: 50%;
|
|
||||||
top: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
width: 12rpx;
|
|
||||||
height: 12rpx;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.method-icon {
|
.method-icon {
|
||||||
width: 48rpx;
|
width: 48rpx;
|
||||||
@@ -524,25 +531,12 @@ export default {
|
|||||||
&.wechat {
|
&.wechat {
|
||||||
background: url('../../static/images/wechat.svg') no-repeat center/contain;
|
background: url('../../static/images/wechat.svg') no-repeat center/contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.alipay {
|
|
||||||
background: url('../../static/images/alipay.svg') no-repeat center/contain;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.method-name {
|
.method-text {
|
||||||
flex: 1;
|
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
font-weight: 500;
|
||||||
|
|
||||||
.method-check {
|
|
||||||
width: 32rpx;
|
|
||||||
height: 32rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
border: 2rpx solid #ddd;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,443 @@
|
|||||||
|
<template>
|
||||||
|
<view class="success-container">
|
||||||
|
<!-- 支付成功状态 -->
|
||||||
|
<view class="status-card">
|
||||||
|
<view class="status-icon success"></view>
|
||||||
|
<view class="status-text">归还成功</view>
|
||||||
|
<view class="status-desc">您的充电宝已归还,费用已从押金中扣除</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 订单信息 -->
|
||||||
|
<view class="order-card">
|
||||||
|
<view class="card-title">订单信息</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">订单号</text>
|
||||||
|
<text class="value">{{ orderInfo.orderNo || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">设备号</text>
|
||||||
|
<text class="value">{{ orderInfo.deviceNo || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">使用时长</text>
|
||||||
|
<text class="value">{{ orderInfo.usedTime || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">套餐时长</text>
|
||||||
|
<text class="value">{{ orderInfo.packageTime || '1小时' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">超出时长</text>
|
||||||
|
<text class="value">{{ orderInfo.extraTime || '0分钟' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">归还时间</text>
|
||||||
|
<text class="value">{{ orderInfo.endTime || '-' }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 费用信息 -->
|
||||||
|
<view class="refund-card">
|
||||||
|
<view class="card-title">费用信息</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">套餐费用</text>
|
||||||
|
<text class="value">¥{{ orderInfo.packagePrice || '0.00' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">超时费用</text>
|
||||||
|
<text class="value">¥{{ orderInfo.extraFee || '0.00' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">总费用</text>
|
||||||
|
<text class="value">¥{{ orderInfo.currentFee || '0.00' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">押金</text>
|
||||||
|
<text class="value">¥{{ orderInfo.deposit || '99.00' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">退还金额</text>
|
||||||
|
<text class="value highlight">¥{{ orderInfo.refundAmount || '99.00' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="label">退还状态</text>
|
||||||
|
<text class="value" :class="orderInfo.withdrawStatus || 'waiting'">{{ getWithdrawStatusText() }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 退款说明卡片 -->
|
||||||
|
<view class="notice-card">
|
||||||
|
<view class="card-title">退款说明</view>
|
||||||
|
<view class="notice-content">
|
||||||
|
<text>1. 押金剩余金额需要您手动申请提现</text>
|
||||||
|
<text>2. 提现申请提交后将在1-3个工作日内退还到原支付账户</text>
|
||||||
|
<text>3. 如有疑问,请联系客服</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 操作按钮 -->
|
||||||
|
<view class="button-group">
|
||||||
|
<button class="primary-btn" @click="handleWithdraw" v-if="!orderInfo.isWithdrawn && orderInfo.refundAmount > 0">申请退款</button>
|
||||||
|
<button class="primary-btn" @click="goToHome">返回首页</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { queryById } from '@/config/user.js'
|
||||||
|
import {
|
||||||
|
URL
|
||||||
|
}from"@/config/url.js"
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
orderId: '',
|
||||||
|
orderInfo: {
|
||||||
|
orderNo: '',
|
||||||
|
deviceNo: '',
|
||||||
|
usedTime: '',
|
||||||
|
currentFee: '0.00',
|
||||||
|
deposit: '99.00',
|
||||||
|
refundAmount: '99.00',
|
||||||
|
endTime: '',
|
||||||
|
withdrawStatus: 'waiting',
|
||||||
|
isWithdrawn: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(options) {
|
||||||
|
if (options && options.orderId) {
|
||||||
|
this.orderId = options.orderId;
|
||||||
|
this.loadOrderInfo();
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '订单ID不能为空',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
this.goToHome();
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 获取退款状态文本
|
||||||
|
getWithdrawStatusText() {
|
||||||
|
const statusMap = {
|
||||||
|
'waiting': '待申请',
|
||||||
|
'processing': '处理中',
|
||||||
|
'success': '已退款',
|
||||||
|
'failed': '退款失败'
|
||||||
|
};
|
||||||
|
return statusMap[this.orderInfo.withdrawStatus] || '待申请';
|
||||||
|
},
|
||||||
|
|
||||||
|
// 加载订单信息
|
||||||
|
async loadOrderInfo() {
|
||||||
|
try {
|
||||||
|
uni.showLoading({ title: '加载中' });
|
||||||
|
|
||||||
|
const result = await queryById(this.orderId);
|
||||||
|
if (result.code === 200 && result.data) {
|
||||||
|
const orderData = result.data;
|
||||||
|
|
||||||
|
// 从remark字段中解析使用信息
|
||||||
|
let packageMinutes = 60;
|
||||||
|
let extraMinutes = 0;
|
||||||
|
let usedMinutes = 0;
|
||||||
|
let packagePrice = '0.00';
|
||||||
|
let extraFee = '0.00';
|
||||||
|
|
||||||
|
if (orderData.remark) {
|
||||||
|
try {
|
||||||
|
// 解析remark字段
|
||||||
|
const remarkInfo = orderData.remark;
|
||||||
|
|
||||||
|
// 尝试提取使用时长
|
||||||
|
const usedTimeMatch = remarkInfo.match(/使用时长:(\d+)分钟/);
|
||||||
|
if (usedTimeMatch && usedTimeMatch[1]) {
|
||||||
|
usedMinutes = parseInt(usedTimeMatch[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 尝试提取套餐时长
|
||||||
|
const packageTimeMatch = remarkInfo.match(/套餐时长:(\d+)分钟/);
|
||||||
|
if (packageTimeMatch && packageTimeMatch[1]) {
|
||||||
|
packageMinutes = parseInt(packageTimeMatch[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 尝试提取超出时长
|
||||||
|
const extraTimeMatch = remarkInfo.match(/超出时长:(\d+)分钟/);
|
||||||
|
if (extraTimeMatch && extraTimeMatch[1]) {
|
||||||
|
extraMinutes = parseInt(extraTimeMatch[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 尝试提取套餐费用
|
||||||
|
const packagePriceMatch = remarkInfo.match(/套餐费用:([\d.]+)元/);
|
||||||
|
if (packagePriceMatch && packagePriceMatch[1]) {
|
||||||
|
packagePrice = packagePriceMatch[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 尝试提取超时费用
|
||||||
|
const extraFeeMatch = remarkInfo.match(/超时费用:([\d.]+)元/);
|
||||||
|
if (extraFeeMatch && extraFeeMatch[1]) {
|
||||||
|
extraFee = extraFeeMatch[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('从remark解析到的信息:', {
|
||||||
|
usedMinutes,
|
||||||
|
packageMinutes,
|
||||||
|
extraMinutes,
|
||||||
|
packagePrice,
|
||||||
|
extraFee
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.error('解析remark字段失败:', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.orderInfo = {
|
||||||
|
orderNo: orderData.orderNo || '',
|
||||||
|
deviceNo: orderData.deviceNo || '',
|
||||||
|
usedTime: usedMinutes + '分钟',
|
||||||
|
packageTime: packageMinutes + '分钟',
|
||||||
|
extraTime: extraMinutes + '分钟',
|
||||||
|
packagePrice: packagePrice,
|
||||||
|
extraFee: extraFee,
|
||||||
|
currentFee: orderData.actualDeviceAmount || '0.00',
|
||||||
|
deposit: orderData.depositAmount || '99.00',
|
||||||
|
refundAmount: orderData.residueAmount || '99.00',
|
||||||
|
endTime: orderData.endTime || '',
|
||||||
|
withdrawStatus: orderData.withdrawStatus || 'waiting',
|
||||||
|
isWithdrawn: orderData.withdrawStatus === 'success'
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
throw new Error(result.msg || '获取订单信息失败');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载订单信息错误:', error);
|
||||||
|
uni.showToast({
|
||||||
|
title: error.message || '获取订单信息失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 申请退款
|
||||||
|
async handleWithdraw() {
|
||||||
|
try {
|
||||||
|
uni.showLoading({ title: '处理中' });
|
||||||
|
|
||||||
|
const res = await uni.request({
|
||||||
|
url: `${URL || 'http://127.0.0.1:8080'}/app/withdraw/add/${this.orderInfo.orderNo}`,
|
||||||
|
method: 'GET',
|
||||||
|
header: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': 'Bearer ' + uni.getStorageSync('token'),
|
||||||
|
'Clientid': uni.getStorageSync('client_id')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (res.statusCode === 200 && res.data.code === 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '退款申请成功',
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
|
||||||
|
// 更新状态
|
||||||
|
this.orderInfo.withdrawStatus = 'processing';
|
||||||
|
this.orderInfo.isWithdrawn = true;
|
||||||
|
|
||||||
|
// 刷新订单信息
|
||||||
|
setTimeout(() => {
|
||||||
|
this.loadOrderInfo();
|
||||||
|
}, 1500);
|
||||||
|
} else {
|
||||||
|
throw new Error(res.data.msg || '退款申请失败');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('退款申请错误:', error);
|
||||||
|
uni.showToast({
|
||||||
|
title: error.message || '退款申请失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 返回首页
|
||||||
|
goToHome() {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.success-container {
|
||||||
|
padding: 20px;
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 30px;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.04);
|
||||||
|
|
||||||
|
.status-icon {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
margin: 0 auto 16px;
|
||||||
|
|
||||||
|
&.success {
|
||||||
|
background-color: #07c160;
|
||||||
|
border-radius: 50%;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
width: 30px;
|
||||||
|
height: 20px;
|
||||||
|
border: 3px solid #fff;
|
||||||
|
border-top: none;
|
||||||
|
border-right: none;
|
||||||
|
transform-origin: center;
|
||||||
|
transform: translate(-50%, -70%) rotate(-45deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-text {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #07c160;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-desc {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-card, .refund-card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.04);
|
||||||
|
|
||||||
|
.card-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
color: #333;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-item {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
color: #666;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
color: #333;
|
||||||
|
font-size: 14px;
|
||||||
|
|
||||||
|
&.highlight {
|
||||||
|
color: #ff6b00;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.success {
|
||||||
|
color: #07c160;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-group {
|
||||||
|
margin-top: 40rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 20rpx;
|
||||||
|
|
||||||
|
.primary-btn, .secondary-btn {
|
||||||
|
width: 50%;
|
||||||
|
height: 88rpx;
|
||||||
|
line-height: 88rpx;
|
||||||
|
border-radius: 44rpx;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-btn {
|
||||||
|
background: #07c160;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.secondary-btn {
|
||||||
|
background: #f0f0f0;
|
||||||
|
color: #333;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.04);
|
||||||
|
|
||||||
|
.card-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
color: #333;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content {
|
||||||
|
text-align: left;
|
||||||
|
color: #666;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.waiting {
|
||||||
|
color: #ffaa00;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -28,6 +28,14 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 设备状态 -->
|
||||||
|
<view class="device-status">
|
||||||
|
<view class="status-message">{{ deviceMessage }}</view>
|
||||||
|
<view class="loading-animation" v-if="isLoading">
|
||||||
|
<view class="loading-circle"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 操作按钮 -->
|
<!-- 操作按钮 -->
|
||||||
<view class="button-group">
|
<view class="button-group">
|
||||||
<button class="primary-btn" @click="goToHome">返回首页</button>
|
<button class="primary-btn" @click="goToHome">返回首页</button>
|
||||||
@@ -37,19 +45,28 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { queryById } from '@/config/user.js'
|
import { queryById, confirmPaymentAndRent } from '@/config/user.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
orderId: '',
|
orderId: '',
|
||||||
orderInfo: {}
|
orderInfo: {},
|
||||||
|
isLoading: true,
|
||||||
|
deviceMessage: '正在准备您的设备,请稍候...',
|
||||||
|
hasTriggeredDevice: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
if (options && options.orderId) {
|
if (options && options.orderId) {
|
||||||
this.orderId = options.orderId
|
this.orderId = options.orderId
|
||||||
this.loadOrderInfo()
|
this.loadOrderInfo()
|
||||||
|
|
||||||
|
// 添加页面显示监听,防止页面切换后重复触发弹出
|
||||||
|
uni.$once('orderSuccess:' + this.orderId, () => {
|
||||||
|
console.log('已经触发过弹出逻辑,不再重复触发')
|
||||||
|
this.hasTriggeredDevice = true
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '订单信息不存在',
|
title: '订单信息不存在',
|
||||||
@@ -73,8 +90,24 @@ export default {
|
|||||||
this.orderInfo = {
|
this.orderInfo = {
|
||||||
orderNo: orderData.orderNo || orderData.orderId,
|
orderNo: orderData.orderNo || orderData.orderId,
|
||||||
deviceNo: orderData.deviceNo,
|
deviceNo: orderData.deviceNo,
|
||||||
amount: orderData.amount,
|
amount: orderData.payAmount || orderData.amount,
|
||||||
payTime: this.formatTime(new Date())
|
payTime: orderData.payTime || this.formatTime(new Date())
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查订单状态
|
||||||
|
if (orderData.orderStatus === 'IN_USED') {
|
||||||
|
// 如果已经是使用中状态,可能说明开锁已经完成
|
||||||
|
this.deviceMessage = '设备已弹出,请取走您的充电宝'
|
||||||
|
this.isLoading = false
|
||||||
|
|
||||||
|
// 如果是第一次加载页面且设备已弹出,记录状态,避免重复弹出
|
||||||
|
if (!this.hasTriggeredDevice) {
|
||||||
|
uni.$emit('orderSuccess:' + this.orderId)
|
||||||
|
this.hasTriggeredDevice = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 正常触发弹出逻辑
|
||||||
|
this.triggerDeviceEject()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error('获取订单信息失败')
|
throw new Error('获取订单信息失败')
|
||||||
@@ -89,6 +122,47 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 触发弹出充电宝
|
||||||
|
async triggerDeviceEject() {
|
||||||
|
if (this.hasTriggeredDevice) {
|
||||||
|
console.log('已经触发过弹出充电宝,不重复触发')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.hasTriggeredDevice = true
|
||||||
|
uni.$emit('orderSuccess:' + this.orderId)
|
||||||
|
this.isLoading = true
|
||||||
|
this.deviceMessage = '正在准备您的设备,请稍候...'
|
||||||
|
|
||||||
|
try {
|
||||||
|
console.log(`准备触发弹出充电宝,orderId: ${this.orderId}`)
|
||||||
|
|
||||||
|
// 调用确认支付并弹出的方法
|
||||||
|
const result = await confirmPaymentAndRent(this.orderId)
|
||||||
|
console.log('确认支付并弹出充电宝结果:', JSON.stringify(result))
|
||||||
|
|
||||||
|
if (result && result.code === 200) {
|
||||||
|
this.deviceMessage = '设备已弹出,请取走您的充电宝'
|
||||||
|
uni.showToast({
|
||||||
|
title: '充电宝已弹出',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
throw new Error((result && result.msg) || '弹出充电宝失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('弹出充电宝错误:', error)
|
||||||
|
this.deviceMessage = '弹出设备失败,请联系客服'
|
||||||
|
uni.showToast({
|
||||||
|
title: error.message || '弹出充电宝失败,请联系客服',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} finally {
|
||||||
|
this.isLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
formatTime(date) {
|
formatTime(date) {
|
||||||
const year = date.getFullYear()
|
const year = date.getFullYear()
|
||||||
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
||||||
@@ -194,6 +268,41 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.device-status {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.status-message {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-animation {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 40px;
|
||||||
|
|
||||||
|
.loading-circle {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 3px solid #f0f0f0;
|
||||||
|
border-top-color: #07c160;
|
||||||
|
animation: spin 1s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
0% { transform: rotate(0deg); }
|
||||||
|
100% { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.button-group {
|
.button-group {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<!-- 订单信息卡片 -->
|
<!-- 订单信息卡片 -->
|
||||||
<view class="order-card">
|
<view class="order-card">
|
||||||
<view class="order-header">
|
<view class="order-header">
|
||||||
<text class="title">使用中</text>
|
<text class="title">{{ getOrderStatusText() }}</text>
|
||||||
<text class="order-no">订单号:{{ orderInfo.orderId }}</text>
|
<text class="order-no">订单号:{{ orderInfo.orderId }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -26,6 +26,14 @@
|
|||||||
<text class="value">¥{{ orderInfo.currentFee }}</text>
|
<text class="value">¥{{ orderInfo.currentFee }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 调试信息(仅在开发环境显示) -->
|
||||||
|
<view class="debug-info" v-if="false">
|
||||||
|
<view class="debug-title">调试信息</view>
|
||||||
|
<view class="debug-item">原始开始时间: {{ this.orderInfo._rawStartTime }}</view>
|
||||||
|
<view class="debug-item">处理后开始时间: {{ this.orderInfo.startTime }}</view>
|
||||||
|
<view class="debug-item">订单状态: {{ this.orderInfo.orderStatus }}</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 归还说明 -->
|
<!-- 归还说明 -->
|
||||||
@@ -38,26 +46,32 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="notice-item">
|
<view class="notice-item">
|
||||||
<view class="dot"></view>
|
<view class="dot"></view>
|
||||||
<text>请在指定区域内归还设备</text>
|
<text>将充电宝插入原位置或空闲插口</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="notice-item">
|
<view class="notice-item">
|
||||||
<view class="dot"></view>
|
<view class="dot"></view>
|
||||||
<text>归还后押金将自动退还</text>
|
<text>系统将自动检测归还并处理退款</text>
|
||||||
|
</view>
|
||||||
|
<view class="notice-item">
|
||||||
|
<view class="dot"></view>
|
||||||
|
<text>归还成功后将自动跳转到成功页面</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 底部操作栏 -->
|
<!-- 底部操作栏 -->
|
||||||
<view class="bottom-bar">
|
<view class="bottom-bar">
|
||||||
<button class="unlock-btn" @click="handleUnlock" :disabled="unlocking">
|
<button class="secondary-btn" @click="checkReturnStatus">刷新状态</button>
|
||||||
{{ unlocking ? '开锁中...' : '开锁归还' }}
|
<button class="primary-btn" @click="goToHome">返回首页</button>
|
||||||
</button>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { queryById, overOrderById } from '@/config/user.js'
|
import { queryById } from '@/config/user.js'
|
||||||
|
import {
|
||||||
|
URL
|
||||||
|
}from"@/config/url.js"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -66,19 +80,28 @@ export default {
|
|||||||
orderInfo: {
|
orderInfo: {
|
||||||
orderId: '',
|
orderId: '',
|
||||||
startTime: '',
|
startTime: '',
|
||||||
|
_rawStartTime: '', // 用于调试
|
||||||
usedTime: '0分钟',
|
usedTime: '0分钟',
|
||||||
currentFee: '0.00'
|
currentFee: '0.00',
|
||||||
|
orderStatus: 'in_used' // 默认状态为使用中
|
||||||
},
|
},
|
||||||
unlocking: false,
|
timer: null,
|
||||||
timer: null
|
statusCheckTimer: null,
|
||||||
|
maxStatusChecks: 30, // 最多检查30次
|
||||||
|
currentStatusChecks: 0,
|
||||||
|
statusCheckInterval: 5000, // 5秒检查一次
|
||||||
|
isPageActive: false // 跟踪页面是否活跃
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
console.log('Return page loaded with options:', JSON.stringify(options))
|
console.log('Return page loaded with options:', JSON.stringify(options))
|
||||||
|
|
||||||
|
// 标记页面为活跃状态
|
||||||
|
this.isPageActive = true
|
||||||
|
|
||||||
// 获取传递的参数
|
// 获取传递的参数
|
||||||
this.orderInfo.orderId = options.orderId || ''
|
this.orderInfo.orderId = options.orderId || ''
|
||||||
this.deviceId = options.deviceId || ''
|
this.deviceId = options.deviceNo || options.deviceId || ''
|
||||||
|
|
||||||
console.log(`初始化参数: orderId=${this.orderInfo.orderId}, deviceId=${this.deviceId}`)
|
console.log(`初始化参数: orderId=${this.orderInfo.orderId}, deviceId=${this.deviceId}`)
|
||||||
|
|
||||||
@@ -90,6 +113,26 @@ export default {
|
|||||||
this.getOrderDetails()
|
this.getOrderDetails()
|
||||||
// 启动定时器更新使用时长
|
// 启动定时器更新使用时长
|
||||||
this.startTimer()
|
this.startTimer()
|
||||||
|
// 启动状态检查定时器
|
||||||
|
this.startStatusCheckTimer()
|
||||||
|
|
||||||
|
// 记录当前活跃订单ID
|
||||||
|
uni.setStorageSync('activeOrderId', this.orderInfo.orderId)
|
||||||
|
|
||||||
|
// 如果订单ID有效,将订单添加到全局监控服务
|
||||||
|
try {
|
||||||
|
if (this.$orderMonitor) {
|
||||||
|
// 先确保移除之前的监控(防止重复添加)
|
||||||
|
this.$orderMonitor.removeOrder({orderId: this.orderInfo.orderId})
|
||||||
|
// 添加到监控队列,明确指定为归还页面
|
||||||
|
this.$orderMonitor.addOrder({orderId: this.orderInfo.orderId}, 'return')
|
||||||
|
console.log('订单已添加到监控队列:', this.orderInfo.orderId)
|
||||||
|
} else {
|
||||||
|
console.warn('$orderMonitor 未定义,无法添加订单到监控队列')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('添加订单到监控队列失败:', error)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// 缺少必要参数
|
// 缺少必要参数
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -99,21 +142,117 @@ export default {
|
|||||||
|
|
||||||
// 返回首页
|
// 返回首页
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
this.goToHome()
|
||||||
|
}, 1500)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 注册全局订单完成事件监听器
|
||||||
|
uni.$on('orderCompleted', this.handleOrderCompleted)
|
||||||
|
},
|
||||||
|
// 添加onHide生命周期,处理页面隐藏时的清理工作
|
||||||
|
onHide() {
|
||||||
|
console.log('归还页面隐藏,清理计时器资源和监控服务')
|
||||||
|
// 标记页面为非活跃状态
|
||||||
|
this.isPageActive = false
|
||||||
|
|
||||||
|
// 清理所有计时器
|
||||||
|
this.clearTimer()
|
||||||
|
this.clearStatusCheckTimer()
|
||||||
|
|
||||||
|
// 从全局订单监控服务中移除当前订单
|
||||||
|
this.removeFromOrderMonitor()
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
console.log('归还页面卸载,清理所有资源')
|
||||||
|
// 标记页面为非活跃状态
|
||||||
|
this.isPageActive = false
|
||||||
|
|
||||||
|
// 页面卸载时清除定时器
|
||||||
|
this.clearTimer()
|
||||||
|
this.clearStatusCheckTimer()
|
||||||
|
|
||||||
|
// 从全局订单监控服务中移除当前订单
|
||||||
|
this.removeFromOrderMonitor()
|
||||||
|
|
||||||
|
// 注销全局事件监听
|
||||||
|
uni.$off('orderCompleted', this.handleOrderCompleted)
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 从订单监控服务中移除当前订单
|
||||||
|
removeFromOrderMonitor() {
|
||||||
|
if (this.orderInfo.orderId && this.$orderMonitor) {
|
||||||
|
try {
|
||||||
|
this.$orderMonitor.removeOrder({orderId: this.orderInfo.orderId})
|
||||||
|
console.log('订单已从监控队列移除:', this.orderInfo.orderId)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('从监控队列移除订单失败:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 处理订单完成事件(可由任何地方触发)
|
||||||
|
handleOrderCompleted(orderData) {
|
||||||
|
console.log('收到订单完成事件:', orderData)
|
||||||
|
|
||||||
|
// 检查是否为当前订单
|
||||||
|
if (orderData.orderId === this.orderInfo.orderId || orderData.orderNo === this.orderInfo.orderNo) {
|
||||||
|
// 显示归还成功弹窗
|
||||||
|
this.showReturnSuccessModal(orderData)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 显示归还成功弹窗
|
||||||
|
showReturnSuccessModal(orderData) {
|
||||||
|
// 清理定时器
|
||||||
|
this.clearTimer()
|
||||||
|
this.clearStatusCheckTimer()
|
||||||
|
|
||||||
|
// 显示归还成功弹窗
|
||||||
|
uni.showModal({
|
||||||
|
title: '归还成功',
|
||||||
|
content: '充电宝已归还成功,剩余押金将退还到您的账户',
|
||||||
|
confirmText: '查看详情',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
// 跳转到归还成功页面查看详情
|
||||||
|
uni.redirectTo({
|
||||||
|
url: `/pages/order/return-success?orderId=${orderData.orderId || this.orderInfo.orderId}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// 跳转到首页
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
})
|
})
|
||||||
}, 1500)
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
onUnload() {
|
|
||||||
// 页面卸载时清除定时器
|
// 根据订单状态获取对应的文字显示
|
||||||
this.clearTimer()
|
getOrderStatusText() {
|
||||||
|
const statusMap = {
|
||||||
|
'waiting_for_payment': '待支付',
|
||||||
|
'payment_in_progress': '支付中',
|
||||||
|
'payment_successful': '支付成功',
|
||||||
|
'in_used': '使用中',
|
||||||
|
'payment_failed': '支付失败',
|
||||||
|
'order_cancelled': '订单取消',
|
||||||
|
'used_done': '订单完成',
|
||||||
|
'used_down': '订单完成'
|
||||||
|
}
|
||||||
|
|
||||||
|
return statusMap[this.orderInfo.orderStatus] || '使用中'
|
||||||
},
|
},
|
||||||
methods: {
|
|
||||||
// 获取订单详情
|
// 获取订单详情
|
||||||
async getOrderDetails() {
|
async getOrderDetails() {
|
||||||
|
// 如果页面不再活跃,不执行API请求
|
||||||
|
if (!this.isPageActive) {
|
||||||
|
console.log('页面已不活跃,跳过订单详情请求')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
uni.showLoading({ title: '加载中' })
|
// uni.showLoading({ title: '加载中' })
|
||||||
|
|
||||||
if (!this.orderInfo.orderId) {
|
if (!this.orderInfo.orderId) {
|
||||||
throw new Error('订单ID不能为空')
|
throw new Error('订单ID不能为空')
|
||||||
@@ -125,32 +264,30 @@ export default {
|
|||||||
|
|
||||||
if (result.code === 200 && result.data) {
|
if (result.code === 200 && result.data) {
|
||||||
const orderData = result.data
|
const orderData = result.data
|
||||||
console.log('订单数据:', JSON.stringify(orderData))
|
console.log('订单原始数据:', orderData)
|
||||||
|
console.log('开始时间字段:', orderData.startTime, typeof orderData.startTime)
|
||||||
|
|
||||||
// 更新订单信息
|
// 更新订单状态
|
||||||
|
if (orderData.orderStatus) {
|
||||||
|
this.orderInfo.orderStatus = orderData.orderStatus
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查订单状态,如果已完成,显示归还成功弹窗
|
||||||
|
if (orderData.orderStatus &&
|
||||||
|
(orderData.orderStatus === 'used_done' || orderData.orderStatus === 'used_down')) {
|
||||||
|
// 触发全局订单完成事件
|
||||||
|
uni.$emit('orderCompleted', orderData)
|
||||||
|
|
||||||
|
// 显示归还成功弹窗
|
||||||
|
this.showReturnSuccessModal(orderData)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新订单信息 (包括开始时间)
|
||||||
this.updateOrderInfo(orderData)
|
this.updateOrderInfo(orderData)
|
||||||
|
|
||||||
// 格式化开始时间
|
// 更新后检查是否成功设置了startTime
|
||||||
const rawTime = orderData.startTime
|
console.log('更新后的开始时间:', this.orderInfo.startTime)
|
||||||
console.log('开始时间:', rawTime)
|
|
||||||
|
|
||||||
if (rawTime) {
|
|
||||||
try {
|
|
||||||
// 尝试格式化时间
|
|
||||||
const date = new Date(rawTime.replace(' ', 'T'))
|
|
||||||
if (!isNaN(date.getTime())) {
|
|
||||||
this.orderInfo.startTime = this.formatTime(date)
|
|
||||||
} else {
|
|
||||||
// 如果时间解析失败,直接使用原始时间字符串
|
|
||||||
this.orderInfo.startTime = rawTime
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('时间格式化错误:', e)
|
|
||||||
this.orderInfo.startTime = rawTime
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.orderInfo.startTime = '未知'
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error(result.msg || '获取订单详情失败')
|
throw new Error(result.msg || '获取订单详情失败')
|
||||||
}
|
}
|
||||||
@@ -163,9 +300,7 @@ export default {
|
|||||||
|
|
||||||
// 如果获取订单失败,返回首页
|
// 如果获取订单失败,返回首页
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.reLaunch({
|
this.goToHome()
|
||||||
url: '/pages/index/index'
|
|
||||||
})
|
|
||||||
}, 1500)
|
}, 1500)
|
||||||
} finally {
|
} finally {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
@@ -186,8 +321,41 @@ export default {
|
|||||||
// 使用后端返回的使用时长和费用数据
|
// 使用后端返回的使用时长和费用数据
|
||||||
updateOrderInfo(orderData) {
|
updateOrderInfo(orderData) {
|
||||||
console.log('更新订单信息:', JSON.stringify(orderData))
|
console.log('更新订单信息:', JSON.stringify(orderData))
|
||||||
|
|
||||||
|
// 处理使用时长
|
||||||
this.orderInfo.usedTime = orderData.usedTime || '0分钟';
|
this.orderInfo.usedTime = orderData.usedTime || '0分钟';
|
||||||
this.orderInfo.currentFee = orderData.currentFee || '0.00';
|
|
||||||
|
// 处理当前费用
|
||||||
|
this.orderInfo.currentFee = orderData.currentFee || orderData.actualDeviceAmount || orderData.payAmount || '0.00';
|
||||||
|
|
||||||
|
// 更新订单状态
|
||||||
|
if (orderData.orderStatus) {
|
||||||
|
this.orderInfo.orderStatus = orderData.orderStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存原始开始时间用于调试
|
||||||
|
this.orderInfo._rawStartTime = orderData.startTime;
|
||||||
|
|
||||||
|
// 处理开始时间
|
||||||
|
if (orderData.startTime) {
|
||||||
|
try {
|
||||||
|
console.log('API返回的开始时间:', orderData.startTime);
|
||||||
|
// 尝试直接显示API返回的时间字符串
|
||||||
|
this.orderInfo.startTime = orderData.startTime;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('更新开始时间错误:', e);
|
||||||
|
this.orderInfo.startTime = '未知';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn('API返回的订单数据中没有startTime字段');
|
||||||
|
// 尝试使用createTime作为备选
|
||||||
|
if (orderData.createTime) {
|
||||||
|
console.log('使用createTime作为备选:', orderData.createTime);
|
||||||
|
this.orderInfo.startTime = orderData.createTime;
|
||||||
|
} else {
|
||||||
|
this.orderInfo.startTime = '未知';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 如果有设备号,更新设备号
|
// 如果有设备号,更新设备号
|
||||||
if (orderData.deviceNo && !this.deviceId) {
|
if (orderData.deviceNo && !this.deviceId) {
|
||||||
@@ -197,10 +365,22 @@ export default {
|
|||||||
|
|
||||||
// 更新使用时长的定时器
|
// 更新使用时长的定时器
|
||||||
startTimer() {
|
startTimer() {
|
||||||
|
// 清除现有计时器,确保不重复
|
||||||
|
this.clearTimer()
|
||||||
|
|
||||||
// 每分钟更新一次使用时长
|
// 每分钟更新一次使用时长
|
||||||
this.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
|
// 只有当页面活跃时才执行更新
|
||||||
|
if (this.isPageActive) {
|
||||||
|
console.log('执行定时更新订单信息')
|
||||||
this.getOrderDetails()
|
this.getOrderDetails()
|
||||||
|
} else {
|
||||||
|
console.log('页面已不活跃,停止计时器')
|
||||||
|
this.clearTimer()
|
||||||
|
}
|
||||||
}, 60000)
|
}, 60000)
|
||||||
|
|
||||||
|
console.log('已启动使用时长更新计时器')
|
||||||
},
|
},
|
||||||
|
|
||||||
// 清除定时器
|
// 清除定时器
|
||||||
@@ -208,72 +388,56 @@ export default {
|
|||||||
if (this.timer) {
|
if (this.timer) {
|
||||||
clearInterval(this.timer)
|
clearInterval(this.timer)
|
||||||
this.timer = null
|
this.timer = null
|
||||||
|
console.log('已清除使用时长更新计时器')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 处理开锁归还
|
// 清除状态检查定时器
|
||||||
async handleUnlock() {
|
clearStatusCheckTimer() {
|
||||||
if (this.unlocking) return
|
if (this.statusCheckTimer) {
|
||||||
|
clearInterval(this.statusCheckTimer)
|
||||||
try {
|
this.statusCheckTimer = null
|
||||||
this.unlocking = true
|
console.log('已清除归还状态检查计时器')
|
||||||
uni.showLoading({ title: '开锁中' })
|
|
||||||
|
|
||||||
// 确认是否归还
|
|
||||||
const confirmResult = await new Promise((resolve) => {
|
|
||||||
uni.showModal({
|
|
||||||
title: '确认归还',
|
|
||||||
content: '确定要归还设备吗?',
|
|
||||||
success: (res) => {
|
|
||||||
resolve(res.confirm)
|
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
})
|
|
||||||
|
|
||||||
if (!confirmResult) {
|
// 开始状态检查定时器
|
||||||
this.unlocking = false
|
startStatusCheckTimer() {
|
||||||
uni.hideLoading()
|
this.currentStatusChecks = 0
|
||||||
return
|
// 确保之前的计时器被清除
|
||||||
}
|
this.clearStatusCheckTimer()
|
||||||
|
|
||||||
console.log(`准备结束订单, orderId: ${this.orderInfo.orderId}`)
|
this.statusCheckTimer = setInterval(() => {
|
||||||
|
// 只有当页面活跃时才执行检查
|
||||||
|
if (this.isPageActive) {
|
||||||
|
this.currentStatusChecks++
|
||||||
|
console.log(`执行归还状态检查 (${this.currentStatusChecks}/${this.maxStatusChecks})`)
|
||||||
|
this.checkReturnStatus()
|
||||||
|
|
||||||
// 调用结束订单接口
|
// 如果超过最大检查次数,停止定时器
|
||||||
const result = await overOrderById(this.orderInfo.orderId)
|
if (this.currentStatusChecks >= this.maxStatusChecks) {
|
||||||
|
this.clearStatusCheckTimer()
|
||||||
|
|
||||||
console.log('结束订单结果:', JSON.stringify(result))
|
// 提示用户手动刷新
|
||||||
|
|
||||||
if (result.code === 200) {
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '归还成功',
|
title: '请手动刷新查看归还状态',
|
||||||
icon: 'success'
|
icon: 'none',
|
||||||
|
duration: 3000
|
||||||
})
|
})
|
||||||
|
}
|
||||||
// 归还成功后,返回首页
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.reLaunch({
|
|
||||||
url: '/pages/index/index'
|
|
||||||
})
|
|
||||||
}, 1500)
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error(result.msg || '归还失败')
|
console.log('页面已不活跃,停止状态检查计时器')
|
||||||
}
|
this.clearStatusCheckTimer()
|
||||||
} catch (error) {
|
|
||||||
console.error('归还操作错误:', error)
|
|
||||||
uni.showToast({
|
|
||||||
title: error.message || '归还失败,请重试',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
} finally {
|
|
||||||
this.unlocking = false
|
|
||||||
uni.hideLoading()
|
|
||||||
}
|
}
|
||||||
|
}, this.statusCheckInterval)
|
||||||
|
|
||||||
|
console.log('已启动归还状态检查计时器')
|
||||||
},
|
},
|
||||||
|
|
||||||
// 通过设备号查询使用中的订单
|
// 通过设备号查询使用中的订单
|
||||||
async getOrderByDevice() {
|
async getOrderByDevice() {
|
||||||
try {
|
try {
|
||||||
uni.showLoading({ title: '加载中' })
|
// uni.showLoading({ title: '加载中' })
|
||||||
|
|
||||||
if (!this.deviceId) {
|
if (!this.deviceId) {
|
||||||
throw new Error('设备号不能为空')
|
throw new Error('设备号不能为空')
|
||||||
@@ -281,7 +445,7 @@ export default {
|
|||||||
|
|
||||||
// 这里调用API查询该设备的使用中订单
|
// 这里调用API查询该设备的使用中订单
|
||||||
const inUseRes = await uni.request({
|
const inUseRes = await uni.request({
|
||||||
url: `${uni.getStorageSync('baseUrl') || 'http://127.0.0.1:8080'}/app/order/inUse`,
|
url: `${URL || 'http://127.0.0.1:8080'}/app/order/inUse`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
header: {
|
header: {
|
||||||
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
||||||
@@ -293,13 +457,28 @@ export default {
|
|||||||
|
|
||||||
if (inUseRes.statusCode === 200 && inUseRes.data.code === 200 && inUseRes.data.data) {
|
if (inUseRes.statusCode === 200 && inUseRes.data.code === 200 && inUseRes.data.data) {
|
||||||
const inUseOrder = inUseRes.data.data
|
const inUseOrder = inUseRes.data.data
|
||||||
|
console.log('使用中的订单:', inUseOrder)
|
||||||
|
|
||||||
// 更新订单ID
|
// 更新订单ID
|
||||||
this.orderInfo.orderId = inUseOrder.orderId
|
this.orderInfo.orderId = inUseOrder.orderId
|
||||||
|
|
||||||
|
// 如果有订单状态,更新订单状态
|
||||||
|
if (inUseOrder.orderStatus) {
|
||||||
|
this.orderInfo.orderStatus = inUseOrder.orderStatus
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果有开始时间,直接更新
|
||||||
|
if (inUseOrder.startTime) {
|
||||||
|
console.log('inUse API返回的开始时间:', inUseOrder.startTime)
|
||||||
|
this.orderInfo.startTime = inUseOrder.startTime
|
||||||
|
}
|
||||||
|
|
||||||
// 获取详细订单信息
|
// 获取详细订单信息
|
||||||
this.getOrderDetails()
|
this.getOrderDetails()
|
||||||
// 启动定时器
|
// 启动定时器
|
||||||
this.startTimer()
|
this.startTimer()
|
||||||
|
// 启动状态检查定时器
|
||||||
|
this.startStatusCheckTimer()
|
||||||
} else {
|
} else {
|
||||||
throw new Error('未找到使用中的订单')
|
throw new Error('未找到使用中的订单')
|
||||||
}
|
}
|
||||||
@@ -312,13 +491,30 @@ export default {
|
|||||||
|
|
||||||
// 如果获取订单失败,返回首页
|
// 如果获取订单失败,返回首页
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.reLaunch({
|
this.goToHome()
|
||||||
url: '/pages/index/index'
|
|
||||||
})
|
|
||||||
}, 1500)
|
}, 1500)
|
||||||
} finally {
|
} finally {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 检查归还状态
|
||||||
|
async checkReturnStatus() {
|
||||||
|
try {
|
||||||
|
// 只有页面活跃时才执行检查
|
||||||
|
if (this.isPageActive) {
|
||||||
|
await this.getOrderDetails()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('检查归还状态失败:', error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 返回首页
|
||||||
|
goToHome() {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -346,9 +542,9 @@ export default {
|
|||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 36rpx;
|
font-size: 32rpx;
|
||||||
font-weight: 600;
|
font-weight: bold;
|
||||||
color: #1976D2;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-no {
|
.order-no {
|
||||||
@@ -358,13 +554,13 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.device-info {
|
.device-info {
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 30rpx;
|
||||||
|
|
||||||
.device-name {
|
.device-name {
|
||||||
font-size: 32rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 500;
|
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-right: 20rpx;
|
display: block;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.device-id {
|
.device-id {
|
||||||
@@ -374,9 +570,14 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.time-info {
|
.time-info {
|
||||||
|
background: #f9f9f9;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 20rpx;
|
||||||
|
|
||||||
.time-item {
|
.time-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
@@ -384,17 +585,17 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
font-size: 28rpx;
|
font-size: 26rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
.value {
|
.value {
|
||||||
font-size: 28rpx;
|
font-size: 26rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
|
|
||||||
&.highlight {
|
&.highlight {
|
||||||
color: #1976D2;
|
color: #ff6b00;
|
||||||
font-weight: 500;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -409,16 +610,16 @@ export default {
|
|||||||
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
|
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
|
||||||
|
|
||||||
.notice-title {
|
.notice-title {
|
||||||
font-size: 32rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 600;
|
font-weight: bold;
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-list {
|
.notice-list {
|
||||||
.notice-item {
|
.notice-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: flex-start;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
@@ -428,13 +629,15 @@ export default {
|
|||||||
.dot {
|
.dot {
|
||||||
width: 12rpx;
|
width: 12rpx;
|
||||||
height: 12rpx;
|
height: 12rpx;
|
||||||
background: #1976D2;
|
background: #07c160;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
margin-top: 10rpx;
|
||||||
margin-right: 16rpx;
|
margin-right: 16rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
text {
|
text {
|
||||||
font-size: 28rpx;
|
font-size: 26rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
@@ -447,33 +650,38 @@ export default {
|
|||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
padding: 30rpx;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 20rpx 30rpx;
|
|
||||||
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
box-shadow: 0 -4rpx 16rpx rgba(0,0,0,0.04);
|
box-shadow: 0 -4rpx 16rpx rgba(0,0,0,0.04);
|
||||||
|
z-index: 10;
|
||||||
.unlock-btn {
|
|
||||||
width: 100%;
|
|
||||||
height: 88rpx;
|
|
||||||
border-radius: 44rpx;
|
|
||||||
background: linear-gradient(135deg, #FF9800, #FFB74D);
|
|
||||||
color: #fff;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: 600;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
justify-content: space-between;
|
||||||
justify-content: center;
|
gap: 20rpx;
|
||||||
border: none;
|
|
||||||
|
|
||||||
&:active {
|
.primary-btn, .secondary-btn {
|
||||||
transform: scale(0.98);
|
height: 88rpx;
|
||||||
|
line-height: 88rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
border-radius: 44rpx;
|
||||||
|
text-align: center;
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:disabled {
|
.primary-btn {
|
||||||
opacity: 0.7;
|
background: #07c160;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.secondary-btn {
|
||||||
|
background: #f0f0f0;
|
||||||
|
color: #333;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,15 @@
|
|||||||
wxLogin,
|
wxLogin,
|
||||||
} from '../../../util/index'
|
} from '../../../util/index'
|
||||||
|
|
||||||
|
import {
|
||||||
|
getMyIndexInfo
|
||||||
|
} from "../../../config/user.js";
|
||||||
import {
|
import {
|
||||||
queryHasOrder
|
queryHasOrder
|
||||||
} from '@/config/user.js'
|
} from "../../../config/user.js";
|
||||||
|
import {
|
||||||
|
checkOrdersByStatus
|
||||||
|
} from "../../../config/user.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -20,46 +26,104 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async onLoad(option) {
|
async onLoad(option) {
|
||||||
|
console.log('bagCheck onLoad option:', option);
|
||||||
try {
|
try {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中...'
|
title: '处理中...',
|
||||||
|
mask: true
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!uni.getStorageSync('token')) {
|
// 检查是否传入设备编号
|
||||||
await wxLogin();
|
if (!option || !option.deviceNo) {
|
||||||
|
throw new Error('未识别到设备编号');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!option.deviceNo) {
|
const deviceNo = option.deviceNo;
|
||||||
uni.hideLoading();
|
|
||||||
uni.showToast({
|
|
||||||
title: '设备编号不能为空',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询用户是否有使用中(in_used)的订单
|
// 检查用户是否有进行中(in_used)或待支付(waiting_for_payment)的订单
|
||||||
const result = await queryHasOrder(option.deviceNo);
|
const statusesToCheck = ['in_used', 'waiting_for_payment'];
|
||||||
uni.hideLoading();
|
const res = await checkOrdersByStatus(deviceNo, statusesToCheck);
|
||||||
|
|
||||||
if (result.data && result.data.data && result.data.data.length > 0) {
|
if (res.code === 200 && res.data && res.data.length > 0) {
|
||||||
// 如果有使用中的订单,直接跳转到归还页面
|
// 找到相关订单,取最新的一条
|
||||||
|
const latestOrder = res.data[0]; // 假设返回结果按时间倒序
|
||||||
|
|
||||||
|
if (latestOrder.orderStatus === 'in_used') {
|
||||||
|
// 如果是使用中的订单,跳转到归还页面
|
||||||
|
console.log('检测到使用中订单,跳转归还页:', latestOrder.orderId);
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pages/device/return?deviceNo=${option.deviceNo}`
|
url: `/pages/device/return?orderId=${latestOrder.orderId}`
|
||||||
|
});
|
||||||
|
} else if (latestOrder.orderStatus === 'waiting_for_payment') {
|
||||||
|
// 如果是待支付订单,跳转到支付页面,并传递必要信息
|
||||||
|
console.log('检测到待支付订单,跳转支付页:', latestOrder.orderId);
|
||||||
|
|
||||||
|
// 获取套餐时间(分钟)
|
||||||
|
const packageTimeMinutes = latestOrder.packageTime || 60;
|
||||||
|
|
||||||
|
// 套餐小时数
|
||||||
|
const packageTimeHours = (packageTimeMinutes / 60).toFixed(1);
|
||||||
|
|
||||||
|
// 套餐价格
|
||||||
|
const packagePrice = latestOrder.packagePrice || '0.00';
|
||||||
|
|
||||||
|
// 计算每小时费率
|
||||||
|
const hourlyRate = (parseFloat(packagePrice) / (packageTimeMinutes / 60)).toFixed(2);
|
||||||
|
|
||||||
|
// 押金金额
|
||||||
|
const depositAmount = latestOrder.depositAmount || '99.00';
|
||||||
|
|
||||||
|
// 计算总金额(套餐+押金)
|
||||||
|
const totalAmount = (parseFloat(depositAmount) + parseFloat(packagePrice)).toFixed(2);
|
||||||
|
|
||||||
|
uni.redirectTo({
|
||||||
|
url: `/pages/order/payment?orderId=${latestOrder.orderId}&packageTimeHours=${packageTimeHours}&packagePrice=${packagePrice}&hourlyRate=${hourlyRate}&totalAmount=${totalAmount}&depositAmount=${depositAmount}`
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 如果没有使用中的订单,跳转到设备详情页面进行租借
|
// 其他状态(理论上不应该到这里,除非statusesToCheck配置错误),默认到详情页
|
||||||
|
console.log('检测到其他状态订单,跳转详情页:', latestOrder.orderId);
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pages/device/detail?deviceNo=${option.deviceNo}`
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 没有找到相关状态的订单,跳转到设备详情页进行租借
|
||||||
|
console.log('未检测到相关订单,跳转详情页');
|
||||||
|
uni.redirectTo({
|
||||||
|
url: `/pages/device/detail?deviceNo=${deviceNo}`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.hideLoading();
|
// 只处理真正的错误,不是"没有订单"的情况
|
||||||
|
if (error.message && (
|
||||||
|
error.message.includes('未识别到设备编号') ||
|
||||||
|
error.message.includes('网络请求失败') ||
|
||||||
|
error.message.includes('服务器错误')
|
||||||
|
)) {
|
||||||
|
console.error('扫码检查订单失败:', error);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '页面加载失败,请重试',
|
title: error.message || '处理失败,请稍后重试',
|
||||||
icon: 'none'
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
});
|
});
|
||||||
console.error('bagCheck onLoad error:', error);
|
} else {
|
||||||
|
// 对于其他错误,包括"没有找到订单",直接跳转到详情页,不显示错误消息
|
||||||
|
console.log('没有找到符合条件的订单或发生其他错误,直接跳转详情页');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 无论什么情况,都跳转到一个可用页面
|
||||||
|
setTimeout(() => {
|
||||||
|
if (option && option.deviceNo) {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: `/pages/device/detail?deviceNo=${option.deviceNo}`
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 如果连deviceNo都没有,则返回首页
|
||||||
|
uni.switchTab({ url: '/pages/index/index' });
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
|
} finally {
|
||||||
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -0,0 +1,230 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<!-- 用户信息卡片 -->
|
||||||
|
<view class="user-card">
|
||||||
|
<view class="avatar">
|
||||||
|
<image :src="userInfo.avatar || '/static/images/default-avatar.png'" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<view class="user-info">
|
||||||
|
<text class="nickname">{{ userInfo.nickName || '未登录' }}</text>
|
||||||
|
<text class="phone">{{ userInfo.phone || '未绑定手机号' }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 余额卡片 -->
|
||||||
|
<view class="balance-card">
|
||||||
|
<view class="balance-title">余额</view>
|
||||||
|
<view class="balance-amount">¥{{ userInfo.balanceAmount || '0.00' }}</view>
|
||||||
|
<view class="balance-desc">可用于租借设备</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 功能菜单 -->
|
||||||
|
<view class="menu-list">
|
||||||
|
<view class="menu-item" @click="navigateTo('/pages/order/list')">
|
||||||
|
<text class="menu-icon">📋</text>
|
||||||
|
<text class="menu-text">我的订单</text>
|
||||||
|
<text class="menu-arrow">></text>
|
||||||
|
</view>
|
||||||
|
<view class="menu-item" @click="navigateTo('/pages/user/feedback')">
|
||||||
|
<text class="menu-icon">💬</text>
|
||||||
|
<text class="menu-text">意见反馈</text>
|
||||||
|
<text class="menu-arrow">></text>
|
||||||
|
</view>
|
||||||
|
<view class="menu-item" @click="navigateTo('/pages/user/about')">
|
||||||
|
<text class="menu-icon">ℹ️</text>
|
||||||
|
<text class="menu-text">关于我们</text>
|
||||||
|
<text class="menu-arrow">></text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 退出登录按钮 -->
|
||||||
|
<view class="logout-btn" @click="handleLogout" v-if="isLogin">
|
||||||
|
<text>退出登录</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getUserInfo } from '@/api/user'
|
||||||
|
import { URL } from '@/config/url'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
userInfo: {},
|
||||||
|
isLogin: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.checkLoginStatus()
|
||||||
|
this.loadUserInfo()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async loadUserInfo() {
|
||||||
|
try {
|
||||||
|
const res = await getUserInfo()
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.userInfo = res.data
|
||||||
|
this.isLogin = true
|
||||||
|
} else {
|
||||||
|
this.isLogin = false
|
||||||
|
uni.showToast({
|
||||||
|
title: '获取用户信息失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载用户信息失败:', error)
|
||||||
|
this.isLogin = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
checkLoginStatus() {
|
||||||
|
const token = uni.getStorageSync('token')
|
||||||
|
this.isLogin = !!token
|
||||||
|
if (!this.isLogin) {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/login/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
navigateTo(url) {
|
||||||
|
uni.navigateTo({ url })
|
||||||
|
},
|
||||||
|
handleLogout() {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要退出登录吗?',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.removeStorageSync('token')
|
||||||
|
uni.removeStorageSync('userInfo')
|
||||||
|
this.isLogin = false
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/login/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.container {
|
||||||
|
padding: 20rpx;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 120rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
border-radius: 60rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-info {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nickname {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phone {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.balance-card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.balance-title {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.balance-amount {
|
||||||
|
font-size: 48rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.balance-desc {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-list {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 30rpx;
|
||||||
|
border-bottom: 1rpx solid #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-icon {
|
||||||
|
font-size: 36rpx;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-text {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-arrow {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-btn {
|
||||||
|
margin-top: 40rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
text-align: center;
|
||||||
|
color: #ff4d4f;
|
||||||
|
font-size: 28rpx;
|
||||||
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./common/vendor.js"),n=require("./util/index.js"),e=require("./utils/orderMonitor.js");Math;const t={onLaunch:function(){console.log("App Launch")},onShow:async function(){console.log("App Show"),await this.autoLogin()},onHide:function(){console.log("App Hide")},methods:{async autoLogin(){try{const o=await n.wxLogin();console.log("自动登录成功:",o)}catch(o){console.error("自动登录失败:",o)}}}};function r(){const n=o.createSSRApp(t);return n.config.globalProperties.$orderMonitor=e.orderMonitor,{app:n}}r().app.mount("#app"),exports.createApp=r;
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"pages": [
|
||||||
|
"pages/index/index",
|
||||||
|
"pages/my/index",
|
||||||
|
"pages/deposit/index",
|
||||||
|
"pages/order/index",
|
||||||
|
"pages/order/payment",
|
||||||
|
"pages/feedback/index",
|
||||||
|
"pages/help/index",
|
||||||
|
"pages/device/detail",
|
||||||
|
"pages/serve/bagCheck/index",
|
||||||
|
"pages/return/index",
|
||||||
|
"pages/order/success",
|
||||||
|
"pages/order/return-success"
|
||||||
|
],
|
||||||
|
"window": {
|
||||||
|
"navigationBarTextStyle": "black",
|
||||||
|
"navigationBarTitleText": "共享风扇",
|
||||||
|
"navigationBarBackgroundColor": "#F8F8F8",
|
||||||
|
"backgroundColor": "#F8F8F8"
|
||||||
|
},
|
||||||
|
"tabBar": {
|
||||||
|
"color": "#999999",
|
||||||
|
"selectedColor": "#1976D2",
|
||||||
|
"backgroundColor": "#ffffff",
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"pagePath": "pages/index/index",
|
||||||
|
"text": "首页",
|
||||||
|
"iconPath": "static/home.png",
|
||||||
|
"selectedIconPath": "static/home-active.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/my/index",
|
||||||
|
"text": "我的",
|
||||||
|
"iconPath": "static/user.png",
|
||||||
|
"selectedIconPath": "static/user-active.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";exports._imports_0="/static/scan-icon.png",exports._imports_0$1="/static/jl.png",exports._imports_1="/static/complaint.png",exports._imports_2="/static/hlep.png";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";const e=require("../common/vendor.js"),o=require("./url.js");exports.request=a=>new Promise(((t,d)=>{console.log(`发起请求: ${a.method} ${o.URL+a.url}`,a.data),e.index.request({url:o.URL+a.url,method:a.method,data:a.data,header:{"Content-Type":"application/x-www-form-urlencoded",...a.headers,appid:o.appid,Authorization:"Bearer "+e.index.getStorageSync("token"),Clientid:e.index.getStorageSync("client_id")},success:e=>(console.log(`请求响应: ${a.url}`,e),200!==e.statusCode?(console.error(`HTTP状态码错误: ${e.statusCode}`,e.data),e.data?void t(e.data):void d({msg:`请求失败,状态码:${e.statusCode}`})):e.data&&200!==e.data.code?(console.warn(`业务状态码错误: ${e.data.code}`,e.data),void t(e.data)):void t(e.data)),fail(e){console.error(`请求失败: ${a.url}`,e),d(e)}})}));
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";exports.URL="https://unifans.gxfs123.com",exports.appid="wxe752f45e7f7aa271";
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";const e=require("./http.js");exports.confirmPaymentAndRent=r=>(console.log(`确认支付并弹出充电宝, orderId: ${r}`),e.request({url:`/app/device/confirmPaymentAndRent?orderId=${r}`,method:"post"})),exports.getDeviceInfo=r=>e.request({url:`/app/device/${r}`,method:"get"}),exports.getMyIndexInfo=r=>e.request({url:"/app/user/userInfo",method:"get",data:r}),exports.getOrderList=r=>e.request({url:"/app/order/list",method:"get",data:r,hideLoading:!0}),exports.login=r=>e.request({url:"/app/user/login",method:"get",data:r}),exports.queryById=r=>(console.log(`查询订单详情, orderId: ${r}`),e.request({url:`/app/order/${r}`,method:"get",hideLoading:!0})),exports.queryHasOrder=r=>e.request({url:`/app/order/list?deviceNo=${r}&orderStatus=in_used`,method:"get"}),exports.rentPowerBank=(r,t)=>e.request({url:"/app/device/rentPowerBank",method:"post",data:{deviceNo:r,phone:t}});
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";exports.HELP_CONTENT={FAQ_LIST:[{question:"如何租借风扇?",answer:'点击首页"扫码租借"按钮,使用微信扫描设备上的二维码,按提示完成支付即可使用。'},{question:"收费标准是怎样的?",answer:"使用费用为2元/小时,不足1小时按1小时计算。押金99元,归还后自动退还。"},{question:"如何归还风扇?",answer:'将风扇带到任意归还点,点击首页"扫码归还"按钮,扫描归还点二维码即可完成归还。'},{question:"押金多久能退还?",answer:"归还设备后押金将自动发起退款,预计0-7个工作日到账。"},{question:"设备无法正常使用怎么办?",answer:'您可以通过"我的-投诉与建议"提交故障反馈,或直接拨打客服电话处理。'}],CONTACT:{TITLE:"联系客服",PHONE:{LABEL:"客服电话",VALUE:"400-888-8888"},SERVICE_TIME:{LABEL:"服务时间",VALUE:"周一至周日 09:00-22:00"}}};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";exports.OrderStatusMap={waiting_for_payment:{text:"待支付",class:"status-waiting"},payment_in_progress:{text:"支付中",class:"status-progress"},payment_successful:{text:"支付成功",class:"status-success"},in_used:{text:"使用中",class:"status-using"},payment_failed:{text:"支付失败",class:"status-failed"},order_cancelled:{text:"已取消",class:"status-cancelled"},used_done:{text:"已完成",class:"status-finished"}},exports.OrderStatusTabs=[{text:"全部",status:[]},{text:"待支付",status:["waiting_for_payment","payment_in_progress"]},{text:"使用中",status:["payment_successful","in_used"]},{text:"已完成",status:["used_done","payment_failed","order_cancelled"]}];
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";const t=require("../../common/vendor.js"),e={data:()=>({depositAmount:"99.00",records:[{type:"支付",time:"2024-03-20 15:30",amount:"99.00"},{type:"退还",time:"2024-03-19 12:00",amount:"99.00"}]}),methods:{handleWithdraw(){t.index.showModal({title:"确认提现",content:"押金将原路退回,预计0-7个工作日到账",success:e=>{e.confirm&&t.index.showToast({title:"提现申请已提交",icon:"success"})}})}}};const o=t._export_sfc(e,[["render",function(e,o,n,d,s,a){return{a:t.t(s.depositAmount),b:t.o(((...t)=>a.handleWithdraw&&a.handleWithdraw(...t))),c:t.f(s.records,((e,o,n)=>({a:t.t(e.type),b:t.t(e.time),c:t.t("退还"===e.type?"+":"-"),d:t.t(e.amount),e:t.n("退还"===e.type?"refund":""),f:o})))}}],["__scopeId","data-v-a3ef2e56"]]);wx.createPage(o);
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "押金管理",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<view class="deposit-container data-v-a3ef2e56"><view class="deposit-card data-v-a3ef2e56"><view class="title data-v-a3ef2e56">押金余额</view><view class="amount data-v-a3ef2e56">¥{{a}}</view><button class="withdraw-btn data-v-a3ef2e56" bindtap="{{b}}">提现</button></view><view class="notice-card data-v-a3ef2e56"><view class="notice-title data-v-a3ef2e56"><view class="dot data-v-a3ef2e56"></view><text class="data-v-a3ef2e56">提现说明</text></view><view class="notice-content data-v-a3ef2e56"><view class="notice-item data-v-a3ef2e56">1. 提现金额将原路退回支付账户</view><view class="notice-item data-v-a3ef2e56">2. 提现申请提交后预计0-7个工作日到账</view><view class="notice-item data-v-a3ef2e56">3. 如超时未收到,请联系客服处理</view></view></view><view class="record-card data-v-a3ef2e56"><view class="record-title data-v-a3ef2e56">押金记录</view><view class="record-list data-v-a3ef2e56"><view wx:for="{{c}}" wx:for-item="item" wx:key="f" class="record-item data-v-a3ef2e56"><view class="record-info data-v-a3ef2e56"><text class="record-type data-v-a3ef2e56">{{item.a}}</text><text class="record-time data-v-a3ef2e56">{{item.b}}</text></view><text class="{{['record-amount', 'data-v-a3ef2e56', item.e]}}">{{item.c}}¥{{item.d}}</text></view></view></view></view>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.deposit-container.data-v-a3ef2e56{min-height:100vh;background:#f8f8f8;padding:30rpx}.deposit-container .deposit-card.data-v-a3ef2e56{background:linear-gradient(135deg,#1976d2,#64b5f6);border-radius:20rpx;padding:40rpx;color:#fff;text-align:center;box-shadow:0 4rpx 20rpx rgba(25,118,210,.2)}.deposit-container .deposit-card .title.data-v-a3ef2e56{font-size:28rpx;opacity:.9;margin-bottom:20rpx}.deposit-container .deposit-card .amount.data-v-a3ef2e56{font-size:72rpx;font-weight:700;margin-bottom:40rpx}.deposit-container .deposit-card .withdraw-btn.data-v-a3ef2e56{background:#fff;color:#1976d2;width:80%;height:80rpx;line-height:80rpx;border-radius:40rpx;font-size:32rpx;font-weight:500;margin:0 auto}.deposit-container .deposit-card .withdraw-btn.data-v-a3ef2e56:active{transform:scale(.98)}.deposit-container .notice-card.data-v-a3ef2e56{margin-top:30rpx;background:#fff;border-radius:20rpx;padding:30rpx;box-shadow:0 4rpx 16rpx rgba(0,0,0,.04)}.deposit-container .notice-card .notice-title.data-v-a3ef2e56{display:flex;align-items:center;margin-bottom:20rpx}.deposit-container .notice-card .notice-title .dot.data-v-a3ef2e56{width:12rpx;height:12rpx;background:#1976d2;border-radius:50%;margin-right:10rpx}.deposit-container .notice-card .notice-title text.data-v-a3ef2e56{font-size:30rpx;font-weight:500;color:#333}.deposit-container .notice-card .notice-content .notice-item.data-v-a3ef2e56{font-size:26rpx;color:#666;line-height:1.8;padding-left:22rpx}.deposit-container .record-card.data-v-a3ef2e56{margin-top:30rpx;background:#fff;border-radius:20rpx;padding:30rpx;box-shadow:0 4rpx 16rpx rgba(0,0,0,.04)}.deposit-container .record-card .record-title.data-v-a3ef2e56{font-size:30rpx;font-weight:500;color:#333;margin-bottom:20rpx;border-left:8rpx solid #1976D2;padding-left:20rpx}.deposit-container .record-card .record-list .record-item.data-v-a3ef2e56{display:flex;justify-content:space-between;align-items:center;padding:20rpx 0;border-bottom:1rpx solid #f5f5f5}.deposit-container .record-card .record-list .record-item.data-v-a3ef2e56:last-child{border-bottom:none}.deposit-container .record-card .record-list .record-item .record-info .record-type.data-v-a3ef2e56{font-size:28rpx;color:#333;margin-bottom:6rpx;display:block}.deposit-container .record-card .record-list .record-item .record-info .record-time.data-v-a3ef2e56{font-size:24rpx;color:#999}.deposit-container .record-card .record-list .record-item .record-amount.data-v-a3ef2e56{font-size:32rpx;color:#333;font-weight:500}.deposit-container .record-card .record-list .record-item .record-amount.refund.data-v-a3ef2e56{color:#4caf50}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";const e=require("../../common/vendor.js"),t=require("../../config/user.js"),i={data:()=>({deviceInfo:{},deviceId:"",deviceLocation:"一号教学楼大厅",batteryLevel:95,hasActiveOrder:!1,deviceStatus:{text:"可使用",class:"available"},selectedPackage:1,packages:[{time:"1小时",price:"2.00",unitPrice:"2.00"},{time:"4小时",price:"6.00",unitPrice:"1.50"},{time:"12小时",price:"15.00",unitPrice:"1.25"}],isLoggedIn:!0,phoneNumber:""}),onLoad(e){this.deviceId=e.deviceNo,console.log(e.deviceNo),this.getDeviceInfo()},methods:{async getDeviceInfo(){const e=await t.getDeviceInfo(this.deviceId);200==e.code&&(this.deviceInfo=e.data)},showLoginTip(){e.index.showModal({title:"提示",content:"请先登录后再操作",confirmText:"去登录",success:t=>{t.confirm&&e.index.navigateTo({url:"/pages/login/index"})}})},selectPackage(e){this.selectedPackage=e},async checkOrderStatus(){try{(await this.$api.checkActiveOrder()).hasOrder&&e.index.redirectTo({url:`/pages/device/return?deviceId=${this.deviceId}`})}catch(t){e.index.showToast({title:"订单状态查询失败",icon:"none"})}},handleRent(){if(!this.isLoggedIn)return void this.showLoginTip();if(!this.phoneNumber)return void e.index.showToast({title:"请输入手机号码",icon:"none"});if(!/^1[3-9]\d{9}$/.test(this.phoneNumber))return void e.index.showToast({title:"请输入正确的手机号码",icon:"none"});const t=this.packages[this.selectedPackage];e.index.showModal({title:"确认租借",content:`确认支付押金¥99.00及${t.time}套餐费用¥${t.price}?`,success:e=>{e.confirm&&this.submitRentOrder()}})},async submitRentOrder(){try{e.index.showLoading({title:"处理中"});const i=this.packages[this.selectedPackage],c=await t.rentPowerBank(this.deviceId,this.phoneNumber);if(200!==c.code)throw new Error(c.msg||"设备租借失败");const n=c.data;e.index.hideLoading(),e.index.redirectTo({url:`/pages/order/payment?orderId=${n.orderId}&packageTime=${i.time}&packagePrice=${i.price}`})}catch(i){e.index.hideLoading(),e.index.showToast({title:i.message||"租借失败,请重试",icon:"none"})}}}};const c=e._export_sfc(i,[["render",function(t,i,c,n,a,r){return e.e({a:e.t(a.deviceId),b:e.t(a.deviceStatus.text),c:e.n(a.deviceStatus.class),d:e.t(a.deviceLocation),e:e.t(a.batteryLevel),f:!a.hasActiveOrder},a.hasActiveOrder?{}:{g:e.f(a.packages,((t,i,c)=>({a:e.t(t.time),b:e.t(t.price),c:e.t(t.unitPrice),d:i,e:a.selectedPackage===i?1:"",f:e.o((e=>r.selectPackage(i)),i)})))},{h:!a.hasActiveOrder},a.hasActiveOrder?{}:{i:a.phoneNumber,j:e.o((e=>a.phoneNumber=e.detail.value))},{k:!a.hasActiveOrder},(a.hasActiveOrder,{}),{l:e.t(a.hasActiveOrder?"归还设备":"立即租借"),m:e.n(a.hasActiveOrder?"return":"rent"),n:e.o(((...e)=>r.handleRent&&r.handleRent(...e)))})}],["__scopeId","data-v-b8e15e19"]]);wx.createPage(c);
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "设备详情",
|
||||||
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
|
"navigationBarTextStyle": "black",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<view class="detail-container data-v-b8e15e19"><view class="device-card data-v-b8e15e19"><view class="device-header data-v-b8e15e19"><view class="device-title data-v-b8e15e19"><text class="name data-v-b8e15e19">共享风扇</text><text class="id data-v-b8e15e19">设备号:{{a}}</text></view><view class="{{['status', 'data-v-b8e15e19', c]}}">{{b}}</view></view><view class="device-info data-v-b8e15e19"><view class="info-item data-v-b8e15e19"><text class="label data-v-b8e15e19">设备位置</text><text class="value data-v-b8e15e19">{{d}}</text></view><view class="info-item data-v-b8e15e19"><text class="label data-v-b8e15e19">电池电量</text><text class="value data-v-b8e15e19">{{e}}%</text></view></view></view><view wx:if="{{f}}" class="package-section data-v-b8e15e19"><view class="section-title data-v-b8e15e19">选择套餐</view><view class="package-list data-v-b8e15e19"><view wx:for="{{g}}" wx:for-item="pkg" wx:key="d" class="{{['package-item', 'data-v-b8e15e19', pkg.e && 'active']}}" bindtap="{{pkg.f}}"><view class="package-content data-v-b8e15e19"><text class="time data-v-b8e15e19">{{pkg.a}}</text><text class="price data-v-b8e15e19">¥{{pkg.b}}</text></view><text class="unit-price data-v-b8e15e19">约{{pkg.c}}元/小时</text></view></view></view><view wx:if="{{h}}" class="phone-section data-v-b8e15e19"><view class="section-title data-v-b8e15e19">联系方式</view><view class="phone-input-wrap data-v-b8e15e19"><input type="number" class="phone-input data-v-b8e15e19" maxlength="11" placeholder="请输入手机号码" value="{{i}}" bindinput="{{j}}"/></view></view><view class="notice-section data-v-b8e15e19"><view class="section-title data-v-b8e15e19">使用说明</view><view class="notice-list data-v-b8e15e19"><view class="notice-item data-v-b8e15e19"><view class="dot data-v-b8e15e19"></view><text class="data-v-b8e15e19">请在使用前检查设备是否完好</text></view><view class="notice-item data-v-b8e15e19"><view class="dot data-v-b8e15e19"></view><text class="data-v-b8e15e19">超出使用时间将自动按小时计费</text></view><view class="notice-item data-v-b8e15e19"><view class="dot data-v-b8e15e19"></view><text class="data-v-b8e15e19">请在指定区域内使用设备</text></view></view></view><view class="bottom-bar data-v-b8e15e19"><view wx:if="{{k}}" class="price-info data-v-b8e15e19"><text class="deposit-text data-v-b8e15e19">押金:</text><text class="deposit-amount data-v-b8e15e19">¥99</text></view><button class="{{['action-btn', 'data-v-b8e15e19', m]}}" bindtap="{{n}}">{{l}}</button></view></view>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";const e=require("../../common/vendor.js"),t={data:()=>({types:["设备故障","收费问题","使用建议","其他"],selectedType:-1,description:"",images:[],contact:""}),methods:{selectType(e){this.selectedType=e},chooseImage(){e.index.chooseImage({count:3-this.images.length,success:e=>{this.images=[...this.images,...e.tempFilePaths]}})},deleteImage(e){this.images.splice(e,1)},submitFeedback(){-1!==this.selectedType?this.description.trim()?this.contact?e.index.showToast({title:"提交成功",icon:"success"}):e.index.showToast({title:"请留下联系方式",icon:"none"}):e.index.showToast({title:"请描述您的问题",icon:"none"}):e.index.showToast({title:"请选择问题类型",icon:"none"})}}};const s=e._export_sfc(t,[["render",function(t,s,i,c,o,a){return e.e({a:e.f(o.types,((t,s,i)=>({a:e.t(t),b:s,c:o.selectedType===s?1:"",d:e.o((e=>a.selectType(s)),s)}))),b:o.description,c:e.o((e=>o.description=e.detail.value)),d:e.t(o.description.length),e:e.f(o.images,((t,s,i)=>({a:t,b:e.o((e=>a.deleteImage(s)),s),c:s}))),f:o.images.length<3},o.images.length<3?{g:e.o(((...e)=>a.chooseImage&&a.chooseImage(...e)))}:{},{h:o.contact,i:e.o((e=>o.contact=e.detail.value)),j:e.o(((...e)=>a.submitFeedback&&a.submitFeedback(...e)))})}],["__scopeId","data-v-229c69af"]]);wx.createPage(s);
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "投诉与建议",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<view class="feedback-container data-v-229c69af"><view class="type-section data-v-229c69af"><view class="section-title data-v-229c69af">问题类型</view><view class="type-grid data-v-229c69af"><view wx:for="{{a}}" wx:for-item="type" wx:key="b" class="{{['type-item', 'data-v-229c69af', type.c && 'active']}}" bindtap="{{type.d}}">{{type.a}}</view></view></view><view class="description-section data-v-229c69af"><view class="section-title data-v-229c69af">问题描述</view><block wx:if="{{r0}}"><textarea class="description-input data-v-229c69af" placeholder="请详细描述您遇到的问题,以便我们更好地为您解决" maxlength="500" value="{{b}}" bindinput="{{c}}"/></block><view class="word-count data-v-229c69af">{{d}}/500</view></view><view class="upload-section data-v-229c69af"><view class="section-title data-v-229c69af">图片上传(选填)</view><view class="upload-grid data-v-229c69af"><view wx:for="{{e}}" wx:for-item="img" wx:key="c" class="upload-item data-v-229c69af"><image class="data-v-229c69af" src="{{img.a}}" mode="aspectFill"/><view class="delete-btn data-v-229c69af" bindtap="{{img.b}}">×</view></view><view wx:if="{{f}}" class="upload-btn data-v-229c69af" bindtap="{{g}}"><text class="plus data-v-229c69af">+</text><text class="tip data-v-229c69af">上传图片</text></view></view></view><view class="contact-section data-v-229c69af"><view class="section-title data-v-229c69af">联系方式</view><input class="contact-input data-v-229c69af" placeholder="请留下您的手机号,方便我们联系您" type="number" maxlength="11" value="{{h}}" bindinput="{{i}}"/></view><view class="submit-section data-v-229c69af"><button class="submit-btn data-v-229c69af" bindtap="{{j}}">提交反馈</button></view></view>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.feedback-container.data-v-229c69af{min-height:100vh;background:#f8f8f8;padding:30rpx}.feedback-container .section-title.data-v-229c69af{font-size:30rpx;color:#333;font-weight:500;margin-bottom:20rpx}.feedback-container .type-section.data-v-229c69af{background:#fff;border-radius:20rpx;padding:30rpx;margin-bottom:20rpx}.feedback-container .type-section .type-grid.data-v-229c69af{display:flex;flex-wrap:wrap;margin:0 -10rpx}.feedback-container .type-section .type-grid .type-item.data-v-229c69af{width:calc(50% - 20rpx);margin:10rpx;height:80rpx;display:flex;align-items:center;justify-content:center;background:#f5f5f5;border-radius:10rpx;font-size:28rpx;color:#666;transition:all .3s}.feedback-container .type-section .type-grid .type-item.active.data-v-229c69af{background:#e3f2fd;color:#1976d2}.feedback-container .description-section.data-v-229c69af{background:#fff;border-radius:20rpx;padding:30rpx;margin-bottom:20rpx}.feedback-container .description-section .description-input.data-v-229c69af{width:100%;height:240rpx;background:#f8f8f8;border-radius:10rpx;padding:20rpx;font-size:28rpx;color:#333;box-sizing:border-box}.feedback-container .description-section .word-count.data-v-229c69af{text-align:right;font-size:24rpx;color:#999;margin-top:10rpx}.feedback-container .upload-section.data-v-229c69af{background:#fff;border-radius:20rpx;padding:30rpx;margin-bottom:20rpx}.feedback-container .upload-section .upload-grid.data-v-229c69af{display:flex;flex-wrap:wrap}.feedback-container .upload-section .upload-grid .upload-item.data-v-229c69af{width:200rpx;height:200rpx;margin-right:20rpx;margin-bottom:20rpx;position:relative}.feedback-container .upload-section .upload-grid .upload-item image.data-v-229c69af{width:100%;height:100%;border-radius:10rpx}.feedback-container .upload-section .upload-grid .upload-item .delete-btn.data-v-229c69af{position:absolute;right:-10rpx;top:-10rpx;width:40rpx;height:40rpx;background:rgba(0,0,0,.5);color:#fff;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:32rpx}.feedback-container .upload-section .upload-grid .upload-btn.data-v-229c69af{width:200rpx;height:200rpx;background:#f5f5f5;border-radius:10rpx;display:flex;flex-direction:column;align-items:center;justify-content:center;color:#999}.feedback-container .upload-section .upload-grid .upload-btn .plus.data-v-229c69af{font-size:60rpx;line-height:1;margin-bottom:10rpx}.feedback-container .upload-section .upload-grid .upload-btn .tip.data-v-229c69af{font-size:24rpx}.feedback-container .contact-section.data-v-229c69af{background:#fff;border-radius:20rpx;padding:30rpx;margin-bottom:40rpx}.feedback-container .contact-section .contact-input.data-v-229c69af{width:100%;height:80rpx;background:#f8f8f8;border-radius:10rpx;padding:0 20rpx;font-size:28rpx;color:#333;box-sizing:border-box}.feedback-container .submit-section.data-v-229c69af{padding:0 40rpx}.feedback-container .submit-section .submit-btn.data-v-229c69af{width:100%;height:88rpx;background:#1976d2;color:#fff;border-radius:44rpx;font-size:32rpx;font-weight:500;display:flex;align-items:center;justify-content:center}.feedback-container .submit-section .submit-btn.data-v-229c69af:active{transform:scale(.98)}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";const e=require("../../common/vendor.js"),T=require("../../constants/help.js"),E={data:()=>({HELP_CONTENT:T.HELP_CONTENT,faqList:T.HELP_CONTENT.FAQ_LIST.map((e=>({...e,isOpen:!1})))}),methods:{toggleFaq(e){this.faqList[e].isOpen=!this.faqList[e].isOpen},makePhoneCall(){e.index.makePhoneCall({phoneNumber:T.HELP_CONTENT.CONTACT.PHONE.VALUE})}}};const t=e._export_sfc(E,[["render",function(T,E,t,N,C,a){return{a:e.f(C.faqList,((T,E,t)=>({a:e.t(T.question),b:T.isOpen?1:"",c:e.t(T.answer),d:T.isOpen,e:E,f:e.o((e=>a.toggleFaq(E)),E)}))),b:e.t(C.HELP_CONTENT.CONTACT.TITLE),c:e.t(C.HELP_CONTENT.CONTACT.PHONE.LABEL),d:e.t(C.HELP_CONTENT.CONTACT.PHONE.VALUE),e:e.o(((...e)=>a.makePhoneCall&&a.makePhoneCall(...e))),f:e.t(C.HELP_CONTENT.CONTACT.SERVICE_TIME.LABEL),g:e.t(C.HELP_CONTENT.CONTACT.SERVICE_TIME.VALUE)}}],["__scopeId","data-v-8f1810be"]]);wx.createPage(t);
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "帮助中心",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<view class="help-container data-v-8f1810be"><view class="faq-list data-v-8f1810be"><view wx:for="{{a}}" wx:for-item="item" wx:key="e" class="faq-item data-v-8f1810be" bindtap="{{item.f}}"><view class="faq-header data-v-8f1810be"><text class="question data-v-8f1810be">{{item.a}}</text><view class="{{['arrow', 'data-v-8f1810be', item.b && 'open']}}"></view></view><view class="answer data-v-8f1810be" hidden="{{!item.d}}">{{item.c}}</view></view></view><view class="contact-card data-v-8f1810be"><view class="contact-title data-v-8f1810be">{{b}}</view><view class="contact-content data-v-8f1810be"><view class="contact-item data-v-8f1810be"><text class="label data-v-8f1810be">{{c}}</text><text class="value data-v-8f1810be" bindtap="{{e}}">{{d}}</text></view><view class="contact-item data-v-8f1810be"><text class="label data-v-8f1810be">{{f}}</text><text class="value data-v-8f1810be">{{g}}</text></view></view></view></view>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.help-container.data-v-8f1810be{min-height:100vh;background:#f8f8f8;padding:30rpx}.help-container .faq-list.data-v-8f1810be{background:#fff;border-radius:20rpx;padding:20rpx;margin-bottom:30rpx;box-shadow:0 4rpx 16rpx rgba(0,0,0,.04)}.help-container .faq-list .faq-item.data-v-8f1810be{border-bottom:1rpx solid #f5f5f5}.help-container .faq-list .faq-item.data-v-8f1810be:last-child{border-bottom:none}.help-container .faq-list .faq-item .faq-header.data-v-8f1810be{display:flex;justify-content:space-between;align-items:center;padding:30rpx 20rpx}.help-container .faq-list .faq-item .faq-header .question.data-v-8f1810be{font-size:30rpx;color:#333;flex:1;padding-right:20rpx}.help-container .faq-list .faq-item .faq-header .arrow.data-v-8f1810be{width:16rpx;height:16rpx;border-right:4rpx solid #999;border-bottom:4rpx solid #999;transform:rotate(45deg);transition:all .3s}.help-container .faq-list .faq-item .faq-header .arrow.open.data-v-8f1810be{transform:rotate(-135deg)}.help-container .faq-list .faq-item .answer.data-v-8f1810be{font-size:28rpx;color:#666;line-height:1.6;padding:0 20rpx 30rpx;background:#f9f9f9;border-radius:10rpx;margin:0 20rpx 20rpx}.help-container .contact-card.data-v-8f1810be{background:#fff;border-radius:20rpx;padding:30rpx;box-shadow:0 4rpx 16rpx rgba(0,0,0,.04)}.help-container .contact-card .contact-title.data-v-8f1810be{font-size:32rpx;color:#333;font-weight:500;margin-bottom:20rpx;border-left:8rpx solid #1976D2;padding-left:20rpx}.help-container .contact-card .contact-content .contact-item.data-v-8f1810be{display:flex;justify-content:space-between;align-items:center;padding:20rpx 0}.help-container .contact-card .contact-content .contact-item .label.data-v-8f1810be{font-size:28rpx;color:#666}.help-container .contact-card .contact-content .contact-item .value.data-v-8f1810be{font-size:28rpx;color:#333;font-weight:500}.help-container .contact-card .contact-content .contact-item .value.data-v-8f1810be:active{opacity:.7}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";const e=require("../../common/vendor.js"),o=require("../../util/index.js"),t=require("../../config/url.js"),n=require("../../common/assets.js"),a={methods:{async handleScan(){try{const n=await new Promise(((o,t)=>{e.index.scanCode({success:o,fail:t})}));let a=o.getQueryString(n.path,"deviceNo");if(console.log("扫码路径:",n.path),console.log("解析到的设备号:",a),!a)return void e.index.showToast({title:"无效的设备二维码",icon:"none"});e.index.getStorageSync("token")||await o.wxLogin();const d=await e.index.request({url:`${t.URL||"http://127.0.0.1:8080"}/app/order/inUse`,method:"GET",header:{Authorization:"Bearer "+e.index.getStorageSync("token"),Clientid:e.index.getStorageSync("client_id")}});if(console.log("使用中订单检查结果:",JSON.stringify(d)),200==d.statusCode&&200==d.data.code&&d.data.data){const o=d.data.data;return console.log("检测到使用中订单,准备跳转:",o),e.index.reLaunch({url:`/pages/return/index?orderId=${o.orderId}&deviceId=${a||o.deviceNo}`}),void console.log("已发起页面跳转")}const i=await e.index.request({url:`${t.URL||"http://127.0.0.1:8080"}/app/order/unpaid`,method:"GET",header:{Authorization:"Bearer "+e.index.getStorageSync("token"),Clientid:e.index.getStorageSync("client_id")}});if(console.log("待支付订单检查结果:",JSON.stringify(i)),200==i.statusCode&&200==i.data.code&&i.data.data){const o=i.data.data;console.log("检测到待支付订单,准备跳转:",o),e.index.navigateTo({url:`/pages/order/payment?orderId=${o.orderId}`})}else console.log("无待支付订单,直接跳转到设备详情页面, deviceNo:",a),e.index.navigateTo({url:`/pages/device/detail?deviceNo=${a}`})}catch(n){console.error("扫码处理失败:",n),e.index.showToast({title:"扫码失败",icon:"none"})}}}};const d=e._export_sfc(a,[["render",function(o,t,a,d,i,r){return{a:n._imports_0,b:e.o(((...e)=>r.handleScan&&r.handleScan(...e)))}}],["__scopeId","data-v-8df762f3"]]);wx.createPage(d);
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "共享风扇",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<view class="container data-v-8df762f3"><view class="banner data-v-8df762f3"><view class="temp-banner data-v-8df762f3"><text class="banner-text data-v-8df762f3">共享风扇</text><text class="banner-subtitle data-v-8df762f3">让清凉随身携带</text><view class="banner-bg data-v-8df762f3"></view></view></view><view class="scan-area data-v-8df762f3"><view class="scan-btn data-v-8df762f3" bindtap="{{b}}"><view class="btn-content data-v-8df762f3"><image class="btn-icon data-v-8df762f3" src="{{a}}" mode="aspectFit"/><text class="btn-text data-v-8df762f3">扫一扫</text></view><text class="btn-desc data-v-8df762f3">扫描设备二维码使用或归还</text></view></view><view class="tips-section data-v-8df762f3"><view class="tips-header data-v-8df762f3"><view class="tips-title data-v-8df762f3">使用小贴士</view></view><view class="tips-list data-v-8df762f3"><view class="tip-item data-v-8df762f3"><view class="tip-dot data-v-8df762f3"></view><text class="data-v-8df762f3">租借时间:每次最长可租借12小时</text></view><view class="tip-item data-v-8df762f3"><view class="tip-dot data-v-8df762f3"></view><text class="data-v-8df762f3">押金说明:租借需支付99元押金,归还后自动退还</text></view><view class="tip-item data-v-8df762f3"><view class="tip-dot data-v-8df762f3"></view><text class="data-v-8df762f3">收费标准:2元/小时,不足1小时按1小时计算</text></view><view class="tip-item data-v-8df762f3"><view class="tip-dot data-v-8df762f3"></view><text class="data-v-8df762f3">爱护提示:请勿将设备带离指定区域,保持设备清洁</text></view></view></view></view>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.container.data-v-8df762f3{height:87.5vh;background:#f8f8f8;padding-bottom:40rpx}.container .banner.data-v-8df762f3{padding:30rpx}.container .banner .temp-banner.data-v-8df762f3{height:300rpx;background:linear-gradient(135deg,#1976d2,#42a5f5);border-radius:30rpx;position:relative;overflow:hidden;display:flex;flex-direction:column;justify-content:center;align-items:center;color:#fff;box-shadow:0 8rpx 32rpx rgba(25,118,210,.2)}.container .banner .temp-banner .banner-text.data-v-8df762f3{font-size:56rpx;font-weight:700;margin-bottom:20rpx;position:relative;z-index:1;text-shadow:0 2rpx 4rpx rgba(0,0,0,.1)}.container .banner .temp-banner .banner-subtitle.data-v-8df762f3{font-size:32rpx;opacity:.95;position:relative;z-index:1;text-shadow:0 2rpx 4rpx rgba(0,0,0,.1)}.container .banner .temp-banner .banner-bg.data-v-8df762f3{position:absolute;right:-60rpx;bottom:-60rpx;width:300rpx;height:300rpx;background:rgba(255,255,255,.1);border-radius:50%;transform:rotate(-15deg)}.container .banner .temp-banner.data-v-8df762f3:after{content:"";position:absolute;left:-80rpx;top:-80rpx;width:240rpx;height:240rpx;background:rgba(255,255,255,.08);border-radius:50%}.container .scan-area.data-v-8df762f3{padding:20rpx 30rpx 40rpx;display:flex;justify-content:center}.container .scan-area .scan-btn.data-v-8df762f3{width:460rpx;height:200rpx;display:flex;flex-direction:column;align-items:center;justify-content:center;background:linear-gradient(135deg,#00c853,#69f0ae);border-radius:30rpx;box-shadow:0 8rpx 32rpx rgba(0,200,83,.2);transition:all .3s ease;position:relative;overflow:hidden}.container .scan-area .scan-btn.data-v-8df762f3:active{transform:scale(.98);box-shadow:0 4rpx 16rpx rgba(0,200,83,.15)}.container .scan-area .scan-btn.data-v-8df762f3:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(rgba(255,255,255,.1),transparent)}.container .scan-area .scan-btn .btn-content.data-v-8df762f3{display:flex;align-items:center;justify-content:center;margin-bottom:12rpx;position:relative;z-index:1}.container .scan-area .scan-btn .btn-content .btn-icon.data-v-8df762f3{width:48rpx;height:48rpx;margin-right:16rpx}.container .scan-area .scan-btn .btn-content .btn-text.data-v-8df762f3{font-size:42rpx;font-weight:600;color:#fff;text-shadow:0 2rpx 4rpx rgba(0,0,0,.1)}.container .scan-area .scan-btn .btn-desc.data-v-8df762f3{font-size:26rpx;color:rgba(255,255,255,.95);position:relative;z-index:1}.container .tips-section.data-v-8df762f3{margin:0 30rpx;background:#fff;border-radius:24rpx;box-shadow:0 8rpx 32rpx rgba(0,0,0,.05);overflow:hidden}.container .tips-section .tips-header.data-v-8df762f3{padding:30rpx;background:linear-gradient(to right,#f5f9ff,#fff);border-bottom:2rpx solid #f0f0f0}.container .tips-section .tips-header .tips-title.data-v-8df762f3{font-size:32rpx;font-weight:600;color:#333;position:relative;padding-left:24rpx}.container .tips-section .tips-header .tips-title.data-v-8df762f3:before{content:"";position:absolute;left:0;top:50%;transform:translateY(-50%);width:8rpx;height:32rpx;background:#1976d2;border-radius:4rpx}.container .tips-section .tips-list.data-v-8df762f3{padding:20rpx 30rpx}.container .tips-section .tips-list .tip-item.data-v-8df762f3{display:flex;align-items:center;margin-bottom:24rpx;padding:0 10rpx}.container .tips-section .tips-list .tip-item.data-v-8df762f3:last-child{margin-bottom:0}.container .tips-section .tips-list .tip-item .tip-dot.data-v-8df762f3{width:12rpx;height:12rpx;background:#1976d2;border-radius:50%;margin-right:16rpx;flex-shrink:0;box-shadow:0 2rpx 6rpx rgba(25,118,210,.2)}.container .tips-section .tips-list .tip-item text.data-v-8df762f3{font-size:28rpx;color:#666;line-height:1.6}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";const e=require("../../common/vendor.js"),o=require("../../util/index.js"),t=require("../../common/assets.js"),n={data:()=>({userInfo:{},deposit:"0.00",tempAvatar:"",tempNickname:"",show:!1}),onShow(){this.getInfo()},methods:{async getInfo(){try{if(!e.index.getStorageSync("token"))return await o.wxLogin(),void this.getInfo();const t=await o.getUserInfo();if(console.log(t),200===t.code){const o={nickName:t.data.nickname,phone:t.data.phone,avatar:t.data.iconUrl,isAdmin:t.data.isAdmin};this.userInfo=o,e.index.setStorageSync("userInfo",o),this.deposit=t.data.balanceAmount||"0.00"}}catch(t){console.error("获取用户信息失败:",t),e.index.showToast({title:"获取用户信息失败",icon:"none"})}},navigateTo(o){e.index.navigateTo({url:o})}}};const a=e._export_sfc(n,[["render",function(o,n,a,s,i,r){return e.e({a:i.userInfo.avatar||"/static/user.png",b:i.userInfo},i.userInfo?{c:e.t(i.userInfo.nickName),d:e.t(i.userInfo.phone||"")}:{},{e:e.o(((...e)=>o.showPopup&&o.showPopup(...e))),f:e.t(i.deposit),g:e.o((e=>r.navigateTo("/pages/deposit/index"))),h:t._imports_0$1,i:e.o((e=>r.navigateTo("/pages/order/index"))),j:t._imports_1,k:e.o((e=>r.navigateTo("/pages/feedback/index"))),l:t._imports_2,m:e.o((e=>r.navigateTo("/pages/help/index")))})}],["__scopeId","data-v-b106ba06"]]);wx.createPage(a);
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "个人中心",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<view class="my-container data-v-b106ba06"><view class="user-info data-v-b106ba06"><view class="floating-dots data-v-b106ba06"></view><view class="user-info-content data-v-b106ba06" bindtap="{{e}}"><view class="avatar-wrap data-v-b106ba06"><image class="avatar data-v-b106ba06" src="{{a}}" mode="aspectFill"/></view><view wx:if="{{b}}" class="info-content data-v-b106ba06"><view class="text-group data-v-b106ba06"><text class="nickname data-v-b106ba06">{{c}}</text><text class="phone data-v-b106ba06">{{d}}</text></view></view><view wx:else class="info-content not-login data-v-b106ba06"><text class="login-text data-v-b106ba06">点击登录</text><text class="login-desc data-v-b106ba06">登录后享受更多服务</text></view></view><view class="wave-decoration data-v-b106ba06"></view></view><view class="balance-card data-v-b106ba06"><view class="balance-content data-v-b106ba06"><text class="label data-v-b106ba06">押金余额</text><text class="amount data-v-b106ba06">¥{{f}}</text></view><view class="withdraw-btn data-v-b106ba06" bindtap="{{g}}"> 提现 <view class="arrow data-v-b106ba06"></view></view></view><view class="function-list data-v-b106ba06"><view class="function-item data-v-b106ba06" bindtap="{{i}}"><view class="item-left data-v-b106ba06"><view class="icon-wrap order data-v-b106ba06"><image src="{{h}}" mode="aspectFit" class="icon-image data-v-b106ba06"/></view><text class="title data-v-b106ba06">租借记录</text></view><view class="arrow data-v-b106ba06"></view></view><view class="function-item data-v-b106ba06" bindtap="{{k}}"><view class="item-left data-v-b106ba06"><view class="icon-wrap feedback data-v-b106ba06"><image src="{{j}}" mode="aspectFit" class="icon-image data-v-b106ba06"/></view><text class="title data-v-b106ba06">投诉与建议</text></view><view class="arrow data-v-b106ba06"></view></view><view class="function-item data-v-b106ba06" bindtap="{{m}}"><view class="item-left data-v-b106ba06"><view class="icon-wrap help data-v-b106ba06"><image src="{{l}}" mode="aspectFit" class="icon-image data-v-b106ba06"/></view><text class="title data-v-b106ba06">帮助中心</text></view><view class="arrow data-v-b106ba06"></view></view></view></view>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";const t=require("../../common/vendor.js"),e=require("../../config/user.js"),r=require("../../constants/orderStatus.js"),s={data:()=>({currentTab:0,OrderStatusMap:r.OrderStatusMap,OrderStatusTabs:r.OrderStatusTabs,orderList:[]}),async onLoad(t){if(t&&t.orderId)try{const r=await e.queryById(t.orderId);if(200===r.code&&r.data){const t=r.data;console.log("特定订单数据:",JSON.stringify(t)),console.log("特定订单的开始时间:",t.startTime),console.log("特定订单的创建时间:",t.createTime);const e=t.startTime||t.createTime||"";console.log("特定订单最终显示的开始时间:",e);const s={orderNo:t.orderId,status:t.orderStatus,deviceId:t.deviceNo,startTime:e,endTime:t.endTime||"",amount:t.payAmount||t.actualDeviceAmount||"0.00"};this.orderList=[s,...this.orderList];const o=this.OrderStatusTabs.findIndex((e=>e.status.includes(t.orderStatus)));-1!==o&&this.switchTab(o)}}catch(r){console.error("获取订单详情失败:",r)}await this.getOrderList()},methods:{async getOrderList(r=[]){try{const t=await e.getOrderList(r);200===t.code&&t.data&&t.data.records&&(console.log("API返回的订单列表数据:",JSON.stringify(t.data.records)),this.orderList=t.data.records.map((t=>{console.log(`订单 ${t.orderId} 的开始时间:`,t.startTime),console.log(`订单 ${t.orderId} 的创建时间:`,t.createTime);const e=t.startTime||t.createTime||"";return console.log(`订单 ${t.orderId} 最终显示的开始时间:`,e),{orderNo:t.orderId,status:t.orderStatus,deviceId:t.deviceNo,startTime:e,endTime:t.endTime||"",amount:t.payAmount||t.actualDeviceAmount||"0.00"}})))}catch(s){console.error("获取订单列表失败:",s),t.index.showToast({title:"获取订单列表失败",icon:"none"})}},async switchTab(t){this.currentTab=t;const e=this.OrderStatusTabs[t].status;await this.getOrderList(e)}}};const o=t._export_sfc(s,[["render",function(e,r,s,o,a,d){return t.e({a:t.f(a.OrderStatusTabs,((e,r,s)=>({a:t.t(e.text),b:r,c:a.currentTab===r?1:"",d:t.o((t=>d.switchTab(r)),r)}))),b:t.f(a.orderList,((e,r,s)=>{var o,d;return t.e({a:t.t(e.orderNo),b:t.t(null==(o=a.OrderStatusMap[e.status])?void 0:o.text),c:t.n(null==(d=a.OrderStatusMap[e.status])?void 0:d.class),d:1===e.status},1===e.status?{e:`/pages/return/index?deviceId=${e.deviceId}&orderId=${e.orderNo}`}:{},{f:t.t(e.deviceId),g:t.t(e.startTime),h:t.t(e.endTime||"-"),i:t.t(e.amount),j:r})})),c:0===a.orderList.length},(a.orderList.length,{}))}],["__scopeId","data-v-d5ec5c8e"]]);wx.createPage(o);
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "租借记录",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<view class="order-container data-v-d5ec5c8e"><view class="tab-bar data-v-d5ec5c8e"><view wx:for="{{a}}" wx:for-item="tab" wx:key="b" class="{{['tab-item', 'data-v-d5ec5c8e', tab.c && 'active']}}" bindtap="{{tab.d}}">{{tab.a}}</view></view><view class="order-list data-v-d5ec5c8e"><view wx:for="{{b}}" wx:for-item="order" wx:key="j" class="order-item data-v-d5ec5c8e"><view class="order-header data-v-d5ec5c8e"><text class="order-no data-v-d5ec5c8e">订单号:{{order.a}}</text><text class="{{['order-status', 'data-v-d5ec5c8e', order.c]}}">{{order.b}}</text><navigator wx:if="{{order.d}}" url="{{order.e}}" class="return-btn data-v-d5ec5c8e">归还设备</navigator></view><view class="order-content data-v-d5ec5c8e"><view class="device-info data-v-d5ec5c8e"><text class="device-name data-v-d5ec5c8e">共享风扇</text><text class="device-id data-v-d5ec5c8e">设备号:{{order.f}}</text></view><view class="time-info data-v-d5ec5c8e"><view class="time-item data-v-d5ec5c8e"><text class="label data-v-d5ec5c8e">开始时间:</text><text class="value data-v-d5ec5c8e">{{order.g}}</text></view><view class="time-item data-v-d5ec5c8e"><text class="label data-v-d5ec5c8e">结束时间:</text><text class="value data-v-d5ec5c8e">{{order.h}}</text></view></view><view class="price-info data-v-d5ec5c8e"><text class="amount data-v-d5ec5c8e">¥{{order.i}}</text></view></view></view></view><view wx:if="{{c}}" class="empty-tip data-v-d5ec5c8e"><view class="empty-icon data-v-d5ec5c8e"></view><text class="data-v-d5ec5c8e">暂无订单记录</text></view></view>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.order-container.data-v-d5ec5c8e{min-height:100vh;background:#f8f8f8}.order-container .tab-bar.data-v-d5ec5c8e{display:flex;background:#fff;padding:20rpx 0;position:-webkit-sticky;position:sticky;top:0;z-index:100;box-shadow:0 2rpx 10rpx rgba(0,0,0,.05)}.order-container .tab-bar .tab-item.data-v-d5ec5c8e{flex:1;text-align:center;font-size:28rpx;color:#666;position:relative;padding:20rpx 0}.order-container .tab-bar .tab-item.active.data-v-d5ec5c8e{color:#1976d2;font-weight:500}.order-container .tab-bar .tab-item.active.data-v-d5ec5c8e:after{content:"";position:absolute;bottom:0;left:50%;transform:translate(-50%);width:40rpx;height:4rpx;background:#1976d2;border-radius:2rpx}.order-container .order-list.data-v-d5ec5c8e{padding:20rpx}.order-container .order-list .order-item.data-v-d5ec5c8e{background:#fff;border-radius:20rpx;margin-bottom:20rpx;padding:30rpx;box-shadow:0 4rpx 16rpx rgba(0,0,0,.04)}.order-container .order-list .order-item .order-header.data-v-d5ec5c8e{display:flex;justify-content:space-between;align-items:center;padding-bottom:20rpx;border-bottom:1rpx solid #f5f5f5}.order-container .order-list .order-item .order-header .order-no.data-v-d5ec5c8e{font-size:26rpx;color:#666}.order-container .order-list .order-item .order-header .order-status.data-v-d5ec5c8e{font-size:26rpx}.order-container .order-list .order-item .order-header .order-status.status-waiting.data-v-d5ec5c8e{color:#ff9800}.order-container .order-list .order-item .order-header .order-status.status-progress.data-v-d5ec5c8e{color:#2196f3}.order-container .order-list .order-item .order-header .order-status.status-success.data-v-d5ec5c8e{color:#4caf50}.order-container .order-list .order-item .order-header .order-status.status-using.data-v-d5ec5c8e{color:#1976d2}.order-container .order-list .order-item .order-header .order-status.status-failed.data-v-d5ec5c8e{color:#f44336}.order-container .order-list .order-item .order-header .order-status.status-cancelled.data-v-d5ec5c8e{color:#9e9e9e}.order-container .order-list .order-item .order-header .order-status.status-finished.data-v-d5ec5c8e{color:#4caf50}.order-container .order-list .order-item .order-content.data-v-d5ec5c8e{padding-top:20rpx}.order-container .order-list .order-item .order-content .device-info.data-v-d5ec5c8e{margin-bottom:20rpx}.order-container .order-list .order-item .order-content .device-info .device-name.data-v-d5ec5c8e{font-size:32rpx;color:#333;font-weight:500;margin-right:20rpx}.order-container .order-list .order-item .order-content .device-info .device-id.data-v-d5ec5c8e{font-size:26rpx;color:#999}.order-container .order-list .order-item .order-content .time-info .time-item.data-v-d5ec5c8e{font-size:26rpx;color:#666;margin-bottom:10rpx}.order-container .order-list .order-item .order-content .time-info .time-item .label.data-v-d5ec5c8e{color:#999}.order-container .order-list .order-item .order-content .price-info.data-v-d5ec5c8e{text-align:right;margin-top:20rpx}.order-container .order-list .order-item .order-content .price-info .amount.data-v-d5ec5c8e{font-size:36rpx;color:#ff9800;font-weight:500}.order-container .empty-tip.data-v-d5ec5c8e{padding:100rpx 0;text-align:center;color:#999;font-size:28rpx}.order-container .empty-tip .empty-icon.data-v-d5ec5c8e{width:200rpx;height:200rpx;margin:0 auto 20rpx;background:#f0f0f0;border-radius:50%}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";const e=require("../../common/vendor.js"),t=require("../../config/user.js"),o=require("../../config/url.js"),r={data:()=>({orderId:null,orderInfo:{},packageInfo:{time:"",price:"0.00"},orderStatus:{text:"等待支付",desc:"请在15分钟内完成支付",class:"waiting"},paymentMethods:[{name:"微信支付",icon:"wechat"},{name:"支付宝",icon:"alipay"}],selectedMethod:0}),computed:{totalAmount(){return(parseFloat(this.orderInfo.deposit||99)+parseFloat(this.orderInfo.amount||this.packageInfo.price||0)).toFixed(2)}},onLoad(t){t&&t.orderId?(this.orderId=t.orderId,t.packageTime&&t.packagePrice&&(this.packageInfo={time:t.packageTime,price:t.packagePrice}),this.loadOrderInfo()):(e.index.showToast({title:"订单信息不存在",icon:"none"}),setTimeout((()=>{e.index.redirectTo({url:"/pages/index/index"})}),1500))},methods:{async loadOrderInfo(){try{e.index.showLoading({title:"加载中"});const o=await t.queryById(this.orderId);if(200!==o.code||!o.data)throw new Error("获取订单信息失败");{const e=o.data;this.orderInfo={orderNo:e.orderNo||e.orderId,deviceNo:e.deviceNo,createTime:this.formatTime(new Date(e.createTime)),phone:e.phone,deposit:"99.00",amount:e.amount||this.packageInfo.price||"0.00"},!e.packageTime&&this.packageInfo.time&&(this.orderInfo.packageTime=this.packageInfo.time,this.orderInfo.packagePrice=this.packageInfo.price)}e.index.hideLoading()}catch(o){e.index.hideLoading(),e.index.showToast({title:o.message||"获取订单信息失败",icon:"none"})}},selectMethod(e){this.selectedMethod=e},async handlePayment(){try{e.index.showLoading({title:"处理中"});const t=await e.index.request({url:`${o.URL||"http://127.0.0.1:8080"}/app/wx-payment/create/${this.orderInfo.orderNo}`,method:"GET",header:{Authorization:"Bearer "+e.index.getStorageSync("token"),Clientid:e.index.getStorageSync("client_id")}});if(200!==t.statusCode||200!==t.data.code)throw new Error(t.data.msg||"创建支付订单失败");{const o=t.data.data;await e.index.requestPayment({...o,success:()=>{this.pollOrderStatus()},fail:e=>{throw console.error("支付失败:",e),new Error("支付失败,请重试")}})}}catch(t){e.index.hideLoading(),e.index.showToast({title:t.message||"支付失败",icon:"none"})}},async sendRentCommand(){try{e.index.showLoading({title:"处理中"});const t=await this.sendRentRequest();if(200!==t.code)throw new Error(t.msg||"租借失败");e.index.hideLoading(),e.index.showToast({title:"租借成功",icon:"success"}),setTimeout((()=>{e.index.redirectTo({url:`/pages/order/index?orderId=${this.orderId}`})}),1500)}catch(t){e.index.hideLoading(),e.index.showToast({title:t.message||"租借失败",icon:"none"})}},sendRentRequest(){return new Promise(((t,r)=>{e.index.request({url:`${o.URL}/app/device/sendRentCommand`,method:"POST",data:{orderId:this.orderId},header:{"Content-Type":"application/x-www-form-urlencoded",Authorization:"Bearer "+e.index.getStorageSync("token"),Clientid:e.index.getStorageSync("client_id")},success(e){200===e.statusCode?t(e.data):r(new Error("请求失败"))},fail(e){r(e)}})}))},formatTime:e=>`${e.getFullYear()}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")} ${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}`,async pollOrderStatus(){let t=0;const r=async()=>{try{const a=await e.index.request({url:`${o.URL||"http://127.0.0.1:8080"}/app/wx-payment/status/${this.orderInfo.orderNo}`,method:"GET",header:{Authorization:"Bearer "+e.index.getStorageSync("token"),Clientid:e.index.getStorageSync("client_id")}});if(200===a.statusCode&&200===a.data.code){if("in_used"===a.data.data.orderStatus)return e.index.showToast({title:"支付成功",icon:"success"}),void setTimeout((()=>{e.index.redirectTo({url:`/pages/order/index?orderId=${this.orderId}`})}),1500)}if(!(t<10))throw new Error("订单状态查询超时");t++,setTimeout(r,1e3)}catch(a){e.index.showToast({title:a.message||"查询订单状态失败",icon:"none"})}};r()}}};const a=e._export_sfc(r,[["render",function(t,o,r,a,n,d){return{a:e.n(n.orderStatus.class),b:e.t(n.orderStatus.text),c:e.t(n.orderStatus.desc),d:e.t(n.orderInfo.orderNo||"-"),e:e.t(n.orderInfo.deviceNo||"-"),f:e.t(n.orderInfo.createTime||"-"),g:e.t(n.orderInfo.phone||"-"),h:e.t(n.orderInfo.deposit||"99.00"),i:e.t(n.packageInfo.time),j:e.t(n.packageInfo.price),k:e.t(n.orderInfo.amount||n.packageInfo.price),l:e.t(d.totalAmount),m:e.f(n.paymentMethods,((t,o,r)=>({a:e.n(t.icon),b:e.t(t.name),c:o,d:n.selectedMethod===o?1:"",e:e.o((e=>d.selectMethod(o)),o)}))),n:e.t(d.totalAmount),o:e.o(((...e)=>d.handlePayment&&d.handlePayment(...e)))}}],["__scopeId","data-v-a18b4e4b"]]);wx.createPage(a);
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "订单支付",
|
||||||
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
|
"navigationBarTextStyle": "black",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<view class="payment-container data-v-a18b4e4b"><view class="status-card data-v-a18b4e4b"><view class="{{['status-icon', 'data-v-a18b4e4b', a]}}"></view><view class="status-text data-v-a18b4e4b">{{b}}</view><view class="status-desc data-v-a18b4e4b">{{c}}</view></view><view class="order-card data-v-a18b4e4b"><view class="card-title data-v-a18b4e4b">订单信息</view><view class="info-item data-v-a18b4e4b"><text class="label data-v-a18b4e4b">订单号</text><text class="value data-v-a18b4e4b">{{d}}</text></view><view class="info-item data-v-a18b4e4b"><text class="label data-v-a18b4e4b">设备号</text><text class="value data-v-a18b4e4b">{{e}}</text></view><view class="info-item data-v-a18b4e4b"><text class="label data-v-a18b4e4b">创建时间</text><text class="value data-v-a18b4e4b">{{f}}</text></view><view class="info-item data-v-a18b4e4b"><text class="label data-v-a18b4e4b">联系电话</text><text class="value data-v-a18b4e4b">{{g}}</text></view></view><view class="price-card data-v-a18b4e4b"><view class="card-title data-v-a18b4e4b">费用信息</view><view class="price-item data-v-a18b4e4b"><text class="label data-v-a18b4e4b">押金</text><text class="value data-v-a18b4e4b">¥{{h}}</text></view><view class="price-item data-v-a18b4e4b"><text class="label data-v-a18b4e4b">套餐</text><text class="value data-v-a18b4e4b">{{i}} (¥{{j}})</text></view><view class="price-item data-v-a18b4e4b"><text class="label data-v-a18b4e4b">租借费用</text><text class="value data-v-a18b4e4b">¥{{k}}</text></view><view class="price-item total data-v-a18b4e4b"><text class="label data-v-a18b4e4b">合计</text><text class="value data-v-a18b4e4b">¥{{l}}</text></view></view><view class="payment-methods data-v-a18b4e4b"><view class="card-title data-v-a18b4e4b">支付方式</view><view wx:for="{{m}}" wx:for-item="method" wx:key="c" class="{{['method-item', 'data-v-a18b4e4b', method.d && 'active']}}" bindtap="{{method.e}}"><view class="{{['method-icon', 'data-v-a18b4e4b', method.a]}}"></view><view class="method-name data-v-a18b4e4b">{{method.b}}</view><view class="method-check data-v-a18b4e4b"></view></view></view><view class="bottom-bar data-v-a18b4e4b"><view class="total-amount data-v-a18b4e4b"><text class="data-v-a18b4e4b">合计:</text><text class="amount data-v-a18b4e4b">¥{{n}}</text></view><button class="pay-btn data-v-a18b4e4b" bindtap="{{o}}">立即支付</button></view></view>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";const e=require("../../common/vendor.js"),t=require("../../config/user.js"),r=require("../../config/url.js"),o={data:()=>({orderId:"",orderInfo:{orderNo:"",deviceNo:"",usedTime:"",currentFee:"0.00",deposit:"99.00",refundAmount:"99.00",endTime:"",withdrawStatus:"waiting",isWithdrawn:!1}}),onLoad(t){t&&t.orderId?(this.orderId=t.orderId,this.loadOrderInfo()):(e.index.showToast({title:"订单ID不能为空",icon:"none"}),setTimeout((()=>{this.goToHome()}),1500))},methods:{getWithdrawStatusText(){return{waiting:"待申请",processing:"处理中",success:"已退款",failed:"退款失败"}[this.orderInfo.withdrawStatus]||"待申请"},async loadOrderInfo(){try{e.index.showLoading({title:"加载中"});const o=await t.queryById(this.orderId);if(200!==o.code||!o.data)throw new Error(o.msg||"获取订单信息失败");{const e=o.data;let t=60,d=0,n=0,i="0.00",a="0.00";if(e.remark)try{const r=e.remark,o=r.match(/使用时长:(\d+)分钟/);o&&o[1]&&(n=parseInt(o[1]));const s=r.match(/套餐时长:(\d+)分钟/);s&&s[1]&&(t=parseInt(s[1]));const c=r.match(/超出时长:(\d+)分钟/);c&&c[1]&&(d=parseInt(c[1]));const h=r.match(/套餐费用:([\d.]+)元/);h&&h[1]&&(i=h[1]);const u=r.match(/超时费用:([\d.]+)元/);u&&u[1]&&(a=u[1]),console.log("从remark解析到的信息:",{usedMinutes:n,packageMinutes:t,extraMinutes:d,packagePrice:i,extraFee:a})}catch(r){console.error("解析remark字段失败:",r)}this.orderInfo={orderNo:e.orderNo||"",deviceNo:e.deviceNo||"",usedTime:n+"分钟",packageTime:t+"分钟",extraTime:d+"分钟",packagePrice:i,extraFee:a,currentFee:e.actualDeviceAmount||"0.00",deposit:e.depositAmount||"99.00",refundAmount:e.residueAmount||"99.00",endTime:e.endTime||"",withdrawStatus:e.withdrawStatus||"waiting",isWithdrawn:"success"===e.withdrawStatus}}}catch(o){console.error("加载订单信息错误:",o),e.index.showToast({title:o.message||"获取订单信息失败",icon:"none"})}finally{e.index.hideLoading()}},async handleWithdraw(){try{e.index.showLoading({title:"处理中"});const t=await e.index.request({url:`${r.URL||"http://127.0.0.1:8080"}/app/withdraw/add/${this.orderInfo.orderNo}`,method:"GET",header:{"Content-Type":"application/json",Authorization:"Bearer "+e.index.getStorageSync("token"),Clientid:e.index.getStorageSync("client_id")}});if(200!==t.statusCode||200!==t.data.code)throw new Error(t.data.msg||"退款申请失败");e.index.showToast({title:"退款申请成功",icon:"success"}),this.orderInfo.withdrawStatus="processing",this.orderInfo.isWithdrawn=!0,setTimeout((()=>{this.loadOrderInfo()}),1500)}catch(t){console.error("退款申请错误:",t),e.index.showToast({title:t.message||"退款申请失败",icon:"none"})}finally{e.index.hideLoading()}},goToHome(){e.index.reLaunch({url:"/pages/index/index"})}}};const d=e._export_sfc(o,[["render",function(t,r,o,d,n,i){return e.e({a:e.t(n.orderInfo.orderNo||"-"),b:e.t(n.orderInfo.deviceNo||"-"),c:e.t(n.orderInfo.usedTime||"-"),d:e.t(n.orderInfo.packageTime||"1小时"),e:e.t(n.orderInfo.extraTime||"0分钟"),f:e.t(n.orderInfo.endTime||"-"),g:e.t(n.orderInfo.packagePrice||"0.00"),h:e.t(n.orderInfo.extraFee||"0.00"),i:e.t(n.orderInfo.currentFee||"0.00"),j:e.t(n.orderInfo.deposit||"99.00"),k:e.t(n.orderInfo.refundAmount||"99.00"),l:e.t(i.getWithdrawStatusText()),m:e.n(n.orderInfo.withdrawStatus||"waiting"),n:!n.orderInfo.isWithdrawn},n.orderInfo.isWithdrawn?{}:{o:e.o(((...e)=>i.handleWithdraw&&i.handleWithdraw(...e)))},{p:e.o(((...e)=>i.goToHome&&i.goToHome(...e)))})}],["__scopeId","data-v-845b5869"]]);wx.createPage(d);
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "归还成功",
|
||||||
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
|
"navigationBarTextStyle": "black",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<view class="success-container data-v-845b5869"><view class="status-card data-v-845b5869"><view class="status-icon success data-v-845b5869"></view><view class="status-text data-v-845b5869">归还成功</view><view class="status-desc data-v-845b5869">您的充电宝已归还,费用已从押金中扣除</view></view><view class="order-card data-v-845b5869"><view class="card-title data-v-845b5869">订单信息</view><view class="info-item data-v-845b5869"><text class="label data-v-845b5869">订单号</text><text class="value data-v-845b5869">{{a}}</text></view><view class="info-item data-v-845b5869"><text class="label data-v-845b5869">设备号</text><text class="value data-v-845b5869">{{b}}</text></view><view class="info-item data-v-845b5869"><text class="label data-v-845b5869">使用时长</text><text class="value data-v-845b5869">{{c}}</text></view><view class="info-item data-v-845b5869"><text class="label data-v-845b5869">套餐时长</text><text class="value data-v-845b5869">{{d}}</text></view><view class="info-item data-v-845b5869"><text class="label data-v-845b5869">超出时长</text><text class="value data-v-845b5869">{{e}}</text></view><view class="info-item data-v-845b5869"><text class="label data-v-845b5869">归还时间</text><text class="value data-v-845b5869">{{f}}</text></view></view><view class="refund-card data-v-845b5869"><view class="card-title data-v-845b5869">费用信息</view><view class="info-item data-v-845b5869"><text class="label data-v-845b5869">套餐费用</text><text class="value data-v-845b5869">¥{{g}}</text></view><view class="info-item data-v-845b5869"><text class="label data-v-845b5869">超时费用</text><text class="value data-v-845b5869">¥{{h}}</text></view><view class="info-item data-v-845b5869"><text class="label data-v-845b5869">总费用</text><text class="value data-v-845b5869">¥{{i}}</text></view><view class="info-item data-v-845b5869"><text class="label data-v-845b5869">押金</text><text class="value data-v-845b5869">¥{{j}}</text></view><view class="info-item data-v-845b5869"><text class="label data-v-845b5869">退还金额</text><text class="value highlight data-v-845b5869">¥{{k}}</text></view><view class="info-item data-v-845b5869"><text class="label data-v-845b5869">退还状态</text><text class="{{['value', 'data-v-845b5869', m]}}">{{l}}</text></view></view><view class="notice-card data-v-845b5869"><view class="card-title data-v-845b5869">退款说明</view><view class="notice-content data-v-845b5869"><text class="data-v-845b5869">1. 押金剩余金额需要您手动申请提现</text><text class="data-v-845b5869">2. 提现申请提交后将在1-3个工作日内退还到原支付账户</text><text class="data-v-845b5869">3. 如有疑问,请联系客服</text></view></view><view class="button-group data-v-845b5869"><button wx:if="{{n}}" class="primary-btn data-v-845b5869" bindtap="{{o}}">申请退款</button><button class="primary-btn data-v-845b5869" bindtap="{{p}}">返回首页</button></view></view>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.success-container.data-v-845b5869{padding:20px;background-color:#f8f8f8;min-height:100vh}.status-card.data-v-845b5869{background-color:#fff;border-radius:12px;padding:30px;text-align:center;margin-bottom:20px;box-shadow:0 2px 8px rgba(0,0,0,.04)}.status-card .status-icon.data-v-845b5869{width:60px;height:60px;margin:0 auto 16px}.status-card .status-icon.success.data-v-845b5869{background-color:#07c160;border-radius:50%;position:relative}.status-card .status-icon.success.data-v-845b5869:after{content:"";position:absolute;left:50%;top:50%;width:30px;height:20px;border:3px solid #fff;border-top:none;border-right:none;transform-origin:center;transform:translate(-50%,-70%) rotate(-45deg)}.status-card .status-text.data-v-845b5869{font-size:24px;font-weight:700;color:#07c160;margin-bottom:8px}.status-card .status-desc.data-v-845b5869{font-size:14px;color:#666}.order-card.data-v-845b5869,.refund-card.data-v-845b5869{background-color:#fff;border-radius:12px;padding:20px;margin-bottom:20px;box-shadow:0 2px 8px rgba(0,0,0,.04)}.order-card .card-title.data-v-845b5869,.refund-card .card-title.data-v-845b5869{font-size:16px;font-weight:700;margin-bottom:16px;color:#333;border-bottom:1px solid #f0f0f0;padding-bottom:10px}.order-card .info-item.data-v-845b5869,.refund-card .info-item.data-v-845b5869{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.order-card .info-item.data-v-845b5869:last-child,.refund-card .info-item.data-v-845b5869:last-child{margin-bottom:0}.order-card .info-item .label.data-v-845b5869,.refund-card .info-item .label.data-v-845b5869{color:#666;font-size:14px}.order-card .info-item .value.data-v-845b5869,.refund-card .info-item .value.data-v-845b5869{color:#333;font-size:14px}.order-card .info-item .value.highlight.data-v-845b5869,.refund-card .info-item .value.highlight.data-v-845b5869{color:#ff6b00;font-weight:700;font-size:16px}.order-card .info-item .value.success.data-v-845b5869,.refund-card .info-item .value.success.data-v-845b5869{color:#07c160}.button-group.data-v-845b5869{margin-top:40rpx;display:flex;justify-content:space-between;gap:20rpx}.button-group .primary-btn.data-v-845b5869,.button-group .secondary-btn.data-v-845b5869{flex:1;height:88rpx;line-height:88rpx;border-radius:44rpx;text-align:center;font-size:32rpx}.button-group .primary-btn.data-v-845b5869{background:#07c160;color:#fff}.button-group .primary-btn.data-v-845b5869:active{opacity:.8}.button-group .secondary-btn.data-v-845b5869{background:#f0f0f0;color:#333}.button-group .secondary-btn.data-v-845b5869:active{opacity:.8}.notice-card.data-v-845b5869{background-color:#fff;border-radius:12px;padding:20px;margin-bottom:20px;box-shadow:0 2px 8px rgba(0,0,0,.04)}.notice-card .card-title.data-v-845b5869{font-size:16px;font-weight:700;margin-bottom:16px;color:#333;border-bottom:1px solid #f0f0f0;padding-bottom:10px}.notice-card .notice-content.data-v-845b5869{text-align:left;color:#666;font-size:14px}.waiting.data-v-845b5869{color:#fa0;font-weight:700}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";const e=require("../../common/vendor.js"),o=require("../../config/user.js"),r={data:()=>({orderId:"",orderInfo:{},isLoading:!0,deviceMessage:"正在准备您的设备,请稍候...",hasTriggeredDevice:!1}),onLoad(o){o&&o.orderId?(this.orderId=o.orderId,this.loadOrderInfo(),e.index.$once("orderSuccess:"+this.orderId,(()=>{console.log("已经触发过弹出逻辑,不再重复触发"),this.hasTriggeredDevice=!0}))):(e.index.showToast({title:"订单信息不存在",icon:"none"}),setTimeout((()=>{this.goToHome()}),1500))},methods:{async loadOrderInfo(){try{e.index.showLoading({title:"加载中"});const r=await o.queryById(this.orderId);if(200!==r.code||!r.data)throw new Error("获取订单信息失败");{const o=r.data;this.orderInfo={orderNo:o.orderNo||o.orderId,deviceNo:o.deviceNo,amount:o.payAmount||o.amount,payTime:o.payTime||this.formatTime(new Date)},"IN_USED"===o.orderStatus?(this.deviceMessage="设备已弹出,请取走您的充电宝",this.isLoading=!1,this.hasTriggeredDevice||(e.index.$emit("orderSuccess:"+this.orderId),this.hasTriggeredDevice=!0)):this.triggerDeviceEject()}e.index.hideLoading()}catch(r){e.index.hideLoading(),e.index.showToast({title:r.message||"获取订单信息失败",icon:"none"})}},async triggerDeviceEject(){if(this.hasTriggeredDevice)console.log("已经触发过弹出充电宝,不重复触发");else{this.hasTriggeredDevice=!0,e.index.$emit("orderSuccess:"+this.orderId),this.isLoading=!0,this.deviceMessage="正在准备您的设备,请稍候...";try{console.log(`准备触发弹出充电宝,orderId: ${this.orderId}`);const r=await o.confirmPaymentAndRent(this.orderId);if(console.log("确认支付并弹出充电宝结果:",JSON.stringify(r)),!r||200!==r.code)throw new Error(r&&r.msg||"弹出充电宝失败");this.deviceMessage="设备已弹出,请取走您的充电宝",e.index.showToast({title:"充电宝已弹出",icon:"success"})}catch(r){console.error("弹出充电宝错误:",r),this.deviceMessage="弹出设备失败,请联系客服",e.index.showToast({title:r.message||"弹出充电宝失败,请联系客服",icon:"none"})}finally{this.isLoading=!1}}},formatTime:e=>`${e.getFullYear()}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")} ${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}`,goToHome(){e.index.switchTab({url:"/pages/index/index"})},goToOrderList(){e.index.redirectTo({url:"/pages/order/index"})}}};const i=e._export_sfc(r,[["render",function(o,r,i,t,d,s){return e.e({a:e.t(d.orderInfo.orderNo||"-"),b:e.t(d.orderInfo.deviceNo||"-"),c:e.t(d.orderInfo.amount||"0.00"),d:e.t(d.orderInfo.payTime||"-"),e:e.t(d.deviceMessage),f:d.isLoading},(d.isLoading,{}),{g:e.o(((...e)=>s.goToHome&&s.goToHome(...e))),h:e.o(((...e)=>s.goToOrderList&&s.goToOrderList(...e)))})}],["__scopeId","data-v-174f45e8"]]);wx.createPage(i);
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "支付成功",
|
||||||
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
|
"navigationBarTextStyle": "black",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<view class="success-container data-v-174f45e8"><view class="status-card data-v-174f45e8"><view class="status-icon success data-v-174f45e8"></view><view class="status-text data-v-174f45e8">支付成功</view><view class="status-desc data-v-174f45e8">您的订单已支付成功</view></view><view class="order-card data-v-174f45e8"><view class="card-title data-v-174f45e8">订单信息</view><view class="info-item data-v-174f45e8"><text class="label data-v-174f45e8">订单号</text><text class="value data-v-174f45e8">{{a}}</text></view><view class="info-item data-v-174f45e8"><text class="label data-v-174f45e8">设备号</text><text class="value data-v-174f45e8">{{b}}</text></view><view class="info-item data-v-174f45e8"><text class="label data-v-174f45e8">支付金额</text><text class="value data-v-174f45e8">¥{{c}}</text></view><view class="info-item data-v-174f45e8"><text class="label data-v-174f45e8">支付时间</text><text class="value data-v-174f45e8">{{d}}</text></view></view><view class="device-status data-v-174f45e8"><view class="status-message data-v-174f45e8">{{e}}</view><view wx:if="{{f}}" class="loading-animation data-v-174f45e8"><view class="loading-circle data-v-174f45e8"></view></view></view><view class="button-group data-v-174f45e8"><button class="primary-btn data-v-174f45e8" bindtap="{{g}}">返回首页</button><button class="secondary-btn data-v-174f45e8" bindtap="{{h}}">查看订单</button></view></view>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.success-container.data-v-174f45e8{padding:20px;background-color:#f5f5f5;min-height:100vh}.status-card.data-v-174f45e8{background-color:#fff;border-radius:12px;padding:30px;text-align:center;margin-bottom:20px}.status-card .status-icon.data-v-174f45e8{width:60px;height:60px;margin:0 auto 16px;background-color:#07c160;border-radius:50%;position:relative}.status-card .status-icon.data-v-174f45e8:after{content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:30px;height:20px;border:3px solid #fff;border-top:none;border-right:none;transform-origin:center;transform:translate(-50%,-70%) rotate(-45deg)}.status-card .status-text.data-v-174f45e8{font-size:24px;font-weight:700;color:#07c160;margin-bottom:8px}.status-card .status-desc.data-v-174f45e8{font-size:14px;color:#666}.order-card.data-v-174f45e8{background-color:#fff;border-radius:12px;padding:20px;margin-bottom:20px}.order-card .card-title.data-v-174f45e8{font-size:16px;font-weight:700;margin-bottom:16px;color:#333}.order-card .info-item.data-v-174f45e8{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.order-card .info-item .label.data-v-174f45e8{color:#666;font-size:14px}.order-card .info-item .value.data-v-174f45e8{color:#333;font-size:14px}.device-status.data-v-174f45e8{background-color:#fff;border-radius:12px;padding:20px;margin-bottom:20px;text-align:center}.device-status .status-message.data-v-174f45e8{font-size:16px;color:#333;margin-bottom:12px}.device-status .loading-animation.data-v-174f45e8{display:flex;justify-content:center;align-items:center;height:40px}.device-status .loading-animation .loading-circle.data-v-174f45e8{width:30px;height:30px;border-radius:50%;border:3px solid #f0f0f0;border-top-color:#07c160;animation:spin-174f45e8 1s linear infinite}@keyframes spin-174f45e8{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.button-group.data-v-174f45e8{margin-top:30px;display:flex;flex-direction:column;gap:16px}.button-group .primary-btn.data-v-174f45e8{background-color:#07c160;color:#fff;border:none;border-radius:24px;padding:12px;font-size:16px}.button-group .primary-btn.data-v-174f45e8:active{opacity:.8}.button-group .secondary-btn.data-v-174f45e8{background-color:#fff;color:#07c160;border:1px solid #07c160;border-radius:24px;padding:12px;font-size:16px}.button-group .secondary-btn.data-v-174f45e8:active{background-color:#f5f5f5}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "归还设备",
|
||||||
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
|
"navigationBarTextStyle": "black",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<view class="return-container data-v-44a2261b"><view class="order-card data-v-44a2261b"><view class="order-header data-v-44a2261b"><text class="title data-v-44a2261b">{{a}}</text><text class="order-no data-v-44a2261b">订单号:{{b}}</text></view><view class="device-info data-v-44a2261b"><text class="device-name data-v-44a2261b">共享风扇</text><text class="device-id data-v-44a2261b">设备号:{{c}}</text></view><view class="time-info data-v-44a2261b"><view class="time-item data-v-44a2261b"><text class="label data-v-44a2261b">开始时间</text><text class="value data-v-44a2261b">{{d}}</text></view><view class="time-item data-v-44a2261b"><text class="label data-v-44a2261b">已使用时长</text><text class="value highlight data-v-44a2261b">{{e}}</text></view><view class="time-item data-v-44a2261b"><text class="label data-v-44a2261b">当前费用</text><text class="value data-v-44a2261b">¥{{f}}</text></view></view><view wx:if="{{false}}" class="debug-info data-v-44a2261b"><view class="debug-title data-v-44a2261b">调试信息</view><view class="debug-item data-v-44a2261b">原始开始时间: {{g}}</view><view class="debug-item data-v-44a2261b">处理后开始时间: {{h}}</view><view class="debug-item data-v-44a2261b">订单状态: {{i}}</view></view></view><view class="notice-card data-v-44a2261b"><view class="notice-title data-v-44a2261b">归还说明</view><view class="notice-list data-v-44a2261b"><view class="notice-item data-v-44a2261b"><view class="dot data-v-44a2261b"></view><text class="data-v-44a2261b">请确保设备完好无损</text></view><view class="notice-item data-v-44a2261b"><view class="dot data-v-44a2261b"></view><text class="data-v-44a2261b">将充电宝插入原位置或空闲插口</text></view><view class="notice-item data-v-44a2261b"><view class="dot data-v-44a2261b"></view><text class="data-v-44a2261b">系统将自动检测归还并处理退款</text></view><view class="notice-item data-v-44a2261b"><view class="dot data-v-44a2261b"></view><text class="data-v-44a2261b">归还成功后将自动跳转到成功页面</text></view></view></view><view class="bottom-bar data-v-44a2261b"><button class="secondary-btn data-v-44a2261b" bindtap="{{j}}">刷新状态</button><button class="primary-btn data-v-44a2261b" bindtap="{{k}}">返回首页</button></view></view>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.return-container.data-v-44a2261b{min-height:100vh;background:#f8f8f8;padding:30rpx 30rpx 180rpx;box-sizing:border-box}.return-container .order-card.data-v-44a2261b{background:#fff;border-radius:24rpx;padding:30rpx;margin-bottom:30rpx;box-shadow:0 4rpx 16rpx rgba(0,0,0,.04)}.return-container .order-card .order-header.data-v-44a2261b{display:flex;justify-content:space-between;align-items:center;margin-bottom:30rpx}.return-container .order-card .order-header .title.data-v-44a2261b{font-size:32rpx;font-weight:700;color:#333}.return-container .order-card .order-header .order-no.data-v-44a2261b{font-size:24rpx;color:#999}.return-container .order-card .device-info.data-v-44a2261b{margin-bottom:30rpx}.return-container .order-card .device-info .device-name.data-v-44a2261b{font-size:28rpx;color:#333;display:block;margin-bottom:10rpx}.return-container .order-card .device-info .device-id.data-v-44a2261b{font-size:24rpx;color:#666}.return-container .order-card .time-info.data-v-44a2261b{background:#f9f9f9;border-radius:16rpx;padding:20rpx}.return-container .order-card .time-info .time-item.data-v-44a2261b{display:flex;justify-content:space-between;align-items:center;margin-bottom:16rpx}.return-container .order-card .time-info .time-item.data-v-44a2261b:last-child{margin-bottom:0}.return-container .order-card .time-info .time-item .label.data-v-44a2261b{font-size:26rpx;color:#666}.return-container .order-card .time-info .time-item .value.data-v-44a2261b{font-size:26rpx;color:#333}.return-container .order-card .time-info .time-item .value.highlight.data-v-44a2261b{color:#ff6b00;font-weight:700}.return-container .notice-card.data-v-44a2261b{background:#fff;border-radius:24rpx;padding:30rpx;margin-bottom:30rpx;box-shadow:0 4rpx 16rpx rgba(0,0,0,.04)}.return-container .notice-card .notice-title.data-v-44a2261b{font-size:28rpx;font-weight:700;color:#333;margin-bottom:20rpx}.return-container .notice-card .notice-list .notice-item.data-v-44a2261b{display:flex;align-items:flex-start;margin-bottom:16rpx}.return-container .notice-card .notice-list .notice-item.data-v-44a2261b:last-child{margin-bottom:0}.return-container .notice-card .notice-list .notice-item .dot.data-v-44a2261b{width:12rpx;height:12rpx;background:#07c160;border-radius:50%;margin-top:10rpx;margin-right:16rpx;flex-shrink:0}.return-container .notice-card .notice-list .notice-item text.data-v-44a2261b{font-size:26rpx;color:#666;line-height:1.5}.return-container .bottom-bar.data-v-44a2261b{position:fixed;left:0;right:0;bottom:0;padding:30rpx;background:#fff;box-shadow:0 -4rpx 16rpx rgba(0,0,0,.04);z-index:10;display:flex;justify-content:space-between;gap:20rpx}.return-container .bottom-bar .primary-btn.data-v-44a2261b,.return-container .bottom-bar .secondary-btn.data-v-44a2261b{height:88rpx;line-height:88rpx;font-size:32rpx;border-radius:44rpx;text-align:center;flex:1}.return-container .bottom-bar .primary-btn.data-v-44a2261b{background:#07c160;color:#fff}.return-container .bottom-bar .primary-btn.data-v-44a2261b:active{opacity:.8}.return-container .bottom-bar .secondary-btn.data-v-44a2261b{background:#f0f0f0;color:#333}.return-container .bottom-bar .secondary-btn.data-v-44a2261b:active{opacity:.8}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";const e=require("../../../common/vendor.js"),i=require("../../../util/index.js"),o=require("../../../config/user.js"),d={data:()=>({}),async onLoad(d){try{if(e.index.showLoading({title:"加载中..."}),e.index.getStorageSync("token")||await i.wxLogin(),!d.deviceNo)return e.index.hideLoading(),void e.index.showToast({title:"设备编号不能为空",icon:"none"});const n=await o.queryHasOrder(d.deviceNo);e.index.hideLoading(),n.data&&n.data.data&&n.data.data.length>0?e.index.redirectTo({url:`/pages/device/return?deviceNo=${d.deviceNo}`}):e.index.redirectTo({url:`/pages/device/detail?deviceNo=${d.deviceNo}`})}catch(n){e.index.hideLoading(),e.index.showToast({title:"页面加载失败,请重试",icon:"none"}),console.error("bagCheck onLoad error:",n)}},methods:{}};const n=e._export_sfc(d,[["render",function(e,i,o,d,n,t){return{}}]]);wx.createPage(n);
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "共享风扇",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<view></view>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"description": "项目配置文件。",
|
||||||
|
"packOptions": {
|
||||||
|
"ignore": []
|
||||||
|
},
|
||||||
|
"setting": {
|
||||||
|
"urlCheck": false,
|
||||||
|
"es6": true,
|
||||||
|
"postcss": false,
|
||||||
|
"minified": false,
|
||||||
|
"newFeature": true,
|
||||||
|
"bigPackageSizeSupport": true
|
||||||
|
},
|
||||||
|
"compileType": "miniprogram",
|
||||||
|
"libVersion": "",
|
||||||
|
"appid": "wxe752f45e7f7aa271",
|
||||||
|
"projectname": "fs",
|
||||||
|
"condition": {
|
||||||
|
"search": {
|
||||||
|
"current": -1,
|
||||||
|
"list": []
|
||||||
|
},
|
||||||
|
"conversation": {
|
||||||
|
"current": -1,
|
||||||
|
"list": []
|
||||||
|
},
|
||||||
|
"game": {
|
||||||
|
"current": -1,
|
||||||
|
"list": []
|
||||||
|
},
|
||||||
|
"miniprogram": {
|
||||||
|
"current": -1,
|
||||||
|
"list": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#1677FF" d="M23.8535534,15.1464466 C24.0488155,15.3417088 24.0488155,15.6582912 23.8535534,15.8535534 L15.8535534,23.8535534 C15.6582912,24.0488155 15.3417088,24.0488155 15.1464466,23.8535534 L0.146446609,8.85355339 C-0.0488155365,8.65829124 -0.0488155365,8.34170876 0.146446609,8.14644661 L8.14644661,0.146446609 C8.34170876,-0.0488155365 8.65829124,-0.0488155365 8.85355339,0.146446609 L23.8535534,15.1464466 Z M17.0355339,17.0355339 L19.0355339,15.0355339 L15.0355339,11.0355339 L13.0355339,13.0355339 L17.0355339,17.0355339 Z M11.0355339,15.0355339 L13.0355339,17.0355339 L9.03553391,21.0355339 L7.03553391,19.0355339 L11.0355339,15.0355339 Z M9.03553391,9.03553391 L11.0355339,11.0355339 L7.03553391,15.0355339 L5.03553391,13.0355339 L9.03553391,9.03553391 Z M3.03553391,11.0355339 L5.03553391,13.0355339 L3.03553391,15.0355339 L1.03553391,13.0355339 L3.03553391,11.0355339 Z M13.0355339,7.03553391 L15.0355339,9.03553391 L11.0355339,13.0355339 L9.03553391,11.0355339 L13.0355339,7.03553391 Z M17.0355339,3.03553391 L19.0355339,5.03553391 L15.0355339,9.03553391 L13.0355339,7.03553391 L17.0355339,3.03553391 Z M21.0355339,7.03553391 L23.0355339,9.03553391 L19.0355339,13.0355339 L17.0355339,11.0355339 L21.0355339,7.03553391 Z"/></svg>
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#07C160" d="M9.82727273,24 C9.82727273,24 9.82727273,24 9.82727273,24 L9.82727273,24 C7.41773163,24 4.95318182,23.5318182 4.95318182,23.5318182 C4.95318182,23.5318182 3,23.1136364 1.5,22.2272727 C1.5,22.2272727 0.954545455,22.0863636 1.04318182,21.5454545 C1.13181818,21.0045455 1.36363636,20.25 1.36363636,20.25 L2.25,17.7272727 C0.409090909,16.0227273 0,14.0454545 0,12.8181818 C0,8.45454545 4.90909091,4.90909091 9.82727273,4.90909091 C13.7454545,4.90909091 17.1818182,7.10454545 18.5454545,10.2272727 C19.0909091,10.1318182 19.6363636,10.0909091 20.1818182,10.0909091 C24.5454545,10.0909091 28.0909091,13.1818182 28.0909091,16.9090909 C28.0909091,18.8181818 26.7272727,20.5909091 24.7272727,21.7272727 L25.3636364,23.5909091 C25.3636364,23.5909091 25.5,24.0454545 25.5909091,24.4090909 C25.6818182,24.7727273 25.3636364,24.9545455 25.3636364,24.9545455 C24.2727273,25.6363636 22.7272727,26.0454545 22.7272727,26.0454545 C22.7272727,26.0454545 20.7272727,26.4545455 18.7272727,26.4545455 C16.7272727,26.4545455 14.7272727,26.0454545 14.7272727,26.0454545 C13.6363636,25.7727273 12.5454545,25.4090909 11.5454545,24.9545455 C10.9090909,24.6818182 10.3636364,24.3636364 9.82727273,24 Z M6.13636364,11.3181818 C5.04545455,11.3181818 4.18181818,12.1818182 4.18181818,13.2727273 C4.18181818,14.3636364 5.04545455,15.2272727 6.13636364,15.2272727 C7.22727273,15.2272727 8.09090909,14.3636364 8.09090909,13.2727273 C8.09090909,12.1818182 7.22727273,11.3181818 6.13636364,11.3181818 Z M13.5,11.3181818 C12.4090909,11.3181818 11.5454545,12.1818182 11.5454545,13.2727273 C11.5454545,14.3636364 12.4090909,15.2272727 13.5,15.2272727 C14.5909091,15.2272727 15.4545455,14.3636364 15.4545455,13.2727273 C15.4545455,12.1818182 14.5909091,11.3181818 13.5,11.3181818 Z M20.1818182,16.5 C19.0909091,16.5 18.2272727,17.3636364 18.2272727,18.4545455 C18.2272727,19.5454545 19.0909091,20.4090909 20.1818182,20.4090909 C21.2727273,20.4090909 22.1363636,19.5454545 22.1363636,18.4545455 C22.1363636,17.3636364 21.2727273,16.5 20.1818182,16.5 Z M25.5,16.5 C24.4090909,16.5 23.5454545,17.3636364 23.5454545,18.4545455 C23.5454545,19.5454545 24.4090909,20.4090909 25.5,20.4090909 C26.5909091,20.4090909 27.4545455,19.5454545 27.4545455,18.4545455 C27.4545455,17.3636364 26.5909091,16.5 25.5,16.5 Z"/></svg>
|
||||||
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1 @@
|
|||||||
|
"use strict";const e=require("../common/vendor.js"),n=require("../config/user.js");exports.getQueryString=function(e,n){var o=new RegExp("(^|&|/?)"+n+"=([^&|/?]*)(&|/?|$)","i"),i=e.substr(1).match(o);return null!=i?i[2]:null},exports.getUserInfo=()=>new Promise((async(e,o)=>{e(await n.getMyIndexInfo({isHide:!1}))})),exports.wxLogin=()=>new Promise(((o,i)=>{e.index.login({provider:"weixin",success:async t=>{try{if(!t.code)throw new Error("获取微信登录凭证失败");{const i=await n.login({code:t.code,appid:"wxe752f45e7f7aa271"});if(200!==i.code)throw new Error(i.message||"登录失败");e.index.setStorageSync("token",i.data.LoginWxVo.access_token),e.index.setStorageSync("client_id",i.data.LoginWxVo.client_id),o(i.data)}}catch(s){e.index.showToast({title:s.message||"登录失败",icon:"none"}),i(s)}},fail:n=>{e.index.showToast({title:"微信登录失败",icon:"none"}),i(n)}})}));
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"use strict";const e=require("../common/vendor.js"),s=require("../config/user.js");const r=new class{constructor(){this.activeOrders=new Map,this.timer=null,this.checkInterval=1e4,this.isRunning=!1}addOrder(e){e&&e.orderId?(console.log("添加订单到监控队列:",e.orderId),this.activeOrders.set(e.orderId,e),this.isRunning||this.start()):console.error("添加订单监控失败:无效的订单数据")}removeOrder(e){this.activeOrders.has(e)&&(console.log("从监控队列移除订单:",e),this.activeOrders.delete(e),0===this.activeOrders.size&&this.stop())}start(){this.isRunning||(console.log("启动订单监控服务"),this.isRunning=!0,this.checkOrders(),this.timer=setInterval((()=>{this.checkOrders()}),this.checkInterval))}stop(){this.isRunning&&(console.log("停止订单监控服务"),this.isRunning=!1,this.timer&&(clearInterval(this.timer),this.timer=null))}async checkOrders(){if(0!==this.activeOrders.size){console.log(`检查 ${this.activeOrders.size} 个活跃订单状态`);for(const[s,r]of this.activeOrders.entries())try{await this.checkOrderStatus(s)}catch(e){console.error(`检查订单状态失败: ${s}`,e)}}}async checkOrderStatus(r){try{console.log(`检查订单 ${r} 的状态`);const t=await s.queryById(r);if(200===t.code&&t.data){const s=t.data;if(this.activeOrders.set(r,s),"used_done"===s.orderStatus||"used_down"===s.orderStatus){console.log(`订单 ${r} 已完成!`),e.index.$emit("orderCompleted",s),e.index.showToast({title:"充电宝归还成功",icon:"success",duration:2e3});const t=e.index.createInnerAudioContext();t.src="/static/audio/return_success.mp3",t.play(),this.removeOrder(r),setTimeout((()=>{e.index.showModal({title:"归还成功",content:"充电宝已归还成功,剩余押金将退还到您的账户",confirmText:"查看详情",success:s=>{s.confirm&&e.index.redirectTo({url:`/pages/order/return-success?orderId=${r}`})}})}),500)}}}catch(t){console.error(`检查订单 ${r} 状态出错:`,t)}}};(()=>{const s=e.index.getStorageSync("activeOrderId");if(s){const e={orderId:s};r.addOrder(e)}})(),exports.orderMonitor=r;
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"hash": "eecc45c6",
|
"hash": "1aab2153",
|
||||||
"configHash": "e4fbd916",
|
"configHash": "d5af41b4",
|
||||||
"lockfileHash": "78df9316",
|
"lockfileHash": "78df9316",
|
||||||
"browserHash": "8d847c28",
|
"browserHash": "506545f1",
|
||||||
"optimized": {
|
"optimized": {
|
||||||
"uview-ui": {
|
"uview-ui": {
|
||||||
"src": "../../../../../node_modules/uview-ui/index.js",
|
"src": "../../../../../node_modules/uview-ui/index.js",
|
||||||
"file": "uview-ui.js",
|
"file": "uview-ui.js",
|
||||||
"fileHash": "b095c49f",
|
"fileHash": "4f573264",
|
||||||
"needsInterop": false
|
"needsInterop": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|||||||
mod
|
mod
|
||||||
));
|
));
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/mixin/mixin.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/mixin/mixin.js
|
||||||
var require_mixin = __commonJS({
|
var require_mixin = __commonJS({
|
||||||
"C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/mixin/mixin.js"(exports, module) {
|
"../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/mixin/mixin.js"(exports, module) {
|
||||||
module.exports = {
|
module.exports = {
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return {};
|
||||||
@@ -82,10 +82,10 @@ var require_mixin = __commonJS({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/index.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/index.js
|
||||||
var import_mixin = __toESM(require_mixin());
|
var import_mixin = __toESM(require_mixin());
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/deepClone.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/deepClone.js
|
||||||
function deepClone(obj, cache = /* @__PURE__ */ new WeakMap()) {
|
function deepClone(obj, cache = /* @__PURE__ */ new WeakMap()) {
|
||||||
if (obj === null || typeof obj !== "object")
|
if (obj === null || typeof obj !== "object")
|
||||||
return obj;
|
return obj;
|
||||||
@@ -116,7 +116,7 @@ function deepClone(obj, cache = /* @__PURE__ */ new WeakMap()) {
|
|||||||
}
|
}
|
||||||
var deepClone_default = deepClone;
|
var deepClone_default = deepClone;
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/deepMerge.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/deepMerge.js
|
||||||
function deepMerge(target = {}, source = {}) {
|
function deepMerge(target = {}, source = {}) {
|
||||||
target = deepClone_default(target);
|
target = deepClone_default(target);
|
||||||
if (typeof target !== "object" || target === null || typeof source !== "object" || source === null)
|
if (typeof target !== "object" || target === null || typeof source !== "object" || source === null)
|
||||||
@@ -145,7 +145,7 @@ function deepMerge(target = {}, source = {}) {
|
|||||||
}
|
}
|
||||||
var deepMerge_default = deepMerge;
|
var deepMerge_default = deepMerge;
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/test.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/test.js
|
||||||
function email(value) {
|
function email(value) {
|
||||||
return /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/.test(value);
|
return /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/.test(value);
|
||||||
}
|
}
|
||||||
@@ -290,7 +290,7 @@ var test_default = {
|
|||||||
code
|
code
|
||||||
};
|
};
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/request/index.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/request/index.js
|
||||||
var Request = class {
|
var Request = class {
|
||||||
// 设置全局默认配置
|
// 设置全局默认配置
|
||||||
setConfig(customConfig) {
|
setConfig(customConfig) {
|
||||||
@@ -424,7 +424,7 @@ var Request = class {
|
|||||||
};
|
};
|
||||||
var request_default = new Request();
|
var request_default = new Request();
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/queryParams.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/queryParams.js
|
||||||
function queryParams(data = {}, isPrefix = true, arrayFormat = "brackets") {
|
function queryParams(data = {}, isPrefix = true, arrayFormat = "brackets") {
|
||||||
let prefix = isPrefix ? "?" : "";
|
let prefix = isPrefix ? "?" : "";
|
||||||
let _result = [];
|
let _result = [];
|
||||||
@@ -472,7 +472,7 @@ function queryParams(data = {}, isPrefix = true, arrayFormat = "brackets") {
|
|||||||
}
|
}
|
||||||
var queryParams_default = queryParams;
|
var queryParams_default = queryParams;
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/route.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/route.js
|
||||||
var Router = class {
|
var Router = class {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.config = {
|
this.config = {
|
||||||
@@ -571,7 +571,7 @@ var Router = class {
|
|||||||
};
|
};
|
||||||
var route_default = new Router().route;
|
var route_default = new Router().route;
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/timeFormat.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/timeFormat.js
|
||||||
if (!String.prototype.padStart) {
|
if (!String.prototype.padStart) {
|
||||||
String.prototype.padStart = function(maxLength, fillString = " ") {
|
String.prototype.padStart = function(maxLength, fillString = " ") {
|
||||||
if (Object.prototype.toString.call(fillString) !== "[object String]")
|
if (Object.prototype.toString.call(fillString) !== "[object String]")
|
||||||
@@ -625,7 +625,7 @@ function timeFormat(dateTime = null, fmt = "yyyy-mm-dd") {
|
|||||||
}
|
}
|
||||||
var timeFormat_default = timeFormat;
|
var timeFormat_default = timeFormat;
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/timeFrom.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/timeFrom.js
|
||||||
function timeFrom(dateTime = null, format = "yyyy-mm-dd") {
|
function timeFrom(dateTime = null, format = "yyyy-mm-dd") {
|
||||||
if (!dateTime)
|
if (!dateTime)
|
||||||
dateTime = Number(/* @__PURE__ */ new Date());
|
dateTime = Number(/* @__PURE__ */ new Date());
|
||||||
@@ -662,7 +662,7 @@ function timeFrom(dateTime = null, format = "yyyy-mm-dd") {
|
|||||||
}
|
}
|
||||||
var timeFrom_default = timeFrom;
|
var timeFrom_default = timeFrom;
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/colorGradient.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/colorGradient.js
|
||||||
function colorGradient(startColor = "rgb(0, 0, 0)", endColor = "rgb(255, 255, 255)", step = 10) {
|
function colorGradient(startColor = "rgb(0, 0, 0)", endColor = "rgb(255, 255, 255)", step = 10) {
|
||||||
let startRGB = hexToRgb(startColor, false);
|
let startRGB = hexToRgb(startColor, false);
|
||||||
let startR = startRGB[0];
|
let startR = startRGB[0];
|
||||||
@@ -770,7 +770,7 @@ var colorGradient_default = {
|
|||||||
colorToRgba
|
colorToRgba
|
||||||
};
|
};
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/guid.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/guid.js
|
||||||
function guid(len = 32, firstU = true, radix = null) {
|
function guid(len = 32, firstU = true, radix = null) {
|
||||||
let chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
|
let chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
|
||||||
let uuid = [];
|
let uuid = [];
|
||||||
@@ -798,7 +798,7 @@ function guid(len = 32, firstU = true, radix = null) {
|
|||||||
}
|
}
|
||||||
var guid_default = guid;
|
var guid_default = guid;
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/color.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/color.js
|
||||||
var color = {
|
var color = {
|
||||||
primary: "#2979ff",
|
primary: "#2979ff",
|
||||||
primaryDark: "#2b85e4",
|
primaryDark: "#2b85e4",
|
||||||
@@ -829,7 +829,7 @@ var color = {
|
|||||||
};
|
};
|
||||||
var color_default = color;
|
var color_default = color;
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/type2icon.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/type2icon.js
|
||||||
function type2icon(type = "success", fill = false) {
|
function type2icon(type = "success", fill = false) {
|
||||||
if (["primary", "info", "error", "warning", "success"].indexOf(type) == -1)
|
if (["primary", "info", "error", "warning", "success"].indexOf(type) == -1)
|
||||||
type = "success";
|
type = "success";
|
||||||
@@ -859,19 +859,19 @@ function type2icon(type = "success", fill = false) {
|
|||||||
}
|
}
|
||||||
var type2icon_default = type2icon;
|
var type2icon_default = type2icon;
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/randomArray.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/randomArray.js
|
||||||
function randomArray(array2 = []) {
|
function randomArray(array2 = []) {
|
||||||
return array2.sort(() => Math.random() - 0.5);
|
return array2.sort(() => Math.random() - 0.5);
|
||||||
}
|
}
|
||||||
var randomArray_default = randomArray;
|
var randomArray_default = randomArray;
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/addUnit.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/addUnit.js
|
||||||
function addUnit(value = "auto", unit = "rpx") {
|
function addUnit(value = "auto", unit = "rpx") {
|
||||||
value = String(value);
|
value = String(value);
|
||||||
return test_default.number(value) ? `${value}${unit}` : value;
|
return test_default.number(value) ? `${value}${unit}` : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/random.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/random.js
|
||||||
function random(min, max) {
|
function random(min, max) {
|
||||||
if (min >= 0 && max > 0 && max >= min) {
|
if (min >= 0 && max > 0 && max >= min) {
|
||||||
let gab = max - min + 1;
|
let gab = max - min + 1;
|
||||||
@@ -882,7 +882,7 @@ function random(min, max) {
|
|||||||
}
|
}
|
||||||
var random_default = random;
|
var random_default = random;
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/trim.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/trim.js
|
||||||
function trim(str, pos = "both") {
|
function trim(str, pos = "both") {
|
||||||
if (pos == "both") {
|
if (pos == "both") {
|
||||||
return str.replace(/^\s+|\s+$/g, "");
|
return str.replace(/^\s+|\s+$/g, "");
|
||||||
@@ -898,7 +898,7 @@ function trim(str, pos = "both") {
|
|||||||
}
|
}
|
||||||
var trim_default = trim;
|
var trim_default = trim;
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/toast.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/toast.js
|
||||||
function toast(title, duration = 1500) {
|
function toast(title, duration = 1500) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title,
|
title,
|
||||||
@@ -908,7 +908,7 @@ function toast(title, duration = 1500) {
|
|||||||
}
|
}
|
||||||
var toast_default = toast;
|
var toast_default = toast;
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/getParent.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/getParent.js
|
||||||
function getParent(name, keys) {
|
function getParent(name, keys) {
|
||||||
let parent = this.$parent;
|
let parent = this.$parent;
|
||||||
while (parent) {
|
while (parent) {
|
||||||
@@ -945,7 +945,7 @@ function getParent(name, keys) {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/$parent.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/$parent.js
|
||||||
function $parent(name = void 0) {
|
function $parent(name = void 0) {
|
||||||
let parent = this.$parent;
|
let parent = this.$parent;
|
||||||
while (parent) {
|
while (parent) {
|
||||||
@@ -958,7 +958,7 @@ function $parent(name = void 0) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/sys.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/sys.js
|
||||||
function os() {
|
function os() {
|
||||||
return uni.getSystemInfoSync().platform;
|
return uni.getSystemInfoSync().platform;
|
||||||
}
|
}
|
||||||
@@ -966,7 +966,7 @@ function sys() {
|
|||||||
return uni.getSystemInfoSync();
|
return uni.getSystemInfoSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/debounce.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/debounce.js
|
||||||
var timeout = null;
|
var timeout = null;
|
||||||
function debounce(func, wait = 500, immediate = false) {
|
function debounce(func, wait = 500, immediate = false) {
|
||||||
if (timeout !== null)
|
if (timeout !== null)
|
||||||
@@ -986,7 +986,7 @@ function debounce(func, wait = 500, immediate = false) {
|
|||||||
}
|
}
|
||||||
var debounce_default = debounce;
|
var debounce_default = debounce;
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/function/throttle.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/function/throttle.js
|
||||||
var timer;
|
var timer;
|
||||||
var flag;
|
var flag;
|
||||||
function throttle(func, wait = 500, immediate = true) {
|
function throttle(func, wait = 500, immediate = true) {
|
||||||
@@ -1010,7 +1010,7 @@ function throttle(func, wait = 500, immediate = true) {
|
|||||||
}
|
}
|
||||||
var throttle_default = throttle;
|
var throttle_default = throttle;
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/config/config.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/config/config.js
|
||||||
var version = "1.8.8";
|
var version = "1.8.8";
|
||||||
var config_default = {
|
var config_default = {
|
||||||
v: version,
|
v: version,
|
||||||
@@ -1025,7 +1025,7 @@ var config_default = {
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/libs/config/zIndex.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/libs/config/zIndex.js
|
||||||
var zIndex_default = {
|
var zIndex_default = {
|
||||||
toast: 10090,
|
toast: 10090,
|
||||||
noNetwork: 10080,
|
noNetwork: 10080,
|
||||||
@@ -1038,7 +1038,7 @@ var zIndex_default = {
|
|||||||
indexListSticky: 965
|
indexListSticky: 965
|
||||||
};
|
};
|
||||||
|
|
||||||
// C:/Users/Administrator.DESKTOP-IRCM9I0/Desktop/locker-fans/locker-fans/uni-fans/node_modules/uview-ui/index.js
|
// ../../../../../../Users/apple/Documents/subject/locker-fans/uni-fans/node_modules/uview-ui/index.js
|
||||||
function wranning(str) {
|
function wranning(str) {
|
||||||
if (true) {
|
if (true) {
|
||||||
console.warn(str);
|
console.warn(str);
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"names":["_sfc_main","onLaunch","common_vendor","index","__f__","onShow","_onShow","_asyncToGenerator2","_regeneratorRuntime2","mark","_callee","wrap","_callee$","_context","prev","next","autoLogin","stop","apply","arguments","onHide","methods","_callee2","loginResult","_callee2$","_context2","util_index","wxLogin","sent","t0"],"sources":["App.vue"],"sourcesContent":["<script>\r\n\timport {\r\n\t\twxLogin,\r\n\t\tgetUserInfo\r\n\t} from './util/index'\r\n\r\n\r\n\texport default {\r\n\t\tonLaunch: function() {\r\n\t\t\tconsole.log('App Launch')\r\n\t\t\t\r\n\t\t},\r\n\t\tonShow: async function() {\r\n\t\t\tconsole.log('App Show')\r\n\t\t\tawait this.autoLogin()\r\n\r\n\t\t},\r\n\t\tonHide: function() {\r\n\t\t\tconsole.log('App Hide')\r\n\t\t},\r\n\r\n\r\n\r\n\t\tmethods: {\r\n\t\t\tasync autoLogin() {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst loginResult = await wxLogin()\r\n\t\t\t\t\tconsole.log('自动登录成功:', loginResult)\r\n\t\t\t\t\t// await getUserInfo()\r\n\t\t\t\t} catch (error) {\r\n\t\t\t\t\tconsole.error('自动登录失败:', error)\r\n\t\t\t\t\t// 登录失败的处理可以在 wxLogin 中统一处理\r\n\t\t\t\t\t// 这里可以添加特殊的错误处理逻辑\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n</script>\r\n\r\n<style lang=\"scss\">\r\n\t@import \"uview-ui/index.scss\"\r\n\r\n\t/*每个页面公共css */\r\n</style>"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAOC,IAAKA,SAAA,GAAU;EACdC,QAAA,EAAU,SAAVA,SAAA,EAAqB;IACpBC,aAAA,CAAAC,KAAA,CAAAC,KAAA,yBAAY,YAAY;EAExB;EACDC,MAAA;IAAA,IAAAC,OAAA,GAAAC,kBAAA,eAAAC,oBAAA,GAAAC,IAAA,CAAQ,SAAAC,QAAA;MAAA,OAAAF,oBAAA,GAAAG,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YACPb,aAAA,CAAAC,KAAA,CAAYC,KAAA,mCAAU;YAAAS,QAAA,CAAAE,IAAA;YAAA,OAChB,KAAKC,SAAA,EAAU;UAAA;UAAA;YAAA,OAAAH,QAAA,CAAAI,IAAA;QAAA;MAAA,GAAAP,OAAA;IAAA,CAErB;IAAA,SAJDL,OAAA;MAAA,OAAAC,OAAA,CAAAY,KAAA,OAAAC,SAAA;IAAA;IAAA,OAAAd,MAAA;EAAA,GAIC;EACDe,MAAA,EAAQ,SAARA,OAAA,EAAmB;IAClBlB,aAAA,CAAAC,KAAA,CAAYC,KAAA,mCAAU;EACtB;EAIDiB,OAAA,EAAS;IACFL,SAAA,WAAAA,UAAA,EAAY;MAAA,OAAAT,kBAAA,eAAAC,oBAAA,GAAAC,IAAA,UAAAa,SAAA;QAAA,IAAAC,WAAA;QAAA,OAAAf,oBAAA,GAAAG,IAAA,UAAAa,UAAAC,SAAA;UAAA,kBAAAA,SAAA,CAAAX,IAAA,GAAAW,SAAA,CAAAV,IAAA;YAAA;cAAAU,SAAA,CAAAX,IAAA;cAAAW,SAAA,CAAAV,IAAA;cAAA,OAEUW,UAAA,CAAAC,OAAA,EAAQ;YAAA;cAA5BJ,WAAA,GAAAE,SAAA,CAAAG,IAAA;cACN1B,aAAA,CAAAC,KAAA,CAAYC,KAAA,oCAAWmB,WAAW;cAAAE,SAAA,CAAAV,IAAA;cAAA;YAAA;cAAAU,SAAA,CAAAX,IAAA;cAAAW,SAAA,CAAAI,EAAA,GAAAJ,SAAA;cAGlCvB,aAAA,CAAAC,KAAA,CAAAC,KAAA,2BAAc,WAAAqB,SAAA,CAAAI,EAAA,CAAgB;YAAA;YAAA;cAAA,OAAAJ,SAAA,CAAAR,IAAA;UAAA;QAAA,GAAAK,QAAA;MAAA;IAIhC;EACD;AACD","ignoreList":[]}
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"app.js","sources":["App.vue"],"sourcesContent":["<script>\r\n\timport {\r\n\t\twxLogin,\r\n\t\tgetUserInfo\r\n\t} from './util/index'\r\n\r\n\r\n\texport default {\r\n\t\tonLaunch: function() {\r\n\t\t\tconsole.log('App Launch')\r\n\t\t\t\r\n\t\t},\r\n\t\tonShow: async function() {\r\n\t\t\tconsole.log('App Show')\r\n\t\t\tawait this.autoLogin()\r\n\r\n\t\t},\r\n\t\tonHide: function() {\r\n\t\t\tconsole.log('App Hide')\r\n\t\t},\r\n\r\n\r\n\r\n\t\tmethods: {\r\n\t\t\tasync autoLogin() {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst loginResult = await wxLogin()\r\n\t\t\t\t\tconsole.log('自动登录成功:', loginResult)\r\n\t\t\t\t\t// await getUserInfo()\r\n\t\t\t\t} catch (error) {\r\n\t\t\t\t\tconsole.error('自动登录失败:', error)\r\n\t\t\t\t\t// 登录失败的处理可以在 wxLogin 中统一处理\r\n\t\t\t\t\t// 这里可以添加特殊的错误处理逻辑\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n</script>\r\n\r\n<style lang=\"scss\">\r\n\t@import \"uview-ui/index.scss\"\r\n\r\n\t/*每个页面公共css */\r\n</style>"],"names":["uni","wxLogin"],"mappings":";;;;;;;;;;;;;;;;;AAOC,MAAK,YAAU;AAAA,EACd,UAAU,WAAW;AACpBA,kBAAAA,MAAA,MAAA,OAAA,iBAAY,YAAY;AAAA,EAExB;AAAA,EACD,QAAQ,iBAAiB;AACxBA,kBAAAA,MAAY,MAAA,OAAA,iBAAA,UAAU;AACtB,UAAM,KAAK,UAAU;AAAA,EAErB;AAAA,EACD,QAAQ,WAAW;AAClBA,kBAAAA,MAAY,MAAA,OAAA,iBAAA,UAAU;AAAA,EACtB;AAAA,EAID,SAAS;AAAA,IACR,MAAM,YAAY;AACjB,UAAI;AACH,cAAM,cAAc,MAAMC,mBAAQ;AAClCD,sBAAAA,MAAY,MAAA,OAAA,iBAAA,WAAW,WAAW;AAAA,MAEjC,SAAO,OAAO;AACfA,sBAAAA,sCAAc,WAAW,KAAK;AAAA,MAG/B;AAAA,IACD;AAAA,EACD;AACD;;;;;;;;;"}
|
{"version":3,"file":"app.js","sources":["App.vue"],"sourcesContent":["<script>\r\n\timport {\r\n\t\twxLogin,\r\n\t\tgetUserInfo\r\n\t} from './util/index'\r\n\r\n\r\n\texport default {\r\n\t\tonLaunch: function() {\r\n\t\t\tconsole.log('App Launch')\r\n\t\t\t\r\n\t\t},\r\n\t\tonShow: async function() {\r\n\t\t\tconsole.log('App Show')\r\n\t\t\tawait this.autoLogin()\r\n\r\n\t\t},\r\n\t\tonHide: function() {\r\n\t\t\tconsole.log('App Hide')\r\n\t\t},\r\n\r\n\r\n\r\n\t\tmethods: {\r\n\t\t\tasync autoLogin() {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst loginResult = await wxLogin()\r\n\t\t\t\t\tconsole.log('自动登录成功:', loginResult)\r\n\t\t\t\t\t// await getUserInfo()\r\n\t\t\t\t} catch (error) {\r\n\t\t\t\t\tconsole.error('自动登录失败:', error)\r\n\t\t\t\t\t// 登录失败的处理可以在 wxLogin 中统一处理\r\n\t\t\t\t\t// 这里可以添加特殊的错误处理逻辑\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n</script>\r\n\r\n<style lang=\"scss\">\r\n\t@import \"uview-ui/index.scss\"\r\n\r\n\t/*每个页面公共css */\r\n</style>"],"names":["uni","wxLogin"],"mappings":";;;;;;;;;;;;;;;;;;;AAOC,MAAK,YAAU;AAAA,EACd,UAAU,WAAW;AACpBA,kBAAAA,MAAA,MAAA,OAAA,iBAAY,YAAY;AAAA,EAExB;AAAA,EACD,QAAQ,iBAAiB;AACxBA,kBAAAA,MAAY,MAAA,OAAA,iBAAA,UAAU;AACtB,UAAM,KAAK,UAAU;AAAA,EAErB;AAAA,EACD,QAAQ,WAAW;AAClBA,kBAAAA,MAAY,MAAA,OAAA,iBAAA,UAAU;AAAA,EACtB;AAAA,EAID,SAAS;AAAA,IACR,MAAM,YAAY;AACjB,UAAI;AACH,cAAM,cAAc,MAAMC,mBAAQ;AAClCD,sBAAAA,MAAY,MAAA,OAAA,iBAAA,WAAW,WAAW;AAAA,MAEjC,SAAO,OAAO;AACfA,sBAAAA,sCAAc,WAAW,KAAK;AAAA,MAG/B;AAAA,IACD;AAAA,EACD;AACD;;;;;;;;;;"}
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"http.js","sources":["config/http.js"],"sourcesContent":["import {\r\n\tURL,\r\n\tappid\r\n} from './url'\r\n\r\nconst request = (option) => {\r\n\treturn new Promise((resolve, reject) => {\r\n\t\t// Debug request info\r\n\t\tconsole.log(`发起请求: ${option.method} ${URL + option.url}`, option.data)\r\n\t\t\r\n\t\tuni.request({\r\n\t\t\turl: URL + option.url,\r\n\t\t\tmethod: option.method,\r\n\t\t\tdata: option.data,\r\n\t\t\theader: {\r\n\t\t\t\t\"Content-Type\": \"application/x-www-form-urlencoded\",\r\n\t\t\t\t\t...option.headers,\r\n\t\t\t\t'appid': appid,\r\n\t\t\t\t'Authorization': \"Bearer \" + uni.getStorageSync('token'),\r\n\t\t\t\t'Clientid': uni.getStorageSync('client_id')\r\n\t\t\t},\r\n\t\t\tsuccess(res) {\r\n\t\t\t\t// 记录响应\r\n\t\t\t\tconsole.log(`请求响应: ${option.url}`, res)\r\n\t\t\t\t\r\n\t\t\t\t// 检查响应状态码\r\n\t\t\t\tif (res.statusCode !== 200) {\r\n\t\t\t\t\tconsole.error(`HTTP状态码错误: ${res.statusCode}`, res.data)\r\n\t\t\t\t\t\r\n\t\t\t\t\t// 为了适应某些服务器的异常响应,我们仍然返回数据\r\n\t\t\t\t\tif (res.data) {\r\n\t\t\t\t\t\tresolve(res.data)\r\n\t\t\t\t\t\treturn\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\treject({msg: `请求失败,状态码:${res.statusCode}`})\r\n\t\t\t\t\treturn\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// 检查业务状态码\r\n\t\t\t\tif (res.data && res.data.code !== 200) {\r\n\t\t\t\t\tconsole.warn(`业务状态码错误: ${res.data.code}`, res.data)\r\n\t\t\t\t\t\r\n\t\t\t\t\t// 仍然返回数据,由业务逻辑处理\r\n\t\t\t\t\tresolve(res.data)\r\n\t\t\t\t\treturn\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tresolve(res.data)\r\n\t\t\t},\r\n\t\t\tfail(err) {\r\n\t\t\t\t// 网络请求本身失败\r\n\t\t\t\tconsole.error(`请求失败: ${option.url}`, err)\r\n\t\t\t\treject(err)\r\n\t\t\t}\r\n\t\t})\r\n\t})\r\n}\r\n\r\n\r\nexport default request"],"names":["uni","URL","appid"],"mappings":";;;AAKK,MAAC,UAAU,CAAC,WAAW;AAC3B,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AAEvCA,kBAAA,MAAA,MAAA,OAAA,uBAAY,SAAS,OAAO,MAAM,IAAIC,WAAAA,MAAM,OAAO,GAAG,IAAI,OAAO,IAAI;AAErED,kBAAAA,MAAI,QAAQ;AAAA,MACX,KAAKC,WAAAA,MAAM,OAAO;AAAA,MAClB,QAAQ,OAAO;AAAA,MACf,MAAM,OAAO;AAAA,MACb,QAAQ;AAAA,QACP,gBAAgB;AAAA,QACf,GAAG,OAAO;AAAA,QACX,SAASC,WAAK;AAAA,QACd,iBAAiB,YAAYF,oBAAI,eAAe,OAAO;AAAA,QACvD,YAAYA,cAAAA,MAAI,eAAe,WAAW;AAAA,MAC1C;AAAA,MACD,QAAQ,KAAK;AAEZA,4BAAA,MAAA,OAAA,wBAAY,SAAS,OAAO,GAAG,IAAI,GAAG;AAGtC,YAAI,IAAI,eAAe,KAAK;AAC3BA,wBAAAA,6CAAc,cAAc,IAAI,UAAU,IAAI,IAAI,IAAI;AAGtD,cAAI,IAAI,MAAM;AACb,oBAAQ,IAAI,IAAI;AAChB;AAAA,UACA;AAED,iBAAO,EAAC,KAAK,YAAY,IAAI,UAAU,GAAE,CAAC;AAC1C;AAAA,QACA;AAGD,YAAI,IAAI,QAAQ,IAAI,KAAK,SAAS,KAAK;AACtCA,wBAAAA,MAAa,MAAA,QAAA,wBAAA,YAAY,IAAI,KAAK,IAAI,IAAI,IAAI,IAAI;AAGlD,kBAAQ,IAAI,IAAI;AAChB;AAAA,QACA;AAED,gBAAQ,IAAI,IAAI;AAAA,MAChB;AAAA,MACD,KAAK,KAAK;AAETA,4BAAA,MAAA,SAAA,wBAAc,SAAS,OAAO,GAAG,IAAI,GAAG;AACxC,eAAO,GAAG;AAAA,MACV;AAAA,IACJ,CAAG;AAAA,EACH,CAAE;AACF;;"}
|
{"version":3,"file":"http.js","sources":["config/http.js"],"sourcesContent":["import {\r\n\tURL,\r\n\tappid\r\n} from './url'\r\n\r\nconst request = (option) => {\r\n\treturn new Promise((resolve, reject) => {\r\n\t\t// Debug request info\r\n\t\tconsole.log(`发起请求: ${option.method} ${URL + option.url}`, option.data)\r\n\t\t\r\n\t\t// 默认不显示加载中提示\r\n\t\tif (!option.hideLoading) {\r\n\t\t\tuni.showLoading({\r\n\t\t\t\ttitle: option.loadingText || '加载中...',\r\n\t\t\t\tmask: true\r\n\t\t\t})\r\n\t\t}\r\n\t\t\r\n\t\tuni.request({\r\n\t\t\turl: URL + option.url,\r\n\t\t\tmethod: option.method,\r\n\t\t\tdata: option.data,\r\n\t\t\theader: {\r\n\t\t\t\t\"Content-Type\": \"application/x-www-form-urlencoded\",\r\n\t\t\t\t\t...option.headers,\r\n\t\t\t\t'appid': appid,\r\n\t\t\t\t'Authorization': \"Bearer \" + uni.getStorageSync('token'),\r\n\t\t\t\t'Clientid': uni.getStorageSync('client_id')\r\n\t\t\t},\r\n\t\t\tsuccess(res) {\r\n\t\t\t\t// 记录响应\r\n\t\t\t\tconsole.log(`请求响应: ${option.url}`, res)\r\n\t\t\t\t\r\n\t\t\t\t// 检查响应状态码\r\n\t\t\t\tif (res.statusCode !== 200) {\r\n\t\t\t\t\tconsole.error(`HTTP状态码错误: ${res.statusCode}`, res.data)\r\n\t\t\t\t\t\r\n\t\t\t\t\t// 为了适应某些服务器的异常响应,我们仍然返回数据\r\n\t\t\t\t\tif (res.data) {\r\n\t\t\t\t\t\tresolve(res.data)\r\n\t\t\t\t\t\treturn\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\treject({msg: `请求失败,状态码:${res.statusCode}`})\r\n\t\t\t\t\treturn\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// 检查业务状态码\r\n\t\t\t\tif (res.data && res.data.code !== 200) {\r\n\t\t\t\t\tconsole.warn(`业务状态码错误: ${res.data.code}`, res.data)\r\n\t\t\t\t\t\r\n\t\t\t\t\t// 判断是否需要忽略数据为空的错误\r\n\t\t\t\t\tif (option.ignoreEmptyError && \r\n\t\t\t\t\t\t(res.data.code === 500 && res.data.msg && \r\n\t\t\t\t\t\t(res.data.msg.includes('未找到') || res.data.msg.includes('不存在')))) {\r\n\t\t\t\t\t\t// 对于指定需要忽略的错误,返回一个标准的\"成功但数据为空\"的响应\r\n\t\t\t\t\t\tresolve({\r\n\t\t\t\t\t\t\tcode: 200,\r\n\t\t\t\t\t\t\tmsg: \"操作成功\",\r\n\t\t\t\t\t\t\tdata: []\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t\treturn\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t// 仍然返回数据,由业务逻辑处理\r\n\t\t\t\t\tresolve(res.data)\r\n\t\t\t\t\treturn\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tresolve(res.data)\r\n\t\t\t},\r\n\t\t\tfail(err) {\r\n\t\t\t\t// 网络请求本身失败\r\n\t\t\t\tconsole.error(`请求失败: ${option.url}`, err)\r\n\t\t\t\treject(err)\r\n\t\t\t},\r\n\t\t\tcomplete() {\r\n\t\t\t\t// 隐藏加载提示\r\n\t\t\t\tif (!option.hideLoading) {\r\n\t\t\t\t\tuni.hideLoading()\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t})\r\n\t})\r\n}\r\n\r\n\r\nexport default request"],"names":["uni","URL","appid"],"mappings":";;;AAKK,MAAC,UAAU,CAAC,WAAW;AAC3B,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AAEvCA,kBAAA,MAAA,MAAA,OAAA,uBAAY,SAAS,OAAO,MAAM,IAAIC,WAAAA,MAAM,OAAO,GAAG,IAAI,OAAO,IAAI;AAGrE,QAAI,CAAC,OAAO,aAAa;AACxBD,oBAAAA,MAAI,YAAY;AAAA,QACf,OAAO,OAAO,eAAe;AAAA,QAC7B,MAAM;AAAA,MACV,CAAI;AAAA,IACD;AAEDA,kBAAAA,MAAI,QAAQ;AAAA,MACX,KAAKC,WAAAA,MAAM,OAAO;AAAA,MAClB,QAAQ,OAAO;AAAA,MACf,MAAM,OAAO;AAAA,MACb,QAAQ;AAAA,QACP,gBAAgB;AAAA,QACf,GAAG,OAAO;AAAA,QACX,SAASC,WAAK;AAAA,QACd,iBAAiB,YAAYF,oBAAI,eAAe,OAAO;AAAA,QACvD,YAAYA,cAAAA,MAAI,eAAe,WAAW;AAAA,MAC1C;AAAA,MACD,QAAQ,KAAK;AAEZA,4BAAA,MAAA,OAAA,wBAAY,SAAS,OAAO,GAAG,IAAI,GAAG;AAGtC,YAAI,IAAI,eAAe,KAAK;AAC3BA,wBAAAA,6CAAc,cAAc,IAAI,UAAU,IAAI,IAAI,IAAI;AAGtD,cAAI,IAAI,MAAM;AACb,oBAAQ,IAAI,IAAI;AAChB;AAAA,UACA;AAED,iBAAO,EAAC,KAAK,YAAY,IAAI,UAAU,GAAE,CAAC;AAC1C;AAAA,QACA;AAGD,YAAI,IAAI,QAAQ,IAAI,KAAK,SAAS,KAAK;AACtCA,wBAAAA,MAAa,MAAA,QAAA,wBAAA,YAAY,IAAI,KAAK,IAAI,IAAI,IAAI,IAAI;AAGlD,cAAI,OAAO,qBACT,IAAI,KAAK,SAAS,OAAO,IAAI,KAAK,QAClC,IAAI,KAAK,IAAI,SAAS,KAAK,KAAK,IAAI,KAAK,IAAI,SAAS,KAAK,KAAK;AAEjE,oBAAQ;AAAA,cACP,MAAM;AAAA,cACN,KAAK;AAAA,cACL,MAAM,CAAE;AAAA,YACf,CAAO;AACD;AAAA,UACA;AAGD,kBAAQ,IAAI,IAAI;AAChB;AAAA,QACA;AAED,gBAAQ,IAAI,IAAI;AAAA,MAChB;AAAA,MACD,KAAK,KAAK;AAETA,4BAAA,MAAA,SAAA,wBAAc,SAAS,OAAO,GAAG,IAAI,GAAG;AACxC,eAAO,GAAG;AAAA,MACV;AAAA,MACD,WAAW;AAEV,YAAI,CAAC,OAAO,aAAa;AACxBA,wBAAAA,MAAI,YAAa;AAAA,QACjB;AAAA,MACD;AAAA,IACJ,CAAG;AAAA,EACH,CAAE;AACF;;"}
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"url.js","sources":["config/url.js"],"sourcesContent":["// export const URL = \"https://notify.gxfs123.com\"\r\nexport const URL = \"http://127.0.0.1:8080\"\r\n\r\nexport const appid = \"wx3ae63fb09936b379\""],"names":[],"mappings":";AACY,MAAC,MAAM;AAEP,MAAC,QAAQ;;;"}
|
{"version":3,"file":"url.js","sources":["config/url.js"],"sourcesContent":["// export const URL = \"https://unifans.gxfs123.com\"\r\nexport const URL = \"http://127.0.0.1:8080\"\r\n\r\nexport const appid = \"wxe752f45e7f7aa271\" "],"names":[],"mappings":";AACY,MAAC,MAAM;AAEP,MAAC,QAAQ;;;"}
|
||||||
@@ -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;"}
|
||||||