update 更新规格bug

This commit is contained in:
qijq 2025-07-17 16:36:58 +08:00
parent e052c52cae
commit 1b3fdbd75e
4 changed files with 163 additions and 8 deletions

View File

@ -339,7 +339,7 @@ export default {
}
.input_icon {
/deep/ .u-icon__icon {
::v-deep .u-icon__icon {
font-size: 36rpx !important;
}
}

View File

@ -496,7 +496,7 @@ export default {
}
.input_icon {
/deep/ .u-icon__icon {
::v-deep .u-icon__icon {
font-size: 36rpx !important;
}
}

View File

@ -270,7 +270,7 @@ export default {
}
.input_icon {
/deep/ .u-icon__icon {
::v-deep.u-icon__icon {
font-size: 36rpx !important;
}
}

View File

@ -108,9 +108,9 @@
></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>
<u-form-item label="分类排序" prop="category_order" class="form-item">
<u-form-item label="分类排序" prop="spec_order" class="form-item">
<u--input
v-model="form.category_order"
v-model="form.spec_order"
type="number"
placeholder="请输入商品排序"
border="none"
@ -252,6 +252,39 @@
</view>
</view>
</u-popup> -->
<u-popup
class="affirm-popup"
zIndex="10077"
:show="showDelectPopup"
mode="center"
>
<view class="affirm-popup-content">
<view class="affirm-popup-title">
确认删除"{{ currDelectItem.spec_name }}"规格?
</view>
<view class="popup-btn-list">
<u-button
class="btn-item"
:hairline="true"
:plain="true"
shape="circle"
@click="showDelectPopup = false"
>
取消
</u-button>
<u-button
class="btn-item btn-item-2"
:hairline="true"
:plain="true"
shape="circle"
@click="handerDelectClassify"
>
确认
</u-button>
</view>
</view>
</u-popup>
<u-toast ref="uToast"></u-toast>
</view>
</template>
@ -276,7 +309,6 @@ export default {
pageSize: 20,
specificationList: [],
currDelectItem: {},
currEidtItem: {},
showDelectPopup: false,
showAddAndEditPopup: false,
form: {
@ -315,7 +347,6 @@ export default {
let res = await GetCommodityClassify();
if (res && res.status == 200) {
const classifyList = res.data;
if (classifyList.length > 0) {
this.baTreePickerList = classifyList.map((item) => {
//
@ -357,11 +388,50 @@ export default {
this.currDelectItem = item;
this.showDelectPopup = true;
},
handerShowEeditPopup(item){
this.isAdd = false
item = {
spec_category_name: "",
...item
}
this.form = item;
const findCategory = (categories, targetId) => {
for (const category of categories) {
// Check current category
if (category.category_id === targetId) {
return category;
}
// Check subcategories if they exist
if (category.children && category.children.length > 0) {
const foundInSub = findCategory(category.children, targetId);
if (foundInSub) return foundInSub;
}
}
return null;
}
if(this.baTreePickerList.length > 0){
const matchedCategory = findCategory(this.baTreePickerList, item.spec_category_id);
if (matchedCategory) {
this.form.spec_category_name = matchedCategory.category_name
}
}
this.showAddAndEditPopup = true
},
hadnerShowClassifyListPopup() {
this.$refs.tkitree._show();
},
handerAddAndEditPopup(isAdd) {
this.isAdd = isAdd;
this.form = {
spec_name: "",
spec_order: "",
spec_category_id: "",
spec_format: "text",
spec_category_name: "",
}
this.showAddAndEditPopup = true;
},
async handerAffirmAddAndEdit() {
@ -374,10 +444,48 @@ export default {
type: "succeed",
duration: 1000,
});
this.showAddAndEditPopup = false
this.getSpecificationList(true);
this.form = {
spec_name: "",
spec_order: "",
spec_category_id: "",
spec_format: "text",
spec_category_name: "",
}
}
},
async handerDelectClassify(){
let params = {
spec_ids:this.currDelectItem.spec_id
}
let res = await DelectSpecification(params)
if(res && res.status == 200){
this.$refs.uToast.show({
message: "删除成功",
type: "succeed",
duration: 1000,
});
this.showDelectPopup = false
this.getSpecificationList()
}
},
treeCancel(){
this.$refs.tkitree._hide();
},
treeConfirm(list){
console.log(this.form)
if(list.length > 1){
this.form.spec_category_name = list[1].category_name;
this.form.spec_category_id = list[1].category_id;
}else{
this.form.spec_category_name = list[0].category_name;
this.form.spec_category_id = list[0].category_id;
}
}
},
};
</script>
@ -456,6 +564,53 @@ export default {
}
}
.affirm-popup {
::v-deep.u-popup__content {
border-radius: 16rpx;
}
::v-deep.u-fade-enter-to {
z-index: 10076 !important;
}
.affirm-popup-content {
width: 600rpx;
.affirm-popup-title {
padding: 40rpx;
text-align: center;
font-weight: 500;
}
.affirm-popup-tips {
padding: 0 60rpx;
font-size: 28rpx;
text-align: center;
}
.popup-btn-list {
display: flex;
margin: 50rpx;
.btn-item {
width: 46%;
height: 80rpx;
border-color: #909193;
&::after {
border: none;
}
}
.btn-item-2 {
background: $base-color;
color: #fff;
border: none;
}
}
}
}
.add-popup {
::v-deep.u-popup__content {
border-radius: 16rpx;