order.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view>
  3. <view class="order">
  4. <view style="background-color: #fff; padding: 15rpx">
  5. <u-tabs :list="list1" lineWidth="30" lineColor="$uni-bg-color-primary" :activeStyle="{
  6. color: '#000',
  7. fontWeight: 'bold',
  8. fontSize: '32rpx',
  9. transform: 'scale(1.05)',
  10. marginBottom: '15rpx',
  11. }" :inactiveStyle="{
  12. color: '#333',
  13. fontSize: '30rpx',
  14. transform: 'scale(1)',
  15. marginBottom: '15rpx',
  16. }" itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;" @click="handlerChangeItem"></u-tabs>
  17. </view>
  18. <orderItem :list="orderList" :typeStyle.sync="typeStyle"></orderItem>
  19. </view>
  20. <tabbar currentTab="merchantOrder" />
  21. </view>
  22. </template>
  23. <script>
  24. import orderItem from './orderItem.vue';
  25. import {
  26. getOrderListApi
  27. } from '@/api/merchant/order';
  28. export default {
  29. components: {
  30. orderItem
  31. },
  32. data() {
  33. return {
  34. list1: [{
  35. id: '0',
  36. name: '全部'
  37. },
  38. {
  39. id: '1',
  40. name: '待核销'
  41. },
  42. {
  43. id: '2',
  44. name: '已核销'
  45. },
  46. {
  47. id: '3',
  48. name: '退款'
  49. },
  50. ],
  51. orderList: [],
  52. params: {
  53. pageNum: 1,
  54. pageSize: 10,
  55. },
  56. typeStyle: 0,
  57. status: '0',
  58. };
  59. },
  60. methods: {
  61. // 点击切换顶部导航栏
  62. handlerChangeItem(item) {
  63. this.typeStyle = item.index;
  64. this.getOrderList(item.id);
  65. },
  66. async getOrderList(status) {
  67. let result = Object.assign({}, {
  68. paging: `${this.params.pageNum},${this.params.pageSize}`,
  69. status: status || 0,
  70. }, );
  71. let res = await getOrderListApi({
  72. ...result
  73. });
  74. if (res.code === 'OK') {
  75. this.orderList = res.data.records;
  76. }
  77. },
  78. },
  79. created() {
  80. this.getOrderList();
  81. },
  82. };
  83. </script>
  84. <style lang="scss" scoped>
  85. .order {
  86. min-height: calc(100vh - 80rpx);
  87. background-color: $uni-bg-color-page;
  88. padding-top: 80rpx;
  89. }
  90. </style>