order-return-item.vue 5.1 KB

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