order.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. import {
  40. orderQuery
  41. } from '@/api/cinema.js'
  42. export default {
  43. data: () => ({
  44. active: 0,
  45. orderLoading: true,
  46. orderLoading2: true,
  47. orderList: {},
  48. orderList2: {}
  49. }),
  50. mounted() {
  51. this.init()
  52. this.init2()
  53. orderQuery({
  54. thirdOrderId: '12021053117040103901269463601171'
  55. })
  56. },
  57. methods: {
  58. async init() {
  59. let orderListRes = await getOrderList({
  60. days: 7,
  61. pageNum: 1,
  62. pageSize: 10
  63. })
  64. orderListRes.rows.map(val => {
  65. val.orderDataJson = JSON.parse(val.orderDataJson)
  66. return val
  67. })
  68. this.orderList = orderListRes.rows
  69. this.orderLoading = false
  70. },
  71. async init2() {
  72. let orderListRes = await getOrderList({
  73. pageNum: 1,
  74. pageSize: 10
  75. })
  76. orderListRes.rows.map(val => {
  77. val.orderDataJson = JSON.parse(val.orderDataJson)
  78. return val
  79. })
  80. this.orderList2 = orderListRes.rows
  81. this.orderLoading2 = false
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss">
  87. .ios-bottom{
  88. padding-bottom: calc(10px + env(safe-area-inset-bottom)/2);
  89. }
  90. .order-item {
  91. background-color: #FFFFFF;
  92. margin-top: 10rpx;
  93. padding: 30rpx;
  94. display: flex;
  95. justify-content: flex-start;
  96. align-items: stretch;
  97. position: relative;
  98. &:nth-child(1) {
  99. margin-top: 20rpx;
  100. }
  101. .img {
  102. width: 112rpx;
  103. height: 156rpx;
  104. margin-right: 50rpx;
  105. }
  106. .des-box {
  107. display: flex;
  108. flex-direction: column;
  109. justify-content: space-between;
  110. text {
  111. font-size: 26rpx;
  112. font-weight: 400;
  113. color: #666666;
  114. }
  115. text:nth-child(2) {
  116. color: #0F0404 !important;
  117. }
  118. }
  119. .icon {
  120. position: absolute;
  121. right: 30rpx;
  122. top: 50%;
  123. transform: translateY(-50%);
  124. }
  125. }
  126. </style>