From 07d73df3d817d01ce47f6c7b7a8d8514cd389295 Mon Sep 17 00:00:00 2001 From: zhengyiming <540361168@qq.com> Date: 星期四, 13 三月 2025 10:19:44 +0800 Subject: [PATCH] release: @life-payment/core v0.0.3 --- packages/components/src/views/GasBillRecharge/GasBillRechargeBaseForm.vue | 65 ++++++++++++++++++++++++++++++++ 1 files changed, 65 insertions(+), 0 deletions(-) diff --git a/packages/components/src/views/GasBillRecharge/GasBillRechargeBaseForm.vue b/packages/components/src/views/GasBillRecharge/GasBillRechargeBaseForm.vue new file mode 100644 index 0000000..010949a --- /dev/null +++ b/packages/components/src/views/GasBillRecharge/GasBillRechargeBaseForm.vue @@ -0,0 +1,65 @@ +<template> + <NutForm + :model-value="form" + ref="formRef" + :rules="rules" + label-position="top" + class="order-bill-recharge electric" + > + <slot name="top"></slot> + <NutFormItem label="鎵�鍦ㄥ煄甯�" class="bole-form-item" prop="areaList" required> + <ChooseInputWithAreaPicker + :columns="cityAreaTree" + v-model="form.areaList" + placeholder="璇烽�夋嫨鎵�鍦ㄥ煄甯�" + ></ChooseInputWithAreaPicker> + </NutFormItem> + <NutFormItem label="缂磋垂鎴峰彿" class="bole-form-item" prop="gasAccount" required> + <NutInput + v-model.trim="form.gasAccount" + class="bole-input-text" + placeholder="璇疯緭鍏ョ即璐规埛鍙�" + type="text" + max-length="13" + /> + </NutFormItem> + <slot></slot> + </NutForm> +</template> + +<script setup lang="ts"> +import { Form as NutForm, FormItem as NutFormItem, Input as NutInput } from '@nutui/nutui-taro'; +import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types'; +import { reactive, ref, computed, watch } from 'vue'; +import ChooseInputWithAreaPicker from '../../components/Input/ChooseInputWithAreaPicker.vue'; +import { useAllAreaList } from '../../hooks/area'; +import { FormValidator } from '../../utils'; + +defineOptions({ + name: 'GasBillRechargeBaseForm', +}); + +const { findAreaNameFromCode, cityAreaTree } = useAllAreaList(); + +const form = defineModel<{ + // province: string; + // city: string; + gasAccount: string; + areaList: string[]; +}>('form'); + +const rules = reactive<FormRules>({ + province: [{ required: true, message: '璇烽�夋嫨鎵�鍦ㄥ尯鍩�' }], + city: [{ required: true, message: '璇烽�夋嫨鎵�鍦ㄥ煄甯�' }], + gasAccount: [{ required: true, message: '璇疯緭鍏ョ即璐规埛鍙�', regex: /^\d{13}$/ }], + areaList: [ + { required: true, message: '璇烽�夋嫨鎵�鍦ㄥ煄甯�', validator: FormValidator.validatorArray }, + ], +}); + +const formRef = ref<any>(null); + +defineExpose({ + validate: computed(() => formRef.value.validate), +}); +</script> -- Gitblit v1.9.1