fix:多平台兼容
This commit is contained in:
@@ -197,7 +197,7 @@
|
||||
return props.bannerImages[currentBannerIndex.value]
|
||||
}
|
||||
// 降级:如果没有广告,显示默认图片
|
||||
return '/static/index_swiper.png'
|
||||
return ''
|
||||
})
|
||||
|
||||
// 验证坐标有效性
|
||||
|
||||
@@ -50,13 +50,14 @@ export const transformDeviceData = (device) => {
|
||||
}
|
||||
|
||||
// 立即租借
|
||||
export const rentPowerBank = (deviceNo, phone) => {
|
||||
export const rentPowerBank = (deviceNo, phone,payway) => {
|
||||
return request({
|
||||
url: `/app/device/rentPowerBank?deviceNo=${deviceNo}`,
|
||||
method: 'post',
|
||||
data: {
|
||||
// deviceNo,
|
||||
phone
|
||||
phone,
|
||||
payway
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
+6
-4
@@ -37,10 +37,12 @@ export const sendVerifyCode = (phonenumber) => {
|
||||
|
||||
// 手机号+验证码登录
|
||||
export const loginWithCode = (phonenumber, smsCode) => {
|
||||
return request({
|
||||
url: '/app/user/sms/login',
|
||||
method: 'post',
|
||||
data: { phonenumber, smsCode }
|
||||
// 兼容保留:统一走 quickLogin(SMS)
|
||||
return quickLogin({
|
||||
loginType: 'SMS',
|
||||
appid,
|
||||
phonenumber,
|
||||
smsCode
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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.64:8080" //本地调试
|
||||
// export const URL = "https://fansdev.gxfs123.com/api" //测试服务器
|
||||
export const URL = "http://192.168.5.58:8080" //本地调试
|
||||
// export const URL = "http://127.0.0.1:8080" //本地调试
|
||||
|
||||
export const appid = "wx2165f0be356ae7a9" //微信小程序appid
|
||||
|
||||
+3
-1
@@ -60,7 +60,9 @@ export default {
|
||||
saveSuccess: 'Saved successfully',
|
||||
saving: 'Saving...',
|
||||
saveFailed: 'Save failed',
|
||||
downloadFailed: 'Download failed'
|
||||
downloadFailed: 'Download failed',
|
||||
reset: 'Reset',
|
||||
preview: 'Preview'
|
||||
},
|
||||
|
||||
nav: {
|
||||
|
||||
+3
-1
@@ -60,7 +60,9 @@ export default {
|
||||
saveSuccess: 'Berhasil disimpan',
|
||||
saving: 'Menyimpan...',
|
||||
saveFailed: 'Gagal menyimpan',
|
||||
downloadFailed: 'Gagal mengunduh'
|
||||
downloadFailed: 'Gagal mengunduh',
|
||||
reset: 'Atur ulang',
|
||||
preview: 'Pratinjau'
|
||||
},
|
||||
|
||||
nav: {
|
||||
|
||||
+4
-2
@@ -59,7 +59,9 @@ export default {
|
||||
saveImage: '保存到手机',
|
||||
saveSuccess: '保存成功',
|
||||
saving: '保存中...',
|
||||
saveFailed: '保存失败'
|
||||
saveFailed: '保存失败',
|
||||
reset: '重置',
|
||||
preview: '预览'
|
||||
},
|
||||
|
||||
nav: {
|
||||
@@ -305,7 +307,7 @@ export default {
|
||||
customerService: '客服中心',
|
||||
feedback: '投诉与建议',
|
||||
businessLicense: '营业资质',
|
||||
cooperation: '合作加盟',
|
||||
cooperation: '信息咨询',
|
||||
settings: '设置',
|
||||
userAgreement: '《用户协议》',
|
||||
settinguserAgreement: '用户协议',
|
||||
|
||||
@@ -149,6 +149,14 @@
|
||||
"navigationBarBackgroundColor": "#ffffff",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "return-map",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"navigationBarBackgroundColor": "#000000",
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -604,7 +604,7 @@
|
||||
|
||||
console.log(deviceId.value);
|
||||
// 调用设备租借接口
|
||||
const rentResult = await rentPowerBank(deviceId.value, phoneNumber.value)
|
||||
const rentResult = await rentPowerBank(deviceId.value, phoneNumber.value,payWay.value)
|
||||
if (rentResult.code !== 200) {
|
||||
throw new Error(rentResult.msg || t('device.rentFailed'))
|
||||
}
|
||||
|
||||
@@ -406,10 +406,17 @@
|
||||
const getBannerImages = async () => {
|
||||
try {
|
||||
console.log('加载首页广告')
|
||||
let appPlatform;
|
||||
// #ifdef MP-WEIXIN
|
||||
appPlatform = 'wechat'
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
appPlatform = 'ali'
|
||||
// #endif
|
||||
|
||||
// 调用接口获取广告内容
|
||||
const res = await getCurrentAdvertisement({
|
||||
appPlatform: 'wechat', // 微信平台
|
||||
appPlatform: appPlatform, // 微信平台
|
||||
appType: 'user' ,// 用户端
|
||||
pictureLocation:'home_banner'
|
||||
})
|
||||
|
||||
+7
-177
@@ -211,26 +211,6 @@
|
||||
</view>
|
||||
</uv-popup>
|
||||
|
||||
<!-- 归还地图弹窗 -->
|
||||
<view class="return-map-popup" v-if="showReturnMapPopup" @click.self="closeReturnMapPopup">
|
||||
<view class="popup-mask"></view>
|
||||
<view class="popup-content">
|
||||
<view class="popup-header">
|
||||
<text class="popup-title">{{ $t('order.returnLocationMap') }}</text>
|
||||
<view class="close-btn" @click="closeReturnMapPopup">
|
||||
<text class="close-icon">×</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="popup-body">
|
||||
<image :src="returnMapImageUrl" mode="widthFix" class="map-image" lazy-load="true"></image>
|
||||
</view>
|
||||
<view class="popup-footer">
|
||||
<view class="save-btn" @click="saveReturnMapImage">
|
||||
{{ $t('common.saveImage') }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -327,8 +307,6 @@
|
||||
const countdownTimer = ref(null)
|
||||
const feeRuleText = ref('')
|
||||
const convertToOwnPopup = ref(null)
|
||||
const showReturnMapPopup = ref(false)
|
||||
const returnMapImageUrl = ref('')
|
||||
const lastDeviceEjectTime = ref(0) // 上次点击"宝未弹出"的时间戳
|
||||
|
||||
// 计算属性:是否显示优惠券/会员卡可用提示
|
||||
@@ -444,72 +422,22 @@
|
||||
// 快速归还
|
||||
const quickReturn = () => {
|
||||
// 检查是否有 returnMapImage 字段
|
||||
console.log(orderInfo.value.returnMapImage);
|
||||
console.log(orderInfo.value.returnMapImage)
|
||||
|
||||
if (orderInfo.value.returnMapImage) {
|
||||
// 有值则弹窗显示图片
|
||||
returnMapImageUrl.value = orderInfo.value.returnMapImage
|
||||
showReturnMapPopup.value = true
|
||||
// 有值则跳转到新的地图页查看大图(支持放大)
|
||||
const encodedUrl = encodeURIComponent(orderInfo.value.returnMapImage)
|
||||
uni.navigateTo({
|
||||
url: `/subPackages/order/return-map?imageUrl=${encodedUrl}`
|
||||
})
|
||||
} else {
|
||||
// 没有值则继续执行跳转流程
|
||||
// 没有值则继续执行原有跳转流程
|
||||
uni.navigateTo({
|
||||
url: '/pages/search/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭归还地图弹窗
|
||||
const closeReturnMapPopup = () => {
|
||||
showReturnMapPopup.value = false
|
||||
}
|
||||
|
||||
// 保存归还地图图片
|
||||
const saveReturnMapImage = () => {
|
||||
uni.showLoading({
|
||||
title: t('common.saving')
|
||||
})
|
||||
|
||||
uni.downloadFile({
|
||||
url: returnMapImageUrl.value,
|
||||
success: (res) => {
|
||||
if (res.statusCode === 200) {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: res.tempFilePath,
|
||||
success: () => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: t('common.saveSuccess'),
|
||||
icon: 'success'
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.hideLoading()
|
||||
console.error('保存图片失败:', err)
|
||||
uni.showToast({
|
||||
title: t('common.saveFailed'),
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: t('common.downloadFailed'),
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.hideLoading()
|
||||
console.error('下载图片失败:', err)
|
||||
uni.showToast({
|
||||
title: t('common.downloadFailed'),
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 再次租借
|
||||
const rentAgain = () => {
|
||||
uni.reLaunch({
|
||||
@@ -1830,102 +1758,4 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* 归还地图弹窗样式 */
|
||||
.return-map-popup {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 9999;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.popup-mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
.popup-content {
|
||||
position: relative;
|
||||
width: 90%;
|
||||
max-width: 600rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 24rpx;
|
||||
overflow: hidden;
|
||||
z-index: 10000;
|
||||
|
||||
.popup-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
.popup-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.close-btn {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
background: #f5f5f5;
|
||||
|
||||
.close-icon {
|
||||
font-size: 40rpx;
|
||||
color: #666;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.popup-body {
|
||||
padding: 30rpx;
|
||||
max-height: 60vh;
|
||||
overflow-y: auto;
|
||||
|
||||
.map-image {
|
||||
width: 100%;
|
||||
display: block;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.popup-footer {
|
||||
padding: 20rpx 30rpx 30rpx;
|
||||
|
||||
.save-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
background: linear-gradient(135deg, #07c160, #10d673);
|
||||
border-radius: 44rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
|
||||
&:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
+12
-7
@@ -327,19 +327,24 @@ const handleInitError = (err) => {
|
||||
if (err.name === 'NotAllowedError' || err.name === 'PermissionDeniedError') {
|
||||
errMsg = '摄像头权限被拒绝';
|
||||
errDetail = '请在浏览器设置中允许访问摄像头';
|
||||
} else if (err.name === 'NotFoundError' || err.name === 'DevicesNotFoundError') {
|
||||
}
|
||||
else if (err.name === 'NotFoundError' || err.name === 'DevicesNotFoundError') {
|
||||
errMsg = '未找到可用的摄像头';
|
||||
errDetail = '请确保设备有摄像头';
|
||||
} else if (err.name === 'NotReadableError' || err.name === 'TrackStartError') {
|
||||
}
|
||||
else if (err.name === 'NotReadableError' || err.name === 'TrackStartError') {
|
||||
errMsg = '摄像头被占用';
|
||||
errDetail = '请关闭其他使用摄像头的应用';
|
||||
} else if (err.name === 'NotSupportedError') {
|
||||
}
|
||||
else if (err.name === 'NotSupportedError') {
|
||||
errMsg = '浏览器不支持';
|
||||
errDetail = '请使用现代浏览器访问';
|
||||
} else if (location.protocol !== 'https:' && location.hostname !== 'localhost' && location.hostname !== '127.0.0.1') {
|
||||
errMsg = '需要 HTTPS 环境';
|
||||
errDetail = '摄像头功能需要在安全环境下使用';
|
||||
} else {
|
||||
}
|
||||
// else if (location.protocol !== 'https:' && location.hostname !== 'localhost' && location.hostname !== '127.0.0.1') {
|
||||
// errMsg = '需要 HTTPS 环境';
|
||||
// errDetail = '摄像头功能需要在安全环境下使用';
|
||||
// }
|
||||
else {
|
||||
errMsg = err.message || '摄像头启动失败';
|
||||
errDetail = '请尝试刷新页面或使用其他方式';
|
||||
}
|
||||
|
||||
+104
-60
@@ -55,6 +55,24 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 支付方式选择 -->
|
||||
<view class="order-card" v-if="paymentMethods.length">
|
||||
<view class="card-header">
|
||||
<view class="card-title-bar"></view>
|
||||
<view class="card-title">{{ $t('payment.paymentMethod') }}</view>
|
||||
</view>
|
||||
<view class="payment-method-item" v-for="item in paymentMethods" :key="item.paymentMethodType"
|
||||
@click="selectPaymentMethod(item.paymentMethodType)">
|
||||
<view class="method-left">
|
||||
<text class="method-name">{{ item.paymentMethodName }}</text>
|
||||
</view>
|
||||
<view class="method-right">
|
||||
<view class="method-radio" :class="{ active: selectedPaymentMethod === item.paymentMethodType }">
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部操作栏 -->
|
||||
<view class="bottom-bar">
|
||||
<view class="pay-btn" @click="handlePayment">
|
||||
@@ -107,10 +125,6 @@
|
||||
const passedTotalAmount = ref(null)
|
||||
const passedDepositAmount = ref(null)
|
||||
|
||||
// 倒计时相关
|
||||
const countdown = ref(15 * 60) // 15分钟 = 900秒
|
||||
let countdownTimer = null
|
||||
|
||||
// 支付方式相关(微信/支付宝/H5-Antom 多平台)
|
||||
const paymentMethods = ref([])
|
||||
const selectedPaymentMethod = ref('WECHAT') // 默认微信
|
||||
@@ -263,10 +277,16 @@
|
||||
|
||||
// 小程序环境下:微信 / 支付宝
|
||||
// #ifdef MP-WEIXIN
|
||||
methods.push({ paymentMethodType: 'WECHAT', paymentMethodName: '微信支付' })
|
||||
methods.push({
|
||||
paymentMethodType: 'WECHAT',
|
||||
paymentMethodName: '微信支付'
|
||||
})
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
methods.push({ paymentMethodType: 'ALIPAY', paymentMethodName: '支付宝支付' })
|
||||
methods.push({
|
||||
paymentMethodType: 'ALIPAY',
|
||||
paymentMethodName: '支付宝支付'
|
||||
})
|
||||
// #endif
|
||||
|
||||
// H5 环境:使用 Antom 聚合支付(多通道)
|
||||
@@ -291,7 +311,10 @@
|
||||
|
||||
// 兜底:至少保留一个微信
|
||||
if (!methods.length) {
|
||||
methods.push({ paymentMethodType: 'WECHAT', paymentMethodName: '微信支付' })
|
||||
methods.push({
|
||||
paymentMethodType: 'WECHAT',
|
||||
paymentMethodName: '微信支付'
|
||||
})
|
||||
}
|
||||
|
||||
paymentMethods.value = methods
|
||||
@@ -376,11 +399,17 @@
|
||||
if (res.resultCode === '9000') {
|
||||
startPaymentStatusPolling('ALIPAY')
|
||||
} else {
|
||||
uni.showToast({ title: t('payment.paymentFailed'), icon: 'none' })
|
||||
uni.showToast({
|
||||
title: t('payment.paymentFailed'),
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({ title: t('payment.paymentFailed'), icon: 'none' })
|
||||
uni.showToast({
|
||||
title: t('payment.paymentFailed'),
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
@@ -390,11 +419,17 @@
|
||||
if (res.resultCode === '9000') {
|
||||
startPaymentStatusPolling('ALIPAY')
|
||||
} else {
|
||||
uni.showToast({ title: t('payment.paymentFailed'), icon: 'none' })
|
||||
uni.showToast({
|
||||
title: t('payment.paymentFailed'),
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({ title: t('payment.paymentFailed'), icon: 'none' })
|
||||
uni.showToast({
|
||||
title: t('payment.paymentFailed'),
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -419,7 +454,12 @@
|
||||
|
||||
uni.hideLoading();
|
||||
uni.setStorageSync('pendingPaymentNo', orderId.value);
|
||||
window.open(paymentUrl);
|
||||
window.location.href = paymentUrl;
|
||||
// plus.runtime.openURL(paymentUrl, function(err) {
|
||||
// console.log('打开失败');
|
||||
// window.location.href = paymentUrl;
|
||||
// })
|
||||
// ==========================================================
|
||||
|
||||
// 开始轮询支付状态(传入当前选中的支付方式类型)
|
||||
startPaymentStatusPolling(method);
|
||||
@@ -511,6 +551,8 @@
|
||||
|
||||
// 处理支付状态结果
|
||||
if (res && res.code === 200 && res.data && status) {
|
||||
console.log(status === successStatus);
|
||||
|
||||
// 支付成功
|
||||
if (status === successStatus) {
|
||||
clearInterval(pollingTimer);
|
||||
@@ -537,66 +579,23 @@
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
const errorMsg = methodType === 'ALIPAY' ? '支付宝' : (methodType === 'WECHAT' || methodType === 'WECHATPAY') ? '微信' : '支付';
|
||||
const errorMsg = methodType === 'ALIPAY' ? '支付宝' : (methodType === 'WECHAT' ||
|
||||
methodType === 'WECHATPAY') ? '微信' : '支付';
|
||||
console.error(`查询${errorMsg}支付状态失败:`, error);
|
||||
}
|
||||
}, 5000); // 每5秒查询一次
|
||||
}, 10000); // 每10秒查询一次
|
||||
}
|
||||
|
||||
// 兼容性方法:保持原有函数名,内部调用统一方法
|
||||
const startWxPaymentStatusPolling = () => startPaymentStatusPolling('WECHAT');
|
||||
const startAliPaymentStatusPolling = () => startPaymentStatusPolling('ALIPAY');
|
||||
|
||||
// 更新导航栏倒计时
|
||||
const updateNavBarCountdown = () => {
|
||||
const minutes = Math.floor(countdown.value / 60).toString().padStart(2, '0')
|
||||
const seconds = (countdown.value % 60).toString().padStart(2, '0')
|
||||
uni.setNavigationBarTitle({
|
||||
title: `待支付 ${minutes}:${seconds}`
|
||||
})
|
||||
}
|
||||
|
||||
// 开始倒计时
|
||||
const startCountdown = () => {
|
||||
// 清除之前的定时器
|
||||
if (countdownTimer) {
|
||||
clearInterval(countdownTimer)
|
||||
}
|
||||
|
||||
// 立即更新一次
|
||||
updateNavBarCountdown()
|
||||
|
||||
// 每秒更新
|
||||
countdownTimer = setInterval(() => {
|
||||
countdown.value--
|
||||
|
||||
if (countdown.value <= 0) {
|
||||
clearInterval(countdownTimer)
|
||||
uni.showToast({
|
||||
title: t('order.paymentFailedRetry'),
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}, 1500)
|
||||
return
|
||||
}
|
||||
|
||||
updateNavBarCountdown()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
// 页面卸载时清除定时器
|
||||
onMounted(() => {
|
||||
return () => {
|
||||
if (pollingTimer) {
|
||||
clearInterval(pollingTimer);
|
||||
}
|
||||
if (countdownTimer) {
|
||||
clearInterval(countdownTimer);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -612,8 +611,10 @@
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
// 启动倒计时
|
||||
startCountdown()
|
||||
// 设置导航栏标题为待支付
|
||||
uni.setNavigationBarTitle({
|
||||
title: t('payment.waitingForPayment')
|
||||
})
|
||||
|
||||
// 优先从 options 中获取 orderId
|
||||
if (options && options.orderId) {
|
||||
@@ -787,6 +788,49 @@ loadOrderInfo()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.payment-method-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 24rpx 0;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
|
||||
&:last-child {
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
|
||||
.method-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.method-name {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.method-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
margin-left: 24rpx;
|
||||
}
|
||||
|
||||
.method-radio {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
border-radius: 50%;
|
||||
border: 2rpx solid #d9d9d9;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.method-radio.active {
|
||||
border-color: #52c41a;
|
||||
background-color: #52c41a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bottom-bar {
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
<template>
|
||||
<view class="return-map-page">
|
||||
<view class="image-wrapper">
|
||||
<movable-area class="movable-area">
|
||||
<movable-view class="movable-view" direction="all" :scale="true" :scale-min="1" :scale-max="4"
|
||||
:scale-value="scale" @scale="onScaleChange">
|
||||
<image :src="imageUrl" mode="widthFix" class="map-image" lazy-load="true"></image>
|
||||
</movable-view>
|
||||
</movable-area>
|
||||
</view>
|
||||
<view class="bottom-bar">
|
||||
<view class="btn" @click="resetScale">{{ $t('common.reset') }}</view>
|
||||
<view class="btn primary" @click="previewImage">{{ $t('common.preview') }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref
|
||||
} from 'vue'
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
useI18n
|
||||
} from '@/utils/i18n.js'
|
||||
|
||||
const {
|
||||
t
|
||||
} = useI18n()
|
||||
|
||||
const imageUrl = ref('')
|
||||
const scale = ref(1)
|
||||
|
||||
onLoad((options) => {
|
||||
if (options && options.imageUrl) {
|
||||
try {
|
||||
imageUrl.value = decodeURIComponent(options.imageUrl)
|
||||
} catch (e) {
|
||||
imageUrl.value = options.imageUrl
|
||||
}
|
||||
}
|
||||
|
||||
if (!imageUrl.value) {
|
||||
uni.showToast({
|
||||
title: t('common.loadFailed'),
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
uni.setNavigationBarTitle({
|
||||
title: t('order.returnLocationMap')
|
||||
})
|
||||
})
|
||||
|
||||
const onScaleChange = (e) => {
|
||||
if (e && typeof e.detail?.scale === 'number') {
|
||||
scale.value = e.detail.scale
|
||||
}
|
||||
}
|
||||
|
||||
const resetScale = () => {
|
||||
scale.value = 1
|
||||
}
|
||||
|
||||
const previewImage = () => {
|
||||
if (!imageUrl.value) return
|
||||
uni.previewImage({
|
||||
urls: [imageUrl.value]
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.return-map-page {
|
||||
min-height: 100vh;
|
||||
background-color: #000;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.image-wrapper {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.movable-area {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.movable-view {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.map-image {
|
||||
width: 100%;
|
||||
display: block;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.bottom-bar {
|
||||
padding: 16rpx 30rpx 24rpx;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 24rpx;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
}
|
||||
|
||||
.btn {
|
||||
min-width: 160rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 36rpx;
|
||||
border: 2rpx solid #ffffff;
|
||||
color: #ffffff;
|
||||
font-size: 28rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&.primary {
|
||||
background: #07c160;
|
||||
border-color: #07c160;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -131,18 +131,18 @@
|
||||
}
|
||||
|
||||
// 微信快捷登录入口(备用,目前主流程使用一键手机号登录)
|
||||
const onWeChatLogin = async () => {
|
||||
try {
|
||||
await checkAgreement()
|
||||
await wxLogin()
|
||||
uni.showToast({ title: t('auth.loginSuccess'), icon: 'success' })
|
||||
await navigateAfterLogin()
|
||||
} catch (error) {
|
||||
if (error.message !== t('auth.pleaseAgreeToTerms')) {
|
||||
uni.showToast({ title: error.message || t('auth.loginFailed'), icon: 'none' })
|
||||
}
|
||||
}
|
||||
}
|
||||
// const onWeChatLogin = async () => {
|
||||
// try {
|
||||
// await checkAgreement()
|
||||
// await wxLogin()
|
||||
// uni.showToast({ title: t('auth.loginSuccess'), icon: 'success' })
|
||||
// await navigateAfterLogin()
|
||||
// } catch (error) {
|
||||
// if (error.message !== t('auth.pleaseAgreeToTerms')) {
|
||||
// uni.showToast({ title: error.message || t('auth.loginFailed'), icon: 'none' })
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// 支付宝快捷登录入口(支付宝小程序)
|
||||
const onAlipayLogin = async () => {
|
||||
@@ -165,12 +165,12 @@
|
||||
uni.showToast({ title: t('auth.phoneCancelled'), icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
console.log(e);
|
||||
try {
|
||||
// 先完成微信登录(/app/user/quickLogin,后端建立/查询 WECHAT_MINI 用户)
|
||||
await wxLogin()
|
||||
await wxLogin(e.detail.code)
|
||||
// 再用微信返回的临时 code 换取手机号(后端按文档更新 phone 字段)
|
||||
await getUserPhoneNumber(e.detail.code)
|
||||
// await getUserPhoneNumber(e.detail.code)
|
||||
uni.showToast({ title: t('auth.loginSuccess'), icon: 'success' })
|
||||
await navigateAfterLogin()
|
||||
} catch (error) {
|
||||
|
||||
@@ -69,7 +69,8 @@
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { sendVerifyCode, loginWithCode } from '@/config/api/user.js'
|
||||
import { sendVerifyCode, quickLogin } from '@/config/api/user.js'
|
||||
import { appid } from '@/config/url.js'
|
||||
import { fetchAndCacheCustomerPhone } from '@/util/index.js'
|
||||
import { useI18n } from '@/utils/i18n.js'
|
||||
|
||||
@@ -163,7 +164,16 @@
|
||||
|
||||
try {
|
||||
uni.showLoading({ title: t('common.loggingIn') })
|
||||
const res = await loginWithCode(phone.value, verifyCode.value)
|
||||
const res = await quickLogin({
|
||||
loginType: 'SMS',
|
||||
appid,
|
||||
phonenumber: phone.value,
|
||||
smsCode: verifyCode.value
|
||||
})
|
||||
|
||||
if (res && res.code !== 200) {
|
||||
throw new Error(res.msg || res.message || t('auth.loginFailed'))
|
||||
}
|
||||
|
||||
// 保存token和client_id
|
||||
// 兼容多种返回格式:res.data.token, res.token, res.data.access_token
|
||||
|
||||
@@ -186,9 +186,16 @@
|
||||
// 获取广告图片
|
||||
const getBannerImages = async () => {
|
||||
try {
|
||||
let appPlatform;
|
||||
// #ifdef MP-WEIXIN
|
||||
appPlatform = 'wechat'
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
appPlatform = 'ali'
|
||||
// #endif
|
||||
// 调用接口获取广告内容
|
||||
const res = await getCurrentAdvertisement({
|
||||
appPlatform: 'wechat', // 微信平台
|
||||
appPlatform: appPlatform, // 微信平台
|
||||
appType: 'user', // 用户端
|
||||
pictureLocation:'userProfile_banner'
|
||||
})
|
||||
|
||||
+5
-3
@@ -15,7 +15,7 @@ import { HELP_CONTENT } from "@/constants/help"
|
||||
// import { GET_PHONE_NUMBER_URL } from "../config/url"
|
||||
|
||||
// 统一快捷登录 - 微信小程序登录(使用 /app/user/quickLogin)
|
||||
export const wxLogin = () => {
|
||||
export const wxLogin = (phoneCode) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 1. 获取微信登录凭证(code -> 后端换 openId)
|
||||
uni.login({
|
||||
@@ -30,7 +30,8 @@ export const wxLogin = () => {
|
||||
const result = await quickLogin({
|
||||
loginType: 'WECHAT',
|
||||
appid: appid,
|
||||
code: loginRes.code
|
||||
loginCode: loginRes.code,
|
||||
code:phoneCode
|
||||
})
|
||||
|
||||
if (result.code === 200 && result.data) {
|
||||
@@ -91,7 +92,7 @@ export const alipayLogin = () => {
|
||||
const result = await quickLogin({
|
||||
loginType: 'ALIPAY',
|
||||
appid: ZFBappid,
|
||||
code: res.authCode
|
||||
loginCode: res.authCode
|
||||
})
|
||||
|
||||
if (result.code === 200 && result.data) {
|
||||
@@ -143,6 +144,7 @@ export const alipayLogin = () => {
|
||||
export const smsQuickLogin = (phonenumber, smsCode) => {
|
||||
return quickLogin({
|
||||
loginType: 'SMS',
|
||||
appid: appid,
|
||||
phonenumber,
|
||||
smsCode
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user