修复套餐对比取消和删除混乱的bug

main
刘佳宇 1 year ago
parent a273f01a5a
commit 67c639f892

@ -11,10 +11,12 @@ import { onShow } from "@dcloudio/uni-app";
import { useStore } from "@/store";
const $store = useStore();
let comboIds = ref([]);
let comboIds = ref([]); //
let newComboIds = ref([]); //
const mountedAction = () => {
comboIds.value = $store.getComboContrast() || [];
newComboIds.value = $store.getComboContrast() || [];
getdbAxios();
};
const comboInfo = ref(false);
@ -34,7 +36,7 @@ const getdbAxios = async () => {
};
const clickdb = async () => {
$store.setComboContrast(comboIds.value);
uni.navigateTo({
uni.navigateTo({
url: "/pages/buy/contrast/contrast",
});
};
@ -47,16 +49,21 @@ const configRef = (e) => {
};
const selectClick = (id, status) => {
if (status) {
comboIds.value.splice(comboIds.value.indexOf(id), 1);
$store.setComboContrast(comboIds.value);
getdbAxios();
return
}
if (comboIds.value.includes(id)) {
comboIds.value.splice(comboIds.value.indexOf(id), 1);
console.log(comboIds.value.indexOf(id));
if (status) {
//
if (comboIds.value.indexOf(id) > -1) {
comboIds.value.splice(comboIds.value.indexOf(id), 1);
$store.setComboContrast(comboIds.value);
}
getdbAxios();
return;
}
//
if (newComboIds.value.includes(id)) {
newComboIds.value.splice(newComboIds.value.indexOf(id), 1);
} else {
comboIds.value.push(id);
newComboIds.value.push(id);
}
};
@ -83,7 +90,7 @@ onShow(() => {
<uni-icons
@click="selectClick(obj.combo_id)"
:type="
comboIds.includes(obj.combo_id) ? 'checkbox-filled' : 'circle'
newComboIds.includes(obj.combo_id) ? 'checkbox-filled' : 'circle'
"
color="#239EA3"
size="30"

Loading…
Cancel
Save