order.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view>
  3. <van-tabs :active="active" @change="onChange" animated sticky>
  4. <van-tab title="近7日订单">
  5. <loadSke :loading='orderLoading'>
  6. <view class="order-item" v-for="(item,index) in orderList" :key='item' @click="goPage(`/pages/cinema/orderdes?outTradeNo=${item.outTradeNo}`)">
  7. <image class="img" :src="item.goodsPictureUrl" mode="widthFix"></image>
  8. <view class="des-box">
  9. <text>订单名称:{{item.orderDataJson.cinemaData.filmName}}</text>
  10. <text>订单日期:{{item.createTime}}</text>
  11. <text> </text>
  12. <text>订单价格:{{item.total/100}}</text>
  13. </view>
  14. <van-icon class='icon' name="arrow" />
  15. </view>
  16. </loadSke>
  17. </van-tab>
  18. <van-tab title="历史订单">
  19. <loadSke :loading='orderLoading2'>
  20. <view class="order-item ios-bottom" v-for="(item,index) in orderList2" :key='item' @click="goPage(`/pages/cinema/orderdes?outTradeNo=${item.outTradeNo}`)">
  21. <image class="img" :src="item.goodsPictureUrl" mode="widthFix"></image>
  22. <view class="des-box">
  23. <text>订单名称:{{item.orderDataJson.cinemaData.filmName}}</text>
  24. <text>订单日期:{{item.createTime}}</text>
  25. <text> </text>
  26. <text>订单价格:{{item.total/100}}</text>
  27. </view>
  28. <van-icon class='icon' name="arrow" />
  29. </view>
  30. </loadSke>
  31. </van-tab>
  32. </van-tabs>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. getOrderList
  38. } from '@/api/order.js'
  39. export default {
  40. data: () => ({
  41. active: 0,
  42. orderLoading: true,
  43. orderLoading2: true,
  44. orderList: {},
  45. orderList2: {}
  46. }),
  47. mounted() {
  48. this.init()
  49. this.init2()
  50. },
  51. methods: {
  52. async init() {
  53. let orderListRes = await getOrderList({
  54. days: 7,
  55. pageNum: 1,
  56. pageSize: 10
  57. })
  58. orderListRes.rows.map(val => {
  59. val.orderDataJson = JSON.parse(val.orderDataJson)
  60. return val
  61. })
  62. this.orderList = orderListRes.rows
  63. this.orderLoading = false
  64. },
  65. async init2() {
  66. let orderListRes = await getOrderList({
  67. pageNum: 1,
  68. pageSize: 10
  69. })
  70. orderListRes.rows.map(val => {
  71. val.orderDataJson = JSON.parse(val.orderDataJson)
  72. return val
  73. })
  74. this.orderList2 = orderListRes.rows
  75. this.orderLoading2 = false
  76. }
  77. }
  78. }
  79. </script>
  80. <style lang="scss">
  81. .ios-bottom{
  82. padding-bottom: calc(10px + env(safe-area-inset-bottom)/2);
  83. }
  84. .order-item {
  85. background-color: #FFFFFF;
  86. margin-top: 10rpx;
  87. padding: 30rpx;
  88. display: flex;
  89. justify-content: flex-start;
  90. align-items: stretch;
  91. position: relative;
  92. &:nth-child(1) {
  93. margin-top: 20rpx;
  94. }
  95. .img {
  96. width: 112rpx;
  97. height: 156rpx;
  98. margin-right: 50rpx;
  99. }
  100. .des-box {
  101. display: flex;
  102. flex-direction: column;
  103. justify-content: space-between;
  104. text {
  105. font-size: 26rpx;
  106. font-weight: 400;
  107. color: #666666;
  108. }
  109. text:nth-child(2) {
  110. color: #0F0404 !important;
  111. }
  112. }
  113. .icon {
  114. position: absolute;
  115. right: 30rpx;
  116. top: 50%;
  117. transform: translateY(-50%);
  118. }
  119. }
  120. </style>