Kaynağa Gözat

支付配置

tags/小炒逻辑变更前
gwbvipvip 2 yıl önce
ebeveyn
işleme
26af69ee99
7 değiştirilmiş dosya ile 320 ekleme ve 7 silme
  1. +7
    -0
      config/routes.js
  2. +1
    -1
      src/app.jsx
  3. +20
    -5
      src/pages/sys/org/components/CreateForm.jsx
  4. +13
    -1
      src/pages/sys/org/index.jsx
  5. +8
    -0
      src/pages/sys/org/service.js
  6. +241
    -0
      src/pages/sys/paytemplate/index.jsx
  7. +30
    -0
      src/pages/sys/paytemplate/service.js

+ 7
- 0
config/routes.js Dosyayı Görüntüle

@@ -33,6 +33,13 @@ export default [
component: './sys/company',
access: 'k2',
},
{
name: '支付配置',
icon: 'smile',
path: '/sys/paytemplate',
component: './sys/paytemplate',
access: 'k2',
},
{
name: '组织管理',
icon: 'smile',


+ 1
- 1
src/app.jsx Dosyayı Görüntüle

@@ -723,7 +723,7 @@ export async function getInitialState() {
var tempMenu = await queryMenuData();
//创建菜单
//await syncMenus(tempMenu);
if (!isDev) {
if (true) {
var data = await dymicMenus(currentUser.data.id);
tempMenu = data.data;
}


+ 20
- 5
src/pages/sys/org/components/CreateForm.jsx Dosyayı Görüntüle

@@ -59,23 +59,38 @@ const CreateForm = (props) => {
</OptGroup>
</Select>
</Form.Item>
<Form.Item label={'店铺地址'} name="store_Addr" rules={[{ required: true,max:100 }]}>
<Form.Item
name="payTemplateId"
label="支付方式"
defaultValue={props.values.payTemplateId}
>
<Select placeholder="请选择支付方式">
{
props.payTemplateList?.map(item => {
return <Option value={item.id} key={item.id}>{item.name}</Option>
})
}
</Select>
</Form.Item>
<Form.Item label={'店铺地址'} name="store_Addr" rules={[{ required: true, max: 100 }]}>
<Input placeholder="成都市武侯区桂溪街道环球中心N5-9111C" />
</Form.Item>
{/* ,pattern: /^[-\+]?\d+(\.\d+)\,[-\+]?\d+(\.\d+)$/,
message: '经纬度格式不对'} */}
<Form.Item label={'店铺坐标'} name="store_Loc" rules={[{ required: true,max:100,pattern: /^[-\+]?\d+(\.\d+)\,[-\+]?\d+(\.\d+)$/,
message: '经纬度格式不对'} ]}>
<Form.Item label={'店铺坐标'} name="store_Loc" rules={[{
required: true, max: 100, pattern: /^[-\+]?\d+(\.\d+)\,[-\+]?\d+(\.\d+)$/,
message: '经纬度格式不对'
}]}>
<Input placeholder="104.070734,30.575041" />
</Form.Item>
<Form.Item name="tel" label="电话" rules={[{ max: 20 }]}>
<Input placeholder="请输入联系电话" />
<Input placeholder="请输入联系电话" />
</Form.Item>
<Form.Item name="sort" label="排序">
<InputNumber min={1} step={1} precision={0} />
</Form.Item>
<Form.Item name="remark" label="备注">
<TextArea rows={4} rules={[{ max: 500 }]}/>
<TextArea rows={4} rules={[{ max: 500 }]} />
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit">


+ 13
- 1
src/pages/sys/org/index.jsx Dosyayı Görüntüle

@@ -5,7 +5,7 @@ import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table';
import ProDescriptions from '@ant-design/pro-descriptions';
import CreateForm from './components/CreateForm';
import { add, edit, getdetail, getlist, getpage, gettree, orgdelete } from './service';
import { add, edit, getdetail, getlist, getpage, gettree, orgdelete,getPayTemplateList } from './service';
import { history } from 'umi';
/**
* 添加节点
@@ -96,6 +96,11 @@ const TableList = () => {

const [treeData, setTreeData] = useState();
const [Pid, setKey] = useState();

const [payTemplateList, setPayTemplateList] = useState();


/** 国际化配置 */

const columns = [
@@ -199,6 +204,12 @@ const TableList = () => {
setTreeData(r.data);
});
}
function initgetPayTemplateList() {
getPayTemplateList().then((r) => {
setPayTemplateList(r.data.data);
});
}
initgetPayTemplateList();
initfranchiseeType();
}, []);
return (
@@ -296,6 +307,7 @@ const TableList = () => {
</FooterToolbar>
)}
<CreateForm
payTemplateList={payTemplateList}
treeDatas={
[
{


+ 8
- 0
src/pages/sys/org/service.js Dosyayı Görüntüle

@@ -76,3 +76,11 @@ export async function gettree(params) {
},
});
}

//获取支付配置
export function getPayTemplateList() {
return request(`/kitchen/api/paytemplate/getPayTemplatePageList`, {
method: 'post',
data: {current: 1, pageSize: 100},
});
}

+ 241
- 0
src/pages/sys/paytemplate/index.jsx Dosyayı Görüntüle

@@ -0,0 +1,241 @@
import React, { useState, useRef } from 'react';
import { PlusOutlined } from '@ant-design/icons';
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import { Drawer, Row, Col, Modal, Form, Input, Button, InputNumber, TreeSelect, Select, message } from 'antd';
import ProTable from '@ant-design/pro-table';
import Field from '@ant-design/pro-field';
import { CopyOutlined } from '@ant-design/icons';

import { useIntl, FormattedMessage } from 'umi';
import { getPayTemplatePageList, add, deletepaytemplate, update } from './service';

const PayTemplate = () => {
const actionRef = useRef();
const [currentRow, setCurrentRow] = useState({});
//drawer 显示控制
const [drawerVisible, setDrawerVisible] = useState(false);

//请求详情
const requestPayTemplate = async (fields) => {

var data = {
name: fields.name,
id: fields.id
};
var list = [];
fields.payTemplateOutDtoInfo.forEach(element => {
if (element.payType == 1) {
data.wxappId = element.appId;
data.wxid = element.id;
data.wxKey = element.key;
data.wxpId = element.pId;
data.wxpayType = 1;
data.wxprivateKey = element.privateKey;
data.wxpubLicKey = element.pubLicKey;
} else {
data.zfbappId = element.appId;
data.zfbid = element.id;
data.zfbKey = element.key;
data.zfbpId = element.pId;
data.zfbpayType = 2;
data.zfbprivateKey = element.privateKey;
data.zfbpubLicKey = element.pubLicKey;
}

});
return data;
};


const columns = [
{
title: '主键',
dataIndex: 'id',
tip: '规则名称是唯一的key',
hideInSearch: true,
hideInTable: true,
},
{
title: '名称',
dataIndex: 'name',
valueType: 'textarea',
},
{
title: '操作',
dataIndex: 'option',
valueType: 'option',
render: (_, record) => [
<a
key={record.id}
onClick={async () => {
var data = await requestPayTemplate(record);
setCurrentRow(data);
setDrawerVisible(true);
}} >
修改
</a>,
<a
key={record.id}
onClick={async () => {
var input=[record.id];
deletepaytemplate(input).then((re) => {
if (re.data) {
message.success('删除成功');
actionRef.current.reload();
} else {
message.error('删除失败');
}
});
}} >
删除
</a>
],
},
];
const intl = useIntl();
return (
<PageContainer>
<ProTable
toolBarRender={() => {
return <Button
type="primary"
key="primary1"
onClick={() => {
setCurrentRow({});
setDrawerVisible(true);

}}
>
<PlusOutlined /> 新建
</Button>
}}
headerTitle="支付配置"
actionRef={actionRef}
rowKey="id"
search={{
labelWidth: 120,
}}
request={async (params) => {
var queryData = [];
var total = 0;
await getPayTemplatePageList(JSON.stringify(params)).then((re) => {
queryData = re.data.data;
total = re.data.total;
});
return {
data: queryData,
success: true,
total: total,
};
}}
columns={columns}
pagination={{ defaultPageSize: 10 }}
/>
{/* ------------------------ */}
<Drawer
title="支付配置"
key="1"
placement="right"
size="large"
width="900"
onClose={() => {
setDrawerVisible(false);
}}
visible={drawerVisible}
destroyOnClose
>
<Form
preserve={false}
layout="horizontal"
initialValues={currentRow}
labelCol={{
span: 4,
}}
onFinish={async (value) => {
if (value.id) {
update(value).then((re) => {
if (re.data) {
message.success('修改成功');
setDrawerVisible(false);
actionRef.current.reload();
} else {
message.error('修改失败');
}
});
} else {
add(value).then((re) => {
if (re.data) {
message.success('添加成功');
setDrawerVisible(false);
actionRef.current.reload();
} else {
message.error('添加失败');
}
});

}
}}
>
<Form.Item name="id" hidden={true}>
<Input />
</Form.Item>
<Form.Item name="name" label="名称" rules={[{ required: true, max: 20 }]}>
<Input placeholder="请输入名称" />
</Form.Item>
<Row>
<Col span={11} >
<h3>微信</h3>
<Form.Item name="wxid" hidden={true}>
<Input />
</Form.Item>
<Form.Item name="wxappId" label="AppId" rules={[{ required: true, max: 255 }]}>
<Input placeholder="请输入appId" />
</Form.Item>
<Form.Item name="wxpId" tooltip="微信的MCHid" label="MchId" rules={[{ required: true, max: 255 }]}>
<Input placeholder="请输入MchId" />
</Form.Item>
<Form.Item name="wxKey" tooltip="微信的aAppKey" label="AppKey" rules={[{ required: true, max: 255 }]}>
<Input placeholder="请输入AppKey" />
</Form.Item>
<Form.Item name="wxpubLicKey" tooltip="证书 " label="证书" rules={[{ required: true, max: 255 }]}>
<Input placeholder="请输入证书" />
</Form.Item>
<Form.Item name="wxprivateKey" tooltip="密码" label="密码" rules={[{ required: true, max: 255 }]}>
<Input placeholder="请输入密码" />
</Form.Item>
</Col>
<Col span={2} ></Col>
<Col span={11} >
<h3>支付宝</h3>
<Form.Item name="zfbid" hidden={true}>
<Input />
</Form.Item>
<Form.Item name="zfbappId" label="AppId" rules={[{ required: true, max: 255 }]}>
<Input placeholder="请输入appId" />
</Form.Item>
<Form.Item name="zfbpId" tooltip="支付宝的Pid" label="PId" rules={[{ required: true, max: 255 }]}>
<Input placeholder="请输入PId" />
</Form.Item>
<Form.Item name="zfbKey" tooltip="支付宝的pk" label="PK" rules={[{ required: true, max: 255 }]}>
<Input placeholder="请输入PK" />
</Form.Item>
<Form.Item name="zfbpubLicKey" tooltip="公钥 " label="公钥" rules={[{ required: true, max: 255 }]}>
<Input placeholder="请输入公钥" />
</Form.Item>
<Form.Item name="zfbprivateKey" tooltip="私钥" label="私钥" rules={[{ required: true, max: 255 }]}>
<Input placeholder="请输入私钥" />
</Form.Item>
</Col>
</Row>
<Form.Item>
<Button type="primary" htmlType="submit">
保存
</Button>
</Form.Item>
</Form>
</Drawer>
</PageContainer>
);
};

export default PayTemplate;

+ 30
- 0
src/pages/sys/paytemplate/service.js Dosyayı Görüntüle

@@ -0,0 +1,30 @@
import { request } from 'umi';

export function getPayTemplatePageList(data) {
return request(`/kitchen/api/paytemplate/getPayTemplatePageList`, {
method: 'post',
data: data,
});
}

export function add(data) {
return request(`/kitchen/api/paytemplate/add`, {
method: 'post',
data: data,
});
}

export function deletepaytemplate(data) {
return request(`/kitchen/api/paytemplate/delete`, {
method: 'post',
data: data,
});
}

export function update(data) {
return request(`/kitchen/api/paytemplate/update`, {
method: 'post',
data: data,
});
}


Yükleniyor…
İptal
Kaydet