✨ feat: 对接动态商户加密类型
This commit is contained in:
parent
7e89178ff0
commit
462843304e
|
@ -1019,4 +1019,9 @@ export const notifyReseller = (data) => {
|
|||
return req("post", baseurl + "/order/notifyReseller", data)
|
||||
}
|
||||
|
||||
/* 获取商户加密类型 */
|
||||
export const getApiMode = () => {
|
||||
return req("get", baseurl + "/reseller/merchant/getApiMode")
|
||||
}
|
||||
|
||||
export { req }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { generateRsaKey, setResellMerchant } from "@/assets/api"
|
||||
import { generateRsaKey, setResellMerchant, getApiMode } from "@/assets/api"
|
||||
import FormItem from "@/components/form-item/main"
|
||||
import Form from "@/components/form/main"
|
||||
import Ipt from "@/components/input/main"
|
||||
|
@ -9,6 +9,7 @@ import "./index.less"
|
|||
export default function Merchant() {
|
||||
const [state, setState] = useState({
|
||||
loading: false,
|
||||
apiMode: [],
|
||||
reseller_id: 0 /* 分销商id */,
|
||||
merchant_id: "", //商户号 *
|
||||
pos_id: "", //平台id 目前都是单平台 *
|
||||
|
@ -45,7 +46,10 @@ export default function Merchant() {
|
|||
|
||||
useEffect(() => {
|
||||
const { merchant, id } = JSON.parse(sessionStorage.getItem("merchant"))
|
||||
setState({ ...state, reseller_id: id, ...merchant })
|
||||
/* 获取加密类型 */
|
||||
getApiMode().then(({ data }) => {
|
||||
setState({ ...state, apiMode: data, reseller_id: id, ...merchant })
|
||||
})
|
||||
}, [])
|
||||
|
||||
/* 获取密钥 */
|
||||
|
@ -130,7 +134,7 @@ export default function Merchant() {
|
|||
/>
|
||||
</FormItem>
|
||||
|
||||
{state.api_mode === 2 ? (
|
||||
{state.apiMode.filter((item) => item.key === state.api_mode)[0]?.store_id ? (
|
||||
<FormItem labelname="店铺ID" prop="store_id">
|
||||
<Ipt
|
||||
onChange={(value) => setState({ ...state, store_id: value })}
|
||||
|
@ -146,7 +150,7 @@ export default function Merchant() {
|
|||
/>
|
||||
</FormItem>
|
||||
) : null}
|
||||
{state.api_mode === 2 ? (
|
||||
{state.apiMode.filter((item) => item.key === state.api_mode)[0]?.secret_key ? (
|
||||
<FormItem labelname="SM4秘钥" prop="secret_key">
|
||||
<Ipt
|
||||
onChange={(value) => setState({ ...state, secret_key: value })}
|
||||
|
@ -234,11 +238,16 @@ export default function Merchant() {
|
|||
</FormItem>
|
||||
<FormItem labelname="对接类型" prop="api_mode">
|
||||
<RadioGroup
|
||||
onChange={({ target }) => setState({ ...state, api_mode: target.value })}
|
||||
onChange={({ target }) => {
|
||||
setState({ ...state, api_mode: target.value })
|
||||
}}
|
||||
value={state.api_mode}
|
||||
>
|
||||
<Radio value={2}>国密模式</Radio>
|
||||
<Radio value={1}>RSA模式</Radio>
|
||||
{state.apiMode.map((item) => (
|
||||
<Radio key={item.key} value={item.key}>
|
||||
{item.label}
|
||||
</Radio>
|
||||
))}
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
<FormItem labelname="订阅事件" prop="subscribe_event" required="">
|
||||
|
|
Loading…
Reference in New Issue