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

133 lines
2.8 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
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 @click="classIfyClickTab" :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"></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. computed,
  42. reactive,
  43. ref
  44. } from "vue";
  45. import systemOrder from "./components/systemOrder.vue";
  46. import orderListByData from "./components/orderListByData.vue";
  47. import {
  48. onShow
  49. } from "@dcloudio/uni-app"
  50. import {
  51. getLoginStatus
  52. } from "@/utils/useMixin.js"
  53. // import personOrder from "./components/personOrder.vue";
  54. // import lossOrder from "./components/lossOrder.vue";
  55. import {
  56. myList
  57. } from "@/api/receivingHall/index.js"
  58. import {
  59. useStore
  60. } from "vuex"
  61. onShow(() => {
  62. if (!getLoginStatus()) return;
  63. getList();
  64. })
  65. const current = ref(0)
  66. const activeIndex = ref(1)
  67. const list = ref([])
  68. const store = useStore();
  69. const userInfo = computed(() => {
  70. return store.getters.userInfo;
  71. })
  72. const tabList1 = reactive([{
  73. name: '待服务',
  74. badge: {
  75. // value: 5,
  76. }
  77. },
  78. {
  79. name: '进行中',
  80. badge: {
  81. // value: 5,
  82. }
  83. },
  84. {
  85. name: '已完成',
  86. badge: {
  87. // value: 5,
  88. }
  89. },
  90. ])
  91. const tabList2 = reactive([{
  92. name: '待上门',
  93. badge: {
  94. // value: 5,
  95. }
  96. },
  97. {
  98. name: '已完成',
  99. badge: {
  100. // value: 5,
  101. }
  102. },
  103. ])
  104. function getList() {
  105. myList({
  106. type: current.value,
  107. userId: userInfo.value.userId
  108. })
  109. .then(res => {
  110. if (res.code == 200) {
  111. list.value = res.data
  112. }
  113. })
  114. }
  115. const classIfyClickTab = (item) => {
  116. current.value = item.index;
  117. getList();
  118. }
  119. </script>
  120. <style scoped lang="scss">
  121. @import "index.scss";
  122. </style>