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

156 lines
3.9 KiB

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