😎1、调整微信支付相关 2、升级npm依赖

This commit is contained in:
zuohuaijun 2024-09-05 02:35:06 +08:00
parent fc6acdb3e6
commit ae0d1e6827
18 changed files with 1090 additions and 23 deletions

View File

@ -150,6 +150,29 @@ public partial class SysWechatPay : EntityBase
[SugarColumn(ColumnDescription = "微信OpenId标识")]
public string? OpenId { get; set; }
/// <summary>
/// 业务标签,用来区分做什么业务
/// </summary>
/// <remarks>
/// Tags标识用来区分这个支付记录对应什么业务从而确定相关联的表名
/// 再结合BusinessId保存了对应的业务数据的ID就可以确定这个支付
/// 记录与哪一条业务数据相关联
/// </remarks>
[SugarColumn(ColumnDescription = "业务标签,用来区分做什么业务", Length = 64)]
public string? Tags { get; set; }
/// <summary>
/// 对应业务的主键
/// </summary>
[SugarColumn(ColumnDescription = "对应业务的主键")]
public long BusinessId { get; set; }
/// <summary>
/// 付款二维码内容
/// </summary>
[SugarColumn(ColumnDescription = "付款二维码内容")]
public string? QrcodeContent { get; set; }
/// <summary>
/// 关联微信用户
/// </summary>

View File

@ -42,6 +42,16 @@ public class WechatPayTransactionInput
/// 关联的商户订单付款状态(或者为第几次支付,有些订单涉及多次支付,比如先付预付款,后补尾款)
/// </summary>
public string OrderStatus { get; set; } = "0";
/// <summary>
/// 业务标签,用来区分做什么业务
/// </summary>
public string Tags { get; set; }
/// <summary>
/// 对应业务的主键
/// </summary>
public long BusinessId { get; set; }
}
public class WechatPayParaInput

View File

@ -68,4 +68,27 @@ public class CreatePayTransactionOutput
{
public string PrepayId { get; set; }
public string OutTradeNumber { get; set; }
public WechatPayParaOutput SingInfo { get; set; }
}
public class WechatPayParaOutput
{
public string AppId { get; set; }
public string TimeStamp { get; set; }
public string NonceStr { get; set; }
public string Package { get; set; }
public string SignType { get; set; }
public string PaySign { get; set; }
}
public class CreatePayTransactionNativeOutput
{
public string OutTradeNumber { get; set; }
public string QrcodeUrl { get; set; }
}

View File

