Commit 25a20355 by zhengxiao

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

parent 83f6b73c
......@@ -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 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 qs from 'qs'
import {Utils} from "@/Utils/Utils";
......@@ -49,6 +49,7 @@ export class Payment {
return new Promise<number|null>(async (resolve, reject) =>{
try {
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') {
this.balance = Number(res.data)
resolve(this.balance)
......@@ -62,23 +63,39 @@ export class Payment {
}
// 获取被禁止的支付方式列表
getDisabledPayMethodList():Promise<number[]> {
return new Promise<number[]>((resolve, reject) => {
resolve([])
getDisabledPayMethodList(doctorId: string | undefined):Promise<number[]> {
return new Promise<number[]>(async (resolve, reject) => {
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)
return new Promise(async (resolve, reject) => {
try {
const res = await this.getDisabledPayMethodList()
const res = await this.getDisabledPayMethodList(doctorId)
console.log("🚀 ~ file: Payment.ts:93 ~ Payment ~ returnnewPromise ~ res:", res)
// 从list中过滤出被禁止的支付方式
const filterList = List.filter(({value}) => !res.includes(value))
console.log("🚀 ~ file: Payment.ts:95 ~ Payment ~ returnnewPromise ~ filterList:", filterList)
resolve(filterList)
} catch (error) {
console.log("🚀 ~ file: Payment.ts:98 ~ Payment ~ returnnewPromise ~ error:", 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