上下架及商品池

main
fanfan 9 months ago
parent aebdb7cdc4
commit 72a012fe58
  1. 61
      src/views/dataCenter/goods/Index.vue

@ -65,7 +65,12 @@
</a-form> </a-form>
</a-row> </a-row>
<!-- 操作板块 --> <!-- 操作板块 -->
<a-modal v-model:visible="visible" width="450px" title="商品分类" @ok="handleUpdateClassify(selectedRowKeys, categoryIds)"> <a-modal
v-model:visible="visible"
width="450px"
title="商品分类"
@ok="handleUpdateClassify(selectedRowKeys, categoryIds)"
>
<a-tree-select <a-tree-select
style="min-width: 400px" style="min-width: 400px"
placeholder="请选择商品分类" placeholder="请选择商品分类"
@ -77,7 +82,12 @@
@change="onChangeCategory" @change="onChangeCategory"
></a-tree-select> ></a-tree-select>
</a-modal> </a-modal>
<a-modal v-model:visible="saleVisible" width="250px" title="停售类型" @ok="handleUpdateSales(selectedRowKeys, is_sale)"> <a-modal
v-model:visible="saleVisible"
width="250px"
title="停售类型"
@ok="handleUpdateSales(selectedRowKeys, is_sale)"
>
<a-select @change="getSale" style="width: 200px" placeholder="请选择"> <a-select @change="getSale" style="width: 200px" placeholder="请选择">
<a-select-option :value="item.val" v-for="item in saleStatus" :key="item.val"> <a-select-option :value="item.val" v-for="item in saleStatus" :key="item.val">
{{ item.name }} {{ item.name }}
@ -110,9 +120,7 @@
>移除</a-button >移除</a-button
> >
<a-button style="background-color: green; color: #fff" @click="visible = true">归类</a-button> <a-button style="background-color: green; color: #fff" @click="visible = true">归类</a-button>
<a-button style="background-color: blue; color: #fff" @click="saleVisible=true" <a-button style="background-color: blue; color: #fff" @click="saleVisible = true">停售</a-button>
>停售</a-button
>
<a-button icon="delete" @click="handleDelete(selectedRowKeys)">删除</a-button> <a-button icon="delete" @click="handleDelete(selectedRowKeys)">删除</a-button>
</a-button-group> </a-button-group>
</div> </div>
@ -133,24 +141,24 @@
<img width="50" height="50" :src="text" alt="商品图片" /> <img width="50" height="50" :src="text" alt="商品图片" />
</a> </a>
</span> </span>
<!-- 商品名称 --> <!-- 商品池 -->
<span slot="goods_name" slot-scope="text"> <span slot="is_pool" slot-scope="text">
<p class="twoline-hide" style="width: 270px">{{ text }}</p> <p class="twoline-hide" style="width: 40px" :style="{color:text == 0 ? 'red' : text == 1 ? 'green' : 'gray'}">
{{ text == 0 ? '待处理' : text == 1 ? '已入池' : '未入池' }}
</p>
</span> </span>
<!-- 商品状态 --> <!-- 商品状态 -->
<span slot="status" slot-scope="text, item"> <span slot="is_sale" slot-scope="text, item">
<a-tag <a-tag class="cur-p" :color="text == 0 ? 'red' : text == 1 ? 'green' : 'gray'">{{
class="cur-p" text == 0 ? '停售' : text == 1 ? '在售' : '无货'
:color="text == 10 ? 'green' : 'red'" }}</a-tag>
>{{ text == 10 ? '上架' : '下架' }}</a-tag
>
</span> </span>
<!-- 操作项 --> <!-- 操作项 -->
<div class="actions" style="width: 140px" slot="action" slot-scope="text, item"> <div class="actions" style="width: 140px" slot="action" slot-scope="text, item">
<router-link :to="{ path: '/goods/update', query: { goodsId: item.goods_id } }">编辑</router-link> <router-link :to="{ path: '/goods/update', query: { goodsId: item.goods_id } }">编辑</router-link>
<router-link :to="{ path: '/goods/copy', query: { goodsId: item.goods_id } }">复制</router-link> <router-link :to="{ path: '/goods/copy', query: { goodsId: item.goods_id } }">复制</router-link>
<a @click="handleUpdateStatus([item.goods_id],1)" v-if="text == 10"></a> <a @click="handleUpdateStatus([item.goods_id], 2)" v-if="item.is_sale == 1"></a>
<a @click="handleUpdateStatus([item.goods_id],2)" v-else></a> <a @click="handleUpdateStatus([item.goods_id], 1)" v-else></a>
<a @click="handleDelete([item.goods_id])">删除</a> <a @click="handleDelete([item.goods_id])">删除</a>
</div> </div>
</s-table> </s-table>
@ -207,10 +215,15 @@ const columns = [
dataIndex: 'stock_total', dataIndex: 'stock_total',
sorter: true, sorter: true,
}, },
{
title: '商品池',
dataIndex: 'is_pool',
scopedSlots: { customRender: 'is_pool' },
},
{ {
title: '状态', title: '状态',
dataIndex: 'status', dataIndex: 'is_sale',
scopedSlots: { customRender: 'status' }, scopedSlots: { customRender: 'is_sale' },
}, },
{ {
title: '添加时间', title: '添加时间',
@ -277,8 +290,8 @@ export default {
checkList: [], checkList: [],
visible: false, visible: false,
saleVisible:false, saleVisible: false,
is_sale:'', is_sale: '',
goodsType: [ goodsType: [
{ name: '自营', val: 1 }, { name: '自营', val: 1 },
{ name: 'POP', val: 2 }, { name: 'POP', val: 2 },
@ -369,7 +382,7 @@ export default {
getGoodsStarus(val) { getGoodsStarus(val) {
this.queryParam.is_pool = val this.queryParam.is_pool = val
}, },
getSale(val){ getSale(val) {
this.is_sale = val this.is_sale = val
}, },
// //
@ -412,7 +425,7 @@ export default {
GoodsApi.category({ goodsIds, categoryIds }) GoodsApi.category({ goodsIds, categoryIds })
.then((result) => { .then((result) => {
// //
this.visible=false this.visible = false
this.$message.success(result.message, 1.5) this.$message.success(result.message, 1.5)
this.handleRefresh() this.handleRefresh()
}) })
@ -422,7 +435,7 @@ export default {
}, },
// //
handleUpdateSales(goodsIds, is_sale) { handleUpdateSales(goodsIds, is_sale) {
if (!is_sale) { if (is_sale === '' || is_sale === undefined || is_sale === null) {
this.$message.warn('请选择停售类型', 1.5) this.$message.warn('请选择停售类型', 1.5)
return return
} }
@ -430,7 +443,7 @@ export default {
GoodsApi.sale({ goodsIds, is_sale }) GoodsApi.sale({ goodsIds, is_sale })
.then((result) => { .then((result) => {
// //
this.saleVisible=false this.saleVisible = false
this.$message.success(result.message, 1.5) this.$message.success(result.message, 1.5)
this.handleRefresh() this.handleRefresh()
}) })

Loading…
Cancel
Save