From e51c44e71f4bce94a5274fbd2fa4d483596752ed Mon Sep 17 00:00:00 2001 From: DongZeLiang <2746733890@qq.com> Date: Tue, 9 Apr 2024 17:26:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout-shop/index.vue | 25 ++++++++---------- src/views/shopCart/detail/index.vue | 41 +++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 25 deletions(-) diff --git a/src/layout-shop/index.vue b/src/layout-shop/index.vue index 4739abf..86bad6e 100644 --- a/src/layout-shop/index.vue +++ b/src/layout-shop/index.vue @@ -2,25 +2,22 @@ - 处理中心 - - - 选项1 - 选项2 - 选项3 - - - 选项1 - 选项2 - 选项3 - - + + + 返回首页 + + + + + 我的购物车 + + 消息中心 订单管理 diff --git a/src/views/shopCart/detail/index.vue b/src/views/shopCart/detail/index.vue index a97f3b9..fb1a2d4 100644 --- a/src/views/shopCart/detail/index.vue +++ b/src/views/shopCart/detail/index.vue @@ -82,9 +82,12 @@ 全选 - 删除选中商品 + 删除选中商品 - + + 购物车内无购物商品,请先去加入购物车 + +
{{ statisticsCart.total }} 件商品,已选择 {{ statisticsCart.selectTotal }} @@ -94,7 +97,7 @@ 应付总额:¥{{ statisticsCart.actualTotal }}
- + 下单
@@ -137,12 +140,26 @@ export default { }, methods: { removeCartProject(row){ - let removeCartProjectParam = { - "projectId": row.projectId, - "projectSku": row.projectSku, - "cartInfoId": row.cartInfoId - }; - let removeCartProjectParams = [removeCartProjectParam]; + + let removeCartProjectParams = []; + if (row){ + removeCartProjectParams.push({ + "projectId": row.projectId, + "projectSku": row.projectSku, + "cartInfoId": row.cartInfoId + }); + }else { + debugger + if (this.cartProjectSelected.length === 0){ + this.$message.warning("请先选择购物车内商品") + return; + } + this.cartProjectSelected.forEach(cartInfoIsSelect => removeCartProjectParams.push({ + "projectId": cartInfoIsSelect.projectId, + "projectSku": cartInfoIsSelect.projectSku, + "cartInfoId": cartInfoIsSelect.cartInfoId + })) + } removeCartInfo(removeCartProjectParams).then(response => { this.init(); }) @@ -164,8 +181,10 @@ export default { this.cartProjectList = []; this.cartProjectSelected = [] getDetailInfo().then(response => { - this.statisticsCart = response.data.statisticsCart; - this.cartProjectList = response.data.cartSkuList; + const {data} = response; + + this.statisticsCart = data == null ? null : data.statisticsCart; + this.cartProjectList = data == null ? [] : data.cartSkuList; this.loading = true; setTimeout(this.initCartSelected, 200); })