Commit ddde3262 authored by XieZhiXiong's avatar XieZhiXiong
parents fa169a29 2ab7af3a
......@@ -81,6 +81,10 @@ const PaySettingLayout = () => {
const [isEdit, setIsEdit] = useState<boolean>(false);
const [editIndex, setEditIndex] = useState<number>(0);
// 建行支付 -> 2021-12-23新增
const [visibleBankPay, setVisibleBankPay] = useState<boolean>(false);
const [bankPayChannel, setBankPayChannel] = useState<string>('1');
const [parameterList, setParameterList] = useState<parameters[]>([]) // 商户支付参数列表
const columns: ColumnType<any>[] = [
......@@ -295,14 +299,20 @@ const PaySettingLayout = () => {
const toggle = (id: string, payType) => {
setValue({})
if (payType === 1) {
setPayChannel(id);
setVisible(true);
} else {
setPayChannelUnicom(id);
setVisibleUnicom(true)
switch (payType) {
case 1:
setPayChannel(id);
setVisible(true);
break;
case 6:
setPayChannelUnicom(id);
setVisibleUnicom(true);
break;
case 7:
setBankPayChannel(id);
setVisibleBankPay(true);
break;
}
}
const handleCancel = (payType) => {
......@@ -319,38 +329,62 @@ const PaySettingLayout = () => {
_parameters.forEach((item: any) => {
const _channels = [...item.channels]
_channels.forEach(_item => {
if (payType === 1) {
if (_item.payChannel === Number(payChannel)) {
if (isEdit) {
_item.parameters[editIndex] = format;
} else {
_item.parameters.push(format)
// if (payType === 1) {
// if (_item.payChannel === Number(payChannel)) {
// if (isEdit) {
// _item.parameters[editIndex] = format;
// } else {
// _item.parameters.push(format)
// }
// }
// } else {
// if (_item.payChannel === Number(payChannelUnicom)) {
// if (isEdit) {
// _item.parameters[editIndex] = format;
// } else {
// _item.parameters.push(format)
// }
// }
// }
switch(payType) {
case 1:
if (_item.payChannel === Number(payChannel)) {
if (isEdit) {
_item.parameters[editIndex] = format;
} else {
_item.parameters.push(format)
}
}
}
} else {
if (_item.payChannel === Number(payChannelUnicom)) {
if (isEdit) {
_item.parameters[editIndex] = format;
} else {
_item.parameters.push(format)
break;
case 6:
if (_item.payChannel === Number(payChannelUnicom)) {
if (isEdit) {
_item.parameters[editIndex] = format;
} else {
_item.parameters.push(format)
}
}
}
break;
case 7:
if (_item.payChannel === Number(bankPayChannel)) {
if (isEdit) {
_item.parameters[editIndex] = format;
} else {
_item.parameters.push(format)
}
}
break;
}
// if (_item.payChannel === Number(payChannel)) {
// if (isEdit) {
// _item.parameters[editIndex] = format;
// } else {
// _item.parameters.push(format)
// }
// }
})
})
setIsEdit(false);
setParameters(_parameters);
if (payType === 1) {
setVisible(false);
} else {
} else if (payType === 6) {
setVisibleUnicom(false)
} else {
}
}
......@@ -586,7 +620,7 @@ const PaySettingLayout = () => {
})}
</Tabs>
)}
{(item.payType !== 1 && item.payType !== 6) && (
{(item.payType !== 1 && item.payType !== 6 && item.payType !== 7) && (
<Fragment>
{item.channels.map((_item, _index) => (
<Fragment key={_item.payChannel}>
......@@ -669,6 +703,60 @@ const PaySettingLayout = () => {
})}
</Tabs>
)}
{/* 建行支付 */}
{item.payType === 7 && (
<Fragment>
{item.channels.map((_item, _index) => (
<Fragment key={_item.payChannel}>
<Form.Item
label={_item.payChannelName}
name={`payChannel_${_item.payChannel}`}
initialValue={`_${_item.payChannel}`}
>
<Radio.Group
size="small"
buttonStyle="solid"
onChange={(e) => handleRadioChang(e, item.payType)}
>
<Radio.Button value={_item.payChannel}></Radio.Button>
<Radio.Button value={`_${_item.payChannel}`}></Radio.Button>
</Radio.Group>
</Form.Item>
<Form.Item
noStyle
shouldUpdate={(prevValues, currentValues) => prevValues[`payChannel_${_item.payChannel}`] !== currentValues[`payChannel_${_item.payChannel}`]}
>
{({ getFieldValue }) => (
getFieldValue(`payChannel_${_item.payChannel}`) === 16) && (
<Fragment>
<div className={style.anchor}>{`${_item.payChannelName}支付参数配置`}{getFieldValue(`payChannel_${_item.payChannel}`) === 1 ? <span className={style.tag}>平台代收模式</span> : null}</div>
<Form.Item
wrapperCol={{ span: 24 }}
name={`payChannel_${_item.payChannel}`}
>
<Table
rowKey={(_record: any, index: any) => `table${index + 1}`}
columns={columnsUnicom}
dataSource={dataSource(item.payType, _item.payChannel)}
pagination={false}
/>
<Button
type='dashed'
block
icon={<PlusOutlined />}
style={{ marginBottom: '24px' }}
onClick={() => toggle(_item.payChannel, 7)}
>
新增参数配置
</Button>
</Form.Item>
</Fragment>
)}
</Form.Item>
</Fragment>
))}
</Fragment>
)}
</div>
</Card>
))}
......@@ -689,6 +777,14 @@ const PaySettingLayout = () => {
onConfirm={(format) => handleConfirm(format, 6)}
onCancel={() => handleCancel(6)}
/>
{/* 建行支付 */}
<ModalLayout
value={value}
visible={visibleBankPay}
payChannel={bankPayChannel}
onConfirm={(format) => handleConfirm(format, 7)}
onCancel={() => handleCancel(6)}
/>
{/* 商家支付参数 */}
<ParameterLayout
value={value}
......
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