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

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