order-return-item.vue 4.9 KB

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