@ -4,6 +4,9 @@
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Furion.Logging.Extensions;
using Newtonsoft.Json;
namespace Admin.NET.Core.Service;
/// <summary>
@ -73,7 +76,7 @@ public class SysWechatPayService : IDynamicApiController, ITransient
{
string outTradeNumber = DateTimeOffset.Now.ToString("yyyyMMddHHmmssfff") + (new Random()).Next(100, 1000); // 微信需要的订单号(唯一)
//检查订单信息是否已存在(使用“商户交易单号+状态”唯一性判断)
// 检查订单信息是否已存在(使用“商户交易单号+状态”唯一性判断)
var wechatPay = await _sysWechatPayRep.GetFirstAsync(u => u.OrderId == input.OrderId && u.OrderStatus == input.OrderStatus);
if (wechatPay != null)
{
@ -111,15 +114,68 @@ public class SysWechatPayService : IDynamicApiController, ITransient
OpenId = input.OpenId,
TransactionId = "",
OrderId = input.OrderId,
OrderStatus = input.OrderStatus
OrderStatus = input.OrderStatus,
Tags = input.Tags,
BusinessId = input.BusinessId,
};
await _sysWechatPayRep.InsertAsync(wechatPay);
}
var singInfo = GenerateParametersForJsapiPay(new WechatPayParaInput() { PrepayId = response.PrepayId });
return new CreatePayTransactionOutput
{
PrepayId = response.PrepayId,
OutTradeNumber = request.OutTradeNumber
OutTradeNumber = request.OutTradeNumber,
SingInfo = singInfo
};
}
/// <summary>
/// 微信支付统一下单(商户直连)Native
/// </summary>
[DisplayName("微信支付统一下单(商户直连)Native")]
public async Task<CreatePayTransactionNativeOutput> CreatePayTransactionNative([FromBody] WechatPayTransactionInput input)
{
var request = new CreatePayTransactionNativeRequest()
{
OutTradeNumber = DateTimeOffset.Now.ToString("yyyyMMddHHmmssfff") + (new Random()).Next(100, 1000), // 微信需要的订单号(唯一)
AppId = _wechatPayOptions.AppId,
Description = input.Description,
Attachment = input.Attachment,
GoodsTag = input.GoodsTag,
ExpireTime = DateTimeOffset.Now.AddMinutes(10),
NotifyUrl = _payCallBackOptions.WechatPayUrl,
Amount = new CreatePayTransactionNativeRequest.Types.Amount() { Total = input.Total },
//Payer = new CreatePayTransactionNativeRequest.Types.Payer() { OpenId = input.OpenId }
Scene = new CreatePayTransactionNativeRequest.Types.Scene() { ClientIp = "127.0.0.1" }
};
var response = await _wechatTenpayClient.ExecuteCreatePayTransactionNativeAsync(request);
if (!response.IsSuccessful())
{
JsonConvert.SerializeObject(response).LogInformation();
throw Oops.Oh(response.ErrorMessage);
}
// 保存订单信息
var wechatPay = new SysWechatPay()
{
AppId = _wechatPayOptions.AppId,
MerchantId = _wechatPayOptions.MerchantId,
OutTradeNumber = request.OutTradeNumber,
Description = input.Description,
Attachment = input.Attachment,
GoodsTag = input.GoodsTag,
Total = input.Total,
OpenId = input.OpenId,
TransactionId = "",
QrcodeContent = response.QrcodeUrl,
Tags = input.Tags,
BusinessId = input.BusinessId,
};
await _sysWechatPayRep.InsertAsync(wechatPay);
return new CreatePayTransactionNativeOutput
{
OutTradeNumber = request.OutTradeNumber,
QrcodeUrl = response.QrcodeUrl
};
}
@ -439,8 +495,6 @@ public class SysWechatPayService : IDynamicApiController, ITransient
public async Task<SqlSugarPagedList<SysWechatPay>> PageAsync(PageSysWechatPayInput input)
{
var query = _sysWechatPayRep.AsQueryable()
//.WhereIF(input.OrderId > 0, u => u.OrderId == input.OrderId)
//.WhereIF(input.OrderStatus > 0, u => u.OrderStatus == input.OrderStatus)
.WhereIF(!string.IsNullOrWhiteSpace(input.OrderId), u => u.OrderId == input.OrderId)
.WhereIF(!string.IsNullOrWhiteSpace(input.OrderStatus), u => u.OrderStatus == input.OrderStatus)
.WhereIF(!string.IsNullOrWhiteSpace(input.OutTradeNumber), u => u.OutTradeNumber.Contains(input.OutTradeNumber.Trim()));
@ -468,4 +522,15 @@ public class SysWechatPayService : IDynamicApiController, ITransient
query = query.OrderByDescending(u => u.CreateTime);
return await query.ToPagedListAsync(input.Page, input.PageSize);
}
/// <summary>
/// 根据支付Id获取退款信息列表
/// </summary>
/// <param name="transactionId"></param>
/// <returns></returns>
[DisplayName("根据支付Id获取退款信息列表")]
public async Task<List<SysWechatRefund>> GetRefundList([FromQuery] string transactionId)
{
return await _sysWechatRefundRep.AsQueryable().Where(u => u.TransactionId == transactionId).ToListAsync();
}
}

View File

