From c24cdd854e258712408a7904bdb401c49e3f07c1 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期四, 28 八月 2025 13:09:08 +0800
Subject: [PATCH] fix: 修改通道充值提示语

---
 packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeStep2.vue |  180 +++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 118 insertions(+), 62 deletions(-)

diff --git a/packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeStep2.vue b/packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeStep2.vue
index 433e3ab..43e7e4c 100644
--- a/packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeStep2.vue
+++ b/packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeStep2.vue
@@ -6,67 +6,82 @@
     label-position="top"
     class="order-bill-recharge phone"
   >
-    <NutFormItem class="bole-form-item" prop="currentUserAccountId">
-      <NutRadioGroup
-        v-model="form.currentUserAccountId"
-        direction="horizontal"
-        class="par-account-list"
-        v-if="userAccountAllList.length > 0"
-        @change="handleUserAccountChange"
-      >
-        <NutRadio
-          :label="item.id"
-          shape="button"
-          v-for="item in userAccountAllList"
-          :key="item.id"
-          >{{ item.content }}</NutRadio
+    <Chunk borderRadiusSmall :hasPaddingBottom="false">
+      <NutFormItem class="bole-form-item user-account-form-item" prop="currentUserAccountId">
+        <NutRadioGroup
+          v-model="form.currentUserAccountId"
+          direction="horizontal"
+          class="par-account-list"
+          v-if="userAccountAllList.length > 0"
+          @change="_handleUserAccountChange"
         >
-      </NutRadioGroup>
-      <AccountCard
-        v-if="userAccountAllList.length > 0"
-        title="鍏呭�兼墜鏈哄彿"
-        :content="form.phone"
-        :remark="form.remark"
-      >
-        <template #action>
-          <div class="account-card-action" @click="handleAddUserAccount">鏂板</div>
-        </template>
-      </AccountCard>
-      <AccountAddCard v-else @click="handleAddUserAccount" />
-    </NutFormItem>
+          <NutRadio
+            :label="item.id"
+            shape="button"
+            v-for="item in userAccountAllList"
+            :key="item.id"
+            >{{ addStarForPhone(item.content) }}</NutRadio
+          >
+        </NutRadioGroup>
+        <AccountCardV2
+          v-if="userAccountAllList.length > 0"
+          :content="StringUtils.phoneNumberAddSpace(form.phone)"
+          :remark="form.remark"
+          :showEditBtn="!!form.currentUserAccountId"
+          @add="handleAddUserAccount"
+          @edit="emit('editUserAccount', form.currentUserAccountId)"
+        >
+        </AccountCardV2>
+        <AccountAddCardV2
+          content="鍘绘坊鍔犲厖鍊煎彿鐮�"
+          remark="娣诲姞鍙风爜灏嗕繚瀛樺湪鐢熸椿缂磋垂杩涜绠$悊"
+          tip="娣诲姞姝g‘鍙风爜"
+          v-else
+          @add="handleAddUserAccount"
+        />
+      </NutFormItem>
+    </Chunk>
 
-    <NutFormItem 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"
-          v-for="item in parValueList"
-          class="parValue-item"
-        >
-          <div class="parValue-item-inner">
-            <div class="amount-wrapper">
-              <div class="amount">{{ item }}</div>
-              <div class="unit">鍏�</div>
-            </div>
-            <div class="price-wrapper">
-              <div class="price-text">鎶樺悗</div>
-              <div class="price">
-                {{ blLifeRecharge.getRechargeParValue(item, lifePayPhoneRate) }}鍏�
+    <Chunk borderRadiusSmall :hasPaddingBottom="false" title="閫夋嫨鍏呭�奸噾棰�">
+      <NutFormItem 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"
+            v-for="item in parValueList"
+            class="parValue-item"
+          >
+            <div class="parValue-item-inner">
+              <div class="amount-wrapper">
+                <div class="amount">{{ item }}</div>
+                <div class="unit">鍏�</div>
               </div>
+              <div class="price-wrapper">
+                <div class="price-text">鎶樺悗</div>
+                <div class="price">
+                  {{ blLifeRecharge.getRechargeParValue(item, lifePayPhoneRate) }}鍏�
+                </div>
+              </div>
+              <div class="discountTag" v-if="lifePayPhoneRate > 0">{{ lifePayPhoneRate }}鎶�</div>
+              <img :src="IconSelect" class="discount-icon" />
             </div>
-            <div class="discountTag">{{ lifePayPhoneRate }}鎶�</div>
-          </div>
-        </NutRadio>
-      </NutRadioGroup>
-    </NutFormItem>
+          </NutRadio>
+        </NutRadioGroup>
+      </NutFormItem>
+    </Chunk>
+
     <SelectPayTypeFormItem
       v-model="form.lifePayType"
       :showWeixinPay="showWeixinPay"
       :showAliPay="showAliPay"
     ></SelectPayTypeFormItem>
     <div class="common-content">
-      <nut-button class="recharge-button" type="primary" @click="handleSubmit">
+      <nut-button
+        class="recharge-button recharge-button-linear"
+        type="primary"
+        @click="handleSubmit"
+      >
         <div class="recharge-button-inner">
           <div>锟{ realParValue }}</div>
           <div class="recharge-button-text">绔嬪嵆鍏呭��</div>
@@ -82,7 +97,7 @@
         <ConfirmDialogInfoItem label="瀹炰粯閲戦" :content="`锟�${realParValue}`" danger />
       </template>
     </ConfirmDialog>
