diff --git a/components/LocationListSheet.vue b/components/LocationListSheet.vue
index 7657e75..0c57b5a 100644
--- a/components/LocationListSheet.vue
+++ b/components/LocationListSheet.vue
@@ -40,7 +40,7 @@
import { computed } from 'vue'
import { useI18n } from '@/utils/i18n.js'
- const { t: $t } = useI18n()
+ const { t } = useI18n()
const props = defineProps({
show: { type: Boolean, default: false },
diff --git a/components/MapComponent.vue b/components/MapComponent.vue
index 1bfe736..e36a81a 100644
--- a/components/MapComponent.vue
+++ b/components/MapComponent.vue
@@ -1,5 +1,5 @@
-
+
@@ -68,7 +68,7 @@
import { useI18n } from '../utils/i18n.js'
// 获取 i18n 实例
- const { t: $t } = useI18n()
+ const { t } = useI18n()
// 引用折叠面板组件的ref
const collapseRef = ref(null)
@@ -272,13 +272,19 @@
const onMapRegionChange = (e) => {
// 只处理结束事件
- if (!e || e.type !== 'end') {
+ if (!e || (e.type !== 'end' && e.type !== 'regionchange')) {
return
}
const causedBy = e.causedBy || e.detail?.causedBy
- if (causedBy === 'gesture' || causedBy === 'scale' || causedBy === 'drag'||causedBy==='update') {
+ // H5 环境下可能没有 causedBy,只要是 end 事件就处理
+ const isH5 = false;
+ // #ifdef H5
+ const h5Status = true;
+ // #endif
+
+ if (causedBy === 'gesture' || causedBy === 'scale' || causedBy === 'drag' || causedBy === 'update' || (typeof h5Status !== 'undefined' && e.type === 'end')) {
// 清除之前的定时器
if (regionChangeTimer) {
clearTimeout(regionChangeTimer)
@@ -481,22 +487,26 @@ const handleSearch = () => {
/* 地图容器 */
.map-container {
flex: 1;
+ position: relative;
// position: fixed;
// top: 0;
left: 0;
right: 0;
bottom: 0;
width: 94vw;
- height: calc(100% - 20rpx); /* 减少高度,避免覆盖底部按钮 */
+ height: var(--map-height, calc(100% - 20rpx)); /* 使用变量或默认高度 */
margin: 20rpx;
margin-bottom: 0; /* 底部不需要边距 */
border-radius: 20rpx;
overflow: hidden;
+ display: flex;
+ flex-direction: column;
&.full-width {
width: 100%;
margin: 0;
border-radius: 0;
+ height: 100%;
}
.map-wrapper {
diff --git a/components/OrderItemCard.vue b/components/OrderItemCard.vue
index 8aedfcf..3a14f47 100644
--- a/components/OrderItemCard.vue
+++ b/components/OrderItemCard.vue
@@ -98,7 +98,7 @@
import { computed } from 'vue';
import { useI18n } from '@/utils/i18n.js'
- const { t: $t } = useI18n()
+ const { t } = useI18n()
const props = defineProps({
order: { type: Object, required: true },
@@ -144,7 +144,7 @@
const isFinished = computed(() => normalizedStatus.value === 'used_done');
const isCancelled = computed(() => normalizedStatus.value === 'order_cancelled');
- const titleText = computed(() => $t('order.rentFan'));
+ const titleText = computed(() => t('order.rentFan'));
// 显示金额(优先后端给定字段)
const displayAmount = computed(() => props.order.amount || props.order.payAmount || props.order.actualDeviceAmount || props.order.currentFee || '0.00');
@@ -158,8 +158,8 @@
const minutes = Math.floor(diffMs / 60000);
const hours = Math.floor(minutes / 60);
const mins = minutes % 60;
- if (hours > 0) return `${hours}${$t('time.hour')}${mins}${$t('time.minute')}`;
- return `${mins}${$t('time.minute')}`;
+ if (hours > 0) return `${hours}${t('time.hour')}${mins}${t('time.minute')}`;
+ return `${mins}${t('time.minute')}`;
});
function parseDate(str) {
diff --git a/config/api/device.js b/config/api/device.js
index 77793b0..2a9d99f 100644
--- a/config/api/device.js
+++ b/config/api/device.js
@@ -79,3 +79,15 @@ export const forcefOpenEmptyGrid = (deviceNo) => {
})
}
+// 发送租借指令
+export const sendRentCommand = (data) => {
+ return request({
+ url: '/app/device/sendRentCommand',
+ method: 'post',
+ data,
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded'
+ }
+ })
+}
+
diff --git a/config/api/order.js b/config/api/order.js
index 2c65395..0a80f57 100644
--- a/config/api/order.js
+++ b/config/api/order.js
@@ -104,6 +104,38 @@ export const closeWithMaxFee = (orderNo) => {
})
}
+// 创建微信支付订单
+export const createWxPayment = (orderNo) => {
+ return request({
+ url: `/app/wx-payment/create/${orderNo}`,
+ method: 'get'
+ })
+}
+
+// 获取正在使用中的订单
+export const getInUseOrder = () => {
+ return request({
+ url: '/app/order/inUse',
+ method: 'get'
+ })
+}
+
+// 获取待支付订单
+export const getUnpaidOrder = () => {
+ return request({
+ url: '/app/order/unpaid',
+ method: 'get'
+ })
+}
+
+// 查询微信支付状态
+export const getWxPaymentStatus = (orderNo) => {
+ return request({
+ url: `/app/wx-payment/status/${orderNo}`,
+ method: 'get'
+ })
+}
+
// 通过订单号获取支付分订单信息
export const getOrderByOrderNoScore = (orderNo) => {
console.log('通过订单号获取支付分订单信息', orderNo);
diff --git a/config/api/system.js b/config/api/system.js
index 361ff6c..4ade900 100644
--- a/config/api/system.js
+++ b/config/api/system.js
@@ -27,12 +27,38 @@ export const getCommonByBrand = (brandName) => {
})
}
-// 查询激活的且临近关闭时间最近的活动
-export const getActiveActivity = () => {
- return request({
- url: '/device/activity/agent/list',
- method: 'get',
- hideLoading: true
- })
+// 获取当前协议内容
+export const getCurrentAgreement = (data) => {
+ return request({
+ url: '/device/agreementConfig/current',
+ method: 'get',
+ data
+ })
+}
+
+// 获取当前广告内容
+export const getCurrentAdvertisement = (data) => {
+ return request({
+ url: '/device/advertisementConfig/current',
+ method: 'get',
+ data
+ })
+}
+
+// 获取当前公告内容
+export const getCurrentAnnouncement = (data) => {
+ return request({
+ url: '/device/announcementConfig/current',
+ method: 'get',
+ data
+ })
+}
+
+export const getActiveActivity = (data) => {
+ return request({
+ url: '/device/activeActivity/current',
+ method: 'get',
+ data
+ })
}
diff --git a/config/api/user.js b/config/api/user.js
index 46eb7f7..1d63bf2 100644
--- a/config/api/user.js
+++ b/config/api/user.js
@@ -10,6 +10,24 @@ export const login = (data) => {
})
}
+// 发送验证码
+export const sendVerifyCode = (phonenumber) => {
+ return request({
+ url: '/app/user/sms/code',
+ method: 'get',
+ data: { phonenumber }
+ })
+}
+
+// 手机号+验证码登录
+export const loginWithCode = (phonenumber, smsCode) => {
+ return request({
+ url: '/app/user/sms/login',
+ method: 'post',
+ data: { phonenumber, smsCode }
+ })
+}
+
// 用户退出登录
export const userLogout = (data) => {
return request({
@@ -56,7 +74,8 @@ export const uploadUserAvatar = (filePath) => {
header: {
'appid': appid,
'Authorization': 'Bearer ' + uni.getStorageSync('token'),
- 'Clientid': uni.getStorageSync('client_id')
+ 'Clientid': uni.getStorageSync('client_id'),
+ 'Content-Language': (uni.getStorageSync('language') || 'zh-CN').replace(/-/g, '_')
},
success: (res) => {
try {
@@ -83,7 +102,8 @@ export const uploadOssResource = (filePath) => {
header: {
'appid': appid,
'Authorization': 'Bearer ' + uni.getStorageSync('token'),
- 'Clientid': uni.getStorageSync('client_id')
+ 'Clientid': uni.getStorageSync('client_id'),
+ 'Content-Language': (uni.getStorageSync('language') || 'zh-CN').replace(/-/g, '_')
},
success: (res) => {
try {
@@ -115,3 +135,12 @@ export const withdrawDeposit = (orderNo) => {
})
}
+// 获取微信用户手机号
+export const getWxUserPhoneNumber = (data) => {
+ return request({
+ url: '/app/user/getPhoneNumber',
+ method: 'post',
+ data
+ })
+}
+
diff --git a/config/http.js b/config/http.js
index eb0073e..44c0d41 100644
--- a/config/http.js
+++ b/config/http.js
@@ -33,7 +33,8 @@ const request = (option) => {
...option.headers,
'appid': appid,
'Authorization': "Bearer " + uni.getStorageSync('token'),
- 'Clientid': uni.getStorageSync('client_id')
+ 'Clientid': uni.getStorageSync('client_id'),
+ 'Content-Language': (uni.getStorageSync('language') || 'zh-CN').replace(/-/g, '_')
},
success(res) {
diff --git a/config/url.js b/config/url.js
index f1c0198..542c40a 100644
--- a/config/url.js
+++ b/config/url.js
@@ -1,7 +1,7 @@
// export const URL = "https://my.gxfs123.com/api" //正式服务器-弃用
// export const URL = "https://manager.fdzpower.com/api" //正式服务器
export const URL = "https://fansdev.gxfs123.com/api" //测试服务器
-// export const URL = "http://192.168.5.52:8080" //本地调试
+// export const URL = "http://192.168.5.123:8080" //本地调试
// export const URL = "http://127.0.0.1:8080" //本地调试
export const appid = "wx2165f0be356ae7a9" //微信小程序appid
diff --git a/locale/en-US.js b/locale/en-US.js
index 97126cb..4799551 100644
--- a/locale/en-US.js
+++ b/locale/en-US.js
@@ -49,6 +49,8 @@ export default {
loginRequired: 'Please login first',
operationSuccess: 'Operation successful',
operationFailed: 'Operation failed',
+ sending: 'Sending...',
+ loggingIn: 'Logging in...',
refresh: 'Refresh',
pull: 'Pull to refresh',
release: 'Release to refresh',
@@ -114,7 +116,8 @@ export default {
businessHours: 'Business Hours: ',
navigateHere: 'Navigate Here',
coordinateError: 'Invalid location coordinates',
- notExist: 'Location does not exist'
+ notExist: 'Location does not exist',
+ supportCouponOrMember: 'Coupons & Cards Available'
},
device: {
@@ -172,6 +175,8 @@ export default {
deposit: 'Deposit',
rentFee: 'Rent Fee',
payNow: 'Pay Now',
+ myCoupons:'Coupons',
+ myCards:'Member Cards',
cancelOrder: 'Cancel Order',
quickReturn: 'Quick Return',
returnDevice: 'Return Device',
@@ -246,6 +251,8 @@ export default {
perHalfHour: 'per half hour',
deviceNoEject: 'Not Ejected',
returnReminder: 'Return Reminder',
+ canUsePromotion: 'Coupons & Cards Available',
+ usedPromotion: 'Promotion Applied',
convertToOwn: 'Don\'t want to return? Convert to own',
convertToOwnTitle: 'Convert to Own',
convertToOwnConfirm: 'Only ¥99 to convert to own. The power bank will be yours. Confirm?',
@@ -261,7 +268,9 @@ export default {
deviceNoEjectTitle: 'Device Not Ejected',
deviceNoEjectConfirm: 'Your power bank didn\'t eject? We will handle it immediately, expected to resolve within 5 minutes.',
deviceNoEjectSuccess: 'Feedback received, will be handled within 5 minutes',
- deviceNoEjectFailed: 'Feedback submission failed, please try again'
+ deviceNoEjectFailed: 'Feedback submission failed, please try again',
+ returnProblemTip: 'After returning, if the order is still active, please go to ',
+ contactStaff: ' to contact staff.'
},
user: {
@@ -327,7 +336,22 @@ export default {
phoneSuccess: 'Success',
phoneError: 'Error',
phoneGetFailed: 'Failed',
- authCodeFailed: 'Auth failed'
+ authCodeFailed: 'Auth failed',
+ phoneLogin: 'Phone Login',
+ phonePlaceholder: 'Enter phone number',
+ codePlaceholder: 'Enter verification code',
+ getCode: 'Get Code',
+ resend: 'Resend',
+ loginBtn: 'Login',
+ phoneRequired: 'Phone required',
+ phoneInvalid: 'Invalid phone number',
+ codeRequired: 'Verification code required',
+ codeSent: 'Code sent',
+ sendCodeFailed: 'Send code failed',
+ regionNotSupported: 'Non-mainland China, Hong Kong, Macau users please login via platform phone authorization',
+ onlyMainlandSupported: 'Currently only Mainland China is supported',
+ getServicePhoneFailed: 'Failed to get service phone',
+ noAuthToken: 'Login successful but no credentials obtained'
},
permission: {
@@ -361,7 +385,9 @@ export default {
package: 'Package',
total: 'Total',
paymentFailedRetry: 'Payment failed, retry?',
- createPayOrderFailed: 'Failed'
+ createPayOrderFailed: 'Failed',
+ subscriptionSuccess: 'Subscription successful',
+ subscriptionFailed: 'Subscription failed, please try again'
},
feedback: {
@@ -421,6 +447,7 @@ export default {
phone: 'Phone',
email: 'Email',
workingHours: 'Working Hours',
+ workingHoursValue: 'Mon-Sun 09:00-22:00',
functionDeveloping: 'Feature in development',
faq1Question: 'How to rent a fan?',
faq1Answer: 'Click "Scan to Rent" on the homepage, scan the QR code on the device with WeChat, and complete payment as prompted.',
@@ -440,6 +467,7 @@ export default {
languageSetting: 'Language Setting',
chinese: '简体中文',
english: 'English',
+ languageSwitched: 'Language switched, refreshing...',
notification: 'Notification',
privacy: 'Privacy',
about: 'About',
@@ -664,6 +692,8 @@ export default {
withdrawNotice2: 'Withdrawal expected to arrive within 0-7 business days',
withdrawNotice3: 'If delayed, please contact customer service',
depositRecord: 'Deposit Record',
+ payRecord: 'Payment Record',
+ refundRecord: 'Refund Record',
orderNotReturned: 'Current order not returned, please return before withdraw',
alreadyRefunded: 'Deposit already refunded',
refundProcessing: 'Refund processing, please wait'
@@ -719,7 +749,7 @@ export default {
type: 'Type',
timesCard: 'Times Card',
durationCard: 'Duration Card',
- remainingTimes: 'Remaining Times',
+ remainingTimes: 'Remaining: ',
remainingDuration: 'Remaining Duration',
hours: 'Hours',
validPeriod: 'Valid Period',
@@ -730,7 +760,23 @@ export default {
price: 'Purchase Price',
noCards: 'No cards',
buyNow: 'Buy Now',
- getListFailed: 'Failed to get card list'
+ getListFailed: 'Failed to get card list',
+ dailyLimit: 'Daily Limit',
+ singleTimeLimit: 'Single Use Limit',
+ unlimited: 'Unlimited',
+ times: 'Times',
+ minutes: 'Minutes',
+ validWithinDays: 'days valid',
+ validFromPurchase: 'Valid from purchase',
+ daysValid: 'days',
+ currentCycleUsed: 'Current Cycle Used',
+ totalCount: 'Total Count',
+ expire: 'Expire',
+ expiredOn: 'Expired on ',
+ renew: 'Renew',
+ toUse: 'Use Now',
+ onlyForRegionBefore: 'Only for ',
+ onlyForRegionAfter: ''
},
myCoupon: {
@@ -744,7 +790,9 @@ export default {
noUsedCoupons: 'No used coupons',
noExpiredCoupons: 'No expired coupons',
buyNow: 'Buy Now',
- getListFailed: 'Failed to get coupon list'
+ getListFailed: 'Failed to get coupon list',
+ onlyForRegionBefore: 'Only for ',
+ onlyForRegionAfter: ''
}
}
diff --git a/locale/zh-CN.js b/locale/zh-CN.js
index e735b78..49ef9ac 100644
--- a/locale/zh-CN.js
+++ b/locale/zh-CN.js
@@ -49,6 +49,8 @@ export default {
loginRequired: '请先登录',
operationSuccess: '操作成功',
operationFailed: '操作失败',
+ sending: '发送中...',
+ loggingIn: '登录中...',
refresh: '刷新',
pull: '下拉刷新',
release: '释放刷新',
@@ -114,7 +116,8 @@ export default {
businessHours: '营业时间:',
navigateHere: '导航去这',
coordinateError: '该场地坐标信息异常',
- notExist: '场地不存在'
+ notExist: '场地不存在',
+ supportCouponOrMember: '可使用优惠券、会员卡'
},
device: {
@@ -171,6 +174,8 @@ export default {
payAmount: '支付金额',
deposit: '押金',
rentFee: '租金',
+ myCards:'会员卡优惠',
+ myCoupons:'优惠券优惠',
payNow: '立即支付',
cancelOrder: '取消订单',
quickReturn: '快速归还',
@@ -246,6 +251,8 @@ export default {
perHalfHour: '每半小时',
deviceNoEject: '宝未弹出',
returnReminder: '归还提醒',
+ canUsePromotion: '可使用优惠券、会员卡',
+ usedPromotion: '已享受优惠',
convertToOwn: '不想还了?点击转为自用',
convertToOwnTitle: '转为自用',
convertToOwnConfirm: '仅需花费99元,即可转为自用,充电宝将归您所有,确认操作吗?',
@@ -261,7 +268,9 @@ export default {
deviceNoEjectTitle: '充电宝未弹出',
deviceNoEjectConfirm: '您的充电宝未弹出吗?我们将立即为您处理,预计5分钟内解决问题。',
deviceNoEjectSuccess: '反馈已受理,将在5分钟内处理',
- deviceNoEjectFailed: '反馈提交失败,请稍后重试'
+ deviceNoEjectFailed: '反馈提交失败,请稍后重试',
+ returnProblemTip: '产品归还入仓后,订单仍未结束,请前往',
+ contactStaff: '联系工作人员。'
},
user: {
@@ -327,7 +336,22 @@ export default {
phoneSuccess: '手机号获取成功',
phoneError: '获取手机号异常',
phoneGetFailed: '获取手机号失败',
- authCodeFailed: '获取授权码失败'
+ authCodeFailed: '获取授权码失败',
+ phoneLogin: '手机号登录',
+ phonePlaceholder: '请输入手机号码',
+ codePlaceholder: '请输入验证码',
+ getCode: '获取验证码',
+ resend: '重新发送',
+ loginBtn: '立即登录',
+ phoneRequired: '请输入手机号',
+ phoneInvalid: '请输入正确的手机号',
+ codeRequired: '请输入验证码',
+ codeSent: '验证码已发送',
+ sendCodeFailed: '发送验证码失败',
+ regionNotSupported: '非大陆、香港、澳门用户请通过平台手机号授权登录',
+ onlyMainlandSupported: '当前仅支持中国大陆地区',
+ getServicePhoneFailed: '获取客服电话失败',
+ noAuthToken: '登录成功但未获取到授权凭证'
},
permission: {
@@ -361,7 +385,9 @@ export default {
package: '套餐',
total: '合计',
paymentFailedRetry: '支付失败,请重试',
- createPayOrderFailed: '创建支付订单失败'
+ createPayOrderFailed: '创建支付订单失败',
+ subscriptionSuccess: '订阅成功',
+ subscriptionFailed: '订阅失败,请稍后重试'
},
feedback: {
@@ -421,6 +447,7 @@ export default {
phone: '电话',
email: '邮箱',
workingHours: '工作时间',
+ workingHoursValue: '周一至周日 09:00-22:00',
functionDeveloping: '功能开发中',
faq1Question: '如何租借风扇?',
faq1Answer: '点击首页"扫码租借"按钮,使用微信扫描设备上的二维码,按提示完成支付即可使用。',
@@ -440,6 +467,7 @@ export default {
languageSetting: '语言设置',
chinese: '简体中文',
english: 'English',
+ languageSwitched: '语言已切换,正在刷新...',
notification: '通知',
privacy: '隐私',
about: '关于',
@@ -664,6 +692,8 @@ export default {
withdrawNotice2: '提现申请提交后预计0-7个工作日到账',
withdrawNotice3: '如超时未收到,请联系客服处理',
depositRecord: '押金记录',
+ payRecord: '支付记录',
+ refundRecord: '退还记录',
orderNotReturned: '当前订单尚未归还,请归还后再提现',
alreadyRefunded: '押金已退还,无需重复提现',
refundProcessing: '押金退还处理中,请耐心等待'
@@ -719,32 +749,50 @@ export default {
type: '类型',
timesCard: '次卡',
durationCard: '时长卡',
- remainingTimes: '剩余次数',
+ remainingTimes: '剩余次数:',
remainingDuration: '剩余时长',
hours: '小时',
validPeriod: '有效期',
active: '使用中',
- expired: '已过期',
+ expired: '已失效',
used: '已用完',
position: '使用地点',
price: '购买价格',
noCards: '暂无会员卡',
buyNow: '立即购买',
- getListFailed: '获取会员卡列表失败'
+ getListFailed: '获取会员卡列表失败',
+ dailyLimit: '每日限用',
+ singleTimeLimit: '单次限时',
+ unlimited: '不限',
+ times: '次',
+ minutes: '分钟',
+ validWithinDays: '天内有效',
+ validFromPurchase: '从购买时间起',
+ daysValid: '天有效',
+ currentCycleUsed: '本周期已使用',
+ totalCount: '总次数',
+ expire: '到期',
+ expiredOn: '失效于',
+ renew: '续卡',
+ toUse: '去使用',
+ onlyForRegionBefore: '仅限',
+ onlyForRegionAfter: '使用'
},
myCoupon: {
available: '可使用',
used: '已使用',
expired: '已过期',
- useNow: '立即使用',
+ useNow: '去使用',
usedStatus: '已使用',
expiredStatus: '已过期',
noAvailableCoupons: '暂无可用优惠券',
noUsedCoupons: '暂无已使用优惠券',
noExpiredCoupons: '暂无已过期优惠券',
buyNow: '立即购买',
- getListFailed: '获取优惠券列表失败'
+ getListFailed: '获取优惠券列表失败',
+ onlyForRegionBefore: '仅限',
+ onlyForRegionAfter: '使用'
}
}
diff --git a/manifest.json b/manifest.json
index d95e362..e7162b1 100644
--- a/manifest.json
+++ b/manifest.json
@@ -81,6 +81,19 @@
"mp-toutiao" : {
"usingComponents" : true
},
+ "h5" : {
+ "sdkConfigs" : {
+ "maps" : {
+ "qqmap" : {
+ "key" : "DJQBZ-WB53Q-WPS5B-4S6J7-53RMS-X4FJ2"
+ }
+ }
+ },
+ "router" : {
+ "mode" : "hash",
+ "base" : "./"
+ }
+ },
"uniStatistics" : {
"enable" : false
},
diff --git a/pages.json b/pages.json
index fedef6e..0931d37 100644
--- a/pages.json
+++ b/pages.json
@@ -19,7 +19,15 @@
"path": "pages/login/index",
"style": {
"navigationBarTitleText": "",
- "navigationBarBackgroundColor": "#ffffff",
+ "navigationBarBackgroundColor": "#C8F4D9",
+ "navigationBarTextStyle": "black"
+ }
+ },
+ {
+ "path": "pages/login/phone",
+ "style": {
+ "navigationBarTitleText": "",
+ "navigationBarBackgroundColor": "#C8F4D9",
"navigationBarTextStyle": "black"
}
},
diff --git a/pages/deposit/index.vue b/pages/deposit/index.vue
index 32d3719..9b4b6bd 100644
--- a/pages/deposit/index.vue
+++ b/pages/deposit/index.vue
@@ -26,11 +26,11 @@
- {{ item.type }}
+ {{ item.typeText }}
{{ item.time }}
-
- {{ item.type === '退还' ? '+' : '-' }}¥{{ item.amount }}
+
+ {{ item.type === 'refund' ? '+' : '-' }}¥{{ item.amount }}
@@ -38,163 +38,145 @@
-
@@ -338,4 +320,4 @@ export default {
}
}
}
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/pages/device/detail.vue b/pages/device/detail.vue
index 1a6b168..57ac843 100644
--- a/pages/device/detail.vue
+++ b/pages/device/detail.vue
@@ -131,7 +131,9 @@
import {
getOrderByOrderNoScore,
getOrderByOrderNo,
- cancelOrder
+ cancelOrder,
+ getInUseOrder,
+ getUnpaidOrder
} from '@/config/api/order.js'
import {
initiateWeChatScorePayment,
@@ -143,7 +145,7 @@
} from '@/utils/i18n.js'
const {
- t: $t
+ t
} = useI18n()
// 响应式状态
@@ -154,7 +156,7 @@
const deviceLocation = ref('一号教学楼大厅')
const hasActiveOrder = ref(false)
const deviceStatus = reactive({
- text: $t('device.available'),
+ text: t('device.available'),
class: 'available'
})
const isLoggedIn = ref(true)
@@ -175,7 +177,7 @@
onMounted(async () => {
uni.setNavigationBarTitle({
- title: $t('device.deviceInfo')
+ title: t('device.deviceInfo')
})
await checkUserPhone()
await fetchDeviceInfo()
@@ -219,7 +221,7 @@
// 用户拒绝授权的情况
if (e.detail.errMsg && e.detail.errMsg.includes('deny')) {
uni.showToast({
- title: $t('auth.phoneRequired'),
+ title: t('auth.phoneRequired'),
icon: 'none'
})
return
@@ -228,7 +230,7 @@
// 获取到授权code
if (e.detail.code) {
uni.showLoading({
- title: $t('auth.getting')
+ title: t('auth.getting')
})
console.log('获取到的授权code:', e.detail.code)
@@ -260,15 +262,15 @@
showPhoneAuthPopup.value = false
uni.showToast({
- title: $t('auth.phoneSuccess'),
+ title: t('auth.phoneSuccess'),
icon: 'success'
})
} else {
// 记录详细信息,不抛出错误
console.warn('获取手机号响应异常:', res.msg || '未知错误')
uni.showModal({
- title: $t('auth.phoneError'),
- content: `${$t('common.statusCode')}: ${res.code}, ${$t('common.message')}: ${res.msg || $t('common.none')}`,
+ title: t('auth.phoneError'),
+ content: `${t('common.statusCode')}: ${res.code}, ${t('common.message')}: ${res.msg || t('common.none')}`,
showCancel: false
})
}
@@ -280,8 +282,8 @@
// 显示更详细的错误信息
let errMsg = err.message || err.toString()
uni.showModal({
- title: $t('auth.phoneGetFailed'),
- content: $t('common.errorInfo') + ': ' + errMsg,
+ title: t('auth.phoneGetFailed'),
+ content: t('common.errorInfo') + ': ' + errMsg,
showCancel: false
})
})
@@ -289,14 +291,14 @@
uni.hideLoading()
console.error('获取手机号外部错误:', outerError)
uni.showModal({
- title: $t('common.unexpectedError'),
- content: $t('common.processException') + ': ' + (outerError.message || outerError),
+ title: t('common.unexpectedError'),
+ content: t('common.processException') + ': ' + (outerError.message || outerError),
showCancel: false
})
}
} else {
uni.showToast({
- title: $t('auth.authCodeFailed'),
+ title: t('auth.authCodeFailed'),
icon: 'none'
})
}
@@ -325,10 +327,10 @@
// 更新设备状态
if (deviceInfo.value.status) {
if (deviceInfo.value.status === 'online') {
- deviceStatus.text = $t('device.available')
+ deviceStatus.text = t('device.available')
deviceStatus.class = 'available'
} else if (deviceInfo.value.status === 'offline') {
- deviceStatus.text = $t('device.offline')
+ deviceStatus.text = t('device.offline')
deviceStatus.class = 'offline'
}
}
@@ -349,9 +351,9 @@
// 显示登录提示
const showLoginTip = () => {
uni.showModal({
- title: $t('common.tips'),
- content: $t('common.loginRequired'),
- confirmText: $t('auth.goToLogin'),
+ title: t('common.tips'),
+ content: t('common.loginRequired'),
+ confirmText: t('auth.goToLogin'),
success: (res) => {
if (res.confirm) {
uni.navigateTo({
@@ -374,27 +376,29 @@
const checkOrderStatus = async () => {
try {
// 调用接口检查是否有进行中的订单
- const result = await uni.$api.checkActiveOrder()
+ const inUseRes = await getInUseOrder()
+ if (inUseRes && inUseRes.code === 200 && inUseRes.data) {
+ const order = inUseRes.data
+ // 如果有正在进行的订单,跳转到归还页面,带上设备ID
+ uni.redirectTo({
+ url: `/pages/device/return?deviceId=${deviceId.value}`
+ })
+ return
+ }
- 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=${deviceId.value}`
- })
- } else if (order.status === 'in_used') {
- // 如果有正在进行的订单,跳转到归还页面,带上设备ID
- uni.redirectTo({
- url: `/pages/device/return?deviceId=${deviceId.value}`
- })
- }
+ // 检查是否有待支付的订单
+ const unpaidRes = await getUnpaidOrder()
+ if (unpaidRes && unpaidRes.code === 200 && unpaidRes.data) {
+ const order = unpaidRes.data
+ // 跳转支付页面,带上订单ID
+ uni.redirectTo({
+ url: `/pages/order/payment?orderId=${order.orderId}&deviceId=${deviceId.value}`
+ })
}
} catch (error) {
+ console.error('检查订单状态失败:', error)
uni.showToast({
- title: $t('order.getOrderStatusFailed'),
+ title: t('order.getOrderStatusFailed'),
icon: 'none'
})
}
@@ -427,7 +431,7 @@
return '30分钟'
}
// 按小时计费(默认)
- return $t('time.hour')
+ return t('time.hour')
}
// 计算计费单位时间(分钟)
@@ -499,7 +503,7 @@
const submitRentOrder = async (payWay) => {
try {
uni.showLoading({
- title: $t('common.processing')
+ title: t('common.processing')
})
// --- 第一步:先请求订阅消息(必须在用户点击的同步上下文中)---
if (payWay === 'wx-score-pay') {
@@ -532,7 +536,7 @@
// 调用设备租借接口
const rentResult = await rentPowerBank(deviceId.value, phoneNumber.value)
if (rentResult.code !== 200) {
- throw new Error(rentResult.msg || $t('device.rentFailed'))
+ throw new Error(rentResult.msg || t('device.rentFailed'))
}
// 获取后端返回的订单信息
@@ -587,7 +591,7 @@
// 用户取消授权,需要取消订单
try {
uni.showLoading({
- title: $t('order.cancelling')
+ title: t('order.cancelling')
});
const cancelRes = await cancelOrder({
orderId: order.orderNo
@@ -596,7 +600,7 @@
uni.hideLoading();
uni.showToast({
- title: $t('order.orderCancelled'),
+ title: t('order.orderCancelled'),
icon: 'none',
duration: 2000
});
@@ -611,7 +615,7 @@
console.error('取消订单失败:', cancelError);
uni.hideLoading();
uni.showToast({
- title: $t('order.cancelFailedContactService'),
+ title: t('order.cancelFailedContactService'),
icon: 'none'
});
}
@@ -622,7 +626,7 @@
// 支付分调用异常,也需要取消订单
try {
uni.showLoading({
- title: $t('order.cancelling')
+ title: t('order.cancelling')
});
const cancelRes = await cancelOrder({
orderId: order.orderNo
@@ -635,7 +639,7 @@
}
uni.showToast({
- title: $t('device.payScoreFailedCancelled'),
+ title: t('device.payScoreFailedCancelled'),
icon: 'none'
});
@@ -647,7 +651,7 @@
}
} else {
uni.showToast({
- title: res?.msg || $t('device.getPayParamsFailed'),
+ title: res?.msg || t('device.getPayParamsFailed'),
icon: 'none'
});
}
@@ -655,7 +659,7 @@
} catch (error) {
uni.hideLoading()
uni.showToast({
- title: error.message || $t('device.rentFailedRetry'),
+ title: error.message || t('device.rentFailedRetry'),
icon: 'none'
})
}
diff --git a/pages/expressReturn/addExpressReturn.vue b/pages/expressReturn/addExpressReturn.vue
index 3c3a50d..fe37557 100644
--- a/pages/expressReturn/addExpressReturn.vue
+++ b/pages/expressReturn/addExpressReturn.vue
@@ -62,11 +62,11 @@
} from '@/config/api/expressReturn.js'
import { useI18n } from '@/utils/i18n.js'
- const { t: $t } = useI18n()
+ const { t } = useI18n()
onMounted(() => {
uni.setNavigationBarTitle({
- title: $t('express.fillExpress')
+ title: t('express.fillExpress')
})
})
@@ -96,7 +96,7 @@
if (!orderId.value) {
uni.showToast({
- title: $t('express.orderNoMissing'),
+ title: t('express.orderNoMissing'),
icon: 'none'
})
setTimeout(() => {
@@ -111,7 +111,7 @@
const loadOrder = async () => {
try {
uni.showLoading({
- title: $t('common.loading')
+ title: t('common.loading')
})
const res = await queryById(orderId.value)
if (res?.code === 200 && res.data) {
@@ -121,11 +121,11 @@
// 默认联系电话可回填订单上的手机号(若有)
if (res.data.phone && !phone.value) phone.value = res.data.phone
} else {
- throw new Error(res?.msg || $t('order.getOrderFailed'))
+ throw new Error(res?.msg || t('order.getOrderFailed'))
}
} catch (e) {
uni.showToast({
- title: e.message || $t('express.loadFailed'),
+ title: e.message || t('express.loadFailed'),
icon: 'none'
})
} finally {
@@ -136,7 +136,7 @@
const loadRecordAndOrderByRecord = async () => {
try {
uni.showLoading({
- title: $t('common.loading')
+ title: t('common.loading')
})
const res = await getExpressReturnDetail(recordId.value)
if (res?.code === 200 && res.data) {
@@ -146,11 +146,11 @@
}
if (res.data.userPhone && !phone.value) phone.value = res.data.userPhone
} else {
- throw new Error(res?.msg || $t('express.getRecordFailed'))
+ throw new Error(res?.msg || t('express.getRecordFailed'))
}
} catch (e) {
uni.showToast({
- title: e.message || $t('express.loadFailed'),
+ title: e.message || t('express.loadFailed'),
icon: 'none'
})
} finally {
@@ -166,10 +166,10 @@
if (rec.status === 0) {
recordId.value = rec.id
uni.showModal({
- title: $t('common.tips'),
- content: $t('express.existingReturnNotice'),
- confirmText: $t('express.goToFill'),
- cancelText: $t('common.cancel'),
+ title: t('common.tips'),
+ content: t('express.existingReturnNotice'),
+ confirmText: t('express.goToFill'),
+ cancelText: t('common.cancel'),
success: (r) => {
if (r.confirm) {
uni.redirectTo({
@@ -181,7 +181,7 @@
return
} else {
uni.showToast({
- title: $t('express.alreadyHasRecord'),
+ title: t('express.alreadyHasRecord'),
icon: 'none'
})
setTimeout(() => {
@@ -201,14 +201,14 @@
const digits = (phone.value || '').replace(/\D/g, '')
if (!digits || digits.length < 5) {
uni.showToast({
- title: $t('express.pleaseEnterValidPhone'),
+ title: t('express.pleaseEnterValidPhone'),
icon: 'none'
})
return false
}
if (isFillMode.value && !trackingNumber.value) {
uni.showToast({
- title: $t('express.pleaseEnterTrackingNo'),
+ title: t('express.pleaseEnterTrackingNo'),
icon: 'none'
})
return false
@@ -221,7 +221,7 @@
submitting.value = true
try {
uni.showLoading({
- title: isFillMode.value ? $t('common.filling') : $t('common.submitting')
+ title: isFillMode.value ? t('common.filling') : t('common.submitting')
})
let res
if (isFillMode.value) {
@@ -238,18 +238,18 @@
}
if (res && res.code === 200) {
uni.showToast({
- title: isFillMode.value ? '补填成功' : '提交成功',
+ title: isFillMode.value ? t('express.fillSuccess') : t('express.submitSuccess'),
icon: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 800)
} else {
- throw new Error(res?.msg || (isFillMode.value ? '补填失败' : '提交失败'))
+ throw new Error(res?.msg || (isFillMode.value ? t('express.fillFailed') : t('express.submitFailed')))
}
} catch (e) {
uni.showToast({
- title: e.message || (isFillMode.value ? '补填失败' : '提交失败'),
+ title: e.message || (isFillMode.value ? t('express.fillFailed') : t('express.submitFailed')),
icon: 'none'
})
} finally {
diff --git a/pages/expressReturn/detail.vue b/pages/expressReturn/detail.vue
index 6ab9c27..fa12904 100644
--- a/pages/expressReturn/detail.vue
+++ b/pages/expressReturn/detail.vue
@@ -91,7 +91,7 @@ import { getExpressReturnDetail } from '@/config/api/expressReturn.js'
import { getCustomerPhone } from '@/util/index.js'
import { useI18n } from '@/utils/i18n.js'
-const { t: $t } = useI18n()
+const { t } = useI18n()
// 详情数据
const detailData = ref({
@@ -131,21 +131,21 @@ const getStatusIcon = (status) => {
// 获取状态文本
const getStatusText = (status) => {
const textMap = {
- 'completed': $t('express.returnCompleted'),
- 'processing': $t('express.processing'),
- 'pending': $t('express.pending')
+ 'completed': t('express.returnCompleted'),
+ 'processing': t('express.processing'),
+ 'pending': t('express.pending')
}
- return textMap[status] || $t('express.pending')
+ return textMap[status] || t('express.pending')
}
// 获取状态描述
const getStatusDesc = (status) => {
const descMap = {
- 'completed': $t('express.returnCompletedDesc'),
- 'processing': $t('express.processingDesc'),
- 'pending': $t('express.pendingDesc')
+ 'completed': t('express.returnCompletedDesc'),
+ 'processing': t('express.processingDesc'),
+ 'pending': t('express.pendingDesc')
}
- return descMap[status] || $t('express.pendingDesc')
+ return descMap[status] || t('express.pendingDesc')
}
// 复制运单号
@@ -154,7 +154,7 @@ const handleCopyTracking = () => {
data: detailData.value.trackingNumber,
success: () => {
uni.showToast({
- title: $t('express.trackingNoCopied'),
+ title: t('express.trackingNoCopied'),
icon: 'success'
})
}
@@ -165,10 +165,10 @@ const handleCopyTracking = () => {
const handleContactService = () => {
const customerPhone = getCustomerPhone()
uni.showModal({
- title: $t('user.customerService'),
- content: `${$t('help.phone')}:${customerPhone}\n${$t('help.workingHours')}:${$t('express.workingHours')}`,
- confirmText: $t('express.call'),
- cancelText: $t('common.cancel'),
+ title: t('user.customerService'),
+ content: `${t('help.phone')}:${customerPhone}\n${t('help.workingHours')}:${t('express.workingHours')}`,
+ confirmText: t('express.call'),
+ cancelText: t('common.cancel'),
success: (res) => {
if (res.confirm) {
uni.makePhoneCall({
@@ -182,7 +182,7 @@ const handleContactService = () => {
// 页面加载时获取详情数据
onMounted(async () => {
uni.setNavigationBarTitle({
- title: $t('express.returnDetail')
+ title: t('express.returnDetail')
})
const pages = getCurrentPages()
@@ -190,7 +190,7 @@ onMounted(async () => {
const options = currentPage.options || {}
if (!options.id) return
try {
- uni.showLoading({ title: $t('common.loading') })
+ uni.showLoading({ title: t('common.loading') })
const res = await getExpressReturnDetail(options.id)
if (res && res.code === 200 && res.data) {
const r = res.data
@@ -208,10 +208,10 @@ onMounted(async () => {
remark: r.remark || ''
}
} else {
- throw new Error(res?.msg || $t('express.getDetailFailed'))
+ throw new Error(res?.msg || t('express.getDetailFailed'))
}
} catch (e) {
- uni.showToast({ title: e.message || $t('express.loadFailed'), icon: 'none' })
+ uni.showToast({ title: e.message || t('express.loadFailed'), icon: 'none' })
} finally {
uni.hideLoading()
}
diff --git a/pages/expressReturn/index.vue b/pages/expressReturn/index.vue
index e0935b7..f18c75e 100644
--- a/pages/expressReturn/index.vue
+++ b/pages/expressReturn/index.vue
@@ -54,7 +54,7 @@ import { ref, onMounted } from 'vue'
import { getExpressReturnList } from '@/config/api/expressReturn.js'
import { useI18n } from '@/utils/i18n.js'
-const { t: $t } = useI18n()
+const { t } = useI18n()
const returnList = ref([])
const loading = ref(false)
@@ -62,7 +62,7 @@ const query = ref({ pageNum: 1, pageSize: 20 })
onMounted(() => {
uni.setNavigationBarTitle({
- title: $t('express.returnRecord')
+ title: t('express.returnRecord')
})
loadList()
})
@@ -80,12 +80,12 @@ const loadList = async () => {
const rows = (res.data && (res.data.rows || res.data)) || []
returnList.value = rows.map(r => ({
id: r.id,
- expressCompany: r.expressCompany || r.company || '待填写',
- trackingNumber: r.logisticsTrackingNumber || r.trackingNumber || '待填写',
- returnAddress: r.returnAddress || r.address || '待填写',
- returnTime: r.expressFillTime || r.createTime || r.returnTime || '待填写',
- packageType: r.packageType || '待填写',
- weight: r.weight || '待填写',
+ expressCompany: r.expressCompany || r.company || t('express.toFill'),
+ trackingNumber: r.logisticsTrackingNumber || r.trackingNumber || t('express.toFill'),
+ returnAddress: r.returnAddress || r.address || t('express.toFill'),
+ returnTime: r.expressFillTime || r.createTime || r.returnTime || t('express.toFill'),
+ packageType: r.packageType || t('express.toFill'),
+ weight: r.weight || t('express.toFill'),
status: mapStatus(r.status),
rawStatus: r.status,
userPhone: r.userPhone,
@@ -93,10 +93,10 @@ const loadList = async () => {
remark: r.remark
}))
} else {
- throw new Error(res?.msg || $t('express.getListFailed'))
+ throw new Error(res?.msg || t('express.getListFailed'))
}
} catch (e) {
- uni.showToast({ title: e.message || $t('express.loadFailed'), icon: 'none' })
+ uni.showToast({ title: e.message || t('express.loadFailed'), icon: 'none' })
} finally {
loading.value = false
}
@@ -118,34 +118,33 @@ const getStatusClass = (status) => ({
}[status] || 'status-pending')
const getStatusText = (status) => ({
- 'completed': $t('express.billingPaused'),
- 'processing': $t('express.billingPaused'),
- 'pending': $t('express.billingPaused')
-}[status] || $t('express.billingPaused'))
+ 'completed': t('express.billingPaused'),
+ 'processing': t('express.billingPaused'),
+ 'pending': t('express.billingPaused')
+}[status] || t('express.billingPaused'))
const getStatusBadge = (status) => ({
- 'completed': $t('express.completed'),
- 'processing': $t('express.processing'),
- 'pending': $t('express.pending')
-}[status] || $t('express.pending'))
+ 'completed': t('express.completed'),
+ 'processing': t('express.processing'),
+ 'pending': t('express.pending')
+}[status] || t('express.pending'))
// 一键复制全部信息
const copyAllInfo = () => {
- const allInfo = `${$t('express.recipient')}:${recipientName}\n${$t('express.recipientAddressLabel')}:${recipientAddress}`
+ const allInfo = `${t('express.recipient')}:${recipientName}\n${t('express.recipientAddressLabel')}:${recipientAddress}`
uni.setClipboardData({
data: allInfo,
success: () => {
- uni.showToast({ title: $t('express.copySuccess'), icon: 'success' })
+ uni.showToast({ title: t('express.copySuccess'), icon: 'success' })
},
fail: () => {
- uni.showToast({ title: $t('express.copyFailed'), icon: 'none' })
+ uni.showToast({ title: t('express.copyFailed'), icon: 'none' })
}
})
}
// 点击列表项
const handleItemClick = (item) => {
- console.log('点击了归还记录:', item)
// 未填写(status=0 -> mapped 'pending')时跳转到补填页,其它跳详情
if (item && item.rawStatus === 0) {
uni.navigateTo({ url: `/pages/expressReturn/addExpressReturn?id=${item.id}` })
diff --git a/pages/feedback/detail.vue b/pages/feedback/detail.vue
index 0dfa2f9..09282ca 100644
--- a/pages/feedback/detail.vue
+++ b/pages/feedback/detail.vue
@@ -98,13 +98,13 @@
} from '@/utils/i18n.js'
const {
- t: $t
+ t
} = useI18n()
// 设置页面标题
onMounted(() => {
uni.setNavigationBarTitle({
- title: $t('feedback.detail')
+ title: t('feedback.detail')
})
})
@@ -126,7 +126,7 @@
await loadDetail();
} else {
uni.showToast({
- title: $t('feedback.idRequired'),
+ title: t('feedback.idRequired'),
icon: 'none'
});
setTimeout(() => {
@@ -170,7 +170,7 @@
try {
if (shouldShowLoading) {
uni.showLoading({
- title: $t('common.loading')
+ title: t('common.loading')
});
}
@@ -180,7 +180,7 @@
await loadMessages(res.data.messages);
} else {
uni.showToast({
- title: res.msg || $t('feedback.getDetailFailed'),
+ title: res.msg || t('feedback.getDetailFailed'),
icon: 'none'
});
setTimeout(() => {
@@ -190,7 +190,7 @@
} catch (error) {
console.error('获取投诉详情失败:', error);
uni.showToast({
- title: $t('feedback.getDetailFailed'),
+ title: t('feedback.getDetailFailed'),
icon: 'none'
});
setTimeout(() => {
@@ -207,7 +207,7 @@
const submitReply = async () => {
if (!replyContent.value.trim()) {
uni.showToast({
- title: $t('feedback.pleaseEnterReply'),
+ title: t('feedback.pleaseEnterReply'),
icon: 'none'
});
return;
@@ -215,7 +215,7 @@
try {
uni.showLoading({
- title: $t('common.submitting')
+ title: t('common.submitting')
});
const res = await sendFeedbackMessage(feedbackId.value, {
@@ -224,7 +224,7 @@
if (res.code === 200) {
uni.showToast({
- title: $t('feedback.replySuccess'),
+ title: t('feedback.replySuccess'),
icon: 'success'
});
replyContent.value = '';
@@ -234,14 +234,14 @@
});
} else {
uni.showToast({
- title: res.msg || $t('feedback.replyFailed'),
+ title: res.msg || t('feedback.replyFailed'),
icon: 'none'
});
}
} catch (error) {
console.error('提交回复失败:', error);
uni.showToast({
- title: $t('feedback.replyFailed'),
+ title: t('feedback.replyFailed'),
icon: 'none'
});
} finally {
@@ -252,11 +252,11 @@
// 获取状态文本
const getStatusText = (status) => {
const statusMap = {
- 'pending': $t('feedback.pending'),
- 'in_progress': $t('feedback.processing'),
- 'resolved': $t('feedback.completed')
+ 'pending': t('feedback.pending'),
+ 'in_progress': t('feedback.processing'),
+ 'resolved': t('feedback.completed')
};
- return statusMap[status] || $t('feedback.pending');
+ return statusMap[status] || t('feedback.pending');
};
// 获取状态样式类
@@ -272,8 +272,8 @@
// 获取类型文本
const getTypeText = (type) => {
const typeMap = {
- 'complain': $t('feedback.complain'),
- 'suggestion': $t('feedback.suggestion')
+ 'complain': t('feedback.complain'),
+ 'suggestion': t('feedback.suggestion')
};
return typeMap[type] || type || '-';
};
diff --git a/pages/feedback/index.vue b/pages/feedback/index.vue
index 5b16dc3..48ea427 100644
--- a/pages/feedback/index.vue
+++ b/pages/feedback/index.vue
@@ -80,7 +80,7 @@
useI18n
} from '@/utils/i18n.js'
const {
- t: $t
+ t
} = useI18n()
// 跳转到投诉记录列表
@@ -92,7 +92,7 @@
onMounted(() => {
uni.setNavigationBarTitle({
- title: $t('feedback.title')
+ title: t('feedback.title')
})
})
@@ -137,7 +137,7 @@
const submitFeedback = async () => {
if (selectedType.value === -1) {
uni.showToast({
- title: $t('feedback.pleaseSelectType'),
+ title: t('feedback.pleaseSelectType'),
icon: 'none'
})
return
@@ -145,7 +145,7 @@
if (!description.value.trim()) {
uni.showToast({
- title: $t('feedback.pleaseDescribe'),
+ title: t('feedback.pleaseDescribe'),
icon: 'none'
})
return
@@ -153,7 +153,7 @@
if (!contact.value) {
uni.showToast({
- title: $t('feedback.pleaseContact'),
+ title: t('feedback.pleaseContact'),
icon: 'none'
})
return
@@ -169,7 +169,7 @@
try {
// 显示上传进度
uni.showLoading({
- title: $t('feedback.uploading') || '上传中...',
+ title: t('feedback.uploading') || '上传中...',
mask: true
})
@@ -185,7 +185,7 @@
console.error(`文件 ${i + 1} 上传失败:`, err)
uni.hideLoading()
uni.showToast({
- title: $t('feedback.imageUploadFailed'),
+ title: t('feedback.imageUploadFailed'),
icon: 'none'
})
return
@@ -208,7 +208,7 @@
// 处理响应
if (res && (res.code === 200 || res === true || res?.success === true)) {
uni.showToast({
- title: $t('feedback.submitSuccess'),
+ title: t('feedback.submitSuccess'),
icon: 'success'
})
setTimeout(() => {
@@ -216,7 +216,7 @@
}, 1500);
} else {
uni.showToast({
- title: (res && (res.msg || res.message)) || $t('feedback.submitFailed'),
+ title: (res && (res.msg || res.message)) || t('feedback.submitFailed'),
icon: 'none'
})
}
@@ -224,7 +224,7 @@
console.error('feedback submit failed:', err)
uni.hideLoading()
uni.showToast({
- title: $t('error.networkError') || '网络错误,请重试',
+ title: t('error.networkError') || '网络错误,请重试',
icon: 'none'
})
}
diff --git a/pages/feedback/list.vue b/pages/feedback/list.vue
index 6906097..526ae78 100644
--- a/pages/feedback/list.vue
+++ b/pages/feedback/list.vue
@@ -78,13 +78,13 @@
} from '@/utils/i18n.js'
const {
- t: $t
+ t
} = useI18n()
// 设置页面标题
onMounted(() => {
uni.setNavigationBarTitle({
- title: $t('feedback.recordList')
+ title: t('feedback.recordList')
})
})
@@ -100,25 +100,25 @@
// 状态标签
const statusTabs = reactive([{
get text() {
- return $t('common.all')
+ return t('common.all')
},
status: ''
},
{
get text() {
- return $t('feedback.pending')
+ return t('feedback.pending')
},
status: 'pending'
},
{
get text() {
- return $t('feedback.processing')
+ return t('feedback.processing')
},
status: 'in_progress'
},
{
get text() {
- return $t('feedback.completed')
+ return t('feedback.completed')
},
status: 'resolved'
}
@@ -176,14 +176,14 @@
}
} else {
uni.showToast({
- title: res.msg || $t('feedback.getListFailed'),
+ title: res.msg || t('feedback.getListFailed'),
icon: 'none'
});
}
} catch (error) {
console.error('获取投诉列表失败:', error);
uni.showToast({
- title: $t('feedback.getListFailed'),
+ title: t('feedback.getListFailed'),
icon: 'none'
});
} finally {
@@ -211,11 +211,11 @@
// 获取状态文本
const getStatusText = (status) => {
const statusMap = {
- 'pending': $t('feedback.pending'),
- 'in_progress': $t('feedback.processing'),
- 'resolved': $t('feedback.completed')
+ 'pending': t('feedback.pending'),
+ 'in_progress': t('feedback.processing'),
+ 'resolved': t('feedback.completed')
};
- return statusMap[status] || $t('feedback.pending');
+ return statusMap[status] || t('feedback.pending');
};
// 获取状态样式类
@@ -231,8 +231,8 @@
// 获取类型文本
const getTypeText = (type) => {
const typeMap = {
- 'complain': $t('feedback.complain'),
- 'suggestion': $t('feedback.suggestion')
+ 'complain': t('feedback.complain'),
+ 'suggestion': t('feedback.suggestion')
};
return typeMap[type] || type || '-';
};
diff --git a/pages/help/index.vue b/pages/help/index.vue
index 8bd8bbf..3ebf058 100644
--- a/pages/help/index.vue
+++ b/pages/help/index.vue
@@ -26,40 +26,36 @@
{{ $t('help.workingHours') }}
- {{ HELP_CONTENT.CONTACT.SERVICE_TIME.VALUE }}
+ {{ $t('help.workingHoursValue') }}
-
diff --git a/pages/index/index.vue b/pages/index/index.vue
index efd35bd..8e9dd28 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -198,10 +198,13 @@
transformDeviceData
} from '../../config/api/device.js'
import {
- getPotionsDetail
+ getInUseOrder,
+ getUnpaidOrder
} from '../../config/api/order.js'
import {
- getActiveActivity
+ getActiveActivity,
+ getCurrentAnnouncement,
+ getCurrentAdvertisement
} from '../../config/api/system.js'
// 导入地图工具函数
import {
@@ -227,7 +230,7 @@
// #endif
const {
- t: $t
+ t
} = useI18n()
// 响应式数据
@@ -294,39 +297,21 @@
const bannerImages = ref([]) // 首页广告图片列表
const bannerImageList = ref([]) // 完整的广告配置列表(包含链接信息)
- // 将语言代码转换为后端接受的格式
- const convertLanguageCode = (lang) => {
- // zh-CN -> zh_CN (转换下划线)
- // en-US -> en_US (转换下划线)
- return lang.replace(/-/g, '_')
- }
-
// 获取公告内容(支持多语言)
const getNoticeText = async () => {
try {
- // 获取当前语言设置
- const currentLang = uni.getStorageSync('language') || 'zh-CN'
- const languageCode = convertLanguageCode(currentLang)
-
- console.log('加载公告,语言:', currentLang, '转换后:', languageCode)
+ console.log('加载公告')
// 调用接口获取公告内容
- const res = await uni.request({
- url: `${URL}/device/announcementConfig/current`,
- method: 'GET',
- header: {
- 'Content-Language': languageCode
- },
- data: {
- type: 'wx_user_type' // 微信小程序用户端
- }
+ const res = await getCurrentAnnouncement({
+ type: 'wx_user_type' // 微信小程序用户端
})
console.log('公告响应:', res)
- if (res.statusCode === 200 && res.data.code === 200 && res.data.data) {
+ if (res && res.code === 200 && res.data) {
// 使用后端自动解析的 announcement 字段
- const announcement = res.data.data.announcement || ''
+ const announcement = res.data.announcement || ''
noticeText.value = announcement
// 设置通知栏高度
@@ -342,7 +327,7 @@
console.warn('缓存通知内容失败:', e)
}
} else {
- console.warn('获取公告失败:', res.data?.msg || '未知错误')
+ console.warn('获取公告失败:', res?.msg || '未知错误')
}
} catch (error) {
console.error('获取公告失败:', error)
@@ -352,31 +337,20 @@
// 获取首页广告图片(支持多语言)
const getBannerImages = async () => {
try {
- // 获取当前语言设置
- const currentLang = uni.getStorageSync('language') || 'zh-CN'
- const languageCode = convertLanguageCode(currentLang)
-
- console.log('加载首页广告,语言:', currentLang, '转换后:', languageCode)
+ console.log('加载首页广告')
// 调用接口获取广告内容
- const res = await uni.request({
- url: `${URL}/device/advertisementConfig/current`,
- method: 'GET',
- header: {
- 'Content-Language': languageCode
- },
- data: {
- appPlatform: 'wechat', // 微信平台
- appType: 'user' ,// 用户端
- pictureLocation:'home_banner'
- }
+ const res = await getCurrentAdvertisement({
+ appPlatform: 'wechat', // 微信平台
+ appType: 'user' ,// 用户端
+ pictureLocation:'home_banner'
})
console.log('首页广告响应:', res)
- if (res.statusCode === 200 && res.data.code === 200 && res.data.data) {
+ if (res && res.code === 200 && res.data) {
// 使用 imageList 字段(包含图片和链接信息)
- const imageList = res.data.data.imageList || []
+ const imageList = res.data.imageList || []
if (imageList.length > 0) {
bannerImageList.value = imageList
// 提取图片URL用于展示
@@ -385,7 +359,7 @@
console.warn('未获取到广告图片')
}
} else {
- console.warn('获取首页广告失败:', res.data?.msg || '未知错误')
+ console.warn('获取首页广告失败:', res?.msg || '未知错误')
}
} catch (error) {
console.error('获取首页广告失败:', error)
@@ -415,7 +389,7 @@
fail: (err) => {
console.error('跳转小程序失败:', err)
uni.showToast({
- title: '跳转失败',
+ title: t('common.loadFailed'),
icon: 'none'
})
}
@@ -423,7 +397,7 @@
// #endif
// #ifndef MP-WEIXIN
uni.showToast({
- title: '请在微信小程序中使用',
+ title: t('auth.pleaseUseInWechat'),
icon: 'none'
})
// #endif
@@ -568,10 +542,10 @@
console.warn('清理旧缓存失败:', e);
}
- // 开发环境测试距离计算
- if (process.env.NODE_ENV === 'development') {
- testDistanceCalculation()
- }
+ // // 开发环境测试距离计算
+ // if (process.env.NODE_ENV === 'development') {
+ // testDistanceCalculation()
+ // }
// 并行加载公告和广告(不依赖定位)
await Promise.all([
@@ -586,12 +560,12 @@
await loadPositions()
// 3. 查询活动并显示弹窗
- await checkActiveActivity()
+ // await checkActiveActivity()
} catch (error) {
console.error('初始化失败:', error)
uni.showToast({
- title: $t('home.getLocationFailed'),
+ title: t('home.getLocationFailed'),
icon: 'none'
})
} finally {
@@ -787,12 +761,16 @@
isRelocating.value = true
uni.showLoading({
- title: $t('home.relocating'),
+ title: t('home.relocating'),
mask: true
})
- // 重新获取用户真实位置(不使用缓存)
+ // 重新获取用户真实位置
const loc = await getUserLocation()
+ if (!loc || !loc.longitude || !loc.latitude) {
+ throw new Error('location failed')
+ }
+
const newLocation = {
longitude: Number(loc.longitude),
latitude: Number(loc.latitude)
@@ -827,7 +805,7 @@
uni.hideLoading()
uni.showToast({
- title: $t('home.locateSuccess'),
+ title: t('home.locateSuccess'),
icon: 'success',
duration: 1500
})
@@ -836,7 +814,7 @@
uni.hideLoading()
uni.showToast({
- title: e.errMsg || $t('home.locateFailed'),
+ title: e.errMsg || t('home.locateFailed'),
icon: 'none',
duration: 2000
})
@@ -868,7 +846,7 @@
const selectPosition = (position) => {
uni.showActionSheet({
- itemList: ['扫码使用', '导航前往'],
+ itemList: [t('home.scanToUse'), t('home.navigate')],
success: (res) => {
switch (res.tapIndex) {
case 0:
@@ -948,27 +926,17 @@
if (!deviceNo) {
uni.showToast({
- title: $t('home.invalidQRCode'),
+ title: t('home.invalidQRCode'),
icon: 'none'
})
return
}
// 检查是否有使用中的订单
- const inUseRes = await uni.request({
- url: `${URL}/app/order/inUse`,
- method: 'GET',
- header: {
- 'Authorization': "Bearer " + uni.getStorageSync('token'),
- 'Clientid': uni.getStorageSync('client_id')
- }
- })
+ const inUseRes = await getInUseOrder()
- if (inUseRes.statusCode === 401 || inUseRes.data?.code === 401 || inUseRes.data?.code === 40101) {
- redirectToLogin()
- return
- } else if (inUseRes.statusCode == 200 && inUseRes.data.code == 200 && inUseRes.data.data) {
- const inUseOrder = inUseRes.data.data
+ if (inUseRes && inUseRes.code === 200 && inUseRes.data) {
+ const inUseOrder = inUseRes.data
uni.reLaunch({
url: `/pages/order/detail?orderId=${inUseOrder.orderId}&deviceId=${deviceNo || inUseOrder.deviceNo}`
})
@@ -976,20 +944,10 @@
}
// 检查是否有待支付订单
- const orderRes = await uni.request({
- url: `${URL}/app/order/unpaid`,
- method: 'GET',
- header: {
- 'Authorization': "Bearer " + uni.getStorageSync('token'),
- 'Clientid': uni.getStorageSync('client_id')
- }
- })
+ const orderRes = await getUnpaidOrder()
- if (orderRes.statusCode === 401 || orderRes.data?.code === 401 || orderRes.data?.code === 40101) {
- redirectToLogin()
- return
- } else if (orderRes.statusCode == 200 && orderRes.data.code == 200 && orderRes.data.data) {
- const unpaidOrder = orderRes.data.data
+ if (orderRes && orderRes.code === 200 && orderRes.data) {
+ const unpaidOrder = orderRes.data
uni.navigateTo({
url: `/pages/order/payment?orderId=${unpaidOrder.orderId}`
})
@@ -1018,7 +976,7 @@
}
} else {
uni.showToast({
- title: '获取设备信息失败',
+ title: t('device.getDeviceInfoFailed'),
icon: 'none'
})
uni.navigateTo({
diff --git a/pages/join/index.vue b/pages/join/index.vue
index 4497c9f..ee9a95c 100644
--- a/pages/join/index.vue
+++ b/pages/join/index.vue
@@ -12,7 +12,7 @@
} from 'vue'
import { useI18n } from '@/utils/i18n.js'
- const { t: $t } = useI18n()
+ const { t } = useI18n()
// 外部网页地址
const webUrl = ref('https://joininvestment.gxfs123.com/')
@@ -27,7 +27,7 @@
const handleError = (e) => {
console.error('web-view 加载错误:', e)
uni.showToast({
- title: $t('join.pageLoadFailed'),
+ title: t('join.pageLoadFailed'),
icon: 'none',
duration: 2000
})
@@ -35,7 +35,7 @@
onMounted(() => {
uni.setNavigationBarTitle({
- title: $t('join.title')
+ title: t('join.title')
})
console.log('招商页面加载,外部网址:', webUrl.value)
})
diff --git a/pages/legal/agreement.vue b/pages/legal/agreement.vue
index 5a3ffc5..ab2e3fd 100644
--- a/pages/legal/agreement.vue
+++ b/pages/legal/agreement.vue
@@ -36,9 +36,9 @@
diff --git a/pages/my/card.vue b/pages/my/card.vue
index 6622f2c..320a679 100644
--- a/pages/my/card.vue
+++ b/pages/my/card.vue
@@ -2,30 +2,63 @@
-
-