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

152 lines
4.2 KiB

2 months ago
2 months ago
2 months ago
  1. <template>
  2. <up-list @scrolltolower="scrolltolower">
  3. <up-list-item>
  4. <view v-if="list && list.length > 0">
  5. <view class="mb28 container-list-item" v-for="(item, index) in list" :key="item.id">
  6. <view class="flex-between flex" style="background: #FFF4E5;padding: 22rpx 42rpx">
  7. <view>{{ orderStatus[item.status] }}</view>
  8. <view>本单酬劳
  9. <text style="color: #FF530A">{{ item.orderGivePrice }}</text>
  10. </view>
  11. </view>
  12. <view class="container-list">
  13. <view class="flex-between flex mb28" v-for="(pet, index) in item.h5OrderVO.petVOList">
  14. <up-image style="flex-shrink:0" class="mr20" width="70px" height="70px"
  15. :src="pet.photo" shape="circle"></up-image>
  16. <view>
  17. <view class="font28 col3">服务天数: {{ pet.orderServiceText.length }} I {{ pet.orderServiceText.join(',') }}
  18. </view>
  19. <view style="margin: 18rpx 0">期望上门时间</view>
  20. <view>{{ pet.breed }}{{ pet.bodyType }} | {{ pet.productNameText.join('+') }}</view>
  21. </view>
  22. </view>
  23. <view class="mb28 address">{{ item.address }}</view>
  24. <view class="mb28" v-if="item.type == 0">订单为系统派发请确认订单信息后再抢单</view>
  25. <view class="flex flex-between">
  26. <up-button type="primary" text="打卡记录" @click="showServicePopup(item)" shape="circle"
  27. class="mr20" color="#FFAA48"></up-button>
  28. <up-button type="primary" text="宠物档案" @click="toPet(item)" shape="circle" class="mr20"
  29. color="#FFAA48"></up-button>
  30. <up-button type="primary" text="服务档案" @click="toService(item)" shape="circle"
  31. color="#FFAA48"></up-button>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view v-else class="empty-state">
  37. <text class="empty-text">暂无订单数据</text>
  38. </view>
  39. </up-list-item>
  40. </up-list>
  41. <!-- 宠物服务时间弹窗 -->
  42. <pet-service-popup :show="popupVisible" :orderData="currentOrder" @close="closeServicePopup" ref="servicePopupRef" />
  43. </template>
  44. <script setup>
  45. import { onMounted, ref } from 'vue';
  46. import PetServicePopup from './petServicePopup.vue';
  47. const scrolltolower = () => {
  48. }
  49. onMounted(() => {
  50. console.log(props)
  51. })
  52. const props = defineProps({
  53. list: {
  54. type: Array,
  55. required: true
  56. },
  57. current: {
  58. type: Number,
  59. required: true
  60. }
  61. });
  62. const orderStatus = ['待接单','进行中','已完成']
  63. // 弹窗相关状态
  64. const popupVisible = ref(false);
  65. const currentOrder = ref(null);
  66. const servicePopupRef = ref(null);
  67. function toClock(item) {
  68. item.h5OrderVO.orderItemList
  69. let itemID = 0
  70. if(item.h5OrderVO.orderServiceList && item.h5OrderVO.orderServiceList[0]){
  71. itemID = item.h5OrderVO.orderServiceList[0].id
  72. }
  73. const paths = [
  74. `/otherPages/myOrdersManage/clock/index?id=${item.orderId}&itemID=${itemID}`,
  75. `/otherPages/myOrdersManage/clock/index?id=${item.orderId}&itemID=${itemID}`,
  76. `/otherPages/myOrdersManage/clock/index?isRead=true&id=${item.orderId}&itemID=${itemID}`,
  77. ]
  78. uni.navigateTo({
  79. url: paths[item.orderStatus]
  80. })
  81. }
  82. // 显示服务时间弹窗
  83. function showServicePopup(item) {
  84. // 如果是已完成状态,直接跳转到打卡记录页面
  85. // if (item.orderStatus === 2) {
  86. // return toClock(item);
  87. // }
  88. // 显示弹窗并设置当前订单数据
  89. currentOrder.value = item;
  90. popupVisible.value = true;
  91. // 更新弹窗中的服务列表数据
  92. setTimeout(() => {
  93. if (servicePopupRef.value) {
  94. servicePopupRef.value.updateServiceList();
  95. }
  96. }, 100);
  97. }
  98. // 关闭服务时间弹窗
  99. function closeServicePopup() {
  100. popupVisible.value = false;
  101. }
  102. function toPet(item) {
  103. uni.navigateTo({
  104. url: "/otherPages/orderTakingManage/pet/index?id=" + item.orderId
  105. })
  106. }
  107. function toService(item) {
  108. uni.navigateTo({
  109. url: "/otherPages/myOrdersManage/service/index?id=" + item.orderId
  110. })
  111. }
  112. </script>
  113. <style scoped lang="scss">
  114. @import "../index";
  115. .empty-state {
  116. display: flex;
  117. flex-direction: column;
  118. align-items: center;
  119. justify-content: center;
  120. padding: 40rpx;
  121. }
  122. .empty-image {
  123. width: 200rpx;
  124. height: 200rpx;
  125. margin-bottom: 20rpx;
  126. }
  127. .empty-text {
  128. color: #999;
  129. font-size: 28rpx;
  130. }
  131. </style>