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

107 lines
2.3 KiB

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. <up-sticky bgColor="#fff">
  4. <view class="container-tabs">
  5. <up-tabs :list="list" lineWidth="68rpx" :activeStyle="{
  6. color: '#FFFFFF',
  7. fontWeight: 'bold',
  8. transform: 'scale(1.05)'
  9. }" :inactiveStyle="{
  10. color: '#FFFFFF',
  11. transform: 'scale(1)'
  12. }" :itemStyle="{height:'88rpx',width : '33%'}" lineColor="#FFFFFF" @click="clickEvent"></up-tabs>
  13. </view>
  14. </up-sticky>
  15. <view class="container">
  16. <List :orderList="orderlist" :current="current" @update="updateList"></List>
  17. </view>
  18. </view>
  19. </template>
  20. <script setup>
  21. import {
  22. computed,
  23. reactive,
  24. ref
  25. } from "vue";
  26. import List from "./components/list.vue";
  27. import {
  28. onShow
  29. } from "@dcloudio/uni-app"
  30. import { getLoginStatus } from "@/utils/useMixin.js"
  31. import {
  32. orderList
  33. } from "@/api/receivingHall/index.js"
  34. import submitBut from "@/components/submitBut/index.vue"
  35. import {
  36. useStore
  37. } from "vuex"
  38. import dayjs from "dayjs";
  39. import { getOrderServiceText, getProductNameText } from '@/utils/serviceTime.js'
  40. const current = ref(0)
  41. const list = reactive([{
  42. name: '系统派单',
  43. badge: {
  44. value: 0,
  45. }
  46. },
  47. {
  48. name: '个人订单',
  49. badge: {
  50. value: 0,
  51. }
  52. },
  53. {
  54. name: '流失订单',
  55. badge: {
  56. value: 0,
  57. }
  58. },
  59. ])
  60. const store = useStore();
  61. const userInfo = computed(() => {
  62. return store.getters.userInfo
  63. })
  64. const orderlist = ref([]);
  65. onShow(() => {
  66. if (!getLoginStatus()) return;
  67. getOrderList();
  68. })
  69. // 获取接单大厅列表
  70. const getOrderList = async () => {
  71. let response = await orderList({
  72. type: current.value,
  73. userIdJson: userInfo.value.userId
  74. });
  75. if (response.code == 200 && response.data) {
  76. orderlist.value = response.data.rows;
  77. list[current.value].badge.value = response.data.total
  78. orderlist.value.forEach(item => {
  79. item.h5OrderVO.petVOList.forEach(pet => {
  80. pet.orderServiceText = getOrderServiceText(pet.id, item.h5OrderVO.orderServiceList)
  81. pet.productNameText = getProductNameText(pet.id, item.h5OrderVO.orderItemList, item.h5OrderVO.orderServiceList)
  82. })
  83. })
  84. }
  85. }
  86. const clickEvent = (item) => {
  87. current.value = item.index;
  88. getOrderList();
  89. }
  90. const updateList = () => {
  91. getOrderList();
  92. }
  93. </script>
  94. <style scoped lang="scss">
  95. @import "index.scss";
  96. </style>