diff --git a/src/pages/DemandNote/Create/SearchForm.js b/src/pages/DemandNote/Create/SearchForm.js
index 6b46abd..339e8c9 100644
--- a/src/pages/DemandNote/Create/SearchForm.js
+++ b/src/pages/DemandNote/Create/SearchForm.js
@@ -27,6 +27,7 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _p
const [isSuccessPopUp, setIsSuccessPopUp] = React.useState(false);
const [resultCount, setResultCount] = React.useState(0);
+ const [dnIdList, setDnIdList] = React.useState([]);
const [issueSelected, setIssueSelected] = React.useState({});
const [paymentCount, setPaymentCount] = React.useState(0);
@@ -86,6 +87,7 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _p
url: UrlUtils.DEMAND_NOTE_CREATE + "/" + issueSelected.id,
onSuccess: function (responseData) {
setResultCount(responseData.count);
+ setDnIdList(responseData.idList);
setIsSuccessPopUp(true);
}
});
@@ -95,9 +97,10 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _p
const fileDownload = () => {
HttpUtils.fileDownload({
+ method:'post',
url: UrlUtils.DEMAND_NOTE_EXPORT,
params: {
- "issueId": issueSelected.id
+ "dnIdList": dnIdList
},
onSuccess: function () {
notifyDownloadSuccess();
@@ -219,7 +222,7 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _p
-
-
-
+
);
}
diff --git a/src/pages/Payment/MultiPaymentWindow.js b/src/pages/Payment/MultiPaymentWindow.js
index 9525b53..77e3131 100644
--- a/src/pages/Payment/MultiPaymentWindow.js
+++ b/src/pages/Payment/MultiPaymentWindow.js
@@ -34,7 +34,7 @@ import FpsIcon from "assets/images/icons/fps.svg";
const MultiPaymentWindow = (props) => {
const windowTitle = "請選擇付款方式";
- const [content, setContent] = useState();
+ // const [content, setContent] = useState();
const [loadtTransactionData, setLoadtTransactionData] = useState({});
const [loadAvailableMethodData, setLoadAvailableMethodData] = useState([]);
const [paymentMethod, setPaymentMethod] = useState("");
@@ -106,110 +106,10 @@ const MultiPaymentWindow = (props) => {
props.setConfirmPayment(true);
};
- // const getMethodImgClass = (method) => () =>{
- // setPaymentMethodClass()
- // return paymentMethod == method || paymentMethod == "" ? "" : "grayscale";
- // }
-
useEffect(() => {
if(props.selectedPaymentMethod === ""){
setPaymentMethod("")
}
- if (availableMethodData.length>0){
- setContent(
-
- {/*
-
-
-
- 交易參考編號:
-
-
-
-
- {props.transactionData.transactionid}
-
-
-
-
-
-
-
-
- 付款金額:
-
-
-
-
- {"HK$ "+FormatUtils.currencyFormat(props.totalAmount)}
-
-
-
- */}
-
-
-
-
- 請選擇付款方法:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {paymentMethod !=""?
-
-
-
-
- 已選擇付款方法:
-
-
-
-
- {paymentMethod}
-
-
-
-
- : null}
-
- )
- }else{
-
-
- 付款功能現在不可用。
-
-
- }
}, [availableMethodData]);
const formik = useFormik({
@@ -256,19 +156,80 @@ const MultiPaymentWindow = (props) => {
*/}
{!props.onReady ?
- :content
+ :availableMethodData.length>0?
+
+
+
+
+
+ 請選擇付款方法:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {paymentMethod !=""?
+
+
+
+
+ 已選擇付款方法:
+
+
+
+
+ {paymentMethod}
+
+
+
+
+ : null}
+ :
+
+
+ 付款功能現在不可用。
+
+
}
-
-
- 付款總額(HK$):
+
+ 付款總額(HK$):
-
+
{" HK$ " + FormatUtils.currencyFormat(props.totalAmount)}
diff --git a/src/pages/Payment/index.js b/src/pages/Payment/index.js
index c64bf6e..fbf037d 100644
--- a/src/pages/Payment/index.js
+++ b/src/pages/Payment/index.js
@@ -47,7 +47,7 @@ const Index = () => {
const navigate = useNavigate()
const location = useLocation();
- // const local = {en:"en_us", zh:"zh_hk", cn:"zh_cn"};
+ // const local = {en:"en-us", zh:"zh-hk", cn:"zh-cn"};
const preferpaymentmethods = ['visa', 'mastercard', 'pps', 'creditcard', 'fps'];
const [totalAmount, setTotalAmount] = useState(0);
const [appIds, setAppIds] = useState([]);
@@ -169,8 +169,12 @@ const Index = () => {
let availableMethods = responseData.availablepaymentmethods;
setAvailableMethods(availableMethods);
+ },
+ onError: () =>{
+ setOnReady(true)
}
});
+
// const responseData = {
// "availablepaymentmethods": [
// {
@@ -298,25 +302,6 @@ const Index = () => {
// };
// let availableMethods = responseData.availablepaymentmethods;
// setAvailableMethods(availableMethods);
- // if (availableMethods.length>0){
- // availableMethods.forEach((method)=>{
- // if(method.subtype === "FPS" ){
- // setFPSStatus(method)
- // }else if (method.subtype === "CreditCard"){
- // method.supportedcard.forEach((supportedcard)=>{
- // if (supportedcard === "JCB" || supportedcard === "MasterCard" || supportedcard === "Visa"){
- // setCreditCardStatus(method)
- // } else {
- // if (supportedcard === "UnionPay"){
- // setUnionPayStatus(method)
- // }
- // }
- // })
- // }else if (method.subtype === "PPS" ){
- // setPPSStatus(method)
- // }
- // });
- // }
}
useEffect(() => {
diff --git a/src/utils/HttpUtils.js b/src/utils/HttpUtils.js
index 1ab55ba..4c87c38 100644
--- a/src/utils/HttpUtils.js
+++ b/src/utils/HttpUtils.js
@@ -58,35 +58,56 @@ export const postWithFiles = ({url, params, files, onSuccess, onFail, onError})
});
};
-export const fileDownload = ({url, fileId, skey, filename, onResponse, onError}) =>{
+export const fileDownload = ({url, fileId, skey, filename, params, method, onResponse, onError}) =>{
if(!url){
url = FILE_DOWN_GET+"/"+fileId+"/"+skey+"/"+filename
}
- axios.get( url,
- {
- responseType: 'blob',
- }
- ).then(
- (response)=>{
- const fn = response.headers.get("content-disposition")?.split("filename=")[1]?.split('"')[1]?.trim()??filename;
- const url = URL.createObjectURL(response.data);
- const a = document.createElement('a');
- a.href = url;
- a.setAttribute("download", fn);
- document.body.appendChild(a);
- a.click();
- document.body.removeChild(a);
- URL.revokeObjectURL(url);
- if(onResponse){
- onResponse();
+ if(method == 'post'){
+ axios.post( url, params,
+ {
+ responseType: 'blob',
+ headers:{
+ "Content-Type":"application/json"
+ }
}
- }
- ).catch(error => {
- return handleError(error,onError);
- });
-};
+ ).then(
+ (response)=>{
+ fileDownloadResponse(response, onResponse)
+ }
+ ).catch(error => {
+ return handleError(error,onError);
+ });
+ }else{
+ axios.get( url,
+ {
+ responseType: 'blob',
+ params:params
+ }
+ ).then(
+ (response)=>{
+ fileDownloadResponse(response, onResponse)
+ }
+ ).catch(error => {
+ return handleError(error,onError);
+ });
+ }
+};
+const fileDownloadResponse=(response, onResponse)=>{
+ const fn = response.headers.get("content-disposition")?.split("filename=")[1]?.split('"')[1]?.trim()??filename;
+ const url = URL.createObjectURL(response.data);
+ const a = document.createElement('a');
+ a.href = url;
+ a.setAttribute("download", fn);
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+ URL.revokeObjectURL(url);
+ if(onResponse){
+ onResponse();
+ }
+}
export const fileUpload = ({refType, refId, files, refCode, onSuccess, onFail, onError}) =>{
postWithFiles({