修复商品管理页累加问题和修复批量管理手风琴无法收缩问题
This commit is contained in:
parent
3e41a5450f
commit
2609b97724
@ -87,7 +87,7 @@
|
|||||||
commodityList.length > 0 &&
|
commodityList.length > 0 &&
|
||||||
!loadingCommodityData &&
|
!loadingCommodityData &&
|
||||||
tabbar.length > 0 &&
|
tabbar.length > 0 &&
|
||||||
tabbar[current].children.length > 0
|
tabbar[collApseIndex].children.length > 0
|
||||||
"
|
"
|
||||||
class="checkbox-all"
|
class="checkbox-all"
|
||||||
@click="handleSelectAll(null, true)"
|
@click="handleSelectAll(null, true)"
|
||||||
@ -95,7 +95,8 @@
|
|||||||
<u-checkbox-group
|
<u-checkbox-group
|
||||||
class="commodity-list"
|
class="commodity-list"
|
||||||
v-model="
|
v-model="
|
||||||
tabbar[current].children[currTabChildrenIndex].checkboxAllList
|
tabbar[collApseIndex].children[currTabChildrenIndex]
|
||||||
|
.checkboxAllList
|
||||||
"
|
"
|
||||||
placement="column"
|
placement="column"
|
||||||
@change="handleSelectAll($event, true)"
|
@change="handleSelectAll($event, true)"
|
||||||
@ -107,7 +108,7 @@
|
|||||||
</u-checkbox-group>
|
</u-checkbox-group>
|
||||||
<view class="checkbox-all-name">
|
<view class="checkbox-all-name">
|
||||||
已勾选{{
|
已勾选{{
|
||||||
tabbar[current].children[currTabChildrenIndex].checkboxList
|
tabbar[collApseIndex].children[currTabChildrenIndex].checkboxList
|
||||||
.length
|
.length
|
||||||
}}个
|
}}个
|
||||||
</view>
|
</view>
|
||||||
@ -118,14 +119,14 @@
|
|||||||
commodityList.length > 0 &&
|
commodityList.length > 0 &&
|
||||||
!loadingCommodityData &&
|
!loadingCommodityData &&
|
||||||
tabbar.length > 0 &&
|
tabbar.length > 0 &&
|
||||||
tabbar[current].children.length <= 0
|
tabbar[collApseIndex].children.length <= 0
|
||||||
"
|
"
|
||||||
class="checkbox-all"
|
class="checkbox-all"
|
||||||
@click="handleSelectAll(null, false)"
|
@click="handleSelectAll(null, false)"
|
||||||
>
|
>
|
||||||
<u-checkbox-group
|
<u-checkbox-group
|
||||||
class="commodity-list"
|
class="commodity-list"
|
||||||
v-model="tabbar[current].checkboxAllList"
|
v-model="tabbar[collApseIndex].checkboxAllList"
|
||||||
placement="column"
|
placement="column"
|
||||||
@change="handleSelectAll($event, false)"
|
@change="handleSelectAll($event, false)"
|
||||||
>
|
>
|
||||||
@ -135,7 +136,7 @@
|
|||||||
></u-checkbox>
|
></u-checkbox>
|
||||||
</u-checkbox-group>
|
</u-checkbox-group>
|
||||||
<view class="checkbox-all-name">
|
<view class="checkbox-all-name">
|
||||||
已勾选{{ tabbar[current].checkboxList.length }}个
|
已勾选{{ tabbar[collApseIndex].checkboxList.length }}个
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<favorite-loading
|
<favorite-loading
|
||||||
@ -164,10 +165,10 @@
|
|||||||
>
|
>
|
||||||
<!-- 有子集 - 单个选择 -->
|
<!-- 有子集 - 单个选择 -->
|
||||||
<u-checkbox-group
|
<u-checkbox-group
|
||||||
v-if="tabbar[current].children.length > 0"
|
v-if="tabbar[collApseIndex].children.length > 0"
|
||||||
class="commodity-list"
|
class="commodity-list"
|
||||||
v-model="
|
v-model="
|
||||||
tabbar[current].children[currTabChildrenIndex].checkboxList
|
tabbar[collApseIndex].children[currTabChildrenIndex].checkboxList
|
||||||
"
|
"
|
||||||
placement="column"
|
placement="column"
|
||||||
@change="handleSingleCheckboxChange($event, true)"
|
@change="handleSingleCheckboxChange($event, true)"
|
||||||
@ -214,9 +215,12 @@
|
|||||||
</u-checkbox-group>
|
</u-checkbox-group>
|
||||||
<!-- 无子集 - 单个选择 -->
|
<!-- 无子集 - 单个选择 -->
|
||||||
<u-checkbox-group
|
<u-checkbox-group
|
||||||
v-if="tabbar[current].children.length <= 0"
|
v-if="
|
||||||
|
tabbar[collApseIndex] &&
|
||||||
|
tabbar[collApseIndex].children.length <= 0
|
||||||
|
"
|
||||||
class="commodity-list"
|
class="commodity-list"
|
||||||
v-model="tabbar[current].checkboxList"
|
v-model="tabbar[collApseIndex].checkboxList"
|
||||||
placement="column"
|
placement="column"
|
||||||
@change="handleSingleCheckboxChange($event, false)"
|
@change="handleSingleCheckboxChange($event, false)"
|
||||||
>
|
>
|
||||||
@ -812,10 +816,10 @@ export default {
|
|||||||
if (!selectedIdsInCurrentPage.length) return;
|
if (!selectedIdsInCurrentPage.length) return;
|
||||||
|
|
||||||
// 根据是否有子分类决定操作哪个数据
|
// 根据是否有子分类决定操作哪个数据
|
||||||
const hasChildren = this.tabbar[this.current]?.children?.length > 0;
|
const hasChildren = this.tabbar[this.collApseIndex]?.children?.length > 0;
|
||||||
const targetData = hasChildren
|
const targetData = hasChildren
|
||||||
? this.tabbar[this.current].children[this.currTabChildrenIndex]
|
? this.tabbar[this.collApseIndex].children[this.currTabChildrenIndex]
|
||||||
: this.tabbar[this.current];
|
: this.tabbar[this.collApseIndex];
|
||||||
|
|
||||||
if (!targetData) return;
|
if (!targetData) return;
|
||||||
|
|
||||||
@ -918,12 +922,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handerScrolltolower() {
|
handerScrolltolower() {
|
||||||
if (this.tabbar[this.current].children.length > 0) {
|
if (this.tabbar[this.collApseIndex].children.length > 0) {
|
||||||
this.tabbar[this.current].children[
|
this.tabbar[this.collApseIndex].children[
|
||||||
this.currTabChildrenIndex
|
this.currTabChildrenIndex
|
||||||
].checkboxAllList = [];
|
].checkboxAllList = [];
|
||||||
} else {
|
} else {
|
||||||
this.tabbar[this.current].checkboxAllList = [];
|
this.tabbar[this.collApseIndex].checkboxAllList = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isNoDownCommodityData) return;
|
if (this.isNoDownCommodityData) return;
|
||||||
@ -978,6 +982,7 @@ export default {
|
|||||||
this.tabbar[index].children[this.currTabChildrenIndex].id;
|
this.tabbar[index].children[this.currTabChildrenIndex].id;
|
||||||
} else {
|
} else {
|
||||||
this.currentTab = index;
|
this.currentTab = index;
|
||||||
|
|
||||||
this.currCategoryId = this.tabbar[index].id;
|
this.currCategoryId = this.tabbar[index].id;
|
||||||
|
|
||||||
if (this.current != -1) {
|
if (this.current != -1) {
|
||||||
@ -991,6 +996,7 @@ export default {
|
|||||||
if (this.collApseIndex == index) {
|
if (this.collApseIndex == index) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.currCategoryId != oldCategoryId && this.current != -1) {
|
if (this.currCategoryId != oldCategoryId && this.current != -1) {
|
||||||
this.getProductList();
|
this.getProductList();
|
||||||
this.collApseIndex = index;
|
this.collApseIndex = index;
|
||||||
@ -1013,8 +1019,8 @@ export default {
|
|||||||
handleSelectAll(e, isHaveChildren) {
|
handleSelectAll(e, isHaveChildren) {
|
||||||
const MAX_LIMIT = 100;
|
const MAX_LIMIT = 100;
|
||||||
const currentTabData = isHaveChildren
|
const currentTabData = isHaveChildren
|
||||||
? this.tabbar[this.current].children[this.currTabChildrenIndex]
|
? this.tabbar[this.collApseIndex].children[this.currTabChildrenIndex]
|
||||||
: this.tabbar[this.current];
|
: this.tabbar[this.collApseIndex];
|
||||||
|
|
||||||
// 获取当前页所有有效商品ID
|
// 获取当前页所有有效商品ID
|
||||||
const allProductIds = this.commodityList
|
const allProductIds = this.commodityList
|
||||||
@ -1078,8 +1084,8 @@ export default {
|
|||||||
handleSingleCheckboxChange(list, isHaveChildren) {
|
handleSingleCheckboxChange(list, isHaveChildren) {
|
||||||
const MAX_LIMIT = 100;
|
const MAX_LIMIT = 100;
|
||||||
const currentTabData = isHaveChildren
|
const currentTabData = isHaveChildren
|
||||||
? this.tabbar[this.current].children[this.currTabChildrenIndex]
|
? this.tabbar[this.collApseIndex].children[this.currTabChildrenIndex]
|
||||||
: this.tabbar[this.current];
|
: this.tabbar[this.collApseIndex];
|
||||||
|
|
||||||
// 过滤掉全选标识和无效ID
|
// 过滤掉全选标识和无效ID
|
||||||
let newIdList = list
|
let newIdList = list
|
||||||
|
|||||||
@ -305,13 +305,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tabbar: [
|
tabbar: [],
|
||||||
{
|
|
||||||
id: null,
|
|
||||||
label: "全部",
|
|
||||||
children: [],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
height: 0, //scroll-view高度
|
height: 0, //scroll-view高度
|
||||||
top: 0,
|
top: 0,
|
||||||
currentTab: 0, //预设当前项的值
|
currentTab: 0, //预设当前项的值
|
||||||
@ -436,11 +430,14 @@ export default {
|
|||||||
async getProductCategoryTree() {
|
async getProductCategoryTree() {
|
||||||
let res = await GetProductCategoryTree();
|
let res = await GetProductCategoryTree();
|
||||||
if (res && res.status == 200) {
|
if (res && res.status == 200) {
|
||||||
// var list = res.data.map((item) => ({
|
this.tabbar = [
|
||||||
// ...item,
|
{
|
||||||
// current: -1,
|
id: null,
|
||||||
// }));
|
label: "全部",
|
||||||
this.tabbar = [...this.tabbar, ...res.data];
|
children: [],
|
||||||
|
},
|
||||||
|
...res.data,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async getProductList() {
|
async getProductList() {
|
||||||
@ -576,7 +573,6 @@ export default {
|
|||||||
let index = e.index;
|
let index = e.index;
|
||||||
//手风琴展开状态 -1 == 不展开
|
//手风琴展开状态 -1 == 不展开
|
||||||
const oldCategoryId = this.currCategoryId;
|
const oldCategoryId = this.currCategoryId;
|
||||||
|
|
||||||
this.current = this.current == index ? -1 : e.index;
|
this.current = this.current == index ? -1 : e.index;
|
||||||
|
|
||||||
// 如果current没有实际变化(点击的是已经展开的项),直接返回
|
// 如果current没有实际变化(点击的是已经展开的项),直接返回
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user