order.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <!--<template>-->
  2. <!-- <view class="order-page">-->
  3. <!-- 1111111111111111111-->
  4. <!-- <van-tabs v-model="activeTab" title-active-color="#ee0a24" color="#333" swipe-threshold="5" animated sticky offset-top="46" @change="handleTabChange">-->
  5. <!-- <van-tab title="全部">-->
  6. <!--&lt;!&ndash; <order-list :orders="allOrders" />&ndash;&gt;-->
  7. <!-- </van-tab>-->
  8. <!-- <van-tab title="待付款">-->
  9. <!--&lt;!&ndash; <order-list :orders="unpaidOrders" />&ndash;&gt;-->
  10. <!-- </van-tab>-->
  11. <!-- <van-tab title="待送达">-->
  12. <!--&lt;!&ndash; <order-list :orders="unreceivedOrders" />&ndash;&gt;-->
  13. <!-- </van-tab>-->
  14. <!-- <van-tab title="已送达">-->
  15. <!--&lt;!&ndash; <order-list :orders="refundOrders" />&ndash;&gt;-->
  16. <!-- </van-tab>-->
  17. <!-- <van-tab title="已完成">-->
  18. <!--&lt;!&ndash; <order-list :orders="completedOrders" />&ndash;&gt;-->
  19. <!-- </van-tab>-->
  20. <!-- </van-tabs>-->
  21. <!-- </view>-->
  22. <!--</template>-->
  23. <!--<script>-->
  24. <!--import {mapState,mapMutations,mapGetters,mapActions} from 'vuex'-->
  25. <!--export default {-->
  26. <!-- components: {-->
  27. <!-- OrderList-->
  28. <!-- },-->
  29. <!-- data() {-->
  30. <!-- return {-->
  31. <!-- activeTab: 0,-->
  32. <!-- orders: [-->
  33. <!-- {-->
  34. <!-- address: {-->
  35. <!-- address: "江西财经大学枫林园",-->
  36. <!-- doorNo: "2#524",-->
  37. <!-- id: 9,-->
  38. <!-- phone: "12345678910",-->
  39. <!-- recipientName: "瑶妹",-->
  40. <!-- userId: 1-->
  41. <!-- },-->
  42. <!-- addressId: 9,-->
  43. <!-- bidPay: 10,-->
  44. <!-- id: 42,-->
  45. <!-- orderProductsLists: [],-->
  46. <!-- orderRemark: "我要大的橘子",-->
  47. <!-- orderState: "已送达",-->
  48. <!-- orderTypeId: null,-->
  49. <!-- originPay: 14.5,-->
  50. <!-- storeId: 1,-->
  51. <!-- timeOrder: "2024-05-05 01:48:28",-->
  52. <!-- timePre: "2024-05-05 01:48:39",-->
  53. <!-- transCode: "1786815170015203328",-->
  54. <!-- user: {-->
  55. <!-- account: null,-->
  56. <!-- addressIds: null,-->
  57. <!-- avatar: null,-->
  58. <!-- id: 1,-->
  59. <!-- name: "爱喝茶的小淮",-->
  60. <!-- newPassword: null,-->
  61. <!-- openid: "1243214213",-->
  62. <!-- password: null,-->
  63. <!-- phone: "12345678910",-->
  64. <!-- role: "USER",-->
  65. <!-- sex: "男",-->
  66. <!-- token: null,-->
  67. <!-- username: "user"-->
  68. <!-- },-->
  69. <!-- userId: 1-->
  70. <!-- }-->
  71. <!-- ]-->
  72. <!-- };-->
  73. <!-- },-->
  74. <!-- computed: {-->
  75. <!-- allOrders() {-->
  76. <!-- return this.orders;-->
  77. <!-- },-->
  78. <!-- unpaidOrders() {-->
  79. <!-- return this.orders.filter(order => order.orderState === "待付款");-->
  80. <!-- },-->
  81. <!-- unreceivedOrders() {-->
  82. <!-- return this.orders.filter(order => order.orderState === "待送达");-->
  83. <!-- },-->
  84. <!-- refundOrders() {-->
  85. <!-- return this.orders.filter(order => order.orderState === "已送达");-->
  86. <!-- },-->
  87. <!-- completedOrders() {-->
  88. <!-- return this.orders.filter(order => order.orderState === "已完成");-->
  89. <!-- }-->
  90. <!-- },-->
  91. <!-- methods: {-->
  92. <!-- ...mapActions('m_order',['fetchOrder']),-->
  93. <!-- ...mapGetters('m_order',['getOrder']),-->
  94. <!-- handleTabChange(index) {-->
  95. <!-- this.activeTab = index;-->
  96. <!-- this.fetchOrder();-->
  97. <!-- //三秒后-->
  98. <!-- setTimeout(() => {-->
  99. <!-- this.orders = this.getOrder();-->
  100. <!-- }, 3000);-->
  101. <!-- console.log(this.allOrders, 'eeeee')-->
  102. <!-- }-->
  103. <!-- }-->
  104. <!--};-->
  105. <!--</script>-->
  106. <!--<style lang="scss">-->
  107. <!--.order-page {-->
  108. <!-- padding: 10px;-->
  109. <!-- background-color: #f5f5f5;-->
  110. <!-- .van-tabs {-->
  111. <!-- &#45;&#45;van-tabs-bottom-bar-color: #ee0a24;-->
  112. <!-- }-->
  113. <!-- .van-tab {-->
  114. <!-- font-size: 14px;-->
  115. <!-- }-->
  116. <!--}-->
  117. <!--</style>-->
  118. <template>
  119. <view>
  120. <van-tabs :active="active" @change="onChange" swipeable sticky :ellipsis="false">
  121. <van-tab title="全部">
  122. <order-list :orders="allOrders"></order-list>
  123. </van-tab>
  124. <van-tab title="待付款">
  125. <order-list :orders="unpaidOrders"></order-list>
  126. </van-tab>
  127. <van-tab title="待送达">
  128. <order-list :orders="unreceivedOrders"></order-list>
  129. </van-tab>
  130. <van-tab title="已送达">
  131. <order-list :orders="refundOrders"></order-list>
  132. </van-tab>
  133. <van-tab title="已完成">
  134. <order-list :orders="completedOrders"></order-list>
  135. </van-tab>
  136. </van-tabs>
  137. </view>
  138. </template>
  139. <script>
  140. import OrderAll from "@/components/orders/order-all/order-all.vue";
  141. import {mapState,mapMutations,mapGetters,mapActions} from 'vuex'
  142. export default {
  143. components: {OrderAll},
  144. onLoad() {
  145. this.orders = this.getOrders();
  146. this.fetchOrder();
  147. console.log(this.orders,"thid")
  148. },
  149. data() {
  150. return {
  151. active: this.query.pagetype ? parseInt(this.query.pagetype): 0,
  152. orders:
  153. [
  154. {
  155. address: {
  156. address: "江西财经大学枫林园",
  157. doorNo: "2#524",
  158. id: 9,
  159. phone: "12345678910",
  160. recipientName: "瑶妹",
  161. userId: 1
  162. },
  163. addressId: 9,
  164. bidPay: 10,
  165. id: 42,
  166. orderProductsLists: [
  167. ],
  168. orderRemark: "我要大的橘子",
  169. orderState: "已送达",
  170. orderTypeId: null,
  171. originPay: 14.5,
  172. storeId: 1,
  173. timeOrder: "2024-05-05 01:48:28",
  174. timePre: "2024-05-05 01:48:39",
  175. transCode: "1786815170015203328",
  176. user:{
  177. account: null,
  178. addressIds: null,
  179. avatar: null,
  180. id: 1,
  181. name: "爱喝茶的小淮",
  182. newPassword: null,
  183. openid: "1243214213",
  184. password: null,
  185. phone: "12345678910",
  186. role: "USER",
  187. sex: "男",
  188. token: null,
  189. username: "user"
  190. },
  191. userId:1
  192. }
  193. ]
  194. };
  195. },
  196. props: {
  197. },
  198. computed: {
  199. allOrders() {
  200. return this.orders;
  201. },
  202. unpaidOrders() {
  203. return this.orders.filter(order => order.orderState === "待付款");
  204. },
  205. unreceivedOrders() {
  206. return this.orders.filter(order => order.orderState === "待送达");
  207. },
  208. refundOrders() {
  209. return this.orders.filter(order => order.orderState === "已送达");
  210. },
  211. completedOrders() {
  212. return this.orders.filter(order => order.orderState === "已完成");
  213. }
  214. },
  215. methods: {
  216. ...mapActions('m_order',['fetchOrder']),
  217. ...mapGetters('m_order',['getOrders']),
  218. onLoad(options) {
  219. // console.log(options.pagetype,"pagetype")
  220. this.orders=this.getOrders()
  221. this.fetchOrder()
  222. if(options.pagetype){
  223. this.active = parseInt(options.pagetype)
  224. }
  225. },
  226. onChange(event) {
  227. console.log(event)
  228. this.active = event.detail.index
  229. this.fetchOrder()
  230. console.log(this.getOrders(),'eeeee')
  231. this.orders=this.getOrders()
  232. // console.log(this.query().pagetype,'eeeee')
  233. },
  234. query() {
  235. return this.$route.query
  236. }
  237. }
  238. }
  239. </script>
  240. <style lang="scss">
  241. page { background-color: #8f8f94; }
  242. </style>