diff --git a/src/utils/maps/payment.ts b/src/utils/maps/payment.ts new file mode 100644 index 0000000..3324f57 --- /dev/null +++ b/src/utils/maps/payment.ts @@ -0,0 +1,14 @@ +export const paymentMethodOptions = [ + { label: '微信支付', value: 0, type: 'primary' }, + { label: '借呗支付', value: 1, type: 'success' }, + { label: '要呗支付', value: 2, type: 'info' }, + { label: '余额支付', value: 3, type: 'warning' }, +]; + +export const modeToPaymentMethodMap = { + 0: [0, 3], + 1: [0, 1], + 2: [0, 1], + 3: [0, 3], + 4: [2], +}; \ No newline at end of file diff --git a/src/views/cabinet/shop/card.vue b/src/views/cabinet/shop/card.vue index 458414e..f20d436 100644 --- a/src/views/cabinet/shop/card.vue +++ b/src/views/cabinet/shop/card.vue @@ -12,6 +12,7 @@ import View from "@iconify-icons/ep/view"; import AddFill from "@iconify-icons/ri/add-circle-line"; import ShopFormModal from "./shop-form-modal.vue"; import { useMultiTagsStoreHook } from "@/store/modules/multiTags"; +import { paymentMethodOptions, modeToPaymentMethodMap } from "@/utils/maps/payment"; const { VITE_PUBLIC_IMG_PATH: IMG_PATH } = import.meta.env; defineOptions({ @@ -87,6 +88,15 @@ function getBalanceType(enable: number): "" | "success" | "warning" | "info" | " onMounted(() => { getList(); }); + +function getPaymentMethods(mode: number): Array<{ label: string; type: string }> { + if (!mode) return []; + const methodValues = modeToPaymentMethodMap[mode] || []; + return methodValues.map(value => { + const option = paymentMethodOptions.find(item => item.value === value); + return option ? { label: option.label, type: option.type } : null; + }).filter(Boolean) as Array<{ label: string; type: string }>; +}