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

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