order-item.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="order-item" @click="goToDetail">
  3. <!-- 订单头部 -->
  4. <view class="order-header">
  5. <text class="common-text-2 font-30">卖书编号:{{ order.orderId }}</text>
  6. <text v-if="order.cancelStatus == 1 || order.status == -1" class="order-status" style="color: #FF000C">已取消</text>
  7. <text v-else class="order-status" style="color: #FF000C">{{ statusText }}</text>
  8. </view>
  9. <!-- 书籍列表 - 改为横向滚动 -->
  10. <scroll-view scroll-x class="book-scroll" :show-scrollbar="false" enhanced>
  11. <view class="book-list">
  12. <image v-for="(book, index) in order.detailCoverList" :key="index" :src="book" class="book-cover"
  13. mode="aspectFill" />
  14. </view>
  15. </scroll-view>
  16. <!-- 订单信息 -->
  17. <view class="flex-a flex-j-b mb-20">
  18. <text class="common-text" v-if="order.orderTime">提交时间:{{ order.orderTime || '-' }}</text>
  19. <text class="common-title">共{{ order.totalNum || order.canRefundNum }}本</text>
  20. </view>
  21. <!-- 底部按钮 -->
  22. <order-actions :order="order" :status="order.status" @action="handleAction" @success="handleSuccess" />
  23. </view>
  24. </template>
  25. <script>
  26. import OrderActions from '@/pages-mine/components/order-actions.vue'
  27. export default {
  28. name: 'order-item',
  29. components: {
  30. OrderActions
  31. },
  32. props: {
  33. order: {
  34. type: Object,
  35. required: true
  36. },
  37. isReturn: {
  38. type: Boolean,
  39. default: false
  40. }
  41. },
  42. computed: {
  43. statusText() {
  44. console.log(this.order.status, 'status')
  45. return this.statusTextMap[this.order.status]
  46. }
  47. },
  48. data() {
  49. return {
  50. statusTextMap: {
  51. '0': '待提交',
  52. '1': '已删除',
  53. '2': '待初审',
  54. '3': '待取件',
  55. "4": '初审未通过',
  56. "5": '已揽件',
  57. "6": '已签收',
  58. "7": '物流签收',
  59. '8': '待审核',
  60. '9': '审核中',
  61. '10': '待到款',
  62. '11': '已完成',
  63. }
  64. }
  65. },
  66. methods: {
  67. goToDetail() {
  68. if (this.isReturn) {
  69. uni.navigateTo({
  70. url: `/pages-mine/pages/apply?orderId=${this.order.orderId}`
  71. })
  72. } else {
  73. uni.navigateTo({
  74. url: `/pages-mine/pages/order-detail?orderId=${this.order.orderId}`
  75. })
  76. }
  77. },
  78. handleAction(data) {
  79. this.$emit('action', data)
  80. },
  81. handleSuccess() {
  82. console.log('handleSuccess')
  83. this.$emit('success')
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .order-item {
  90. background: #FFFFFF;
  91. border-radius: 12rpx;
  92. padding: 30rpx;
  93. margin-bottom: 20rpx;
  94. .order-header {
  95. display: flex;
  96. justify-content: space-between;
  97. align-items: center;
  98. .order-status {
  99. font-size: 28rpx;
  100. }
  101. }
  102. // 修改图片滚动区域样式
  103. .book-scroll {
  104. width: 100%;
  105. white-space: nowrap;
  106. margin: 30rpx 0 20rpx 0;
  107. .book-list {
  108. display: inline-flex;
  109. padding-right: 20rpx; // 为最后一张图片添加右边距
  110. gap: 20rpx;
  111. .book-cover {
  112. width: 132rpx;
  113. height: 132rpx;
  114. border-radius: 10rpx;
  115. flex-shrink: 0; // 防止图片被压缩
  116. }
  117. }
  118. }
  119. }
  120. // 隐藏滚动条
  121. ::-webkit-scrollbar {
  122. display: none;
  123. width: 0;
  124. height: 0;
  125. color: transparent;
  126. }
  127. </style>