This commit is contained in:
qijq 2025-07-18 04:10:51 +08:00
parent a86973f3e0
commit 64989931cb
4 changed files with 154 additions and 147 deletions

View File

@ -231,7 +231,7 @@
} }
}, },
{ {
"path": "pages/warehouse/manage/TypeManagement", "path": "pages/warehouse/manage/typeManagement",
"style": { "style": {
"navigationBarTitleText": "类型管理" "navigationBarTitleText": "类型管理"
} }

View File

@ -963,9 +963,6 @@ export default {
font-weight: 500; font-weight: 500;
} }
.commodity-type-search-scroll {
}
.commodity-type-radio-group { .commodity-type-radio-group {
margin: 40rpx; margin: 40rpx;

View File

@ -17,6 +17,10 @@
scroll-y scroll-y
scroll-with-animation scroll-with-animation
:show-scrollbar="false" :show-scrollbar="false"
@scrolltolower="handerScrolltolower"
refresher-enabled
:refresher-triggered="isRefreshing"
@refresherrefresh="handleRefresh"
class="specification-scroll" class="specification-scroll"
> >
<view <view
@ -24,10 +28,16 @@
v-for="(item, index) of specificationList" v-for="(item, index) of specificationList"
> >
<view class="specification-info"> <view class="specification-info">
<view class="specification-name"> <view class="specification-name">{{ item.spec_name }}</view>
{{ item.spec_name }} <view class="specification-classify">
分类
{{
item.spec_category_id == 0
? "未绑定分类"
: handerCategoryName(item)
}}
</view> </view>
<view class="specification-sort">排序{{ item.spec_order }}</view> <view class="specification-sort">排序{{ item.spec_order }}</view>
</view> </view>
<view class="specification-btn-content"> <view class="specification-btn-content">
<u-icon <u-icon
@ -44,6 +54,22 @@
></u-icon> ></u-icon>
</view> </view>
</view> </view>
<view
class="m-loading-box"
v-if="specificationList.length > 0 && !isNoSpecificationData"
>
<block v-if="loadingDownSpecificationData">
<view class="u-loadmore">
<view class="u-loading"></view>
<text class="u-loadmore-tips">正在加载...</text>
</view>
</block>
<block v-else>
<view class="u-loadmore u-loadmore-line">
<text class="u-loadmore-tips">没有更多商品类型了 ~</text>
</view>
</block>
</view>
</scroll-view> </scroll-view>
</view> </view>
<view class="specification-bottom"> <view class="specification-bottom">
@ -151,107 +177,7 @@
@handerScrolltolower="handerScrolltolower" @handerScrolltolower="handerScrolltolower"
@handleRefresh="handleRefresh" @handleRefresh="handleRefresh"
></tki-tree> ></tki-tree>
<!-- <ba-tree-picker
ref="treePicker"
:multiple="false"
@select-change="selectChange"
title="选择商品分类"
:localdata="baTreePickerList"
valueKey="category_id"
textKey="category_name"
childrenKey="sub"
:selectParent="false"
/> -->
<!--商品类型弹窗-->
<!-- <u-popup
class="commodity-type-popup"
:show="showCommodityTypePopup"
mode="bottom"
zIndex="10080"
closeable
@close="handerCloseTypePopup"
>
<view class="commodity-type-popup-content">
<view class="commodity-type-popup-title">选择商品类型</view>
<view class="no-commodity-type" v-if="typeManageList.length <= 0">
<view class="no-commodity-type-bg"></view>
<view class="no-commodity-type-tips" @click="skipuBrandList">
暂无商品马上添加
<u-icon
style="display: inline-block"
name="arrow-right"
color="red"
></u-icon>
</view>
</view>
<scroll-view
v-if="typeManageList.length > 0"
scroll-y
class="commodity-type-search-scroll"
:show-scrollbar="false"
@scrolltolower="handerScrolltolower"
refresher-enabled
:refresher-triggered="isRefreshing"
@refresherrefresh="handleRefresh"
:style="{
maxHeight: typeManageList.length >= 2 ? '500px' : 'none',
overflowY: typeManageList.length >= 2 ? 'auto' : 'visible',
}"
>
<u-radio-group
class="commodity-type-radio-group"
v-model="radioValue"
placement="column"
>
<u-radio
class="commodity-type-radio"
v-for="(item, index) in typeManageList"
:key="index"
:label="item.type_name"
:name="item.type_id"
></u-radio>
</u-radio-group>
<view
class="m-loading-box"
v-if="typeManageList.length > 0 && !isNotypeManageData"
>
<block v-if="loadingDownTypeManageData">
<view class="u-loadmore">
<view class="u-loading"></view>
<text class="u-loadmore-tips">正在加载...</text>
</view>
</block>
<block v-else>
<view class="u-loadmore u-loadmore-line">
<text class="u-loadmore-tips">没有更多商品类型了 ~</text>
</view>
</block>
</view>
</scroll-view>
<view class="popup-btn-list">
<u-button
class="btn-item"
:hairline="true"
:plain="true"
shape="circle"
@click="handerCancelCommodityTpye"
>
取消
</u-button>
<u-button
v-show="typeManageList.length > 0"
class="btn-item btn-item-2"
:hairline="true"
:plain="true"
shape="circle"
@click="handerAffirmCommodityType"
>
确认
</u-button>
</view>
</view>
</u-popup> -->
<u-popup <u-popup
class="affirm-popup" class="affirm-popup"
zIndex="10077" zIndex="10077"
@ -314,7 +240,7 @@ export default {
form: { form: {
spec_name: "", spec_name: "",
spec_order: "", spec_order: "",
spec_category_id: "", spec_category_id: 0,
spec_format: "text", spec_format: "text",
spec_category_name: "", spec_category_name: "",
}, },
@ -330,6 +256,11 @@ export default {
], ],
}, },
baTreePickerList: [], baTreePickerList: [],
isRefreshing: false,
isNoSpecificationData: false,
loadingDownSpecificationData: false,
isNoDownSpecificationData: false,
time: null,
}; };
}, },
computed: {}, computed: {},
@ -380,20 +311,80 @@ export default {
let res = await GetSpecificationList(params); let res = await GetSpecificationList(params);
if (res && res.status == 200) { if (res && res.status == 200) {
if (this.loadingDownSpecificationData) {
if (res.data.items.length <= 0) {
this.loadingDownSpecificationData = false;
this.isNoDownSpecificationData = true;
} else {
this.specificationList = [
...this.specificationList,
...res.data.items,
];
}
} else {
this.specificationList = res.data.items; this.specificationList = res.data.items;
} }
if (this.specificationList.length <= 0) {
this.isNoSpecificationData = true;
}
}
this.loading = false; this.loading = false;
this.isRefreshing = false;
this.loadingDownSpecificationData = false;
},
handerScrolltolower() {
clearTimeout(this.time);
if (this.isNoDownTypeManageData) return;
this.loadingDownSpecificationData = true;
this.pageNum = this.pageNum + 1;
this.time = setTimeout(() => {
this.getSpecificationList(false);
}, 500);
},
handleRefresh() {
this.isRefreshing = true;
this.pageNum = 1;
this.getSpecificationList();
}, },
handerShowDelectPopup(item) { handerShowDelectPopup(item) {
this.currDelectItem = item; this.currDelectItem = item;
this.showDelectPopup = true; this.showDelectPopup = true;
}, },
handerCategoryName(item) {
if (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
);
return (matchedCategory && matchedCategory.category_name) || "";
}
}
},
handerShowEeditPopup(item) { handerShowEeditPopup(item) {
this.isAdd = false this.isAdd = false;
item = { item = {
spec_category_name: "", spec_category_name: "",
...item ...item,
} };
this.form = item; this.form = item;
const findCategory = (categories, targetId) => { const findCategory = (categories, targetId) => {
@ -410,15 +401,18 @@ export default {
} }
} }
return null; return null;
} };
if (this.baTreePickerList.length > 0) { if (this.baTreePickerList.length > 0) {
const matchedCategory = findCategory(this.baTreePickerList, item.spec_category_id); const matchedCategory = findCategory(
this.baTreePickerList,
item.spec_category_id
);
if (matchedCategory) { if (matchedCategory) {
this.form.spec_category_name = matchedCategory.category_name this.form.spec_category_name = matchedCategory.category_name;
} }
} }
this.showAddAndEditPopup = true this.showAddAndEditPopup = true;
}, },
hadnerShowClassifyListPopup() { hadnerShowClassifyListPopup() {
this.$refs.tkitree._show(); this.$refs.tkitree._show();
@ -428,10 +422,10 @@ export default {
this.form = { this.form = {
spec_name: "", spec_name: "",
spec_order: "", spec_order: "",
spec_category_id: "", spec_category_id: 0,
spec_format: "text", spec_format: "text",
spec_category_name: "", spec_category_name: "",
} };
this.showAddAndEditPopup = true; this.showAddAndEditPopup = true;
}, },
async handerAffirmAddAndEdit() { async handerAffirmAddAndEdit() {
@ -444,39 +438,47 @@ export default {
type: "succeed", type: "succeed",
duration: 1000, duration: 1000,
}); });
this.showAddAndEditPopup = false this.showAddAndEditPopup = false;
this.getSpecificationList(true);
if (this.isAdd) {
this.specificationList.push(this.form);
this.specificationList.sort((a, b) => a.spec_order - b.spec_order);
}
// this.specificationList =
this.form = { this.form = {
spec_name: "", spec_name: "",
spec_order: "", spec_order: "",
spec_category_id: "", spec_category_id: 0,
spec_format: "text", spec_format: "text",
spec_category_name: "", spec_category_name: "",
} };
} }
}, },
async handerDelectClassify() { async handerDelectClassify() {
let params = { let params = {
spec_ids:this.currDelectItem.spec_id spec_ids: this.currDelectItem.spec_id,
} };
let res = await DelectSpecification(params) let res = await DelectSpecification(params);
if (res && res.status == 200) { if (res && res.status == 200) {
this.$refs.uToast.show({ this.$refs.uToast.show({
message: "删除成功", message: "删除成功",
type: "succeed", type: "succeed",
duration: 1000, duration: 1000,
}); });
this.showDelectPopup = false this.showDelectPopup = false;
this.getSpecificationList() this.specificationList = this.specificationList.filter(
(item) => item.spec_id !== this.currDelectItem.spec_id
);
} }
}, },
treeCancel() { treeCancel() {
this.$refs.tkitree._hide(); this.$refs.tkitree._hide();
}, },
treeConfirm(list) { treeConfirm(list) {
console.log(this.form) console.log(this.form);
if (list.length > 1) { if (list.length > 1) {
this.form.spec_category_name = list[1].category_name; this.form.spec_category_name = list[1].category_name;
this.form.spec_category_id = list[1].category_id; this.form.spec_category_id = list[1].category_id;
@ -484,8 +486,7 @@ export default {
this.form.spec_category_name = list[0].category_name; this.form.spec_category_name = list[0].category_name;
this.form.spec_category_id = list[0].category_id; this.form.spec_category_id = list[0].category_id;
} }
},
}
}, },
}; };
</script> </script>
@ -496,7 +497,7 @@ export default {
.specification-scroll { .specification-scroll {
-ms-overflow-style: none; /* IE和Edge */ -ms-overflow-style: none; /* IE和Edge */
scrollbar-width: none; /* Firefox */ scrollbar-width: none; /* Firefox */
height: calc(100vh - 230px); height: calc(100vh - 300rpx);
} }
.specification-loading { .specification-loading {
@ -544,6 +545,12 @@ export default {
font-weight: 600; font-weight: 600;
} }
.specification-classify {
font-size: 30rpx;
margin: 16rpx 0;
color: #606060;
}
.specification-sort { .specification-sort {
font-size: 15px; font-size: 15px;
color: #606060; color: #606060;

View File

@ -24,7 +24,10 @@
</view> </view>
<view class="warehouse-item-name">规格管理</view> <view class="warehouse-item-name">规格管理</view>
</view> </view>
<view class="warehouse-item warehouse-item-2" @click="skipu('')"> <view
class="warehouse-item warehouse-item-2"
@click="skipu('typeManagement')"
>
<view class="warehouse-item-img"> <view class="warehouse-item-img">
<u--image <u--image
src="../../static/warehouse/commodity-type.png" src="../../static/warehouse/commodity-type.png"
@ -34,7 +37,7 @@
</view> </view>
<view class="warehouse-item-name">类型管理</view> <view class="warehouse-item-name">类型管理</view>
</view> </view>
<view class="warehouse-item" @click="skipu('TypeManagement')"> <view class="warehouse-item" @click="skipu('classifyList')">
<view class="warehouse-item-img"> <view class="warehouse-item-img">
<u--image <u--image
src="../../static/warehouse/classify.png" src="../../static/warehouse/classify.png"