'update'
This commit is contained in:
parent
a86973f3e0
commit
64989931cb
@ -230,8 +230,8 @@
|
||||
"navigationBarTitleText": "规格管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/warehouse/manage/TypeManagement",
|
||||
{
|
||||
"path": "pages/warehouse/manage/typeManagement",
|
||||
"style": {
|
||||
"navigationBarTitleText": "类型管理"
|
||||
}
|
||||
|
||||
@ -963,9 +963,6 @@ export default {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.commodity-type-search-scroll {
|
||||
}
|
||||
|
||||
.commodity-type-radio-group {
|
||||
margin: 40rpx;
|
||||
|
||||
|
||||
@ -17,6 +17,10 @@
|
||||
scroll-y
|
||||
scroll-with-animation
|
||||
:show-scrollbar="false"
|
||||
@scrolltolower="handerScrolltolower"
|
||||
refresher-enabled
|
||||
:refresher-triggered="isRefreshing"
|
||||
@refresherrefresh="handleRefresh"
|
||||
class="specification-scroll"
|
||||
>
|
||||
<view
|
||||
@ -24,10 +28,16 @@
|
||||
v-for="(item, index) of specificationList"
|
||||
>
|
||||
<view class="specification-info">
|
||||
<view class="specification-name">
|
||||
{{ item.spec_name }}
|
||||
<view class="specification-name">{{ item.spec_name }}</view>
|
||||
<view class="specification-classify">
|
||||
分类:
|
||||
{{
|
||||
item.spec_category_id == 0
|
||||
? "未绑定分类"
|
||||
: handerCategoryName(item)
|
||||
}}
|
||||
</view>
|
||||
<view class="specification-sort">排序{{ item.spec_order }}</view>
|
||||
<view class="specification-sort">排序:{{ item.spec_order }}</view>
|
||||
</view>
|
||||
<view class="specification-btn-content">
|
||||
<u-icon
|
||||
@ -44,6 +54,22 @@
|
||||
></u-icon>
|
||||
</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>
|
||||
</view>
|
||||
<view class="specification-bottom">
|
||||
@ -151,108 +177,8 @@
|
||||
@handerScrolltolower="handerScrolltolower"
|
||||
@handleRefresh="handleRefresh"
|
||||
></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"
|
||||
zIndex="10077"
|
||||
:show="showDelectPopup"
|
||||
@ -314,7 +240,7 @@ export default {
|
||||
form: {
|
||||
spec_name: "",
|
||||
spec_order: "",
|
||||
spec_category_id: "",
|
||||
spec_category_id: 0,
|
||||
spec_format: "text",
|
||||
spec_category_name: "",
|
||||
},
|
||||
@ -330,6 +256,11 @@ export default {
|
||||
],
|
||||
},
|
||||
baTreePickerList: [],
|
||||
isRefreshing: false,
|
||||
isNoSpecificationData: false,
|
||||
loadingDownSpecificationData: false,
|
||||
isNoDownSpecificationData: false,
|
||||
time: null,
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
@ -380,29 +311,89 @@ export default {
|
||||
|
||||
let res = await GetSpecificationList(params);
|
||||
if (res && res.status == 200) {
|
||||
this.specificationList = res.data.items;
|
||||
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;
|
||||
}
|
||||
|
||||
if (this.specificationList.length <= 0) {
|
||||
this.isNoSpecificationData = true;
|
||||
}
|
||||
}
|
||||
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) {
|
||||
this.currDelectItem = item;
|
||||
this.showDelectPopup = true;
|
||||
},
|
||||
handerShowEeditPopup(item){
|
||||
this.isAdd = false
|
||||
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) {
|
||||
this.isAdd = false;
|
||||
item = {
|
||||
spec_category_name: "",
|
||||
...item
|
||||
}
|
||||
...item,
|
||||
};
|
||||
this.form = item;
|
||||
|
||||
const findCategory = (categories, targetId) => {
|
||||
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);
|
||||
@ -410,15 +401,18 @@ export default {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if(this.baTreePickerList.length > 0){
|
||||
const matchedCategory = findCategory(this.baTreePickerList, item.spec_category_id);
|
||||
};
|
||||
|
||||
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.form.spec_category_name = matchedCategory.category_name;
|
||||
}
|
||||
}
|
||||
this.showAddAndEditPopup = true
|
||||
this.showAddAndEditPopup = true;
|
||||
},
|
||||
hadnerShowClassifyListPopup() {
|
||||
this.$refs.tkitree._show();
|
||||
@ -428,10 +422,10 @@ export default {
|
||||
this.form = {
|
||||
spec_name: "",
|
||||
spec_order: "",
|
||||
spec_category_id: "",
|
||||
spec_category_id: 0,
|
||||
spec_format: "text",
|
||||
spec_category_name: "",
|
||||
}
|
||||
};
|
||||
this.showAddAndEditPopup = true;
|
||||
},
|
||||
async handerAffirmAddAndEdit() {
|
||||
@ -444,48 +438,55 @@ export default {
|
||||
type: "succeed",
|
||||
duration: 1000,
|
||||
});
|
||||
this.showAddAndEditPopup = false
|
||||
this.getSpecificationList(true);
|
||||
this.showAddAndEditPopup = false;
|
||||
|
||||
if (this.isAdd) {
|
||||
this.specificationList.push(this.form);
|
||||
this.specificationList.sort((a, b) => a.spec_order - b.spec_order);
|
||||
}
|
||||
|
||||
// this.specificationList =
|
||||
|
||||
this.form = {
|
||||
spec_name: "",
|
||||
spec_order: "",
|
||||
spec_category_id: "",
|
||||
spec_category_id: 0,
|
||||
spec_format: "text",
|
||||
spec_category_name: "",
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
async handerDelectClassify(){
|
||||
async handerDelectClassify() {
|
||||
let params = {
|
||||
spec_ids:this.currDelectItem.spec_id
|
||||
}
|
||||
spec_ids: this.currDelectItem.spec_id,
|
||||
};
|
||||
|
||||
let res = await DelectSpecification(params)
|
||||
if(res && res.status == 200){
|
||||
let res = await DelectSpecification(params);
|
||||
if (res && res.status == 200) {
|
||||
this.$refs.uToast.show({
|
||||
message: "删除成功",
|
||||
type: "succeed",
|
||||
duration: 1000,
|
||||
});
|
||||
this.showDelectPopup = false
|
||||
this.getSpecificationList()
|
||||
this.showDelectPopup = false;
|
||||
this.specificationList = this.specificationList.filter(
|
||||
(item) => item.spec_id !== this.currDelectItem.spec_id
|
||||
);
|
||||
}
|
||||
},
|
||||
treeCancel(){
|
||||
treeCancel() {
|
||||
this.$refs.tkitree._hide();
|
||||
|
||||
},
|
||||
treeConfirm(list){
|
||||
console.log(this.form)
|
||||
if(list.length > 1){
|
||||
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{
|
||||
} else {
|
||||
this.form.spec_category_name = list[0].category_name;
|
||||
this.form.spec_category_id = list[0].category_id;
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@ -496,7 +497,7 @@ export default {
|
||||
.specification-scroll {
|
||||
-ms-overflow-style: none; /* IE和Edge */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
height: calc(100vh - 230px);
|
||||
height: calc(100vh - 300rpx);
|
||||
}
|
||||
|
||||
.specification-loading {
|
||||
@ -544,6 +545,12 @@ export default {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.specification-classify {
|
||||
font-size: 30rpx;
|
||||
margin: 16rpx 0;
|
||||
color: #606060;
|
||||
}
|
||||
|
||||
.specification-sort {
|
||||
font-size: 15px;
|
||||
color: #606060;
|
||||
|
||||
@ -24,7 +24,10 @@
|
||||
</view>
|
||||
<view class="warehouse-item-name">规格管理</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">
|
||||
<u--image
|
||||
src="../../static/warehouse/commodity-type.png"
|
||||
@ -34,7 +37,7 @@
|
||||
</view>
|
||||
<view class="warehouse-item-name">类型管理</view>
|
||||
</view>
|
||||
<view class="warehouse-item" @click="skipu('TypeManagement')">
|
||||
<view class="warehouse-item" @click="skipu('classifyList')">
|
||||
<view class="warehouse-item-img">
|
||||
<u--image
|
||||
src="../../static/warehouse/classify.png"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user