!78 购物车商品数量减为0时,删除错误

Merge pull request !78 from 邓飞鹏/master
pull/77/MERGE
芋道源码 2024-08-14 16:27:04 +00:00 committed by Gitee
commit c6b55dc90b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 7 additions and 1 deletions

View File

@ -57,7 +57,13 @@ const cart = defineStore({
// 移除购物车
async delete(ids) {
const { code } = await CartApi.deleteCart(ids.join(','));
let idsTemp = '';
if (Array.isArray(ids)) {
idsTemp = ids.join(',');
} else {
idsTemp = ids;
}
const { code } = await CartApi.deleteCart(idsTemp);
if (code === 0) {
await this.getList();
}