From 6e49347de2c879873db79c9941053101f0fe8408 Mon Sep 17 00:00:00 2001 From: dzq Date: Sat, 21 Jun 2025 16:33:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=94=AF=E4=BB=98):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E6=96=B9=E5=BC=8F=E9=80=BB=E8=BE=91=E4=BB=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=BA=97=E9=93=BA=E6=A8=A1=E5=BC=8F=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增支付方式映射文件,支持根据店铺模式显示不同支付选项 重构结算组件,动态显示支持的支付方式并处理支付逻辑 在商品列表选择店铺时保存选中店铺信息 --- src/common/utils/maps/payment.ts | 14 +++ src/pages/product/ProductList.vue | 1 + src/pages/product/components/checkout.vue | 143 ++++++++++++---------- src/pinia/stores/product.ts | 9 +- 4 files changed, 99 insertions(+), 68 deletions(-) create mode 100644 src/common/utils/maps/payment.ts diff --git a/src/common/utils/maps/payment.ts b/src/common/utils/maps/payment.ts new file mode 100644 index 0000000..ff83145 --- /dev/null +++ b/src/common/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: Record = { + 0: [0], + 1: [0, 1], + 2: [0, 1], + 3: [0], + 4: [2], +}; \ No newline at end of file diff --git a/src/pages/product/ProductList.vue b/src/pages/product/ProductList.vue index 16998e1..baf9339 100644 --- a/src/pages/product/ProductList.vue +++ b/src/pages/product/ProductList.vue @@ -61,6 +61,7 @@ const showAb98BindPopup = ref(false); function handleShopSelect(selectedShopId: number) { shopId.value = selectedShopId; showShopList.value = false; + productStore.setSelectedShop(shopList.value.find(shop => shop.shopId === selectedShopId)!); productStore.getGoods(selectedShopId); cartStore.clearCart(); activeCategory.value = 0; diff --git a/src/pages/product/components/checkout.vue b/src/pages/product/components/checkout.vue index aa9c572..d2c1b0f 100644 --- a/src/pages/product/components/checkout.vue +++ b/src/pages/product/components/checkout.vue @@ -1,25 +1,42 @@