hookehuyr

fix 购物车删除选中值后处理逻辑优化

1 <!-- 1 <!--
2 * @Date: 2024-07-23 12:53:15 2 * @Date: 2024-07-23 12:53:15
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-07-27 21:00:09 4 + * @LastEditTime: 2024-07-28 00:53:21
5 * @FilePath: /temple_material_request/src/views/material_pre_request.vue 5 * @FilePath: /temple_material_request/src/views/material_pre_request.vue
6 * @Description: 待申领物资页面 6 * @Description: 待申领物资页面
7 --> 7 -->
...@@ -252,10 +252,13 @@ const onClickDel = () => { // 点击删除回调 ...@@ -252,10 +252,13 @@ const onClickDel = () => { // 点击删除回调
252 .then(async () => { 252 .then(async () => {
253 const { code, data } = await delCartAPI({ activity_id, good_ids: del_ids }); 253 const { code, data } = await delCartAPI({ activity_id, good_ids: del_ids });
254 if (code) { 254 if (code) {
255 + if (!list.value.length) {
255 // 还原列表显示 256 // 还原列表显示
256 onClickCancel(); 257 onClickCancel();
257 - // 获取购物车列表 258 + }
258 - getCartList(); 259 + // 删除del_ids
260 + list.value = list.value.filter(item => !del_ids.includes(item.good_id));
261 + sum_num.value = list.value.length;
259 // 262 //
260 showToast('删除成功'); 263 showToast('删除成功');
261 } 264 }
......