Created
February 14, 2019 05:27
-
-
Save oomusou/85bccece851ded1b145687e3aa747411 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { pipe, gt, any, not, either, propEq } from 'ramda'; | |
import { getGetter, renderState, getState } from '@/helpers/vuex'; | |
import { paymentEnum } from '@/constant/payment-info'; | |
/** 由 [取得運費 + 應付金額] API 取得 [分期門檻] */ | |
const installmentLimit = renderState('AmountDetail', 'installmentLimit'); | |
/** 小於 [信用卡分期門檻] */ | |
const lessThanInstallmentLimit = pipe( | |
getGetter('AmountDetail', 'realAmount'), | |
gt(installmentLimit), | |
); | |
/** PaymentInfo 的 payments 天生就沒有 [信用卡分期] */ | |
const noIstallmentInPayments = pipe( | |
getState('PaymentInfo', 'payments'), | |
any(propEq('payment', paymentEnum.creditCardInstallment)), | |
not, | |
); | |
/** 小於 [信用卡分期門檻] */ | |
/** 或 */ | |
/** PaymentInfo 的 payments 天生就沒有 [信用卡分期] */ | |
/** 就顯示提示訊息 */ | |
export const isShowDesc = either( | |
lessThanInstallmentLimit, | |
noIstallmentInPayments, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment