fix:修复bug
This commit is contained in:
@@ -60,34 +60,3 @@ export const rentPowerBank = (deviceNo, phone) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确认支付并弹出风扇
|
|
||||||
export const confirmPaymentAndRent = (orderId) => {
|
|
||||||
console.log(`确认支付并弹出风扇, orderId: ${orderId}`)
|
|
||||||
return request({
|
|
||||||
url: `/app/device/confirmPaymentAndRent?orderId=${orderId}`,
|
|
||||||
method: 'GET'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 强制打开空格子
|
|
||||||
export const forcefOpenEmptyGrid = (deviceNo) => {
|
|
||||||
console.log(`强制打开空格子, deviceNo: ${deviceNo}`)
|
|
||||||
return request({
|
|
||||||
url: `/app/device/forcef/${deviceNo}`,
|
|
||||||
method: 'post'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发送租借指令
|
|
||||||
export const sendRentCommand = (data) => {
|
|
||||||
return request({
|
|
||||||
url: '/app/device/sendRentCommand',
|
|
||||||
method: 'post',
|
|
||||||
data,
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
+28
-23
@@ -51,7 +51,6 @@ 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',
|
||||||
@@ -61,7 +60,6 @@ export const queryById = (id) => {
|
|||||||
|
|
||||||
// 用户查询商品订单详情
|
// 用户查询商品订单详情
|
||||||
export const getProductOrderDetail = (id) => {
|
export const getProductOrderDetail = (id) => {
|
||||||
console.log(`查询商品订单详情, orderId: ${id}`)
|
|
||||||
return request({
|
return request({
|
||||||
url: `/app/product/order/${id}`,
|
url: `/app/product/order/${id}`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@@ -80,7 +78,6 @@ export const cancelOrder = (data) => {
|
|||||||
|
|
||||||
// 结束订单
|
// 结束订单
|
||||||
export const overOrderById = (orderId) => {
|
export const overOrderById = (orderId) => {
|
||||||
console.log(`调用结束订单API, orderId: ${orderId}`)
|
|
||||||
return request({
|
return request({
|
||||||
url: `/app/order/close/${orderId}`,
|
url: `/app/order/close/${orderId}`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@@ -98,7 +95,6 @@ export const getOrderByOrderNo = (orderNo) => {
|
|||||||
|
|
||||||
// 充电宝未弹出反馈(快捷反馈)
|
// 充电宝未弹出反馈(快捷反馈)
|
||||||
export const reportDeviceNoEject = (data) => {
|
export const reportDeviceNoEject = (data) => {
|
||||||
console.log('充电宝未弹出反馈:', data)
|
|
||||||
return request({
|
return request({
|
||||||
url: '/app/order/report-no-eject',
|
url: '/app/order/report-no-eject',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@@ -108,7 +104,6 @@ export const reportDeviceNoEject = (data) => {
|
|||||||
|
|
||||||
// 充电宝转为自用
|
// 充电宝转为自用
|
||||||
export const convertToOwned = (orderId) => {
|
export const convertToOwned = (orderId) => {
|
||||||
console.log('充电宝转为自用,订单ID:', orderId)
|
|
||||||
return request({
|
return request({
|
||||||
url: `/app/order/convert-to-owned/${orderId}`,
|
url: `/app/order/convert-to-owned/${orderId}`,
|
||||||
method: 'post'
|
method: 'post'
|
||||||
@@ -117,7 +112,6 @@ export const convertToOwned = (orderId) => {
|
|||||||
|
|
||||||
// 不想还了转为自用(按最高费用)
|
// 不想还了转为自用(按最高费用)
|
||||||
export const closeWithMaxFee = (orderNo) => {
|
export const closeWithMaxFee = (orderNo) => {
|
||||||
console.log('不想还了转为自用,订单号:', orderNo)
|
|
||||||
return request({
|
return request({
|
||||||
url: `/app/order/closeWithMaxFee/${orderNo}`,
|
url: `/app/order/closeWithMaxFee/${orderNo}`,
|
||||||
method: 'post'
|
method: 'post'
|
||||||
@@ -156,9 +150,36 @@ export const getWxPaymentStatus = (orderNo) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ==================== Antom 支付相关接口 ====================
|
||||||
|
|
||||||
|
// 创建 Antom H5 支付订单
|
||||||
|
export const createAntomPayment = (orderNo, paymentType, osType) => {
|
||||||
|
return request({
|
||||||
|
url: `/app/antom-payment/create/${orderNo}?paymentType=${paymentType}&osType=${osType}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取 Antom 可用支付方式列表
|
||||||
|
export const getAntomPaymentMethods = (orderNo, osType) => {
|
||||||
|
return request({
|
||||||
|
url: `/app/antom-payment/consult/${orderNo}?osType=${osType}`,
|
||||||
|
method: 'get',
|
||||||
|
hideLoading: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Antom 支付结果查询
|
||||||
|
export const getAntomPaymentStatus = (orderNo, osType) => {
|
||||||
|
return request({
|
||||||
|
url: `/app/antom-payment/inquiry/${orderNo}?osType=${osType}`,
|
||||||
|
method: 'get',
|
||||||
|
hideLoading: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 通过订单号获取支付分订单信息
|
// 通过订单号获取支付分订单信息
|
||||||
export const getOrderByOrderNoScore = (orderNo) => {
|
export const getOrderByOrderNoScore = (orderNo) => {
|
||||||
console.log('通过订单号获取支付分订单信息', orderNo);
|
|
||||||
return request({
|
return request({
|
||||||
url: `/app/wx-payment/score/create/${orderNo}`,
|
url: `/app/wx-payment/score/create/${orderNo}`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@@ -168,7 +189,6 @@ export const getOrderByOrderNoScore = (orderNo) => {
|
|||||||
|
|
||||||
// 通过订单号获取支付分订单状态
|
// 通过订单号获取支付分订单状态
|
||||||
export const getOrderByOrderNoScorePayStatus = (orderNo) => {
|
export const getOrderByOrderNoScorePayStatus = (orderNo) => {
|
||||||
console.log('通过订单号获取支付分订单状态', orderNo);
|
|
||||||
return request({
|
return request({
|
||||||
url: `/app/wx-payment/score/status/${orderNo}`,
|
url: `/app/wx-payment/score/status/${orderNo}`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@@ -178,7 +198,6 @@ export const getOrderByOrderNoScorePayStatus = (orderNo) => {
|
|||||||
|
|
||||||
// 更新订单套餐信息
|
// 更新订单套餐信息
|
||||||
export const updateOrderPackage = (data) => {
|
export const updateOrderPackage = (data) => {
|
||||||
console.log('更新订单套餐信息:', data)
|
|
||||||
return request({
|
return request({
|
||||||
url: '/app/device/updateOrderPackage',
|
url: '/app/device/updateOrderPackage',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@@ -188,7 +207,6 @@ export const updateOrderPackage = (data) => {
|
|||||||
|
|
||||||
// 用户端删除商品订单(逻辑删除)
|
// 用户端删除商品订单(逻辑删除)
|
||||||
export const deleteProductOrder = (id) => {
|
export const deleteProductOrder = (id) => {
|
||||||
console.log('删除商品订单,订单ID:', id)
|
|
||||||
return request({
|
return request({
|
||||||
url: `/app/product/order/${id}`,
|
url: `/app/product/order/${id}`,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
@@ -197,22 +215,9 @@ export const deleteProductOrder = (id) => {
|
|||||||
|
|
||||||
// 用户端取消商品订单支付
|
// 用户端取消商品订单支付
|
||||||
export const cancelProductOrder = (OutOrderNo) => {
|
export const cancelProductOrder = (OutOrderNo) => {
|
||||||
console.log('取消商品订单支付,订单ID:', OutOrderNo)
|
|
||||||
return request({
|
return request({
|
||||||
url: `/app/product/order/${OutOrderNo}/cancel`,
|
url: `/app/product/order/${OutOrderNo}/cancel`,
|
||||||
method: 'put'
|
method: 'put'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* 弃用
|
|
||||||
*/
|
|
||||||
export const getPotionsDetail = (data) => {
|
|
||||||
console.log(data);
|
|
||||||
return request({
|
|
||||||
url: '/device/position/positionDetails',
|
|
||||||
method: 'get',
|
|
||||||
data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
// 配置项:true 表示打印日志,false 表示不打印日志
|
// 配置项:true 表示打印日志,false 表示不打印日志
|
||||||
export const CONSOLE_CONFIG = {
|
export const CONSOLE_CONFIG = {
|
||||||
// 是否启用 console.log
|
// 是否启用 console.log
|
||||||
enableLog: true,
|
enableLog: false,
|
||||||
// 是否启用 console.warn
|
// 是否启用 console.warn
|
||||||
enableWarn: true,
|
enableWarn: true,
|
||||||
// 是否启用 console.error
|
// 是否启用 console.error
|
||||||
|
|||||||
+3
-1
@@ -157,6 +157,7 @@ export default {
|
|||||||
|
|
||||||
order: {
|
order: {
|
||||||
myOrders: 'My Orders',
|
myOrders: 'My Orders',
|
||||||
|
myDeviceOrders:'Customize Orders',
|
||||||
noOrderRecord: 'No order records',
|
noOrderRecord: 'No order records',
|
||||||
getOrderListFailed: 'Failed to get order list',
|
getOrderListFailed: 'Failed to get order list',
|
||||||
confirmCancelContent: 'Are you sure to cancel this order?',
|
confirmCancelContent: 'Are you sure to cancel this order?',
|
||||||
@@ -799,10 +800,11 @@ export default {
|
|||||||
|
|
||||||
goods: {
|
goods: {
|
||||||
title: 'Product Details',
|
title: 'Product Details',
|
||||||
|
goodsTitle:'Customize Details',
|
||||||
productName: 'FengDianZhe Shared Fan + Power Bank + Hand Warmer Series - Cherry Blossom Pink',
|
productName: 'FengDianZhe Shared Fan + Power Bank + Hand Warmer Series - Cherry Blossom Pink',
|
||||||
perUnit: '/pc',
|
perUnit: '/pc',
|
||||||
buyNow: 'Buy Now',
|
buyNow: 'Buy Now',
|
||||||
productDetail: 'Product Details',
|
productDetail: 'Customize Details',
|
||||||
features: {
|
features: {
|
||||||
battery: '8000Ahm',
|
battery: '8000Ahm',
|
||||||
batteryDesc: 'Large Capacity Battery',
|
batteryDesc: 'Large Capacity Battery',
|
||||||
|
|||||||
+3
-1
@@ -157,6 +157,7 @@ export default {
|
|||||||
|
|
||||||
order: {
|
order: {
|
||||||
myOrders: '我的订单',
|
myOrders: '我的订单',
|
||||||
|
myDeviceOrders:'我的定制',
|
||||||
noOrderRecord: '暂无订单记录',
|
noOrderRecord: '暂无订单记录',
|
||||||
getOrderListFailed: '获取订单列表失败',
|
getOrderListFailed: '获取订单列表失败',
|
||||||
confirmCancelContent: '确定要取消此订单吗?',
|
confirmCancelContent: '确定要取消此订单吗?',
|
||||||
@@ -799,10 +800,11 @@ export default {
|
|||||||
|
|
||||||
goods: {
|
goods: {
|
||||||
title: '商品详情',
|
title: '商品详情',
|
||||||
|
goodsTitle:'定制详情',
|
||||||
productName: '风电者共享风扇 + 充电宝 + 暖手宝系列-樱花粉',
|
productName: '风电者共享风扇 + 充电宝 + 暖手宝系列-樱花粉',
|
||||||
perUnit: '/个',
|
perUnit: '/个',
|
||||||
buyNow: '立即购买',
|
buyNow: '立即购买',
|
||||||
productDetail: '商品详情',
|
productDetail: '定制详情',
|
||||||
features: {
|
features: {
|
||||||
battery: '8000Ahm',
|
battery: '8000Ahm',
|
||||||
batteryDesc: '大容量电池',
|
batteryDesc: '大容量电池',
|
||||||
|
|||||||
+3
-2
@@ -126,7 +126,7 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/device/orderDetail",
|
"path": "pages/device/orderDetail",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "订单详情",
|
"navigationBarTitleText": "定制详情",
|
||||||
"navigationBarBackgroundColor": "#ffffff",
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
"navigationBarTextStyle": "black"
|
"navigationBarTextStyle": "black"
|
||||||
}
|
}
|
||||||
@@ -276,7 +276,8 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "",
|
"navigationBarTitleText": "",
|
||||||
"navigationBarBackgroundColor": "#ffffff",
|
"navigationBarBackgroundColor": "#ffffff",
|
||||||
"navigationBarTextStyle": "black"
|
"navigationBarTextStyle": "black",
|
||||||
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -364,7 +364,7 @@
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: t('goods.title')
|
title: t('goods.goodsTitle')
|
||||||
})
|
})
|
||||||
// 初始化地区数据
|
// 初始化地区数据
|
||||||
initRegionData()
|
initRegionData()
|
||||||
|
|||||||
@@ -114,7 +114,7 @@
|
|||||||
<view class="action-btn secondary" @click="onDeleteOrder">
|
<view class="action-btn secondary" @click="onDeleteOrder">
|
||||||
删除订单
|
删除订单
|
||||||
</view>
|
</view>
|
||||||
<view class="action-btn primary" @click="onReorder">
|
<view class="action-btn primary" @click="onReorder(orderDetail.productId)">
|
||||||
再次定制
|
再次定制
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
<view class="action-btn secondary" @click="onContactService">
|
<view class="action-btn secondary" @click="onContactService">
|
||||||
联系客服
|
联系客服
|
||||||
</view>
|
</view>
|
||||||
<view class="action-btn primary" @click="onReorder">
|
<view class="action-btn primary" @click="onReorder(orderDetail.productId)">
|
||||||
再次定制
|
再次定制
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted } from 'vue';
|
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import {
|
import {
|
||||||
queryById,
|
queryById,
|
||||||
@@ -149,6 +149,8 @@
|
|||||||
|
|
||||||
const orderDetail = ref({});
|
const orderDetail = ref({});
|
||||||
const orderId = ref('');
|
const orderId = ref('');
|
||||||
|
const countdownText = ref('');
|
||||||
|
let countdownTimer = null;
|
||||||
|
|
||||||
// 订单状态文本
|
// 订单状态文本
|
||||||
const statusText = computed(() => {
|
const statusText = computed(() => {
|
||||||
@@ -234,6 +236,10 @@
|
|||||||
|
|
||||||
if (status === 0 || status === '0') {
|
if (status === 0 || status === '0') {
|
||||||
title = '待付款';
|
title = '待付款';
|
||||||
|
// 如果有倒计时文本,添加到标题中
|
||||||
|
if (countdownText.value) {
|
||||||
|
title = `${title} ${countdownText.value}`;
|
||||||
|
}
|
||||||
} else if (status === 1 || status === '1') {
|
} else if (status === 1 || status === '1') {
|
||||||
title = '待发货';
|
title = '待发货';
|
||||||
} else if (status === 2 || status === '2') {
|
} else if (status === 2 || status === '2') {
|
||||||
@@ -251,6 +257,66 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 启动倒计时
|
||||||
|
const startCountdown = () => {
|
||||||
|
// 清除之前的定时器
|
||||||
|
if (countdownTimer) {
|
||||||
|
clearInterval(countdownTimer);
|
||||||
|
countdownTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const status = orderDetail.value.status;
|
||||||
|
const expireTime = orderDetail.value.expireTime;
|
||||||
|
|
||||||
|
// 只有待付款状态且有过期时间才显示倒计时
|
||||||
|
if ((status === 0 || status === '0') && expireTime) {
|
||||||
|
// 计算倒计时
|
||||||
|
const updateCountdown = () => {
|
||||||
|
const now = new Date().getTime();
|
||||||
|
const expireTimestamp = new Date(expireTime).getTime();
|
||||||
|
const diff = expireTimestamp - now;
|
||||||
|
|
||||||
|
if (diff > 0) {
|
||||||
|
// 计算总分钟数和秒数
|
||||||
|
const totalMinutes = Math.floor(diff / (1000 * 60));
|
||||||
|
const seconds = Math.floor((diff % (1000 * 60)) / 1000);
|
||||||
|
|
||||||
|
// 格式化为 MM:SS
|
||||||
|
const minutesStr = String(totalMinutes).padStart(2, '0');
|
||||||
|
const secondsStr = String(seconds).padStart(2, '0');
|
||||||
|
|
||||||
|
countdownText.value = `${minutesStr}:${secondsStr}`;
|
||||||
|
updatePageTitle();
|
||||||
|
} else {
|
||||||
|
// 倒计时结束
|
||||||
|
countdownText.value = '';
|
||||||
|
if (countdownTimer) {
|
||||||
|
clearInterval(countdownTimer);
|
||||||
|
countdownTimer = null;
|
||||||
|
}
|
||||||
|
// 重新加载订单详情(订单可能已自动取消)
|
||||||
|
loadOrderDetail();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 立即执行一次
|
||||||
|
updateCountdown();
|
||||||
|
// 每秒更新一次
|
||||||
|
countdownTimer = setInterval(updateCountdown, 1000);
|
||||||
|
} else {
|
||||||
|
countdownText.value = '';
|
||||||
|
updatePageTitle();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 组件卸载时清除定时器
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (countdownTimer) {
|
||||||
|
clearInterval(countdownTimer);
|
||||||
|
countdownTimer = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 加载订单详情
|
// 加载订单详情
|
||||||
const loadOrderDetail = async () => {
|
const loadOrderDetail = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -269,6 +335,7 @@
|
|||||||
outTradeNo: data.outTradeNo,
|
outTradeNo: data.outTradeNo,
|
||||||
userId: data.userId,
|
userId: data.userId,
|
||||||
|
|
||||||
|
|
||||||
// 状态信息
|
// 状态信息
|
||||||
status: data.status,
|
status: data.status,
|
||||||
payStatus: data.payStatus,
|
payStatus: data.payStatus,
|
||||||
@@ -282,6 +349,7 @@
|
|||||||
createTime: data.createTime,
|
createTime: data.createTime,
|
||||||
updateTime: data.updateTime,
|
updateTime: data.updateTime,
|
||||||
payTime: data.payTime,
|
payTime: data.payTime,
|
||||||
|
expireTime: data.expireTime, // 订单自动取消时间
|
||||||
|
|
||||||
// 收货信息
|
// 收货信息
|
||||||
receiverName: data.receiverName,
|
receiverName: data.receiverName,
|
||||||
@@ -300,6 +368,7 @@
|
|||||||
pictureUrl: data.pictureUrl,
|
pictureUrl: data.pictureUrl,
|
||||||
color: data.color,
|
color: data.color,
|
||||||
quantity: data.quantity,
|
quantity: data.quantity,
|
||||||
|
productId:data.productId,
|
||||||
|
|
||||||
// 兼容旧字段
|
// 兼容旧字段
|
||||||
orderId: data.id,
|
orderId: data.id,
|
||||||
@@ -315,8 +384,8 @@
|
|||||||
productImage: data.pictureUrl || data.productImage || ''
|
productImage: data.pictureUrl || data.productImage || ''
|
||||||
};
|
};
|
||||||
|
|
||||||
// 根据订单状态更新页面标题
|
// 启动倒计时
|
||||||
updatePageTitle();
|
startCountdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
@@ -528,9 +597,13 @@
|
|||||||
|
|
||||||
// 再次定制
|
// 再次定制
|
||||||
const onReorder = (order) => {
|
const onReorder = (order) => {
|
||||||
|
if(order){
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/device/goods?productId=${order.productId}`
|
url: `/pages/device/goods?productId=${order}`
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
// console.log(order);
|
||||||
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -622,8 +695,8 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
font-size: 26rpx;
|
font-size: 28rpx;
|
||||||
height: 40rpx;
|
height: 50rpx;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
|||||||
@@ -54,9 +54,6 @@
|
|||||||
import{
|
import{
|
||||||
createProductOrder
|
createProductOrder
|
||||||
}from "@/config/api/product.js"
|
}from "@/config/api/product.js"
|
||||||
import {
|
|
||||||
confirmPaymentAndRent
|
|
||||||
} from '../../config/api/device.js';
|
|
||||||
import {
|
import {
|
||||||
updateUserBalance
|
updateUserBalance
|
||||||
} from '../../config/api/user.js';
|
} from '../../config/api/user.js';
|
||||||
@@ -288,7 +285,7 @@
|
|||||||
// 设置页面标题并监听订单完成事件
|
// 设置页面标题并监听订单完成事件
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: t('order.myOrders')
|
title: t('order.myDeviceOrders')
|
||||||
})
|
})
|
||||||
|
|
||||||
// 监听订单完成事件
|
// 监听订单完成事件
|
||||||
|
|||||||
@@ -49,9 +49,6 @@
|
|||||||
cancelOrder,
|
cancelOrder,
|
||||||
createWxPayment
|
createWxPayment
|
||||||
} from '../../config/api/order.js';
|
} from '../../config/api/order.js';
|
||||||
import {
|
|
||||||
confirmPaymentAndRent
|
|
||||||
} from '../../config/api/device.js';
|
|
||||||
import {
|
import {
|
||||||
updateUserBalance
|
updateUserBalance
|
||||||
} from '../../config/api/user.js';
|
} from '../../config/api/user.js';
|
||||||
|
|||||||
+437
-160
@@ -2,14 +2,20 @@
|
|||||||
<view class="payment-container">
|
<view class="payment-container">
|
||||||
<!-- 订单状态 -->
|
<!-- 订单状态 -->
|
||||||
<view class="status-card">
|
<view class="status-card">
|
||||||
<view class="status-icon" :class="orderStatus.class"></view>
|
<view class="status-icon-wrapper">
|
||||||
|
<view class="status-icon" :class="orderStatus.class">
|
||||||
|
<text class="icon-text">💳</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="status-text">{{ orderStatus.text }}</view>
|
<view class="status-text">{{ orderStatus.text }}</view>
|
||||||
<view class="status-desc">{{ orderStatus.desc }}</view>
|
<view class="status-desc">{{ orderStatus.desc }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 订单信息 -->
|
<!-- 订单信息 -->
|
||||||
<view class="order-card">
|
<view class="order-card">
|
||||||
|
<view class="card-header">
|
||||||
<view class="card-title">{{ $t('payment.orderInfo') }}</view>
|
<view class="card-title">{{ $t('payment.orderInfo') }}</view>
|
||||||
|
</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="label">{{ $t('order.orderNo') }}</text>
|
<text class="label">{{ $t('order.orderNo') }}</text>
|
||||||
<text class="value">{{ orderInfo.orderNo || '-' }}</text>
|
<text class="value">{{ orderInfo.orderNo || '-' }}</text>
|
||||||
@@ -22,81 +28,142 @@
|
|||||||
<text class="label">{{ $t('payment.createTime') }}</text>
|
<text class="label">{{ $t('payment.createTime') }}</text>
|
||||||
<text class="value">{{ orderInfo.createTime || '-' }}</text>
|
<text class="value">{{ orderInfo.createTime || '-' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-item">
|
|
||||||
<text class="label">{{ $t('payment.contactPhone') }}</text>
|
|
||||||
<text class="value">{{ orderInfo.phone || '-' }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 费用信息 -->
|
<!-- 费用信息 -->
|
||||||
<view class="price-card">
|
<view class="price-card">
|
||||||
|
<view class="card-header">
|
||||||
<view class="card-title">{{ $t('payment.feeInfo') }}</view>
|
<view class="card-title">{{ $t('payment.feeInfo') }}</view>
|
||||||
|
</view>
|
||||||
<view class="price-item">
|
<view class="price-item">
|
||||||
<text class="label">{{ $t('payment.deposit') }}</text>
|
<text class="label">{{ $t('payment.deposit') }}</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-divider"></view> -->
|
||||||
<text class="label">{{ $t('payment.package') }}</text>
|
|
||||||
<text class="value">{{ packageInfo.price }}{{ $t('unit.yuan') }}/{{ packageInfo.time }}{{ $t('time.hour') }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="price-item total">
|
<view class="price-item total">
|
||||||
<text class="label">{{ $t('payment.total') }}</text>
|
<text class="label">{{ $t('payment.total') }}</text>
|
||||||
<text class="value">¥{{ totalAmount }}</text>
|
<text class="value">¥{{ totalAmount }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 支付方式选择 -->
|
||||||
|
<view class="payment-methods" v-if="paymentMethods.length > 0">
|
||||||
|
<view class="card-header">
|
||||||
|
<view class="card-title">支付方式</view>
|
||||||
|
</view>
|
||||||
|
<view class="method-item" v-for="method in paymentMethods" :key="method?.paymentMethodType"
|
||||||
|
:class="{ active: selectedPaymentMethod === method?.paymentMethodType }"
|
||||||
|
@click="selectPaymentMethod(method?.paymentMethodType)">
|
||||||
|
<view class="method-info">
|
||||||
|
<view class="method-icon">
|
||||||
|
<image :src="method?.logo?.logoUrl" mode="aspectFit" style="width: 48rpx; height: 48rpx;">
|
||||||
|
</image>
|
||||||
|
</view>
|
||||||
|
<text class="method-name">{{ method?.logo?.logoName }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="method-radio" :class="{ checked: selectedPaymentMethod === method?.paymentMethodType }">
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 底部操作栏 -->
|
<!-- 底部操作栏 -->
|
||||||
<view class="bottom-bar">
|
<view class="bottom-bar">
|
||||||
<view class="total-amount">
|
<view class="total-amount">
|
||||||
<text>{{ $t('payment.total') }}:</text>
|
<text class="label-text">{{ $t('payment.total') }}:</text>
|
||||||
<text class="amount">¥{{ totalAmount }}</text>
|
<text class="amount">¥{{ totalAmount }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="pay-btn" @click="handlePayment">{{ $t('payment.payNow') }}</view>
|
<view class="pay-btn" @click="handlePayment">
|
||||||
|
<text>{{ $t('payment.payNow') }}</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, reactive } from 'vue'
|
import {
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
ref,
|
||||||
import { queryById, createWxPayment } from '@/config/api/order.js'
|
computed,
|
||||||
import { getDeviceInfo } from '@/config/api/device.js'
|
reactive,
|
||||||
import { updateUserBalance } from '@/config/api/user.js'
|
onMounted
|
||||||
import { useI18n } from '@/utils/i18n.js'
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
onLoad
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
|
import {
|
||||||
|
queryById,
|
||||||
|
createAntomPayment,
|
||||||
|
getAntomPaymentMethods,
|
||||||
|
getAntomPaymentStatus
|
||||||
|
} from '@/config/api/order.js'
|
||||||
|
import {
|
||||||
|
getDeviceInfo
|
||||||
|
} from '@/config/api/device.js'
|
||||||
|
import {
|
||||||
|
updateUserBalance
|
||||||
|
} from '@/config/api/user.js'
|
||||||
|
import {
|
||||||
|
useI18n
|
||||||
|
} from '@/utils/i18n.js'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const {
|
||||||
|
t
|
||||||
|
} = useI18n()
|
||||||
|
|
||||||
const orderId = ref(null)
|
const orderId = ref(null)
|
||||||
const deviceNo = ref(null)
|
const deviceNo = ref(null)
|
||||||
const orderInfo = ref({})
|
const orderInfo = ref({})
|
||||||
const packageInfo = ref({
|
const deviceInfo = ref(null)
|
||||||
time: '',
|
const passedTotalAmount = ref(null)
|
||||||
price: '0.00'
|
const passedDepositAmount = ref(null)
|
||||||
})
|
|
||||||
const deviceInfo = ref(null)
|
|
||||||
const passedTotalAmount = ref(null)
|
|
||||||
const passedDepositAmount = ref(null)
|
|
||||||
|
|
||||||
const orderStatus = reactive({
|
// 支付方式相关
|
||||||
get text() { return t('payment.waitingForPayment') },
|
const paymentMethods = ref([])
|
||||||
get desc() { return t('payment.pleasePayIn15Min') },
|
const selectedPaymentMethod = ref('ALIPAY') // 默认选择支付宝
|
||||||
|
|
||||||
|
const orderStatus = reactive({
|
||||||
|
get text() {
|
||||||
|
return t('payment.waitingForPayment')
|
||||||
|
},
|
||||||
|
get desc() {
|
||||||
|
return t('payment.pleasePayIn15Min')
|
||||||
|
},
|
||||||
class: 'waiting'
|
class: 'waiting'
|
||||||
})
|
})
|
||||||
|
|
||||||
const totalAmount = computed(() => {
|
const totalAmount = computed(() => {
|
||||||
if (passedTotalAmount.value !== null) {
|
if (passedTotalAmount.value !== null) {
|
||||||
return parseFloat(passedTotalAmount.value).toFixed(2);
|
return parseFloat(passedTotalAmount.value).toFixed(2);
|
||||||
}
|
}
|
||||||
const deposit = parseFloat(orderInfo.value.deposit || passedDepositAmount.value || 99)
|
const deposit = parseFloat(orderInfo.value.deposit || passedDepositAmount.value || 99)
|
||||||
const packagePrice = parseFloat(packageInfo.value.price || 0)
|
return deposit.toFixed(2)
|
||||||
return (deposit + packagePrice).toFixed(2)
|
})
|
||||||
})
|
|
||||||
|
// 加载订单信息
|
||||||
|
const loadOrderInfo = async () => {
|
||||||
|
// 检查 orderId 是否存在,如果不存在则尝试从缓存获取
|
||||||
|
if (!orderId.value) {
|
||||||
|
// #ifdef H5
|
||||||
|
const cachedOrderId = uni.getStorageSync('pendingPaymentNo');
|
||||||
|
if (cachedOrderId) {
|
||||||
|
orderId.value = cachedOrderId;
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果两种方式都获取不到 orderId,提示并跳转
|
||||||
|
if (!orderId.value) {
|
||||||
|
uni.showToast({
|
||||||
|
title: t('order.orderNotExist'),
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
});
|
||||||
|
}, 1500);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 加载订单信息
|
|
||||||
const loadOrderInfo = async () => {
|
|
||||||
try {
|
try {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: t('common.loading')
|
title: t('common.loading')
|
||||||
@@ -123,20 +190,12 @@ const loadOrderInfo = async () => {
|
|||||||
orderNo: orderData.orderNo || orderData.orderId,
|
orderNo: orderData.orderNo || orderData.orderId,
|
||||||
deviceNo: orderData.deviceNo,
|
deviceNo: orderData.deviceNo,
|
||||||
createTime: formattedTime,
|
createTime: formattedTime,
|
||||||
phone: orderData.phone,
|
|
||||||
deposit: passedDepositAmount.value || orderData.depositAmount || '99.00',
|
deposit: passedDepositAmount.value || orderData.depositAmount || '99.00',
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orderData.packageTime && orderData.packagePrice) {
|
|
||||||
const timeInHours = (parseFloat(orderData.packageTime) / 60).toFixed(1);
|
|
||||||
packageInfo.value = {
|
|
||||||
time: timeInHours.toString(),
|
|
||||||
price: orderData.packagePrice.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
deviceNo.value = orderData.deviceNo;
|
deviceNo.value = orderData.deviceNo;
|
||||||
await loadDeviceInfo();
|
await loadDeviceInfo();
|
||||||
|
await loadPaymentMethods();
|
||||||
} else {
|
} else {
|
||||||
throw new Error(t('order.getOrderFailed'))
|
throw new Error(t('order.getOrderFailed'))
|
||||||
}
|
}
|
||||||
@@ -149,10 +208,10 @@ const loadOrderInfo = async () => {
|
|||||||
} finally {
|
} finally {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载设备信息
|
// 加载设备信息
|
||||||
const loadDeviceInfo = async () => {
|
const loadDeviceInfo = async () => {
|
||||||
if (!deviceNo.value) return;
|
if (!deviceNo.value) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -167,48 +226,112 @@ const loadDeviceInfo = async () => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取设备信息失败:', error);
|
console.error('获取设备信息失败:', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取操作系统类型
|
||||||
|
const getOsType = () => {
|
||||||
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
|
console.log(uni.getSystemInfoSync());
|
||||||
|
|
||||||
|
const platform = systemInfo.platform;
|
||||||
|
console.log('当前系统类型:', uni.getSystemInfoSync().platform);
|
||||||
|
|
||||||
|
// 根据平台返回对应的 osType
|
||||||
|
if (platform === 'android') {
|
||||||
|
return 'ANDROID';
|
||||||
|
} else if (platform === 'ios') {
|
||||||
|
return 'IOS';
|
||||||
|
} else {
|
||||||
|
// 默认返回 ANDROID
|
||||||
|
return 'ANDROID';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载支付方式列表
|
||||||
|
const loadPaymentMethods = async () => {
|
||||||
|
if (!orderInfo.value.orderNo) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const osType = getOsType();
|
||||||
|
console.log('当前系统类型:', osType);
|
||||||
|
|
||||||
|
const res = await getAntomPaymentMethods(orderInfo.value.orderNo, osType);
|
||||||
|
if (res.code === 200 && res.data && res.data.paymentOptions) {
|
||||||
|
paymentMethods.value = res.data.paymentOptions;
|
||||||
|
console.log('支付方式列表:', paymentMethods.value);
|
||||||
|
// 如果有支付方式,默认选择第一个
|
||||||
|
if (paymentMethods.value.length > 0) {
|
||||||
|
selectedPaymentMethod.value = paymentMethods.value[0].paymentMethodType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取支付方式失败:', error);
|
||||||
|
// 如果获取失败,使用默认支付方式
|
||||||
|
paymentMethods.value = [{
|
||||||
|
paymentMethodType: 'ALIPAY',
|
||||||
|
paymentMethodName: '支付宝'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
paymentMethodType: 'WECHATPAY',
|
||||||
|
paymentMethodName: '微信支付'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 选择支付方式
|
||||||
|
const selectPaymentMethod = (methodType) => {
|
||||||
|
selectedPaymentMethod.value = methodType;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取支付方式图标
|
||||||
|
const getPaymentIcon = (methodType) => {
|
||||||
|
const iconMap = {
|
||||||
|
'ALIPAY': 'alipay',
|
||||||
|
'WECHATPAY': 'wechat',
|
||||||
|
'WECHAT': 'wechat'
|
||||||
|
};
|
||||||
|
return iconMap[methodType] || 'default';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理支付
|
||||||
|
const handlePayment = async () => {
|
||||||
|
if (!selectedPaymentMethod.value) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请选择支付方式',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 处理支付
|
|
||||||
const handlePayment = async () => {
|
|
||||||
try {
|
try {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: t('common.processing')
|
title: t('common.processing')
|
||||||
})
|
})
|
||||||
|
|
||||||
const res = await createWxPayment(orderInfo.value.orderNo)
|
const osType = getOsType();
|
||||||
|
const res = await createAntomPayment(orderInfo.value.orderNo, selectedPaymentMethod.value, osType)
|
||||||
|
|
||||||
if (res && res.code === 200) {
|
if (res && res.code === 200 && res.data) {
|
||||||
const payParams = res.data
|
const paymentUrl = res.data.h5Url;
|
||||||
|
|
||||||
await uni.requestPayment({
|
if (!paymentUrl) {
|
||||||
...payParams,
|
throw new Error('未获取到支付链接');
|
||||||
success: async () => {
|
|
||||||
uni.showToast({
|
|
||||||
title: t('payment.paymentSuccess'),
|
|
||||||
icon: 'success'
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
await updateUserBalance(orderId.value);
|
|
||||||
} catch (error) {
|
|
||||||
console.warn('更新用户余额失败:', error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
uni.hideLoading();
|
||||||
uni.redirectTo({
|
// #ifdef H5
|
||||||
url: `/pages/order/index?orderId=${orderId.value}`
|
uni.setStorageSync('pendingPaymentNo', orderId.value);
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// 跳转到支付页面
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/webview/index?url=${encodeURIComponent(paymentUrl)}&title=支付`
|
||||||
});
|
});
|
||||||
}, 1500);
|
|
||||||
},
|
// 开始轮询支付状态
|
||||||
fail: (err) => {
|
startPaymentStatusPolling();
|
||||||
console.error('支付失败:', err)
|
|
||||||
uni.showToast({
|
|
||||||
title: t('payment.paymentFailedRetry'),
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error(res?.msg || t('payment.createPayOrderFailed'))
|
throw new Error(res?.msg || t('payment.createPayOrderFailed'))
|
||||||
}
|
}
|
||||||
@@ -221,10 +344,82 @@ const handlePayment = async () => {
|
|||||||
} finally {
|
} finally {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 格式化时间
|
// 轮询支付状态
|
||||||
const formatTime = (date) => {
|
let pollingTimer = null;
|
||||||
|
const startPaymentStatusPolling = () => {
|
||||||
|
// 清除之前的定时器
|
||||||
|
if (pollingTimer) {
|
||||||
|
clearInterval(pollingTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
let pollCount = 0;
|
||||||
|
const maxPollCount = 60; // 最多轮询60次(5分钟)
|
||||||
|
|
||||||
|
pollingTimer = setInterval(async () => {
|
||||||
|
pollCount++;
|
||||||
|
|
||||||
|
if (pollCount > maxPollCount) {
|
||||||
|
clearInterval(pollingTimer);
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付超时,请重新支付',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const osType = getOsType();
|
||||||
|
const res = await getAntomPaymentStatus(orderInfo.value.orderNo, osType);
|
||||||
|
if (res && res.code === 200 && res.data) {
|
||||||
|
const paymentStatus = res.data.paymentStatus;
|
||||||
|
|
||||||
|
if (paymentStatus === 'SUCCESS') {
|
||||||
|
clearInterval(pollingTimer);
|
||||||
|
|
||||||
|
// uni.showToast({
|
||||||
|
// title: t('payment.paymentSuccess'),
|
||||||
|
// icon: 'success'
|
||||||
|
// });
|
||||||
|
|
||||||
|
try {
|
||||||
|
await updateUserBalance(orderId.value);
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('更新用户余额失败:', error);
|
||||||
|
}
|
||||||
|
console.log(orderInfo);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: `/pages/order/success?orderId=${orderId.value}&deviceId=${orderInfo.value.deviceNo}`
|
||||||
|
});
|
||||||
|
}, 1500);
|
||||||
|
} else if (paymentStatus === 'FAIL' || paymentStatus === 'CANCELLED') {
|
||||||
|
clearInterval(pollingTimer);
|
||||||
|
uni.showToast({
|
||||||
|
title: '支付失败,请重新支付',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('查询支付状态失败:', error);
|
||||||
|
}
|
||||||
|
}, 5000); // 每5秒查询一次
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页面卸载时清除定时器
|
||||||
|
onMounted(() => {
|
||||||
|
return () => {
|
||||||
|
if (pollingTimer) {
|
||||||
|
clearInterval(pollingTimer);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
// 格式化时间
|
||||||
|
const formatTime = (date) => {
|
||||||
const year = date.getFullYear()
|
const year = date.getFullYear()
|
||||||
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
||||||
const day = date.getDate().toString().padStart(2, '0')
|
const day = date.getDate().toString().padStart(2, '0')
|
||||||
@@ -232,13 +427,14 @@ const formatTime = (date) => {
|
|||||||
const minute = date.getMinutes().toString().padStart(2, '0')
|
const minute = date.getMinutes().toString().padStart(2, '0')
|
||||||
|
|
||||||
return `${year}-${month}-${day} ${hour}:${minute}`
|
return `${year}-${month}-${day} ${hour}:${minute}`
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: t('payment.orderPayment')
|
title: t('payment.orderPayment')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 优先从 options 中获取 orderId
|
||||||
if (options && options.orderId) {
|
if (options && options.orderId) {
|
||||||
orderId.value = options.orderId
|
orderId.value = options.orderId
|
||||||
|
|
||||||
@@ -253,51 +449,65 @@ onLoad((options) => {
|
|||||||
if (options.feeConfig) {
|
if (options.feeConfig) {
|
||||||
try {
|
try {
|
||||||
const feeConfigStr = decodeURIComponent(options.feeConfig)
|
const feeConfigStr = decodeURIComponent(options.feeConfig)
|
||||||
deviceInfo.value = { feeConfig: feeConfigStr }
|
deviceInfo.value = {
|
||||||
|
feeConfig: feeConfigStr
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('解析URL中的feeConfig失败:', e)
|
console.error('解析URL中的feeConfig失败:', e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadOrderInfo()
|
loadOrderInfo()
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: t('order.orderNotExist'),
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pages/index/index'
|
|
||||||
})
|
|
||||||
}, 1500)
|
|
||||||
}
|
}
|
||||||
})
|
// #ifdef H5
|
||||||
|
// 如果 options 中没有 orderId,尝试从缓存中获取(H5 环境)
|
||||||
|
else {
|
||||||
|
const cachedOrderId = uni.getStorageSync('pendingPaymentNo');
|
||||||
|
console.log("订单编号:"+cachedOrderId);
|
||||||
|
|
||||||
|
if (cachedOrderId) {
|
||||||
|
orderId.value = cachedOrderId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// 调用 loadOrderInfo,内部会再次检查 orderId 是否存在
|
||||||
|
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.payment-container {
|
.payment-container {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: #f8f8f8;
|
background: #f7f8fa;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
padding-bottom: 180rpx;
|
padding-bottom: 180rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
.status-card {
|
.status-card {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 24rpx;
|
border-radius: 20rpx;
|
||||||
padding: 40rpx 30rpx;
|
padding: 40rpx 30rpx;
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 20rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||||
|
|
||||||
|
.status-icon-wrapper {
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
|
||||||
.status-icon {
|
.status-icon {
|
||||||
width: 120rpx;
|
width: 120rpx;
|
||||||
height: 120rpx;
|
height: 120rpx;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: #f5f5f5;
|
display: flex;
|
||||||
margin-bottom: 20rpx;
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.icon-text {
|
||||||
|
font-size: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
&.waiting {
|
&.waiting {
|
||||||
background: #FFF9C4;
|
background: #FFF9C4;
|
||||||
@@ -311,10 +521,11 @@ onLoad((options) => {
|
|||||||
background: #FFEBEE;
|
background: #FFEBEE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.status-text {
|
.status-text {
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
font-weight: 600;
|
font-weight: bold;
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-bottom: 10rpx;
|
margin-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
@@ -325,40 +536,32 @@ onLoad((options) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-card, .price-card {
|
.order-card,
|
||||||
|
.price-card,
|
||||||
|
.payment-methods {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 24rpx;
|
border-radius: 20rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 20rpx;
|
||||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||||
|
|
||||||
|
.card-header {
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
|
||||||
.card-title {
|
.card-title {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: 600;
|
font-weight: bold;
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-bottom: 20rpx;
|
|
||||||
position: relative;
|
|
||||||
padding-left: 20rpx;
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
width: 8rpx;
|
|
||||||
height: 32rpx;
|
|
||||||
background: #1976D2;
|
|
||||||
border-radius: 4rpx;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-item, .price-item {
|
.info-item,
|
||||||
|
.price-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 20rpx 0;
|
padding: 16rpx 0;
|
||||||
border-bottom: 1px solid #f5f5f5;
|
border-bottom: 1rpx solid #f0f0f0;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
@@ -366,58 +569,121 @@ onLoad((options) => {
|
|||||||
|
|
||||||
.label {
|
.label {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #666;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.value {
|
.value {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.total {
|
.price-divider {
|
||||||
margin-top: 10rpx;
|
height: 1rpx;
|
||||||
padding-top: 30rpx;
|
background: #f0f0f0;
|
||||||
border-top: 1px solid #f5f5f5;
|
margin: 10rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
.label, .value {
|
.price-item.total {
|
||||||
font-size: 32rpx;
|
margin-top: 10rpx;
|
||||||
font-weight: 600;
|
padding-top: 20rpx;
|
||||||
color: #333;
|
border-top: none;
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.value {
|
.value {
|
||||||
color: #FF5722;
|
font-size: 48rpx;
|
||||||
}
|
font-weight: bold;
|
||||||
|
color: #ff6b6b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.wechat-tip {
|
.payment-methods {
|
||||||
background: #fff;
|
.method-item {
|
||||||
border-radius: 24rpx;
|
display: flex;
|
||||||
padding: 30rpx;
|
justify-content: space-between;
|
||||||
margin-bottom: 30rpx;
|
align-items: center;
|
||||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
padding: 24rpx 20rpx;
|
||||||
|
margin-bottom: 16rpx;
|
||||||
|
background: #f7f8fa;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
border: 2rpx solid transparent;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background: #E8F5E9;
|
||||||
|
border-color: #07c160;
|
||||||
|
}
|
||||||
|
|
||||||
|
.method-info {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.method-icon {
|
.method-icon {
|
||||||
width: 48rpx;
|
width: 48rpx;
|
||||||
height: 48rpx;
|
height: 48rpx;
|
||||||
margin-right: 20rpx;
|
margin-right: 16rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
|
||||||
|
&.alipay {
|
||||||
|
background: #1677FF;
|
||||||
|
}
|
||||||
|
|
||||||
&.wechat {
|
&.wechat {
|
||||||
background: url('../../static/images/wechat.svg') no-repeat center/contain;
|
background: #07C160;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.default {
|
||||||
|
background: #999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.method-text {
|
.method-name {
|
||||||
font-size: 28rpx;
|
font-size: 30rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.method-radio {
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
border: 2rpx solid #ddd;
|
||||||
|
border-radius: 50%;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&.checked {
|
||||||
|
border-color: #07c160;
|
||||||
|
background: #07c160;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
width: 16rpx;
|
||||||
|
height: 16rpx;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.bottom-bar {
|
.bottom-bar {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0;
|
left: 0;
|
||||||
@@ -430,32 +696,43 @@ onLoad((options) => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
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;
|
||||||
|
gap: 20rpx;
|
||||||
|
|
||||||
.total-amount {
|
.total-amount {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
|
||||||
|
.label-text {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
.amount {
|
.amount {
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
font-weight: 600;
|
font-weight: bold;
|
||||||
color: #FF5722;
|
color: #ff6b6b;
|
||||||
margin-left: 10rpx;
|
margin-left: 8rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.pay-btn {
|
.pay-btn {
|
||||||
background: #1976D2;
|
height: 88rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: #07c160;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 32rpx;
|
font-size: 30rpx;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
padding: 20rpx 60rpx;
|
padding: 0 60rpx;
|
||||||
border-radius: 100rpx;
|
border-radius: 44rpx;
|
||||||
border: none;
|
border: none;
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
opacity: 0.9;
|
opacity: 0.8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
+105
-101
@@ -44,78 +44,114 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
import { queryById } from '@/config/api/order.js'
|
import {
|
||||||
import { confirmPaymentAndRent } from '@/config/api/device.js'
|
ref,
|
||||||
|
getCurrentInstance
|
||||||
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
onLoad
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
|
import {
|
||||||
|
queryById,
|
||||||
|
getOrderByOrderNo
|
||||||
|
} from '@/config/api/order.js'
|
||||||
|
|
||||||
export default {
|
// 获取当前实例以访问 $t 方法
|
||||||
data() {
|
const {
|
||||||
return {
|
proxy
|
||||||
orderId: '',
|
} = getCurrentInstance()
|
||||||
orderInfo: {},
|
|
||||||
isLoading: true,
|
// 响应式数据
|
||||||
deviceMessage: '',
|
const orderId = ref('')
|
||||||
hasTriggeredDevice: false
|
const orderInfo = ref({})
|
||||||
}
|
const isLoading = ref(true)
|
||||||
},
|
const deviceMessage = ref('')
|
||||||
onLoad(options) {
|
const hasTriggeredDevice = ref(false)
|
||||||
|
|
||||||
|
// 页面加载
|
||||||
|
onLoad((options) => {
|
||||||
// 设置页面标题
|
// 设置页面标题
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: this.$t('success.paymentSuccess')
|
title: proxy.$t('success.paymentSuccess')
|
||||||
})
|
})
|
||||||
|
|
||||||
this.deviceMessage = this.$t('success.preparingDevice')
|
deviceMessage.value = proxy.$t('success.preparingDevice')
|
||||||
|
|
||||||
if (options && options.orderId) {
|
// #ifdef H5
|
||||||
this.orderId = options.orderId
|
if (uni.getStorageSync('pendingPaymentNo')) {
|
||||||
this.loadOrderInfo()
|
orderId.value = options.orderId
|
||||||
|
loadOrderInfo()
|
||||||
|
|
||||||
// 添加页面显示监听,防止页面切换后重复触发弹出
|
// 添加页面显示监听,防止页面切换后重复触发弹出
|
||||||
uni.$once('orderSuccess:' + this.orderId, () => {
|
uni.$once('orderSuccess:' + orderId.value, () => {
|
||||||
console.log('已经触发过弹出逻辑,不再重复触发')
|
console.log('已经触发过弹出逻辑,不再重复触发')
|
||||||
this.hasTriggeredDevice = true
|
hasTriggeredDevice.value = true
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: this.$t('order.orderNotExist'),
|
title: proxy.$t('order.orderNotExist'),
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.goToHome()
|
goToHome()
|
||||||
}, 1500)
|
}, 1500)
|
||||||
}
|
}
|
||||||
},
|
// #endif
|
||||||
methods: {
|
// #ifndef H5
|
||||||
async loadOrderInfo() {
|
if (options && options.orderId) {
|
||||||
try {
|
orderId.value = options.orderId
|
||||||
uni.showLoading({
|
loadOrderInfo()
|
||||||
title: this.$t('common.loading')
|
|
||||||
|
// 添加页面显示监听,防止页面切换后重复触发弹出
|
||||||
|
uni.$once('orderSuccess:' + orderId.value, () => {
|
||||||
|
console.log('已经触发过弹出逻辑,不再重复触发')
|
||||||
|
hasTriggeredDevice.value = true
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: proxy.$t('order.orderNotExist'),
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
goToHome()
|
||||||
|
}, 1500)
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
})
|
})
|
||||||
|
|
||||||
const res = await queryById(this.orderId)
|
// 加载订单信息
|
||||||
|
const loadOrderInfo = async () => {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: proxy.$t('common.loading')
|
||||||
|
})
|
||||||
|
|
||||||
|
const res = await queryById(orderId.value)
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
const orderData = res.data
|
const orderData = res.data
|
||||||
this.orderInfo = {
|
orderInfo.value = {
|
||||||
orderNo: orderData.orderNo || orderData.orderId,
|
orderNo: orderData.orderNo || orderData.orderId,
|
||||||
deviceNo: orderData.deviceNo,
|
deviceNo: orderData.deviceNo,
|
||||||
amount: orderData.payAmount || orderData.amount,
|
amount: orderData.payAmount || orderData.amount,
|
||||||
payTime: orderData.payTime || this.formatTime(new Date())
|
payTime: orderData.payTime || formatTime(new Date())
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查订单状态
|
// 检查订单状态
|
||||||
if (orderData.orderStatus === 'IN_USED') {
|
if (orderData.orderStatus === 'IN_USED') {
|
||||||
// 如果已经是使用中状态,可能说明开锁已经完成
|
// 如果已经是使用中状态,可能说明开锁已经完成
|
||||||
this.deviceMessage = '设备已弹出,请取走您的风扇'
|
deviceMessage.value = '设备已弹出,请取走您的风扇'
|
||||||
this.isLoading = false
|
isLoading.value = false
|
||||||
|
|
||||||
// 如果是第一次加载页面且设备已弹出,记录状态,避免重复弹出
|
// 如果是第一次加载页面且设备已弹出,记录状态,避免重复弹出
|
||||||
if (!this.hasTriggeredDevice) {
|
if (!hasTriggeredDevice.value) {
|
||||||
uni.$emit('orderSuccess:' + this.orderId)
|
uni.$emit('orderSuccess:' + orderId.value)
|
||||||
this.hasTriggeredDevice = true
|
hasTriggeredDevice.value = true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 正常触发弹出逻辑
|
// 在此页面不再触发设备弹出操作,仅更新展示文案和加载状态
|
||||||
this.triggerDeviceEject()
|
deviceMessage.value = proxy.$t('success.paymentSuccessDesc')
|
||||||
|
isLoading.value = false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error('获取订单信息失败')
|
throw new Error('获取订单信息失败')
|
||||||
@@ -125,53 +161,14 @@ export default {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: error.message || this.$t('order.getOrderFailed'),
|
title: error.message || proxy.$t('order.getOrderFailed'),
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
// 触发弹出风扇
|
|
||||||
async triggerDeviceEject() {
|
|
||||||
if (this.hasTriggeredDevice) {
|
|
||||||
console.log('已经触发过弹出风扇,不重复触发')
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hasTriggeredDevice = true
|
// 格式化时间
|
||||||
uni.$emit('orderSuccess:' + this.orderId)
|
const formatTime = (date) => {
|
||||||
this.isLoading = true
|
|
||||||
this.deviceMessage = this.$t('success.preparingDevice')
|
|
||||||
|
|
||||||
try {
|
|
||||||
console.log(`准备触发弹出风扇,orderId: ${this.orderId}`)
|
|
||||||
|
|
||||||
// 调用确认支付并弹出的方法
|
|
||||||
const result = await confirmPaymentAndRent(this.orderId)
|
|
||||||
console.log('确认支付并弹出风扇结果:', JSON.stringify(result))
|
|
||||||
|
|
||||||
if (result && result.code === 200) {
|
|
||||||
this.deviceMessage = this.$t('success.deviceReady')
|
|
||||||
uni.showToast({
|
|
||||||
title: this.$t('success.deviceReady'),
|
|
||||||
icon: 'success'
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
throw new Error((result && result.msg) || this.$t('success.deviceFailed'))
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('弹出风扇错误:', error)
|
|
||||||
this.deviceMessage = this.$t('success.deviceFailed')
|
|
||||||
uni.showToast({
|
|
||||||
title: error.message || this.$t('success.deviceFailed'),
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
} finally {
|
|
||||||
this.isLoading = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
formatTime(date) {
|
|
||||||
const year = date.getFullYear()
|
const year = date.getFullYear()
|
||||||
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
||||||
const day = date.getDate().toString().padStart(2, '0')
|
const day = date.getDate().toString().padStart(2, '0')
|
||||||
@@ -179,29 +176,31 @@ export default {
|
|||||||
const minute = date.getMinutes().toString().padStart(2, '0')
|
const minute = date.getMinutes().toString().padStart(2, '0')
|
||||||
const second = date.getSeconds().toString().padStart(2, '0')
|
const second = date.getSeconds().toString().padStart(2, '0')
|
||||||
return `${year}-${month}-${day} ${hour}:${minute}:${second}`
|
return `${year}-${month}-${day} ${hour}:${minute}:${second}`
|
||||||
},
|
}
|
||||||
goToHome() {
|
|
||||||
uni.switchTab({
|
// 返回首页
|
||||||
|
const goToHome = () => {
|
||||||
|
uni.reLaunch({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
goToOrderList() {
|
|
||||||
|
// 查看订单列表
|
||||||
|
const goToOrderList = () => {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pages/order/index'
|
url: '/pages/order/index'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.success-container {
|
.success-container {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-card {
|
.status-card {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
@@ -243,9 +242,9 @@ export default {
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-card {
|
.order-card {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
@@ -274,9 +273,9 @@ export default {
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.device-status {
|
.device-status {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
@@ -305,13 +304,18 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes spin {
|
@keyframes spin {
|
||||||
0% { transform: rotate(0deg); }
|
0% {
|
||||||
100% { transform: rotate(360deg); }
|
transform: rotate(0deg);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-group {
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-group {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
display: flex;
|
display: flex;
|
||||||
// flex-direction: column;
|
// flex-direction: column;
|
||||||
@@ -342,5 +346,5 @@ export default {
|
|||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user