diff --git a/config/api/system.js b/config/api/system.js
index 8f51466..9f16f1c 100644
--- a/config/api/system.js
+++ b/config/api/system.js
@@ -18,3 +18,12 @@ export const getNoticeTextData = (data) => {
})
}
+// 根据品牌名称获取客服信息
+export const getCommonByBrand = (brandName) => {
+ return request({
+ url: `/device/common/by/${brandName}`,
+ method: 'get',
+ hideLoading: true
+ })
+}
+
diff --git a/config/url.js b/config/url.js
index 9ee9a63..0be9782 100644
--- a/config/url.js
+++ b/config/url.js
@@ -1,6 +1,6 @@
-export const URL = "https://my.gxfs123.com/api" //正式服务器
+// export const URL = "https://my.gxfs123.com/api" //正式服务器
// export const URL = "https://fansdev.gxfs123.com/api" //测试服务器
-// export const URL = "http://192.168.5.37:8080" //本地调试
+export const URL = "http://192.168.5.120:8080" //本地调试
// export const URL = "http://127.0.0.1:8080" //本地调试
export const appid = "wx2165f0be356ae7a9" //小程序appid
\ No newline at end of file
diff --git a/pages.json b/pages.json
index a4f06ec..fb589c3 100644
--- a/pages.json
+++ b/pages.json
@@ -11,7 +11,7 @@
"style": {
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#ffffff",
- "navigationStyle": "default",
+ "navigationStyle": "custom",
"enableShareAppMessage": true,
"enableShareTimeline": true
}
diff --git a/pages/device/detail.vue b/pages/device/detail.vue
index 6396b7f..5dab198 100644
--- a/pages/device/detail.vue
+++ b/pages/device/detail.vue
@@ -38,13 +38,13 @@
ⓘ
- 5元/小时,45元/24小时
+ {{ getPricingInfoText() }}
ⓘ
- 前15分钟内归还免费,不足60分钟按60分钟计费点总封顶99元,持续计费至99元视为买断
+ {{ getDetailInfoText() }}
@@ -138,6 +138,7 @@
const deviceInfo = ref({})
const deviceId = ref('')
const deviceFeeConfig = ref({})
+ const positionInfo = ref({})
const deviceLocation = ref('一号教学楼大厅')
const batteryLevel = ref(95)
const hasActiveOrder = ref(false)
@@ -283,6 +284,11 @@
if (res.code == 200) {
deviceInfo.value = res.data.device || {}
+ // 保存 position 信息
+ if (res.data.position) {
+ positionInfo.value = res.data.position
+ }
+
// 更新设备位置信息
if (deviceInfo.value.deviceLocation) {
deviceLocation.value = deviceInfo.value.deviceLocation
@@ -377,10 +383,64 @@
const selectedPkg = reactive({
time: '1小时',
- price: '5.00'
+ price: '5'
})
const depositAmount = ref('99.00')
+ // 计算计费单位时间(分钟)
+ const getBillingUnitMinutes = () => {
+ if (!deviceFeeConfig.value || !deviceFeeConfig.value.hourPrice) return 60
+ const hourPrice = parseFloat(deviceFeeConfig.value.hourPrice)
+ // hourPrice 为 0.5 时表示 30 分钟,为 1 时表示 60 分钟
+ return hourPrice === 0.5 ? 30 : 60
+ }
+
+ // 计算每个计费单位的价格
+ const getBillingUnitPrice = () => {
+ if (!deviceFeeConfig.value || !deviceFeeConfig.value.maxHourPrice) return '5'
+ const maxHourPrice = parseFloat(deviceFeeConfig.value.maxHourPrice)
+ const hourPrice = parseFloat(deviceFeeConfig.value.hourPrice || 1)
+ // maxHourPrice 是1小时的价格,需要根据 hourPrice 换算
+ const unitPrice = maxHourPrice * hourPrice
+ return unitPrice.toFixed(2)
+ }
+
+ // 获取免费时间(分钟)
+ const getFreeMinutes = () => {
+ if (!positionInfo.value || !positionInfo.value.freeRentTime) return 15
+ return parseInt(positionInfo.value.freeRentTime)
+ }
+
+ // 计算24小时封顶价格
+ const get24HourCapPrice = () => {
+ if (!deviceFeeConfig.value || !deviceFeeConfig.value.maxHourPrice || !deviceFeeConfig.value.maxHour) return '45.00'
+ const maxHourPrice = parseFloat(deviceFeeConfig.value.maxHourPrice)
+ const maxHour = parseFloat(deviceFeeConfig.value.maxHour)
+ return (maxHourPrice * maxHour).toFixed(2)
+ }
+
+ // 生成计费说明文本
+ const getPricingInfoText = () => {
+ const unitMinutes = getBillingUnitMinutes()
+ const unitPrice = getBillingUnitPrice()
+ const maxHourPrice = deviceFeeConfig.value.maxHourPrice || '5'
+
+ if (unitMinutes === 30) {
+ return `${unitPrice}元/${unitMinutes}分钟,${maxHourPrice}元/小时`
+ } else {
+ return `${maxHourPrice}元/小时`
+ }
+ }
+
+ // 生成详细说明文本
+ const getDetailInfoText = () => {
+ const freeMinutes = getFreeMinutes()
+ const unitMinutes = getBillingUnitMinutes()
+ const depositAmount = deviceInfo.value.depositAmount || '99'
+
+ return `前${freeMinutes}分钟内归还免费,不足${unitMinutes}分钟按${unitMinutes}分钟计费,封顶${depositAmount}元,持续计费至${depositAmount}元视为买断`
+ }
+
// 提交租借订单
const submitRentOrder = async (payWay) => {
try {
diff --git a/pages/expressReturn/detail.vue b/pages/expressReturn/detail.vue
index a46f325..9cc95f5 100644
--- a/pages/expressReturn/detail.vue
+++ b/pages/expressReturn/detail.vue
@@ -88,6 +88,7 @@