127 lines
3.1 KiB
Vue
127 lines
3.1 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"
|
|
>
|
|
</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"
|
|
>
|
|
</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: @spacing-lg;
|
|
|
|
&__row {
|
|
.flex(row, flex-start, stretch);
|
|
gap: @spacing-base;
|
|
}
|
|
|
|
&__field {
|
|
.flex(column, flex-start, stretch);
|
|
flex: 1 1 50%;
|
|
gap: @spacing-sm;
|
|
min-width: 0;
|
|
}
|
|
|
|
&__label {
|
|
font-size: @font-size-base;
|
|
font-weight: 600;
|
|
color: @heading-color;
|
|
}
|
|
|
|
&__input {
|
|
.text-control();
|
|
height: 36px;
|
|
}
|
|
|
|
&__area {
|
|
position: relative;
|
|
width: 100%;
|
|
}
|
|
|
|
&__textarea {
|
|
.text-control();
|
|
min-height: 132px;
|
|
padding: @spacing-sm @spacing-base 24px;
|
|
line-height: 1.7;
|
|
resize: vertical;
|
|
}
|
|
|
|
&__count {
|
|
position: absolute;
|
|
right: @spacing-sm;
|
|
bottom: @spacing-xs;
|
|
font-size: @font-size-sm;
|
|
color: @text-color-secondary;
|
|
}
|
|
}
|
|
</style>
|