index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <app-layout>
  3. <view class="order-box">
  4. <view v-if="is_show" class='content-box'>
  5. <template v-if="orders.length">
  6. <view v-for='(item, index) in orders' :key='item.id' :style="{'margin-top': index == 0 ? '24rpx' : '0'}" class='order-item-box dir-top-wrap'>
  7. <app-jump-button type="redirect" :url="item.id | getPageUrl(currentIndex)">
  8. <view class="dir-top-nowrap" style="width: 100%">
  9. <view class='dir-left-nowrap view-1'>
  10. <view class='box-grow-1'>订单号:{{item.order_no}}</view>
  11. <template v-if='item.status == 0'>
  12. <text v-if='item.sign == "pintuan"'>{{item.is_pay == 1 ? '拼团中' : '待付款'}}</text>
  13. </template>
  14. <template v-else>
  15. <view>{{item.status_text}}</view>
  16. </template>
  17. </view>
  18. <view v-for='(dItem) in item.detail' :key='dItem.id' class='view-2'>
  19. <app-order-goods-info :goods='dItem.goods_info'></app-order-goods-info>
  20. </view>
  21. </view>
  22. </app-jump-button>
  23. <view class='dir-left-nowrap view-3 status-text'>
  24. <view class='box-grow-1'>
  25. {{item.status_text}}
  26. </view>
  27. <view v-if="item.type == 1 || item.type == 3" class='box-grow-0 dir-top-nowrap'>
  28. <text>
  29. 申请退款:{{item.refund_price}}
  30. </text>
  31. <text style="margin-top:5rpx;" v-if="item.is_refund == 1">
  32. 实际退款:{{item.reality_refund_price}}
  33. </text>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <template v-else>
  39. <view class='not-order-box cross-center main-center'>
  40. 暂无相关订单
  41. </view>
  42. </template>
  43. </view>
  44. <app-load-text v-if="is_load_show"></app-load-text>
  45. </view>
  46. </app-layout>
  47. </template>
  48. <script>
  49. import appOrderGoodsInfo from '../../../components/page-component/app-order-goods-info/app-order-goods-info.vue';
  50. import { mapGetters } from 'vuex';
  51. export default {
  52. data() {
  53. return {
  54. page: 1,
  55. currentIndex: 5,
  56. orders: [],
  57. pagination: null,
  58. is_show: false,
  59. is_load_show: false,
  60. }
  61. },
  62. methods: {
  63. async getList() {
  64. try {
  65. const response = await this.$request({
  66. url: this.$api.order.list,
  67. data: {
  68. status: this.currentIndex,
  69. page: this.page,
  70. }
  71. });
  72. this.$hideLoading();
  73. let { code, data, msg } = response;
  74. this.is_load_show = false;
  75. this.is_show = true;
  76. if (code === 0) {
  77. let { list, pagination } = data;
  78. if (this.page !== 1) {
  79. this.orders = this.orders.concat(list);
  80. } else {
  81. this.orders = list;
  82. }
  83. this.page = list.length ? this.page + 1 : this.page;
  84. this.pagination = pagination;
  85. } else {
  86. uni.showModal({
  87. title: '',
  88. content: msg,
  89. showCancel: false,
  90. });
  91. }
  92. } catch (e) {
  93. this.is_load_show = false;
  94. this.$hideLoading();
  95. throw new Error(e);
  96. }
  97. },
  98. },
  99. filters: {
  100. getPageUrl(id, currentIndex) {
  101. if (currentIndex === 5) {
  102. return `/pages/order/refund-detail/refund-detail?id=${id}`
  103. }
  104. }
  105. },
  106. onReachBottom() {
  107. this.is_load_show = true;
  108. this.getList()
  109. },
  110. onShow() {
  111. this.page = 1;
  112. this.$showLoading();
  113. this.getList();
  114. this.$store.dispatch('gConfig/setTabBarBoolean', this.tabBarNavs.navs);
  115. },
  116. computed: {
  117. ...mapGetters('mallConfig', {
  118. tabBarNavs: 'getNavBar'
  119. }),
  120. },
  121. components: {
  122. 'app-order-goods-info': appOrderGoodsInfo,
  123. },
  124. }
  125. </script>
  126. <style scoped lang="scss">
  127. .order-box {
  128. width: 100%;
  129. height: 100%;
  130. }
  131. .not-order-box {
  132. height: 100vh;
  133. color: $uni-general-color-two;
  134. }
  135. .order-item-box {
  136. background: #fff;
  137. padding: 0 24#{rpx};
  138. margin: 0 24#{rpx};
  139. margin-bottom: 24#{rpx};
  140. border-radius: 16#{rpx};
  141. font-size: $uni-font-size-general-two;
  142. }
  143. .order-item-box .view-1 {
  144. width: 100%;
  145. font-size: $uni-font-size-weak-one;
  146. color: $uni-important-color-black;
  147. margin: 32#{rpx} 0;
  148. }
  149. .order-item-box .view-2 {}
  150. .order-item-box .view-3 {
  151. font-size: $uni-font-size-import-two;
  152. }
  153. .order-item-box .view-3 .btn {
  154. margin-left: 15#{rpx};
  155. }
  156. .price-color {
  157. color: $uni-important-color-black;
  158. }
  159. .status-text {
  160. margin: #{28rpx} 0;
  161. font-size: $uni-font-size-general-two;
  162. }
  163. .success-color {
  164. color: $uni-important-color-black;
  165. }
  166. .action-box-view {
  167. width: 100%;
  168. }
  169. </style>