puzhibing
2026-08-28 e92cd56bb56b111c1afe9922191f9897215ff6b0
yuyueMiniProgram/src/pages/appointment/index.vue
@@ -40,6 +40,8 @@
  RESPONDENT: 'respondent',
  VISIT_REASON: 'visit_reason',
  VISIT_START_TIME: 'visit_start_time',
  LICENSE_PLATE: 'license_plate',
  DRIVER: 'driver',
} as const
interface AppointmentVehicle {
@@ -93,6 +95,10 @@
const isVisitReasonRequired = computed(() => isFieldRequired(APPOINTMENT_FIELD_CODES.VISIT_REASON, true))
const isRespondentRequired = computed(() => isFieldRequired(APPOINTMENT_FIELD_CODES.RESPONDENT, true))
const isVisitTimeRequired = computed(() => isFieldRequired(APPOINTMENT_FIELD_CODES.VISIT_START_TIME, true))
const showVehicleEntryOption = computed(() =>
  isFieldVisible(APPOINTMENT_FIELD_CODES.LICENSE_PLATE, true)
  || isFieldVisible(APPOINTMENT_FIELD_CODES.DRIVER, true),
)
const showCustomReasonInput = computed(() => Boolean(selectedVisitReason.value))
const showReasonPicker = ref(false)
const appointmentIcons = {
@@ -124,6 +130,14 @@
    return defaultValue
  }
  return config.requiredFlag === 1
}
function isFieldVisible(fieldCode: string, defaultValue = true) {
  const config = findFieldConfig(fieldCode)
  if (!config) {
    return defaultValue
  }
  return config.visible === 1
}
function handlePlateCharClick(vehicleIndex: number, charIndex: number) {
@@ -190,6 +204,10 @@
  if (lastFilledIndex < 7) {
    focusNextPlateChar(vehicleIndex, lastFilledIndex + 1)
  }
}
function handleIntervieweeInput(e: any) {
  formData.interviewee = e?.detail?.value || ''
}
function handlePlateDelete(vehicleIndex: number, charIndex: number) {
@@ -954,6 +972,9 @@
async function loadFieldConfigs() {
  try {
    fieldConfigs.value = await fetchMiniFieldConfigs()
    if (!showVehicleEntryOption.value) {
      handleVehicleEntryChange(false)
    }
  }
  catch (error) {
    fieldConfigs.value = []
@@ -1307,6 +1328,15 @@
  },
)
watch(
  showVehicleEntryOption,
  (visible) => {
    if (!visible) {
      handleVehicleEntryChange(false)
    }
  },
)
onLoad((options) => {
  uni.$on('selectVisitors', handleVisitorSelection)
  rebookOrderId.value = options?.rebookOrderId ? Number(options.rebookOrderId) : null
@@ -1368,15 +1398,24 @@
        class="mb-[48rpx] rounded-[16rpx] bg-white pl-[32rpx] pr-[12rpx] py-[8rpx] shadow-[0px_4px_8px_0px_rgba(6,47,108,0.1608)]">
        <wd-form :model="formData">
          <!-- 被访人 -->
          <wd-input v-model="formData.interviewee" placeholder="请输入要拜访谁" align="right" custom-class="custom-cell"
            placeholder-class="custom-placeholder">
            <template #label>
              <view class="inline-flex items-start">
                <text class="text-[28rpx] text-[#333333]">被访人</text>
                <text v-if="isRespondentRequired" class="text-[24rpx] text-[#FF4D4F] ml-[4rpx] mt-[-4rpx]">*</text>
              </view>
            </template>
          </wd-input>
          <view class="custom-cell flex items-center justify-between">
            <view class="inline-flex items-start shrink-0">
              <text class="text-[28rpx] text-[#333333]">被访人</text>
              <text v-if="isRespondentRequired" class="text-[24rpx] text-[#FF4D4F] ml-[4rpx] mt-[-4rpx]">*</text>
            </view>
            <input
              :value="formData.interviewee"
              type="text"
              placeholder="请输入要拜访谁"
              placeholder-class="text-[#B3B3B3]"
              class="ml-[32rpx] h-[64rpx] flex-1 text-right text-[28rpx] text-[#333333]"
              confirm-type="search"
              :adjust-position="true"
              :cursor-spacing="120"
              @input="handleIntervieweeInput"
              @confirm="handleSearchVisitedUser"
            />
          </view>
          <view v-if="selectedVisitedUser" class="px-[20rpx] pb-[16rpx] text-right text-[22rpx] text-[#999999]">
            已选:{{ selectedVisitedUser.realName }}{{ selectedVisitedUser.deptName ? ` / ${selectedVisitedUser.deptName}` : '' }}
          </view>
@@ -1517,14 +1556,14 @@
                </view>
                <text class="ml-[12rpx] text-[28rpx] text-[#999999]">人员进场</text>
              </view>
              <view class="flex items-center" @click="handleVehicleEntryChange(!formData.vehicleEntry)">
              <view v-if="showVehicleEntryOption" class="flex items-center" @click="handleVehicleEntryChange(!formData.vehicleEntry)">
                <view
                  class="flex items-center justify-center w-[28rpx] h-[28rpx] rounded-full border-[2rpx] border-solid transition-colors duration-200"
                  :class="formData.vehicleEntry ? 'border-[#1677FF]' : 'border-[#CFCFCF]'">
                  <view v-if="formData.vehicleEntry" class="w-[16rpx] h-[16rpx] rounded-full bg-[#1677FF]">
                  </view>
                </view>
                <text class="ml-[12rpx] text-[28rpx]" :class="formData.vehicleEntry ? 'text-[#333333]' : 'text-[#999999]'">车辆进场</text>
                <text class="ml-[12rpx] text-[28rpx]" :class="formData.vehicleEntry ? 'text-[#333333]' : 'text-[#999999]'">接送货</text>
              </view>
            </view>
          </view>