新增微信支付、Native支付
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
VITE_APP_NAME=后台管理系统
|
||||
VITE_SOCKET_URL=wss://server.gxwebsoft.com
|
||||
VITE_SERVER_URL=https://server.gxwebsoft.com/api
|
||||
#VITE_API_URL=https://modules.gxwebsoft.com/api
|
||||
#VITE_SERVER_URL=https://server.gxwebsoft.com/api
|
||||
VITE_API_URL=https://modules.gxwebsoft.com/api
|
||||
|
||||
VITE_API_URL=http://127.0.0.1:9099/api
|
||||
#VITE_SERVER_URL=http://127.0.0.1:9091/api
|
||||
#VITE_API_URL=http://127.0.0.1:9099/api
|
||||
VITE_SERVER_URL=http://127.0.0.1:9091/api
|
||||
#VITE_SOCKET_URL=ws://localhost:9191
|
||||
#VITE_API_URL=https://server.gxwebsoft.com/api
|
||||
#VITE_API_URL=http://103.233.255.195:9300/api
|
||||
|
||||
@@ -28,12 +28,20 @@ export interface Merchant {
|
||||
region?: string;
|
||||
// 地址
|
||||
address?: string;
|
||||
// 每小时价格
|
||||
price?: number;
|
||||
// 手续费
|
||||
commission?: number;
|
||||
// 关键字
|
||||
keywords?: string;
|
||||
// 资质图片
|
||||
files?: string;
|
||||
// 营业时间
|
||||
businessTime?: string;
|
||||
timePeriod1?: string;
|
||||
timePeriod2?: string;
|
||||
// 商户介绍
|
||||
content?: string;
|
||||
// 是否自营
|
||||
ownStore?: number;
|
||||
// 是否推荐
|
||||
|
||||
121
src/api/system/payment/index.ts
Normal file
121
src/api/system/payment/index.ts
Normal file
@@ -0,0 +1,121 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { Payment, PaymentParam } from './model';
|
||||
import { SERVER_API_URL } from '@/config/setting';
|
||||
import type { Order } from '@/api/shop/order/model';
|
||||
|
||||
/**
|
||||
* 分页查询支付方式
|
||||
*/
|
||||
export async function pagePayment(params: PaymentParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Payment>>>(
|
||||
SERVER_API_URL + '/system/payment/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询支付方式列表
|
||||
*/
|
||||
export async function listPayment(params?: PaymentParam) {
|
||||
const res = await request.get<ApiResult<Payment[]>>(
|
||||
SERVER_API_URL + '/system/payment',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加支付方式
|
||||
*/
|
||||
export async function addPayment(data: Payment) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/payment',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改支付方式
|
||||
*/
|
||||
export async function updatePayment(data: Payment) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/payment',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除支付方式
|
||||
*/
|
||||
export async function removePayment(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/payment/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除支付方式
|
||||
*/
|
||||
export async function removeBatchPayment(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/payment/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询支付方式
|
||||
*/
|
||||
export async function getPayment(id: number) {
|
||||
const res = await request.get<ApiResult<Payment>>(
|
||||
SERVER_API_URL + '/system/payment/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成支付二维码(微信native)
|
||||
*/
|
||||
export async function getNativeCode(data: Order) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/wx-native-pay/codeUrl',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
51
src/api/system/payment/model/index.ts
Normal file
51
src/api/system/payment/model/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
export interface Payment {
|
||||
// ID
|
||||
id?: number;
|
||||
// 支付方式
|
||||
name?: string;
|
||||
// 标识
|
||||
code?: string;
|
||||
// 支付图标
|
||||
image?: string;
|
||||
// 微信商户号类型 1普通商户2子商户
|
||||
wechatType?: number;
|
||||
// 应用ID
|
||||
appId?: string;
|
||||
// 商户号
|
||||
mchId?: string;
|
||||
// 设置APIv3密钥
|
||||
apiKey?: string;
|
||||
// 证书文件 (CERT)
|
||||
apiclientCert?: string;
|
||||
// 证书文件 (KEY)
|
||||
apiclientKey?: string;
|
||||
// 商户证书序列号
|
||||
merchantSerialNumber?: string;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 文章排序(数字越小越靠前)
|
||||
sortNumber?: number;
|
||||
// 状态, 0启用, 1禁用
|
||||
status?: boolean;
|
||||
// 是否删除, 0否, 1是
|
||||
deleted?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 注册时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付方式搜索条件
|
||||
*/
|
||||
export interface PaymentParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
56
src/components/PayMethod/index.vue
Normal file
56
src/components/PayMethod/index.vue
Normal file
@@ -0,0 +1,56 @@
|
||||
<!-- 选择下拉框 -->
|
||||
<template>
|
||||
<a-select
|
||||
:allow-clear="true"
|
||||
:show-search="true"
|
||||
optionFilterProp="label"
|
||||
:options="options"
|
||||
:value="value"
|
||||
:placeholder="placeholder"
|
||||
@update:value="updateValue"
|
||||
:style="`width: 200px`"
|
||||
@blur="onBlur"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { SelectProps } from 'ant-design-vue';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:value', value: string, item: any): void;
|
||||
(e: 'blur'): void;
|
||||
}>();
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
value?: any;
|
||||
type?: any;
|
||||
placeholder?: string;
|
||||
dictCode?: string;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择服务器厂商'
|
||||
}
|
||||
);
|
||||
|
||||
// 字典数据
|
||||
const options = ref<SelectProps['options']>([
|
||||
{ value: 'wxPay', label: '微信支付', icon: 'WechatOutlined' },
|
||||
{ value: 'aliPay', label: '支付宝支付', icon: 'AlipayCircleOutlined' },
|
||||
{ value: 'balancePay', label: '余额支付', icon: 'PayCircleOutlined' },
|
||||
{ value: 'yearCardPay', label: '年卡支付', icon: 'IdcardOutlined' },
|
||||
{ value: 'icCardPay', label: 'IC卡支付', icon: 'IdcardOutlined' }
|
||||
]);
|
||||
|
||||
/* 更新选中数据 */
|
||||
const updateValue = (value: string) => {
|
||||
const item = options.value?.find((d) => d.value == value);
|
||||
console.log(item);
|
||||
emit('update:value', value, item);
|
||||
};
|
||||
/* 失去焦点 */
|
||||
const onBlur = () => {
|
||||
emit('blur');
|
||||
};
|
||||
</script>
|
||||
@@ -110,7 +110,10 @@
|
||||
v-model:value="form.totalPrice"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格" name="reducePrice">
|
||||
<a-form-item
|
||||
label="减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格"
|
||||
name="reducePrice"
|
||||
>
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格"
|
||||
@@ -159,7 +162,10 @@
|
||||
v-model:value="form.coachId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="1微信支付,2积分,3支付宝,4现金,5POS机,6VIP月卡,7VIP年卡,8VIP次卡,9IC月卡,10IC年卡,11IC次卡,12免费,13VIP充值卡,14IC充值卡,15积分支付,16VIP季卡,17IC季卡" name="payType">
|
||||
<a-form-item
|
||||
label="1微信支付,2积分,3支付宝,4现金,5POS机,6VIP月卡,7VIP年卡,8VIP次卡,9IC月卡,10IC年卡,11IC次卡,12免费,13VIP充值卡,14IC充值卡,15积分支付,16VIP季卡,17IC季卡"
|
||||
name="payType"
|
||||
>
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入1微信支付,2积分,3支付宝,4现金,5POS机,6VIP月卡,7VIP年卡,8VIP次卡,9IC月卡,10IC年卡,11IC次卡,12免费,13VIP充值卡,14IC充值卡,15积分支付,16VIP季卡,17IC季卡"
|
||||
@@ -173,21 +179,30 @@
|
||||
v-model:value="form.payStatus"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="1已完成,2未使用,3已取消,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款" name="orderStatus">
|
||||
<a-form-item
|
||||
label="1已完成,2未使用,3已取消,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款"
|
||||
name="orderStatus"
|
||||
>
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入1已完成,2未使用,3已取消,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款"
|
||||
v-model:value="form.orderStatus"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡" name="type">
|
||||
<a-form-item
|
||||
label="优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡"
|
||||
name="type"
|
||||
>
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡"
|
||||
v-model:value="form.type"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="二维码地址,保存订单号,支付成功后才生成" name="qrcode">
|
||||
<a-form-item
|
||||
label="二维码地址,保存订单号,支付成功后才生成"
|
||||
name="qrcode"
|
||||
>
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入二维码地址,保存订单号,支付成功后才生成"
|
||||
@@ -222,7 +237,10 @@
|
||||
v-model:value="form.startTime"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="是否已开具发票:1已开发票,2未开发票,3不能开具发票" name="isInvoice">
|
||||
<a-form-item
|
||||
label="是否已开具发票:1已开发票,2未开发票,3不能开具发票"
|
||||
name="isInvoice"
|
||||
>
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入是否已开具发票:1已开发票,2未开发票,3不能开具发票"
|
||||
@@ -257,7 +275,10 @@
|
||||
v-model:value="form.refundApplyTime"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="对账情况:1=已对账;2=未对账;3=已对账,金额对不上;4=未查询到该订单" name="checkBill">
|
||||
<a-form-item
|
||||
label="对账情况:1=已对账;2=未对账;3=已对账,金额对不上;4=未查询到该订单"
|
||||
name="checkBill"
|
||||
>
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入对账情况:1=已对账;2=未对账;3=已对账,金额对不上;4=未查询到该订单"
|
||||
@@ -361,14 +382,9 @@
|
||||
refundTime: undefined,
|
||||
refundApplyTime: undefined,
|
||||
checkBill: undefined,
|
||||
comments: undefined,
|
||||
deleted: undefined,
|
||||
tenantId: undefined,
|
||||
orderId: undefined,
|
||||
orderName: '',
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
comments: ''
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
@@ -439,12 +455,12 @@
|
||||
images.value = [];
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if(props.data.image){
|
||||
if (props.data.image) {
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: props.data.image,
|
||||
status: 'done'
|
||||
})
|
||||
});
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
|
||||
@@ -8,13 +8,29 @@
|
||||
@search="search"
|
||||
@pressEnter="search"
|
||||
/>
|
||||
<a-button @click="getCode">生成支付二维码</a-button>
|
||||
</a-space>
|
||||
<ele-modal
|
||||
:width="500"
|
||||
:visible="showQrcode"
|
||||
:maskClosable="false"
|
||||
title="使用微信扫一扫完成支付"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@cancel="closeQrcode"
|
||||
@ok="closeQrcode"
|
||||
>
|
||||
<div class="qrcode">
|
||||
<ele-qr-code-svg v-if="text" :value="text" :size="200" />
|
||||
<div class="ele-text-secondary">使用微信扫一扫完成支付</div>
|
||||
</div>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { watch } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { OrderParam } from '@/api/shop/order/model';
|
||||
import { getNativeCode } from '@/api/system/payment';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -41,8 +57,33 @@
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
// 二维码内容
|
||||
const text = ref('');
|
||||
const showQrcode = ref(false);
|
||||
|
||||
const closeQrcode = () => {
|
||||
showQrcode.value = !showQrcode.value;
|
||||
};
|
||||
|
||||
const getCode = () => {
|
||||
getNativeCode({}).then((data) => {
|
||||
text.value = String(data);
|
||||
showQrcode.value = true;
|
||||
});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.qrcode {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 40px 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:width="1000"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
@@ -59,6 +59,25 @@
|
||||
@done="chooseShopType"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="营业时间" name="businessTime">
|
||||
<!-- <a-time-picker-->
|
||||
<!-- v-model:value="form.timePeriod1"-->
|
||||
<!-- format="HH:mm"-->
|
||||
<!-- valueFormat="HH:mm"-->
|
||||
<!-- />-->
|
||||
<!-- - -->
|
||||
<!-- <a-time-picker-->
|
||||
<!-- v-model:value="form.timePeriod2"-->
|
||||
<!-- format="HH:mm"-->
|
||||
<!-- valueFormat="HH:mm"-->
|
||||
<!-- />-->
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="100"
|
||||
placeholder="请选择营业时间"
|
||||
v-model:value="form.businessTime"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="所属行业" name="category">
|
||||
<industry-select
|
||||
v-model:value="form.category"
|
||||
@@ -93,17 +112,28 @@
|
||||
v-model:value="form.address"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="手续费(%)" name="commission">
|
||||
<a-form-item label="每小时价格" name="price">
|
||||
<a-input-number
|
||||
:step="1"
|
||||
:max="100"
|
||||
:max="1000000"
|
||||
:min="0.0"
|
||||
:precision="2"
|
||||
class="ele-fluid"
|
||||
placeholder="请输入手续费"
|
||||
v-model:value="form.commission"
|
||||
placeholder="请输入每小时价格"
|
||||
v-model:value="form.price"
|
||||
/>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="手续费(%)" name="commission">-->
|
||||
<!-- <a-input-number-->
|
||||
<!-- :step="1"-->
|
||||
<!-- :max="100"-->
|
||||
<!-- :min="0.0"-->
|
||||
<!-- :precision="2"-->
|
||||
<!-- class="ele-fluid"-->
|
||||
<!-- placeholder="请输入手续费"-->
|
||||
<!-- v-model:value="form.commission"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-form-item label="关键字" name="keywords">
|
||||
<a-select
|
||||
v-model:value="form.keywords"
|
||||
@@ -111,7 +141,7 @@
|
||||
placeholder="输入关键词后回车"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="资质图片" name="files">
|
||||
<a-form-item label="场馆图片" name="files">
|
||||
<SelectFile
|
||||
:placeholder="`请选择图片`"
|
||||
:limit="9"
|
||||
@@ -120,6 +150,17 @@
|
||||
@del="onDeleteFiles"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="场馆介绍" name="content">
|
||||
<!-- 编辑器 -->
|
||||
<tinymce-editor
|
||||
ref="editorRef"
|
||||
class="content"
|
||||
v-model:value="content"
|
||||
:disabled="disabled"
|
||||
:init="config"
|
||||
placeholder="请输入场馆介绍内容"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="是否自营" name="ownStore">
|
||||
<a-switch
|
||||
checked-children="是"
|
||||
@@ -195,6 +236,8 @@
|
||||
import { MerchantType } from '@/api/shop/merchantType/model';
|
||||
import { CenterPoint } from 'ele-admin-pro/es/ele-map-picker/types';
|
||||
import { listRoles } from '@/api/system/role';
|
||||
import TinymceEditor from '@/components/TinymceEditor/index.vue';
|
||||
import { uploadOss } from '@/api/system/file';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
@@ -223,6 +266,9 @@
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
const images = ref<ItemType[]>([]);
|
||||
const files = ref<ItemType[]>([]);
|
||||
const disabled = ref(false);
|
||||
// 编辑器内容,双向绑定
|
||||
const content = ref<any>('');
|
||||
// 是否显示地图选择弹窗
|
||||
const showMap = ref(false);
|
||||
|
||||
@@ -240,9 +286,14 @@
|
||||
region: '',
|
||||
address: '',
|
||||
lngAndLat: '',
|
||||
price: 0,
|
||||
commission: 0,
|
||||
keywords: undefined,
|
||||
files: undefined,
|
||||
businessTime: undefined,
|
||||
content: '',
|
||||
timePeriod1: undefined,
|
||||
timePeriod2: undefined,
|
||||
ownStore: undefined,
|
||||
recommend: undefined,
|
||||
goodsReview: 1,
|
||||
@@ -286,6 +337,14 @@
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
businessTime: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填营业时间',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
realName: [
|
||||
{
|
||||
required: true,
|
||||
@@ -377,6 +436,69 @@
|
||||
form.category = item[0] + '/' + item[1];
|
||||
};
|
||||
|
||||
const editorRef = ref<InstanceType<typeof TinymceEditor> | null>(null);
|
||||
const config = ref({
|
||||
height: 450,
|
||||
images_upload_handler: (blobInfo, success, error) => {
|
||||
const file = blobInfo.blob();
|
||||
const formData = new FormData();
|
||||
formData.append('file', file, file.name);
|
||||
uploadOss(file)
|
||||
.then((res) => {
|
||||
success(res.path);
|
||||
})
|
||||
.catch((msg) => {
|
||||
error(msg);
|
||||
});
|
||||
},
|
||||
// 自定义文件上传(这里使用把选择的文件转成 blob 演示)
|
||||
file_picker_callback: (callback: any, _value: any, meta: any) => {
|
||||
const input = document.createElement('input');
|
||||
input.setAttribute('type', 'file');
|
||||
// 设定文件可选类型
|
||||
if (meta.filetype === 'image') {
|
||||
input.setAttribute('accept', 'image/*');
|
||||
} else if (meta.filetype === 'media') {
|
||||
input.setAttribute('accept', 'video/*,.pdf');
|
||||
}
|
||||
input.onchange = () => {
|
||||
const file = input.files?.[0];
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
if (meta.filetype === 'media') {
|
||||
if (file.size / 1024 / 1024 > 200) {
|
||||
editorRef.value?.alert({ content: '大小不能超过 200MB' });
|
||||
return;
|
||||
}
|
||||
if (file.type.startsWith('application/pdf')) {
|
||||
uploadOss(file).then((res) => {
|
||||
const addPath = `<a href="${res.downloadUrl}" target="_blank">${res.name}</a>`;
|
||||
content.value = content.value + addPath;
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!file.type.startsWith('video/')) {
|
||||
editorRef.value?.alert({ content: '只能选择视频文件' });
|
||||
return;
|
||||
}
|
||||
uploadOss(file).then((res) => {
|
||||
callback(res.path);
|
||||
});
|
||||
}
|
||||
// const reader = new FileReader();
|
||||
// reader.onload = (e) => {
|
||||
// if (e.target?.result != null) {
|
||||
// const blob = new Blob([e.target.result], { type: file.type });
|
||||
// callback(URL.createObjectURL(blob));
|
||||
// }
|
||||
// };
|
||||
// reader.readAsArrayBuffer(file);
|
||||
};
|
||||
input.click();
|
||||
}
|
||||
});
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
@@ -391,6 +513,7 @@
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form,
|
||||
content: content.value,
|
||||
keywords: JSON.stringify(form.keywords),
|
||||
files: JSON.stringify(files.value)
|
||||
};
|
||||
@@ -416,9 +539,13 @@
|
||||
if (visible) {
|
||||
images.value = [];
|
||||
files.value = [];
|
||||
content.value = '';
|
||||
if (props.data) {
|
||||
isUpdate.value = true;
|
||||
assignObject(form, props.data);
|
||||
if (form.content) {
|
||||
content.value = form.content;
|
||||
}
|
||||
if (props.data.image) {
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
@@ -449,6 +576,7 @@
|
||||
form.tenantId = Number(localStorage.getItem('TenantId'));
|
||||
});
|
||||
} else {
|
||||
content.value = '';
|
||||
resetFields();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -58,6 +58,14 @@
|
||||
v-model:value="form.rows"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="打开方式" name="target">
|
||||
<DictSelect
|
||||
dict-code="navType"
|
||||
class="form-item"
|
||||
placeholder="请选择链接方式"
|
||||
v-model:value="form.target"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序" name="sortNumber">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
|
||||
@@ -49,6 +49,14 @@
|
||||
:predefine="predefineColors"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="打开方式" name="target">
|
||||
<DictSelect
|
||||
dict-code="navType"
|
||||
class="form-item"
|
||||
placeholder="请选择链接方式"
|
||||
v-model:value="form.target"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序" name="sortNumber">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
})
|
||||
"
|
||||
>
|
||||
<div class="user-avatar">
|
||||
<div class="user-avatar" @click.stop="onAvatar">
|
||||
<a-avatar :src="param.site_logo" :size="60" />
|
||||
<div class="user-info">
|
||||
<div class="nickname">昵称</div>
|
||||
@@ -218,7 +218,7 @@
|
||||
const { currentRoute } = useRouter();
|
||||
const { query } = unref(currentRoute);
|
||||
|
||||
import MpMenuEdit from '@/views/cms/mp-weixin/menu/components/mpMenuEdit.vue';
|
||||
import MpMenuEdit from './mpMenuEdit.vue';
|
||||
import UserCardEdit from '@/views/cms/field/components/website-field-edit.vue';
|
||||
|
||||
const prpos = withDefaults(
|
||||
@@ -286,6 +286,8 @@
|
||||
|
||||
const onShare = () => {};
|
||||
|
||||
const onAvatar = () => {};
|
||||
|
||||
const reload = () => {
|
||||
listWebsiteField({}).then((list) => {
|
||||
list.map((d) => {
|
||||
|
||||
@@ -64,41 +64,32 @@
|
||||
>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="应用类型">
|
||||
<a-space class="justify">
|
||||
<a-tag>{{ form.websiteType }}</a-tag>
|
||||
<a @click="onEdit('主体类型', 'websiteType', form.websiteType)">修改</a>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="应用类型">-->
|
||||
<!-- <a-space class="justify">-->
|
||||
<!-- <a-tag>{{ form.websiteType }}</a-tag>-->
|
||||
<!-- <a @click="onEdit('主体类型', 'websiteType', form.websiteType)">修改</a>-->
|
||||
<!-- </a-space>-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-form-item label="网站域名">
|
||||
<a-space class="justify">
|
||||
<a @click="openPreview(`${form.domain}`)">{{ form.domain }}</a>
|
||||
<a @click="onEdit('网站域名', 'domain', form.domain)">修改</a>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="模板ID">-->
|
||||
<!-- <a-space class="justify">-->
|
||||
<!-- <span>{{ form.templateId }}</span>-->
|
||||
<!-- <a @click="onEdit('模板ID', 'templateId', form.templateId)">修改</a>-->
|
||||
<!-- </a-space>-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-form-item label="租户ID">
|
||||
<span>{{ form.tenantId }}</span>
|
||||
<a-form-item label="模板ID">
|
||||
<a-space class="justify">
|
||||
<span>{{ form.templateId }}000</span>
|
||||
<a @click="onEdit('模板ID', 'templateId', form.templateId)">修改</a>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="网站状态">
|
||||
<a-tag v-if="form.status == 0" color="green">运行中</a-tag>
|
||||
<span v-if="form.status == 1" color="orange">开发中</span>
|
||||
<span v-if="form.status == 2" color="orange">维护中</span>
|
||||
<span v-if="form.status == 3" color="orange">已欠费</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="开通时间">
|
||||
<span>{{ form.createTime }}</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="到期时间">
|
||||
<span>{{ form.expirationTime }}</span>
|
||||
<a-tag v-if="form.status == 1" color="orange">开发中</a-tag>
|
||||
<a-tag v-if="form.status == 2" color="error">维护中</a-tag>
|
||||
<a-tag v-if="form.status == 3" color="error">已欠费</a-tag>
|
||||
</a-form-item>
|
||||
<a-divider style="padding-bottom: 20px" />
|
||||
<a-form-item label="办公地址">
|
||||
<a-form-item label="公司地址">
|
||||
<a-space class="justify">
|
||||
<span>{{ form.address ? form.address : '-' }}</span>
|
||||
<a @click="onEdit('企业地址', 'address', form.address)">修改</a>
|
||||
|
||||
332
src/views/system/payment/components/paymentEdit.vue
Normal file
332
src/views/system/payment/components/paymentEdit.vue
Normal file
@@ -0,0 +1,332 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑支付方式' : '添加支付方式'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
{{ form }}
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="支付方式" name="name">
|
||||
<PayMethod
|
||||
dict-code="payMethod"
|
||||
v-model:value="form.name"
|
||||
:placeholder="`选择支付方式`"
|
||||
@change="onPayMethod"
|
||||
/>
|
||||
</a-form-item>
|
||||
<!--微信支付-->
|
||||
<template v-if="form.code == 'wxPay'">
|
||||
<a-form-item label="微信商户号类型" name="wechatType">
|
||||
<a-radio-group v-model:value="form.wechatType">
|
||||
<a-radio :value="0">
|
||||
<text>普通商户</text>
|
||||
</a-radio>
|
||||
<a-radio :value="1">子商户 (服务商模式)</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item label="应用ID" name="appId" extra="微信小程序或者微信公众号的APPID,需要在哪个客户端支付就填写哪个,APP支付需要填写开放平台的应用APPID">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入应用ID"
|
||||
v-model:value="form.appId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="商户号" name="mchId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入商户号"
|
||||
v-model:value="form.mchId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="设置APIv3密钥" name="apiKey">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入设置APIv3密钥"
|
||||
v-model:value="form.apiKey"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="证书文件 (CERT)" name="apiclientCert" extra="请上传 apiclient_cert.pem 文件">
|
||||
<Upload accept=".crt" v-model:value="form.apiclientCert" />
|
||||
{{ form.apiclientCert }}
|
||||
</a-form-item>
|
||||
<a-form-item label="证书文件 (KEY)" name="apiclientKey" extra="请上传 apiclient_key.pem 文件">
|
||||
<Upload accept=".crt" v-model:value="form.apiclientKey" />
|
||||
{{ form.apiclientKey }}
|
||||
</a-form-item>
|
||||
<a-form-item label="商户证书序列号" name="merchantSerialNumber">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入商户证书序列号"
|
||||
v-model:value="form.merchantSerialNumber"
|
||||
/>
|
||||
</a-form-item>
|
||||
</template>
|
||||
|
||||
<a-form-item label="支付图标" name="image">
|
||||
<SelectFile
|
||||
:placeholder="`请选择图片`"
|
||||
:limit="1"
|
||||
:data="images"
|
||||
@done="chooseImage"
|
||||
@del="onDeleteItem"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="备注" name="comments">
|
||||
<a-textarea
|
||||
:rows="4"
|
||||
:maxlength="200"
|
||||
placeholder="请输入描述"
|
||||
v-model:value="form.comments"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序" name="sortNumber">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="9999"
|
||||
class="ele-fluid"
|
||||
placeholder="请输入排序号"
|
||||
v-model:value="form.sortNumber"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="是否启用" name="status">
|
||||
<a-switch v-model:checked="form.status" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject, uuid } from 'ele-admin-pro';
|
||||
import { addPayment, updatePayment } from '@/api/system/payment';
|
||||
import { Payment } from '@/api/system/payment/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import { FileRecord } from '@/api/system/file/model';
|
||||
import Upload from "@/components/UploadCert/index.vue";
|
||||
import { uploadFile } from "@/api/system/file";
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: Payment | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
// 表格选中数据
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
const images = ref<ItemType[]>([]);
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<Payment>({
|
||||
id: 0,
|
||||
name: undefined,
|
||||
code: '',
|
||||
image: '',
|
||||
wechatType: 0,
|
||||
appId: '',
|
||||
mchId: '',
|
||||
apiKey: '',
|
||||
apiclientCert: '',
|
||||
apiclientKey: '',
|
||||
merchantSerialNumber: '',
|
||||
comments: '',
|
||||
sortNumber: 0,
|
||||
status: undefined,
|
||||
tenantId: undefined,
|
||||
createTime: ''
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写支付方式名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
appId: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写应用ID',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
mchId: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写商户号',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
wechatType: [
|
||||
{
|
||||
required: true,
|
||||
type: 'number',
|
||||
message: '请选择商户类型',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
apiKey: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写APIv3密钥',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
// apiclientCert: [
|
||||
// {
|
||||
// required: true,
|
||||
// type: 'string',
|
||||
// message: '请上传证书文件(CERT)',
|
||||
// trigger: 'blur'
|
||||
// }
|
||||
// ],
|
||||
// apiclientKey: [
|
||||
// {
|
||||
// required: true,
|
||||
// type: 'string',
|
||||
// message: '请上传证书文件(KEY)',
|
||||
// trigger: 'blur'
|
||||
// }
|
||||
// ],
|
||||
merchantSerialNumber: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写商户证书序列号',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const chooseImage = (data: FileRecord) => {
|
||||
console.log(data);
|
||||
images.value.push({
|
||||
uid: data.id,
|
||||
url: data.thumbnail,
|
||||
status: 'done'
|
||||
});
|
||||
form.image = data.thumbnail;
|
||||
};
|
||||
|
||||
const onDeleteItem = (index: number) => {
|
||||
images.value.splice(index, 1);
|
||||
form.image = '';
|
||||
};
|
||||
|
||||
const onPayMethod = (value: string, item: any) => {
|
||||
form.name = item.label
|
||||
form.code = item.value
|
||||
}
|
||||
|
||||
const onUpload = (d: ItemType) => {
|
||||
uploadFile(<File>d.file)
|
||||
.then((result) => {
|
||||
form.image = result.path;
|
||||
message.success("上传成功");
|
||||
})
|
||||
.catch((e) => {
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updatePayment : addPayment;
|
||||
saveOrUpdate(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
images.value = [];
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if(props.data.image){
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: props.data.image,
|
||||
status: 'done'
|
||||
})
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
42
src/views/system/payment/components/search.vue
Normal file
42
src/views/system/payment/components/search.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
<span>添加</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import type { GradeParam } from '@/api/user/grade/model';
|
||||
import { watch } from 'vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: GradeParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
252
src/views/system/payment/index.vue
Normal file
252
src/views/system/payment/index.vue
Normal file
@@ -0,0 +1,252 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="ele-body">
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="id"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
<template #toolbar>
|
||||
<search
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'name'">
|
||||
<a-space class="ele-cell">
|
||||
<a-avatar :src="record.image" size="small" shape="square" />
|
||||
<span class="ele-text-secondary">{{ record.name }}</span>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-if="column.key === 'code'">
|
||||
<span class="ele-text-secondary">{{ record.code }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-switch
|
||||
v-model:checked="record.status"
|
||||
@change="updateStatus(record)"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要删除此记录吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<PaymentEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import {
|
||||
ExclamationCircleOutlined,
|
||||
WechatOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import { toDateString } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import PaymentEdit from './components/paymentEdit.vue';
|
||||
import {
|
||||
pagePayment,
|
||||
removePayment,
|
||||
removeBatchPayment,
|
||||
updatePayment
|
||||
} from '@/api/system/payment';
|
||||
import type { Payment, PaymentParam } from '@/api/system/payment/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<Payment[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<Payment | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
}
|
||||
return pagePayment({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '支付方式',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
width: 280
|
||||
},
|
||||
{
|
||||
title: '标识',
|
||||
dataIndex: 'code',
|
||||
key: 'code',
|
||||
width: 280,
|
||||
align: 'center'
|
||||
},
|
||||
// {
|
||||
// title: '商户号类型',
|
||||
// dataIndex: 'wechatType',
|
||||
// key: 'wechatType',
|
||||
// align: 'center',
|
||||
// width: 180,
|
||||
// customRender: ({ text }) => ['普通商户', '子商户'][text]
|
||||
// },
|
||||
{
|
||||
title: '是否启用',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 280,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: PaymentParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: Payment) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
const updateStatus = (item: Payment) => {
|
||||
updatePayment(item)
|
||||
.then((msg) => {
|
||||
message.success(msg);
|
||||
})
|
||||
.catch((msg) => {
|
||||
message.error(msg);
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: Payment) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removePayment(row.id)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 批量删除 */
|
||||
const removeBatch = () => {
|
||||
if (!selection.value.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选中的记录吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchPayment(selection.value.map((d) => d.id))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 查询 */
|
||||
const query = () => {
|
||||
loading.value = true;
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: Payment) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'Payment'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -54,15 +54,16 @@
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="应用状态">
|
||||
<span v-if="form.status == 0">已上线</span>
|
||||
<span v-if="form.status == 1" color="orange">开发中</span>
|
||||
<span v-if="form.status == 2" color="orange">维护中</span>
|
||||
<span v-if="form.status == 3" color="orange">已欠费</span>
|
||||
<span v-if="form.status == 0" class="ele-text-success">已上线</span>
|
||||
<span v-if="form.status == 1" class="ele-text-warning" color="orange">开发中</span>
|
||||
<span v-if="form.status == 2" class="ele-text-danger">维护中</span>
|
||||
<span v-if="form.status == 3" class="ele-text-placeholder">已欠费</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="当前版本">
|
||||
<a-space class="justify">
|
||||
<div v-if="form.version === 10">体验版(试用期1个月)</div>
|
||||
<a-tag color="green" v-if="form.version === 20">授权版</a-tag>
|
||||
<a-tag color="red" v-if="form.version === 10">体验版</a-tag>
|
||||
<a-tag color="blue" v-if="form.version === 20">授权版</a-tag>
|
||||
<a-tag color="cyan" v-if="form.version === 30">永久授权</a-tag>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="当前版本号">
|
||||
@@ -71,10 +72,10 @@
|
||||
<a @click="openUrl('/system/version')">更新</a>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="注册时间">
|
||||
<a-form-item label="开通时间">
|
||||
<span>{{ form.createTime }}</span>
|
||||
</a-form-item>
|
||||
<a-form-item label="到期时间">
|
||||
<a-form-item label="到期时间" v-if="form.version != 30">
|
||||
<span>{{ form.expirationTime }}</span>
|
||||
</a-form-item>
|
||||
<a-divider style="padding-bottom: 20px" />
|
||||
@@ -414,11 +415,12 @@ import {FileRecord} from "@/api/system/file/model";
|
||||
const query = () => {
|
||||
logo.value = [];
|
||||
getCompany().then((response) => {
|
||||
console.log(response.companyLogo);
|
||||
if (response.companyLogo) {
|
||||
logo.value.push({
|
||||
uid: 1,
|
||||
url: response.companyLogo,
|
||||
status: ''
|
||||
status: 'done'
|
||||
});
|
||||
}
|
||||
assignObject(form, response);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
:wrapper-col="styleResponsive ? { md: 9, sm: 19, xs: 24 } : { flex: '1' }"
|
||||
>
|
||||
<a-form-item label="支付方式" name="payMethod">
|
||||
<DictRadio
|
||||
<PayMethod
|
||||
dict-code="payMethod"
|
||||
v-model:value="form.payMethod"
|
||||
:placeholder="`选择支付方式`"
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
import { listSetting } from '@/api/system/setting';
|
||||
|
||||
// tab页选中
|
||||
const active = ref('upload');
|
||||
const active = ref('payment');
|
||||
|
||||
const data = ref<Setting>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user