<template>
    <uni-card
        v-for="(item,index) in items"
        :key="item.saleid"
        :class="index % 2 === 0 ? 'card-even' : 'card-odd'"
        :extra="item.contractcode"
        :title="item.user_name"
        style="margin: 0;margin-bottom: 20px"
        @click="handleDetail(item)"
    >
        <view class="context">
            <view class="label">
                <text>货主:</text>
                <text>{{ item.companyname }}</text>
            </view>
            <view class="label">
                <text>发货仓库:</text>
                <text>{{ item.warehousename }}</text>
            </view>
            <view class="label">
                <text>订单金额:</text>
                <text>{{ formatPrice(item.contractmoney) }}</text>
            </view>
            <view class="label">
                <text>补差金额:</text>
                <text>{{ formatPrice(item.piaokou) }}</text>
            </view>
            <view class="label">
                <text>制单日期:</text>
                <text>{{ item.addDate }}</text>
            </view>
            <view class="label">
                <text>执行日期:</text>
                <text>{{ item.execDate }}</text>
            </view>
            <view class="label">
                <text>支付方式:</text>
                <text>{{ item.ispaynow }}</text>
            </view>
            <view class="label">
                <text>状态:</text>
                <text>{{ item.stateText }}</text>
            </view>
        </view>

    </uni-card>
</template>

<script setup>
import {defineOptions, defineProps, getCurrentInstance} from 'vue'
import UniCard from "../../../uni_modules/uni-card/components/uni-card/uni-card.vue";
import {formatPrice} from "../../../utils/utils";

defineOptions({
    name: "ListItem"
})

const {proxy} = getCurrentInstance()
const props = defineProps(['items'])
const handleDetail = (raw) => {
    // proxy.$tab.navigateTo(`/pages/work/FinancialApproval/OrderDetail?id=${raw.saleid}`)
}
</script>
