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

222 lines
6.6 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 class="" style="margin-top: 10rpx;">{{ pet.breed }}({{ pet.bodyType }}) | {{ 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="btm">
  34. <view class="mb28 address" style="font-size: 26rpx;">{{ item.address }}</view>
  35. <view class="mb28" style="padding-left: 20rpx;font-size: 26rpx;"
  36. v-if="item.type == 0">订单为系统派发请确认订单信息后再抢单</view>
  37. <view class="flex flex-between" v-if="item.status != 2">
  38. <up-button @click="unableToAcceptOrder(item.id)" text="无法接单" shape="circle" plain
  39. class="mr20"></up-button>
  40. <up-button @click="toOrderDetail(item.id)" type="primary" text="查看详情后接单" shape="circle"
  41. color="#FFAA48"></up-button>
  42. </view>
  43. <!-- <view class="flex flex-between" v-if="item.status == 2">
  44. <up-button @click="toOrderDetail(item.id)" type="primary" text="查看派单详情" shape="circle"
  45. color="#FFAA48"></up-button>
  46. </view> -->
  47. </view>
  48. </view>
  49. </up-list-item>
  50. </up-list>
  51. <Modal @confirm="confirm" @cancel="cancel" ref="modal">
  52. <template>
  53. <view class="tip">
  54. 确认要拒绝该系统派单的订单吗?
  55. </view>
  56. </template>
  57. </Modal>
  58. <up-popup :show="showCause" mode="bottom" @close="close" @open="open" :round="10" :closeable="true"
  59. :safeAreaInsetBottom="false" :customStyle="{ padding: '60rpx 20rpx 40rpx 20rpx;position:relative;height:auto;' }">
  60. <view>
  61. <view style="position:absolute;top: 20rpx;text-align: center;width: 100%;">
  62. 请补充无法接单原因
  63. </view>
  64. <view style="margin: 20rpx 0rpx;">
  65. <up-textarea style="background-color: #f0f0f0;" v-model="cause" placeholder="请输入内容"
  66. border="none"></up-textarea>
  67. </view>
  68. <up-button @click="noneOrder" color="#FFBF60" text="提交" shape="circle"></up-button>
  69. </view>
  70. </up-popup>
  71. </template>
  72. <script setup>
  73. import {
  74. computed,
  75. ref
  76. } from "vue";
  77. import Modal from "@/components/Modal/index.vue"
  78. import {
  79. endByOrderId
  80. } from "@/api/receivingHall/index.js"
  81. import { useStore } from "vuex"
  82. const modal = ref(null);
  83. const showCause = ref(false);
  84. const cause = ref("");
  85. const id = ref(0);
  86. const store = useStore();
  87. const userInfo = computed(() => {
  88. return store.getters.userInfo
  89. })
  90. const partnerMaster = computed(() => {
  91. const { userHh } = userInfo.value
  92. if (!userHh) {
  93. return ''
  94. }
  95. const key = `partner_${LEVEL_AND_KEY_FIELDS_MAPPING[userHh]}`
  96. return configList.value?.[key]?.paramValueImage
  97. })
  98. const scrolltolower = () => {
  99. }
  100. const props = defineProps({
  101. orderList: {
  102. type: Array,
  103. default: () => []
  104. },
  105. current: {
  106. type: Number,
  107. required: true
  108. }
  109. })
  110. const emits = defineEmits(['update']);
  111. // 跳转订单详情
  112. const toOrderDetail = (id) => {
  113. if(checkUserBcs()) return
  114. uni.navigateTo({
  115. url: `/otherPages/orderTakingManage/detail/index?id=${id}`
  116. });
  117. }
  118. const confirm = () => {
  119. open();
  120. }
  121. const cancel = () => {
  122. }
  123. function checkUserBcs(){
  124. const { userBcs, userBcsRole } = userInfo.value
  125. if(userBcs == 0){
  126. uni.showModal({
  127. title: '完成伴宠师认证认证后在进行操作!',
  128. content: '当前无法操作,如果您已经提交伴宠师认证,请耐心等待',
  129. confirmText: '去查看',
  130. success(res) {
  131. if(res.confirm){
  132. uni.navigateTo({
  133. url: "/otherPages/authentication/list/index"
  134. })
  135. }
  136. }
  137. })
  138. return true
  139. }
  140. return false
  141. }
  142. const unableToAcceptOrder = (currentId) => {
  143. if(checkUserBcs()) return
  144. modal.value.open();
  145. id.value = currentId;
  146. }
  147. const open = () => {
  148. showCause.value = true;
  149. }
  150. const close = () => {
  151. showCause.value = false;
  152. }
  153. // 无法接单逻辑
  154. const noneOrder = async () => {
  155. if (!id.value || !userInfo.value.userId) return
  156. if (!cause.value) {
  157. return uni.showToast({
  158. title: '提交无法接单原因成功~',
  159. icon: "none"
  160. })
  161. }
  162. let response = await endByOrderId({
  163. id: id.value,
  164. reason: cause.value,
  165. userId: userInfo.value.userId
  166. });
  167. if (response.code == 200 && response.data) {
  168. uni.showToast({
  169. title: '提交无法接单原因成功~',
  170. icon: "none"
  171. });
  172. emits('update');
  173. close();
  174. }
  175. }
  176. </script>
  177. <style scoped lang="scss">
  178. @import "../index";
  179. .tip {
  180. text-align: center;
  181. padding: 25rpx 0rpx;
  182. }
  183. .text-ellipsis{
  184. overflow:hidden;
  185. white-space: nowrap;
  186. text-overflow: ellipsis;
  187. -o-text-overflow:ellipsis;
  188. }
  189. </style>