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

153 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="btnTexts[item.orderStatus]" @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 btnTexts = ['打卡', '打卡', '打开记录']
  63. const orderStatus = ['待接单','进行中','已完成']
  64. // 弹窗相关状态
  65. const popupVisible = ref(false);
  66. const currentOrder = ref(null);
  67. const servicePopupRef = ref(null);
  68. function toClock(item) {
  69. item.h5OrderVO.orderItemList
  70. let itemID = 0
  71. if(item.h5OrderVO.orderServiceList && item.h5OrderVO.orderServiceList[0]){
  72. itemID = item.h5OrderVO.orderServiceList[0].id
  73. }
  74. const paths = [
  75. `/otherPages/myOrdersManage/clock/index?id=${item.orderId}&itemID=${itemID}`,
  76. `/otherPages/myOrdersManage/clock/index?id=${item.orderId}&itemID=${itemID}`,
  77. `/otherPages/myOrdersManage/clock/index?isRead=true&id=${item.orderId}&itemID=${itemID}`,
  78. ]
  79. uni.navigateTo({
  80. url: paths[item.orderStatus]
  81. })
  82. }
  83. // 显示服务时间弹窗
  84. function showServicePopup(item) {
  85. // 如果是已完成状态,直接跳转到打卡记录页面
  86. // if (item.orderStatus === 2) {
  87. // return toClock(item);
  88. // }
  89. // 显示弹窗并设置当前订单数据
  90. currentOrder.value = item;
  91. popupVisible.value = true;
  92. // 更新弹窗中的服务列表数据
  93. setTimeout(() => {
  94. if (servicePopupRef.value) {
  95. servicePopupRef.value.updateServiceList();
  96. }
  97. }, 100);
  98. }
  99. // 关闭服务时间弹窗
  100. function closeServicePopup() {
  101. popupVisible.value = false;
  102. }
  103. function toPet(item) {
  104. uni.navigateTo({
  105. url: "/otherPages/orderTakingManage/pet/index?id=" + item.orderId
  106. })
  107. }
  108. function toService(item) {
  109. uni.navigateTo({
  110. url: "/otherPages/myOrdersManage/service/index?id=" + item.orderId
  111. })
  112. }
  113. </script>
  114. <style scoped lang="scss">
  115. @import "../index";
  116. .empty-state {
  117. display: flex;
  118. flex-direction: column;
  119. align-items: center;
  120. justify-content: center;
  121. padding: 40rpx;
  122. }
  123. .empty-image {
  124. width: 200rpx;
  125. height: 200rpx;
  126. margin-bottom: 20rpx;
  127. }
  128. .empty-text {
  129. color: #999;
  130. font-size: 28rpx;
  131. }
  132. </style>