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

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