增加排序,以及处理上下架的问题

main
陈伟 9 months ago
parent 7f66b5271a
commit b424042769
  1. 39
      src/views/dataCenter/goods/Index.vue

@ -121,7 +121,8 @@ import CategoryModel from '@/common/model/Category'
const columns = [ const columns = [
{ {
title: '商品ID', title: '商品ID',
dataIndex: 'goods_id' dataIndex: 'goods_id',
sorter: true
}, },
{ {
title: '渠道', title: '渠道',
@ -142,15 +143,18 @@ const columns = [
{ {
title: '商品价格', title: '商品价格',
dataIndex: 'goods_price_min', dataIndex: 'goods_price_min',
scopedSlots: { customRender: 'goods_price_min' } scopedSlots: { customRender: 'goods_price_min' },
sorter: true
}, },
{ {
title: '总销量', title: '总销量',
dataIndex: 'sales_actual' dataIndex: 'sales_actual',
sorter: true
}, },
{ {
title: '库存总量', title: '库存总量',
dataIndex: 'stock_total' dataIndex: 'stock_total',
sorter: true
}, },
{ {
title: '状态', title: '状态',
@ -159,12 +163,14 @@ const columns = [
}, },
{ {
title: '排序', title: '排序',
dataIndex: 'sort' dataIndex: 'sort',
sorter: true
}, },
{ {
title: '添加时间', title: '添加时间',
width: '180px', width: '180px',
dataIndex: 'create_time' dataIndex: 'create_time',
sorter: true
}, },
{ {
title: '操作', title: '操作',
@ -199,7 +205,23 @@ export default {
selectedRowKeys: [], selectedRowKeys: [],
// Promise // Promise
loadData: (param) => { loadData: (param) => {
return GoodsApi.list({ ...param, ...this.queryParam }).then((response) => { const data = { ...param, ...this.queryParam }
const orderEnum = {
ascend: 'asc',
descend: 'desc'
}
if (data.sortField && data.sortOrder && orderEnum[data.sortOrder]) {
data.sort = data.sortField
data.order = orderEnum[data.sortOrder]
delete data.sortField
delete data.sortOrder
} else {
delete data.sortField
delete data.sortOrder
}
return GoodsApi.list(data).then((response) => {
return response.data.list return response.data.list
}) })
}, },
@ -278,9 +300,6 @@ export default {
// () // ()
handleUpdateStatus (goodsIds, state = true) { handleUpdateStatus (goodsIds, state = true) {
if (!this.$auth('/goods/index.status')) {
return false
}
this.isLoading = true this.isLoading = true
GoodsApi.state({ goodsIds, state }) GoodsApi.state({ goodsIds, state })
.then((result) => { .then((result) => {

Loading…
Cancel
Save