From 644d4f695a7e03c54a8673af954f92f53af08e7c Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期五, 07 三月 2025 13:49:25 +0800
Subject: [PATCH] release: @life-payment/components v0.0.5

---
 packages/components/src/views/electricBillRecharge/electricBillRecharge.vue |   95 +++++++++++++++++++++++++++++++----------------
 1 files changed, 62 insertions(+), 33 deletions(-)

diff --git a/packages/components/src/views/electricBillRecharge/electricBillRecharge.vue b/packages/components/src/views/electricBillRecharge/electricBillRecharge.vue
index 7c08c14..5efa31d 100644
--- a/packages/components/src/views/electricBillRecharge/electricBillRecharge.vue
+++ b/packages/components/src/views/electricBillRecharge/electricBillRecharge.vue
@@ -1,18 +1,27 @@
 <template>
-  <Form
+  <NutForm
     :model-value="form"
     ref="formRef"
     :rules="rules"
     label-position="top"
     class="order-bill-recharge electric"
   >
-    <FormItem label="鎵�鍦ㄥ煄甯�" class="bole-form-item" prop="province" required>
+    <FormItem label="鎵�鍦ㄥ尯鍩�" class="bole-form-item" prop="province" required>
       <ChooseInputWithPicker
         v-model="form.province"
-        placeholder="璇烽�夋嫨鍩庡競"
+        placeholder="璇烽�夋嫨鍖哄煙"
         :value-enum="electricParValueList"
-        enum-label-key="areaName"
-        enum-value-key="areaName"
+        enum-label-key="cityName"
+        enum-value-key="cityName"
+      />
+    </FormItem>
+    <FormItem label="鎵�鍦ㄥ煄甯�" class="bole-form-item" prop="city" required v-if="form.province">
+      <ChooseInputWithPicker
+        v-model="form.city"
+        placeholder="璇烽�夋嫨鍩庡競"
+        :value-enum="electricCityList"
+        enum-label-key="cityName"
+        enum-value-key="cityName"
       />
     </FormItem>
     <!-- <FormItem label="鐢电綉绫诲瀷" class="bole-form-item" prop="electricType" required>
@@ -30,11 +39,11 @@
       />
     </FormItem>
     <FormItem label="鐢电綉鎴峰彿" class="bole-form-item" prop="electricAccount" required>
-      <Input
+      <NumberInput
         v-model.trim="form.electricAccount"
         class="bole-input-text"
         placeholder="璇疯緭鍏�13浣嶆暟瀛楃紪鍙�"
-        type="text"
+        max-length="13"
       />
     </FormItem>
     <FormItem
@@ -44,16 +53,23 @@
       prop="sixID"
       required
     >
-      <Input
+      <NutInput
         v-model.trim="form.sixID"
         class="bole-input-text"
         placeholder="璇疯緭鍏ヨ韩浠借瘉鍚庡叚浣�"
         type="text"
+        max-length="6"
       />
     </FormItem>
-    <FormItem label="閫夋嫨鍏呭�奸噾棰�" class="bole-form-item" prop="parValue" required>
-      <RadioGroup v-model="form.parValue" direction="horizontal" class="parValue-radio-group">
-        <Radio
+    <FormItem
+      v-if="!!form.province"
+      label="閫夋嫨鍏呭�奸噾棰�"
+      class="bole-form-item"
+      prop="parValue"
+      required
+    >
+      <NutRadioGroup v-model="form.parValue" direction="horizontal" class="parValue-radio-group">
+        <NutRadio
           :label="Number(item)"
           :key="item"
           shape="button"
@@ -73,13 +89,13 @@
             </div>
             <div class="discountTag">{{ lifePayElectricRate * 100 }}鎶�</div>
           </div>
-        </Radio>
-      </RadioGroup>
+        </NutRadio>
+      </NutRadioGroup>
     </FormItem>
     <div class="common-content">
       <nut-button class="recharge-button" type="primary" @click="handleSubmit">
         <div class="recharge-button-inner">
-          <div>锟{ form.parValue }}</div>
+          <div>锟{ realParValue }}</div>
           <div class="recharge-button-text">绔嬪嵆鍏呭��</div>
         </div>
       </nut-button>
@@ -90,7 +106,10 @@
         璇ヤ骇鍝佷负鎱㈠厖妯″紡锛�0-72灏忔椂鍐呭埌璐︼紝浠嬫剰璇峰嬁浠樻锛佸厖鍊煎墠璇蜂粩缁嗛槄璇诲厖鍊奸』鐭ワ紒
       </template>
       <template #info>
