wupengfei
1 天以前 9e5a47d90455c4770815d32899f660b53fc27110
packages/components/src/views/electricBillRecharge/ElectricBillRechargeStep2.vue
@@ -6,75 +6,90 @@
    label-position="top"
    class="order-bill-recharge electric"
  >
    <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.city }}-{{ 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.city} ${form.electricAccount}`"
        :remark="form.remark"
      >
        <template #action>
          <div class="account-card-action" @click="handleAddUserAccount">新增</div>
        </template>
      </AccountCard>
      <AccountAddCard text="新增户号" v-else @click="handleAddUserAccount" />
    </NutFormItem>
          <NutRadio
            :label="item.id"
            shape="button"
            v-for="item in userAccountAllList"
            :key="item.id"
            >{{ item.city }}-{{ item.content }}</NutRadio
          >
        </NutRadioGroup>
        <AccountCardV2
          v-if="userAccountAllList.length > 0"
          :content="`${form.city}-${form.electricAccount}`"
          :remark="form.remark"
          :showEditBtn="!!form.currentUserAccountId"
          @add="handleAddUserAccount"
          @edit="emit('editUserAccount', form.currentUserAccountId)"
        >
        </AccountCardV2>
        <AccountAddCardV2
          content="去添加充值户号"
          remark="添加户号将保存在生活缴费进行管理"
          tip="添加正确户号"
          v-else
          @add="handleAddUserAccount"
        />
      </NutFormItem>
    </Chunk>
    <NutFormItem
      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"
          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, lifePayElectricRate) }}元
    <Chunk borderRadiusSmall :hasPaddingBottom="false" title="选择充值金额" v-if="!!form.province">
      <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, lifePayElectricRate) }}元
                </div>
              </div>
              <div class="discountTag" v-if="lifePayElectricRate > 0">
                {{ lifePayElectricRate }}折
              </div>
              <img :src="IconSelect" class="discount-icon" />
            </div>
            <div class="discountTag">{{ lifePayElectricRate }}折</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>
        </div>
      </nut-button>
      <RechargeTipsView :tips="tips" />
      <RechargeTipsView :lifePayOrderType="LifeRechargeConstants.LifePayOrderTypeEnum.电费订单" />
    </div>
    <ConfirmDialog v-model:visible="confirmDialogVisible" @ok="goPay">
      <template #tips>
@@ -120,13 +135,14 @@
import ConfirmDialogInfoItem from '../../components/Dialog/ConfirmDialogInfoItem.vue';
import { useGetRate, useGetElectricParValue, useSetUserAccountBySelect } from '../../hooks';
import { FormValidator, initLifePayType } from '../../utils';
import { CustomerServiceTips } from '../../constants';
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 { useElectricBillRechargeContext, ElectricUserAccountExtraProperties } from './context';
import SelectPayTypeFormItem from '../../components/SelectPayTypeFormItem/SelectPayTypeFormItem.vue';
import { useSelectPayType, useGetPayStatusByOrderNo } from '../../hooks/selectPayType';
import { RechargeProps } from '../PhoneBillRecharge/types';
import Chunk from '../../components/Layout/Chunk.vue';
import IconSelect from '../../assets/recharge/icon-select.png';
defineOptions({
  name: 'ElectricBillRechargeStep2',
@@ -139,6 +155,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 { goTo } = useElectricBillRechargeContext();
@@ -154,6 +172,7 @@
  currentUserAccountId: '',
  remark: '',
  lifePayType: initLifePayType(props.isInWeChat, props.isInAlipay),
  name: '',
});
const { userAccountAllList, handleUserAccountChange } = useSetUserAccountBySelect({
@@ -171,6 +190,7 @@
    form.electricAccountType = currentUserAccountExtraProperties.electricAccountType;
    form.sixID = currentUserAccountExtraProperties.sixID;
    form.remark = currentUserAccount.remark;
    form.name = currentUserAccountExtraProperties.name ?? '';
    const electricParValueItem = electricParValueList.value.find(
      (x) => x.cityName === form.province
    );
@@ -217,19 +237,14 @@
  if (!formRef.value) return;
  formRef.value.validate().then(({ valid, errors }: any) => {
    if (valid) {
      if (!form.name) {
        emit('missName', form.currentUserAccountId);
        return;
      }
      recharge();
    }
  });
}
const tips = [
  '平台提供慢充服务,订单提交后,电费将于0 - 72 小时内到账,若未能按时到账,系统将自动发起退款。',
  '充值期间,若同一账户的充值款未到账,请勿在其他平台重复充值,因上述操作导致的资金损失,由用户自行承担。',
  '为确保充值顺利进行,目前平台不支持对欠款金额超过1000元的账户进行充值,且每次充值金额必须高于欠费总额。',
  '如接到陌生来电,对方以缴费或误操作等理由要求处理款项,务必立即拉黑,谨防诈骗。',
  '下单时,请您务必准确填写完整的省市及户号信息。充值完成后,发票由运营商提供,您可登录网上营业厅下载对应的电子发票。',
  CustomerServiceTips,
];
const confirmDialogVisible = ref(false);
@@ -238,10 +253,10 @@
}
const { state, invokeAliPay, invokeWeixinPay } = useSelectPayType({
  openId: toRef(props, 'openId'),
  isInWeChat: toRef(props, 'isInWeChat'),
  isH5: toRef(props, 'isH5'),
  appId: toRef(props, 'appId'),
  getOpenId: toRef(props, 'getOpenId'),
});
const currentOrderNo = ref('');
@@ -252,13 +267,14 @@
      userId: blLifeRecharge.accountModel.userId,
      channelId: blLifeRecharge.accountModel.channlesNum,
      productData: {
        parValue: props.isDev ? 0.1 : form.parValue,
        parValue: form.parValue,
        electricType: form.electricType,
        electricAccountType: form.electricAccountType,
        electricAccount: form.electricAccount,
        province: form.province,
        city: form.city,
        sixID: form.sixID,
        // name: form.name,
      },
    };
    let res = await blLifeRecharge.services.createLifePayElectricOrder(params);