猫妈狗爸伴宠师小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
2.6 KiB

  1. <template>
  2. <view>
  3. <view class="header-buts flex flex-center">
  4. <view class="flex buts-box">
  5. <view class="buts" :class="{'buts-active':activeIndex===1}" @click="activeIndex=1">总订单</view>
  6. <view class="buts" :class="{'buts-active':activeIndex===2}" @click="activeIndex=2">日订单</view>
  7. </view>
  8. </view>
  9. <up-sticky bgColor="#fff" v-if="activeIndex == 1">
  10. <view class="container-tabs">
  11. <up-tabs :list="tabList1" lineWidth="68rpx" :activeStyle="{
  12. color: '#FFFFFF',
  13. fontWeight: 'bold',
  14. transform: 'scale(1.05)'
  15. }" :inactiveStyle="{
  16. color: '#FFFFFF',
  17. transform: 'scale(1)'
  18. }" :itemStyle="{height:'88rpx',padding:'0 52rpx'}" lineColor="#FFFFFF" @click="activeIndex1Click"></up-tabs>
  19. </view>
  20. </up-sticky>
  21. <up-sticky bgColor="#fff" v-else>
  22. <view class="container-tabs">
  23. <up-tabs :list="tabList2" lineWidth="68rpx" :activeStyle="{
  24. color: '#FFFFFF',
  25. fontWeight: 'bold',
  26. transform: 'scale(1.05)'
  27. }" :inactiveStyle="{
  28. color: '#FFFFFF',
  29. transform: 'scale(1)'
  30. }" :itemStyle="{height:'88rpx',padding:'0 52rpx', width : '400rpx'}" lineColor="#FFFFFF"></up-tabs>
  31. </view>
  32. </up-sticky>
  33. <view class="container">
  34. <systemOrder :list="list" :current="current" v-if="activeIndex == 1" />
  35. <orderListByData :list="list" v-else />
  36. </view>
  37. </view>
  38. </template>
  39. <script setup>
  40. import {
  41. reactive,
  42. ref
  43. } from "vue";
  44. import systemOrder from "./components/systemOrder.vue";
  45. import orderListByData from "./components/orderListByData.vue";
  46. import {
  47. onShow
  48. } from "@dcloudio/uni-app"
  49. import {
  50. getIsLogin
  51. } from "@/utils/auth.js"
  52. // import personOrder from "./components/personOrder.vue";
  53. // import lossOrder from "./components/lossOrder.vue";
  54. import {
  55. getAppOrderList,
  56. } from "@/api/order/order.js"
  57. onShow(() => {
  58. if (!getIsLogin()) {
  59. uni.navigateTo({
  60. url: "/pages/login/index"
  61. })
  62. }
  63. })
  64. const current = ref(0)
  65. const activeIndex = ref(1)
  66. const list = ref([])
  67. const tabList1 = reactive([{
  68. name: '待服务',
  69. badge: {
  70. // value: 5,
  71. }
  72. },
  73. {
  74. name: '进行中',
  75. badge: {
  76. // value: 5,
  77. }
  78. },
  79. {
  80. name: '已完成',
  81. badge: {
  82. // value: 5,
  83. }
  84. },
  85. ])
  86. const tabList2 = reactive([{
  87. name: '待上门',
  88. badge: {
  89. // value: 5,
  90. }
  91. },
  92. {
  93. name: '已完成',
  94. badge: {
  95. // value: 5,
  96. }
  97. },
  98. ])
  99. function getList() {
  100. getAppOrderList()
  101. .then(res => {
  102. if (res.code == 200) {
  103. list.value = res.rows
  104. }
  105. })
  106. }
  107. getList()
  108. const activeIndex1Click = (item) => {
  109. current.value = item.index;
  110. }
  111. </script>
  112. <style scoped lang="scss">
  113. @import "index.scss";
  114. </style>