order-return-item.vue 4.5 KB

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