<template>
	<up-list @scrolltolower="scrolltolower">
		<up-list-item>
			<view class="mb28 container-list-item" v-for="(item, index) in list" :key="item.id">
				<view class="flex-between flex" style="background: #FFF4E5;padding: 22rpx 42rpx">
					<view>{{ orderStatus[item.status] }}</view>
					<view>本单酬劳
						<text style="color: #FF530A">￥{{ item.orderGivePrice }}</text>
					</view>
				</view>
				<view class="container-list">
					<view class="flex-between 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 style="margin: 18rpx 0">期望上门时间：早</view>
							<view>{{ pet.breed }}{{ pet.bodyType }} | {{ pet.productNameText.join('+') }}</view>
						</view>
					</view>
					<view class="mb28 address">{{ item.address }}</view>
					<view class="mb28" v-if="item.type == 0">订单为系统派发，请确认订单信息后再抢单</view>
					<view class="flex flex-between">

						<up-button type="primary" v-if="true" :text="btnTexts[current]" @click="toClock(item.id)" shape="circle"
							class="mr20" color="#FFAA48"></up-button>

						<up-button type="primary" text="宠物档案" @click="toPet" shape="circle" class="mr20"
							color="#FFAA48"></up-button>

						<up-button type="primary" text="服务档案" @click="toService" shape="circle"
							color="#FFAA48"></up-button>
					</view>
				</view>
			</view>
		</up-list-item>
	</up-list>
</template>
<script setup>
import { onMounted } from 'vue';

	const scrolltolower = () => {

	}
	
	onMounted(() => {
		console.log(props)
	})

	const props = defineProps({
		list: {
			type: Array,
			required: true
		},
		current: {
			type: Number,
			required: true
		}
	});
	const btnTexts = ['订单详情', '打卡', '打开记录']
	const orderStatus = ['待接单','进行中','已完成']


	function toClock(id) {
		const paths = [`/otherPages/orderTakingManage/detail/index?id=${id}`,'/otherPages/myOrdersManage/clock/index','/otherPages/myOrdersManage/clock/detail']
		uni.navigateTo({
			url: paths[1],
			// url: paths[props.current]
		})
	}

	function toPet() {
		uni.navigateTo({
			url: "/otherPages/orderTakingManage/pet/index"
		})
	}

	function toService() {
		uni.navigateTo({
			url: "/otherPages/myOrdersManage/service/index"
		})
	}
</script>

<style scoped lang="scss">
	@import "../index";
</style>