| | |
| | | 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.gasAccount}`" |
| | | :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.areaList?.[1] ?? ''} ${form.gasAccount}`" |
| | | :remark="form.remark" |
| | | :showEditBtn="!!form.currentUserAccountId" |
| | | @add="handleAddUserAccount" |
| | | @edit="emit('editUserAccount', form.currentUserAccountId)" |
| | | > |
| | | </AccountCardV2> |
| | | <AccountAddCardV2 |
| | | content="去添加充值户号" |
| | | remark="添加户号将保存在生活缴费进行管理" |
| | | tip="添加正确户号" |
| | | v-else |
| | | @click="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, lifePayGasRate) }}元 |
| | | <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 gasValueList" |
| | | 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, lifePayGasRate) }}元 |
| | | </div> |
| | | </div> |
| | | <div class="discountTag" v-if="lifePayGasRate > 0">{{ lifePayGasRate }}折</div> |
| | | <img :src="IconSelect" class="discount-icon" /> |
| | | </div> |
| | | <div class="discountTag">{{ lifePayGasRate }}折</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>¥{{ realParValue }}</div> |
| | | <div class="recharge-button-text">立即充值</div> |
| | | </div> |
| | | </nut-button> |
| | | <RechargeTipsView :tips="tips"> |
| | | <RechargeTipsView :lifePayOrderType="LifeRechargeConstants.LifePayOrderTypeEnum.燃气订单"> |
| | | <template #tips-top> |
| | | 同一电费账户在充值期间切勿在多平台重复充值,下单前请仔细阅读下方须知内容。若接到陌生来电,切勿轻信!!! |
| | | </template> |
| | |
| | | <template #info> |
| | | <ConfirmDialogInfoItem |
| | | label="燃气类型" |
| | | :content="blLifeRecharge.constants.GasOrgCodeEnumText[form.gasOrgType]" |
| | | :content="currentGasParValueItem?.gasOrgName ?? ''" |
| | | /> |
| | | <ConfirmDialogInfoItem :label-width="96" label="户号" :content="form.gasAccount" /> |
| | | <ConfirmDialogInfoItem label="充值金额" :content="`¥${form.parValue.toFixed(2)}`" danger /> |
| | |
| | | 同一燃气费账户在充值期间,未到账前切勿在其他任何平台再次充值。因此造成的资金损失须用户自行承担!!! |
| | | </template> |
| | | </ConfirmDialog> |
| | | <NutToast :msg="state.msg" v-model:visible="state.show" type="warn" cover /> |
| | | </NutForm> |
| | | </template> |
| | | |
| | |
| | | RadioGroup as NutRadioGroup, |
| | | Radio as NutRadio, |
| | | Button as NutButton, |
| | | Toast as NutToast, |
| | | } from '@nutui/nutui-taro'; |
| | | import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types'; |
| | | import { reactive, ref, computed } from 'vue'; |
| | | import { reactive, ref, computed, toRef } from 'vue'; |
| | | import { |
| | | useLifeRechargeContext, |
| | | LifeElectricDataCreateLifePayOrderInput, |
| | |
| | | } from '@life-payment/core-vue'; |
| | | import { useGetRate, useGetGasParValue, useSetUserAccountBySelect } from '../../hooks'; |
| | | import { useGasBillRechargeContext, GasUserAccountExtraProperties } from './context'; |
| | | import { FormValidator } from '../../utils'; |
| | | import { CustomerServiceTips } from '../../constants'; |
| | | import AccountAddCard from '../../components/Card/AccountAddCard.vue'; |
| | | import AccountCard from '../../components/Card/AccountCard.vue'; |
| | | import { FormValidator, initLifePayType } from '../../utils'; |
| | | import AccountAddCardV2 from '../../components/Card/AccountAddCardV2.vue'; |
| | | import AccountCardV2 from '../../components/Card/AccountCardV2.vue'; |
| | | import RechargeTipsView from '../../components/RechargeTipsView/RechargeTipsView.vue'; |
| | | import ConfirmDialog from '../../components/Dialog/ConfirmDialog.vue'; |
| | | import ConfirmDialogInfoItem from '../../components/Dialog/ConfirmDialogInfoItem.vue'; |
| | | 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: 'GasBillRechargeStep3', |
| | | }); |
| | | |
| | | type Props = { |
| | | isDev?: boolean; |
| | | }; |
| | | |
| | | const props = withDefaults(defineProps<Props>(), { |
| | | const props = withDefaults(defineProps<RechargeProps>(), { |
| | | isDev: false, |
| | | }); |
| | | |
| | | 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 } = useGasBillRechargeContext(); |
| | |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | |
| | | const { lifePayGasRate } = useGetRate(); |
| | | const { gasParValueList } = useGetGasParValue(); |
| | | |
| | | const form = reactive({ |
| | | parValue: 0, |
| | | province: '', |
| | | city: '', |
| | | // province: '', |
| | | // city: '', |
| | | gasOrgType: '', |
| | | gasAccount: '', |
| | | currentUserAccountId: '', |
| | | remark: '', |
| | | areaList: [] as string[], |
| | | lifePayType: initLifePayType(props.isInWeChat, props.isInAlipay), |
| | | name: '', |
| | | }); |
| | | |
| | | const { userAccountAllList, handleUserAccountChange } = useSetUserAccountBySelect({ |
| | |
| | | const currentUserAccountExtraProperties = JSON.parse( |
| | | currentUserAccount.extraProperties |
| | | ) as GasUserAccountExtraProperties; |
| | | // form.currentUserAccountId = currentUserAccount.id; |
| | | // form.electricAccount = currentUserAccount.content; |
| | | // form.province = currentUserAccount.province; |
| | | // form.city = currentUserAccount.city; |
| | | form.currentUserAccountId = currentUserAccount.id; |
| | | form.gasAccount = currentUserAccount.content; |
| | | form.areaList = [currentUserAccount.province, currentUserAccount.city]; |
| | | form.gasOrgType = currentUserAccount.operators; |
| | | |
| | | // form.electricType = currentUserAccountExtraProperties.electricType; |
| | | // form.electricAccountType = currentUserAccountExtraProperties.electricAccountType; |
| | | // form.sixID = currentUserAccountExtraProperties.sixID; |
| | | // form.remark = currentUserAccount.remark; |
| | | // const electricParValueItem = electricParValueList.value.find( |
| | | // (x) => x.cityName === form.province |
| | | // ); |
| | | // if ( |
| | | // electricParValueItem && |
| | | // electricParValueItem.parValue.every((x) => Number(x) !== form.parValue) |
| | | // ) { |
| | | // form.parValue = 0; |
| | | // } |
| | | form.remark = currentUserAccount.remark; |
| | | form.name = currentUserAccountExtraProperties.name ?? ''; |
| | | const gasParValueItem = gasParValueList.value.find((x) => x.gasOrgCode === form.gasOrgType); |
| | | if (gasParValueItem && gasParValueItem.parValue.every((x) => Number(x) !== form.parValue)) { |
| | | form.parValue = 0; |
| | | } |
| | | }, |
| | | }); |
| | | |
| | | function handleAddUserAccount() { |
| | | goTo('step1'); |
| | | } |
| | | |
| | | const currentGasParValueItem = computed(() => |
| | | gasParValueList.value.find((x) => x.gasOrgCode === form.gasOrgType) |
| | | ); |
| | | |
| | | const gasValueList = computed(() => { |
| | | const gasValueList = currentGasParValueItem.value?.parValue ?? []; |
| | | return blLifeRecharge.filterParValueList(gasValueList); |
| | | }); |
| | | |
| | | const realParValue = computed(() => |
| | | blLifeRecharge.getRechargeParValue(form.parValue, lifePayGasRate.value) |
| | |
| | | { required: true, message: '请选择充值金额', validator: FormValidator.validatorNumberNotNull }, |
| | | ], |
| | | currentUserAccountId: [{ required: true, message: '请选择充值户号' }], |
| | | lifePayType: [{ required: true, message: '请选择支付方式' }], |
| | | }); |
| | | |
| | | const formRef = ref<any>(null); |
| | |
| | | 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 小时内到账,若未能按时到账,系统将自动发起退款。', |
| | | '目前平台仅支持中国燃气和北京燃气充值服务。', |
| | | '中国燃气充值户号必须在“壹品慧”APP燃气缴费界面查询到账户信息,户号为11开头或者5开头的10位数字。', |
| | | '北京燃气不支持欠费充值,仅支持智能表的户号,户号是9开头11位的账户进行充值。', |
| | | '充值期间,若同一账户的充值款未到账,请勿在其他平台重复充值,因上述操作导致的资金损失,由用户自行承担。', |
| | | '如接到陌生来电,对方以缴费或误操作等理由要求处理款项,务必立即拉黑,谨防诈骗。', |
| | | '下单时,请您务必准确填写完整的省市及户号信息。充值完成后,发票由运营商提供,您可登录网上营业厅下载对应的电子发票。', |
| | | CustomerServiceTips, |
| | | ]; |
| | | |
| | | const confirmDialogVisible = ref(false); |
| | | |
| | |
| | | confirmDialogVisible.value = true; |
| | | } |
| | | |
| | | const { state, invokeAliPay, invokeWeixinPay } = useSelectPayType({ |
| | | getOpenId: toRef(props, 'getOpenId'), |
| | | isInWeChat: toRef(props, 'isInWeChat'), |
| | | isH5: toRef(props, 'isH5'), |
| | | appId: toRef(props, 'appId'), |
| | | }); |
| | | |
| | | const currentOrderNo = ref(''); |
| | | |
| | | async function goPay() { |
| | | try { |
| | | let params: LifeGasDataCreateLifePayOrderInput = { |
| | | userId: blLifeRecharge.accountModel.userId, |
| | | channelId: blLifeRecharge.accountModel.channlesNum, |
| | | productData: { |
| | | parValue: props.isDev ? 0.1 : form.parValue, |
| | | parValue: form.parValue, |
| | | gasOrgType: form.gasOrgType, |
| | | gasAccount: form.gasAccount, |
| | | province: form.province, |
| | | city: form.city, |
| | | province: form.areaList?.[0] ?? '', |
| | | city: form.areaList?.[1] ?? '', |
| | | // name: form.name, |
| | | }, |
| | | }; |
| | | let res = await blLifeRecharge.services.createLifePayGasOrder(params); |
| | | emit('goPay', res.orderNo); |
| | | // emit('goPay', res.orderNo); |
| | | if (form.lifePayType === LifeRechargeConstants.LifePayTypeEnum.WxPay) { |
| | | await invokeWeixinPay(res.orderNo); |
| | | } else { |
| | | await invokeAliPay(res.orderNo); |
| | | } |
| | | currentOrderNo.value = res.orderNo; |
| | | } catch (error) {} |
| | | } |
| | | |
| | | useGetPayStatusByOrderNo({ |
| | | orderNo: currentOrderNo, |
| | | enabled: computed(() => props.isFocus && !!currentOrderNo.value), |
| | | onPaySuccess: (orderNo) => { |
| | | emit('paySuccess', orderNo); |
| | | currentOrderNo.value = ''; |
| | | }, |
| | | }); |
| | | </script> |