index.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <script setup name="order">
  2. import Container from "@/components/Container/Container.vue";
  3. import { request } from "@/utils/request";
  4. import { ref, onMounted } from "vue";
  5. import utils from "@/utils/common";
  6. const orderList = ref([]);
  7. onMounted(async () => {
  8. const res = await request("api/question_bank/question_reception/orders/list");
  9. orderList.value = res.data;
  10. });
  11. </script>
  12. <template>
  13. <Container
  14. title="订单记录"
  15. bgColor="#f8f8f8"
  16. :empty="!orderList.length"
  17. headerColor="#fff"
  18. text="暂无订单记录"
  19. >
  20. <view class="Container">
  21. <view class="card" v-for="item in orderList" :key="item.id">
  22. <view class="left">
  23. <view class="name">{{ item.name }}</view>
  24. <view
  25. >有效期: {{ utils.timestampToString(item.start_time_validity) }}至{{
  26. utils.timestampToString(item.end_time_validity)
  27. }}</view
  28. >
  29. <view>订单号: {{ item.order_sn }}</view>
  30. <view
  31. >创建订单时间: {{ utils.timestampToString(item.insert_time) }}</view
  32. >
  33. </view>
  34. <view class="right">
  35. <view class="price"
  36. >¥{{ item.order_preferential_price?.toFixed?.(1) }}</view
  37. >
  38. <view class="line">{{ item.order_original_price?.toFixed?.(1) }}</view>
  39. </view>
  40. </view>
  41. </view>
  42. </Container>
  43. </template>
  44. <style scoped lang="scss">
  45. @import "@/uni.scss";
  46. .Container {
  47. display: flex;
  48. flex-direction: column;
  49. gap: 16rpx;
  50. .card {
  51. background-color: #fff;
  52. padding: 24rpx 16rpx;
  53. border-radius: 16rpx;
  54. display: flex;
  55. justify-content: space-between;
  56. border-radius: 16rpx;
  57. font-family: PingFang SC, PingFang SC;
  58. font-weight: 500;
  59. font-size: 28rpx;
  60. .left {
  61. display: flex;
  62. flex-direction: column;
  63. gap: 8rpx;
  64. color: #666666;
  65. .name {
  66. color: $primary;
  67. }
  68. }
  69. .right {
  70. .price {
  71. color: $error;
  72. }
  73. .line {
  74. color: #999;
  75. text-decoration: line-through;
  76. }
  77. }
  78. }
  79. }
  80. </style>