order-return-item.vue 4.3 KB

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