apply-return.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view class="order-page">
  3. <!-- 标签页 -->
  4. <view class="tabs-wrapper">
  5. <u-tabs :list="tabList" :current="currentTab" @change="handleTabChange" :is-scroll="false"
  6. active-color="#38C148" bar-width="60"></u-tabs>
  7. </view>
  8. <!-- 订单列表 -->
  9. <page-scroll :page-size="12" @updateList="handleUpdateList" ref="pageRef" slotEmpty url="/token/order/scanLogs">
  10. <view v-if="orderList.length > 0" class="pad-20">
  11. <order-item isReturn v-for="order in orderList" :key="order.orderNo" :order="order" @cancel="handleCancel"
  12. @report="handleReport" @editAddress="handleEditAddress" @remind="handleRemind"></order-item>
  13. </view>
  14. </page-scroll>
  15. </view>
  16. </template>
  17. <script>
  18. import OrderItem from '../components/order-item.vue'
  19. import pageScroll from '@/components/pageScroll/index.vue'
  20. export default {
  21. components: {
  22. OrderItem,
  23. pageScroll
  24. },
  25. data() {
  26. return {
  27. tabList: [{
  28. name: '已申请'
  29. },
  30. {
  31. name: '可退回'
  32. },
  33. ],
  34. currentTab: 0,
  35. orderList: [],
  36. }
  37. },
  38. onLoad(options) {
  39. // 如果有传入状态,切换到对应tab
  40. if (options.status) {
  41. const index = this.tabList.findIndex(tab => tab.value === options.status)
  42. if (index !== -1) {
  43. this.currentTab = index
  44. }
  45. }
  46. this.loadOrders(true)
  47. },
  48. methods: {
  49. // 加载订单
  50. loadOrders(bool = false) {
  51. this.$refs.pageRef?.loadData(bool)
  52. },
  53. handleTabChange(index) {
  54. this.currentTab = index
  55. this.page = 1
  56. this.loadOrders(true)
  57. },
  58. handleUpdateList(list) {
  59. this.orderList = list.map(item => {
  60. return {
  61. orderNo: '54631435441',
  62. status: 'pending_review',
  63. submitTime: '2024-12-06 15:00:00',
  64. books: [{
  65. cover: 'https://shuhi.oss-cn-qingdao.aliyuncs.com/20241206/08ea280b-8627-4525-9e31-ed25cdce9094.jpg'
  66. },
  67. {
  68. cover: 'https://shuhi.oss-cn-qingdao.aliyuncs.com/20241206/08ea280b-8627-4525-9e31-ed25cdce9094.jpg'
  69. },
  70. {
  71. cover: 'https://shuhi.oss-cn-qingdao.aliyuncs.com/20241206/08ea280b-8627-4525-9e31-ed25cdce9094.jpg'
  72. },
  73. {
  74. cover: 'https://shuhi.oss-cn-qingdao.aliyuncs.com/20241206/08ea280b-8627-4525-9e31-ed25cdce9094.jpg'
  75. },
  76. {
  77. cover: 'https://shuhi.oss-cn-qingdao.aliyuncs.com/20241206/08ea280b-8627-4525-9e31-ed25cdce9094.jpg'
  78. },
  79. {
  80. cover: 'https://shuhi.oss-cn-qingdao.aliyuncs.com/20241206/08ea280b-8627-4525-9e31-ed25cdce9094.jpg'
  81. }
  82. ]
  83. }
  84. })
  85. },
  86. // 订单操作方法
  87. handleCancel(order) {
  88. uni.showModal({
  89. title: '提示',
  90. content: '确定要取消该订单吗?',
  91. success: (res) => {
  92. if (res.confirm) {
  93. // 调用取消订单接口
  94. }
  95. }
  96. })
  97. },
  98. handleReport(order) {
  99. uni.navigateTo({
  100. url: `/pages/order/report?orderNo=${order.orderNo}`
  101. })
  102. },
  103. handleEditAddress(order) {
  104. uni.navigateTo({
  105. url: `/pages/order/address?orderNo=${order.orderNo}`
  106. })
  107. },
  108. handleRemind(order) {
  109. uni.showToast({
  110. title: '已提醒审核',
  111. icon: 'none'
  112. })
  113. }
  114. }
  115. }
  116. </script>
  117. <style lang="scss" scoped>
  118. .order-page {
  119. min-height: 100vh;
  120. background-color: #F5F5F5;
  121. .tabs-wrapper {
  122. position: sticky;
  123. top: 0;
  124. z-index: 99;
  125. background: #FFFFFF;
  126. }
  127. }
  128. </style>