orderAll.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <view class="container">
  3. <u-sticky style="margin-top: 15rpx; margin-left: 20rpx" bgColor="#fff">
  4. <u-tabs lineWidth="40" :list="list" :current="current" @change="handlerChangeItem" />
  5. </u-sticky>
  6. <!-- 订单 -->
  7. <view>
  8. <view v-if="init_list.length > 0"> 1111111111 </view>
  9. <view v-else style="margin-top: 40rpx">
  10. <u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" />
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import { userOrdersApi } from '@/api/client/order';
  17. export default {
  18. data() {
  19. return {
  20. current: 0,
  21. type: 'ALL',
  22. size: 20,
  23. list: [
  24. {
  25. name: '全部',
  26. type: 'ALL',
  27. },
  28. {
  29. name: '待付款',
  30. type: 'WAIT_PAY',
  31. },
  32. {
  33. name: '已付款',
  34. type: 'WAIT_EVALUATE',
  35. },
  36. {
  37. name: '待评价',
  38. type: 'CANCELLED',
  39. },
  40. ],
  41. init_list: [],
  42. };
  43. },
  44. mounted() {
  45. this.userOrdersPage();
  46. },
  47. methods: {
  48. handlerChangeItem(data) {
  49. this.current = data.index;
  50. this.type = data.type;
  51. this.userOrdersPage(this.type);
  52. },
  53. async userOrdersPage(type) {
  54. let orderStatus = type == undefined ? 'ALL' : `${type}`;
  55. let res = await userOrdersApi({
  56. orderStatus,
  57. size: this.size,
  58. });
  59. if ((res.code = 200 && res.data)) {
  60. this.init_list = res.data;
  61. }
  62. },
  63. },
  64. };
  65. </script>
  66. <style lang="scss" scoped>
  67. ::deep .u-tabs__wrapper__nav__item__text {
  68. font-size: 30px;
  69. }
  70. </style>