归类 排行 新品等

master
fanfan 8 months ago
parent aa2f14a69c
commit 75dba24bed
  1. 14
      src/api/goods/index.js
  2. 52
      src/views/goods/Index.vue

@ -15,7 +15,19 @@ const api = {
setStorePrice: 'store/setStorePrice', setStorePrice: 'store/setStorePrice',
getStorePriceInfo: 'store/getStorePriceInfo', getStorePriceInfo: 'store/getStorePriceInfo',
pool: '/goods/pool', pool: '/goods/pool',
collector:'/goods/collector' collector:'/goods/collector',
category: '/goods/category',
}
/**
* 归类
* @param {*} data
*/
export function category (data) {
return axios({
url: api.category,
method: 'post',
data: data
})
} }
/** /**
* 大牌 * 大牌

@ -59,13 +59,18 @@
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-row> </a-row>
<a-modal v-model:visible="batchVisible" width="300px" :title="setupIndex==1?'设置是否大牌正品':setupIndex==2?'设置是否新品首发':setupIndex==3?'设置是否店内':'设置所属分类排行'" @ok="handleUpdateSetup(selectedRowKeys,setupIndex!=4?setupValue:paihang,setupIndex)"> <a-modal v-model:visible="batchVisible" width="300px" :title="setupIndex==1?'设置是否大牌正品':setupIndex==2?'设置是否新品首发':setupIndex==3?'设置是否店内':'设置所属分类排行'" @ok="handleUpdateSetup(selectedRowKeys,setupValue,setupIndex)">
<a-select v-if="setupIndex!=4" v-model="setupValue" style="width: 250px;margin:10px 0" placeholder="请选择"> <a-select v-model="setupValue" style="width: 250px;margin:10px 0" placeholder="请选择">
<a-select-option :value="item.val" v-for="item in isYesNo" :key="item.val"> <a-select-option :value="item.val" v-for="item in isYesNo" :key="item.val">
{{ item.name }} {{ item.name }}
</a-select-option> </a-select-option>
</a-select> </a-select>
<a-input v-model="paihang" v-else placeholder="请输入所属分类排行值" style="width: 250px;margin:10px 0" /> <!-- <a-input v-model="paihang" v-else placeholder="请输入所属分类排行值" style="width: 250px;margin:10px 0" /> -->
</a-modal>
<!-- 操作板块 -->
<a-modal v-model:visible="categoryVisible" width="450px" title="商品分类" @ok="handleUpdateClassify(selectedRowKeys, categoryIds)">
<a-tree-select style="min-width: 400px" placeholder="请选择商品分类" :dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }" :treeData="categoryListTree" treeCheckable treeCheckStrictly allowClear
@change="onChangeCategory"></a-tree-select>
</a-modal> </a-modal>
<!-- 操作板块 --> <!-- 操作板块 -->
<div class="row-item-tab clearfix"> <div class="row-item-tab clearfix">
@ -83,11 +88,12 @@
<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 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 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="storeVersion === 0 || (storeVersion === 1 && isSuper === 0)" class="fl-l" style="background-color: #f0baae; border: none" type="primary" @click="handleModify()">批量修改</a-button>
<!-- <a-button style="background-color: #9E7AFF; color: #fff; border: none" v-if="selectedRowKeys.length" @click="handleSetup(1)">设置大牌</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 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: #FB322A; 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: #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> --> <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"> <div v-if="selectedRowKeys.length" class="button-group" style="margin-top:15px">
<a-button-group class="ml-10"> <a-button-group class="ml-10">
<a-button v-action:status icon="arrow-up" @click="handleUpdateStatus(selectedRowKeys, true)">上架</a-button> <a-button v-action:status icon="arrow-up" @click="handleUpdateStatus(selectedRowKeys, true)">上架</a-button>
<a-button v-action:status icon="arrow-down" @click="handleUpdateStatus(selectedRowKeys, false)">下架</a-button> <a-button v-action:status icon="arrow-down" @click="handleUpdateStatus(selectedRowKeys, false)">下架</a-button>
@ -285,7 +291,6 @@ export default {
merchant_id: '', merchant_id: '',
is_jd_remove: '' is_jd_remove: ''
}, },
paihang: '',
setupIndex: 0, setupIndex: 0,
setupValue: 1, setupValue: 1,
// //
@ -326,7 +331,9 @@ export default {
], ],
checkList: [], checkList: [],
merchantList: [], merchantList: [],
batchVisible: false batchVisible: false,
categoryVisible: false,
categoryIds: [],
} }
}, },
created() { created() {
@ -361,8 +368,31 @@ export default {
handleModify() { handleModify() {
this.$router.push('/goods/modify') this.$router.push('/goods/modify')
}, },
//
onChangeCategory(list) {
this.categoryIds = []
list.forEach((item) => {
this.categoryIds.push(item.value)
})
},
handleUpdateClassify(goodsIds, categoryIds) {
if (categoryIds.length == 0) {
this.$message.warn('请至少选择1个商品分类', 1.5)
return
}
this.isLoading = true
GoodsApi.category({ goodsIds, categoryIds })
.then((result) => {
//
this.categoryVisible = false
this.$message.success(result.message, 1.5)
this.handleRefresh()
})
.finally((result) => {
this.isLoading = false
})
},
handleSetup(type) { handleSetup(type) {
this.paihang = '';
this.setupValue = 1; this.setupValue = 1;
this.setupIndex = type this.setupIndex = type
this.batchVisible = true this.batchVisible = true
@ -381,7 +411,7 @@ export default {
url = GoodsApi.setInstore({ goodsIds, is_in_store: val }) url = GoodsApi.setInstore({ goodsIds, is_in_store: val })
} }
if (type == 4) { if (type == 4) {
url = GoodsApi.setRank({ goodsIds, paihang: val }) url = GoodsApi.setRank({ goodsIds, is_paihang: val })
} }
url.then((result) => { url.then((result) => {
this.batchVisible = false this.batchVisible = false
@ -389,7 +419,7 @@ export default {
this.handleRefresh() this.handleRefresh()
}) })
.finally((result) => { .finally((result) => {
this.$message.warning(result.message, 1.5) this.$message.warning(result.message, 1.5)
this.isLoading = false this.isLoading = false
}) })
}, },

Loading…
Cancel
Save