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

170 lines
5.3 KiB

2 months ago
  1. <template>
  2. <up-list @scrolltolower="scrolltolower">
  3. <up-list-item v-for="item in orderList">
  4. <view class="mb28 container-list-item">
  5. <view class="flex-between flex" style="background: #FFF4E5;padding: 22rpx 42rpx">
  6. <view>
  7. <text v-if="current != 2">待接单</text>
  8. </view>
  9. <view>本单酬劳
  10. <text style="color: #FF530A">{{ item.orderGive }}</text>
  11. </view>
  12. </view>
  13. <view class="container-list">
  14. <view class="flex mb28" v-for="(pet, index) in item.h5OrderVO.petVOList">
  15. <up-image style="flex-shrink:0" class="mr20" width="70px" height="70px" :src="pet.photo"
  16. shape="circle"></up-image>
  17. <view>
  18. <view class="font28 col3">服务天数: {{ pet.orderServiceText.length }} I {{ pet.orderServiceText.join(',') }}</view>
  19. <!-- <view class="font28 col3">服务天数: {{ item.h5OrderVO.orderServiceList.length }} I
  20. <text v-for="itemService in item.h5OrderVO.orderServiceList" :key="itemService.id">
  21. {{ itemService.serviceDate }}
  22. </text>
  23. </view> -->
  24. <!-- <view style="margin: 18rpx 0">期望上门时间{{itemService.expectServiceTime}}</view> -->
  25. <view>{{ pet.breed }} | {{ pet.productNameText.join(',') }}
  26. <!-- <text v-for="itemPet in item.h5OrderVO.orderItemList" :key="itemPet.id">
  27. {{ itemPet.productName }}
  28. </text> -->
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="mb28 address">{{ item.address }}</view>
  34. <view class="mb28">订单为系统派发请确认订单信息后再抢单</view>
  35. <view class="flex flex-between">
  36. <up-button @click="unableToAcceptOrder(item.id)" text="无法接单" shape="circle" plain
  37. class="mr20"></up-button>
  38. <up-button @click="toOrderDetail(item.id)" type="primary" text="查看详情后接单" shape="circle"
  39. color="#FFAA48"></up-button>
  40. </view>
  41. </view>
  42. </up-list-item>
  43. </up-list>
  44. <Modal @confirm="confirm" @cancel="cancel" ref="modal">
  45. <template>
  46. <view class="tip">
  47. 确认要拒绝该系统派单的订单吗?
  48. </view>
  49. </template>
  50. </Modal>
  51. <up-popup :show="showCause" mode="bottom" @close="close" @open="open" :round="10" :closeable="true"
  52. :safeAreaInsetBottom="false" :customStyle="{ padding: '60rpx 20rpx 40rpx 20rpx;position:relative;height:auto;' }">
  53. <view>
  54. <view style="position:absolute;top: 20rpx;text-align: center;width: 100%;">
  55. 请补充无法接单原因
  56. </view>
  57. <view style="margin: 20rpx 0rpx;">
  58. <up-textarea style="background-color: #f0f0f0;" v-model="cause" placeholder="请输入内容"
  59. border="none"></up-textarea>
  60. </view>
  61. <up-button @click="noneOrder" color="#FFBF60" text="提交" shape="circle"></up-button>
  62. </view>
  63. </up-popup>
  64. </template>
  65. <script setup>
  66. import {
  67. computed,
  68. ref
  69. } from "vue";
  70. import Modal from "@/components/Modal/index.vue"
  71. import {
  72. endByOrderId
  73. } from "@/api/receivingHall/index.js"
  74. import { useStore } from "vuex"
  75. const modal = ref(null);
  76. const showCause = ref(false);
  77. const cause = ref("");
  78. const id = ref(0);
  79. const store = useStore();
  80. const userInfo = computed(() => {
  81. return store.getters.userInfo
  82. })
  83. const scrolltolower = () => {
  84. }
  85. const props = defineProps({
  86. orderList: {
  87. type: Array,
  88. default: () => []
  89. },
  90. current: {
  91. type: Number,
  92. required: true
  93. }
  94. })
  95. const emits = defineEmits(['update']);
  96. // 跳转订单详情
  97. const toOrderDetail = (id) => {
  98. uni.navigateTo({
  99. url: `/otherPages/orderTakingManage/detail/index?id=${id}`
  100. });
  101. }
  102. const confirm = () => {
  103. open();
  104. }
  105. const cancel = () => {
  106. }
  107. const unableToAcceptOrder = (currentId) => {
  108. modal.value.open();
  109. id.value = currentId;
  110. }
  111. const open = () => {
  112. showCause.value = true;
  113. }
  114. const close = () => {
  115. showCause.value = false;
  116. }
  117. // 无法接单逻辑
  118. const noneOrder = async () => {
  119. if (!id.value || !userInfo.value.userId) return
  120. if (!cause.value) {
  121. return uni.showToast({
  122. title: '提交无法接单原因成功~',
  123. icon: "none"
  124. })
  125. }
  126. let response = await endByOrderId({
  127. id: id.value,
  128. reason: cause.value,
  129. userId: userInfo.value.userId
  130. });
  131. if (response.code == 200 && response.data) {
  132. uni.showToast({
  133. title: '提交无法接单原因成功~',
  134. icon: "none"
  135. });
  136. emits('update');
  137. close();
  138. }
  139. }
  140. </script>
  141. <style scoped lang="scss">
  142. @import "../index";
  143. .tip {
  144. text-align: center;
  145. padding: 25rpx 0rpx;
  146. }
  147. </style>