|
@@ -144,7 +144,7 @@
|
|
|
<view class="batch-btns">
|
|
<view class="batch-btns">
|
|
|
<template v-if="filterStatus === '' || filterStatus === 'reviewing'">
|
|
<template v-if="filterStatus === '' || filterStatus === 'reviewing'">
|
|
|
<view class="b-btn disabled">批量删除</view>
|
|
<view class="b-btn disabled">批量删除</view>
|
|
|
- <view class="b-btn disabled">批量下架</view>
|
|
|
|
|
|
|
+ <view :class="['b-btn', selectedOffIds.length ? 'danger' : 'disabled']" @click="batchOff">批量下架</view>
|
|
|
<view class="b-btn disabled">批量上架</view>
|
|
<view class="b-btn disabled">批量上架</view>
|
|
|
</template>
|
|
</template>
|
|
|
<template v-else-if="filterStatus === 'selling' || filterStatus === 'soldout'">
|
|
<template v-else-if="filterStatus === 'selling' || filterStatus === 'soldout'">
|
|
@@ -260,6 +260,11 @@ export default {
|
|
|
const ids = list.map((i) => i.id);
|
|
const ids = list.map((i) => i.id);
|
|
|
return ids.length > 0 && ids.every((id) => this.selectedIds.includes(id));
|
|
return ids.length > 0 && ids.every((id) => this.selectedIds.includes(id));
|
|
|
},
|
|
},
|
|
|
|
|
+ selectedOffIds() {
|
|
|
|
|
+ return this.currentList
|
|
|
|
|
+ .filter((item) => this.selectedIds.includes(item.id) && (item.status === 'selling' || item.status === 'soldout'))
|
|
|
|
|
+ .map((item) => item.id);
|
|
|
|
|
+ },
|
|
|
bannerVisible() {
|
|
bannerVisible() {
|
|
|
return this.applyStatus !== 1;
|
|
return this.applyStatus !== 1;
|
|
|
},
|
|
},
|
|
@@ -472,9 +477,13 @@ export default {
|
|
|
return true;
|
|
return true;
|
|
|
},
|
|
},
|
|
|
async batchOff() {
|
|
async batchOff() {
|
|
|
- if (!this.ensureSelected()) return;
|
|
|
|
|
|
|
+ const ids = this.filterStatus === '' ? this.selectedOffIds : this.selectedIds;
|
|
|
|
|
+ if (!ids.length) {
|
|
|
|
|
+ uni.showToast({ title: '请先选择在售菜品', icon: 'none' });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (!(await this.confirmModal('确定批量下架选中商品?'))) return;
|
|
if (!(await this.confirmModal('确定批量下架选中商品?'))) return;
|
|
|
- merchantDishApi.packageBatchLaunch(this.selectedIds, 0).then((res) => {
|
|
|
|
|
|
|
+ merchantDishApi.packageBatchLaunch(ids, 0).then((res) => {
|
|
|
this.$tip.toast(res.data.message || (res.data.code === 200 ? '批量下架成功' : '操作失败'));
|
|
this.$tip.toast(res.data.message || (res.data.code === 200 ? '批量下架成功' : '操作失败'));
|
|
|
if (res.data.code === 200) {
|
|
if (res.data.code === 200) {
|
|
|
this.exitBatch();
|
|
this.exitBatch();
|