全部上下架

master
fanfan 7 months ago
parent fc31d6bc94
commit d8cc0a5245
  1. 24
      src/api/goods/index.js
  2. 33
      src/views/goods/Index.vue

@ -17,6 +17,30 @@ const api = {
pool: '/goods/pool',
collector:'/goods/collector',
category: '/goods/category',
oneShelf:'/goods/oneClickShelf',
oneOffTheShelf:'/goods/oneClickOffTheShelf'
}
/**
* 一键上架
* @param {*} data
*/
export function oneShelf (data) {
return axios({
url: api.oneShelf,
method: 'post',
data: data
})
}
/**
* 一键下架
* @param {*} data
*/
export function oneOffTheShelf (data) {
return axios({
url: api.oneOffTheShelf,
method: 'post',
data: data
})
}
/**
* 归类

@ -114,9 +114,11 @@
<a-button v-if="$module('goods-import') && $auth('/goods/import/batch') && (storeVersion === 0 || (storeVersion === 1 && isSuper === 0))" class="fl-l" icon="arrow-up" @click="handleImport()">批量导入</a-button>
<a-button style="background-color: #501212; color: #fff; border: none" @click="handleExport(selectedRowKeys)">导出</a-button>
<a-button v-if="storeVersion === 0 || (storeVersion === 1 && isSuper === 0)" class="fl-l" style="background-color: #f0baae; border: none" type="primary" @click="handleModify()">批量修改</a-button>
<a-button v-if="selectedRowKeys.length" style="background-color: green; color: #fff; border: none; border-radius: 2px" @click="categoryVisible = true">归类</a-button>
<a-button v-if="selectedRowKeys.length==0" style="background-color: green; color: #fff; border: none; border-radius: 2px" @click="handleSetupGoods(selectedRowKeys,1)">全部上架</a-button>
<a-button v-if="selectedRowKeys.length==0" style="background-color: #FB322A; color: #fff; border: none; border-radius: 2px" @click="handleSetupGoods(selectedRowKeys,2)">全部下架</a-button>
<a-button v-if="selectedRowKeys.length" style="background-color: #872658; color: #fff; border: none; border-radius: 2px" @click="categoryVisible = true">归类</a-button>
<a-button style="background-color: #9E7AFF; color: #fff; border: none" v-if="selectedRowKeys.length" @click="handleSetup(1)">设置大牌</a-button>
<a-button style="background-color: #FB322A; color: #fff; border: none" v-if="selectedRowKeys.length" @click="handleSetup(2)">设置新品</a-button>
<a-button style="background-color: #0b1746; color: #fff; border: none" v-if="selectedRowKeys.length" @click="handleSetup(2)">设置新品</a-button>
<a-button style="background-color: #1184D2; color: #fff; border: none" v-if="selectedRowKeys.length" @click="handleSetup(3)">设置店内</a-button>
<a-button style="background-color: #EEA507; color: #fff; border: none" v-if="selectedRowKeys.length" @click="handleSetup(4)">设置排行榜</a-button>
<div v-if="selectedRowKeys.length" class="button-group" style="margin-top:15px">
@ -459,6 +461,26 @@ export default {
this.isLoading = false
})
},
handleSetupGoods(goodsIds, type) {
// type==1 1 2
this.isLoading = true
let url = ''
if (type == 1) {
url = GoodsApi.oneShelf()
}
if (type == 2) {
url = GoodsApi.oneOffTheShelf()
}
url.then((result) => {
this.isLoading = false
this.$message.success(result.message, 1.5)
this.handleRefresh()
})
.finally((result) => {
this.$message.warning(result.message, 1.5)
this.isLoading = false
})
},
handleSetup(type) {
this.setupValue = 1;
this.paihang = '';
@ -483,6 +505,7 @@ export default {
}
url.then((result) => {
this.batchVisible = false
this.isLoading = false
this.$message.success(result.message, 1.5)
this.handleRefresh()
})
@ -678,9 +701,9 @@ export default {
</script>
<style lang="less">
.overlayName .ant-tooltip-inner {
background-color: rgba(0, 0, 0, 0.7) !important;
width: 350px;
padding: 0;
background-color: rgba(0, 0, 0, 0.7) !important;
width: 350px;
padding: 0;
}
</style>
<style lang="less" scoped>

Loading…
Cancel
Save