<template>
  <view>
    <view class="card_form">
      <!-- <hs-cell title="工单编号" :value="useModel?.formData?.value?.code" /> -->
      <!-- <hs-cell borderTop title="工单标题" :value="useModel?.formData?.value?.title" /> -->
      <hs-radio-cell-picker :Enums="useModel?.HouseWorkOrdersStatusItemEnum?.value" title="工单状态" borderTop
        v-model:valueModel="useModel.formData.value.status" required />
      <hs-cell-textarea borderTop :title="useModel.formData.value.status === 'Completed' ? '备注说明' : '进度说明'" required
        :placeholder="useModel.formData.value.status === 'Completed'
          ? '请详细描述情况，包括具体位置现象等'
          : '请输入进度说明'
          " v-model:valueModel="useModel.formData.value.description" />
      <!-- <hs-upload borderTop title="上传图片" :count="6" v-model:valueModel="useModel.formData.value.attachments" /> -->
      <hs-upload borderTop :title="useModel.formData.value.status === 'Completed' ? '完工图片' : '上传图片'"
        :required="useModel.formData.value.status === 'Completed'" :count="6"
        v-model:valueModel="useModel.formData.value.attachments" />
    </view>
    <view class="card_form" v-if="
      useModel.formData.value.status === 'Completed' &&
      useModel.formData.value.location === 'MyHome'
    ">
      <hs-cell title="是否产生费用" required>
        <hs-radio v-model:valueModel="useModel.formData.value.is_fee"
          :Enums="useModel?.HouseWorkOrdersCostEnum?.value" />
      </hs-cell>
      <template v-if="useModel.formData.value.is_fee === '1'">
        <hs-cell title="费用金额" required borderTop>
          <hs-input v-model:valueModel="useModel.formData.value.amount" type="number" placeholder="请输入费用金额"
            textAlign="right" suffix="元" />
        </hs-cell>
        <hs-radio-picker-accounts title="收款账号" required borderTop
          v-model:valueModel="useModel.formData.value.company_project_receipt_accounts_id"
          :params="useModel.formData.value" />
      </template>
    </view>
    <hs-footer btnParimaryName="提交" @handleParmaryClick="method?.handleSubmit" />
  </view>
</template>

<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app'
import method from './method'
import useModel from './model'

onLoad(e => {
  method?.init(e)
})
</script>

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