<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.price }}</text>
					</view>
				</view>
				<view class="container-list">
					<view class="flex-between flex mb28">
						<up-image style="flex-shrink:0" class="mr20" width="70px" height="70px"
							src="https://cdn.catmdogd.com/Work/image/work/tx.png" shape="circle"></up-image>
						<view>
							<view class="font28 col3">服务天数: 共{{ item.orderServiceTime }}天 I {{ item.orderServiceDate }}
							</view>
							<view style="margin: 18rpx 0">期望上门时间：早</view>
							<view>中华田园犬(小型犬) | 专业喂养+提前熟悉+陪玩</view>
						</view>
					</view>
					<view class="mb28 address">{{ item.orderVisitAddress }}</view>
					<view class="mb28">订单为系统派发，请确认订单信息后再抢单</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[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>