-    <NutToast :msg="state.msg" v-model:visible="state.show" type="warn" cover />
+    <NutToast :msg="state.msg" v-model:visible="state.show" type="warn" cover :duration="3000" />
   </NutForm>
 </template>
 
@@ -98,7 +113,7 @@
 } from '@nutui/nutui-taro';
 import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types';
 import { reactive, ref, computed, toRef } from 'vue';
-import { FormValidator, initLifePayType } from '../../utils';
+import { FormValidator, initLifePayType, addStarForPhone, StringUtils } from '../../utils';
 import {
   useLifeRechargeContext,
   BlLifeRecharge,
@@ -109,12 +124,14 @@
 import ConfirmDialog from '../../components/Dialog/ConfirmDialog.vue';
 import ConfirmDialogInfoItem from '../../components/Dialog/ConfirmDialogInfoItem.vue';
 import { useGetRate, useGetPhoneParValue, useSetUserAccountBySelect } from '../../hooks';
-import AccountAddCard from '../../components/Card/AccountAddCard.vue';
-import AccountCard from '../../components/Card/AccountCard.vue';
+import AccountAddCardV2 from '../../components/Card/AccountAddCardV2.vue';
+import AccountCardV2 from '../../components/Card/AccountCardV2.vue';
 import { usePhoneBillRechargeContext, PhoneUserAccountExtraProperties } from './context';
 import SelectPayTypeFormItem from '../../components/SelectPayTypeFormItem/SelectPayTypeFormItem.vue';
 import { useSelectPayType, useGetPayStatusByOrderNo } from '../../hooks/selectPayType';
 import { RechargeProps } from './types';
+import Chunk from '../../components/Layout/Chunk.vue';
+import IconSelect from '../../assets/recharge/icon-select.png';
 
 defineOptions({
   name: 'PhoneBillRechargeStep2',
@@ -146,12 +163,30 @@
     form.phone = currentUserAccount.content;
     form.ispCode = currentUserAccountExtraProperties.ispCode;
     form.name = currentUserAccountExtraProperties.name;
-
     form.remark = currentUserAccount.remark;
-
     changeIspCode(form.ispCode as any);
   },
+  getDefaultUserAccount(userAccountList) {
+    const defaultUserAccount = userAccountList.find((x) => {
+      const currentUserAccountExtraProperties = JSON.parse(
+        x.extraProperties
+      ) as PhoneUserAccountExtraProperties;
+      return isCanRecharge(currentUserAccountExtraProperties.ispCode);
+    });
+    return defaultUserAccount;
+  },
 });
+
+function _handleUserAccountChange(userAccountId: string) {
+  const currentUserAccount = userAccountAllList.value.find((x) => x.id === userAccountId);
+  const currentUserAccountExtraProperties = JSON.parse(
+    currentUserAccount.extraProperties
+  ) as PhoneUserAccountExtraProperties;
+  if (!checkCanRecharge(currentUserAccountExtraProperties.ispCode)) {
+    // return;
+  }
+  handleUserAccountChange(userAccountId);
+}
 
 function handleAddUserAccount() {
   goTo('step1');
@@ -160,6 +195,8 @@
 const emit = defineEmits<{
   (e: 'goPay', orderNo: string): void;
   (e: 'paySuccess', orderNo: string): void;
+  (e: 'missName', userAccountId: string): void;
+  (e: 'editUserAccount', userAccountId: string): void;
 }>();
 
 const { lifePayPhoneRate } = useGetRate();
@@ -196,14 +233,15 @@
 const formRef = ref<any>(null);
 
 function handleSubmit() {
-  if (!form.name) {
-    state.show = true;
-    state.msg = '璇峰厛瀹屽杽鎵嬫満鍙锋墍灞炴満涓诲鍚�';
-    return;
-  }
   if (!formRef.value) return;
+  console.log('form: ', form, formRef.value);
   formRef.value.validate().then(({ valid, errors }: any) => {
+    console.log('errors: ', errors);
     if (valid) {
+      if (!form.name) {
+        emit('missName', form.currentUserAccountId);
+        return;
+      }
       recharge();
     }
   });
@@ -224,8 +262,26 @@
 
 const currentOrderNo = ref('');
 
+function isCanRecharge(ispCode: string) {
+  return ispCode !== blLifeRecharge.constants.IspCode.yidong;
+}
+
+function checkCanRecharge(ispCode: string) {
+  if (!isCanRecharge(ispCode)) {
+    //閫氶亾姝e湪鍗囩骇锛岀粰鎮ㄥ甫鏉ヤ笉渚垮敖鎯呰皡瑙�
+    state.msg =
+      '灏婃暚鐨勭敤鎴凤紝涓烘彁渚涙洿瀹夊叏銆佺ǔ瀹氱殑鍏呭�兼湇鍔★紝绉诲姩鍏呭�奸�氶亾姝e湪杩涜鍗囩骇缁存姢锛岀淮鎶ゆ湡闂存殏鏃犳硶鍙戣捣鍏呭��';
+    state.show = true;
+    return false;
+  }
+  return true;
+}
+
 async function goPay() {
   try {
+    if (!checkCanRecharge(form.ispCode)) {
+      return;
+    }
     let params: LifePhoneDataCreateLifePayOrderInput = {
       userId: blLifeRecharge.accountModel.userId,
       channelId: blLifeRecharge.accountModel.channlesNum,

--
Gitblit v1.9.1