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

149 lines
3.4 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
  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',width : '33%'}" 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. <timelineService v-else />
  36. <!-- <orderListByData :list="list" v-else /> -->
  37. </view>
  38. </view>
  39. </template>
  40. <script setup>
  41. import {
  42. computed,
  43. reactive,
  44. ref
  45. } from "vue";
  46. import systemOrder from "./components/systemOrder.vue";
  47. import orderListByData from "./components/orderListByData.vue";
  48. import timelineService from "./components/timelineService.vue";
  49. import {
  50. onShow
  51. } from "@dcloudio/uni-app"
  52. import {
  53. getLoginStatus
  54. } from "@/utils/useMixin.js"
  55. // import personOrder from "./components/personOrder.vue";
  56. // import lossOrder from "./components/lossOrder.vue";
  57. import {
  58. myList
  59. } from "@/api/receivingHall/index.js"
  60. import {
  61. useStore
  62. } from "vuex"
  63. import { getOrderServiceText, getProductNameText } from '@/utils/serviceTime.js'
  64. onShow(() => {
  65. if (!getLoginStatus()) return;
  66. getList();
  67. })
  68. const current = ref(0)
  69. const activeIndex = ref(1)
  70. const list = ref([])
  71. const store = useStore();
  72. const userInfo = computed(() => {
  73. return store.getters.userInfo;
  74. })
  75. const tabList1 = reactive([{
  76. name: '待服务',
  77. badge: {
  78. value: 0,
  79. }
  80. },
  81. {
  82. name: '进行中',
  83. badge: {
  84. value: 0,
  85. }
  86. },
  87. {
  88. name: '已完成',
  89. badge: {
  90. value: 0,
  91. }
  92. },
  93. ])
  94. const tabList2 = reactive([{
  95. name: '待上门',
  96. badge: {
  97. value: 0,
  98. }
  99. },
  100. {
  101. name: '已完成',
  102. badge: {
  103. value: 0,
  104. }
  105. },
  106. ])
  107. function getList() {
  108. myList({
  109. type: current.value,
  110. userId: userInfo.value.userId
  111. })
  112. .then(res => {
  113. if (res.code == 200) {
  114. list.value = res.data.rows
  115. if(activeIndex.value == 0){
  116. tabList2[current.value].badge.value = res.data.total
  117. }else{
  118. tabList1[current.value].badge.value = res.data.total
  119. }
  120. list.value.forEach(item => {
  121. item.h5OrderVO.petVOList.forEach(pet => {
  122. pet.orderServiceText = getOrderServiceText(pet.id, item.h5OrderVO.orderServiceList)
  123. pet.productNameText = getProductNameText(pet.id, item.h5OrderVO.orderItemList, item.h5OrderVO.orderServiceList)
  124. })
  125. })
  126. }
  127. })
  128. }
  129. const classIfyClickTab = (item) => {
  130. current.value = item.index;
  131. getList();
  132. }
  133. </script>
  134. <style scoped lang="scss">
  135. @import "index.scss";
  136. </style>