@ -2,7 +2,7 @@
"name": "admin.net.pro",
"type": "module",
"version": "2.4.33",
"lastBuildTime": "2024.09.01",
"lastBuildTime": "2024.09.05",
"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
"author": "zuohuaijun",
"license": "MIT",
@ -53,14 +53,14 @@
"push.js": "^1.0.12",
"qrcodejs2-fixes": "^0.0.2",
"qs": "^6.13.0",
"relation-graph": "^2.2.3",
"relation-graph": "^2.2.4",
"screenfull": "^6.0.2",
"sm-crypto-v2": "^1.9.2",
"sortablejs": "^1.15.2",
"sortablejs": "^1.15.3",
"splitpanes": "^3.1.5",
"vcrontab-3": "^3.3.22",
"vform3-builds": "^3.0.10",
"vue": "^3.4.38",
"vue": "^3.5.1",
"vue-clipboard3": "^2.0.0",
"vue-demi": "0.14.6",
"vue-draggable-plus": "^0.5.3",
@ -71,7 +71,7 @@
"vue-router": "^4.4.3",
"vue-signature-pad": "^3.0.2",
"vue3-tree-org": "^4.2.2",
"vxe-pc-ui": "^4.1.15",
"vxe-pc-ui": "^4.1.17",
"vxe-table": "^4.7.59",
"vxe-table-plugin-element": "^4.0.4",
"vxe-table-plugin-export-xlsx": "^4.0.5",
@ -85,22 +85,22 @@
"@types/node": "^20.14.14",
"@types/nprogress": "^0.2.3",
"@types/sortablejs": "^1.15.8",
"@typescript-eslint/eslint-plugin": "^8.3.0",
"@typescript-eslint/parser": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^8.4.0",
"@typescript-eslint/parser": "^8.4.0",
"@vitejs/plugin-vue": "^5.1.3",
"@vitejs/plugin-vue-jsx": "^4.0.1",
"@vue/compiler-sfc": "^3.4.38",
"@vue/compiler-sfc": "^3.5.1",
"code-inspector-plugin": "^0.16.1",
"eslint": "^9.9.1",
"eslint-plugin-vue": "^9.27.0",
"eslint-plugin-vue": "^9.28.0",
"globals": "^15.8.0",
"less": "^4.2.0",
"prettier": "^3.3.3",
"rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.77.8",
"sass": "^1.78.0",
"terser": "^5.31.6",
"typescript": "^5.5.4",
"vite": "^5.4.2",
"vite": "^5.4.3",
"vite-plugin-cdn-import": "^1.0.1",
"vite-plugin-compression2": "^1.2.0",
"vite-plugin-vue-setup-extend": "^0.4.0",

View File

