update:接口对接
This commit is contained in:
parent
70366175f5
commit
7db1e9cdd2
156
src/api/match/certificate-detail.js
Normal file
156
src/api/match/certificate-detail.js
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
import { BaseApi } from '../baseApi';
|
||||||
|
import { http } from '../../utils/request';
|
||||||
|
|
||||||
|
// ==================== 证书模板管理 ====================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传DOC模板
|
||||||
|
* @param {FormData} formData - 表单数据
|
||||||
|
* @param {File} formData.templatefile - 模板文件 (Word文档)
|
||||||
|
* @returns {Promise<{
|
||||||
|
* templateId: number,
|
||||||
|
* templateUrl: string,
|
||||||
|
* detectedPlaceholders: Array<{
|
||||||
|
* placeholderKey: string,
|
||||||
|
* placeholderType: string,
|
||||||
|
* isValid: boolean,
|
||||||
|
* validationMessage: string,
|
||||||
|
* suggestedDisplayName: string
|
||||||
|
* }>,
|
||||||
|
* totalPlaceholders: number,
|
||||||
|
* validPlaceholders: number
|
||||||
|
* }>}
|
||||||
|
*/
|
||||||
|
export const certificatetemplateUploaddoctemplatePost = (formData) => {
|
||||||
|
return http.post('/certificatetemplate/uploaddoctemplate', formData, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新DOC模板
|
||||||
|
* @param {Object} data - 模板信息
|
||||||
|
* @param {number} data.id - 模板ID
|
||||||
|
* @param {number} data.version - 版本号
|
||||||
|
* @param {string} data.templateFile - 模板文件(Base64编码)
|
||||||
|
* @param {number} [data.width] - 宽度 (默认5000)
|
||||||
|
* @param {number} [data.height] - 高度 (默认5000)
|
||||||
|
* @param {boolean} [data.isActive] - 是否激活
|
||||||
|
* @returns {Promise<{
|
||||||
|
* templateId: number,
|
||||||
|
* templateUrl: string,
|
||||||
|
* detectedPlaceholders: Array<{
|
||||||
|
* placeholderKey: string,
|
||||||
|
* placeholderType: string,
|
||||||
|
* isValid: boolean,
|
||||||
|
* validationMessage: string,
|
||||||
|
* suggestedDisplayName: string
|
||||||
|
* }>,
|
||||||
|
* totalPlaceholders: number,
|
||||||
|
* validPlaceholders: number
|
||||||
|
* }>}
|
||||||
|
*/
|
||||||
|
export const certificatetemplateDoctemplatePut = (data) => {
|
||||||
|
return http.put('/certificatetemplate/doctemplate', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取模板详情
|
||||||
|
* @param {Object} data - 请求参数
|
||||||
|
* @param {number} data.id - 模板ID
|
||||||
|
* @returns {Promise<{
|
||||||
|
* id: number,
|
||||||
|
* version: number,
|
||||||
|
* templateType: string,
|
||||||
|
* docxTemplateUrl: string,
|
||||||
|
* isActive: boolean,
|
||||||
|
* status: string,
|
||||||
|
* createdTime: string,
|
||||||
|
* placeholders: Array<{
|
||||||
|
* id: number,
|
||||||
|
* templateId: number,
|
||||||
|
* placeholderKey: string,
|
||||||
|
* displayName: string,
|
||||||
|
* placeholderType: string,
|
||||||
|
* defaultValue: string,
|
||||||
|
* isRequired: boolean,
|
||||||
|
* validationRule: string,
|
||||||
|
* description: string,
|
||||||
|
* sort: number
|
||||||
|
* }>
|
||||||
|
* }>}
|
||||||
|
*/
|
||||||
|
export const certificatetemplateGet = (data) => {
|
||||||
|
return http.get('/certificatetemplate', { params: data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测DOC模板占位符
|
||||||
|
* @param {Object} data - 请求参数
|
||||||
|
* @param {string} data.templateFile - 模板文件(Base64编码)
|
||||||
|
* @returns {Promise<{
|
||||||
|
* placeholders: Array<{
|
||||||
|
* placeholderKey: string,
|
||||||
|
* placeholderType: string,
|
||||||
|
* isValid: boolean,
|
||||||
|
* validationMessage: string,
|
||||||
|
* suggestedDisplayName: string
|
||||||
|
* }>,
|
||||||
|
* totalCount: number,
|
||||||
|
* validCount: number,
|
||||||
|
* invalidCount: number
|
||||||
|
* }>}
|
||||||
|
*/
|
||||||
|
export const certificatetemplateDetectplaceholdersPost = (data) => {
|
||||||
|
return http.post('/certificatetemplate/detectplaceholders', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存占位符配置
|
||||||
|
* @param {Object} data - 占位符配置
|
||||||
|
* @param {number} data.templateId - 模板ID
|
||||||
|
* @param {Array<Object>} data.placeholders - 占位符列表
|
||||||
|
* @param {string} data.placeholders[].placeholderKey - 占位符键名
|
||||||
|
* @param {string} data.placeholders[].displayName - 显示名称
|
||||||
|
* @param {string} data.placeholders[].placeholderType - 占位符类型 (Text, Number, Date, Image等)
|
||||||
|
* @param {string} [data.placeholders[].defaultValue] - 默认值
|
||||||
|
* @param {boolean} data.placeholders[].isRequired - 是否必填
|
||||||
|
* @param {string} [data.placeholders[].validationRule] - 验证规则
|
||||||
|
* @param {string} [data.placeholders[].description] - 描述说明
|
||||||
|
* @param {number} data.placeholders[].sort - 排序
|
||||||
|
*/
|
||||||
|
export const certificatetemplateSaveplaceholdersPost = (data) => {
|
||||||
|
return http.post('/certificatetemplate/saveplaceholders', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取模板占位符列表
|
||||||
|
* @param {Object} data - 请求参数
|
||||||
|
* @param {number} data.id - 模板ID
|
||||||
|
* @returns {Promise<Array<{
|
||||||
|
* id: number,
|
||||||
|
* templateId: number,
|
||||||
|
* placeholderKey: string,
|
||||||
|
* displayName: string,
|
||||||
|
* placeholderType: string,
|
||||||
|
* defaultValue: string,
|
||||||
|
* isRequired: boolean,
|
||||||
|
* validationRule: string,
|
||||||
|
* description: string,
|
||||||
|
* sort: number
|
||||||
|
* }>>}
|
||||||
|
*/
|
||||||
|
export const certificatetemplateTemplateplaceholdersGet = (data) => {
|
||||||
|
return http.get('/certificatetemplate/templateplaceholders', { params: data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除模板(支持批量)
|
||||||
|
* @param {Object} data - 删除参数
|
||||||
|
* @param {Array<number>} data.ids - 模板ID数组
|
||||||
|
*/
|
||||||
|
export const certificatetemplateTemplateDelete = (data) => {
|
||||||
|
return http.delete('/certificatetemplate/template', { data });
|
||||||
|
};
|
||||||
130
src/api/match/certificate.js
Normal file
130
src/api/match/certificate.js
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
import { BaseApi } from '../baseApi';
|
||||||
|
import { http } from '../../utils/request';
|
||||||
|
|
||||||
|
// ==================== 证书管理 ====================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 证书分页查询
|
||||||
|
* @param {Object} data - 查询参数
|
||||||
|
* @param {number} [data.pageNo] - 当前页码
|
||||||
|
* @param {number} [data.pageSize] - 每页条数
|
||||||
|
* @param {string} [data.name] - 证书名称 (模糊查询)
|
||||||
|
* @param {string} [data.code] - 证书编码
|
||||||
|
* @param {string} [data.status] - 状态 (Enable=启用, Disable=禁用)
|
||||||
|
* @returns {Promise<{
|
||||||
|
* pageNo: number,
|
||||||
|
* pageSize: number,
|
||||||
|
* pages: number,
|
||||||
|
* total: number,
|
||||||
|
* rows: Array<{
|
||||||
|
* id: number,
|
||||||
|
* name: string,
|
||||||
|
* code: string,
|
||||||
|
* templateId: number,
|
||||||
|
* remark: string,
|
||||||
|
* status: string,
|
||||||
|
* sort: number,
|
||||||
|
* createdTime: string
|
||||||
|
* }>
|
||||||
|
* }>}
|
||||||
|
*/
|
||||||
|
export const certificatePageGet = (data) => {
|
||||||
|
return http.post('/certificate/page', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加证书
|
||||||
|
* @param {Object} data - 证书信息
|
||||||
|
* @param {string} data.name - 证书名称
|
||||||
|
* @param {string} data.code - 证书编码
|
||||||
|
* @param {number} data.templateId - 模板ID
|
||||||
|
* @param {string} [data.remark] - 备注说明
|
||||||
|
* @param {string} [data.status] - 状态 (Enable=启用, Disable=禁用,默认Enable)
|
||||||
|
* @param {number} [data.sort] - 排序号
|
||||||
|
*/
|
||||||
|
export const certificateAddPost = (data) => {
|
||||||
|
return http.post('/certificate', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新证书
|
||||||
|
* @param {Object} data - 证书信息
|
||||||
|
* @param {number} data.id - 证书ID
|
||||||
|
* @param {string} data.name - 证书名称
|
||||||
|
* @param {string} data.code - 证书编码
|
||||||
|
* @param {number} data.templateId - 模板ID
|
||||||
|
* @param {string} [data.remark] - 备注说明
|
||||||
|
* @param {string} [data.status] - 状态 (Enable=启用, Disable=禁用)
|
||||||
|
* @param {number} [data.sort] - 排序号
|
||||||
|
*/
|
||||||
|
export const certificateEditPut = (data) => {
|
||||||
|
return http.put('/certificate', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除证书
|
||||||
|
* @param {Object} data - 删除参数
|
||||||
|
* @param {Array<number>} data.ids - 证书ID数组
|
||||||
|
*/
|
||||||
|
export const certificateDelete = (data) => {
|
||||||
|
return http.delete('/certificate', { data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取证书详情
|
||||||
|
* @param {Object} data - 请求参数
|
||||||
|
* @param {number} data.id - 证书ID
|
||||||
|
* @returns {Promise<{
|
||||||
|
* id: number,
|
||||||
|
* name: string,
|
||||||
|
* code: string,
|
||||||
|
* templateId: number,
|
||||||
|
* remark: string,
|
||||||
|
* status: string,
|
||||||
|
* sort: number,
|
||||||
|
* createdTime: string,
|
||||||
|
* template: {
|
||||||
|
* id: number,
|
||||||
|
* version: number,
|
||||||
|
* templateType: string,
|
||||||
|
* docxTemplateUrl: string,
|
||||||
|
* isActive: boolean,
|
||||||
|
* status: string,
|
||||||
|
* createdTime: string,
|
||||||
|
* placeholders: Array<{
|
||||||
|
* id: number,
|
||||||
|
* templateId: number,
|
||||||
|
* placeholderKey: string,
|
||||||
|
* displayName: string,
|
||||||
|
* placeholderType: string,
|
||||||
|
* defaultValue: string,
|
||||||
|
* isRequired: boolean,
|
||||||
|
* validationRule: string,
|
||||||
|
* description: string,
|
||||||
|
* sort: number
|
||||||
|
* }>
|
||||||
|
* }
|
||||||
|
* }>}
|
||||||
|
*/
|
||||||
|
export const certificateDetailPost = (data) => {
|
||||||
|
return http.post('/certificate/detail', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除单个证书
|
||||||
|
* @param {Object} data - 删除参数
|
||||||
|
* @param {number} data.id - 证书ID
|
||||||
|
*/
|
||||||
|
export const certificateDeleteDelete = (data) => {
|
||||||
|
return http.delete('/certificate/delete', { data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改证书状态
|
||||||
|
* @param {Object} data - 状态参数
|
||||||
|
* @param {number} data.id - 证书ID
|
||||||
|
* @param {string} data.status - 状态 (Enable=启用, Disable=禁用)
|
||||||
|
*/
|
||||||
|
export const certificateSetstatusPatch = (data) => {
|
||||||
|
return http.patch('/certificate/setstatus', data);
|
||||||
|
};
|
||||||
116
src/api/match/coupon.js
Normal file
116
src/api/match/coupon.js
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
import { BaseApi } from '../baseApi';
|
||||||
|
import { http } from '../../utils/request';
|
||||||
|
|
||||||
|
// ==================== 优惠券管理 ====================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券分页查询
|
||||||
|
* @param {Object} data - 查询参数
|
||||||
|
* @param {number} [data.pageNo] - 当前页码
|
||||||
|
* @param {number} [data.pageSize] - 每页条数
|
||||||
|
* @param {string} [data.name] - 优惠券名称 (模糊查询)
|
||||||
|
* @param {number} [data.type] - 优惠券类型 (1:满减券, 2:折扣券, 3:代金券)
|
||||||
|
* @returns {Promise<{
|
||||||
|
* pageNo: number,
|
||||||
|
* pageSize: number,
|
||||||
|
* pages: number,
|
||||||
|
* total: number,
|
||||||
|
* rows: Array<{
|
||||||
|
* id: number,
|
||||||
|
* name: string,
|
||||||
|
* type: number,
|
||||||
|
* value: number,
|
||||||
|
* startTime: string,
|
||||||
|
* endTime: string,
|
||||||
|
* eventNames: string,
|
||||||
|
* eventIds: Array<number>,
|
||||||
|
* redemptionCode: string,
|
||||||
|
* totalQuantity: number,
|
||||||
|
* claimedQuantity: number,
|
||||||
|
* usedQuantity: number,
|
||||||
|
* createdTime: string
|
||||||
|
* }>,
|
||||||
|
* totalPage: number
|
||||||
|
* }>}
|
||||||
|
*/
|
||||||
|
export const couponPage = (data) => {
|
||||||
|
return http.post('/coupon/page', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加优惠券
|
||||||
|
* @param {Object} data - 优惠券信息
|
||||||
|
* @param {string} data.name - 优惠券名称
|
||||||
|
* @param {number} data.type - 优惠券类型 (1:满减券, 2:折扣券, 3:代金券)
|
||||||
|
* @param {number} data.value - 优惠券面值
|
||||||
|
* @param {string} data.startTime - 开始时间 (格式:2026-03-08T18:23:19.664Z)
|
||||||
|
* @param {string} data.endTime - 结束时间 (格式:2026-03-08T18:23:19.664Z)
|
||||||
|
* @param {Array<number>} data.eventIds - 适用赛事ID列表
|
||||||
|
* @param {number} data.totalQuantity - 总数量
|
||||||
|
*/
|
||||||
|
export const couponAdd = (data) => {
|
||||||
|
return http.post('/coupon', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新优惠券
|
||||||
|
* @param {Object} data - 优惠券信息
|
||||||
|
* @param {number} data.id - 优惠券ID
|
||||||
|
* @param {string} data.name - 优惠券名称
|
||||||
|
* @param {number} data.type - 优惠券类型 (1:满减券, 2:折扣券, 3:代金券)
|
||||||
|
* @param {number} data.value - 优惠券面值
|
||||||
|
* @param {string} data.startTime - 开始时间 (格式:2026-03-08T18:23:19.665Z)
|
||||||
|
* @param {string} data.endTime - 结束时间 (格式:2026-03-08T18:23:19.665Z)
|
||||||
|
* @param {Array<number>} data.eventIds - 适用赛事ID列表
|
||||||
|
* @param {number} data.totalQuantity - 总数量
|
||||||
|
*/
|
||||||
|
export const couponEdit = (data) => {
|
||||||
|
return http.put('/coupon', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除优惠券
|
||||||
|
* @param {Array<number>} data - 优惠券ID数组
|
||||||
|
*/
|
||||||
|
export const couponDelete = (data) => {
|
||||||
|
return http.delete('/coupon', { data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成兑换码
|
||||||
|
* @param {number} id - 优惠券ID (路径参数)
|
||||||
|
* @returns {Promise<string>} - 生成的兑换码
|
||||||
|
*/
|
||||||
|
export const couponGeneratecodePost = (id) => {
|
||||||
|
return http.post(`/coupon/generatecode/${id}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取赛事列表(下拉选择用)
|
||||||
|
* @returns {Promise<Array<{
|
||||||
|
* id: number,
|
||||||
|
* name: string
|
||||||
|
* }>>}
|
||||||
|
*/
|
||||||
|
export const couponEventlistGet = () => {
|
||||||
|
return http.get('/coupon/eventlist');
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除单个优惠券
|
||||||
|
* @param {Object} data - 删除参数
|
||||||
|
* @param {number} data.id - 优惠券ID
|
||||||
|
*/
|
||||||
|
export const couponDeleteDelete = (data) => {
|
||||||
|
return http.delete('/coupon/delete', { data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改优惠券状态
|
||||||
|
* @param {Object} data - 状态参数
|
||||||
|
* @param {number} data.id - 优惠券ID
|
||||||
|
* @param {string} data.status - 状态 (Enable=启用, Disable=禁用)
|
||||||
|
*/
|
||||||
|
export const couponSetstatusPatch = (data) => {
|
||||||
|
return http.patch('/coupon/setstatus', data);
|
||||||
|
};
|
||||||
106
src/api/match/merchant.js
Normal file
106
src/api/match/merchant.js
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
import { BaseApi } from '../baseApi';
|
||||||
|
import { http } from '../../utils/request';
|
||||||
|
|
||||||
|
// ==================== 商户管理 ====================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户分页查询
|
||||||
|
* @param {Object} params - 查询参数
|
||||||
|
* @param {string} [params.MerchantName] - 商户名称
|
||||||
|
* @param {string} [params.ContactPhone] - 联系电话
|
||||||
|
* @param {string} [params.AuditStatus] - 审核状态 (PendingSubmission=待提交, PendingAudit=待审核, Approved=审核通过, Rejected=驳回)
|
||||||
|
* @param {string} [params.StartTime] - 开始时间
|
||||||
|
* @param {string} [params.EndTime] - 结束时间
|
||||||
|
* @param {number} [params.PageNo] - 页码
|
||||||
|
* @param {number} [params.PageSize] - 每页条数
|
||||||
|
*/
|
||||||
|
export const merchantPageGet = (params) => {
|
||||||
|
return http.get('/merchant/page', {params});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加商户
|
||||||
|
* @param {Object} data - 商户信息
|
||||||
|
* @param {string} data.merchantName - 商户名称
|
||||||
|
* @param {string} data.creditCode - 统一信用代码
|
||||||
|
* @param {string} data.bankName - 开户银行
|
||||||
|
* @param {string} data.accountNumber - 银行账号
|
||||||
|
* @param {string} data.businessLicenseUrl - 营业执照URL
|
||||||
|
* @param {string} data.contactPhone - 联系电话
|
||||||
|
*/
|
||||||
|
export const merchantAddPost = (data) => {
|
||||||
|
return http.post('/merchant/add', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新商户
|
||||||
|
* @param {Object} data - 商户信息
|
||||||
|
* @param {string} data.merchantName - 商户名称
|
||||||
|
* @param {string} data.creditCode - 统一信用代码
|
||||||
|
* @param {string} data.bankName - 开户银行
|
||||||
|
* @param {string} data.accountNumber - 银行账号
|
||||||
|
* @param {string} data.businessLicenseUrl - 营业执照URL
|
||||||
|
* @param {string} data.contactPhone - 联系电话
|
||||||
|
* @param {number} data.id - 商户ID
|
||||||
|
*/
|
||||||
|
export const merchantEditPut = (data) => {
|
||||||
|
return http.put('/merchant/edit', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除商户(支持批量)
|
||||||
|
* @param {Array<number>} data - 商户ID数组
|
||||||
|
*/
|
||||||
|
export const merchantDeletePost = (data) => {
|
||||||
|
return http.post('/merchant/delete', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除商户
|
||||||
|
* @param {Object} data - 删除参数
|
||||||
|
* @param {number} data.id - 商户ID
|
||||||
|
*/
|
||||||
|
export const merchantDeleteDelete = (data) => {
|
||||||
|
return http.delete('/merchant/delete', { data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商户详情
|
||||||
|
* @param {Object} params - 查询参数
|
||||||
|
* @param {number} params.id - 商户ID
|
||||||
|
*/
|
||||||
|
export const merchantDetailGet = (params) => {
|
||||||
|
return http.get('/merchant/detail', params);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核商户
|
||||||
|
* @param {Object} data - 审核参数
|
||||||
|
* @param {Array<number>} data.ids - 商户ID数组
|
||||||
|
* @param {string} data.status - 审核状态 (PendingSubmission=待提交, PendingAudit=待审核, Approved=审核通过, Rejected=驳回)
|
||||||
|
* @param {string} [data.remark] - 审核备注
|
||||||
|
*/
|
||||||
|
export const merchantAuditPost = (data) => {
|
||||||
|
return http.post('/merchant/audit', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发放优惠券
|
||||||
|
* @param {Object} data - 发放参数
|
||||||
|
* @param {Array<number>} data.merchantIds - 商户ID数组
|
||||||
|
* @param {number} data.couponId - 优惠券ID
|
||||||
|
* @param {number} data.count - 发放数量
|
||||||
|
*/
|
||||||
|
export const merchantIssuecouponPost = (data) => {
|
||||||
|
return http.post('/merchant/issuecoupon', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改状态
|
||||||
|
* @param {Object} data - 状态参数
|
||||||
|
* @param {number} data.id - 商户ID
|
||||||
|
* @param {string} data.status - 状态 (Enable=启用, Disable=禁用)
|
||||||
|
*/
|
||||||
|
export const merchantSetstatusPatch = (data) => {
|
||||||
|
return http.patch('/merchant/setstatus', data);
|
||||||
|
};
|
||||||
98
src/api/match/project.js
Normal file
98
src/api/match/project.js
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
import { BaseApi } from '../baseApi';
|
||||||
|
import { http } from '../../utils/request';
|
||||||
|
|
||||||
|
// ==================== 项目管理 ====================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目分页查询
|
||||||
|
* @param {Object} params - 查询参数
|
||||||
|
* @param {number} [params.EventId] - 赛事ID
|
||||||
|
* @param {string} [params.ProjectName] - 项目名称 (模糊查询)
|
||||||
|
* @param {number} [params.ProjectTypeId] - 项目类型ID
|
||||||
|
* @param {number} [params.PageNo] - 当前页码
|
||||||
|
* @param {number} [params.PageSize] - 页码容量
|
||||||
|
*/
|
||||||
|
export const projectPageGet = (params) => {
|
||||||
|
return http.post('/project/page', {params});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加项目
|
||||||
|
* @param {Object} data - 项目信息
|
||||||
|
* @param {number} data.eventId - 赛事ID
|
||||||
|
* @param {string} data.name - 项目名称
|
||||||
|
* @param {number} data.projectTypeId - 项目类型ID
|
||||||
|
* @param {number} data.completionCount - 完成人数
|
||||||
|
* @param {number} data.fee - 费用
|
||||||
|
* @param {number} data.durationMinutes - 时长(分钟)
|
||||||
|
* @param {number} data.durationSeconds - 时长(秒)
|
||||||
|
* @param {number} data.venueCount - 场地数量
|
||||||
|
* @param {number} data.sortIndex - 排序索引
|
||||||
|
* @param {Array<Object>} data.groups - 组别信息列表
|
||||||
|
* @param {string} data.groups[].groupName - 组别名称
|
||||||
|
* @param {string} data.groups[].birthDateStart - 出生日期开始 (格式:2026-03-08T16:08:27.652Z)
|
||||||
|
* @param {string} data.groups[].birthDateEnd - 出生日期结束 (格式:2026-03-08T16:08:27.652Z)
|
||||||
|
* @param {string} data.groups[].gender - 性别 (Male=男, Female=女, Mixed=混合)
|
||||||
|
*/
|
||||||
|
export const projectAddPost = (data) => {
|
||||||
|
return http.post('/project/add', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新项目
|
||||||
|
* @param {Object} data - 项目信息
|
||||||
|
* @param {number} data.id - 项目ID
|
||||||
|
* @param {number} data.eventId - 赛事ID
|
||||||
|
* @param {string} data.name - 项目名称
|
||||||
|
* @param {number} data.projectTypeId - 项目类型ID
|
||||||
|
* @param {number} data.completionCount - 完成次数/达标次数
|
||||||
|
* @param {number} data.fee - 费用
|
||||||
|
* @param {number} data.durationMinutes - 时长(分钟)
|
||||||
|
* @param {number} data.durationSeconds - 时长(秒)
|
||||||
|
* @param {number} data.venueCount - 场地数量
|
||||||
|
* @param {number} data.sortIndex - 排序索引
|
||||||
|
* @param {Array<Object>} data.groups - 组别信息列表
|
||||||
|
* @param {string} data.groups[].groupName - 组别名称
|
||||||
|
* @param {string} data.groups[].birthDateStart - 出生日期开始 (格式:2026-03-08T16:08:27.653Z)
|
||||||
|
* @param {string} data.groups[].birthDateEnd - 出生日期结束 (格式:2026-03-08T16:08:27.653Z)
|
||||||
|
* @param {string} data.groups[].gender - 性别 (Male=男, Female=女, Mixed=混合)
|
||||||
|
*/
|
||||||
|
export const projectEditPut = (data) => {
|
||||||
|
return http.put('/project/edit', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除项目(支持批量)
|
||||||
|
* @param {Array<number>} data - 项目ID数组
|
||||||
|
*/
|
||||||
|
export const projectDeletePost = (data) => {
|
||||||
|
return http.post('/project/delete', data);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除项目
|
||||||
|
* @param {Object} data - 删除参数
|
||||||
|
* @param {number} data.id - 项目ID
|
||||||
|
*/
|
||||||
|
export const projectDeleteDelete = (data) => {
|
||||||
|
return http.delete('/project/delete', { data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取项目详情
|
||||||
|
* @param {Object} params - 查询参数
|
||||||
|
* @param {number} params.id - 项目ID
|
||||||
|
*/
|
||||||
|
export const projectDetailGet = (params) => {
|
||||||
|
return http.get('/project/detail', params);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改项目状态
|
||||||
|
* @param {Object} data - 状态参数
|
||||||
|
* @param {number} data.id - 项目ID
|
||||||
|
* @param {string} data.status - 状态 (Enable=启用, Disable=禁用)
|
||||||
|
*/
|
||||||
|
export const projectSetstatusPatch = (data) => {
|
||||||
|
return http.patch('/project/setstatus', data);
|
||||||
|
};
|
||||||
@ -61,8 +61,13 @@ export const useTable = (
|
|||||||
if (!api) return;
|
if (!api) return;
|
||||||
try {
|
try {
|
||||||
state.loading = true;
|
state.loading = true;
|
||||||
|
|
||||||
// 先把初始化参数和分页参数放到总参数里面
|
// 先把初始化参数和分页参数放到总参数里面
|
||||||
Object.assign(state.totalParam, initParam, isPageable ? pageParam.value : {});
|
Object.assign(state.totalParam, initParam, isPageable ? pageParam.value : {});
|
||||||
|
// console.log('我是分页参数', pageParam.value);
|
||||||
|
// console.log('我是总参数', state.totalParam);
|
||||||
|
// console.log('我是查询参数', state.searchParam);
|
||||||
|
|
||||||
let { data } = await api({ ...state.searchInitParam, ...state.totalParam });
|
let { data } = await api({ ...state.searchInitParam, ...state.totalParam });
|
||||||
dataCallBack && (data = dataCallBack(data));
|
dataCallBack && (data = dataCallBack(data));
|
||||||
state.tableData = isPageable ? data.rows ?? data.items : data;
|
state.tableData = isPageable ? data.rows ?? data.items : data;
|
||||||
|
|||||||
@ -1,29 +1,27 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="system-menu-container layout-padding">
|
<div class="system-menu-container layout-padding">
|
||||||
<ProTable ref="tableRef" :request-api="SysMenuApi.page" :columns="columns" :pagination="false"
|
<ProTable ref="tableRef" :request-api="certificatePageGet" :columns="columns" :pagination="true"
|
||||||
:tool-button="false">
|
:tool-button="false">
|
||||||
<template #tools>
|
<template #tools>
|
||||||
<el-button v-auth="'sysmenu:add'" type="primary" icon="ele-Plus" @click="onOpenMenu"> 新增 </el-button>
|
<el-button v-auth="'certificate:add'" type="primary" icon="ele-Plus" @click="onOpenMenu"> 新增 </el-button>
|
||||||
</template>
|
</template>
|
||||||
<template #index="scope">
|
<template #index="scope">
|
||||||
{{ scope.$index + 1 }}
|
{{ scope.$index + 1 }}
|
||||||
</template>
|
</template>
|
||||||
<template #name="scope">
|
|
||||||
<span class="ml10">{{ $t(scope.row.name) }}</span>
|
<template #remark="scope">
|
||||||
|
<img :src="scope.row.remark" style="width: 100px;" />
|
||||||
</template>
|
</template>
|
||||||
<template #img="scope">
|
<!-- <template #status="scope">
|
||||||
<img :src="scope.row.img" class="img" />
|
|
||||||
</template>
|
|
||||||
<template #status="scope">
|
|
||||||
<el-tag :type="scope.row.status === 0 ? 'success' : 'danger'"> {{ scope.row.status === 0 ? '启用' : '禁用'
|
<el-tag :type="scope.row.status === 0 ? 'success' : 'danger'"> {{ scope.row.status === 0 ? '启用' : '禁用'
|
||||||
}}</el-tag>
|
}}</el-tag>
|
||||||
</template>
|
</template> -->
|
||||||
<template #action="scope">
|
<template #action="scope">
|
||||||
<el-button v-auth="'sysmenu:edit'" icon="ele-Edit" size="small" text type="primary"
|
<el-button v-auth="'certificate:edit'" icon="ele-Edit" size="small" text type="primary"
|
||||||
@click="onOpenMenu(scope.row.id)"> 编辑 </el-button>
|
@click="onOpenMenu(scope.row.id)"> 编辑 </el-button>
|
||||||
<el-popconfirm title="确认删除吗?" @confirm="onDeleteMenu(scope.row.id)">
|
<el-popconfirm title="确认删除吗?" @confirm="onDeleteMenu(scope.row.id)">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button v-auth="'sysmenu:delete'" icon="ele-Delete" size="small" text type="danger"> 删除
|
<el-button v-auth="'certificate:delete'" icon="ele-Delete" size="small" text type="danger"> 删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
@ -36,16 +34,16 @@
|
|||||||
style="width: 80%;margin-bottom: 30px;max-width: 600px" v-if="isShowDialog">
|
style="width: 80%;margin-bottom: 30px;max-width: 600px" v-if="isShowDialog">
|
||||||
|
|
||||||
<!-- 证书名称 -->
|
<!-- 证书名称 -->
|
||||||
<el-form-item label="证书名称" prop="projectName" >
|
<el-form-item label="证书名称" prop="name" >
|
||||||
<el-input v-model="formData.projectName" placeholder="请输入项目名称"></el-input>
|
<el-input v-model="formData.name" placeholder="请输入证书名称"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
|
||||||
<!-- 证书模板 -->
|
<!-- 证书模板 -->
|
||||||
<el-form-item label="证书模板" prop="fee">
|
<el-form-item label="证书模板" prop="remark">
|
||||||
<el-upload class="avatar-uploader" action=""
|
<el-upload class="avatar-uploader" action="/api/file/upload"
|
||||||
:show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
|
:show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
|
||||||
<img v-if="formData.fee" :src="formData.fee" class="avatar" />
|
<img v-if="formData.remark" :src="formData.remark" class="avatar" />
|
||||||
<el-icon v-else class="avatar-uploader-icon">
|
<el-icon v-else class="avatar-uploader-icon">
|
||||||
<Plus />
|
<Plus />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@ -70,25 +68,21 @@ import { ElMessage, ElForm } from 'element-plus';
|
|||||||
import SysMenuApi from '/@/api/SysMenuApi';
|
import SysMenuApi from '/@/api/SysMenuApi';
|
||||||
import { auths } from '/@/utils/authFunction';
|
import { auths } from '/@/utils/authFunction';
|
||||||
import ProTable from '/@/components/ProTable/index.vue';
|
import ProTable from '/@/components/ProTable/index.vue';
|
||||||
|
import { certificatePageGet, certificateAddPost ,certificateEditPut ,certificateDeleteDelete} from '/@/api/match/certificate';
|
||||||
|
|
||||||
// 定义表单引用类型
|
// 定义表单引用类型
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
|
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
projectName: '30秒单摇',
|
name: '',
|
||||||
projectType: 'personal_speed',
|
remark: '',
|
||||||
participantCount: '',
|
|
||||||
description: '',
|
|
||||||
fee: '100',
|
|
||||||
durationMinutes: '',
|
|
||||||
phone: '30'
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const formRules = ref({
|
const formRules = ref({
|
||||||
projectName: [
|
name: [
|
||||||
{ required: true, message: '请输入证书名称', trigger: 'blur' }
|
{ required: true, message: '请输入证书名称', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
fee: [
|
remark: [
|
||||||
{ required: true, message: '请上传证书模版', trigger: 'blur' }
|
{ required: true, message: '请上传证书模版', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -108,8 +102,8 @@ const columns = ref([
|
|||||||
el: 'input',
|
el: 'input',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ prop: 'img', label: '证书' },
|
{ prop: 'remark', label: '证书' },
|
||||||
{ prop: 'action', label: '操作', align: 'center', fixed: 'right', isShow: auths(['sysmenu:delete', 'sysmenu:edit']) },
|
{ prop: 'action', label: '操作', align: 'center', fixed: 'right', isShow: auths(['certificate:delete', 'certificate:edit']) },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const isShowDialog = ref(false);
|
const isShowDialog = ref(false);
|
||||||
@ -118,13 +112,8 @@ const dialogTitle = ref('新增');
|
|||||||
const onOpenMenu = (id) => {
|
const onOpenMenu = (id) => {
|
||||||
dialogTitle.value = id ? '编辑' : '新增';
|
dialogTitle.value = id ? '编辑' : '新增';
|
||||||
formData.value = {
|
formData.value = {
|
||||||
projectName: '',
|
name: '',
|
||||||
projectType: '',
|
remark: '',
|
||||||
participantCount: '',
|
|
||||||
description: '',
|
|
||||||
fee: '',
|
|
||||||
durationMinutes: '',
|
|
||||||
phone: ''
|
|
||||||
};
|
};
|
||||||
isShowDialog.value = true;
|
isShowDialog.value = true;
|
||||||
};
|
};
|
||||||
@ -139,9 +128,8 @@ const onDeleteMenu = async (id) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAvatarSuccess = ( response,
|
const handleAvatarSuccess = (response,uploadFile) => {
|
||||||
uploadFile) => {
|
formData.value.remark = response[0].url;
|
||||||
formData.value.fee = URL.createObjectURL(uploadFile.raw)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const beforeAvatarUpload = () => {
|
const beforeAvatarUpload = () => {
|
||||||
@ -163,23 +151,23 @@ const onSubmit = () => {
|
|||||||
formRef.value.validate(async (valid) => {
|
formRef.value.validate(async (valid) => {
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
|
|
||||||
// try {
|
try {
|
||||||
// let res;
|
let res;
|
||||||
// if (formData.value.id) {
|
if (formData.value.id) {
|
||||||
// res = await SysMenuApi.add(formData.value);
|
res = await certificateEditPut(formData.value);
|
||||||
// } else {
|
} else {
|
||||||
// res = await SysMenuApi.add(formData.value);
|
res = await certificateAddPost(formData.value);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (res.succeeded) {
|
if (res.succeeded) {
|
||||||
// ElMessage.success(dialogTitle.value + '成功');
|
ElMessage.success(dialogTitle.value + '成功');
|
||||||
// isShowDialog.value = false;
|
isShowDialog.value = false;
|
||||||
// } else {
|
} else {
|
||||||
// ElMessage.error(res.errors);
|
ElMessage.error(res.errors);
|
||||||
// }
|
}
|
||||||
// } catch (error) {
|
} catch (error) {
|
||||||
// console.error(error);
|
console.error(error);
|
||||||
// }
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="system-menu-container layout-padding">
|
<div class="system-menu-container layout-padding">
|
||||||
<ProTable ref="tableRef" :request-api="SysMenuApi.page" :columns="columns" :pagination="false"
|
<ProTable ref="tableRef" :request-api="couponPage" :columns="columns" :pagination="true" :tool-button="false" :initParam="initParam">
|
||||||
:tool-button="false">
|
|
||||||
<template #tools>
|
<template #tools>
|
||||||
<el-button v-auth="'sysmenu:add'" type="primary" icon="ele-Plus" @click="onOpenMenu"> 新增 </el-button>
|
<el-button v-auth="'coupon:add'" type="primary" icon="ele-Plus" @click="onOpenMenu()"> 新增 </el-button>
|
||||||
</template>
|
</template>
|
||||||
<template #index="scope">
|
<template #index="scope">
|
||||||
{{ scope.$index + 1 }}
|
{{ scope.$index + 1 }}
|
||||||
@ -13,63 +12,72 @@
|
|||||||
<span class="ml10">{{ $t(scope.row.name) }}</span>
|
<span class="ml10">{{ $t(scope.row.name) }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #type="scope">
|
<template #type="scope">
|
||||||
<el-tag :type="scope.row.type === 0 ? '' : scope.row.type === 1 ? 'success' : 'danger'">
|
{{ scope.row.type == 1 ? '折扣券' : '代金券' }}
|
||||||
{{ scope.row.type === 0 ? '目录' : scope.row.type === 1 ? '菜单' : '按钮' }}</el-tag>
|
|
||||||
</template>
|
</template>
|
||||||
<template #status="scope">
|
<template #startTime="scope">
|
||||||
<el-tag :type="scope.row.status === 0 ? 'success' : 'danger'"> {{ scope.row.status === 0 ? '启用' : '禁用'
|
{{ scope.row.startTime }} - {{ scope.row.endTime }}
|
||||||
}}</el-tag>
|
|
||||||
</template>
|
</template>
|
||||||
<template #action="scope">
|
<template #action="scope">
|
||||||
<el-button v-auth="'sysmenu:edit'" icon="ele-Edit" size="small" text type="primary"
|
<el-button v-auth="'coupon:edit'" icon="ele-Edit" size="small" text type="primary"
|
||||||
@click="onOpenMenu(scope.row.id)"> 编辑 </el-button>
|
@click="onOpenMenu(scope.row)"> 编辑 </el-button>
|
||||||
<el-popconfirm title="确认删除吗?" @confirm="onDeleteMenu(scope.row.id)">
|
<el-popconfirm title="确认删除吗?" @confirm="onDeleteMenu(scope.row.id)">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button v-auth="'sysmenu:delete'" icon="ele-Delete" size="small" text type="danger"> 删除
|
<el-button v-auth="'coupon:delete'" icon="ele-Delete" size="small" text type="danger"> 删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
|
<el-button size="small" text type="primary" @click="getSdk(scope.row.id)"> 生成兑换码 </el-button>
|
||||||
</template>
|
</template>
|
||||||
</ProTable>
|
</ProTable>
|
||||||
|
|
||||||
<!-- 弹窗 -->
|
<!-- 弹窗 -->
|
||||||
<el-dialog title="新增" v-model="isShowDialog">
|
<el-dialog :title="dialogTitle" v-model="isShowDialog">
|
||||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="150px"
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="150px"
|
||||||
style="max-width: 600px;margin-bottom: 30px;" v-if="isShowDialog">
|
style="max-width: 600px;margin-bottom: 30px;" v-if="isShowDialog">
|
||||||
|
|
||||||
<!-- 商户名称 -->
|
<!-- 商户名称 -->
|
||||||
<el-form-item label="优惠券名称" prop="projectName">
|
<el-form-item label="优惠券名称" prop="name">
|
||||||
<el-input v-model="formData.projectName" placeholder="请输入项目名称"></el-input>
|
<el-input v-model="formData.name" placeholder="请输入优惠券名称"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- 优惠券类型 -->
|
<!-- 优惠券类型 -->
|
||||||
<el-form-item label="优惠券类型" prop="projectType">
|
<el-form-item label="优惠券类型" prop="type">
|
||||||
<el-select v-model="formData.projectType" placeholder="请选择优惠券类型">
|
<el-select v-model="formData.type" placeholder="请选择优惠券类型">
|
||||||
<el-option label="折扣" value="discount"></el-option>
|
<el-option label="折扣" value="1"></el-option>
|
||||||
<el-option label="定价" value="fixed"></el-option>
|
<el-option label="定价" value="2"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- 填写折扣 -->
|
<!-- 填写折扣 -->
|
||||||
<el-form-item label="填写折扣" prop="participantCount" v-if="formData.projectType === 'discount'">
|
<el-form-item label="填写折扣" prop="value" v-if="formData.type === '1'">
|
||||||
<el-input v-model="formData.participantCount" placeholder="请输入折扣百分比">
|
<el-input v-model="formData.value" placeholder="请输入折扣百分比">
|
||||||
<template #append>%</template>
|
<template #append>%</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- 填写优惠金额 -->
|
<!-- 填写优惠金额 -->
|
||||||
<el-form-item label="填写优惠金额" prop="description" v-if="formData.projectType === 'fixed'">
|
<el-form-item label="填写优惠金额" prop="value" v-if="formData.type === '2'">
|
||||||
<el-input v-model="formData.description" placeholder="请输入优惠金额" class="fee-input">
|
<el-input v-model="formData.value" placeholder="请输入优惠金额" class="fee-input">
|
||||||
<template #append>元</template>
|
<template #append>元</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<!-- 选择有效期 -->
|
||||||
|
<el-form-item label="选择有效期" prop="startTime">
|
||||||
|
<el-date-picker type="daterange" v-model="formData.time" start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期" style="width: 100%;" value-format="YYYY-MM-DD" @change="(val) => {
|
||||||
|
console.log('选择的日期范围:', val);
|
||||||
|
formData.startTime = val[0];
|
||||||
|
formData.endTime = val[1];
|
||||||
|
}"></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<!-- 可用赛事 -->
|
<!-- 可用赛事 -->
|
||||||
<el-form-item label="可用赛事" prop="phone">
|
<el-form-item label="可用赛事" prop="phone">
|
||||||
<el-input v-model="formData.phone" placeholder="请输入费用" class="fee-input">
|
<el-select v-model="formData.eventIds" placeholder="请选择项目类型" multiple style="width: 100%;">
|
||||||
<template slot="append">元</template>
|
<el-option v-for="item in eventList" :key="item.id" :label="item.name"
|
||||||
</el-input>
|
:value="item.id"></el-option>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -89,32 +97,39 @@ import { ElMessage, ElForm } from 'element-plus';
|
|||||||
import SysMenuApi from '/@/api/SysMenuApi';
|
import SysMenuApi from '/@/api/SysMenuApi';
|
||||||
import { auths } from '/@/utils/authFunction';
|
import { auths } from '/@/utils/authFunction';
|
||||||
import ProTable from '/@/components/ProTable/index.vue';
|
import ProTable from '/@/components/ProTable/index.vue';
|
||||||
|
import { couponPage, couponAdd, couponEdit, couponDelete, couponEventlistGet } from '/@/api/match/coupon';
|
||||||
// 定义表单引用类型
|
// 定义表单引用类型
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
|
const eventList = ref([]);
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
projectName: '30秒单摇',
|
name: '',
|
||||||
projectType: 'discount',
|
type: '',
|
||||||
participantCount: '',
|
value: '',
|
||||||
description: '',
|
startTime: '',
|
||||||
fee: '100',
|
endTime: '',
|
||||||
durationMinutes: '',
|
eventIds: [],
|
||||||
phone: '30'
|
totalQuantity: '',
|
||||||
|
time: '',
|
||||||
})
|
})
|
||||||
|
const initParam = ref(true)
|
||||||
const formRules = ref({
|
const formRules = ref({
|
||||||
projectName: [
|
name: [
|
||||||
{ required: true, message: '请输入优惠券名称', trigger: 'blur' }
|
{ required: true, message: '请输入优惠券名称', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
projectType: [
|
type: [
|
||||||
{ required: true, message: '请选择优惠券类型', trigger: 'change' }
|
{ required: true, message: '请选择优惠券类型', trigger: 'change' }
|
||||||
],
|
],
|
||||||
participantCount: [
|
value: [
|
||||||
{ required: true, message: '请输入折扣百分比', trigger: 'blur' }
|
{ required: true, message: '请输入优惠额度', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
description: [
|
// description: [
|
||||||
{ required: true, message: '请输入优惠金额', trigger: 'blur' }
|
// { required: true, message: '请输入优惠金额', trigger: 'blur' }
|
||||||
|
// ],
|
||||||
|
startTime: [
|
||||||
|
{ required: true, message: '请选择有效期', trigger: 'change' }
|
||||||
|
],
|
||||||
|
endTime: [
|
||||||
|
{ required: true, message: '请选择有效期', trigger: 'change' }
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -132,28 +147,41 @@ const columns = ref([
|
|||||||
el: 'input',
|
el: 'input',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{prop: 'type',label: '优惠券类型',search: { el: 'select',},enum: [ { label: '全部', value: 0 }, { label: '折扣', value: 1 }, { label: '定价', value: 2 },]},
|
{ prop: 'type', label: '优惠券类型', search: { el: 'select', }, enum: [{ label: '全部', value: '' }, { label: '折扣', value: 1 }, { label: '定价', value: 2 },] },
|
||||||
{prop: 'money',label: '详情',},
|
{ prop: 'value', label: '详情', },
|
||||||
{ prop: 'code', label: '有效期' },
|
{ prop: 'startTime', label: '有效期' },
|
||||||
{ prop: 'img', label: '可用赛事' },
|
{ prop: 'eventNames', label: '可用赛事' },
|
||||||
|
|
||||||
{ prop: 'action', label: '操作', align: 'center', fixed: 'right', isShow: auths(['sysmenu:delete', 'sysmenu:edit']) },
|
{ prop: 'action', label: '操作', align: 'center', fixed: 'right', isShow: auths(['coupon:delete', 'coupon:edit']) },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const isShowDialog = ref(false);
|
const isShowDialog = ref(false);
|
||||||
const dialogTitle = ref('新增');
|
const dialogTitle = ref('新增');
|
||||||
|
|
||||||
const onOpenMenu = (id) => {
|
const onOpenMenu = async (row) => {
|
||||||
dialogTitle.value = id ? '编辑' : '新增';
|
console.log('打开菜单,数据:', row);
|
||||||
formData.value = {
|
if (eventList.value.length === 0) {
|
||||||
projectName: '',
|
const { data } = await couponEventlistGet();
|
||||||
projectType: '',
|
eventList.value = data;
|
||||||
participantCount: '',
|
}
|
||||||
description: '',
|
dialogTitle.value = row ? '编辑' : '新增';
|
||||||
fee: '',
|
if (row) {
|
||||||
durationMinutes: '',
|
// const { data } = await couponEdit(row.id);
|
||||||
phone: ''
|
formData.value = row;
|
||||||
};
|
formData.value.time = [row.startTime.slice(0,10) , row.endTime.slice(0,10)];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
formData.value = {
|
||||||
|
name: '',
|
||||||
|
type: '',
|
||||||
|
value: '',
|
||||||
|
startTime: '',
|
||||||
|
endTime: '',
|
||||||
|
eventIds: [],
|
||||||
|
totalQuantity: '',
|
||||||
|
time: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
isShowDialog.value = true;
|
isShowDialog.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -167,23 +195,6 @@ const onDeleteMenu = async (id) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAvatarSuccess = ( response,
|
|
||||||
uploadFile) => {
|
|
||||||
formData.value.fee = URL.createObjectURL(uploadFile.raw)
|
|
||||||
}
|
|
||||||
|
|
||||||
const beforeAvatarUpload = () => {
|
|
||||||
// if (rawFile.type !== 'image/jpeg') {
|
|
||||||
// ElMessage.error('Avatar picture must be JPG format!')
|
|
||||||
// return false
|
|
||||||
// } else if (rawFile.size / 1024 / 1024 > 2) {
|
|
||||||
// ElMessage.error('Avatar picture size can not exceed 2MB!')
|
|
||||||
// return false
|
|
||||||
// }
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 表单提交
|
// 表单提交
|
||||||
const onSubmit = () => {
|
const onSubmit = () => {
|
||||||
if (!formRef.value) return;
|
if (!formRef.value) return;
|
||||||
@ -191,23 +202,24 @@ const onSubmit = () => {
|
|||||||
formRef.value.validate(async (valid) => {
|
formRef.value.validate(async (valid) => {
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
|
|
||||||
// try {
|
try {
|
||||||
// let res;
|
let res;
|
||||||
// if (formData.value.id) {
|
if (formData.value.id) {
|
||||||
// res = await SysMenuApi.add(formData.value);
|
res = await couponEdit(formData.value);
|
||||||
// } else {
|
} else {
|
||||||
// res = await SysMenuApi.add(formData.value);
|
res = await couponAdd(formData.value);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (res.succeeded) {
|
if (res.succeeded) {
|
||||||
// ElMessage.success(dialogTitle.value + '成功');
|
initParam.value = !initParam.value;
|
||||||
// isShowDialog.value = false;
|
ElMessage.success(dialogTitle.value + '成功');
|
||||||
// } else {
|
isShowDialog.value = false;
|
||||||
// ElMessage.error(res.errors);
|
} else {
|
||||||
// }
|
ElMessage.error(res.errors);
|
||||||
// } catch (error) {
|
}
|
||||||
// console.error(error);
|
} catch (error) {
|
||||||
// }
|
console.error(error);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -241,29 +253,27 @@ const onCancel = () => {
|
|||||||
color: #909399;
|
color: #909399;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.avatar-uploader .el-upload {
|
.avatar-uploader .el-upload {
|
||||||
border: 1px dashed var(--el-border-color);
|
border: 1px dashed var(--el-border-color);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
transition: var(--el-transition-duration-fast);
|
transition: var(--el-transition-duration-fast);
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-uploader .el-upload:hover {
|
.avatar-uploader .el-upload:hover {
|
||||||
border-color: var(--el-color-primary);
|
border-color: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-icon.avatar-uploader-icon {
|
.el-icon.avatar-uploader-icon {
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
color: #8c939d;
|
color: #8c939d;
|
||||||
width: 178px;
|
width: 178px;
|
||||||
height: 178px;
|
height: 178px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -1,36 +1,29 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="system-menu-container layout-padding">
|
<div class="system-menu-container layout-padding">
|
||||||
<ProTable ref="tableRef" :request-api="SysMenuApi.page" :columns="columns" :pagination="false"
|
<ProTable ref="tableRef" :request-api="projectPageGet" :columns="columns" :pagination="true"
|
||||||
:tool-button="false">
|
:tool-button="false">
|
||||||
<template #tools>
|
<template #tools>
|
||||||
<el-button v-auth="'sysmenu:add'" type="primary" icon="ele-Plus" @click="onOpenMenu"> 新增 </el-button>
|
<el-button v-auth="'project:add'" type="primary" icon="ele-Plus" @click="onOpenMenu"> 新增 </el-button>
|
||||||
</template>
|
</template>
|
||||||
<template #index="scope">
|
<template #index="scope">
|
||||||
{{ scope.$index + 1 }}
|
{{ scope.$index + 1 }}
|
||||||
</template>
|
</template>
|
||||||
<template #name="scope">
|
|
||||||
<SvgIcon :name="scope.row.icon" />
|
<template #projectTypeId="scope">
|
||||||
<span class="ml10">{{ $t(scope.row.name) }}</span>
|
{{ scope.row.projectTypeName }}
|
||||||
</template>
|
|
||||||
<template #type="scope">
|
|
||||||
<el-tag :type="scope.row.type === 0 ? '' : scope.row.type === 1 ? 'success' : 'danger'">
|
|
||||||
{{ scope.row.type === 0 ? '目录' : scope.row.type === 1 ? '菜单' : '按钮' }}</el-tag>
|
|
||||||
</template>
|
|
||||||
<template #status="scope">
|
|
||||||
<el-tag :type="scope.row.status === 0 ? 'success' : 'danger'"> {{ scope.row.status === 0 ? '启用' : '禁用'
|
|
||||||
}}</el-tag>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #action="scope">
|
<template #action="scope">
|
||||||
<el-button v-auth="'sysmenu:edit'" icon="ele-Edit" size="small" text type="primary"
|
<el-button v-auth="'project:edit'" icon="ele-Edit" size="small" text type="primary"
|
||||||
@click="onOpenMenu(scope.row.id)"> 编辑 </el-button>
|
@click="onOpenMenu(scope.row.id)"> 编辑 </el-button>
|
||||||
<el-popconfirm title="确认删除吗?" @confirm="onDeleteMenu(scope.row.id)">
|
<el-popconfirm title="确认删除吗?" @confirm="onDeleteMenu(scope.row.id)">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button v-auth="'sysmenu:delete'" icon="ele-Delete" size="small" text type="danger"> 删除
|
<el-button v-auth="'project:delete'" icon="ele-Delete" size="small" text type="danger"> 删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
|
|
||||||
<el-button v-auth="'sysmenu:add'" size="small" text type="primary" @click="onOpenMenu(scope.row.id)">
|
<el-button v-auth="'project:detail'" size="small" text type="primary" @click="onOpenMenu(scope.row.id)">
|
||||||
查看详情 </el-button>
|
查看详情 </el-button>
|
||||||
</template>
|
</template>
|
||||||
</ProTable>
|
</ProTable>
|
||||||
@ -41,28 +34,23 @@
|
|||||||
style="width: 70%;margin-bottom: 30px;" v-if="isShowDialog">
|
style="width: 70%;margin-bottom: 30px;" v-if="isShowDialog">
|
||||||
|
|
||||||
<!-- 项目名称 -->
|
<!-- 项目名称 -->
|
||||||
<el-form-item label="项目名称:" prop="projectName">
|
<el-form-item label="项目名称:" prop="name">
|
||||||
<el-input v-model="formData.projectName" placeholder="请输入项目名称"></el-input>
|
<el-input v-model="formData.name" placeholder="请输入项目名称"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- 项目类型 -->
|
<!-- 项目类型 -->
|
||||||
<el-form-item label="项目类型:" prop="projectType">
|
<el-form-item label="项目类型:" prop="projectTypeId">
|
||||||
<el-select v-model="formData.projectType" placeholder="请选择项目类型" style="width: 100%;">
|
<el-select v-model="formData.projectTypeId" placeholder="请选择项目类型" style="width: 100%;">
|
||||||
<el-option label="个人速度" value="personal_speed"></el-option>
|
<el-option label="个人速度" value="1003"></el-option>
|
||||||
<el-option label="个人花样" value="personal_endurance"></el-option>
|
<el-option label="个人花样" value="1004"></el-option>
|
||||||
<el-option label="团队速度" value="team_speed"></el-option>
|
<el-option label="团队速度" value="1001"></el-option>
|
||||||
<el-option label="团队花样" value="team_cooperation"></el-option>
|
<el-option label="团队花样" value="1002"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- 完成人数 -->
|
<!-- 完成人数 -->
|
||||||
<el-form-item label="完成人数:" prop="participantCount">
|
<el-form-item label="完成人数:" prop="completionCount" v-if="formData.projectTypeId == 1001 || formData.projectTypeId == 1002">
|
||||||
<el-input v-model="formData.participantCount" placeholder="请输入完成人数"></el-input>
|
<el-input v-model="formData.completionCount" placeholder="请输入完成人数"></el-input>
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<!-- 项目描述(根据图片中的模糊区域推断) -->
|
|
||||||
<el-form-item label="项目描述:" prop="description">
|
|
||||||
<el-input type="textarea" v-model="formData.description" :rows="4" placeholder="请输入项目描述"></el-input>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- 费用 -->
|
<!-- 费用 -->
|
||||||
@ -94,35 +82,36 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="sysMenu">
|
<script setup name="project">
|
||||||
import { defineAsyncComponent, ref, reactive } from 'vue';
|
import { defineAsyncComponent, ref, reactive } from 'vue';
|
||||||
import { ElMessage, ElForm } from 'element-plus';
|
import { ElMessage, ElForm } from 'element-plus';
|
||||||
import SysMenuApi from '/@/api/SysMenuApi';
|
import SysMenuApi from '/@/api/SysMenuApi';
|
||||||
import { auths } from '/@/utils/authFunction';
|
import { auths } from '/@/utils/authFunction';
|
||||||
import ProTable from '/@/components/ProTable/index.vue';
|
import ProTable from '/@/components/ProTable/index.vue';
|
||||||
import { ColumnProps } from '/@/components/ProTable/interface';
|
import { projectPageGet, projectAddPost ,projectEditPut ,projectDeleteDelete} from '/@/api/match/project';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 定义表单引用类型
|
// 定义表单引用类型
|
||||||
const formRef = ref<InstanceType<typeof ElForm>>();
|
const formRef = ref();
|
||||||
|
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
projectName: '30秒单摇',
|
name: '',
|
||||||
projectType: 'personal_speed',
|
projectTypeId: '',
|
||||||
participantCount: '',
|
completionCount: '',
|
||||||
description: '',
|
fee: '',
|
||||||
fee: '100',
|
durationMinutes: '0',
|
||||||
durationMinutes: '',
|
durationSeconds: '0'
|
||||||
durationSeconds: '30'
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const formRules = ref({
|
const formRules = ref({
|
||||||
projectName: [
|
name: [
|
||||||
{ required: true, message: '请输入项目名称', trigger: 'blur' }
|
{ required: true, message: '请输入项目名称', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
projectType: [
|
projectTypeId: [
|
||||||
{ required: true, message: '请选择项目类型', trigger: 'change' }
|
{ required: true, message: '请选择项目类型', trigger: 'change' }
|
||||||
],
|
],
|
||||||
participantCount: [
|
completionCount: [
|
||||||
{ required: true, message: '请输入完成人数', trigger: 'blur' }
|
{ required: true, message: '请输入完成人数', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
description: [
|
description: [
|
||||||
@ -139,7 +128,7 @@ const formRules = ref({
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
const columns = ref<ColumnProps[]>([
|
const columns = ref([
|
||||||
{
|
{
|
||||||
prop: 'index',
|
prop: 'index',
|
||||||
label: '序号',
|
label: '序号',
|
||||||
@ -154,36 +143,38 @@ const columns = ref<ColumnProps[]>([
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'type',
|
prop: 'projectTypeId',
|
||||||
label: '项目类型',
|
label: '项目类型',
|
||||||
search: {
|
search: {
|
||||||
el: 'select',
|
el: 'select',
|
||||||
},
|
},
|
||||||
enum: [
|
enum: [
|
||||||
{ label: '全部', value: 0 },
|
{ label: '全部', value: 0 },
|
||||||
{ label: '线上', value: 1 },
|
{ label: '团队速度', value: 1001 },
|
||||||
{ label: '线下', value: 2 },
|
{ label: '团队花样', value: 1002 },
|
||||||
|
{ label: '个人速度', value: 1003 },
|
||||||
|
{ label: '个人花样', value: 1004 },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'path',
|
prop: 'completionCount',
|
||||||
label: '完成人数',
|
label: '完成人数',
|
||||||
},
|
},
|
||||||
|
|
||||||
{ prop: 'code', label: '费用' },
|
{ prop: 'fee', label: '费用(元)' },
|
||||||
|
|
||||||
{ prop: 'action', label: '操作', align: 'center', fixed: 'right', isShow: auths(['sysmenu:delete', 'sysmenu:edit', 'sysmenu:add']) },
|
{ prop: 'action', label: '操作', align: 'center', fixed: 'right', isShow: auths(['project:delete', 'project:edit', 'project:add']) },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const isShowDialog = ref(false);
|
const isShowDialog = ref(false);
|
||||||
const dialogTitle = ref('新增');
|
const dialogTitle = ref('新增');
|
||||||
|
|
||||||
const onOpenMenu = (id: number = 0) => {
|
const onOpenMenu = (id) => {
|
||||||
dialogTitle.value = id ? '编辑' : '新增';
|
dialogTitle.value = id ? '编辑' : '新增';
|
||||||
formData.value = {
|
formData.value = {
|
||||||
projectName: '',
|
projectName: '',
|
||||||
projectType: '',
|
projectTypeId: '',
|
||||||
participantCount: '',
|
completionCount: '',
|
||||||
description: '',
|
description: '',
|
||||||
fee: '',
|
fee: '',
|
||||||
durationMinutes: '',
|
durationMinutes: '',
|
||||||
@ -193,8 +184,8 @@ const onOpenMenu = (id: number = 0) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//删除菜单
|
//删除菜单
|
||||||
const onDeleteMenu = async (id: number) => {
|
const onDeleteMenu = async (id) => {
|
||||||
const { succeeded, errors } = await SysMenuApi.delete({ id });
|
const { succeeded, errors } = await merchantDeleteDelete({ id });
|
||||||
if (succeeded) {
|
if (succeeded) {
|
||||||
ElMessage.success('删除成功');
|
ElMessage.success('删除成功');
|
||||||
} else {
|
} else {
|
||||||
@ -209,23 +200,23 @@ const onSubmit = () => {
|
|||||||
formRef.value.validate(async (valid) => {
|
formRef.value.validate(async (valid) => {
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
|
|
||||||
// try {
|
try {
|
||||||
// let res;
|
let res;
|
||||||
// if (formData.value.id) {
|
if (formData.value.id) {
|
||||||
// res = await SysMenuApi.add(formData.value);
|
res = await projectEditPut(formData.value);
|
||||||
// } else {
|
} else {
|
||||||
// res = await SysMenuApi.add(formData.value);
|
res = await projectAddPost(formData.value);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (res.succeeded) {
|
if (res.succeeded) {
|
||||||
// ElMessage.success(dialogTitle.value + '成功');
|
ElMessage.success(dialogTitle.value + '成功');
|
||||||
// isShowDialog.value = false;
|
isShowDialog.value = false;
|
||||||
// } else {
|
} else {
|
||||||
// ElMessage.error(res.errors);
|
ElMessage.error(res.errors);
|
||||||
// }
|
}
|
||||||
// } catch (error) {
|
} catch (error) {
|
||||||
// console.error(error);
|
console.error(error);
|
||||||
// }
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,31 +1,26 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="system-menu-container layout-padding">
|
<div class="system-menu-container layout-padding">
|
||||||
<ProTable ref="tableRef" :request-api="SysMenuApi.page" :columns="columns" :pagination="false"
|
<ProTable ref="tableRef" :request-api="merchantPageGet" :columns="columns" :pagination="true" :initParam="initParam"
|
||||||
:tool-button="false">
|
:tool-button="false">
|
||||||
<template #tools>
|
<template #tools>
|
||||||
<el-button v-auth="'sysmenu:add'" type="primary" icon="ele-Plus" @click="onOpenMenu"> 新增 </el-button>
|
<el-button v-auth="'merchant:add'" type="primary" icon="ele-Plus" @click="onOpenMenu()"> 新增 </el-button>
|
||||||
</template>
|
</template>
|
||||||
<template #index="scope">
|
<template #index="scope">
|
||||||
{{ scope.$index + 1 }}
|
{{ scope.$index + 1 }}
|
||||||
</template>
|
</template>
|
||||||
<template #name="scope">
|
<template #businessLicenseUrl="scope">
|
||||||
<SvgIcon :name="scope.row.icon" />
|
<el-image :src="scope.row.businessLicenseUrl" style="width: 100px;" fit="cover" />
|
||||||
<span class="ml10">{{ $t(scope.row.name) }}</span>
|
|
||||||
</template>
|
|
||||||
<template #type="scope">
|
|
||||||
<el-tag :type="scope.row.type === 0 ? '' : scope.row.type === 1 ? 'success' : 'danger'">
|
|
||||||
{{ scope.row.type === 0 ? '目录' : scope.row.type === 1 ? '菜单' : '按钮' }}</el-tag>
|
|
||||||
</template>
|
</template>
|
||||||
<template #status="scope">
|
<template #status="scope">
|
||||||
<el-tag :type="scope.row.status === 0 ? 'success' : 'danger'"> {{ scope.row.status === 0 ? '启用' : '禁用'
|
<el-tag :type="scope.row.status === 0 ? 'success' : 'danger'"> {{ scope.row.status === 0 ? '启用' : '禁用'
|
||||||
}}</el-tag>
|
}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
<template #action="scope">
|
<template #action="scope">
|
||||||
<el-button v-auth="'sysmenu:edit'" icon="ele-Edit" size="small" text type="primary"
|
<el-button v-auth="'merchant:edit'" icon="ele-Edit" size="small" text type="primary"
|
||||||
@click="onOpenMenu(scope.row.id)"> 编辑 </el-button>
|
@click="onOpenMenu(scope.row)"> 编辑 </el-button>
|
||||||
<el-popconfirm title="确认删除吗?" @confirm="onDeleteMenu(scope.row.id)">
|
<el-popconfirm title="确认删除吗?" @confirm="onDeleteMenu(scope.row.id)">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button v-auth="'sysmenu:delete'" icon="ele-Delete" size="small" text type="danger"> 删除
|
<el-button v-auth="'merchant:delete'" icon="ele-Delete" size="small" text type="danger"> 删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
@ -33,44 +28,44 @@
|
|||||||
</ProTable>
|
</ProTable>
|
||||||
|
|
||||||
<!-- 弹窗 -->
|
<!-- 弹窗 -->
|
||||||
<el-dialog title="新增" v-model="isShowDialog">
|
<el-dialog :title="dialogTitle" v-model="isShowDialog">
|
||||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="200px"
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="200px"
|
||||||
style="max-width: 600px;margin-bottom: 30px;" v-if="isShowDialog">
|
style="max-width: 600px;margin-bottom: 30px;" v-if="isShowDialog">
|
||||||
|
|
||||||
<!-- 商户名称 -->
|
<!-- 商户名称 -->
|
||||||
<el-form-item label="商户名称" prop="projectName">
|
<el-form-item label="商户名称" prop="merchantName">
|
||||||
<el-input v-model="formData.projectName" placeholder="请输入项目名称"></el-input>
|
<el-input v-model="formData.merchantName" placeholder="请输入商户名称"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- 统一社会信用代码 -->
|
<!-- 统一社会信用代码 -->
|
||||||
<el-form-item label="统一社会信用代码" prop="projectType">
|
<el-form-item label="统一社会信用代码" prop="creditCode">
|
||||||
<el-input v-model="formData.projectType" placeholder="请输入项目名称"></el-input>
|
<el-input v-model="formData.creditCode" placeholder="请输入统一社会信用代码"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- 开户行 -->
|
<!-- 开户行 -->
|
||||||
<el-form-item label="开户行" prop="participantCount">
|
<el-form-item label="开户行" prop="bankName">
|
||||||
<el-input v-model="formData.participantCount" placeholder="请输入完成人数"></el-input>
|
<el-input v-model="formData.bankName" placeholder="请输入开户行"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- 账号 -->
|
<!-- 账号 -->
|
||||||
<el-form-item label="账号" prop="description">
|
<el-form-item label="账号" prop="accountNumber">
|
||||||
<el-input v-model="formData.description" placeholder="请输入项目描述"></el-input>
|
<el-input v-model="formData.accountNumber" placeholder="请输入账号"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- 营业执照 -->
|
<!-- 营业执照 -->
|
||||||
<el-form-item label="营业执照" prop="fee">
|
<el-form-item label="营业执照" prop="businessLicenseUrl">
|
||||||
<el-upload class="avatar-uploader" action=""
|
<el-upload class="avatar-uploader" action="/api/file/upload" :show-file-list="false"
|
||||||
:show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
|
:on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
|
||||||
<img v-if="formData.fee" :src="formData.fee" class="avatar" />
|
<img v-if="formData.businessLicenseUrl" :src="formData.businessLicenseUrl" class="avatar" />
|
||||||
<el-icon v-else class="avatar-uploader-icon">
|
<el-icon v-else class="avatar-uploader-icon">
|
||||||
<Plus />
|
<Plus />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- 费用 -->
|
<!-- 费用 -->
|
||||||
<el-form-item label="联系电话" prop="phone">
|
<el-form-item label="联系电话" prop="contactPhone">
|
||||||
<el-input v-model="formData.phone" placeholder="请输入费用" class="fee-input">
|
<el-input v-model="formData.contactPhone" placeholder="请输入联系电话" class="fee-input">
|
||||||
<template slot="append">元</template>
|
<template slot="append">元</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -89,37 +84,40 @@
|
|||||||
<script setup name="sysMenu">
|
<script setup name="sysMenu">
|
||||||
import { defineAsyncComponent, ref, reactive } from 'vue';
|
import { defineAsyncComponent, ref, reactive } from 'vue';
|
||||||
import { ElMessage, ElForm } from 'element-plus';
|
import { ElMessage, ElForm } from 'element-plus';
|
||||||
import SysMenuApi from '/@/api/SysMenuApi';
|
import { merchantPageGet, merchantAddPost ,merchantEditPut ,merchantDeleteDelete} from '/@/api/match/merchant';
|
||||||
|
|
||||||
import { auths } from '/@/utils/authFunction';
|
import { auths } from '/@/utils/authFunction';
|
||||||
import ProTable from '/@/components/ProTable/index.vue';
|
import ProTable from '/@/components/ProTable/index.vue';
|
||||||
|
|
||||||
// 定义表单引用类型
|
// 定义表单引用类型
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
|
const initParam = ref({
|
||||||
|
refresh: false,
|
||||||
|
});
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
projectName: '30秒单摇',
|
merchantName: '',
|
||||||
projectType: 'personal_speed',
|
creditCode: '',
|
||||||
participantCount: '',
|
bankName: '',
|
||||||
description: '',
|
accountNumber: '',
|
||||||
fee: '100',
|
businessLicenseUrl: '',
|
||||||
durationMinutes: '',
|
durationMinutes: '',
|
||||||
phone: '30'
|
contactPhone: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
const formRules = ref({
|
const formRules = ref({
|
||||||
projectName: [
|
merchantName: [
|
||||||
{ required: true, message: '请输入商户名称', trigger: 'blur' }
|
{ required: true, message: '请输入商户名称', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
projectType: [
|
creditCode: [
|
||||||
{ required: true, message: '请选择统一社会信用代码', trigger: 'change' }
|
{ required: true, message: '请选择统一社会信用代码', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
participantCount: [
|
bankName: [
|
||||||
{ required: true, message: '请输入开户行', trigger: 'blur' }
|
{ required: true, message: '请输入开户行', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
description: [
|
accountNumber: [
|
||||||
{ required: true, message: '请输入账号', trigger: 'blur' }
|
{ required: true, message: '请输入账号', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
fee: [
|
businessLicenseUrl: [
|
||||||
{ required: true, message: '请上传营业执照', trigger: 'blur' }
|
{ required: true, message: '请上传营业执照', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -132,90 +130,96 @@ const columns = ref([
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'merchantName',
|
||||||
label: '商户名称',
|
label: '商户名称',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
search: {
|
search: {
|
||||||
el: 'input',
|
el: 'input',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{prop: 'type',label: '统一社会信用代码',},
|
{ prop: 'creditCode', label: '统一社会信用代码', },
|
||||||
{prop: 'path',label: '开户行',},
|
{ prop: 'bankName', label: '开户行', },
|
||||||
{ prop: 'code', label: '账号' },
|
{ prop: 'accountNumber', label: '账号' },
|
||||||
{ prop: 'img', label: '营业执照' },
|
{ prop: 'businessLicenseUrl', label: '营业执照' },
|
||||||
{ prop: 'phone', label: '联系电话' },
|
{ prop: 'contactPhone', label: '联系电话' },
|
||||||
|
|
||||||
{ prop: 'action', label: '操作', align: 'center', fixed: 'right', isShow: auths(['sysmenu:delete', 'sysmenu:edit']) },
|
{ prop: 'action', label: '操作', align: 'center', fixed: 'right', isShow: auths(['merchant:delete', 'merchant:edit']) },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const isShowDialog = ref(false);
|
const isShowDialog = ref(false);
|
||||||
const dialogTitle = ref('新增');
|
const dialogTitle = ref('新增');
|
||||||
|
|
||||||
const onOpenMenu = (id) => {
|
const onOpenMenu = (data) => {
|
||||||
dialogTitle.value = id ? '编辑' : '新增';
|
console.log(data)
|
||||||
formData.value = {
|
dialogTitle.value = data ? '编辑' : '新增';
|
||||||
projectName: '',
|
if (data) {
|
||||||
projectType: '',
|
formData.value = data;
|
||||||
participantCount: '',
|
} else {
|
||||||
description: '',
|
formData.value = {
|
||||||
fee: '',
|
merchantName: '',
|
||||||
durationMinutes: '',
|
creditCode: '',
|
||||||
phone: ''
|
bankName: '',
|
||||||
};
|
accountNumber: '',
|
||||||
|
businessLicenseUrl: '',
|
||||||
|
phone: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
isShowDialog.value = true;
|
isShowDialog.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
//删除菜单
|
//删除菜单
|
||||||
const onDeleteMenu = async (id) => {
|
const onDeleteMenu = async (id) => {
|
||||||
const { succeeded, errors } = await SysMenuApi.delete({ id });
|
const { succeeded, errors } = await merchantDeleteDelete({ id });
|
||||||
if (succeeded) {
|
if (succeeded) {
|
||||||
ElMessage.success('删除成功');
|
ElMessage.success('删除成功');
|
||||||
|
initParam.value.refresh = !initParam.value.refresh;
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error(errors);
|
ElMessage.error(errors);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAvatarSuccess = ( response,
|
const handleAvatarSuccess = (response, uploadFile) => {
|
||||||
uploadFile) => {
|
formData.value.businessLicenseUrl = response[0].url;
|
||||||
formData.value.fee = URL.createObjectURL(uploadFile.raw)
|
console.log(response, uploadFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
const beforeAvatarUpload = () => {
|
const beforeAvatarUpload = () => {
|
||||||
// if (rawFile.type !== 'image/jpeg') {
|
// if (rawFile.type !== 'image/jpeg') {
|
||||||
// ElMessage.error('Avatar picture must be JPG format!')
|
// ElMessage.error('Avatar picture must be JPG format!')
|
||||||
// return false
|
// return false
|
||||||
// } else if (rawFile.size / 1024 / 1024 > 2) {
|
// } else if (rawFile.size / 1024 / 1024 > 2) {
|
||||||
// ElMessage.error('Avatar picture size can not exceed 2MB!')
|
// ElMessage.error('Avatar picture size can not exceed 2MB!')
|
||||||
// return false
|
// return false
|
||||||
// }
|
// }
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 表单提交
|
// 表单提交
|
||||||
const onSubmit = () => {
|
const onSubmit = () => {
|
||||||
|
console.log(formData.value)
|
||||||
if (!formRef.value) return;
|
if (!formRef.value) return;
|
||||||
|
|
||||||
formRef.value.validate(async (valid) => {
|
formRef.value.validate(async (valid) => {
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
|
try {
|
||||||
|
let res;
|
||||||
|
if (formData.value.id) {
|
||||||
|
res = await merchantEditPut(formData.value);
|
||||||
|
} else {
|
||||||
|
res = await merchantAddPost(formData.value);
|
||||||
|
}
|
||||||
|
|
||||||
// try {
|
if (res.succeeded) {
|
||||||
// let res;
|
initParam.value.refresh = !initParam.value.refresh;
|
||||||
// if (formData.value.id) {
|
ElMessage.success(dialogTitle.value + '成功');
|
||||||
// res = await SysMenuApi.add(formData.value);
|
isShowDialog.value = false;
|
||||||
// } else {
|
} else {
|
||||||
// res = await SysMenuApi.add(formData.value);
|
ElMessage.error(res.errors);
|
||||||
// }
|
}
|
||||||
|
} catch (error) {
|
||||||
// if (res.succeeded) {
|
console.error(error);
|
||||||
// ElMessage.success(dialogTitle.value + '成功');
|
}
|
||||||
// isShowDialog.value = false;
|
|
||||||
// } else {
|
|
||||||
// ElMessage.error(res.errors);
|
|
||||||
// }
|
|
||||||
// } catch (error) {
|
|
||||||
// console.error(error);
|
|
||||||
// }
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -250,28 +254,30 @@ const onCancel = () => {
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 350px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.avatar-uploader .el-upload {
|
.avatar-uploader .el-upload {
|
||||||
border: 1px dashed var(--el-border-color);
|
border: 1px dashed var(--el-border-color);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
transition: var(--el-transition-duration-fast);
|
transition: var(--el-transition-duration-fast);
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-uploader .el-upload:hover {
|
.avatar-uploader .el-upload:hover {
|
||||||
border-color: var(--el-color-primary);
|
border-color: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-icon.avatar-uploader-icon {
|
.el-icon.avatar-uploader-icon {
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
color: #8c939d;
|
color: #8c939d;
|
||||||
width: 178px;
|
width: 178px;
|
||||||
height: 178px;
|
height: 178px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
x
Reference in New Issue
Block a user