| | |
| | | |
| | | type Props = { |
| | | label?: string; |
| | | content?: string; |
| | | content?: string | number; |
| | | danger?: boolean; |
| | | }; |
| | | |
New file |
| | |
| | | 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 || ''; |
New file |
| | |
| | | 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; |
| | | } |
New file |
| | |
| | | // 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> |
| | |
| | | v-model.trim="form.phone" |
| | | class="bole-input-text" |
| | | placeholder="请填写您需要充值的手机号码" |
| | | 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> |
| | |
| | | </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; |
| | | } |
| | |
| | | |
| | | interface APIgetParkRewardDetailParams { |
| | | id?: string; |
| | | } |
| | | |
| | | interface APIgetPayStatusByOrderNoParams { |
| | | orderNo?: string; |
| | | } |
| | | |
| | | interface APIgetPersonalAttestationParams { |
| | |
| | | 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; |
| | | |
| | |
| | | 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; |
| | |
| | | refundDealRemark?: string; |
| | | /** 状态:0待确认验收,10待评价,20交易完成,-10申请退款,-20退款成功,-30申请退款驳回 */ |
| | | status?: number; |
| | | } |
| | | |
| | | interface RefundLifePayOrderInput { |
| | | id?: string; |
| | | refundCredentialsImgUrl?: string; |
| | | } |
| | | |
| | | interface RefundOrderContactSignInput { |
| | |
| | | |
| | | interface SetInsureSettingPriceInput { |
| | | prices?: InsurePriceModel[]; |
| | | } |
| | | |
| | | interface SetLifePayOrderPayTypeInput { |
| | | orderNo: string; |
| | | lifePayType?: LifePayTypeEnum; |
| | | } |
| | | |
| | | interface SetManyContractTemplateHandSignKeyInput { |
| | |
| | | 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; |