Commit b36a56e5 authored by Bill's avatar Bill

fix: 修改结算支付支付完成后无法更新状态bug

parent 1d0a1a32
......@@ -8,7 +8,8 @@ interface Iprops {
mode: 'wechat' | 'alipay'
visible: boolean,
qrcode: string,
onClose: () => void
onClose: () => void,
onOk: () => void
}
const MODE_TEXT = {
......@@ -16,17 +17,23 @@ const MODE_TEXT = {
alipay: '支付宝'
}
const QrcodeModal: React.FC<Iprops> = (props: Iprops) => {
const { mode, visible, qrcode, onClose } = props;
const { mode, visible, qrcode, onClose, onOk } = props;
const currentImage = mode === 'wechat' ? wechat : alipay;
const handleClose = () => {
onClose?.()
}
const handleOk = () => {
onOk?.();
}
return (
<Modal
visible={visible}
title={`请用${MODE_TEXT[mode]}支付`}
onCancel={handleClose}
okText="我已付款"
onOk={handleOk}
>
<div className={styles.container}>
<div className={styles.tips}>
......
......@@ -152,7 +152,7 @@ const SettlementList = () => {
/** 通联支付,短信验证码支付 */
const handleCompleteSmsCode = async (codeString: string) => {
const { code, data, message: msg } = await postPayEAccountAllInPayConfirmPay({
tradeCode: itemInfo.settlementNo,
tradeCode: `${itemInfo.settlementNo}-${randomCode}`,
verificationCode: codeString
})
if (code !== 1000) {
......@@ -168,16 +168,19 @@ const SettlementList = () => {
const channel = params.payChannel;
try {
setUniversalPayLoading(true)
const randomCodeDate = "" + new Date().valueOf()
setRandomCode(randomCodeDate);
// TODO 加一个随机数
const { data, code, message: msg } = await postSettleAccountsMemberSettlementCommunicationPay({
id: itemInfo.id,
payChannelType: params.payChannel,
settlementNo: `${itemInfo.settlementNo}-${randomCodeDate}`,
}, {ctlType: 'none'})
if (code !== 1000) {
message.error(msg);
return;
}
setRandomCode("" + new Date().valueOf());
setCurrentUniversalPay(channel as UniversalPay);
if ([UNIVERSAL_PAY_WECHAT, UNIVERSAL_PAY_ALIPAY].includes(channel)) {
message.loading({
......@@ -208,7 +211,7 @@ const SettlementList = () => {
/** 轮询接口 */
useEffect(() => {
if (modals.qrcodeModal) {
cycleStart(postSettleAccountsMemberSettlementCommunicationPayResult, { settlementNo: `${itemInfo.settlementNo}-${randomCode}` });
cycleStart(postSettleAccountsMemberSettlementCommunicationPayResult, { settlementNo: itemInfo.settlementNo });
}
}, [modals])
......@@ -231,6 +234,11 @@ const SettlementList = () => {
ref.current.reload({ ...values, startTime, endTime });
}
const handleIhadPay = () => {
handleClose('qrcodeModal');
formActions.submit();
}
return (
<PageHeaderWrapper>
<Card>
......@@ -303,6 +311,7 @@ const SettlementList = () => {
<QrcodeModal
visible={modals.qrcodeModal}
mode={currentUniversalPay === UNIVERSAL_PAY_WECHAT ? 'wechat' : 'alipay' }
onOk={handleIhadPay}
// mode={'wechat'}
qrcode={qrcodeUrl}
onClose={() => handleClose('qrcodeModal')}
......
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