@ -17,8 +17,10 @@ import { Configuration } from '../configuration';
// Some imports not used depending on template conditions
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
import { AdminResultCreatePayTransactionNativeOutput } from '../models';
import { AdminResultCreatePayTransactionOutput } from '../models';
import { AdminResultGetRefundDomesticRefundByOutRefundNumberResponse } from '../models';
import { AdminResultListSysWechatRefund } from '../models';
import { AdminResultObject } from '../models';
import { AdminResultSqlSugarPagedListSysWechatPay } from '../models';
import { AdminResultSysWechatPay } from '../models';
@ -410,6 +412,54 @@ export const SysWechatPayApiAxiosParamCreator = function (configuration?: Config
options: localVarRequestOptions,
};
},
/**
*
* @summary ()Native
* @param {WechatPayTransactionInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiSysWechatPayPayTransactionNativePost: async (body?: WechatPayTransactionInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/sysWechatPay/payTransactionNative`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication Bearer required
// http bearer authentication required
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
}
localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
}
for (const key in options.params) {
query.set(key, options.params[key]);
}
localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
},
/**
*
* @summary Id() 🔖
@ -507,6 +557,54 @@ export const SysWechatPayApiAxiosParamCreator = function (configuration?: Config
options: localVarRequestOptions,
};
},
/**
*
* @summary Id获取退款信息列表
* @param {string} [transactionId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiSysWechatPayRefundListGet: async (transactionId?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/sysWechatPay/refundList`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication Bearer required
// http bearer authentication required
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
}
if (transactionId !== undefined) {
localVarQueryParameter['transactionId'] = transactionId;
}
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
}
for (const key in options.params) {
query.set(key, options.params[key]);
}
localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
},
/**
*
* @summary 退 🔖 https://pay.weixin.qq.com/docs/merchant/apis/mini-program-payment/create.html
@ -674,6 +772,20 @@ export const SysWechatPayApiFp = function(configuration?: Configuration) {
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary ()Native
* @param {WechatPayTransactionInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiSysWechatPayPayTransactionNativePost(body?: WechatPayTransactionInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultCreatePayTransactionNativeOutput>>> {
const localVarAxiosArgs = await SysWechatPayApiAxiosParamCreator(configuration).apiSysWechatPayPayTransactionNativePost(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Id() 🔖
@ -702,6 +814,20 @@ export const SysWechatPayApiFp = function(configuration?: Configuration) {
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Id获取退款信息列表
* @param {string} [transactionId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiSysWechatPayRefundListGet(transactionId?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultListSysWechatRefund>>> {
const localVarAxiosArgs = await SysWechatPayApiAxiosParamCreator(configuration).apiSysWechatPayRefundListGet(transactionId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary 退 🔖 https://pay.weixin.qq.com/docs/merchant/apis/mini-program-payment/create.html
@ -803,6 +929,16 @@ export const SysWechatPayApiFactory = function (configuration?: Configuration, b
async apiSysWechatPayPayTransactionByOutTradeNumberOutTradeNumberGet(outTradeNumber: string, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultWechatPayOutput>> {
return SysWechatPayApiFp(configuration).apiSysWechatPayPayTransactionByOutTradeNumberOutTradeNumberGet(outTradeNumber, options).then((request) => request(axios, basePath));
},
/**
*
* @summary ()Native
* @param {WechatPayTransactionInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiSysWechatPayPayTransactionNativePost(body?: WechatPayTransactionInput, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultCreatePayTransactionNativeOutput>> {
return SysWechatPayApiFp(configuration).apiSysWechatPayPayTransactionNativePost(body, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Id() 🔖
@ -823,6 +959,16 @@ export const SysWechatPayApiFactory = function (configuration?: Configuration, b
async apiSysWechatPayRefundByOutRefundNumberOutRefundNumberGet(outRefundNumber: string, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultGetRefundDomesticRefundByOutRefundNumberResponse>> {
return SysWechatPayApiFp(configuration).apiSysWechatPayRefundByOutRefundNumberOutRefundNumberGet(outRefundNumber, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Id获取退款信息列表
* @param {string} [transactionId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiSysWechatPayRefundListGet(transactionId?: string, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultListSysWechatRefund>> {
return SysWechatPayApiFp(configuration).apiSysWechatPayRefundListGet(transactionId, options).then((request) => request(axios, basePath));
},
/**
*
* @summary 退 🔖 https://pay.weixin.qq.com/docs/merchant/apis/mini-program-payment/create.html
@ -929,6 +1075,17 @@ export class SysWechatPayApi extends BaseAPI {
public async apiSysWechatPayPayTransactionByOutTradeNumberOutTradeNumberGet(outTradeNumber: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultWechatPayOutput>> {
return SysWechatPayApiFp(this.configuration).apiSysWechatPayPayTransactionByOutTradeNumberOutTradeNumberGet(outTradeNumber, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary ()Native
* @param {WechatPayTransactionInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SysWechatPayApi
*/
public async apiSysWechatPayPayTransactionNativePost(body?: WechatPayTransactionInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultCreatePayTransactionNativeOutput>> {
return SysWechatPayApiFp(this.configuration).apiSysWechatPayPayTransactionNativePost(body, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Id() 🔖
@ -951,6 +1108,17 @@ export class SysWechatPayApi extends BaseAPI {
public async apiSysWechatPayRefundByOutRefundNumberOutRefundNumberGet(outRefundNumber: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultGetRefundDomesticRefundByOutRefundNumberResponse>> {
return SysWechatPayApiFp(this.configuration).apiSysWechatPayRefundByOutRefundNumberOutRefundNumberGet(outRefundNumber, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Id获取退款信息列表
* @param {string} [transactionId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SysWechatPayApi
*/
public async apiSysWechatPayRefundListGet(transactionId?: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultListSysWechatRefund>> {
return SysWechatPayApiFp(this.configuration).apiSysWechatPayRefundListGet(transactionId, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary 退 🔖 https://pay.weixin.qq.com/docs/merchant/apis/mini-program-payment/create.html

View File

@ -0,0 +1,69 @@
/* tslint:disable */
/* eslint-disable */
/**
* Admin.NET
* .NET <br/><u><b><font color='FF0000'> 👮</font></b></u>
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { CreatePayTransactionNativeOutput } from './create-pay-transaction-native-output';
/**
*
*
* @export
* @interface AdminResultCreatePayTransactionNativeOutput
*/
export interface AdminResultCreatePayTransactionNativeOutput {
/**
*
*
* @type {number}
* @memberof AdminResultCreatePayTransactionNativeOutput
*/
code?: number;
/**
* successwarningerror
*
* @type {string}
* @memberof AdminResultCreatePayTransactionNativeOutput
*/
type?: string | null;
/**
*
*
* @type {string}
* @memberof AdminResultCreatePayTransactionNativeOutput
*/
message?: string | null;
/**
* @type {CreatePayTransactionNativeOutput}
* @memberof AdminResultCreatePayTransactionNativeOutput
*/
result?: CreatePayTransactionNativeOutput;
/**
*
*
* @type {any}
* @memberof AdminResultCreatePayTransactionNativeOutput
*/
extras?: any | null;
/**
*
*
* @type {Date}
* @memberof AdminResultCreatePayTransactionNativeOutput
*/
time?: Date;
}

View File

@ -0,0 +1,71 @@
/* tslint:disable */
/* eslint-disable */
/**
* Admin.NET
* .NET <br/><u><b><font color='FF0000'> 👮</font></b></u>
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import { SysWechatRefund } from './sys-wechat-refund';
/**
*
*
* @export
* @interface AdminResultListSysWechatRefund
*/
export interface AdminResultListSysWechatRefund {
/**
*
*
* @type {number}
* @memberof AdminResultListSysWechatRefund
*/
code?: number;
/**
* successwarningerror
*
* @type {string}
* @memberof AdminResultListSysWechatRefund
*/
type?: string | null;
/**
*
*
* @type {string}
* @memberof AdminResultListSysWechatRefund
*/
message?: string | null;
/**
*
*
* @type {Array<SysWechatRefund>}
* @memberof AdminResultListSysWechatRefund
*/
result?: Array<SysWechatRefund> | null;
/**
*
*
* @type {any}
* @memberof AdminResultListSysWechatRefund
*/
extras?: any | null;
/**
*
*
* @type {Date}
* @memberof AdminResultListSysWechatRefund
*/
time?: Date;
}

View File

@ -0,0 +1,34 @@
/* tslint:disable */
/* eslint-disable */
/**
* Admin.NET
* .NET <br/><u><b><font color='FF0000'> 👮</font></b></u>
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/**
*
*
* @export
* @interface CreatePayTransactionNativeOutput
*/
export interface CreatePayTransactionNativeOutput {
/**
* @type {string}
* @memberof CreatePayTransactionNativeOutput
*/
outTradeNumber?: string | null;
/**
* @type {string}
* @memberof CreatePayTransactionNativeOutput
*/
qrcodeUrl?: string | null;
}

View File

@ -12,6 +12,7 @@
* Do not edit the class manually.
*/
import { WechatPayParaOutput } from './wechat-pay-para-output';
/**
*
*
@ -31,4 +32,10 @@ export interface CreatePayTransactionOutput {
* @memberof CreatePayTransactionOutput
*/
outTradeNumber?: string | null;
/**
* @type {WechatPayParaOutput}
* @memberof CreatePayTransactionOutput
*/
singInfo?: WechatPayParaOutput;
}

View File

@ -20,6 +20,7 @@ export * from './add-sys-ldap-input';
export * from './add-tenant-input';
export * from './add-user-input';
export * from './admin-result-boolean';
export * from './admin-result-create-pay-transaction-native-output';
export * from './admin-result-create-pay-transaction-output';
export * from './admin-result-data-set';
export * from './admin-result-data-table';
@ -64,6 +65,7 @@ export * from './admin-result-list-sys-region';
export * from './admin-result-list-sys-schedule';
export * from './admin-result-list-sys-user';
export * from './admin-result-list-sys-user-ext-org';
export * from './admin-result-list-sys-wechat-refund';
export * from './admin-result-list-table-output';
export * from './admin-result-login-output';
export * from './admin-result-login-user-output';
@ -133,6 +135,7 @@ export * from './compare-info';
export * from './const-output';
export * from './constructor-info';
export * from './create-entity-input';
export * from './create-pay-transaction-native-output';
export * from './create-pay-transaction-output';
export * from './create-seed-data-input';
export * from './culture-info';
@ -373,6 +376,7 @@ export * from './sys-schedule';
export * from './sys-user';
export * from './sys-user-ext-org';
export * from './sys-wechat-pay';
export * from './sys-wechat-refund';
export * from './sys-wx-open-upload-avatar-body';
export * from './table-output';
export * from './tenant-id-input';
@ -418,6 +422,7 @@ export * from './visual-db-table';
export * from './visual-table';
export * from './wechat-pay-output';
export * from './wechat-pay-para-input';
export * from './wechat-pay-para-output';
export * from './wechat-pay-transaction-input';
export * from './wechat-user-login';
export * from './wx-open-id-login-input';

View File

@ -30,6 +30,12 @@ export interface MemberInfo {
*/
memberType?: MemberTypes;
/**
* @type {string}
* @memberof MemberInfo
*/
name?: string | null;
/**
* @type {Type}
* @memberof MemberInfo
@ -42,12 +48,6 @@ export interface MemberInfo {
*/
reflectedType?: Type;
/**
* @type {string}
* @memberof MemberInfo
*/
name?: string | null;
/**
* @type {Module}
* @memberof MemberInfo

View File

@ -222,7 +222,7 @@ export interface SysCodeGen {
isApiService?: boolean;
/**
*
* SysCodeGenTemplateRelation表中的CodeGenIdCodeGenTemplateRelations手动赋值
*
* @type {Array<SysCodeGenTemplateRelation>}
* @memberof SysCodeGen

View File

@ -260,6 +260,30 @@ export interface SysWechatPay {
*/
openId?: string | null;
/**
*
*
* @type {string}
* @memberof SysWechatPay
*/
tags?: string | null;
/**
*
*
* @type {number}
* @memberof SysWechatPay
*/
businessId?: number;
/**
*
*
* @type {string}
* @memberof SysWechatPay
*/
qrcodeContent?: string | null;
/**
*
*

View File

@ -0,0 +1,222 @@
/* tslint:disable */
/* eslint-disable */
/**
* Admin.NET
* .NET <br/><u><b><font color='FF0000'> 👮</font></b></u>
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/**
* 退
*
* @export
* @interface SysWechatRefund
*/
export interface SysWechatRefund {
/**
* Id
*
* @type {number}
* @memberof SysWechatRefund
*/
id?: number;
/**
*
*
* @type {Date}
* @memberof SysWechatRefund
*/
createTime?: Date;
/**
*
*
* @type {Date}
* @memberof SysWechatRefund
*/
updateTime?: Date | null;
/**
* Id
*
* @type {number}
* @memberof SysWechatRefund
*/
createUserId?: number | null;
/**
*
*
* @type {string}
* @memberof SysWechatRefund
*/
createUserName?: string | null;
/**
* Id
*
* @type {number}
* @memberof SysWechatRefund
*/
updateUserId?: number | null;
/**
*
*
* @type {string}
* @memberof SysWechatRefund
*/
updateUserName?: string | null;
/**
*
*
* @type {boolean}
* @memberof SysWechatRefund
*/
isDelete?: boolean;
/**
* ()
*
* @type {string}
* @memberof SysWechatRefund
*/
transactionId: string;
/**
* ()
*
* @type {string}
* @memberof SysWechatRefund
*/
outTradeNumber: string;
/**
* 退_-|*@ 退退
*
* @type {string}
* @memberof SysWechatRefund
*/
outRefundNo: string;
/**
* 退
*
* @type {string}
* @memberof SysWechatRefund
*/
reason?: string | null;
/**
* 退
*
* @type {number}
* @memberof SysWechatRefund
*/
refund?: number;
/**
*
*
* @type {number}
* @memberof SysWechatRefund
*/
total?: number;
/**
* 退url
*
* @type {string}
* @memberof SysWechatRefund
*/
notifyUrl?: string | null;
/**
* 退, 使退
*
* @type {string}
* @memberof SysWechatRefund
*/
fundsAccount?: string | null;
/**
*
*
* @type {string}
* @memberof SysWechatRefund
*/
orderId?: string | null;
/**
* ()
*
* @type {string}
* @memberof SysWechatRefund
*/
orderStatus?: string | null;
/**
*
*
* @type {string}
* @memberof SysWechatRefund
*/
merchantGoodsId?: string | null;
/**
*
*
* @type {string}
* @memberof SysWechatRefund
*/
goodsName?: string | null;
/**
*
*
* @type {number}
* @memberof SysWechatRefund
*/
unitPrice?: number;
/**
* 退
*
* @type {number}
* @memberof SysWechatRefund
*/
refundAmount?: number;
/**
* 退
*
* @type {number}
* @memberof SysWechatRefund
*/
refundQuantity?: number;
/**
*
*
* @type {string}
* @memberof SysWechatRefund
*/
attachment?: string | null;
/**
*
*
* @type {string}
* @memberof SysWechatRefund
*/
remark?: string | null;
}

View File

@ -0,0 +1,58 @@
/* tslint:disable */
/* eslint-disable */
/**
* Admin.NET
* .NET <br/><u><b><font color='FF0000'> 👮</font></b></u>
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/**
*
*
* @export
* @interface WechatPayParaOutput
*/
export interface WechatPayParaOutput {
/**
* @type {string}
* @memberof WechatPayParaOutput
*/
appId?: string | null;
/**
* @type {string}
* @memberof WechatPayParaOutput
*/
timeStamp?: string | null;
/**
* @type {string}
* @memberof WechatPayParaOutput
*/
nonceStr?: string | null;
/**
* @type {string}
* @memberof WechatPayParaOutput
*/
_package?: string | null;
/**
* @type {string}
* @memberof WechatPayParaOutput
*/
signType?: string | null;
/**
* @type {string}
* @memberof WechatPayParaOutput
*/
paySign?: string | null;
}

View File

@ -75,4 +75,20 @@ export interface WechatPayTransactionInput {
* @memberof WechatPayTransactionInput
*/
orderStatus?: string | null;
/**
*
*
* @type {string}
* @memberof WechatPayTransactionInput
*/
tags?: string | null;
/**
*
*
* @type {number}
* @memberof WechatPayTransactionInput
*/
businessId?: number;
}

View File

@ -0,0 +1,272 @@
<template>
<div class="weChatPay-container">
<el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
<el-form :model="state.queryParams" ref="queryForm" :inline="true">
<el-form-item label="订单号">
<el-input v-model="state.queryParams.searchKey" clearable="" placeholder="请输入订单号" />
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker placeholder="请选择创建时间" value-format="YYYY/MM/DD" type="daterange" v-model="state.queryParams.createTimeRange" />
</el-form-item>
<el-form-item>
<el-button-group>
<el-button type="primary" icon="ele-Search" @click="handleQuery"> 查询 </el-button>
<el-button icon="ele-Refresh" @click="resetQuery"> 重置 </el-button>
</el-button-group>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="ele-Plus" @click="openAddDialog">新增模拟数据</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
<el-table :data="state.tableData" style="width: 100%" v-loading="state.loading" border="">
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="outTradeNumber" label="商户订单号" width="180"></el-table-column>
<el-table-column prop="transactionId" label="支付订单号" width="220"></el-table-column>
<el-table-column prop="description" label="描述" width="180"></el-table-column>
<el-table-column prop="total" :formatter="amountFormatter" label="金额" width="70"></el-table-column>
<el-table-column prop="tradeState" label="状态" width="70">
<template #default="scope">
<el-tag v-if="scope.row.tradeState == 'SUCCESS'" type="success"> 完成 </el-tag>
<el-tag v-else-if="scope.row.tradeState == 'REFUND'" type="danger"> 退款 </el-tag>
<el-tag v-else type="info"> 未完成 </el-tag>
</template>
</el-table-column>
<el-table-column prop="attachment" label="附加信息" width="180"></el-table-column>
<el-table-column prop="tags" label="业务类型" width="90"></el-table-column>
<el-table-column prop="createTime" label="创建时间" width="150"></el-table-column>
<el-table-column prop="successTime" label="完成时间" width="150"></el-table-column>
<el-table-column prop="businessId" label="业务ID" width="130"></el-table-column>
<el-table-column label="操作" align="center" fixed="right">
<template #default="scope">
<el-button
size="small"
text=""
type="primary"
v-if="scope.row.qrcodeContent != null && scope.row.qrcodeContent != '' && (scope.row.tradeState === '' || !scope.row.tradeState)"
@click="openQrDialog(scope.row.qrcodeContent)"
>
付款二维码
</el-button>
<el-button size="small" text="" type="primary" v-if="scope.row.tradeState === 'REFUND'" @click="openRefundDialog(scope.row.transactionId)">查看退款</el-button>
<el-button size="small" text="" type="primary" v-if="scope.row.tradeState === 'SUCCESS'" @click="doRefund(scope.row)">全额退款</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-model:currentPage="state.tableParams.page"
v-model:page-size="state.tableParams.pageSize"
:total="state.tableParams.total"
:page-sizes="[10, 20, 50, 100]"
size="small"
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper"
/>
</el-card>
<el-dialog v-model="showAddDialog" draggable overflow destroy-on-close width="700px">
<template #header>
<div style="color: #fff">
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>
<span> 新增模拟数据 </span>
</div>
</template>
<el-form ref="ruleFormRef" label-width="auto">
<el-form-item label="商品">
<el-input v-model="addData.description" placeholder="必填" clearable />
</el-form-item>
<el-form-item label="金额(分)">
<el-input v-model="addData.total" placeholder="必填,填数字,单位是分" clearable />
</el-form-item>
<el-form-item label="附加信息">
<el-input v-model="addData.attachment" clearable />
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="closeAddDialog"> </el-button>
<el-button type="primary" @click="saveData"> </el-button>
</span>
</template>
</el-dialog>
<el-dialog v-model="showQrDialog">
<template #header>
<div style="color: #fff">
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>
<span> 付款二维码 </span>
</div>
</template>
<div ref="qrDiv"></div>
</el-dialog>
<el-dialog v-model="showRefundDialog">
<template #header>
<div style="color: #fff">
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>
<span> 退款信息 </span>
</div>
</template>
<el-table :data="subTableData" style="width: 100%" tooltip-effect="light" row-key="id" border="">
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="outRefundNumber" label="商户退款号" width="180"></el-table-column>
<el-table-column prop="transactionId" label="支付订单号" width="220"></el-table-column>
<el-table-column prop="refund" label="金额(分)" width="70"></el-table-column>
<el-table-column prop="reason" label="退款原因" width="180"></el-table-column>
<el-table-column prop="tradeState" label="状态" width="70">
<template #default="scope">
<el-tag v-if="scope.row.tradeState == 'SUCCESS'" type="success"> 完成 </el-tag>
<el-tag v-else-if="scope.row.tradeState == 'REFUND'" type="danger"> 退款 </el-tag>
<el-tag v-else type="info"> 未完成 </el-tag>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" width="180"></el-table-column>
<el-table-column prop="createTime" label="创建时间" width="150"></el-table-column>
<el-table-column prop="successTime" label="完成时间" width="150"></el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script setup lang="ts" name="weChatPay">
import { ref, nextTick, onMounted, reactive } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import QRCode from 'qrcodejs2-fixes';
import { getAPI } from '/@/utils/axios-utils';
import { SysWechatPayApi } from '/@/api-services/api';
import { SysWechatPay } from '/@/api-services/models';
const qrDiv = ref<HTMLElement | null>(null);
const showAddDialog = ref(false);
const showQrDialog = ref(false);
const showRefundDialog = ref(false);
const subTableData = ref<any>([]);
const addData = ref<any>({});
const state = reactive({
loading: false,
tableData: [] as Array<SysWechatPay>,
queryParams: {
searchKey: undefined,
createTimeRange: undefined,
},
tableParams: {
page: 1,
pageSize: 10,
total: 0 as any,
},
});
//
onMounted(async () => {
await handleQuery();
});
//
const handleQuery = async () => {
state.loading = true;
let params = Object.assign(state.queryParams, state.tableParams);
var res = await getAPI(SysWechatPayApi).apiSysWechatPayPagePost(params);
let tmpRows = res.data.result?.items ?? [];
state.tableData = tmpRows;
state.tableParams.total = res.data.result?.total;
state.loading = false;
};
//
const resetQuery = async () => {
state.queryParams.searchKey = undefined;
state.queryParams.createTimeRange = undefined;
await handleQuery();
};
//
const openAddDialog = () => {
addData.value = {
description: null,
total: null,
attachment: null,
};
showAddDialog.value = true;
};
//
const closeAddDialog = () => {
showAddDialog.value = false;
};
//
const openQrDialog = (code: string) => {
showQrDialog.value = true;
nextTick(() => {
(<HTMLElement>qrDiv.value).innerHTML = '';
new QRCode(qrDiv.value, {
text: code,
width: 260,
height: 260,
colorDark: '#000000',
colorLight: '#ffffff',
});
});
};
// 退
const openRefundDialog = async (transactionId: string) => {
var res = await getAPI(SysWechatPayApi).apiSysWechatPayRefundListGet(transactionId);
let tmpRows = res.data.result ?? [];
subTableData.value = tmpRows;
showRefundDialog.value = true;
};
//
const saveData = async () => {
var res = await getAPI(SysWechatPayApi).apiSysWechatPayPayTransactionNativePost(addData.value);
closeAddDialog();
let code = res.data.result?.qrcodeUrl;
openQrDialog(code == undefined ? '' : code);
await handleQuery();
};
// 退
const doRefund = async (orderInfo: any) => {
ElMessageBox.prompt(`确定进行退款:${orderInfo.total / 100}元?请输入退款理由`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
})
.then(async ({ value }) => {
await getAPI(SysWechatPayApi).apiSysWechatPayRefundPost({
outTradeNumber: orderInfo.outTradeNumber,
reason: value,
refund: orderInfo.total,
total: orderInfo.total,
});
ElMessage.success(`${value}】退款申请成功`);
})
.catch(() => {
ElMessage.error('取消操作');
});
};
//
const amountFormatter = (row: any, column: any, cellValue: number) => {
return (cellValue / 100).toFixed(2);
};
//
const handleSizeChange = (val: number) => {
state.tableParams.pageSize = val;
handleQuery();
};
//
const handleCurrentChange = (val: number) => {
state.tableParams.page = val;
handleQuery();
};
</script>