From bc9db06646fc925635dd5995d521bcf9fd05aa93 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期五, 21 二月 2025 16:35:04 +0800
Subject: [PATCH] fix: 对接
---
packages/services/api/Test.ts | 8
packages/components/src/utils/lifeRechargeConstants.ts | 49 +++
packages/components/src/views/PhoneBillRecharge/PhoneBillRecharge.vue | 101 +++++-
packages/components/src/components/Dialog/ConfirmDialogInfoItem.vue | 2
packages/components/src/utils/index.ts | 1
packages/services/api/typings.d.ts | 146 +++++++++
packages/components/src/views/SelectPayTypeView/SelectPayTypeView.vue | 4
packages/services/api/AliPayNotify.ts | 17 +
packages/components/src/utils/lifeRecharge.ts | 4
packages/components/src/utils/lifeRechargeServices.ts | 184 ++++++++++++
packages/components/src/hooks/index.ts | 59 ++++
packages/services/api/LifePay.ts | 99 ++++++
packages/components/src/utils/validator.ts | 115 ++++++++
13 files changed, 752 insertions(+), 37 deletions(-)
diff --git a/packages/components/src/components/Dialog/ConfirmDialogInfoItem.vue b/packages/components/src/components/Dialog/ConfirmDialogInfoItem.vue
index 17a7681..b8c3dda 100644
--- a/packages/components/src/components/Dialog/ConfirmDialogInfoItem.vue
+++ b/packages/components/src/components/Dialog/ConfirmDialogInfoItem.vue
@@ -12,7 +12,7 @@
type Props = {
label?: string;
- content?: string;
+ content?: string | number;
danger?: boolean;
};
diff --git a/packages/components/src/hooks/index.ts b/packages/components/src/hooks/index.ts
new file mode 100644
index 0000000..8513ce7
--- /dev/null
+++ b/packages/components/src/hooks/index.ts
@@ -0,0 +1,59 @@
+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,
+ };
+}
diff --git a/packages/components/src/utils/index.ts b/packages/components/src/utils/index.ts
index 0545fe5..d446ea1 100644
--- a/packages/components/src/utils/index.ts
+++ b/packages/components/src/utils/index.ts
@@ -2,3 +2,4 @@
export * from './plugin';
export * from './lifeRechargeServices';
export * from './types';
+export * from './validator';
diff --git a/packages/components/src/utils/lifeRecharge.ts b/packages/components/src/utils/lifeRecharge.ts
index 36714ce..5afe980 100644
--- a/packages/components/src/utils/lifeRecharge.ts
+++ b/packages/components/src/utils/lifeRecharge.ts
@@ -4,11 +4,15 @@
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 || '';
diff --git a/packages/components/src/utils/lifeRechargeConstants.ts b/packages/components/src/utils/lifeRechargeConstants.ts
new file mode 100644
index 0000000..c6dfd5b
--- /dev/null
+++ b/packages/components/src/utils/lifeRechargeConstants.ts
@@ -0,0 +1,49 @@
+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]: '涓浗鑱旈��',
+ };
+}
diff --git a/packages/components/src/utils/lifeRechargeServices.ts b/packages/components/src/utils/lifeRechargeServices.ts
index 7493a37..f8f6b2b 100644
--- a/packages/components/src/utils/lifeRechargeServices.ts
+++ b/packages/components/src/utils/lifeRechargeServices.ts
@@ -1,12 +1,6 @@
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 {}
@@ -26,4 +20,180 @@
...(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:缂磋垂鎴愬姛锛宲arValue>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"浠h〃鍥藉鐢电綉锛�"nanwang"浠h〃鍗楁柟鐢电綉銆� */
+ electricType: string;
+ /** 鐢佃垂绫诲瀷锛屽浗缃戝繀浼狅細浣忓畢銆佷紒浜嬩笟銆佸簵閾轰笁涓�夐」銆� */
+ electricAccountType: string;
+ /** 鐢佃垂鎴峰彿銆� */
+ electricAccount: string;
+ /** 鐪佷唤銆� */
+ province: string;
+ /** 鍩庡競銆� */
+ city: string;
+ /** 瀹㈡埛韬唤璇佸悗6浣嶏紝鍗楃綉蹇呬紶銆� */
+ sixID?: string;
+}
+
+export interface APIgetPayStatusByOrderNoParams {
+ orderNo?: string;
}
diff --git a/packages/components/src/utils/validator.ts b/packages/components/src/utils/validator.ts
new file mode 100644
index 0000000..cb4a54b
--- /dev/null
+++ b/packages/components/src/utils/validator.ts
@@ -0,0 +1,115 @@
+// 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\-\\@?^=%&/~\\+#])?$/;
+}
diff --git a/packages/components/src/views/PhoneBillRecharge/PhoneBillRecharge.vue b/packages/components/src/views/PhoneBillRecharge/PhoneBillRecharge.vue
index f3d2d56..484d4ba 100644
--- a/packages/components/src/views/PhoneBillRecharge/PhoneBillRecharge.vue
+++ b/packages/components/src/views/PhoneBillRecharge/PhoneBillRecharge.vue
@@ -8,7 +8,12 @@
>
<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>
@@ -16,6 +21,20 @@
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>
@@ -35,15 +54,17 @@
</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>
@@ -53,9 +74,9 @@
</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>
@@ -67,36 +88,63 @@
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);
@@ -104,6 +152,7 @@
if (!formRef.value) return;
formRef.value.validate().then(({ valid, errors }: any) => {
if (valid) {
+ recharge();
}
});
}
@@ -123,6 +172,22 @@
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');
}
diff --git a/packages/components/src/views/SelectPayTypeView/SelectPayTypeView.vue b/packages/components/src/views/SelectPayTypeView/SelectPayTypeView.vue
index 818faa5..95cf51f 100644
--- a/packages/components/src/views/SelectPayTypeView/SelectPayTypeView.vue
+++ b/packages/components/src/views/SelectPayTypeView/SelectPayTypeView.vue
@@ -1,6 +1,6 @@
<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>
@@ -22,4 +22,6 @@
// type Props = {};
// const props = withDefaults(defineProps<Props>(), {});
+
+function handleAliPay() {}
</script>
diff --git a/packages/services/api/AliPayNotify.ts b/packages/services/api/AliPayNotify.ts
index 9ed98b0..359d1a0 100644
--- a/packages/services/api/AliPayNotify.ts
+++ b/packages/services/api/AliPayNotify.ts
@@ -2,8 +2,23 @@
// @ts-ignore
import { request } from '@/utils/request';
+/** 姝ゅ鍚庣娌℃湁鎻愪緵娉ㄩ噴 GET /api/AliPayNotify/AliRechargeNotify */
+export async function aliRechargeNotify(
+ // 鍙犲姞鐢熸垚鐨凱aram绫诲瀷 (闈瀊ody鍙傛暟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 || {}),
diff --git a/packages/services/api/LifePay.ts b/packages/services/api/LifePay.ts
index 09b6036..301d9d3 100644
--- a/packages/services/api/LifePay.ts
+++ b/packages/services/api/LifePay.ts
@@ -7,7 +7,7 @@
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',
@@ -22,7 +22,7 @@
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',
@@ -40,6 +40,36 @@
});
}
+/** 鑾峰彇璁㈠崟鍒嗛〉鏁版嵁 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(
+ // 鍙犲姞鐢熸垚鐨凱aram绫诲瀷 (闈瀊ody鍙傛暟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', {
@@ -47,3 +77,68 @@
...(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 || {}),
+ });
+}
diff --git a/packages/services/api/Test.ts b/packages/services/api/Test.ts
index 728fc7c..2fd5623 100644
--- a/packages/services/api/Test.ts
+++ b/packages/services/api/Test.ts
@@ -114,6 +114,14 @@
});
}
+/** 姝ゅ鍚庣娌℃湁鎻愪緵娉ㄩ噴 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(
// 鍙犲姞鐢熸垚鐨凱aram绫诲瀷 (闈瀊ody鍙傛暟swagger榛樿娌℃湁鐢熸垚瀵硅薄)
diff --git a/packages/services/api/typings.d.ts b/packages/services/api/typings.d.ts
index 38bcbd5..c913d8b 100644
--- a/packages/services/api/typings.d.ts
+++ b/packages/services/api/typings.d.ts
@@ -917,6 +917,12 @@
id?: string;
}
+ interface APIaliRechargeNotifyParams {
+ outTradeNo?: string;
+ tradeNo?: string;
+ success?: boolean;
+ }
+
interface APIapiDefinitionParams {
includeTypes?: boolean;
}
@@ -1558,6 +1564,10 @@
interface APIgetParkRewardDetailParams {
id?: string;
+ }
+
+ interface APIgetPayStatusByOrderNoParams {
+ orderNo?: string;
}
interface APIgetPersonalAttestationParams {
@@ -3989,6 +3999,10 @@
remark?: string;
}
+ interface CreateLifePayOrderOutput {
+ orderNo?: string;
+ }
+
interface CreateOrEditAdvertiseBoardInput {
/** Id */
id?: string;
@@ -5454,7 +5468,7 @@
interface ElectricParValueOutput {
electricType?: string;
areaName?: string;
- parValue?: number;
+ parValue?: string;
rate?: number;
comments?: string;
}
@@ -5471,7 +5485,7 @@
code?: string;
message?: string;
detail?: string;
- electricParValue?: ElectricParValueOutput;
+ electricParValue?: ElectricParValueOutput[];
}
interface EnableSearchSettingInput {
@@ -12154,9 +12168,56 @@
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;
@@ -12167,11 +12228,12 @@
parValue: number;
/** 鎵嬫満鍙枫�� */
phone: string;
+ /** 鏈轰富鍚嶇О(鐢典俊鎵嬫満鍙峰繀濉�) */
+ name?: string;
}
interface LifePhoneDataCreateLifePayOrderInput {
userId?: string;
- lifePayType?: LifePayTypeEnum;
productData?: LifePhoneData;
}
@@ -13439,7 +13501,8 @@
| 29
| 30
| 31
- | 32;
+ | 32
+ | 40;
interface OrderChangedBzContentInput {
outBizNo?: string;
@@ -14854,7 +14917,7 @@
interface PhoneParValueOutput {
ispCode?: string;
ispName?: string;
- parValue?: number;
+ parValue?: string;
rate?: number;
phoneSection?: string;
comments?: string;
@@ -14872,7 +14935,7 @@
code?: string;
message?: string;
detail?: string;
- phoneParValue?: PhoneParValueOutput;
+ phoneParValue?: PhoneParValueOutput[];
}
interface PhoneToken {
@@ -15968,6 +16031,23 @@
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;
@@ -16625,6 +16705,11 @@
refundDealRemark?: string;
/** 鐘舵�侊細0寰呯‘璁ら獙鏀讹紝10寰呰瘎浠凤紝20浜ゆ槗瀹屾垚锛�-10鐢宠閫�娆撅紝-20閫�娆炬垚鍔燂紝-30鐢宠閫�娆鹃┏鍥� */
status?: number;
+ }
+
+ interface RefundLifePayOrderInput {
+ id?: string;
+ refundCredentialsImgUrl?: string;
}
interface RefundOrderContactSignInput {
@@ -17325,6 +17410,11 @@
interface SetInsureSettingPriceInput {
prices?: InsurePriceModel[];
+ }
+
+ interface SetLifePayOrderPayTypeInput {
+ orderNo: string;
+ lifePayType?: LifePayTypeEnum;
}
interface SetManyContractTemplateHandSignKeyInput {
@@ -20101,6 +20191,48 @@
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;
--
Gitblit v1.9.1