From a6199c779263ddf719fe71415d84a40b6d35c1de Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Fri, 16 May 2025 10:43:44 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0API=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=90=8D=E7=A7=B0=E5=92=8C=E5=8F=82=E6=95=B0=E4=BB=A5?= =?UTF-8?q?=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4=E6=80=A7=E5=92=8C=E6=B8=85?= =?UTF-8?q?=E6=99=B0=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 `addressDefault` 接口更名为 `updateDefaultAddress`,以更清晰地表达其功能 - 将 `iconId` 参数更名为 `shopIconId`,以提高代码的可读性 - 添加 `getClassify` 接口以支持获取分类功能 - 移除不必要的注释代码,保持代码简洁 --- api/model/index.js | 11 +++++++++++ pages/index/category.vue | 8 ++++---- pages_order/mine/address.vue | 2 +- pages_order/product/productList.vue | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/api/model/index.js b/api/model/index.js index 99a6565..9fe5cdc 100644 --- a/api/model/index.js +++ b/api/model/index.js @@ -16,6 +16,11 @@ const api = { url: '/index/getProductDetail', method: 'GET', }, + // 获取分类 + getClassify: { + url: '/index/getClassify', + method: 'GET', + }, // 获取商品列表 getProductList: { url: '/index/getProductList', @@ -86,6 +91,12 @@ const api = { method: 'POST', limit : 1000, }, + // 修改默认地址 + updateDefaultAddress: { + url: '/info/updateDefaultAddress', + method: 'POST', + limit : 1000, + }, // 删除地址 deleteAddress: { url: '/info/deleteAddress', diff --git a/pages/index/category.vue b/pages/index/category.vue index 1b25d49..41e1bb2 100644 --- a/pages/index/category.vue +++ b/pages/index/category.vue @@ -10,9 +10,9 @@ :barItemBadgeStyle="{right:'20px',top:'12px'}" @change="change"> - + @@ -61,7 +61,7 @@ methods: { // 获取分类列表 getCategory() { - this.$api('getIcon', res => { + this.$api('getClassify', res => { if(res.code == 200) { this.category = res.result if(this.category.length > 0) { @@ -73,7 +73,7 @@ // 获取商品列表 getProductList(shopIconId) { this.$api('getProductList', { - shopIconId: shopIconId, + shopClassId: shopIconId, pageNo: 1, pageSize: 99999 }, res => { diff --git a/pages_order/mine/address.vue b/pages_order/mine/address.vue index 8bb9c95..e92a4a9 100644 --- a/pages_order/mine/address.vue +++ b/pages_order/mine/address.vue @@ -107,7 +107,7 @@ //修改默认地址 editDefault(id) { - this.$api('addressDefault', { + this.$api('updateDefaultAddress', { id: id, }, res => { if (res.code == 200) { diff --git a/pages_order/product/productList.vue b/pages_order/product/productList.vue index d7d327f..2b3c284 100644 --- a/pages_order/product/productList.vue +++ b/pages_order/product/productList.vue @@ -27,7 +27,7 @@ onLoad({title, iconId}) { this.title = title this.iconId = iconId - this.queryParams.iconId = iconId + this.queryParams.shopIconId = iconId }, methods: {