猫妈狗爸伴宠师小程序前端代码
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.

121 lines
2.6 KiB

2 months ago
2 months ago
  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 { getLoginStatus } from "@/utils/useMixin.js"
  50. // import personOrder from "./components/personOrder.vue";
  51. // import lossOrder from "./components/lossOrder.vue";
  52. import {
  53. getAppOrderList,
  54. } from "@/api/order/order.js"
  55. onShow(() => {
  56. if (!getLoginStatus())return;
  57. })
  58. const current = ref(0)
  59. const activeIndex = ref(1)
  60. const list = ref([])
  61. const tabList1 = reactive([{
  62. name: '待服务',
  63. badge: {
  64. // value: 5,
  65. }
  66. },
  67. {
  68. name: '进行中',
  69. badge: {
  70. // value: 5,
  71. }
  72. },
  73. {
  74. name: '已完成',
  75. badge: {
  76. // value: 5,
  77. }
  78. },
  79. ])
  80. const tabList2 = reactive([{
  81. name: '待上门',
  82. badge: {
  83. // value: 5,
  84. }
  85. },
  86. {
  87. name: '已完成',
  88. badge: {
  89. // value: 5,
  90. }
  91. },
  92. ])
  93. function getList() {
  94. getAppOrderList()
  95. .then(res => {
  96. if (res.code == 200) {
  97. list.value = res.rows
  98. }
  99. })
  100. }
  101. getList()
  102. const activeIndex1Click = (item) => {
  103. current.value = item.index;
  104. }
  105. </script>
  106. <style scoped lang="scss">
  107. @import "index.scss";
  108. </style>