47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
export interface options {
|
|
label: string;
|
|
value: string | number;
|
|
[property: string]: any;
|
|
}
|
|
export interface optionObject {
|
|
[property: string]: options[];
|
|
}
|
|
const options: optionObject = {
|
|
payType: [
|
|
{ label: "现金", value: "cash" },
|
|
{ label: "微信", value: "weixin" },
|
|
{ label: "银行卡", value: "bank" },
|
|
{ label: "会员支付", value: "member-account" },
|
|
{ label: "支付宝", value: "alipay" },
|
|
{ label: "刷卡", value: "deposit" },
|
|
{ label: "挂账", value: "arrears" },
|
|
{ label: "刷卡", value: "deposit" },
|
|
{ label: "储值", value: "member-account" },
|
|
{ label: "自定义", value: "virtual" },
|
|
],
|
|
isIdeal: [
|
|
{ label: "否", value: 0 },
|
|
{ label: "是", value: 1 },
|
|
],
|
|
};
|
|
|
|
export const switchAttr = {
|
|
"active-value": 1,
|
|
"inactive-value": 0,
|
|
};
|
|
|
|
export type optionsType = string;
|
|
|
|
export function returnOptions(type: optionsType) {
|
|
return options[type];
|
|
}
|
|
|
|
export function returnOptionsLabel(optionsType: optionsType, value: string | number) {
|
|
const options = returnOptions(optionsType);
|
|
if (!options) {
|
|
return "";
|
|
}
|
|
const option = options.find((item) => item.value === value);
|
|
return option ? option.label : "";
|
|
}
|