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

132 lines
3.8 KiB

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