attractions-orderList.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <script setup lang="ts">
  2. import router from '@/router'
  3. const props = defineProps<{
  4. order: Api.xsbOrderList
  5. }>()
  6. // 订单状态映射(hbOrderStatus)
  7. const statusMap: Record<number, { text: string, color: string }> = {
  8. 0: { text: '待支付', color: '#FF9500' },
  9. 60: { text: '已取消', color: '#999999' },
  10. 70: { text: '已支付', color: '#52C41A' },
  11. 80: { text: '已完成', color: '#52C41A' },
  12. }
  13. // 订单项点击
  14. function handleOrderClick(order: Api.ScenicOrderListVo | Api.xsbOrderList) {
  15. router.push({ name: 'attractions-order-detail', params: { orderNo: String(order.orderNumber) } })
  16. }
  17. const statusInfo = computed(() => {
  18. const status = props.order?.hbOrderStatus as number
  19. return statusMap[status] ?? { text: '', color: '#999999' }
  20. })
  21. </script>
  22. <template>
  23. <view class="mb-20rpx box-border w-full overflow-hidden rounded-16rpx bg-#FFF p-24rpx" @click="handleOrderClick(order)">
  24. <view class="w-full flex items-center justify-between">
  25. <view class="text-32rpx font-bold">
  26. {{ order?.orderScenic.viewName }}
  27. </view>
  28. <view class="text-28rpx" :style="{ color: statusInfo.color }">
  29. {{ statusInfo.text }}
  30. </view>
  31. </view>
  32. <view class="mt-20rpx w-full flex items-center gap-20rpx">
  33. <image v-if="order?.orderScenic.img" :src="order?.orderScenic.img" class="h-160rpx w-160rpx flex-shrink-0 rounded-8rpx" mode="aspectFill" />
  34. <view v-else class="h-160rpx w-160rpx flex flex-shrink-0 items-center justify-center rounded-8rpx bg-#f5f5f5 text-#999">
  35. 暂无图片
  36. </view>
  37. <view class="min-w-0 flex-1">
  38. <view class="line-clamp-2 text-28rpx font-bold">
  39. {{ order?.orderScenic.productName }}
  40. </view>
  41. <view class="mt-20rpx text-24rpx text-#666">
  42. 游玩日期:{{ order?.orderScenic.travelDate }}
  43. </view>
  44. </view>
  45. </view>
  46. <view class="mt-24rpx flex items-center justify-between text-24rpx text-#999">
  47. <view>订单编号:{{ order?.orderNumber }}</view>
  48. <view>共{{ order?.orderScenic.num }}件商品</view>
  49. </view>
  50. <view class="mt-20rpx flex items-center justify-between">
  51. <view class="text-24rpx text-#999">
  52. 下单时间:{{ order?.createTime }}
  53. </view>
  54. <view>
  55. <text class="text-24rpx">
  56. 合计:
  57. </text>
  58. <text class="text-26rpx text-#FF4A39 font-bold">
  59. </text>
  60. <text class="text-bold text-32rpx text-#FF4A39">
  61. {{ order?.total }}
  62. </text>
  63. </view>
  64. </view>
  65. </view>
  66. </template>
  67. <style lang="scss" scoped></style>