Commit 761302ab authored by tjy's avatar tjy
parents 601a0239 c44e3c3d
/*
* @Author: LeeJiancong
* @Date: 2020-08-04 15:05:52
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-04 15:49:47
*/
import { defineConfig } from 'umi';
import routes from './routes/index'
import proxy from './proxy'
......
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-08-04 16:21:48
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-07 14:03:12
* @LastEditTime: 2020-08-13 09:52:00
*/
const router = {
path: '/ruleSettingManager',
......@@ -25,7 +25,7 @@ const router = {
{
path: '/ruleSettingManager/paySetting',
name: 'paySetting',
component: '@/pages/ruleSettingManage/paySetting',
component: '@/pages/ruleSettingManage/paySetting/settingIndex',
hidePageHeader: true
}
]
......
......@@ -3,9 +3,9 @@
"scripts": {
"api": "god-ytt",
"start:analyze": "ANALYZE=1 umi dev",
"start:dev": "umi dev",
"scripts:build": "node scripts/run",
"start": "yarn scripts:build && umi dev",
"start:dev": "umi dev",
"build": "umi build",
"build:analyze": "ANALYZE=1 umi build",
"postinstall": "umi generate tmp",
......
{
"name": "god-template",
"scripts": {
"api": "god-ytt",
"start:analyze": "ANALYZE=1 umi dev",
"start:dev": "umi dev",
"scripts:build": "node scripts/run",
"start": "yarn api && yarn scripts:build && umi dev",
"build": "yarn api && yarn scripts:build && umi build",
"build:analyze": "ANALYZE=1 umi build",
"postinstall": "umi generate tmp",
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
"test": "umi-test",
"test:coverage": "umi-test --coverage"
},
"lint-staged": {
"*.{js,jsx,less,md,json}": [
"prettier --write"
],
"*.ts?(x)": [
"prettier --parser=typescript --write"
]
},
"license": "MIT",
"dependencies": {
"@ant-design/icons": "^4.2.1",
"@ant-design/pro-layout": "^5.0.12",
"@formily/antd": "^1.2.11",
"@formily/antd-components": "^1.2.11",
"@umijs/hooks": "^1.9.3",
"@umijs/preset-react": "1.x",
"@umijs/test": "^3.2.0",
"braft-editor": "^2.3.9",
"classnames": "^2.2.6",
"core-js": "^3.6.5",
"god": "0.1.17",
"lint-staged": "^10.0.7",
"mobx": "^5.15.4",
"mobx-react": "^6.2.2",
"prettier": "^1.19.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"umi": "^3.2.0",
"yorkie": "^2.0.0"
},
"devDependencies": {
"axios": "^0.19.2",
"god-yapi2ts": "^1.6.0",
"gulp": "^4.0.2",
"json2ts": "^0.0.7",
"ora": "^4.0.4"
}
}
......@@ -11,7 +11,7 @@ import RightContent from './RightContent';
import { Button } from 'antd';
import styles from './index.less';
import cx from 'classnames';
import MenuSlider from './components/menuSlider';
import MenuSlider from './components/MenuSlider';
import PageHeader from './components/PageHeader';
import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons';
import { MenuDataItem } from '@/utils/typing';
......
......@@ -143,6 +143,7 @@ const AddAtttribute: React.FC<{}> = () => {
labelAlign="left"
{...layout}
initialValues={formValue}
autoComplete="off"
>
<Row gutter={24}>
<Col span={18}>
......@@ -207,7 +208,7 @@ const AddAtttribute: React.FC<{}> = () => {
<Col span={24}>
<Form.Item name="isEmpty" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled={pageStatus === 2}>必填</Checkbox></Form.Item>
</Col>
<Col span={24}>
{/* <Col span={24}>
<Form.Item name="isImage" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled={pageStatus === 2}>上传图片</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性的属性值可以上传属性值的对应图片!">
<InfoCircleOutlined />
......@@ -218,7 +219,7 @@ const AddAtttribute: React.FC<{}> = () => {
<Tooltip title="勾选后对于此属性的属性值会将属性值添加到商品名称之后,中间以/区隔!">
<InfoCircleOutlined />
</Tooltip>
</Col>
</Col> */}
<Col span={24}>
<Form.Item name="isPrice" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled={pageStatus === 2}>价格属性</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性的每个属性值会在商品发布时按属性设置不同的价格!">
......
......@@ -15,7 +15,7 @@ import { ColumnType } from 'antd/lib/table/interface'
import { PublicApi } from '@/services/api'
const Attribute: React.FC<{}> = () => {
const ref = useRef({})
const ref = useRef<any>({})
const fetchData = (params?: any) => {
return new Promise((resolve, reject) => {
......@@ -94,15 +94,17 @@ const Attribute: React.FC<{}> = () => {
const confirm = (record: any) => {
PublicApi.postProductPlatformUpdateAttributeStatus({id: record.id, isEnable: !record.isEnable}).then(res=>{
//@ts-ignore
if(res.code===43018){
message.error(res.message)
}else{
ref.current.reload()
}
})
}
const clickDelete = (record: any) => {
PublicApi.postProductPlatformDeleteAttribute({ id: record.id }).then(res=>{
//@ts-ignore
ref.current.reload()
})
}
......@@ -122,6 +124,7 @@ const Attribute: React.FC<{}> = () => {
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
pagination={{showQuickJumper: true}}
formilyLayouts={{
justify: 'space-between'
}}
......
......@@ -89,13 +89,13 @@ const viewAtttributes: React.FC<{}> = () => {
</Col>
<Col span={18}>
<Form.Item
label='属性设置'
label='自定义显示字段'
>
<Row>
<Col span={24}>
<Form.Item name="isEmpty" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled>必填</Checkbox></Form.Item>
</Col>
<Col span={24}>
{/* <Col span={24}>
<Form.Item name="isImage" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled>上传图片</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性的属性值可以上传属性值的对应图片!">
<InfoCircleOutlined />
......@@ -106,7 +106,7 @@ const viewAtttributes: React.FC<{}> = () => {
<Tooltip title="勾选后对于此属性的属性值会将属性值添加到商品名称之后,中间以/区隔!">
<InfoCircleOutlined />
</Tooltip>
</Col>
</Col> */}
<Col span={24}>
<Form.Item name="isPrice" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled>价格属性</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性的每个属性值会在商品发布时按属性设置不同的价格!">
......
......@@ -90,6 +90,7 @@ const AddPropertyValue: React.FC<{}> = () => {
labelAlign="left"
{...layout}
initialValues={formValue}
autoComplete="off"
>
<Row gutter={24}>
<Col span={18} style={{display:'none'}}>
......
......@@ -119,7 +119,7 @@ const Products: React.FC<{}> = () => {
else if (record.status === 3)
component = (<><span className="commonStatusValid"></span>审核不通过</>)
else if (record.status === 4)
component = (<><span className="commonStatusInvalid">审核通过</span></>)
component = (<><span className="commonStatusInvalid"></span>审核通过</>)
else if (record.status === 5)
component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>)
else if (record.status === 6)
......
......@@ -95,14 +95,14 @@ const viewProducts: React.FC<{}> = () => {
key: 'status',
render: (text:any, record:any) => {
let component: ReactNode = null
if(record.status === 1)
component = (<><span className="commonStatusValid"></span>通过</>)
else if(record.status === 2)
component = (<><span className="commonStatusInvalid"></span>待提交</>)
else if(record.status === 3)
if (record.status === 1)
component = (<><span className="commonStatusStop"></span>待提交审核</>)
else if (record.status === 2)
component = (<><span className="commonStatusModify"></span>待审核</>)
else if(record.status === 4)
component = (<><span className="commonStatusStop"></span>审核不通过</>)
else if (record.status === 4)
component = (<><span className="commonStatusValid"></span>审核通过</>)
else if (record.status === 3)
component = (<><span className="commonStatusInvalid">审核不通过</span></>)
return component
}
},
......@@ -166,10 +166,10 @@ const viewProducts: React.FC<{}> = () => {
component = (<><span className="commonStatusStop"></span>待提交审核</>)
else if (status === 2)
component = (<><span className="commonStatusModify"></span>待审核</>)
else if (status === 3)
component = (<><span className="commonStatusValid"></span>审核通过</>)
else if (status === 4)
component = (<><span className="commonStatusInvalid">审核不通过</span></>)
component = (<><span className="commonStatusValid"></span>审核通过</>)
else if (status === 3)
component = (<><span className="commonStatusInvalid"></span>审核不通过</>)
}
if (status === 5)
component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>)
......@@ -178,6 +178,14 @@ const viewProducts: React.FC<{}> = () => {
return component
}
/* 品类类型&商品类型 */
//1-实物商品、2-虚拟商品、3-服务商品
const renderCustomerCategoryType = (type: number) => {
if(type === 1 ) return '实物商品'
if(type === 2 ) return '虚拟商品'
if(type === 3 ) return '服务商品'
}
/* description */
const content = <>
<Descriptions colon={true} style={{paddingLeft:128}}>
......@@ -190,7 +198,7 @@ const viewProducts: React.FC<{}> = () => {
</Descriptions.Item>
<Descriptions.Item label="审核状态">{renderStatus(productDetail?.status, 1)}</Descriptions.Item>
<Descriptions.Item label="商品状态">{renderStatus(productDetail?.status, 2)}</Descriptions.Item>
<Descriptions.Item label="商品类型"><span className="commonStatusValid"></span>实物商品</Descriptions.Item>
<Descriptions.Item label="商品类型"><span className="commonStatusValid"></span>{renderCustomerCategoryType(productDetail?.customerCategory?.type)}</Descriptions.Item>
</Descriptions>
</>
......@@ -292,7 +300,7 @@ const viewProducts: React.FC<{}> = () => {
const handleOK = () => {
checkForm.validateFields().then(values => {
console.log(values, 'value')
PublicApi.postProductCommodityCheckCommodity({ id: productDetail.id, ...values }).then(res=>{
PublicApi.postProductCommodityCheckCommodity({ id: productDetail?.id, ...values }).then(res=>{
if(res.code=1000){
handleCancel()
setDisableCheck(true)
......@@ -539,13 +547,13 @@ const viewProducts: React.FC<{}> = () => {
<p>所有属性共用商品图片(默认)</p>
</Col>
</Row>
{/* 没有价格属性默认一行直接显示图片 */}
<div className={styles.productImgBox}>
<div className={styles.imgItem}>图片</div>
<div className={styles.imgItem}>图片</div>
<div className={styles.imgItem}>图片</div>
<div className={styles.imgItem}>图片</div>
<div className={styles.imgItem}>图片</div>
<div className={styles.imgItem}>图片</div>
{
productDetail?.unitPriceAndPicList[0].commodityPic.length>0 && productDetail?.unitPriceAndPicList[0].commodityPic.map((_item, index) =>
<div key={index} className={styles.imgItem}><img className={styles.pic} src={_item} alt=""/>
</div>)
}
</div>
</> : <>
<Row>
......@@ -558,7 +566,7 @@ const viewProducts: React.FC<{}> = () => {
</Row>
<Divider />
{
attributeArrByImageRender.map((item, index) => <>
attributeArrByImageRender.map((item, index) => <div key={index}>
<Row>
<Col span={3}>
<p>属性:</p>
......@@ -570,12 +578,12 @@ const viewProducts: React.FC<{}> = () => {
<Divider />
<div className={styles.productImgBox}>
{
imageArrByImageRender.length>0 && imageArrByImageRender[index].map(_item =>
<div className={styles.imgItem}><img className={styles.pic} src={_item} alt=""/>
imageArrByImageRender.length>0 && imageArrByImageRender[index].map((_item, _index) =>
<div key={_index} className={styles.imgItem}><img className={styles.pic} src={_item} alt=""/>
</div>)
}
</div>
</>)
</div>)
}
</>
}
......@@ -583,24 +591,27 @@ const viewProducts: React.FC<{}> = () => {
</Space>
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title="商品描述">
<div className={styles.descriptionBox}>
{/* 预留 文字区块 */}
{/* <div className={styles.descriptionBox}>
<p>商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述</p>
</div>
</div> */}
{/* 视频区块 */}
<div className={styles.descriptionBox}>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
{
productDetail?.commodityRemark?.video.length>0 ? productDetail?.commodityRemark?.video.map((_item, _index)=> <div key={_index} className={styles.videoItem}>
<video src={_item} controls={true}>
您的浏览器不支持视频标签,请及时升级。
</video>
</div>) : <p>暂无数据</p>
}
</div>
{/* 图片区块 */}
<div className={styles.descriptionBox}>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
{
productDetail?.commodityRemark?.image.length>0 ? productDetail?.commodityRemark?.image.map((_item, _index)=> <div key={_index} className={styles.imgItem}>
<img src={_item} />
</div>) : <p>暂无数据</p>
}
</div>
</Card>
</Space>
......
......@@ -135,8 +135,18 @@
display: flex;
justify-content: left;
.imgItem{
width:104px;
height:104px;
width:180px;
height:180px;
margin-left: 16px;
border:1px solid rgba(235,236,240,1);
img{
width: 100%;
height: 100%;
}
}
.videoItem{
width:320px;
height:240px;
margin-left: 16px;
border:1px solid rgba(235,236,240,1);
}
......
......@@ -133,7 +133,7 @@ const Products: React.FC<{}> = () => {
else if (record.status === 3)
component = (<><span className="commonStatusValid"></span>审核不通过</>)
else if (record.status === 4)
component = (<><span className="commonStatusInvalid">审核通过</span></>)
component = (<><span className="commonStatusInvalid"></span>审核通过</>)
else if (record.status === 5)
component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>)
else if (record.status === 6)
......
......@@ -94,14 +94,14 @@ const viewProducts: React.FC<{}> = () => {
key: 'status',
render: (text:any, record:any) => {
let component: ReactNode = null
if(record.status === 1)
component = (<><span className="commonStatusValid"></span>通过</>)
else if(record.status === 2)
component = (<><span className="commonStatusInvalid"></span>待提交</>)
else if(record.status === 3)
if (record.status === 1)
component = (<><span className="commonStatusStop"></span>待提交审核</>)
else if (record.status === 2)
component = (<><span className="commonStatusModify"></span>待审核</>)
else if(record.status === 4)
component = (<><span className="commonStatusStop"></span>审核不通过</>)
else if (record.status === 4)
component = (<><span className="commonStatusValid"></span>审核通过</>)
else if (record.status === 3)
component = (<><span className="commonStatusInvalid">审核不通过</span></>)
return component
}
},
......@@ -167,10 +167,10 @@ const viewProducts: React.FC<{}> = () => {
component = (<><span className="commonStatusStop"></span>待提交审核</>)
else if (status === 2)
component = (<><span className="commonStatusModify"></span>待审核</>)
else if (status === 3)
component = (<><span className="commonStatusValid"></span>审核通过</>)
else if (status === 4)
component = (<><span className="commonStatusInvalid">审核不通过</span></>)
component = (<><span className="commonStatusValid"></span>审核通过</>)
else if (status === 3)
component = (<><span className="commonStatusInvalid"></span>审核不通过</>)
}
if (status === 5)
component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>)
......@@ -179,6 +179,14 @@ const viewProducts: React.FC<{}> = () => {
return component
}
/* 品类类型&商品类型 */
//1-实物商品、2-虚拟商品、3-服务商品
const renderCustomerCategoryType = (type: number) => {
if(type === 1 ) return '实物商品'
if(type === 2 ) return '虚拟商品'
if(type === 3 ) return '服务商品'
}
/* description */
const content = <>
<Descriptions colon={true} style={{paddingLeft:128}}>
......@@ -191,7 +199,7 @@ const viewProducts: React.FC<{}> = () => {
</Descriptions.Item>
<Descriptions.Item label="审核状态">{renderStatus(productDetail?.status, 1)}</Descriptions.Item>
<Descriptions.Item label="商品状态">{renderStatus(productDetail?.status, 2)}</Descriptions.Item>
<Descriptions.Item label="商品类型"><span className="commonStatusValid"></span>实物商品</Descriptions.Item>
<Descriptions.Item label="商品类型"><span className="commonStatusValid"></span>{renderCustomerCategoryType(productDetail?.customerCategory?.type)}</Descriptions.Item>
</Descriptions>
</>
......@@ -509,13 +517,13 @@ const viewProducts: React.FC<{}> = () => {
<p>所有属性共用商品图片(默认)</p>
</Col>
</Row>
{/* 没有价格属性默认一行直接显示图片 */}
<div className={styles.productImgBox}>
<div className={styles.imgItem}>图片</div>
<div className={styles.imgItem}>图片</div>
<div className={styles.imgItem}>图片</div>
<div className={styles.imgItem}>图片</div>
<div className={styles.imgItem}>图片</div>
<div className={styles.imgItem}>图片</div>
{
productDetail?.unitPriceAndPicList[0].commodityPic.length>0 && productDetail?.unitPriceAndPicList[0].commodityPic.map((_item, index) =>
<div key={index} className={styles.imgItem}><img className={styles.pic} src={_item} alt=""/>
</div>)
}
</div>
</> : <>
<Row>
......@@ -528,7 +536,7 @@ const viewProducts: React.FC<{}> = () => {
</Row>
<Divider />
{
attributeArrByImageRender.map((item, index) => <>
attributeArrByImageRender.map((item, index) => <div key={index}>
<Row>
<Col span={3}>
<p>属性:</p>
......@@ -540,18 +548,12 @@ const viewProducts: React.FC<{}> = () => {
<Divider />
<div className={styles.productImgBox}>
{
imageArrByImageRender.length>0 && imageArrByImageRender[index].map(_item =>
<div className={styles.imgItem}><img className={styles.pic} src={_item} alt=""/>
imageArrByImageRender.length>0 && imageArrByImageRender[index].map((_item, _index) =>
<div key={_index} className={styles.imgItem}><img className={styles.pic} src={_item} alt=""/>
</div>)
}
{/* <div className={styles.imgItem}>图片</div>
<div className={styles.imgItem}>图片</div>
<div className={styles.imgItem}>图片</div>
<div className={styles.imgItem}>图片</div>
<div className={styles.imgItem}>图片</div>
<div className={styles.imgItem}>图片</div> */}
</div>
</>)
</div>)
}
</>
}
......@@ -559,24 +561,27 @@ const viewProducts: React.FC<{}> = () => {
</Space>
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title="商品描述">
<div className={styles.descriptionBox}>
{/* 预留 文字区块 */}
{/* <div className={styles.descriptionBox}>
<p>商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述商品描述</p>
</div>
</div> */}
{/* 视频区块 */}
<div className={styles.descriptionBox}>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
{
productDetail?.commodityRemark?.video.length>0 ? productDetail?.commodityRemark?.video.map((_item, _index)=> <div key={_index} className={styles.videoItem}>
<video src={_item} controls={true}>
您的浏览器不支持视频标签,请及时升级。
</video>
</div>) : <p>暂无数据</p>
}
</div>
{/* 图片区块 */}
<div className={styles.descriptionBox}>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
<div className={styles.imgItem}>描述</div>
{
productDetail?.commodityRemark?.image.length>0 ? productDetail?.commodityRemark?.image.map((_item, _index)=> <div key={_index} className={styles.imgItem}>
<img src={_item} />
</div>) : <p>暂无数据</p>
}
</div>
</Card>
</Space>
......
......@@ -8,6 +8,7 @@ const RadioGroud = (props:any) => {
className='radio-group-box'
size="small"
defaultValue={0}
value={props.value}
buttonStyle="solid"
options={options}
optionType="button"
......
import React, { Component, useState, useEffect } from 'react';
import { Modal, Button, Form } from 'antd'
import { Modal, Button, Form,Radio } from 'antd'
import {
SchemaForm, SchemaMarkupField as Field,
createFormActions,
FormEffectHooks
} from '@formily/antd'
import { Input, Radio, FormMegaLayout } from '@formily/antd-components'
import { Input, FormMegaLayout } from '@formily/antd-components'
import { PublicApi } from '@/services/api'
export interface Params {
id?: number | string;
id?: any,
mode:number,
type?: number|string,
dialogVisible: boolean;
onCancel: Function;
onOK?: Function;
initialValues?: any;
dontReceive?: boolean; //默认展示
}
const actions = createFormActions()
const { onFieldChange$ } = FormEffectHooks
const comfirmDialog: React.FC<Params> = (props) => {
console.log(props.dialogVisible)
const handleCancel = () => {
}
const handletOk = (values: any) => {
let value = { ...values }
if(props.id){
value.type = props.id
if(props.type){
value.type = props.type
}
PublicApi.postPayCollectionParametersAdd(value).then(res => {
if (res.code === 1000) {
props.onOK()
}
})
console.log('列表',value)
props.onOK(value)
}
useEffect(() => {
......@@ -46,17 +45,18 @@ const comfirmDialog: React.FC<Params> = (props) => {
return (
<>
<Modal
title={ props.type == 0 ?'新增参数配置':'编辑参数配置'}
title={ props.mode === 0 ?'新增参数配置':'编辑参数配置'}
width={800}
visible={props.dialogVisible}
onOk={() => actions.submit()}
onCancel={() => props.onCancel()}
destroyOnClose
afterClose={() => actions.reset()}
okText='确定'
okText={`确定`}
cancelText='取消'
>
<SchemaForm
labelCol={3}
components={{
Input, Radio: Radio.Group, TextArea: Input.TextArea
......@@ -64,8 +64,9 @@ const comfirmDialog: React.FC<Params> = (props) => {
actions={actions}
effects={() => useFormEffects()}
onSubmit={(values) => handletOk(values)}
initialValues={{
}}
initialValues={
props.initialValues
}
>
<Field
name='code'
......@@ -117,7 +118,7 @@ const comfirmDialog: React.FC<Params> = (props) => {
}
comfirmDialog.defaultProps = {
dontReceive: true,
id:1 //1.支付宝 2.支付宝转账到银行卡参数配置 3.微信
type:1 //1.支付宝 2.支付宝转账到银行卡参数配置 3.微信
}
export default comfirmDialog
\ No newline at end of file
import React, { useEffect , useState,useRef } from 'react'
import {Card,Button} from 'antd'
import React, { useEffect, useState, useRef } from 'react'
import { Card, Button } from 'antd'
import { PlusOutlined, SaveOutlined } from '@ant-design/icons'
import { PageHeaderWrapper} from '@ant-design/pro-layout'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import EyePreview from '@/components/EyePreview'
import {createFormActions, FormEffectHooks,useFormEffects} from '@formily/antd'
import PayForm from '../components/PayForm'
import {TabSetting} from '../schema'
import { createFormActions, FormEffectHooks,useFormEffects } from '@formily/antd'
import PayForm from '../components/PayForm'
import Setting, { TabSetting, exportId } from '../schema'
import SettingModal from '../components/PayForm/components/settingModal'
import { PublicApi } from '@/services/api'
import {history} from 'umi'
import { action } from 'mobx'
const payActions = createFormActions()
const { onFieldValueChange$} = FormEffectHooks
const { onFieldValueChange$ } = FormEffectHooks
const PaySetting: React.FC<{}> = () => {
const ref = useRef<any>({})
const [mode, setmord] = useState<number>(0)
const [visible, setvisible] = useState<boolean>(false)
const [optionType, setoptionType] = useState(0)
const [infoData, setinfoData] = useState<any>([])
const [id, setid] = useState<any>('')
const [type, settype] = useState<any>(null)
const [tabid, settabid] = useState<any>(1)
let currentTab = exportId()
let [tabOption, settabOption] = useState({
tab: 1,
type: 1
})
const handleAddMemberBtn = (type:number) => {
setid(type)
// useEffect(() => {
// setCurrentTab(exportId())
// }, [exportId()])
const handleAddMemberBtn = (type: number) => {
settype(type)
setvisible(true)
}
const handleDeleteTable = (id:number) => {
const handleDeleteTable = (id: number) => {
}
const handleModalOK = () => {
const handleModalOK = (obj:any) => {
console.log('选项卡:',exportId(),'弹窗id:',type)
setvisible(false)
ref.current.reload()
currentTab = !exportId() ? 1: exportId()
console.log('选项卡:',exportId(),'数据',obj)
console.log(payActions.getFieldValue("payParametersListResponses1"))
if(type == 1){
let list:any = []
list.push(obj)
let old = payActions.getFieldValue("payParametersListResponses1")
// list.map(v=> v['key']= v.code)
payActions.setFieldValue("payParametersListResponses1", [...old,...list])
}
if(type == 2){
let list:any = []
list.push(obj)
let old = payActions.getFieldValue(`payParametersList${currentTab}`)
// list.map(v=> v['key']= v.code)
payActions.setFieldValue(`payParametersList${currentTab}`, [...old,...list])
}
//微信
if(type == 3){
let list:any = []
list.push(obj)
let old = payActions.getFieldValue("payParametersListResponses2")
// list.map(v=> v['key']= v.code)
payActions.setFieldValue("payParametersListResponses2", [...old,...list])
payActions.setFieldValue("payParametersListResponses2", [...old,...list])
}
// ref.current.reload()
}
const tableAddButton = <Button style={{marginBottom: 16}} block icon={<PlusOutlined/>} onClick={() =>handleAddMemberBtn(1)} type='dashed'>新增参数配置1</Button>
const tableAddButton2 = <Button style={{marginBottom: 16}} block icon={<PlusOutlined/>} onClick={() =>handleAddMemberBtn(2)} type='dashed'>新增参数配置2</Button>
const tableAddButton3 = <Button style={{marginBottom: 16}} block icon={<PlusOutlined/>} onClick={() =>handleAddMemberBtn(3)} type='dashed'>新增参数配置3</Button>
const tableAddButton = <Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(1)} type='dashed'>新增参数配置1</Button>
const tableAddButton2 = <Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(2)} type='dashed'>新增参数配置2</Button>
const tableAddButton3 = <Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(3)} type='dashed'>新增参数配置3</Button>
const tableColumns = [
{ dataIndex: 'code', title: '参数代码', align: 'center' },
{ dataIndex: 'value', align: 'center', title: '参数值', render: (_, record) => <EyePreview url={`/memberCenter/memberAbility/manage/addMember?id=${record.memberId}&preview=1`}>{_}</EyePreview> },
{ dataIndex: 'describe', title: '参数描述', align: 'center' },
{ dataIndex: 'ctl', title: '操作', align: 'center', render: (_, record) =>
<>
<Button type='link' onClick={() =>{
setvisible(true),
setoptionType(1)
}}>编辑</Button>
<Button type='link' onClick={() => handleDeleteTable(record.id)}>删除</Button>
</>
{
dataIndex: 'ctl', title: '操作', align: 'center', render: (_, record) =>
<>
<Button type='link' onClick={() => {
setvisible(true),
setoptionType(1)
}}>编辑</Button>
<Button type='link' onClick={() => handleDeleteTable(record.id)}>删除</Button>
</>
}
}
]
const cardTableColumns = [
{ dataIndex: 'code', title: '参数代码', align: 'center' },
......@@ -57,48 +100,84 @@ const PaySetting: React.FC<{}> = () => {
{ dataIndex: 'describe', title: '参数描述', align: 'center' },
{ dataIndex: 'ctl', title: '操作', align: 'center', render: (_, record) => <Button type='link' onClick={() => handleDeleteTable(record.id)}>删除</Button> }
]
useEffect(() => {
PublicApi.getPayQueryPlatformDetails().then(res => {
let list = res.data
// setinfoData(list)
console.log('当前',currentTab)
PublicApi.getPayQueryPlatformDetails({id:exportId()}).then(res => {
if(res.code === 1000){
let {id,isPitchOn,payParametersList,payParametersListResponses} = res.data
payActions.setFieldValue(`isPitchOn${id}`,isPitchOn)
payActions.setFieldValue(`payParametersList${id}`,payParametersList)
payActions.setFieldValue(`payParametersListResponses${id}`,payParametersListResponses)
}
})
return () => {
}
}, [])
const useTabEffects = () => {
// useFormEffects(($, { setFieldState }) => {
// onFieldValueChange$('PAY_TABS').subscribe(fieldState => {
// console.log(fieldState)
// })
// useFormEffects(($, { setFieldState }) => {
// onFieldValueChange$('PAY_TABS').subscribe(fieldState => {
// console.log(fieldState)
// })
// })
}
// })
}
const handleSubmit = (values) => {
console.log('当前id',currentTab)
console.log(values)
let list:any = []
let parametersList:any = [],payParametersListResponses:any = []
parametersList = payActions.getFieldValue(`payParametersList${currentTab}`)
payParametersListResponses = payActions.getFieldValue(`payParametersListResponses${currentTab}`)
if(exportId() == 1){
list = [...parametersList,...payParametersListResponses]
}else{
list = [...payParametersListResponses]
}
console.log(list)
// return
PublicApi.postPayCollectionParametersAdd({
payWayId: currentTab,
isPitchOn: values.isPitchOn,
payParameters: list
}).then(res=>{
if(res.code === 1000){
history.push('/home')
}
})
}
return (
<PageHeaderWrapper
extra={
<Button type="primary" onClick={() => payActions.submit()} icon={<SaveOutlined/>}>
<Button type="primary" onClick={() => payActions.submit()} icon={<SaveOutlined />} >
保存
</Button>
}
>
<Card>
<PayForm
expressionScope={{
tableColumns,
tableAddButton,
tableAddButton2,
tableAddButton3,
cardTableColumns,
}}
schema={TabSetting(infoData)}
actions={payActions}
schema={TabSetting()}
effects={() => useTabEffects()}
onSubmit={(values) => handleSubmit(values)}
/>
<SettingModal
id={id}
type={optionType}
mode={mode}
id={exportId()}
type={type}
dialogVisible={visible}
onCancel={() => setvisible(false)}
onOK = {() =>handleModalOK}
onOK={(list) => handleModalOK(list)}
/>
</Card>
</PageHeaderWrapper>
......
This diff is collapsed.
......@@ -2,14 +2,16 @@
* @Author: LeeJiancong
* @Date: 2020-08-06 11:12:18
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-11 20:48:22
* @LastEditTime: 2020-08-12 20:32:03
*/
import React, { Component } from 'react'
import React, { useState, useEffect } from 'react'
import { ISchema } from '@formily/antd'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { GlobalConfig } from '@/global/config'
import { AreaChartOutlined } from '@ant-design/icons'
let payType = ['', '线上支付', '线下支付', '授信额度支付', '货到付款支付']
let currentTab;
//会员支付策略
export const strategyDetailTab = (props: any, usePageStatus: any) => {
......@@ -17,7 +19,7 @@ export const strategyDetailTab = (props: any, usePageStatus: any) => {
let baseList: any = GlobalConfig.payConfig.payInitializeConfig
console.log('baseList', baseList)
let tabItem = {}, Tab1 = {},arr=[]
let tabItem = {}, Tab1 = {}, arr = []
baseList.map((item, index) => {
Tab1[`MEGA_LAYOUT_LINE${index}`] = {
type: 'Text',
......@@ -209,90 +211,106 @@ export const paySetting: ISchema = {
}
}
}
let TabID: any = 1
function getID(val?) {
TabID = val
console.log('id', TabID)
}
//会员支付参数配置
export const TabSetting = (props: any[]) => {
let list =// GlobalConfig.payConfig.payPlatformPayConfig
[{
id: 1,
isPitchOn: 1,
payType: 1,
way: "支付宝支付",
},
{
id: 2,
isPitchOn: 1,
payType: 1,
way: "微信",
},
{
id: 3,
isPitchOn: 1,
payType: 2,
way: "线上线下",
}
]
console.log('初始哈',list)
export const TabSetting = (props?: any[]) => {
let list = GlobalConfig.payConfig.payPlatformPayConfig
// [{
// id: 1,
// isPitchOn: 1,
// payType: 1,
// way: "支付宝支付",
// },
// {
// id: 2,
// isPitchOn: 1,
// payType: 1,
// way: "微信",
// },
// {
// id: 3,
// isPitchOn: 1,
// payType: 2,
// way: "线上线下",
// }
// ]
console.log('初始哈', list)
let tabItem = {}
list.forEach((v, i) => {
tabItem[`${v.id}`] = {
if (i == 0) {
currentTab = v.id
}
tabItem[`tab-${v.id}`] = {
"type": 'object',
"x-component": 'tabpane',
"x-component-props": {
tab: v.way
},
properties: {
"isPitchOn": {
type: 'RadioGroud',
title: `是否开启${v.way}`,
required: true,
"x-linkages": [
{
type: 'value:visible',
target: 'megaLayout',
"condition": "{{!!$value}}"
}
]
},
megaLayout: {
[`MeGALOYOUT`]: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
},
properties: {
"alipayTitle": {
visible: v.payType != 2,
type: 'Text',
title: <div style={{ borderLeft: '2px solid #00B37A', padding: '1px 5px' }}>{v.way}参数配置</div>,
},
"payParametersList": {
visible: v.payType != 2,
type: 'array:number',
"x-component": 'PayTable',
"x-component-props": {
rowKey: 'id',
columns: "{{tableColumns}}",
suffix: "{{tableAddButton}}"
}
},
"cardTitle": {
visible: v.payType != 2 && v.id != 2,
type: 'Text',
title: <div style={{ borderLeft: '2px solid #00B37A', padding: '1px 5px' }}>{v.way}转账到银行卡参数配置</div>,
[`isPitchOn${v.id}`]: {
type: 'RadioGroud',
title: `是否开启${v.way}`,
required: false,
"x-linkages": [
{
type: 'value:visible',
target: `megaLayout${v.id}`,
"condition": "{{!!$value}}"
}
]
},
"payParametersListResponses": {
visible: v.payType != 2 && v.id != 2,
type: 'array:number',
"x-component": 'PayTable',
[`megaLayout${v.id}`]: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
rowKey: 'id',
columns: "{{cardTableColumns}}",
suffix: "{{tableAddButton}}"
},
properties: {
"alipayTitle": {
visible: v.payType != 2,
type: 'Text',
title: <div style={{ borderLeft: '2px solid #00B37A', padding: '1px 5px' }}>{v.way}参数配置</div>,
},
[`payParametersListResponses${v.id}`]: {
visible: v.payType != 2 ,
type: 'array:number',
"x-component": 'PayTable',
"x-component-props": {
rowKey: 'code',
columns: "{{tableColumns}}",
suffix: v.id === 1 ? "{{tableAddButton}}" : "{{tableAddButton3}}"
}
},
"cardTitle": {
visible: v.payType != 2 && v.id != 2,
type: 'Text',
title: <div style={{ borderLeft: '2px solid #00B37A', padding: '1px 5px' }}>{v.way}转账到银行卡参数配置</div>,
},
[`payParametersList${v.id}`]: {
visible: v.payType != 2 && v.id != 2,
type: 'array:number',
"x-component": 'PayTable',
"x-component-props": {
rowKey: 'code',
columns: "{{cardTableColumns}}",
suffix: "{{tableAddButton2}}",
}
}
}
}
}
......@@ -322,20 +340,25 @@ export const TabSetting = (props: any[]) => {
"x-component": 'tab',
"x-component-props": {
type: 'card',
onChange: file => console.log(file),
onTabClick: file => console.log(file)
onTabClick: (tab) => {
currentTab = tab.split('-')[1]
}
},
properties: { ...tabItem }
}
}
}
console.log('结构',tabItem)
return payTabSetting
}
export const exportId = () => {
return currentTab
}
export default {
getTabId: () => getID()
}
......
......@@ -52,8 +52,8 @@ const CheckBrand: React.FC<{}> = () => {
},
{
title: '角色',
dataIndex: 'merchantRoleName',
key: 'merchantRoleName',
dataIndex: 'memberRoleName',
key: 'memberRoleName',
},
{
title: '状态',
......
......@@ -50,8 +50,8 @@ const viewBrand: React.FC<{}> = () => {
},
{
title: '角色',
dataIndex: 'merchantRoleName',
key: 'merchantRoleName',
dataIndex: 'memberRoleName',
key: 'memberRoleName',
},
{
title: '状态',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment