order-page.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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
  10. url="/token/order/getMyOrderList" :params="params" :immediate="false">
  11. <view v-if="orderList.length > 0" class="pad-20">
  12. <order-item v-for="order in orderList" :key="order.orderNo" :order="order" @action="handleAction"
  13. @success="handleSuccess"></order-item>
  14. </view>
  15. </page-scroll>
  16. <u-action-sheet v-model="showReportSheet" :list="actionList" @close="showReportSheet = false"
  17. @click="handleReportSelect" cancelText="取消" :mask-close-able="false" :safe-area-inset-bottom="true" />
  18. <common-dialog ref="reviewDialog" title="温馨提示" @confirm="confirmReview">
  19. <text>对复审结果有疑问,申请复审?</text>
  20. </common-dialog>
  21. <common-dialog ref="processDialog" title="温馨提示" @confirm="handleSuccess">
  22. <text>{{ reviewMsg }}</text>
  23. </common-dialog>
  24. </view>
  25. </template>
  26. <script>
  27. import OrderItem from '../components/order-item.vue'
  28. import pageScroll from '@/components/pageScroll/index.vue'
  29. import CommonDialog from '@/components/common-dialog.vue'
  30. import mixin from '../mixin/btnAction.js'
  31. export default {
  32. mixins: [mixin],
  33. components: {
  34. OrderItem,
  35. pageScroll,
  36. CommonDialog,
  37. },
  38. data() {
  39. return {
  40. tabList: [{
  41. name: '全部',
  42. status: "-1"
  43. },
  44. {
  45. name: '待初审',
  46. status: "2"
  47. },
  48. {
  49. name: '待取件',
  50. status: "3"
  51. },
  52. {
  53. name: '待审核',
  54. status: "8"
  55. },
  56. {
  57. name: '待到款',
  58. status: "10"
  59. }
  60. ],
  61. currentTab: 0,
  62. orderList: [],
  63. isRefreshing: false,
  64. page: 1,
  65. pageSize: 10,
  66. hasMore: true,
  67. params: {},
  68. reviewMsg: ""
  69. }
  70. },
  71. onLoad(options) {
  72. console.log(options, 'options')
  73. // 如果有传入状态,切换到对应tab
  74. if (options.status) {
  75. this.currentTab = this.tabList.findIndex(item => item.status == options.status)
  76. this.params.status = options.status
  77. } else {
  78. this.currentTab = 0
  79. }
  80. this.loadOrders(true, this.params)
  81. uni.$on('btnActionSuccess', () => {
  82. this.loadOrders(true, this.params)
  83. })
  84. },
  85. onUnload() {
  86. uni.$off('btnActionSuccess')
  87. },
  88. methods: {
  89. loadOrders(bool = false, params = {}) {
  90. console.log(this.$refs.pageRef, 'params')
  91. this.$nextTick(() => {
  92. this.$refs.pageRef?.loadData(bool, params);
  93. })
  94. },
  95. confirmReview() {
  96. uni.$u.http.post('/token/order/applyReview?orderId=' + this.order.orderId).then(res => {
  97. if (res.code == 200) {
  98. this.reviewMsg = res.data || '申请复审成功'
  99. this.$refs.processDialog.openPopup()
  100. } else {
  101. this.reviewMsg = res.data || '申请复审失败'
  102. }
  103. })
  104. },
  105. handleSuccess() {
  106. this.loadOrders(true, this.params)
  107. },
  108. handleTabChange(index) {
  109. this.currentTab = index
  110. this.params.status = this.tabList[index].status
  111. this.loadOrders(true, this.params)
  112. },
  113. handleUpdateList(list) {
  114. this.orderList = list
  115. },
  116. // 订单操作方法
  117. handleCancel(order) {
  118. uni.showModal({
  119. title: '提示',
  120. content: '确定要取消该订单吗?',
  121. success: (res) => {
  122. if (res.confirm) {
  123. // 调用取消订单接口
  124. }
  125. }
  126. })
  127. },
  128. handleReport(order) {
  129. uni.navigateTo({
  130. url: `/pages/order/report?orderNo=${order.orderNo}`
  131. })
  132. },
  133. handleEditAddress(order) {
  134. uni.navigateTo({
  135. url: `/pages/order/address?orderNo=${order.orderNo}`
  136. })
  137. },
  138. handleRemind(order) {
  139. uni.showToast({
  140. title: '已提醒审核',
  141. icon: 'none'
  142. })
  143. }
  144. }
  145. }
  146. </script>
  147. <style lang="scss" scoped>
  148. .order-page {
  149. min-height: 100vh;
  150. background-color: #F5F5F5;
  151. .tabs-wrapper {
  152. position: sticky;
  153. top: 0;
  154. z-index: 99;
  155. background: #FFFFFF;
  156. }
  157. }
  158. </style>