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

261 lines
7.7 KiB

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