| | |
| | | |
| | | type Props = { |
| | | label?: string; |
| | | content?: string; |
| | | content?: string | number; |
| | | danger?: boolean; |
| | | }; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import { |
| | | useLifeRechargeContext, |
| | | LifePayRateListOutput, |
| | | PhoneParValueOutput, |
| | | PhoneParValueResponse, |
| | | } from '../utils'; |
| | | import { useQuery } from '@tanstack/vue-query'; |
| | | import { computed } from 'vue'; |
| | | |
| | | export function useGetRate() { |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | |
| | | const { data: lifePayRateList, isLoading } = useQuery({ |
| | | queryKey: ['blLifeRecharge/getRate'], |
| | | queryFn: async () => { |
| | | return await blLifeRecharge.services.getRate({ showLoading: false }); |
| | | }, |
| | | placeholderData: () => [] as LifePayRateListOutput[], |
| | | }); |
| | | |
| | | const lifePayPhoneRate = computed( |
| | | () => |
| | | lifePayRateList.value.find( |
| | | (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.é»è®¤è¯è´¹ææ£ |
| | | )?.rate ?? 1 |
| | | ); |
| | | |
| | | const lifePayElectricRate = computed( |
| | | () => |
| | | lifePayRateList.value.find( |
| | | (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.é»è®¤çµè´¹ææ£ |
| | | )?.rate ?? 1 |
| | | ); |
| | | |
| | | return { |
| | | lifePayRateList, |
| | | lifePayPhoneRate, |
| | | lifePayElectricRate, |
| | | }; |
| | | } |
| | | |
| | | export function useGetPhoneParValue() { |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | |
| | | const { data: phoneParValueList, isLoading } = useQuery({ |
| | | queryKey: ['blLifeRecharge/getPhoneParValue'], |
| | | queryFn: async () => { |
| | | return await blLifeRecharge.services.getPhoneParValue({ showLoading: false }); |
| | | }, |
| | | select(data) { |
| | | return data.phoneParValue ?? []; |
| | | }, |
| | | placeholderData: () => ({} as PhoneParValueResponse), |
| | | }); |
| | | |
| | | return { |
| | | phoneParValueList, |
| | | }; |
| | | } |
| | |
| | | export * from './plugin'; |
| | | export * from './lifeRechargeServices'; |
| | | export * from './types'; |
| | | export * from './validator'; |
| | |
| | | RequestConfig, |
| | | } from './lifeRechargeServices'; |
| | | import { IRequest, BlLifeRechargeOptions } from './types'; |
| | | import { LifeRechargeConstants } from './lifeRechargeConstants'; |
| | | |
| | | export class BlLifeRecharge<T extends IRequest = IRequest> { |
| | | services: BlLifeRechargeServices<T>; |
| | | userId = ''; |
| | | |
| | | static constants = LifeRechargeConstants; |
| | | constants = LifeRechargeConstants; |
| | | |
| | | constructor(options: BlLifeRechargeOptions<T>) { |
| | | this.services = new BlLifeRechargeServices(options); |
| | | this.userId = options.userId || ''; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | export namespace LifeRechargeConstants { |
| | | export enum LifePayRateTypeEnum { |
| | | 'é»è®¤è¯è´¹ææ£' = 10, |
| | | 'é»è®¤çµè´¹ææ£' = 10, |
| | | } |
| | | |
| | | export enum LifePayTypeEnum { |
| | | WxPay = 10, |
| | | AliPay = 20, |
| | | } |
| | | |
| | | export enum LifePayOrderTypeEnum { |
| | | è¯è´¹è®¢å = 10, |
| | | çµè´¹è®¢å = 20, |
| | | } |
| | | |
| | | export enum LifePayStatusEnum { |
| | | æªæ¯ä» = 10, |
| | | |
| | | å·²æ¯ä» = 20, |
| | | |
| | | å¾
鿬¾ = 30, |
| | | |
| | | 已鿬¾ = 40, |
| | | } |
| | | |
| | | export enum LifePayOrderStatusEnum { |
| | | å¾
确认 = 10, |
| | | |
| | | 已失败 = 20, |
| | | |
| | | 已宿 = 30, |
| | | } |
| | | |
| | | export enum IspCode { |
| | | /**ä¸å½ç§»å¨ */ |
| | | yidong = 'yidong', |
| | | /**ä¸å½çµä¿¡ */ |
| | | dianxin = 'dianxin', |
| | | /**ä¸å½èé */ |
| | | liantong = 'liantong', |
| | | } |
| | | |
| | | export const IspCodeText = { |
| | | [IspCode.yidong]: 'ä¸å½ç§»å¨', |
| | | [IspCode.dianxin]: 'ä¸å½çµä¿¡', |
| | | [IspCode.liantong]: 'ä¸å½èé', |
| | | }; |
| | | } |
| | |
| | | import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'; |
| | | import { IRequest, BlLifeRechargeServicesOptions } from './types'; |
| | | |
| | | export interface PhoneMesssageCodeLoginInput { |
| | | /** ææºå· */ |
| | | phoneNumber: string; |
| | | /** éªè¯ç */ |
| | | code: string; |
| | | } |
| | | import { LifeRechargeConstants } from './lifeRechargeConstants'; |
| | | |
| | | export interface RequestConfig {} |
| | | |
| | |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** è·åææ£ GET /api/LifePay/GetRate */ |
| | | async getRate(options?: RequestConfig) { |
| | | return this.request<LifePayRateListOutput[]>('/api/LifePay/GetRate', { |
| | | method: 'GET', |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** è·åçµè´¹é¢å¼ GET /api/LifePay/GetElectricParValue */ |
| | | async getElectricParValue(options?: RequestConfig) { |
| | | return this.request<ElectricParValueResponse>('/api/LifePay/GetElectricParValue', { |
| | | method: 'GET', |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** è·åè¯è´¹é¢å¼ GET /api/LifePay/GetPhoneParValue */ |
| | | async getPhoneParValue(options?: RequestConfig) { |
| | | return this.request<PhoneParValueResponse>('/api/LifePay/GetPhoneParValue', { |
| | | method: 'GET', |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** åå»ºçæ´»ç¼´è´¹è¯è´¹è®¢å POST /api/LifePay/CreateLifePayPhoneOrder */ |
| | | async createLifePayPhoneOrder( |
| | | body: LifePhoneDataCreateLifePayOrderInput, |
| | | options?: RequestConfig |
| | | ) { |
| | | return this.request<CreateLifePayOrderOutput>('/api/LifePay/CreateLifePayPhoneOrder', { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** åå»ºçæ´»ç¼´è´¹çµè´¹è®¢å POST /api/LifePay/CreateLifePayElectricOrder */ |
| | | async createLifePayElectricOrder( |
| | | body: LifeElectricDataCreateLifePayOrderInput, |
| | | options?: RequestConfig |
| | | ) { |
| | | return this.request<CreateLifePayOrderOutput>('/api/LifePay/CreateLifePayElectricOrder', { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** æ ¹æ®è®¢åå·è·åæ¯ä»ç¶æ GET /api/LifePay/GetPayStatusByOrderNo */ |
| | | async getPayStatusByOrderNo(params: APIgetPayStatusByOrderNoParams, options?: RequestConfig) { |
| | | return this.request<LifeRechargeConstants.LifePayStatusEnum>( |
| | | '/api/LifePay/GetPayStatusByOrderNo', |
| | | { |
| | | method: 'GET', |
| | | params: { |
| | | ...params, |
| | | }, |
| | | ...(options || {}), |
| | | } |
| | | ); |
| | | } |
| | | } |
| | | |
| | | export interface PhoneMesssageCodeLoginInput { |
| | | /** ææºå· */ |
| | | phoneNumber: string; |
| | | /** éªè¯ç */ |
| | | code: string; |
| | | } |
| | | |
| | | export interface LifePayRateListOutput { |
| | | rateType?: LifeRechargeConstants.LifePayRateTypeEnum; |
| | | rate?: number; |
| | | } |
| | | |
| | | export interface ElectricParValueResponse { |
| | | success?: string; |
| | | requestNo?: string; |
| | | partnerId?: string; |
| | | service?: string; |
| | | version?: string; |
| | | protocol?: string; |
| | | context?: string; |
| | | ext?: string; |
| | | code?: string; |
| | | message?: string; |
| | | detail?: string; |
| | | electricParValue?: ElectricParValueOutput[]; |
| | | } |
| | | |
| | | export interface ElectricParValueOutput { |
| | | electricType?: string; |
| | | areaName?: string; |
| | | parValue?: string; |
| | | rate?: number; |
| | | comments?: string; |
| | | } |
| | | |
| | | export interface PhoneParValueResponse { |
| | | success?: string; |
| | | requestNo?: string; |
| | | partnerId?: string; |
| | | service?: string; |
| | | version?: string; |
| | | protocol?: string; |
| | | context?: string; |
| | | ext?: string; |
| | | code?: string; |
| | | message?: string; |
| | | detail?: string; |
| | | phoneParValue?: PhoneParValueOutput[]; |
| | | } |
| | | |
| | | export interface PhoneParValueOutput { |
| | | ispCode?: string; |
| | | ispName?: string; |
| | | parValue?: string; |
| | | rate?: number; |
| | | phoneSection?: string; |
| | | comments?: string; |
| | | } |
| | | |
| | | export interface LifePhoneDataCreateLifePayOrderInput { |
| | | userId?: string; |
| | | lifePayType?: LifeRechargeConstants.LifePayTypeEnum; |
| | | productData?: LifePhoneData; |
| | | } |
| | | |
| | | export interface LifePhoneData { |
| | | /** è¿è¥åç¼ç ï¼ä¾å¦ï¼"yidong", "dianxin", "liantong"ã */ |
| | | ispCode: string; |
| | | /** å
å¼é¢é¢ï¼åä½ä¸ºå
ãæµè¯è´¦æ·ï¼parValue=100:ç¼´è´¹æåï¼parValue>100ï¼ç¼´è´¹å¤±è´¥ã */ |
| | | parValue: number; |
| | | /** ææºå·ã */ |
| | | phone: string; |
| | | /** æºä¸»åç§°(çµä¿¡ææºå·å¿
å¡«) */ |
| | | name?: string; |
| | | } |
| | | |
| | | export interface CreateLifePayOrderOutput { |
| | | orderNo?: string; |
| | | payUrl?: string; |
| | | } |
| | | |
| | | export interface LifeElectricDataCreateLifePayOrderInput { |
| | | userId?: string; |
| | | lifePayType?: LifeRechargeConstants.LifePayTypeEnum; |
| | | productData?: LifeElectricData; |
| | | } |
| | | |
| | | export interface LifeElectricData { |
| | | /** å
å¼é¢é¢ï¼åä½ä¸ºå
ã */ |
| | | parValue: number; |
| | | /** çµç½ç±»åï¼ä¾å¦ï¼"guowang"代表å½å®¶çµç½ï¼"nanwang"ä»£è¡¨åæ¹çµç½ã */ |
| | | electricType: string; |
| | | /** çµè´¹ç±»åï¼å½ç½å¿
ä¼ ï¼ä½å®
ãä¼äºä¸ãåºéºä¸ä¸ªé项ã */ |
| | | electricAccountType: string; |
| | | /** çµè´¹æ·å·ã */ |
| | | electricAccount: string; |
| | | /** ç份ã */ |
| | | province: string; |
| | | /** åå¸ã */ |
| | | city: string; |
| | | /** 客æ·èº«ä»½è¯å6ä½ï¼åç½å¿
ä¼ ã */ |
| | | sixID?: string; |
| | | } |
| | | |
| | | export interface APIgetPayStatusByOrderNoParams { |
| | | orderNo?: string; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // import _ from 'lodash'; |
| | | import { FormItemRuleWithoutValidator } from '@nutui/nutui-taro/dist/types/__VUE/form/types'; |
| | | |
| | | export class FormValidator { |
| | | /** |
| | | * éªè¯è¡¨åinput-number ä¸ä¸º0 |
| | | */ |
| | | static validatorNumberNotNull(value: any, ruleCfg: FormItemRuleWithoutValidator) { |
| | | // eslint-disable-next-line eqeqeq |
| | | if (!value) { |
| | | return Promise.reject(ruleCfg.message); |
| | | } |
| | | return Promise.resolve(true); |
| | | } |
| | | |
| | | // static validatorArray(value: any, ruleCfg: FormItemRuleWithoutValidator) { |
| | | // if (!_.isArray(value) || !value?.length) { |
| | | // return Promise.reject(ruleCfg.message); |
| | | // } |
| | | // return Promise.resolve(true); |
| | | // } |
| | | |
| | | static validatorUrl(value: string, ruleCfg: FormItemRuleWithoutValidator) { |
| | | if (BoleRegExp.RegUrl.test(value)) { |
| | | return Promise.resolve(true); |
| | | } |
| | | return Promise.reject(ruleCfg.message); |
| | | } |
| | | static validatorUrlWithRarameter(value: string, ruleCfg: FormItemRuleWithoutValidator) { |
| | | if (BoleRegExp.RegUrlWithParameter.test(value)) { |
| | | return Promise.resolve(true); |
| | | } |
| | | return Promise.reject(ruleCfg.message); |
| | | } |
| | | static validatorSocietyCreditCode(value: string, ruleCfg: FormItemRuleWithoutValidator) { |
| | | if (!ruleCfg.required && !value) return Promise.resolve(true); |
| | | if (/^[^_IOZSVa-z\W]{2}\d{6}[^_IOZSVa-z\W]{10}$/g.test(value)) { |
| | | return Promise.resolve(true); |
| | | } |
| | | return Promise.reject(ruleCfg.message); |
| | | } |
| | | static validatorPhoneNumber(value: string, ruleCfg: FormItemRuleWithoutValidator) { |
| | | console.log('value: ', value); |
| | | if (BoleRegExp.RegPhoneNumber.test(value)) { |
| | | return Promise.resolve(true); |
| | | } |
| | | return Promise.reject(ruleCfg.message); |
| | | } |
| | | static validatorTelNumber(value: string, ruleCfg: FormItemRuleWithoutValidator) { |
| | | if (BoleRegExp.RegTelNumber.test(value)) { |
| | | return Promise.resolve(true); |
| | | } |
| | | return Promise.reject(ruleCfg.message); |
| | | } |
| | | static validatorIDCard(value: string, ruleCfg: FormItemRuleWithoutValidator) { |
| | | if (BoleRegExp.RegIDCard.test(value)) { |
| | | return Promise.resolve(true); |
| | | } |
| | | return Promise.reject(ruleCfg.message); |
| | | } |
| | | static validatorNumber(value: string, ruleCfg: FormItemRuleWithoutValidator) { |
| | | if (BoleRegExp.RegNumber.test(value)) { |
| | | return Promise.resolve(true); |
| | | } |
| | | return Promise.reject(ruleCfg.message); |
| | | } |
| | | |
| | | static validatorEmail(value: string, ruleCfg: FormItemRuleWithoutValidator) { |
| | | if (!ruleCfg.required && !value) return Promise.resolve(true); |
| | | if (BoleRegExp.RegEmail.test(value)) { |
| | | return Promise.resolve(true); |
| | | } |
| | | return Promise.reject(ruleCfg.message); |
| | | } |
| | | } |
| | | |
| | | export class BoleRegExp { |
| | | static RegIDCard = |
| | | /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/; |
| | | |
| | | // static RegEmail = |
| | | // /^(([^<>()\\[\]\\.,;:\s@"]+(\.[^<>()\\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/; |
| | | static RegEmail = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; |
| | | |
| | | /**åªæææº */ |
| | | static RegPhoneNumber = /^1[3-9]\d{9}$/; |
| | | |
| | | /**åº§æº + ææº*/ |
| | | static RegTelNumber = |
| | | /(^(0[0-9]{2,3})?[-\s]?([2-9][0-9]{6,7})+([0-9]{1,4})?$)|(^((\(\d{3}\))|(\d{3}[-\s]))?(1[3-9]\d{9})$)|(^(400)[-\s](\d{3})[-\s](\d{4})(.)(\d{1,4})$)|(^(400)(\d{3})(\d{4}$))/; |
| | | |
| | | /**åªæåº§æº */ |
| | | static RegOnlyTelNumber = |
| | | /(^(0[0-9]{2,3})?[-\s]?([2-9][0-9]{6,7})+([0-9]{1,4})?$)|(^(400)[-\s](\d{3})[-\s](\d{4})(.)(\d{1,4})$)|(^(400)(\d{3})(\d{4}$))/; |
| | | |
| | | static RegSocietyCreditCode = /^[^_IOZSVa-z\W]{2}\d{6}[^_IOZSVa-z\W]{10}$/g; |
| | | |
| | | static RegNumber = /^\d+$/; |
| | | |
| | | static RegFileName = /(.*\/)*([^.]+).*/gi; |
| | | |
| | | static RegCanPreview = /png|jpg|jpeg|doc|docx|txt|ppsx|xlsx|xls|pdf/gi; |
| | | |
| | | static RegDecimalNumber = /^\d+(\.\d{0,2}){0,1}$/; |
| | | |
| | | static RegBankCard = /^\d{16,30}$/; |
| | | |
| | | static RegUrl = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})(\/\w+)*\/?$/; |
| | | |
| | | static RegUrlWithParameter = |
| | | /^((http|ftp|https):\/\/)?[\w\-_]+(\.[\w\-_]+)+([\w\-\\.,@?^=%&:/~\\+#]*[\w\-\\@?^=%&/~\\+#])?$/; |
| | | |
| | | static RegUrlWithParameterExact = |
| | | /^((http|ftp|https):\/\/)[\w\-_]+(\.[\w\-_]+)+([\w\-\\.,@?^=%&:/~\\+#]*[\w\-\\@?^=%&/~\\+#])?$/; |
| | | } |
| | |
| | | > |
| | | <FormItem label="éæ©è¿è¥å:" class="bole-form-item" prop="ispCode" required> |
| | | <RadioGroup v-model="form.ispCode" direction="horizontal"> |
| | | <BlRadio :label="key" v-for="(val, key) in IspCodeText" :key="key">{{ val }}</BlRadio> |
| | | <BlRadio |
| | | :label="key" |
| | | v-for="(val, key) in BlLifeRecharge.constants.IspCodeText" |
| | | :key="key" |
| | | >{{ val }}</BlRadio |
| | | > |
| | | </RadioGroup> |
| | | </FormItem> |
| | | <FormItem label="å
弿æºå·" class="bole-form-item" prop="phone" required> |
| | |
| | | type="text" |
| | | /> |
| | | </FormItem> |
| | | <FormItem |
| | | label="å§å" |
| | | class="bole-form-item" |
| | | prop="name" |
| | | required |
| | | v-if="form.ispCode === BlLifeRecharge.constants.IspCode.dianxin" |
| | | > |
| | | <Input |
| | | v-model.trim="form.name" |
| | | class="bole-input-text" |
| | | placeholder="è¯·å¡«åæ¨çå§å" |
| | | type="text" |
| | | /> |
| | | </FormItem> |
| | | <FormItem label="éæ©å
å¼éé¢" class="bole-form-item" prop="parValue" required> |
| | | <RadioGroup v-model="form.parValue" direction="horizontal" class="parValue-radio-group"> |
| | | <Radio |
| | |
| | | </div> |
| | | <div class="price-wrapper"> |
| | | <div class="price-text">æå</div> |
| | | <div class="price">{{ blLifeRecharge.getRechargeParValue(item, rate) }}å
</div> |
| | | <div class="price"> |
| | | {{ blLifeRecharge.getRechargeParValue(item, lifePayPhoneRate) }}å
|
| | | </div> |
| | | </div> |
| | | <div class="discountTag">{{ rate * 100 }}æ</div> |
| | | <div class="discountTag">{{ lifePayPhoneRate * 100 }}æ</div> |
| | | </div> |
| | | </Radio> |
| | | </RadioGroup> |
| | | </FormItem> |
| | | <div class="common-content"> |
| | | <nut-button class="recharge-button" type="primary" @click="recharge"> |
| | | <nut-button class="recharge-button" type="primary" @click="handleSubmit"> |
| | | <div class="recharge-button-inner"> |
| | | <div>ï¿¥{{ form.parValue }}</div> |
| | | <div class="recharge-button-text">ç«å³å
å¼</div> |
| | |
| | | </div> |
| | | <ConfirmDialog v-model:visible="confirmDialogVisible" @ok="goPay"> |
| | | <template #info> |
| | | <ConfirmDialogInfoItem label="å
å¼è´¦å·" content="18858418480" /> |
| | | <ConfirmDialogInfoItem label="å
å¼éé¢" :content="`ï¿¥${form.parValue}`" danger /> |
| | | <ConfirmDialogInfoItem label="伿 éé¢" :content="`ï¿¥${discountParValue}`" /> |
| | | <ConfirmDialogInfoItem label="å
å¼è´¦å·" :content="form.phone" /> |
| | | <ConfirmDialogInfoItem label="å
å¼éé¢" :content="`ï¿¥${form.parValue.toFixed(2)}`" danger /> |
| | | <ConfirmDialogInfoItem label="伿 éé¢" :content="`ï¿¥${discountParValue.toFixed(2)}`" /> |
| | | <ConfirmDialogInfoItem label="å®ä»éé¢" :content="`ï¿¥${realParValue}`" danger /> |
| | | </template> |
| | | </ConfirmDialog> |
| | |
| | | import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types'; |
| | | import { reactive, ref, computed } from 'vue'; |
| | | import BlRadio from '../../components/Radio/Radio.vue'; |
| | | import { IspCodeText, IspCode } from '../../constants'; |
| | | import { useLifeRechargeContext } from '../../utils'; |
| | | import { |
| | | useLifeRechargeContext, |
| | | BlLifeRecharge, |
| | | LifePhoneDataCreateLifePayOrderInput, |
| | | FormValidator, |
| | | } from '../../utils'; |
| | | import RechargeTipsView from '../../components/RechargeTipsView/RechargeTipsView.vue'; |
| | | import ConfirmDialog from '../../components/Dialog/ConfirmDialog.vue'; |
| | | import ConfirmDialogInfoItem from '../../components/Dialog/ConfirmDialogInfoItem.vue'; |
| | | import { useGetRate, useGetPhoneParValue } from '../../hooks'; |
| | | |
| | | defineOptions({ |
| | | name: 'PhoneBillRecharge', |
| | | }); |
| | | |
| | | const emit = defineEmits<{ |
| | | (e: 'goPay'): void; |
| | | }>(); |
| | | |
| | | const form = reactive({ |
| | | ispCode: IspCode.yidong, |
| | | ispCode: BlLifeRecharge.constants.IspCode.yidong, |
| | | phone: '', |
| | | parValue: 100, |
| | | parValue: 0, |
| | | name: '', |
| | | }); |
| | | |
| | | const rate = 0.96; |
| | | const emit = defineEmits<{ |
| | | ( |
| | | e: 'goPay', |
| | | form: { |
| | | ispCode: typeof BlLifeRecharge.constants.IspCode; |
| | | phone: string; |
| | | parValue: number; |
| | | name: string; |
| | | } |
| | | ): void; |
| | | }>(); |
| | | |
| | | const { lifePayPhoneRate } = useGetRate(); |
| | | const { phoneParValueList } = useGetPhoneParValue(); |
| | | |
| | | const parValueList = [50, 100, 200]; |
| | | |
| | | const realParValue = computed(() => blLifeRecharge.getRechargeParValue(form.parValue, rate)); |
| | | const realParValue = computed(() => |
| | | blLifeRecharge.getRechargeParValue(form.parValue, lifePayPhoneRate.value) |
| | | ); |
| | | const discountParValue = computed(() => form.parValue - Number(realParValue.value)); |
| | | |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | |
| | | const rules = reactive<FormRules>({}); |
| | | const rules = reactive<FormRules>({ |
| | | ispCode: [{ required: true, message: 'è¯·éæ©è¿è¥å' }], |
| | | phone: [ |
| | | { required: true, message: '请è¾å
¥å
弿æºå·' }, |
| | | { validator: FormValidator.validatorPhoneNumber, message: '请è¾å
¥æ£ç¡®çææºå·' }, |
| | | ], |
| | | name: [{ required: true, message: '请è¾å
¥å§å' }], |
| | | parValue: [ |
| | | { required: true, message: 'è¯·éæ©å
å¼éé¢', validator: FormValidator.validatorNumberNotNull }, |
| | | ], |
| | | }); |
| | | |
| | | const formRef = ref<any>(null); |
| | | |
| | |
| | | if (!formRef.value) return; |
| | | formRef.value.validate().then(({ valid, errors }: any) => { |
| | | if (valid) { |
| | | recharge(); |
| | | } |
| | | }); |
| | | } |
| | |
| | | confirmDialogVisible.value = true; |
| | | } |
| | | |
| | | async function createLifePayPhoneOrder() { |
| | | try { |
| | | let params: LifePhoneDataCreateLifePayOrderInput = { |
| | | userId: blLifeRecharge.userId, |
| | | // lifePayType: 10, |
| | | productData: { |
| | | ispCode: form.ispCode, |
| | | parValue: 0.1, |
| | | phone: '18858418480', |
| | | name: form.ispCode === BlLifeRecharge.constants.IspCode.dianxin ? form.name : '', |
| | | }, |
| | | }; |
| | | let res = await blLifeRecharge.services.createLifePayPhoneOrder(params); |
| | | } catch (error) {} |
| | | } |
| | | |
| | | function goPay() { |
| | | emit('goPay'); |
| | | } |
| | |
| | | <template> |
| | | <div class="select-pay-type-view"> |
| | | <div class="select-pay-type-view-item"> |
| | | <div class="select-pay-type-view-item" @click="handleAliPay"> |
| | | <img class="select-pay-type-view-item-icon" :src="IconAliPay" /> |
| | | <div class="select-pay-type-view-item-text">æ¯ä»å®æ¯ä»</div> |
| | | </div> |
| | |
| | | // type Props = {}; |
| | | |
| | | // const props = withDefaults(defineProps<Props>(), {}); |
| | | |
| | | function handleAliPay() {} |
| | | </script> |
| | |
| | | // @ts-ignore |
| | | import { request } from '@/utils/request'; |
| | | |
| | | /** æ¤å¤å端没ææä¾æ³¨é GET /api/AliPayNotify/AliRechargeNotify */ |
| | | export async function aliRechargeNotify( |
| | | // å å çæçParamç±»å (ébodyåæ°swaggeré»è®¤æ²¡æçæå¯¹è±¡) |
| | | params: API.APIaliRechargeNotifyParams, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<any>('/api/AliPayNotify/AliRechargeNotify', { |
| | | method: 'GET', |
| | | params: { |
| | | ...params, |
| | | }, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** æ¯ä»å®å
å¼åè°éç¥ POST /api/AliPayNotify/AliRechargeNotify */ |
| | | export async function aliRechargeNotify(options?: API.RequestConfig) { |
| | | export async function aliRechargeNotify_2(options?: API.RequestConfig) { |
| | | return request<any>('/api/AliPayNotify/AliRechargeNotify', { |
| | | method: 'POST', |
| | | ...(options || {}), |
| | |
| | | body: API.LifeElectricDataCreateLifePayOrderInput, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<any>('/api/LifePay/CreateLifePayElectricOrder', { |
| | | return request<API.CreateLifePayOrderOutput>('/api/LifePay/CreateLifePayElectricOrder', { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | |
| | | body: API.LifePhoneDataCreateLifePayOrderInput, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<any>('/api/LifePay/CreateLifePayPhoneOrder', { |
| | | return request<API.CreateLifePayOrderOutput>('/api/LifePay/CreateLifePayPhoneOrder', { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | |
| | | }); |
| | | } |
| | | |
| | | /** è·å订ååé¡µæ°æ® POST /api/LifePay/GetLifePayOrderPage */ |
| | | export async function getLifePayOrderPage( |
| | | body: API.QueryLifePayOrderListInput, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<API.LifePayOrderListOutputPageOutput>('/api/LifePay/GetLifePayOrderPage', { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** æ ¹æ®è®¢åå·è·åæ¯ä»ç¶æ GET /api/LifePay/GetPayStatusByOrderNo */ |
| | | export async function getPayStatusByOrderNo( |
| | | // å å çæçParamç±»å (ébodyåæ°swaggeré»è®¤æ²¡æçæå¯¹è±¡) |
| | | params: API.APIgetPayStatusByOrderNoParams, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<API.LifePayStatusEnum>('/api/LifePay/GetPayStatusByOrderNo', { |
| | | method: 'GET', |
| | | params: { |
| | | ...params, |
| | | }, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** è·åè¯è´¹é¢å¼ GET /api/LifePay/GetPhoneParValue */ |
| | | export async function getPhoneParValue(options?: API.RequestConfig) { |
| | | return request<API.PhoneParValueResponse>('/api/LifePay/GetPhoneParValue', { |
| | |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** è·åææ£ GET /api/LifePay/GetRate */ |
| | | export async function getRate(options?: API.RequestConfig) { |
| | | return request<API.LifePayRateListOutput[]>('/api/LifePay/GetRate', { |
| | | method: 'GET', |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** è·åæç订ååé¡µæ°æ® POST /api/LifePay/GetUserLifePayOrderPage */ |
| | | export async function getUserLifePayOrderPage( |
| | | body: API.QueryLifePayOrderListInput, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<API.UserLifePayOrderOutputPageOutput>('/api/LifePay/GetUserLifePayOrderPage', { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** è·åç¨æ·åé¡µæ°æ® POST /api/LifePay/GetUserPage */ |
| | | export async function getUserPage(body: API.PageInput, options?: API.RequestConfig) { |
| | | return request<API.UserListOutputPageOutput>('/api/LifePay/GetUserPage', { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** 鿬¾ç活缴费订å POST /api/LifePay/RefundLifePayOrder */ |
| | | export async function refundLifePayOrder( |
| | | body: API.RefundLifePayOrderInput, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<any>('/api/LifePay/RefundLifePayOrder', { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** è®¾ç½®çæ´»ç¼´è´¹æ¯ä»ç±»å POST /api/LifePay/SetLifePayOrderPayType */ |
| | | export async function setLifePayOrderPayType( |
| | | body: API.SetLifePayOrderPayTypeInput, |
| | | options?: API.RequestConfig |
| | | ) { |
| | | return request<string>('/api/LifePay/SetLifePayOrderPayType', { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | }, |
| | | data: body, |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | /** æ¤å¤å端没ææä¾æ³¨é GET /api/Test/TestAddLifePayRate */ |
| | | export async function testAddLifePayRate(options?: API.RequestConfig) { |
| | | return request<any>('/api/Test/TestAddLifePayRate', { |
| | | method: 'GET', |
| | | ...(options || {}), |
| | | }); |
| | | } |
| | | |
| | | /** æ¤å¤å端没ææä¾æ³¨é GET /api/Test/TestEventBusSendPhoneMessge */ |
| | | export async function testEventBusSendPhoneMessge( |
| | | // å å çæçParamç±»å (ébodyåæ°swaggeré»è®¤æ²¡æçæå¯¹è±¡) |
| | |
| | | id?: string; |
| | | } |
| | | |
| | | interface APIaliRechargeNotifyParams { |
| | | outTradeNo?: string; |
| | | tradeNo?: string; |
| | | success?: boolean; |
| | | } |
| | | |
| | | interface APIapiDefinitionParams { |
| | | includeTypes?: boolean; |
| | | } |
| | |
| | | id?: string; |
| | | } |
| | | |
| | | interface APIgetPayStatusByOrderNoParams { |
| | | orderNo?: string; |
| | | } |
| | | |
| | | interface APIgetPersonalAttestationParams { |
| | | /** ç¨æ·è®¤è¯Id */ |
| | | id?: string; |
| | |
| | | remark?: string; |
| | | } |
| | | |
| | | interface CreateLifePayOrderOutput { |
| | | orderNo?: string; |
| | | } |
| | | |
| | | interface CreateOrEditAdvertiseBoardInput { |
| | | /** Id */ |
| | | id?: string; |
| | |
| | | interface ElectricParValueOutput { |
| | | electricType?: string; |
| | | areaName?: string; |
| | | parValue?: number; |
| | | parValue?: string; |
| | | rate?: number; |
| | | comments?: string; |
| | | } |
| | |
| | | code?: string; |
| | | message?: string; |
| | | detail?: string; |
| | | electricParValue?: ElectricParValueOutput; |
| | | electricParValue?: ElectricParValueOutput[]; |
| | | } |
| | | |
| | | interface EnableSearchSettingInput { |
| | |
| | | |
| | | interface LifeElectricDataCreateLifePayOrderInput { |
| | | userId?: string; |
| | | lifePayType?: LifePayTypeEnum; |
| | | productData?: LifeElectricData; |
| | | } |
| | | |
| | | interface LifePayOrderListOutput { |
| | | id?: string; |
| | | userId?: string; |
| | | /** ç¨æ·ææºå· */ |
| | | phoneNumber?: string; |
| | | lifePayType?: LifePayTypeEnum; |
| | | lifePayOrderType?: LifePayOrderTypeEnum; |
| | | /** 订åå· */ |
| | | orderNo?: string; |
| | | /** å
å¼éé¢ */ |
| | | rechargeAmount?: number; |
| | | /** 伿 éé¢ */ |
| | | discountAmount?: number; |
| | | /** å®ä»éé¢ */ |
| | | payAmount?: number; |
| | | /** æ¯ä»æ¶é´ */ |
| | | payTime?: string; |
| | | payStatus?: LifePayStatusEnum; |
| | | /** å¤é¨è®¢åå· */ |
| | | outOrderNo?: string; |
| | | lifePayOrderStatus?: LifePayOrderStatusEnum; |
| | | /** 宿æ¶é´ */ |
| | | finishTime?: string; |
| | | /** 鿬¾åè¯ */ |
| | | refundCredentialsImgUrl?: string; |
| | | /** ä¸åæ¶é´ */ |
| | | creationTime?: string; |
| | | } |
| | | |
| | | interface LifePayOrderListOutputPageOutput { |
| | | pageModel?: Pagination; |
| | | objectData?: any; |
| | | data?: LifePayOrderListOutput[]; |
| | | } |
| | | |
| | | type LifePayOrderStatusEnum = 10 | 20 | 30; |
| | | |
| | | type LifePayOrderTypeEnum = 10 | 20; |
| | | |
| | | interface LifePayRateListOutput { |
| | | rateType?: LifePayRateTypeEnum; |
| | | rate?: number; |
| | | } |
| | | |
| | | type LifePayRateTypeEnum = 10 | 20; |
| | | |
| | | type LifePayStatusEnum = 10 | 20 | 30 | 40; |
| | | |
| | | type LifePayTypeEnum = 10 | 20; |
| | | |
| | | interface LifePhoneData { |
| | |
| | | parValue: number; |
| | | /** ææºå·ã */ |
| | | phone: string; |
| | | /** æºä¸»åç§°(çµä¿¡ææºå·å¿
å¡«) */ |
| | | name?: string; |
| | | } |
| | | |
| | | interface LifePhoneDataCreateLifePayOrderInput { |
| | | userId?: string; |
| | | lifePayType?: LifePayTypeEnum; |
| | | productData?: LifePhoneData; |
| | | } |
| | | |
| | |
| | | | 29 |
| | | | 30 |
| | | | 31 |
| | | | 32; |
| | | | 32 |
| | | | 40; |
| | | |
| | | interface OrderChangedBzContentInput { |
| | | outBizNo?: string; |
| | |
| | | interface PhoneParValueOutput { |
| | | ispCode?: string; |
| | | ispName?: string; |
| | | parValue?: number; |
| | | parValue?: string; |
| | | rate?: number; |
| | | phoneSection?: string; |
| | | comments?: string; |
| | |
| | | code?: string; |
| | | message?: string; |
| | | detail?: string; |
| | | phoneParValue?: PhoneParValueOutput; |
| | | phoneParValue?: PhoneParValueOutput[]; |
| | | } |
| | | |
| | | interface PhoneToken { |
| | |
| | | docId?: string; |
| | | } |
| | | |
| | | interface QueryLifePayOrderListInput { |
| | | pageModel?: Pagination; |
| | | lifePayOrderType?: LifePayOrderTypeEnum; |
| | | /** å¼å§æ¯ä»æ¶é´ */ |
| | | beginPayTime?: string; |
| | | /** ç»ææ¯ä»æ¶é´ */ |
| | | endPayTime?: string; |
| | | payStatus?: LifePayStatusEnum; |
| | | lifePayOrderStatus?: LifePayOrderStatusEnum; |
| | | /** å¼å§å®ææ¶é´ */ |
| | | beginFinishTime?: string; |
| | | /** ç»æå®ææ¶é´ */ |
| | | endFinishTime?: string; |
| | | /** ç¨æ·Id */ |
| | | userId?: string; |
| | | } |
| | | |
| | | interface QueryMatchMakingApplyByOrderInput { |
| | | pageModel?: Pagination; |
| | | orderId?: string; |
| | |
| | | status?: number; |
| | | } |
| | | |
| | | interface RefundLifePayOrderInput { |
| | | id?: string; |
| | | refundCredentialsImgUrl?: string; |
| | | } |
| | | |
| | | interface RefundOrderContactSignInput { |
| | | /** æç»äººç±»å 10ç²æ¹ 20乿¹ */ |
| | | fromType?: number; |
| | |
| | | prices?: InsurePriceModel[]; |
| | | } |
| | | |
| | | interface SetLifePayOrderPayTypeInput { |
| | | orderNo: string; |
| | | lifePayType?: LifePayTypeEnum; |
| | | } |
| | | |
| | | interface SetManyContractTemplateHandSignKeyInput { |
| | | contractTemplateId?: string; |
| | | listKey?: string[]; |
| | |
| | | certificationChannel?: UserCertificationChannelEnum; |
| | | } |
| | | |
| | | interface UserLifePayOrderOutput { |
| | | id?: string; |
| | | lifePayType?: LifePayTypeEnum; |
| | | lifePayOrderType?: LifePayOrderTypeEnum; |
| | | /** 订åå· */ |
| | | orderNo?: string; |
| | | /** å
å¼éé¢ */ |
| | | rechargeAmount?: number; |
| | | /** 伿 éé¢ */ |
| | | discountAmount?: number; |
| | | /** å®ä»éé¢ */ |
| | | payAmount?: number; |
| | | /** æ¯ä»æ¶é´ */ |
| | | payTime?: string; |
| | | payStatus?: LifePayStatusEnum; |
| | | lifePayOrderStatus?: LifePayOrderStatusEnum; |
| | | /** 宿æ¶é´ */ |
| | | finishTime?: string; |
| | | /** 订åè¯¦ç»æ°æ® */ |
| | | orderParamDetailJsonStr?: string; |
| | | } |
| | | |
| | | interface UserLifePayOrderOutputPageOutput { |
| | | pageModel?: Pagination; |
| | | objectData?: any; |
| | | data?: UserLifePayOrderOutput[]; |
| | | } |
| | | |
| | | interface UserListOutput { |
| | | id?: string; |
| | | /** ç¨æ·ææºå· */ |
| | | phoneNumber?: string; |
| | | lastLoginTime?: string; |
| | | creationTime?: string; |
| | | } |
| | | |
| | | interface UserListOutputPageOutput { |
| | | pageModel?: Pagination; |
| | | objectData?: any; |
| | | data?: UserListOutput[]; |
| | | } |
| | | |
| | | interface UserMessageInfo { |
| | | /** æ¶æ¯Id */ |
| | | id?: string; |