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

200 lines
6.2 KiB

<template>
<up-list @scrolltolower="scrolltolower">
<up-list-item v-for="item in orderList">
<view class="mb28 container-list-item">
<view class="flex-between flex" style="background: #FFF4E5;padding: 22rpx 42rpx">
<view>
<text v-if="current != 2">待接单</text>
</view>
<view>本单酬劳
<text style="color: #FF530A">¥{{ item.orderGive }}</text>
</view>
</view>
<view class="container-list">
<view class="flex mb28" v-for="(pet, index) in item.h5OrderVO.petVOList">
<up-image style="flex-shrink:0" class="mr20" width="70px" height="70px" :src="pet.photo"
shape="circle"></up-image>
<view>
<view class="font28 col3">服务天数: 共{{ pet.orderServiceText.length }}天 I {{ pet.orderServiceText.join(',') }}</view>
<!-- <view class="font28 col3">服务天数: 共{{ item.h5OrderVO.orderServiceList.length }}天 I
<text v-for="itemService in item.h5OrderVO.orderServiceList" :key="itemService.id">
{{ itemService.serviceDate }}
</text>
</view> -->
<!-- <view style="margin: 18rpx 0">期望上门时间:{{itemService.expectServiceTime}}</view> -->
<view class="" style="margin-top: 10rpx;">{{ pet.breed }}({{ pet.bodyType }}) | {{ pet.productNameText.join(',') }}
<!-- <text v-for="itemPet in item.h5OrderVO.orderItemList" :key="itemPet.id">
{{ itemPet.productName }}
</text> -->
</view>
</view>
</view>
</view>
<view class="btm">
<view class="mb28 address" style="font-size: 26rpx;">{{ item.address }}</view>
<view class="mb28" style="padding-left: 20rpx;font-size: 26rpx;"
v-if="item.type == 0">订单为系统派发,请确认订单信息后再抢单</view>
<view class="flex flex-between" v-if="item.status != 2">
<up-button @click="unableToAcceptOrder(item.id)" text="无法接单" shape="circle" plain
class="mr20"></up-button>
<up-button @click="toOrderDetail(item.id)" type="primary" text="查看详情后接单" shape="circle"
color="#FFAA48"></up-button>
</view>
<!-- <view class="flex flex-between" v-if="item.status == 2">
<up-button @click="toOrderDetail(item.id)" type="primary" text="查看派单详情" shape="circle"
color="#FFAA48"></up-button>
</view> -->
</view>
</view>
</up-list-item>
</up-list>
<Modal @confirm="confirm" @cancel="cancel" ref="modal">
<template>
<view class="tip">
确认要拒绝该系统派单的订单吗?
</view>
</template>
</Modal>
<up-popup :show="showCause" mode="bottom" @close="close" @open="open" :round="10" :closeable="true"
:safeAreaInsetBottom="false" :customStyle="{ padding: '60rpx 20rpx 40rpx 20rpx;position:relative;height:auto;' }">
<view>
<view style="position:absolute;top: 20rpx;text-align: center;width: 100%;">
请补充无法接单原因
</view>
<view style="margin: 20rpx 0rpx;">
<up-textarea style="background-color: #f0f0f0;" v-model="cause" placeholder="请输入内容"
border="none"></up-textarea>
</view>
<up-button @click="noneOrder" color="#FFBF60" text="提交" shape="circle"></up-button>
</view>
</up-popup>
</template>
<script setup>
import {
computed,
ref
} from "vue";
import Modal from "@/components/Modal/index.vue"
import {
endByOrderId
} from "@/api/receivingHall/index.js"
import { useStore } from "vuex"
const modal = ref(null);
const showCause = ref(false);
const cause = ref("");
const id = ref(0);
const store = useStore();
const userInfo = computed(() => {
return store.getters.userInfo
})
const partnerMaster = computed(() => {
const { userHh } = userInfo.value
if (!userHh) {
return ''
}
const key = `partner_${LEVEL_AND_KEY_FIELDS_MAPPING[userHh]}`
return configList.value?.[key]?.paramValueImage
})
const scrolltolower = () => {
}
const props = defineProps({
orderList: {
type: Array,
default: () => []
},
current: {
type: Number,
required: true
}
})
const emits = defineEmits(['update']);
// 跳转订单详情
const toOrderDetail = (id) => {
console.log(userInfo.userBcs);
uni.navigateTo({
url: `/otherPages/orderTakingManage/detail/index?id=${id}`
});
}
const confirm = () => {
open();
}
const cancel = () => {
}
const unableToAcceptOrder = (currentId) => {
modal.value.open();
id.value = currentId;
}
const open = () => {
showCause.value = true;
}
const close = () => {
showCause.value = false;
}
// 无法接单逻辑
const noneOrder = async () => {
if (!id.value || !userInfo.value.userId) return
if (!cause.value) {
return uni.showToast({
title: '提交无法接单原因成功~',
icon: "none"
})
}
let response = await endByOrderId({
id: id.value,
reason: cause.value,
userId: userInfo.value.userId
});
if (response.code == 200 && response.data) {
uni.showToast({
title: '提交无法接单原因成功~',
icon: "none"
});
emits('update');
close();
}
}
</script>
<style scoped lang="scss">
@import "../index";
.tip {
text-align: center;
padding: 25rpx 0rpx;
}
.text-ellipsis{
overflow:hidden;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow:ellipsis;
}
</style>