|
|
|
@ -3,11 +3,11 @@
|
|
|
|
|
<div style="display: flex">
|
|
|
|
|
<a-button size="large" class="editable-add-btn" @click="commodityVisible = true">
|
|
|
|
|
<a-icon type="plus"/>
|
|
|
|
|
新增商品
|
|
|
|
|
新增货物
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-input-search
|
|
|
|
|
placeholder="请输入商品名"
|
|
|
|
|
enter-button="搜索商品"
|
|
|
|
|
placeholder="请输入货物名"
|
|
|
|
|
enter-button="搜索货物"
|
|
|
|
|
style="width: 400px;margin-left: 20px"
|
|
|
|
|
size="large"
|
|
|
|
|
@search="onSearch"
|
|
|
|
@ -18,24 +18,24 @@
|
|
|
|
|
</div>
|
|
|
|
|
<a-table :loading="loading" :columns="columns" :data-source="data" :sortDirections="['ascend', 'descend']" rowKey="id">
|
|
|
|
|
<a slot="name" slot-scope="text">{{ text }}</a>
|
|
|
|
|
<span slot="customTitle"><a-icon type="smile-o"/> 商品名称</span>
|
|
|
|
|
<span slot="customTitle"><a-icon type="smile-o"/> 货物名称</span>
|
|
|
|
|
<span slot="action" slot-scope="text, record, index">
|
|
|
|
|
<a-button @click="handleUpdate(record)" type="link"><a-icon type="edit"/> Update</a-button>
|
|
|
|
|
<a-button @click="handleUpdate(record)" type="link"><a-icon type="edit"/> 修改</a-button>
|
|
|
|
|
<a-divider type="vertical"/>
|
|
|
|
|
<a-button @click="handleDelete(record,index)" type="link"><a-icon type="delete"/> Delete</a-button>
|
|
|
|
|
<a-button @click="handleDelete(record,index)" type="link"><a-icon type="delete"/> 删除</a-button>
|
|
|
|
|
</span>
|
|
|
|
|
</a-table>
|
|
|
|
|
|
|
|
|
|
<a-modal
|
|
|
|
|
title="商品信息"
|
|
|
|
|
title="货物信息"
|
|
|
|
|
:closable="false"
|
|
|
|
|
:visible="commodityVisible"
|
|
|
|
|
>
|
|
|
|
|
<a-form-model ref="ruleForm" :model="commodity">
|
|
|
|
|
<a-form-model-item ref="name" label="商品名称" prop="name">
|
|
|
|
|
<a-form-model-item ref="name" label="货物名称" prop="name">
|
|
|
|
|
<a-input v-model="commodity.name"/>
|
|
|
|
|
</a-form-model-item>
|
|
|
|
|
<a-form-model-item label="商品单价" prop="price">
|
|
|
|
|
<a-form-model-item label="货品单价" prop="price">
|
|
|
|
|
<a-input-number id="input" v-model="commodity.price" :min="1"/>
|
|
|
|
|
</a-form-model-item>
|
|
|
|
|
<a-form-model-item label="描述信息" prop="description">
|
|
|
|
@ -44,10 +44,10 @@
|
|
|
|
|
</a-form-model>
|
|
|
|
|
<template slot="footer">
|
|
|
|
|
<a-button key="back" @click="commodityVisible = false">
|
|
|
|
|
Return
|
|
|
|
|
取消
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button key="submit" type="primary" :loading="modalLoading" @click="submitCommodity">
|
|
|
|
|
Submit
|
|
|
|
|
提交
|
|
|
|
|
</a-button>
|
|
|
|
|
</template>
|
|
|
|
|
</a-modal>
|
|
|
|
@ -88,7 +88,7 @@ const columns = [
|
|
|
|
|
sortField: 'createAt'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '商品单价',
|
|
|
|
|
title: '货品单价',
|
|
|
|
|
key: 'price',
|
|
|
|
|
dataIndex: 'price',
|
|
|
|
|
scopedSlots: {customRender: 'tags'},
|
|
|
|
@ -107,7 +107,7 @@ export default {
|
|
|
|
|
return {
|
|
|
|
|
commodity: {
|
|
|
|
|
name: '',
|
|
|
|
|
description: '商品简介',
|
|
|
|
|
description: '货物简介',
|
|
|
|
|
count: 0,
|
|
|
|
|
price: 9.99,
|
|
|
|
|
},
|
|
|
|
@ -138,7 +138,7 @@ export default {
|
|
|
|
|
}, 600)
|
|
|
|
|
} else {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.$message.success("搜索到" + res.data.length + "个商品")
|
|
|
|
|
this.$message.success("搜索到" + res.data.length + "个货物")
|
|
|
|
|
this.loading = false
|
|
|
|
|
this.data = res.data
|
|
|
|
|
}, 600)
|
|
|
|
@ -165,7 +165,7 @@ export default {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.modalLoading = false
|
|
|
|
|
this.commodityVisible = false
|
|
|
|
|
this.$message.success('商品信息提交成功');
|
|
|
|
|
this.$message.success('货物信息提交成功');
|
|
|
|
|
this.loadTableData()
|
|
|
|
|
}, 600)
|
|
|
|
|
} else {
|
|
|
|
@ -178,7 +178,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
handleDelete(r, index) {
|
|
|
|
|
DeleteCommodityById(r.id).then((res) => {
|
|
|
|
|
if (res.status) this.$message.success('商品信息删除成功');
|
|
|
|
|
if (res.status) this.$message.success('货物信息删除成功');
|
|
|
|
|
this.loadTableData()
|
|
|
|
|
})
|
|
|
|
|
console.log(index)
|
|
|
|
|