main
fanfan 6 months ago
parent a4cd9ab34d
commit 918306e990
  1. 87
      src/views/goods/Index.vue

@ -36,8 +36,7 @@
</a-form-item>
<a-form-item label="商品价格">
<div style="display: flex" class="goodsType">
<a-input v-decorator="['goods_price_min']" placeholder="请输入" /><span
style="padding: 0 3px 0 5px"
<a-input v-decorator="['goods_price_min']" placeholder="请输入" /><span style="padding: 0 3px 0 5px"
>-</span
>
<a-input style="margin-left: 5px" v-decorator="['goods_price_max']" placeholder="请输入" />
@ -45,8 +44,7 @@
</a-form-item>
<a-form-item label="利润率">
<div style="display: flex" class="goodsType">
<a-input v-decorator="['profit_rate_min']" placeholder="请输入" /><span
style="padding: 0 3px 0 5px"
<a-input v-decorator="['profit_rate_min']" placeholder="请输入" /><span style="padding: 0 3px 0 5px"
>-</span
>
<a-input style="margin-left: 5px" v-decorator="['profit_rate_max']" placeholder="请输入" />
@ -67,12 +65,7 @@
<a-radio-button value="sold_out">已售罄</a-radio-button>
</a-radio-group>
</div>
<a-button
v-if="$auth('/goods/create')"
class="fl-l"
type="primary"
icon="plus"
@click="handleCreate()"
<a-button v-if="$auth('/goods/create')" class="fl-l" type="primary" icon="plus" @click="handleCreate()"
>创建商品</a-button
>
<a-button
@ -82,25 +75,16 @@
@click="handleImport()"
>批量导入</a-button
>
<a-button
style="background-color: #501212; color: #fff; border: none"
@click="handleExport(selectedRowKeys)"
<a-button style="background-color: #501212; color: #fff; border: none" @click="handleExport(selectedRowKeys)"
>导出</a-button
>
<a-button
class="fl-l"
style="background-color: #f0baae; border: none"
type="primary"
@click="handleModify()"
<a-button class="fl-l" style="background-color: #f0baae; border: none" type="primary" @click="handleModify()"
>批量修改</a-button
>
<div v-if="selectedRowKeys.length" class="button-group">
<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-down"
@click="handleUpdateStatus(selectedRowKeys, false)"
<a-button v-action:status icon="arrow-down" @click="handleUpdateStatus(selectedRowKeys, false)"
>下架</a-button
>
<a-button v-action:delete icon="delete" @click="handleDelete(selectedRowKeys)">删除</a-button>
@ -172,100 +156,107 @@ const columns = [
title: '商品ID',
dataIndex: 'goods_id',
width: '80px',
sorter: true
sorter: true,
},
{
title: '渠道',
width: '50px',
dataIndex: 'channel_name'
dataIndex: 'channel_name',
},
{
title: '商品编号',
dataIndex: 'goods_no',
width: '100px'
width: '100px',
},
{
title: '商品图片',
width: '100px',
dataIndex: 'goods_image',
scopedSlots: { customRender: 'goods_image' }
scopedSlots: { customRender: 'goods_image' },
},
{
title: '商品名称',
dataIndex: 'goods_name',
width: '260px',
scopedSlots: { customRender: 'goods_name' }
scopedSlots: { customRender: 'goods_name' },
},
{
title: '商品价格',
width: '90px',
dataIndex: 'goods_price_min',
scopedSlots: { customRender: 'goods_price_min' },
sorter: true
sorter: true,
},
{
title: '成本价',
width: '80px',
dataIndex: 'cost_price_min',
scopedSlots: { customRender: 'cost_price_min' },
sorter: true
sorter: true,
},
{
title: '利润',
width: '80px',
dataIndex: 'profit',
sorter: true
sorter: true,
},
{
title: '利润率',
width: '80px',
dataIndex: 'profit_rate',
sorter: true,
scopedSlots: { customRender: 'profit_rate' }
scopedSlots: { customRender: 'profit_rate' },
},
{
title: '加价率',
width: '90px',
dataIndex: 'markup_rate',
sorter: true,
scopedSlots: { customRender: 'markup_rate' },
},
{
title: '总销量',
width: '80px',
dataIndex: 'sales_actual',
sorter: true
sorter: true,
},
{
title: '库存总量',
width: '90px',
dataIndex: 'stock_total',
sorter: true
sorter: true,
},
{
title: '状态',
width: '60px',
dataIndex: 'status',
scopedSlots: { customRender: 'status' }
scopedSlots: { customRender: 'status' },
},
{
title: '排序',
width: '80px',
dataIndex: 'sort',
sorter: true
sorter: true,
},
{
title: '添加时间',
width: '150px',
dataIndex: 'create_time',
sorter: true
sorter: true,
},
{
title: '操作',
dataIndex: 'action',
width: '150px',
scopedSlots: { customRender: 'action' }
}
scopedSlots: { customRender: 'action' },
},
]
export default {
name: 'Index',
components: {
ContentHeader,
STable,
Update
Update,
},
data() {
return {
@ -277,7 +268,7 @@ export default {
queryParam: {
listType: 'all',
spec_type: '',
channel: ''
channel: '',
},
//
isLoading: false,
@ -290,7 +281,7 @@ export default {
const data = { ...param, ...this.queryParam }
const orderEnum = {
ascend: 'asc',
descend: 'desc'
descend: 'desc',
}
if (data.sortField && data.sortOrder && orderEnum[data.sortOrder]) {
@ -309,9 +300,9 @@ export default {
specsType: [
{ name: '全部', val: '' },
{ name: '单规格', val: 10 },
{ name: '多规格', val: 20 }
{ name: '多规格', val: 20 },
],
checkList: []
checkList: [],
}
},
created() {
@ -327,10 +318,10 @@ export default {
rowSelection() {
return {
selectedRowKeys: this.selectedRowKeys,
onChange: this.onSelectChange
}
onChange: this.onSelectChange,
}
},
},
methods: {
//
handleModify() {
@ -449,7 +440,7 @@ export default {
app.handleRefresh()
})
.finally((result) => modal.destroy())
}
},
})
},
//
@ -474,8 +465,8 @@ export default {
handleRefresh(bool = false) {
this.selectedRowKeys = []
this.$refs.table.refresh(bool)
}
}
},
},
}
</script>
<style lang="less" scoped>

Loading…
Cancel
Save