Files
cz-web/src/views/demand/cpns/DemandConfirmForm.vue
2026-10-16 17:01:17 +08:00

171 lines
3.7 KiB
Vue

<script setup lang="ts">
import { computed } from 'vue'
import type { Demand } from '@/types/business/demand'
interface Props {
demand: Demand
}
const props = defineProps<Props>()
const emit = defineEmits<{ update: [partial: Partial<Demand>] }>()
const REMARK_MAX = 500
const remarkLength = computed(() => props.demand.supplementaryRemarks.length)
function onUserName(event: Event): void {
emit('update', { userName: (event.target as HTMLInputElement).value })
}
function onUserPhone(event: Event): void {
emit('update', { userPhone: (event.target as HTMLInputElement).value })
}
function onRemark(event: Event): void {
emit('update', {
supplementaryRemarks: (event.target as HTMLTextAreaElement).value,
})
}
</script>
<template>
<div class="demand-confirm">
<div class="demand-confirm__row">
<div class="demand-confirm__field">
<label class="demand-confirm__label" for="demand-user-name"
>用户名称</label
>
<input
id="demand-user-name"
class="demand-confirm__input"
type="text"
maxlength="30"
:value="props.demand.userName"
placeholder="请输入用户名称"
@input="onUserName"
disabled
/>
</div>
<div class="demand-confirm__field">
<label class="demand-confirm__label" for="demand-user-phone"
>用户手机号</label
>
<input
id="demand-user-phone"
class="demand-confirm__input"
type="tel"
maxlength="30"
:value="props.demand.userPhone"
placeholder="请输入用户手机号"
@input="onUserPhone"
disabled
/>
</div>
</div>
<div class="demand-confirm__field">
<label class="demand-confirm__label" for="demand-remark">补充备注</label>
<div class="demand-confirm__area">
<textarea
id="demand-remark"
class="demand-confirm__textarea"
:maxlength="REMARK_MAX"
:value="props.demand.supplementaryRemarks"
placeholder="其他需要说明的事项…"
@input="onRemark"
/>
<span class="demand-confirm__count"
>{{ remarkLength }}/{{ REMARK_MAX }}字</span
>
</div>
</div>
</div>
</template>
<style lang="less" scoped>
.demand-confirm {
.flex(column, flex-start, stretch);
gap: 0;
width: 1605px;
&__row {
.flex(row, flex-start, flex-start);
gap: 73px;
}
&__field {
.flex(column, flex-start, stretch);
gap: 14px;
min-width: 0;
}
&__row &__field {
flex: 0 0 503px;
}
&__row + &__field {
margin-top: 30px;
}
&__label {
font-size: @font-size-base;
font-weight: 500;
line-height: 1.4;
color: @demand-heading;
}
&__input {
.text-control();
height: 40px;
padding: 0 @spacing-base;
border-color: @border-color;
border-radius: @radius-sm;
font-size: @font-size-base;
color: @demand-ink;
&::placeholder {
font-weight: 400;
color: @text-color-disabled;
}
&:disabled {
background-color: @input-bg;
color: @text-color-disabled;
cursor: not-allowed;
}
}
&__area {
position: relative;
width: 100%;
}
&__textarea {
.text-control();
height: 160px;
min-height: 160px;
padding: @spacing-base;
border-color: @border-color;
border-radius: @radius-sm;
font-size: @font-size-base;
color: @demand-ink;
line-height: 1.5;
resize: vertical;
&::placeholder {
font-weight: 400;
color: @text-color-disabled;
}
}
&__count {
position: absolute;
right: @spacing-base;
bottom: @spacing-sm;
font-size: @font-size-sm;
color: @text-color-disabled;
}
}
</style>