更新:增加订单详情功能

This commit is contained in:
2025-11-28 18:03:13 +08:00
parent 0e7952ac4e
commit bdf1b41098
13 changed files with 392 additions and 55 deletions

View File

@@ -3,14 +3,14 @@
<template #top>
<!-- 自定义导航栏 -->
<nav-bar :title="$t('user.myOrders')"></nav-bar>
<wd-tabs v-model="orderStatus" @change="handleOrderStatusTabChange">
<!-- <wd-tabs v-model="orderStatus" @change="handleOrderStatusTabChange">
<wd-tab v-for="item in ordersTabs" :key="item.value" :title="item.name" :name="item.value"></wd-tab>
</wd-tabs>
</wd-tabs> -->
</template>
<!-- 订单列表 -->
<view class="order-list">
<wd-card v-for="order in orderList" :key="order.id" type="rectangle" custom-class="order-item">
<wd-card v-for="order in orderList" :key="order.id" type="rectangle" custom-class="order-item" @click="toDetails(order)">
<template #title>
<view class="order-item-title">
<view class="order-item-sn">
@@ -23,8 +23,7 @@
</template>
<!-- 三种订单类型商品信息 -->
<ProductInfo v-if="order.orderType === 'order'" :data="order.productList" :type="order.orderType" />
<ProductInfo v-if="order.orderType === 'abroadBook'" :data="order.bookEntity" :type="order.orderType" />
<ProductInfo v-if="order.orderType === 'order'" :data="order.productList[0].product" :type="order.orderType" />
<ProductInfo v-if="order.orderType === 'vip'" :data="order.vipBuyConfigEntity" :type="order.orderType" />
<ProductInfo v-if="order.orderType === 'abroadVip'" :data="order.ebookvipBuyConfig" :type="order.orderType" />
<!-- 三种订单类型商品信息 end -->
@@ -48,12 +47,16 @@ import type { IOrder } from '@/types/order'
import { useI18n } from 'vue-i18n'
import { copyToClipboard } from '@/utils/index'
import ProductInfo from '@/components/order/ProductInfo.vue'
import { useSysStore } from '@/stores/sys'
const { t } = useI18n()
const paging = ref<any>(null)
// 订单状态映射
const orderStatusMap = useSysStore().orderStatusMap
// 订单状态
const orderStatus = ref<string>('-1')
const orderStatus = ref<string>('3')
const ordersTabs = [
{
name: "全部",
@@ -72,12 +75,6 @@ const ordersTabs = [
},
]
// 订单状态映射
const orderStatusMap = {
'0': '待付款',
'3': '已完成',
}
/**
* 处理订单状态切换
*/
@@ -122,22 +119,17 @@ const getOrderImage = (order: IOrder) => {
}
}
const getOrderTitle = (order: IOrder) => {
switch (order.orderType) {
case 'order':
return order.productList[0]?.product?.productName || ''
case 'abroadBook':
return order.bookEntity?.name || ''
case 'vip':
return order.vipBuyConfigEntity?.title || ''
case 'point':
return ''
default:
return ''
}
/**
* 跳转订单详情
*/
const toDetails = (order: IOrder) => {
uni.navigateTo({
url: '/pages/user/order/details?orderId=' + order.orderId
})
}
</script>
<style lang="scss" scoped>