Commit 25a20355 by zhengxiao

feat: 新增获取禁止的支付方式的接口

parent 83f6b73c
...@@ -32,3 +32,5 @@ export const IS_PAY = `${BASE_URL_JAVA}/api/auth/Order/orderIsPay` ...@@ -32,3 +32,5 @@ export const IS_PAY = `${BASE_URL_JAVA}/api/auth/Order/orderIsPay`
export const MY_BALANCE = `${BASE_URL_JAVA}/api/auth/cashierV2/myBalance` export const MY_BALANCE = `${BASE_URL_JAVA}/api/auth/cashierV2/myBalance`
export const PAY_CHECK_INTERVAL = `${BASE_URL_JAVA}/api/pay/auth/pay/payCheckInterval` export const PAY_CHECK_INTERVAL = `${BASE_URL_JAVA}/api/pay/auth/pay/payCheckInterval`
export const GET_EXCLUDE_PAYTYPE = `${BASE_URL_JAVA}/api/auth/cashierV2/getExcludePayType`
\ No newline at end of file
import {UNIT_PAY, IS_PAY, MY_BALANCE, PAY_CHECK_INTERVAL} from "./API"; import {UNIT_PAY, IS_PAY, MY_BALANCE, PAY_CHECK_INTERVAL, GET_EXCLUDE_PAYTYPE} from "./API";
import md5 from 'blueimp-md5' import md5 from 'blueimp-md5'
import qs from 'qs' import qs from 'qs'
import {Utils} from "@/Utils/Utils"; import {Utils} from "@/Utils/Utils";
...@@ -49,6 +49,7 @@ export class Payment { ...@@ -49,6 +49,7 @@ export class Payment {
return new Promise<number|null>(async (resolve, reject) =>{ return new Promise<number|null>(async (resolve, reject) =>{
try { try {
const res = await requestForJava.get<Record<string, string>, DefaultResponse>(MY_BALANCE) const res = await requestForJava.get<Record<string, string>, DefaultResponse>(MY_BALANCE)
console.log("🚀 ~ file: Payment.ts:52 ~ Payment ~ returnnewPromise<number|null> ~ res:", res)
if (res.code === '200') { if (res.code === '200') {
this.balance = Number(res.data) this.balance = Number(res.data)
resolve(this.balance) resolve(this.balance)
...@@ -62,23 +63,39 @@ export class Payment { ...@@ -62,23 +63,39 @@ export class Payment {
} }
// 获取被禁止的支付方式列表 // 获取被禁止的支付方式列表
getDisabledPayMethodList():Promise<number[]> { getDisabledPayMethodList(doctorId: string | undefined):Promise<number[]> {
return new Promise<number[]>((resolve, reject) => { return new Promise<number[]>(async (resolve, reject) => {
resolve([]) try {
const res:any = await requestForJava.get<Record<string, string>, DefaultResponse>(GET_EXCLUDE_PAYTYPE, {
params: {
doctorId
}
})
if (res.code == 200) {
resolve(res.data)
} else {
reject()
}
} catch (error) {
reject(error)
}
}) })
} }
getPayMethodList (totalAmount:number) { getPayMethodList (totalAmount:number, doctorId?:string) {
// 计算支付方式列表 // 计算支付方式列表
const List = this.supportCombination ? this.getPayMethodListForCombination(totalAmount) : this.getPayMethodListForNotCombination(totalAmount) const List = this.supportCombination ? this.getPayMethodListForCombination(totalAmount) : this.getPayMethodListForNotCombination(totalAmount)
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
try { try {
const res = await this.getDisabledPayMethodList() const res = await this.getDisabledPayMethodList(doctorId)
console.log("🚀 ~ file: Payment.ts:93 ~ Payment ~ returnnewPromise ~ res:", res)
// 从list中过滤出被禁止的支付方式 // 从list中过滤出被禁止的支付方式
const filterList = List.filter(({value}) => !res.includes(value)) const filterList = List.filter(({value}) => !res.includes(value))
console.log("🚀 ~ file: Payment.ts:95 ~ Payment ~ returnnewPromise ~ filterList:", filterList)
resolve(filterList) resolve(filterList)
} catch (error) { } catch (error) {
console.log("🚀 ~ file: Payment.ts:98 ~ Payment ~ returnnewPromise ~ error:", error)
reject(error) reject(error)
} }
}) })
......
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