<!--
 * @Author: micky
 * @Date: 2024-08-13 19:19:02
 * @LastEditors: micky
 * @LastEditTime: 2024-08-27 00:08:10
 * @FilePath: \chargingpile-uniapp\src\bundle\pages\overhaul\module-replace-detail.vue
-->
<template>
    <w-page-common btnText="继续模块更换" @submit="handleSubmit" :needPadding="false">
        <view class="flex flex-col gap-[20rpx] pt-[20rpx]">
            <TCard title="基本信息">
                <view class="c-form-item-wrapper py-[16rpx]">
                    <view class="item">
                        <view>工单编号</view>
                        <view>{{ formData.orderNo }}</view>
                    </view>
                    <w-client-device-info :formData="formData" />
                    <view class="item">
                        <view>安装人</view>
                        <view>{{ formData.equipmentModel?.installationName }}</view>
                    </view>
                    <view class="item">
                        <view>安装时间</view>
                        <view>{{ formData.equipmentModel?.installationTime }}</view>
                    </view>
                </view>
            </TCard>
            <TCard title="模块更新明细">
                <view class="c-form-item-wrapper py-[16rpx]">
                    <view class="item">
                        <view>模块编号</view>
                        <view>{{ formData.equipmentModel?.modelNo }}</view>
                    </view>
                    <view class="item">
                        <view>品牌</view>
                        <view>{{ formData.equipmentModel?.brand }}</view>
                    </view>
                    <view class="item">
                        <view>更新次数</view>
                        <view>{{ formData.equipmentModel?.replaceFrequency }}</view>
                    </view>
                </view>
            </TCard>
        </view>
    </w-page-common>
</template>

<script setup lang="ts">
import { ref, unref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { apiOverhaulDetail } from '@/api/overhaul'

const formData = ref<any>({})
const orderId = ref('')
const handleSubmit = () => {
    uni.navigateTo({
        url: `/bundle/pages/scan/scan?type=1&id=${unref(orderId)}`
    })
}

const getDetail = async () => {
    const res = await apiOverhaulDetail({ id: unref(orderId) })
    formData.value = res
}

onLoad(options => {
    orderId.value = options.id as string
})
onShow(() => {
    getDetail()
})
</script>
<style scoped lang="scss"></style>
