修改删除分类弹窗

This commit is contained in:
YeMingfei666 2024-10-22 14:21:35 +08:00
parent f829c2da84
commit 40e9f10bcc
1 changed files with 55 additions and 24 deletions

View File

@ -207,14 +207,15 @@
</view>
<view class="">
<uni-forms-item label="分类名称" required name="name">
<uni-easyinput padding-none :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="categoryChild.name" placeholder="输入分类名称" />
<uni-easyinput padding-none :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="categoryChild.name" placeholder="输入分类名称" />
</uni-forms-item>
</view>
<template v-if="option.type==='edit'">
<uni-forms-item label="排序" required name="sort">
<uni-easyinput padding-none :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="categoryChild.sort" type="number" placeholder="排序越小越靠前" />
<uni-easyinput padding-none :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="categoryChild.sort" type="number"
placeholder="排序越小越靠前" />
</uni-forms-item>
</template>
<uni-forms-item label="">
@ -241,9 +242,11 @@
</view>
</template>
</my-model>
<up-modal title="提示" content="确认删除该分类吗?" :show="modal.del" showCancelButton closeOnClickOverlay
@confirm="confirmModelConfirm" @cancel="setModalShow('del',false)" @close="setModalShow('del',false)"
width="300px"></up-modal>
</view>
</template>
<script setup>
@ -269,7 +272,28 @@
onBeforeMount,
watch
} from 'vue';
const modal = reactive({
key: '',
del: false
})
function confirmModelConfirm() {
if (modal.key == 'del') {
$productCategory.del([selItem.data.id]).then(res => {
category.childrenList.splice(selItem.index, 1)
infoBox.showToast('删除成功')
uni.setStorageSync('cateItem', category)
})
modal.del=false
return
}
}
function setModalShow(key = 'show', show = true) {
modal.key = key
modal[key] = show
console.log(modal);
}
const refAddChilCate = ref(null)
const refAddChilCateTitle = ref('添加子分类')
@ -339,19 +363,21 @@
return
}
if (index === 1) {
return uni.showModal({
title: '提示',
content: '确认删除该分类吗?',
success(res) {
if (res.confirm) {
$productCategory.del([selItem.data.id]).then(res => {
category.childrenList.splice(selItem.index, 1)
infoBox.showToast('删除成功')
uni.setStorageSync('cateItem', category)
})
}
}
})
setModalShow('del', true)
return
// return uni.showModal({
// title: '',
// content: '?',
// success(res) {
// if (res.confirm) {
// $productCategory.del([selItem.data.id]).then(res => {
// category.childrenList.splice(selItem.index, 1)
// infoBox.showToast('')
// uni.setStorageSync('cateItem', category)
// })
// }
// }
// })
}
}
@ -676,13 +702,16 @@
$icon-line-width: 20rpx;
$icon-line-height: 4rpx;
@import '@/commons/style/reset-uni-form.scss';
::v-deep .uni-forms-item--border{
padding-top: 24rpx ;
padding-bottom: 24rpx ;
::v-deep .uni-forms-item--border {
padding-top: 24rpx;
padding-bottom: 24rpx;
}
::v-deep .uni-forms-item.is-direction-top .uni-forms-item__label{
::v-deep .uni-forms-item.is-direction-top .uni-forms-item__label {
padding-bottom: 16rpx;
}
.category-icon {
width: 60rpx;
height: 60rpx;
@ -697,9 +726,11 @@
.my-switch {
transform: scale(0.7);
}
::v-deep .uni-forms-item__content{
::v-deep .uni-forms-item__content {
min-height: inherit;
}
::v-deep .uni-forms-item__error {
display: none !important;
}