-        <ConfirmDialogInfoItem label="鐢电綉绫诲瀷" content="鍥藉鐢电綉" />
+        <ConfirmDialogInfoItem
+          label="鐢电綉绫诲瀷"
+          :content="blLifeRecharge.constants.ElectricTypeText[form.electricType]"
+        />
         <ConfirmDialogInfoItem label="鐢佃垂绫诲瀷" content="浣忓畢" />
         <ConfirmDialogInfoItem label="鍏呭�奸噾棰�" :content="`锟�${form.parValue.toFixed(2)}`" danger />
         <ConfirmDialogInfoItem label="浼樻儬閲戦" :content="`锟�${discountParValue.toFixed(2)}`" />
@@ -100,11 +119,18 @@
         鍚屼竴鐢佃垂璐︽埛鍦ㄥ厖鍊兼湡闂达紝鏈埌璐﹀墠鍒囧嬁鍦ㄥ叾浠栦换浣曞钩鍙板啀娆″厖鍊笺�傚洜姝ら�犳垚鐨勮祫閲戞崯澶遍』鐢ㄦ埛鑷鎵挎媴锛侊紒锛�
       </template>
     </ConfirmDialog>
-  </Form>
+  </NutForm>
 </template>
 
 <script setup lang="ts">
-import { Form, FormItem, RadioGroup, Radio, Input, Button as NutButton } from '@nutui/nutui-taro';
+import {
+  Form as NutForm,
+  FormItem,
+  RadioGroup as NutRadioGroup,
+  Radio as NutRadio,
+  Input as NutInput,
+  Button as NutButton,
+} from '@nutui/nutui-taro';
 import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types';
 import { reactive, ref, computed, watch } from 'vue';
 import {
@@ -116,6 +142,7 @@
 import ConfirmDialog from '../../components/Dialog/ConfirmDialog.vue';
 import ConfirmDialogInfoItem from '../../components/Dialog/ConfirmDialogInfoItem.vue';
 import ChooseInputWithPicker from '../../components/Input/ChooseInputWithPicker.vue';
+import NumberInput from '../../components/Input/NumberInput.vue';
 import { useGetRate, useGetElectricParValue } from '../../hooks';
 import { FormValidator } from '../../utils';
 
@@ -141,6 +168,7 @@
   electricType: '',
   electricAccountType: '',
   province: '',
+  city: '',
   sixID: '',
 });
 
@@ -148,14 +176,18 @@
 const { electricParValueList } = useGetElectricParValue();
 
 const parValueList = computed(
-  () => electricParValueList.value.find((x) => x.areaName === form.province)?.parValue ?? []
+  () => electricParValueList.value.find((x) => x.cityName === form.province)?.parValue ?? []
+);
+
+const electricCityList = computed(
+  () => electricParValueList.value.find((x) => x.cityName === form.province)?.childCityList ?? []
 );
 
 watch(
   () => form.province,
   (provinceName) => {
     const electricParValue = electricParValueList.value.find(
-      (item) => item.areaName === provinceName
+      (item) => item.cityName === provinceName
     );
     form.electricType = electricParValue.electricType;
   }
@@ -169,9 +201,17 @@
 const { blLifeRecharge } = useLifeRechargeContext();
 
 const rules = reactive<FormRules>({
+  province: [{ required: true, message: '璇烽�夋嫨鎵�鍦ㄥ尯鍩�' }],
+  city: [{ required: true, message: '璇烽�夋嫨鎵�鍦ㄥ煄甯�' }],
   electricAccountType: [{ required: true, message: '璇烽�夋嫨鐢佃垂绫诲瀷' }],
-  electricAccount: [{ required: true, message: '璇疯緭鍏ョ數缃戞埛鍙�' }],
-  sixID: [{ required: true, message: '璇疯緭鍏ヨ韩浠借瘉鍚庡叚浣�' }],
+  electricAccount: [{ required: true, message: '璇疯緭鍏ョ數缃戞埛鍙�', regex: /^\d{13}$/ }],
+  sixID: [
+    {
+      required: true,
+      message: '璇疯緭鍏ヨ韩浠借瘉鍚庡叚浣�',
+      validator: FormValidator.validatorIDNumberSix,
+    },
+  ],
   parValue: [
     { required: true, message: '璇烽�夋嫨鍏呭�奸噾棰�', validator: FormValidator.validatorNumberNotNull },
   ],
@@ -212,7 +252,7 @@
         electricAccountType: form.electricAccountType,
         electricAccount: form.electricAccount,
         province: form.province,
-        city: '',
+        city: form.city,
         sixID: form.sixID,
       },
     };
@@ -221,14 +261,3 @@
   } catch (error) {}
 }
 </script>
-<style lang="scss">
-.order-bill-recharge {
-  &.electric {
-    .nut-dialog {
-      .nut-dialog__content {
-        max-height: 700px;
-      }
-    }
-  }
-}
-</style>

--
Gitblit v1.9.1