<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.usernames"
        style="margin: 0;margin-bottom: 20px"
        @click="handleDetail(item)"
    >
        <view class="context">
            <view class="label">
                <text>状态:</text>
                <text>{{ item.stateText }}</text>
            </view>
            <view class="label">
                <text>制单日期:</text>
                <text>{{ formatDate(item.adddate, 'yyyy-MM-dd') }}</text>
            </view>

            <view class="label">
                <text>支付方式:</text>
                <text>{{ item.creditperiods > 0 ? '非现款' : '现款' }}</text>
            </view>
            <view class="label">
                <text>区域:</text>
                <text>{{ item.areaName }}</text>
            </view>

            <view class="label">
                <text>订单金额:</text>
                <text>{{ formatPrice(item.contractmoney) }}</text>
            </view>
            <view class="label">
                <text>补差金额:</text>
                <text>{{ formatPrice(item.disCount) }}</text>
            </view>

            <view class="label">
                <text>账期核查状态:</text>
                <text>
                    <dict-tag :options="bus_acperiod_state" :value="item.acPeriodState"/>
                </text>
            </view>
            <view class="label">
                <text>额度状态:</text>
                <text>
                    <dict-tag :options="bus_isrush_state" :value="item.isRush"/>
                </text>
            </view>

            <view class="label">
                <text>OA推送状态:</text>
                <text>{{ item.oaStateText }}</text>
            </view>
            <view class="label">
                <text>OA流程编号:</text>
                <text>{{ item.oaCode }}</text>
            </view>

            <view class="label">
                <text>本月/下月:</text>
                <text>{{ item.actioninfo }}</text>
            </view>
            <view class="label">
                <text>商务经理:</text>
                <text>{{ item.businessManagerName }}</text>
            </view>

        </view>

    </uni-card>
</template>

<script setup>
import {defineOptions, defineProps, getCurrentInstance} from 'vue'
import {formatDate} from "../../../uni_modules/uni-dateformat/components/uni-dateformat/date-format";
import UniCard from "../../../uni_modules/uni-card/components/uni-card/uni-card.vue";
import {formatPrice} from "../../../utils/utils";
import DictTag from "../../../components/dict-tag/dict-tag.vue";

defineOptions({
    name: "ListItem"
})

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

<style lang="scss" scoped>

</style>