order.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view>
  3. <van-tabs :active="active" @change="onChange" animated>
  4. <van-tab title="近7日订单">
  5. <view class="order-item" v-for="(item,index) in orderList" :key='item' @click="goPage('/pages/cinema/orderdes')">
  6. <image class="img" :src="item.goodsPictureUrl"
  7. 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. </van-tab>
  17. <van-tab title="历史订单">
  18. <view class="order-item" v-for="(item,index) in 3" :key='item' @click="goPage('/pages/cinema/orderdes')">
  19. <image class="img" src="https://t1-1305573081.cos.ap-shanghai.myqcloud.com/wxapp/static/imgs/%E7%94%B5%E5%BD%B1%E5%9B%BE.png"
  20. mode="widthFix"></image>
  21. <view class="des-box">
  22. <text>订单名称:指环王</text>
  23. <text>订单日期:2021年02月20日</text>
  24. <text>订单数量:2</text>
  25. <text>订单价格:79.9</text>
  26. </view>
  27. <van-icon class='icon' name="arrow" />
  28. </view>
  29. </van-tab>
  30. </van-tabs>
  31. </view>
  32. </template>
  33. <script>
  34. import { getOrderList } from '@/api/order.js'
  35. export default {
  36. data: () => ({
  37. active: 0,
  38. orderList:{}
  39. }),
  40. mounted() {
  41. this.init()
  42. },
  43. methods:{
  44. async init(){
  45. let orderListRes =await getOrderList()
  46. console.log(orderListRes)
  47. orderListRes.rows.map(val=>{
  48. val.orderDataJson=JSON.parse(val.orderDataJson)
  49. return val
  50. })
  51. this.orderList=orderListRes.rows
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss">
  57. .order-item {
  58. background-color: #FFFFFF;
  59. margin-top: 10rpx;
  60. padding: 30rpx;
  61. display: flex;
  62. justify-content: flex-start;
  63. align-items: stretch;
  64. position: relative;
  65. &:nth-child(1){
  66. margin-top: 20rpx;
  67. }
  68. .img {
  69. width: 112rpx;
  70. height: 156rpx;
  71. margin-right: 50rpx;
  72. }
  73. .des-box{
  74. display: flex;
  75. flex-direction: column;
  76. justify-content: space-between;
  77. text{
  78. font-size: 26rpx;
  79. font-weight: 400;
  80. color: #666666;
  81. }
  82. text:nth-child(2){
  83. color: #0F0404 !important;
  84. }
  85. }
  86. .icon{
  87. position: absolute;
  88. right: 30rpx;
  89. top: 50%;
  90. transform: translateY(-50%);
  91. }
  92. }
  93. </style>