fix:修复bug
This commit is contained in:
+25
-7
@@ -81,11 +81,12 @@
|
||||
|
||||
<!-- 底部操作区 -->
|
||||
<view class="footer">
|
||||
<button class="rent-button" :class="{ 'return-button': hasActiveOrder }"
|
||||
@click="handleRent('wx-pay')">
|
||||
<text>{{ hasActiveOrder ? $t('order.returnDevice') : $t('device.rentDepositFree') }}</text>
|
||||
</button>
|
||||
<view class="wechat-credit">
|
||||
<view class="rent-button" :class="{ 'return-button': hasActiveOrder }"
|
||||
@click="handleRent(isWechatMiniProgram ? 'wx-score-pay' : 'wx-pay')">
|
||||
<text>{{ hasActiveOrder ? $t('order.returnDevice') : getRentButtonText() }}</text>
|
||||
</view>
|
||||
<!-- 微信支付分标识仅在微信小程序环境显示 -->
|
||||
<view class="wechat-credit" v-if="isWechatMiniProgram">
|
||||
<image src="/static/images/wxpayflag.png" mode="aspectFit" class="wx-icon"></image>
|
||||
<text class="credit-text">{{ $t('device.wxPayScoreDesc') }}</text>
|
||||
</view>
|
||||
@@ -162,6 +163,7 @@
|
||||
const isLoggedIn = ref(true)
|
||||
const phoneNumber = ref('')
|
||||
const showPhoneAuthPopup = ref(false)
|
||||
const isWechatMiniProgram = ref(false)
|
||||
|
||||
// 生命周期 onLoad 钩子
|
||||
onLoad(async (options) => {
|
||||
@@ -179,6 +181,13 @@
|
||||
uni.setNavigationBarTitle({
|
||||
title: t('device.deviceInfo')
|
||||
})
|
||||
// 检测当前运行环境
|
||||
// #ifdef MP-WEIXIN
|
||||
isWechatMiniProgram.value = true
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
isWechatMiniProgram.value = false
|
||||
// #endif
|
||||
await checkUserPhone()
|
||||
await fetchDeviceInfo()
|
||||
})
|
||||
@@ -368,7 +377,7 @@
|
||||
const goToPurchase = () => {
|
||||
const positionId = positionInfo.value?.positionId || positionInfo.value?.id
|
||||
uni.navigateTo({
|
||||
url: `/pages/purchase/index?positionId=${positionId}`
|
||||
url: `/subPackages/business/purchase/index?positionId=${positionId}`
|
||||
})
|
||||
}
|
||||
|
||||
@@ -381,7 +390,7 @@
|
||||
const order = inUseRes.data
|
||||
// 如果有正在进行的订单,跳转到归还页面,带上设备ID
|
||||
uni.redirectTo({
|
||||
url: `/pages/device/return?deviceId=${deviceId.value}`
|
||||
url: `/subPackages/service/return/index?deviceId=${deviceId.value}`
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -499,6 +508,15 @@
|
||||
return `不足${unitMinutes}分钟按${unitMinutes}分钟计费,封顶${depositAmount}元,持续计费至${depositAmount}元视为买断`
|
||||
}
|
||||
|
||||
// 获取租借按钮文本
|
||||
const getRentButtonText = () => {
|
||||
if (isWechatMiniProgram.value) {
|
||||
return t('device.rentDepositFree')
|
||||
} else {
|
||||
return '立即租借'
|
||||
}
|
||||
}
|
||||
|
||||
// 提交租借订单
|
||||
const submitRentOrder = async (payWay) => {
|
||||
try {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,783 +0,0 @@
|
||||
<template>
|
||||
<view class="order-detail-container">
|
||||
<!-- 状态标题 -->
|
||||
<!-- <view class="status-header">
|
||||
<view class="status-icon">
|
||||
<uv-icon name="checkbox-mark" size="40" color="#07c160"></uv-icon>
|
||||
</view>
|
||||
<text class="status-text">{{ statusText }}</text>
|
||||
</view> -->
|
||||
|
||||
<!-- 产品信息卡片 -->
|
||||
<view class="product-card">
|
||||
<image
|
||||
:src="orderDetail.pictureUrl || orderDetail.productImage || '/static/default-product.png'"
|
||||
mode="aspectFill"
|
||||
class="product-image"
|
||||
></image>
|
||||
<view class="product-info">
|
||||
<view class="product-name">{{ orderDetail.productName || orderDetail.deviceName || '风电者2026新款风扇、充电宝、暖手宝三合一' }}</view>
|
||||
<view class="product-style">款式:{{ orderDetail.optionName || orderDetail.style || '标准' }}</view>
|
||||
<view class="product-price">¥{{ orderDetail.price || orderDetail.totalAmount }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单信息 -->
|
||||
<view class="info-section">
|
||||
<view class="section-title">订单信息</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">订单号</text>
|
||||
<text class="value">{{ orderDetail.orderNo || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item" v-if="orderDetail.outTradeNo">
|
||||
<text class="label">交易单号</text>
|
||||
<text class="value">{{ orderDetail.outTradeNo }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">订单状态</text>
|
||||
<text class="value" :style="{color: statusColor}">{{ statusText }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">创建时间</text>
|
||||
<text class="value">{{ orderDetail.createTime || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">支付方式</text>
|
||||
<text class="value">{{ paymentMethodText }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">支付时间</text>
|
||||
<text class="value">{{ orderDetail.payTime || '未支付' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">收货人</text>
|
||||
<text class="value">{{ receiverInfo }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">收货地址</text>
|
||||
<text class="value address">{{ orderDetail.receiverAddress || '-' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item" v-if="orderDetail.expressageNo">
|
||||
<text class="label">快递单号</text>
|
||||
<text class="value">{{ orderDetail.expressageNo }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item" v-if="orderDetail.remark">
|
||||
<text class="label">备注</text>
|
||||
<text class="value address">{{ orderDetail.remark }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 费用信息 -->
|
||||
<view class="info-section">
|
||||
<view class="section-title">费用信息</view>
|
||||
|
||||
<view class="info-item" v-if="orderDetail.quantity">
|
||||
<text class="label">数量</text>
|
||||
<text class="value">x{{ orderDetail.quantity }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">单价</text>
|
||||
<text class="value">¥ {{ orderDetail.price || orderDetail.totalAmount }}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item total">
|
||||
<text class="label">合计</text>
|
||||
<text class="value highlight">¥ {{ totalAmount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<view class="bottom-actions">
|
||||
<!-- 待付款状态:显示取消订单和立即支付 -->
|
||||
<template v-if="orderDetail.status === 0 || orderDetail.status === '0'">
|
||||
<view class="action-btn secondary" @click="onCancelOrder">
|
||||
取消订单
|
||||
</view>
|
||||
<view class="action-btn primary" @click="onPayNow">
|
||||
立即支付
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 已完成/已取消状态:显示删除订单和再次定制 -->
|
||||
<template v-else-if="orderDetail.status === 3 || orderDetail.status === '3' || orderDetail.status === 4 || orderDetail.status === '4'">
|
||||
<view class="action-btn secondary" @click="onDeleteOrder">
|
||||
删除订单
|
||||
</view>
|
||||
<view class="action-btn primary" @click="onReorder(orderDetail.productId)">
|
||||
再次定制
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 其他状态:显示联系客服和再次定制 -->
|
||||
<template v-else>
|
||||
<view class="action-btn secondary" @click="onContactService">
|
||||
联系客服
|
||||
</view>
|
||||
<view class="action-btn primary" @click="onReorder(orderDetail.productId)">
|
||||
再次定制
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import {
|
||||
queryById,
|
||||
getProductOrderDetail,
|
||||
deleteProductOrder,
|
||||
cancelProductOrder,
|
||||
createWxPayment
|
||||
} from '../../config/api/order.js';
|
||||
// import { getSystemParamByKey } from '../../config/api/system.js';
|
||||
import { useI18n } from '@/utils/i18n.js'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const orderDetail = ref({});
|
||||
const orderId = ref('');
|
||||
const countdownText = ref('');
|
||||
let countdownTimer = null;
|
||||
|
||||
// 订单状态文本
|
||||
const statusText = computed(() => {
|
||||
const status = orderDetail.value.status;
|
||||
if (status === 0 || status === '0') {
|
||||
return '待付款';
|
||||
}
|
||||
if (status === 1 || status === '1') {
|
||||
return '待发货';
|
||||
}
|
||||
if (status === 2 || status === '2') {
|
||||
return '待收货';
|
||||
}
|
||||
if (status === 3 || status === '3') {
|
||||
return '已完成';
|
||||
}
|
||||
if (status === 4 || status === '4') {
|
||||
return '已取消';
|
||||
}
|
||||
if (status === 5 || status === '5') {
|
||||
return '退款中';
|
||||
}
|
||||
return '待付款';
|
||||
});
|
||||
|
||||
// 订单状态颜色
|
||||
const statusColor = computed(() => {
|
||||
const status = orderDetail.value.status;
|
||||
if (status === 0 || status === '0') {
|
||||
return '#ff976a'; // 待付款 - 橙色
|
||||
}
|
||||
if (status === 1 || status === '1') {
|
||||
return '#1989fa'; // 待发货 - 蓝色
|
||||
}
|
||||
if (status === 2 || status === '2') {
|
||||
return '#1989fa'; // 待收货 - 蓝色
|
||||
}
|
||||
if (status === 3 || status === '3') {
|
||||
return '#07c160'; // 已完成 - 绿色
|
||||
}
|
||||
if (status === 4 || status === '4') {
|
||||
return '#999'; // 已取消 - 灰色
|
||||
}
|
||||
if (status === 5 || status === '5') {
|
||||
return '#ff6b6b'; // 退款中 - 红色
|
||||
}
|
||||
return '#ff976a';
|
||||
});
|
||||
|
||||
// 支付方式文本
|
||||
const paymentMethodText = computed(() => {
|
||||
const payWay = orderDetail.value.payWay;
|
||||
if (payWay === 'wx_score_pay') return '微信支付';
|
||||
if (payWay === 'wx_global_pay') return '微信支付';
|
||||
if (payWay === 'wx_member_pay') return '微信支付';
|
||||
return '微信支付';
|
||||
});
|
||||
|
||||
// 收货人信息
|
||||
const receiverInfo = computed(() => {
|
||||
const name = orderDetail.value.receiverName || '-';
|
||||
const phone = orderDetail.value.receiverPhone || '-';
|
||||
return `${name} ${phone}`;
|
||||
});
|
||||
|
||||
// 总金额
|
||||
const totalAmount = computed(() => {
|
||||
return orderDetail.value.totalAmount || orderDetail.value.amount || orderDetail.value.payAmount || '99.0';
|
||||
});
|
||||
|
||||
// 页面加载
|
||||
onLoad(async (options) => {
|
||||
if (options && options.orderId) {
|
||||
orderId.value = options.orderId;
|
||||
await loadOrderDetail();
|
||||
}
|
||||
});
|
||||
|
||||
// 根据订单状态设置页面标题
|
||||
const updatePageTitle = () => {
|
||||
const status = orderDetail.value.status;
|
||||
let title = '订单详情';
|
||||
|
||||
if (status === 0 || status === '0') {
|
||||
title = '待付款';
|
||||
// 如果有倒计时文本,添加到标题中
|
||||
if (countdownText.value) {
|
||||
title = `${title} ${countdownText.value}`;
|
||||
}
|
||||
} else if (status === 1 || status === '1') {
|
||||
title = '待发货';
|
||||
} else if (status === 2 || status === '2') {
|
||||
title = '待收货';
|
||||
} else if (status === 3 || status === '3') {
|
||||
title = '已完成';
|
||||
} else if (status === 4 || status === '4') {
|
||||
title = '已取消';
|
||||
} else if (status === 5 || status === '5') {
|
||||
title = '退款中';
|
||||
}
|
||||
|
||||
uni.setNavigationBarTitle({
|
||||
title: title
|
||||
});
|
||||
};
|
||||
|
||||
// 启动倒计时
|
||||
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 () => {
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
});
|
||||
|
||||
const res = await getProductOrderDetail(orderId.value);
|
||||
|
||||
if (res.code === 200 && res.data) {
|
||||
const data = res.data;
|
||||
orderDetail.value = {
|
||||
// 基础信息
|
||||
id: data.id,
|
||||
orderNo: data.orderNo,
|
||||
outTradeNo: data.outTradeNo,
|
||||
userId: data.userId,
|
||||
|
||||
|
||||
// 状态信息
|
||||
status: data.status,
|
||||
payStatus: data.payStatus,
|
||||
|
||||
// 金额信息
|
||||
totalAmount: data.totalAmount,
|
||||
payAmount: data.payAmount,
|
||||
price: data.price,
|
||||
|
||||
// 时间信息
|
||||
createTime: data.createTime,
|
||||
updateTime: data.updateTime,
|
||||
payTime: data.payTime,
|
||||
expireTime: data.expireTime, // 订单自动取消时间
|
||||
|
||||
// 收货信息
|
||||
receiverName: data.receiverName,
|
||||
receiverPhone: data.receiverPhone,
|
||||
receiverAddress: data.receiverAddress,
|
||||
|
||||
// 物流信息
|
||||
expressageNo: data.expressageNo,
|
||||
|
||||
// 备注
|
||||
remark: data.remark,
|
||||
|
||||
// 商品信息
|
||||
productName: data.productName,
|
||||
optionName: data.optionName,
|
||||
pictureUrl: data.pictureUrl,
|
||||
color: data.color,
|
||||
quantity: data.quantity,
|
||||
productId:data.productId,
|
||||
|
||||
// 兼容旧字段
|
||||
orderId: data.id,
|
||||
deviceId: data.deviceNo || '',
|
||||
deviceName: data.deviceName || '',
|
||||
style: data.optionName || data.style || data.deviceStyle || '',
|
||||
payWay: data.payWay || 'wx_global_pay',
|
||||
phone: data.receiverPhone,
|
||||
address: data.receiverAddress,
|
||||
deposit: data.deposit || '0',
|
||||
package: data.package || '',
|
||||
amount: data.payAmount,
|
||||
productImage: data.pictureUrl || data.productImage || ''
|
||||
};
|
||||
|
||||
// 启动倒计时
|
||||
startCountdown();
|
||||
}
|
||||
|
||||
uni.hideLoading();
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
console.error('加载订单详情失败:', error);
|
||||
uni.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 退款/售后
|
||||
const onRefund = () => {
|
||||
uni.showToast({
|
||||
title: '退款/售后功能开发中',
|
||||
icon: 'none'
|
||||
});
|
||||
};
|
||||
|
||||
// 取消订单
|
||||
const onCancelOrder = () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要取消这个订单吗?',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '取消中...',
|
||||
mask: true
|
||||
});
|
||||
|
||||
const result = await cancelProductOrder(orderDetail.value.id);
|
||||
|
||||
uni.hideLoading();
|
||||
|
||||
if (result && result.code === 200) {
|
||||
uni.showToast({
|
||||
title: '订单已取消',
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
// 重新加载订单详情
|
||||
await loadOrderDetail();
|
||||
} else {
|
||||
throw new Error(result?.msg || '取消失败');
|
||||
}
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
console.error('取消订单失败:', error);
|
||||
uni.showToast({
|
||||
title: error.message || '取消失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 删除订单
|
||||
const onDeleteOrder = () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要删除这个订单吗?',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '删除中...',
|
||||
mask: true
|
||||
});
|
||||
|
||||
const result = await deleteProductOrder(orderDetail.value.id);
|
||||
|
||||
uni.hideLoading();
|
||||
|
||||
if (result && result.code === 200) {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
// 返回订单列表
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
} else {
|
||||
throw new Error(result?.msg || '删除失败');
|
||||
}
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
console.error('删除订单失败:', error);
|
||||
uni.showToast({
|
||||
title: error.message || '删除失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 立即支付
|
||||
const onPayNow = async () => {
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '正在创建支付...',
|
||||
mask: true
|
||||
});
|
||||
|
||||
const res = await createWxPayment(orderDetail.value.orderNo);
|
||||
|
||||
if (res && res.code === 200 && res.data) {
|
||||
uni.hideLoading();
|
||||
|
||||
const payParams = res.data;
|
||||
|
||||
// 调用微信支付
|
||||
uni.requestPayment({
|
||||
timeStamp: payParams.timeStamp,
|
||||
nonceStr: payParams.nonceStr,
|
||||
package: payParams.package,
|
||||
signType: payParams.signType,
|
||||
paySign: payParams.paySign,
|
||||
success: async (payRes) => {
|
||||
console.log('支付成功:', payRes);
|
||||
uni.showToast({
|
||||
title: '支付成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
|
||||
// 重新加载订单详情
|
||||
await loadOrderDetail();
|
||||
},
|
||||
fail: async (err) => {
|
||||
console.error('支付失败:', err);
|
||||
|
||||
// 判断是用户取消还是支付失败
|
||||
if (err.errMsg && err.errMsg.includes('cancel')) {
|
||||
// 用户取消支付,调用取消订单接口
|
||||
try {
|
||||
await cancelProductOrder(orderDetail.value.id);
|
||||
uni.showToast({
|
||||
title: '支付已取消',
|
||||
icon: 'none'
|
||||
});
|
||||
|
||||
// 重新加载订单详情
|
||||
await loadOrderDetail();
|
||||
} catch (cancelError) {
|
||||
console.error('取消订单失败:', cancelError);
|
||||
uni.showToast({
|
||||
title: '支付已取消',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// 支付失败
|
||||
uni.showToast({
|
||||
title: '支付失败,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: res?.msg || '创建支付订单失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('支付异常:', error);
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: error.message || '支付失败,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 联系客服
|
||||
const onContactService = async () => {
|
||||
|
||||
|
||||
const phoneNumber = uni.getStorageSync('customerPhone');
|
||||
|
||||
// 拨打客服电话
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: phoneNumber,
|
||||
success: () => {
|
||||
console.log('拨打电话成功');
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('拨打电话失败:', err);
|
||||
uni.showToast({
|
||||
title: '拨打电话失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
// 再次定制
|
||||
const onReorder = (order) => {
|
||||
if(order){
|
||||
uni.navigateTo({
|
||||
url: `/pages/device/goods?productId=${order}`
|
||||
});
|
||||
}
|
||||
// console.log(order);
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.order-detail-container {
|
||||
min-height: 100vh;
|
||||
background: #f7f8fa;
|
||||
padding-bottom: 120rpx;
|
||||
|
||||
// 状态头部
|
||||
.status-header {
|
||||
background: #fff;
|
||||
padding: 60rpx 0 40rpx;
|
||||
text-align: center;
|
||||
|
||||
.status-icon {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.status-text {
|
||||
font-size: 36rpx;
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
// 产品卡片
|
||||
.product-card {
|
||||
background: #fff;
|
||||
margin: 20rpx;
|
||||
padding: 24rpx;
|
||||
border-radius: 16rpx;
|
||||
display: flex;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||
|
||||
.product-image {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 12rpx;
|
||||
background: #f5f5f5;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.product-info {
|
||||
flex: 1;
|
||||
margin-left: 20rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
.product-name {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.product-style {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.product-price {
|
||||
font-size: 32rpx;
|
||||
color: #07c160;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 信息区块
|
||||
.info-section {
|
||||
background: #fff;
|
||||
margin: 20rpx;
|
||||
padding: 24rpx;
|
||||
border-radius: 16rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 20rpx;
|
||||
font-size: 28rpx;
|
||||
height: 50rpx;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.label {
|
||||
color: #999;
|
||||
flex-shrink: 0;
|
||||
width: 140rpx;
|
||||
}
|
||||
|
||||
.value {
|
||||
color: #333;
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
word-break: break-all;
|
||||
|
||||
&.address {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
&.total {
|
||||
margin-top: 12rpx;
|
||||
padding-top: 20rpx;
|
||||
border-top: 1rpx dashed #e5e5e5;
|
||||
|
||||
.label {
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.value.highlight {
|
||||
color: #07c160;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 底部按钮
|
||||
.bottom-actions {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
padding: 20rpx;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 20rpx;
|
||||
box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||
z-index: 100;
|
||||
|
||||
.action-btn {
|
||||
width: 180rpx;
|
||||
height: 64rpx;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
|
||||
&.secondary {
|
||||
background: #fff;
|
||||
color: #07c160;
|
||||
border: 2rpx solid #07c160;
|
||||
}
|
||||
|
||||
&.primary {
|
||||
background: #07c160;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,796 +0,0 @@
|
||||
<template>
|
||||
<view class="order-container">
|
||||
<!-- 状态切换 -->
|
||||
<view class="status-tabs">
|
||||
<view v-for="(tab, index) in orderStatusTabs" :key="index" class="tab-item"
|
||||
:class="{ active: currentTab === index }" @click="switchTab(index)">
|
||||
{{ tab.text }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单列表 -->
|
||||
<view class="order-list">
|
||||
<view class="empty-state" v-if="orderList.length === 0">
|
||||
<view class="empty-icon">
|
||||
<image src="/static/orderList.png" mode="aspectFill" class="empty-icon"></image>
|
||||
</view>
|
||||
<text class="empty-text">{{ $t('order.noOrderRecord') }}</text>
|
||||
</view>
|
||||
|
||||
<DeviceOrderItemCard
|
||||
v-for="(order, index) in orderList"
|
||||
:key="index"
|
||||
:order="order"
|
||||
@click="navigateToDeviceOrderDetail"
|
||||
@delete="handleDeleteOrder"
|
||||
@pay="handlePayment"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
onUnmounted
|
||||
} from 'vue';
|
||||
import DeviceOrderItemCard from '../../components/DeviceOrderItemCard.vue';
|
||||
import {
|
||||
onLoad,
|
||||
onShow
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
getOrderList,
|
||||
getProductOrderList,
|
||||
queryById,
|
||||
getOrderByOrderNoScorePayStatus,
|
||||
cancelOrder,
|
||||
createWxPayment,
|
||||
deleteProductOrder,
|
||||
cancelProductOrder,
|
||||
} from '../../config/api/order.js';
|
||||
import{
|
||||
createProductOrder
|
||||
}from "@/config/api/product.js"
|
||||
import {
|
||||
updateUserBalance
|
||||
} from '../../config/api/user.js';
|
||||
import {
|
||||
URL
|
||||
} from '../../config/url.js';
|
||||
import { useI18n } from '@/utils/i18n.js'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
// 初始化状态
|
||||
const currentTab = ref(0);
|
||||
const orderList = ref([]);
|
||||
|
||||
// 订单状态映射
|
||||
const orderStatusMap = reactive({
|
||||
'0': {
|
||||
text: '待付款',
|
||||
class: 'status-waiting'
|
||||
},
|
||||
'1': {
|
||||
text: '待发货',
|
||||
class: 'status-shipping'
|
||||
},
|
||||
'2': {
|
||||
text: '待收货',
|
||||
class: 'status-receiving'
|
||||
},
|
||||
'3': {
|
||||
text: '已完成',
|
||||
class: 'status-finished'
|
||||
},
|
||||
'4': {
|
||||
text: '已取消',
|
||||
class: 'status-cancelled'
|
||||
},
|
||||
'5': {
|
||||
text: '退款中',
|
||||
class: 'status-refunding'
|
||||
}
|
||||
});
|
||||
|
||||
// 订单状态标签
|
||||
const orderStatusTabs = reactive([
|
||||
{
|
||||
text: '全部',
|
||||
status: []
|
||||
},
|
||||
{
|
||||
text: '待付款',
|
||||
status: [0]
|
||||
},
|
||||
{
|
||||
text: '待发货',
|
||||
status: [1]
|
||||
},
|
||||
{
|
||||
text: '待收货',
|
||||
status: [2]
|
||||
},
|
||||
{
|
||||
text: '已完成',
|
||||
status: [3]
|
||||
},
|
||||
{
|
||||
text: '已取消',
|
||||
status: [4]
|
||||
},
|
||||
// {
|
||||
// text: '退款中',
|
||||
// status: [5]
|
||||
// }
|
||||
]);
|
||||
|
||||
// 页面加载
|
||||
onLoad(async (options) => {
|
||||
// 如果有传入orderId参数,说明是从设备租借页面跳转过来的
|
||||
if (options && options.orderId) {
|
||||
try {
|
||||
// 获取特定订单信息
|
||||
const res = await queryById(options.orderId);
|
||||
if (res.code === 200 && res.data) {
|
||||
// 获取到的订单数据
|
||||
const orderData = res.data;
|
||||
|
||||
// 使用实际的startTime字段,如果没有则尝试使用createTime
|
||||
const orderStartTime = orderData.startTime || orderData.createTime || '';
|
||||
|
||||
// 格式化订单数据
|
||||
const formattedOrder = {
|
||||
orderNo: orderData.orderId,
|
||||
status: orderData.orderStatus,
|
||||
deviceId: orderData.deviceNo,
|
||||
payWay: orderData.payWay,
|
||||
startTime: orderStartTime,
|
||||
endTime: orderData.endTime || '',
|
||||
positionName: orderData.positionName || orderData.positionLocation || '',
|
||||
deviceName: orderData.deviceName || '',
|
||||
amount: orderData.payAmount || orderData.actualDeviceAmount || orderData.currentFee || orderData.residueAmount || '0.00'
|
||||
};
|
||||
|
||||
// 将订单添加到列表开头
|
||||
orderList.value = [formattedOrder, ...orderList.value];
|
||||
|
||||
// 根据订单状态切换到对应标签
|
||||
const tabIndex = orderStatusTabs.findIndex(tab =>
|
||||
tab.status.includes(orderData.orderStatus)
|
||||
);
|
||||
|
||||
if (tabIndex !== -1) {
|
||||
switchTab(tabIndex);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取订单详情失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取订单列表
|
||||
await loadOrderList();
|
||||
});
|
||||
|
||||
// 页面显示时刷新订单列表
|
||||
onShow(async () => {
|
||||
// 根据当前选中的标签刷新对应状态的订单
|
||||
const statusArray = orderStatusTabs[currentTab.value].status;
|
||||
const statusValue = statusArray.length === 0 ? undefined : statusArray[0];
|
||||
await loadOrderList(statusValue);
|
||||
});
|
||||
|
||||
// 切换标签
|
||||
const switchTab = async (index) => {
|
||||
currentTab.value = index;
|
||||
// 根据状态获取订单列表
|
||||
const statusArray = orderStatusTabs[index].status;
|
||||
// 如果是全部,传undefined;否则传第一个数字状态值
|
||||
const statusValue = statusArray.length === 0 ? undefined : statusArray[0];
|
||||
await loadOrderList(statusValue);
|
||||
};
|
||||
|
||||
// 加载订单列表
|
||||
const loadOrderList = async (statusList) => {
|
||||
try {
|
||||
let params = {};
|
||||
if(statusList !== undefined){
|
||||
params = {
|
||||
status: statusList
|
||||
}
|
||||
}
|
||||
const res = await getProductOrderList(params);
|
||||
|
||||
// 根据实际接口返回结构处理数据
|
||||
if (res.code === 200 && res.data) {
|
||||
// 支持两种数据结构:res.data.rows 或 res.data.records
|
||||
const dataList = res.data.rows || res.data.records || [];
|
||||
|
||||
// 处理订单列表数据
|
||||
orderList.value = dataList.map(item => {
|
||||
return {
|
||||
// 基础信息
|
||||
id: item.id,
|
||||
orderNo: item.orderNo,
|
||||
orderId: item.id,
|
||||
userId: item.userId,
|
||||
|
||||
// 状态信息
|
||||
status: item.status,
|
||||
orderStatus: item.status,
|
||||
payStatus: item.payStatus,
|
||||
|
||||
// 金额信息
|
||||
totalAmount: item.totalAmount,
|
||||
payAmount: item.payAmount,
|
||||
price: item.price,
|
||||
|
||||
// 时间信息
|
||||
createTime: item.createTime,
|
||||
payTime: item.payTime,
|
||||
|
||||
// 收货信息
|
||||
receiverName: item.receiverName,
|
||||
receiverPhone: item.receiverPhone,
|
||||
receiverAddress: item.receiverAddress,
|
||||
|
||||
// 物流信息
|
||||
expressageNo: item.expressageNo,
|
||||
|
||||
// 备注
|
||||
remark: item.remark,
|
||||
|
||||
// 商品信息
|
||||
productName: item.productName,
|
||||
optionName: item.optionName,
|
||||
pictureUrl: item.pictureUrl,
|
||||
color: item.color,
|
||||
quantity: item.quantity,
|
||||
|
||||
// 兼容旧字段
|
||||
deviceId: item.deviceNo || '',
|
||||
deviceName: item.productName || item.deviceName || '',
|
||||
productImage: item.pictureUrl || '',
|
||||
style: item.optionName || item.style || item.deviceStyle || '',
|
||||
payWay: item.payWay || '',
|
||||
startTime: item.createTime || item.startTime || '',
|
||||
endTime: item.endTime || '',
|
||||
positionName: item.positionName || item.positionLocation || '',
|
||||
amount: item.payAmount || item.totalAmount || '0.00'
|
||||
};
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取订单列表失败:', error);
|
||||
uni.showToast({
|
||||
title: t('order.getOrderListFailed'),
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 处理订单完成事件
|
||||
const handleOrderCompleted = (orderData) => {
|
||||
console.log('订单列表页收到订单完成事件:', orderData)
|
||||
// 刷新订单列表,根据当前选中的标签刷新对应状态的订单
|
||||
const statusArray = orderStatusTabs[currentTab.value].status
|
||||
const statusValue = statusArray.length === 0 ? undefined : statusArray[0]
|
||||
loadOrderList(statusValue)
|
||||
}
|
||||
|
||||
// 设置页面标题并监听订单完成事件
|
||||
onMounted(() => {
|
||||
uni.setNavigationBarTitle({
|
||||
title: t('order.myDeviceOrders')
|
||||
})
|
||||
|
||||
// 监听订单完成事件
|
||||
uni.$on('orderCompleted', handleOrderCompleted)
|
||||
})
|
||||
|
||||
// 页面卸载时移除事件监听
|
||||
onUnmounted(() => {
|
||||
uni.$off('orderCompleted', handleOrderCompleted)
|
||||
})
|
||||
|
||||
// 同步订单状态
|
||||
const getOrderStatus = async (order) => {
|
||||
try {
|
||||
const res = await getOrderByOrderNoScorePayStatus(order.orderNo);
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: t('order.syncSuccess'),
|
||||
icon: 'success'
|
||||
});
|
||||
const statusArray = orderStatusTabs[currentTab.value].status;
|
||||
const statusValue = statusArray.length === 0 ? undefined : statusArray[0];
|
||||
await loadOrderList(statusValue);
|
||||
}
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
title: t('order.syncFailed'),
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 跳转到订单详情页面(统一入口)
|
||||
const navigateToOrderDetail = (order) => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/order/detail?orderId=${order.orderId || order.orderNo}&deviceId=${order.deviceId}`
|
||||
});
|
||||
};
|
||||
|
||||
// 组件事件:归还设备(实际跳转到订单详情页)
|
||||
const onReturnDevice = (order) => {
|
||||
navigateToOrderDetail(order);
|
||||
};
|
||||
|
||||
// 跳转到订单详情页
|
||||
const navigateToDetails = (order) => {
|
||||
navigateToOrderDetail(order);
|
||||
};
|
||||
|
||||
// 立即支付
|
||||
const handlePayment = async (order) => {
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '正在创建支付...',
|
||||
mask: true
|
||||
});
|
||||
console.log(order);
|
||||
|
||||
// 调用后端创建微信支付订单接口(使用订单号)
|
||||
// const res = await createWxPayment(order.orderNo);
|
||||
const res = await createProductOrder({orderNo:order.orderNo});
|
||||
|
||||
if (res && res.code === 200 && res.data) {
|
||||
uni.hideLoading();
|
||||
|
||||
const payParams = res.data;
|
||||
|
||||
// 调用微信支付
|
||||
uni.requestPayment({
|
||||
timeStamp: payParams.timeStamp,
|
||||
nonceStr: payParams.nonceStr,
|
||||
package: payParams.package,
|
||||
signType: payParams.signType,
|
||||
paySign: payParams.paySign,
|
||||
success: async (payRes) => {
|
||||
console.log('支付成功:', payRes);
|
||||
uni.showToast({
|
||||
title: '支付成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
|
||||
// 刷新订单列表
|
||||
const statusArray = orderStatusTabs[currentTab.value].status;
|
||||
const statusValue = statusArray.length === 0 ? undefined : statusArray[0];
|
||||
await loadOrderList(statusValue);
|
||||
},
|
||||
fail: async (err) => {
|
||||
console.error('支付失败:', err);
|
||||
|
||||
// 判断是用户取消还是支付失败
|
||||
if (err.errMsg && err.errMsg.includes('cancel')) {
|
||||
// 用户取消支付,调用取消订单接口
|
||||
try {
|
||||
// await cancelProductOrder(order.id || order.orderId);
|
||||
// uni.showToast({
|
||||
// title: '支付已取消',
|
||||
// icon: 'none'
|
||||
// });
|
||||
|
||||
// 刷新订单列表
|
||||
const statusArray = orderStatusTabs[currentTab.value].status;
|
||||
const statusValue = statusArray.length === 0 ? undefined : statusArray[0];
|
||||
await loadOrderList(statusValue);
|
||||
} catch (cancelError) {
|
||||
console.error('取消订单失败:', cancelError);
|
||||
uni.showToast({
|
||||
title: '支付已取消',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// 支付失败
|
||||
uni.showToast({
|
||||
title: '支付失败,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: res?.msg || '创建支付订单失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('支付异常:', error);
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: error.message || '支付失败,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 取消订单
|
||||
const handleCancelOrder = async (order) => {
|
||||
try {
|
||||
uni.showModal({
|
||||
title: t('order.confirmCancel'),
|
||||
content: t('order.confirmCancelContent'),
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showLoading({
|
||||
title: t('common.processing')
|
||||
});
|
||||
|
||||
const result = await cancelOrder({
|
||||
orderId: order.orderNo
|
||||
});
|
||||
|
||||
if (result) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: t('order.cancelSuccess'),
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
// 刷新订单列表
|
||||
await loadOrderList();
|
||||
} else {
|
||||
throw new Error(result.msg || t('order.cancelFailed'));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: error.message || t('order.cancelFailed'),
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 跳转到设备订单详情页
|
||||
const navigateToDeviceOrderDetail = (order) => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/device/orderDetail?orderId=${order.orderId || order.orderNo}`
|
||||
});
|
||||
};
|
||||
|
||||
// 处理删除订单
|
||||
const handleDeleteOrder = (order) => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要删除这个订单吗?',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '删除中...',
|
||||
mask: true
|
||||
});
|
||||
|
||||
// 调用删除订单接口
|
||||
const result = await deleteProductOrder(order.id || order.orderId);
|
||||
|
||||
uni.hideLoading();
|
||||
|
||||
if (result && result.code === 200) {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
// 刷新订单列表
|
||||
const statusArray = orderStatusTabs[currentTab.value].status;
|
||||
const statusValue = statusArray.length === 0 ? undefined : statusArray[0];
|
||||
await loadOrderList(statusValue);
|
||||
} else {
|
||||
throw new Error(result?.msg || '删除失败');
|
||||
}
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
console.error('删除订单失败:', error);
|
||||
uni.showToast({
|
||||
title: error.message || '删除失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.order-container {
|
||||
min-height: 100vh;
|
||||
background: #f7f8fa;
|
||||
padding-bottom: 30rpx;
|
||||
|
||||
// 状态标签栏
|
||||
.status-tabs {
|
||||
display: flex;
|
||||
background: #fff;
|
||||
padding: 0 20rpx;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
height: 90rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
position: relative;
|
||||
|
||||
&.active {
|
||||
color: #07c160;
|
||||
font-weight: 500;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 40rpx;
|
||||
height: 4rpx;
|
||||
background: #07c160;
|
||||
border-radius: 2rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 订单列表
|
||||
.order-list {
|
||||
padding: 20rpx;
|
||||
|
||||
// 订单项
|
||||
.order-item {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 20rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||
|
||||
// 订单头部
|
||||
.order-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 24rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
.order-id {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.order-status {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
|
||||
&.status-waiting {
|
||||
color: #FF9800;
|
||||
}
|
||||
|
||||
&.status-shipping {
|
||||
color: #1989fa;
|
||||
}
|
||||
|
||||
&.status-receiving {
|
||||
color: #1989fa;
|
||||
}
|
||||
|
||||
&.status-finished {
|
||||
color: #07c160;
|
||||
}
|
||||
|
||||
&.status-cancelled {
|
||||
color: #9E9E9E;
|
||||
}
|
||||
|
||||
&.status-refunding {
|
||||
color: #ff6b6b;
|
||||
}
|
||||
|
||||
&.status-express-return {
|
||||
color: #FF9800;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 订单内容
|
||||
.order-body {
|
||||
padding: 24rpx;
|
||||
|
||||
.device-info {
|
||||
margin-bottom: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
|
||||
.device-left {
|
||||
flex: 1;
|
||||
margin-right: 20rpx;
|
||||
|
||||
.device-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.device-id {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.device-right {
|
||||
|
||||
// 支付分标识
|
||||
.payment-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 6rpx 12rpx;
|
||||
border-radius: 8rpx;
|
||||
white-space: nowrap;
|
||||
|
||||
&.wx-score {
|
||||
background: rgba(7, 193, 96, 0.08);
|
||||
|
||||
.badge-icon {
|
||||
width: 32rpx;
|
||||
height: 26rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.badge-text {
|
||||
font-size: 22rpx;
|
||||
color: #07c160;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.divider {
|
||||
margin: 0 6rpx;
|
||||
}
|
||||
|
||||
.highlight {
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.member {
|
||||
background: rgba(25, 118, 210, 0.08);
|
||||
|
||||
.badge-text {
|
||||
font-size: 22rpx;
|
||||
color: #1976D2;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
&.deposit {
|
||||
background: #f5f5f5;
|
||||
|
||||
.badge-text {
|
||||
font-size: 22rpx;
|
||||
color: #666;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.order-times {
|
||||
.time-row {
|
||||
display: flex;
|
||||
font-size: 26rpx;
|
||||
margin-bottom: 8rpx;
|
||||
|
||||
.time-label {
|
||||
color: #999;
|
||||
width: 140rpx;
|
||||
}
|
||||
|
||||
.time-value {
|
||||
color: #333;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 订单底部
|
||||
.order-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20rpx 24rpx;
|
||||
background: #fafafa;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
|
||||
.price {
|
||||
font-size: 34rpx;
|
||||
font-weight: 500;
|
||||
color: #ff6b6b;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
|
||||
.action-item {
|
||||
font-size: 26rpx;
|
||||
padding: 10rpx 30rpx;
|
||||
border-radius: 30rpx;
|
||||
margin-left: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 10rpx;
|
||||
|
||||
&.primary {
|
||||
background: #07c160;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&.secondary {
|
||||
background: #f5f5f5;
|
||||
color: #666;
|
||||
border: 1rpx solid #e0e0e0;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 空状态
|
||||
.empty-state {
|
||||
padding: 100rpx 0;
|
||||
text-align: center;
|
||||
|
||||
.empty-icon {
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
margin: 0 auto 30rpx;
|
||||
background: #f5f5f5;
|
||||
// border-radius: 50%;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user