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

152 lines
3.7 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. // 跳转订单详情
  87. const toOrderDetail = (id) => {
  88. uni.navigateTo({
  89. url: `/otherPages/orderTakingManage/detail/index?id=${id}`
  90. });
  91. }
  92. const confirm = () => {
  93. open();
  94. }
  95. const cancel = () => {
  96. }
  97. const unableToAcceptOrder = () => {
  98. modal.value.open();
  99. }
  100. const open = () => {
  101. showCause.value = true;
  102. }
  103. const close = () => {
  104. showCause.value = false;
  105. }
  106. // 无法接单逻辑
  107. const noneOrder = async () => {
  108. if (!cause.value) {
  109. return uni.showToast({
  110. title: '提交无法接单原因成功~',
  111. icon: "none"
  112. })
  113. }
  114. let response = await endByOrderId({
  115. id : id.value,
  116. reason : cause.value,
  117. userId : userInfo.value.userId
  118. });
  119. if (response.code == 200 && response.data) {
  120. uni.showToast({
  121. title: '提交无法接单原因成功~',
  122. icon: "none"
  123. });
  124. close();
  125. }
  126. }
  127. </script>
  128. <style scoped lang="scss">
  129. @import "../index";
  130. .tip {
  131. text-align: center;
  132. padding: 25rpx 0rpx;
  133. }
  134. </style>