增加成本价

feature/0423
陈伟 11 months ago
parent a725144794
commit d8418ccb52
  1. 6
      src/views/goods/Create.vue
  2. 99
      src/views/goods/Index.vue
  3. 8
      src/views/goods/Update.vue

@ -184,12 +184,12 @@
<span class="ml-10"></span>
</a-form-item>
<a-form-item
label="划线价"
label="成本价"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="划线价仅用于商品页展示"
extra="成本价仅用于商品页展示"
>
<a-input-number :min="0" :precision="2" v-decorator="['line_price']" />
<a-input-number :min="0" :precision="2" v-decorator="['cost_price_min']" />
<span class="ml-10"></span>
</a-form-item>
<a-form-item

@ -34,21 +34,29 @@
<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
<a-button
v-if="$auth('/goods/create')"
class="fl-l"
type="primary"
icon="plus"
@click="handleCreate()"
>创建商品</a-button
>
<a-button
v-if="$module('goods-import') && $auth('/goods/import/batch')"
class="fl-l"
icon="arrow-up"
@click="handleImport()"
>批量导入</a-button
>批量导入</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
<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>
</a-button-group>
@ -81,18 +89,20 @@
class="cur-p"
:color="text == 10 ? 'green' : 'red'"
@click="handleUpdateStatus([item.goods_id], text != 10)"
>{{ text == 10 ? '上架' : '下架' }}</a-tag
>{{ text == 10 ? '上架' : '下架' }}</a-tag
>
</span>
<!-- 操作项 -->
<div class="actions" slot="action" slot-scope="text, item">
<router-link v-if="$auth('/goods/update')" :to="{ path: '/goods/update', query: { goodsId: item.goods_id } }"
>编辑</router-link
<router-link
v-if="$auth('/goods/update')"
:to="{ path: '/goods/update', query: { goodsId: item.goods_id } }"
>编辑</router-link
>
<router-link
v-if="$module('goods-copy') && $auth('/goods/copy')"
:to="{ path: '/goods/copy', query: { goodsId: item.goods_id } }"
>复制</router-link
>复制</router-link
>
<a v-action:delete @click="handleDelete([item.goods_id])">删除</a>
</div>
@ -109,61 +119,66 @@ import CategoryModel from '@/common/model/Category'
const columns = [
{
title: '商品ID',
dataIndex: 'goods_id',
dataIndex: 'goods_id'
},
{
title: '商品图片',
dataIndex: 'goods_image',
scopedSlots: { customRender: 'goods_image' },
scopedSlots: { customRender: 'goods_image' }
},
{
title: '商品名称',
dataIndex: 'goods_name',
width: '302px',
scopedSlots: { customRender: 'goods_name' },
scopedSlots: { customRender: 'goods_name' }
},
{
title: '商品价格',
dataIndex: 'goods_price_min',
scopedSlots: { customRender: 'goods_price_min' },
scopedSlots: { customRender: 'goods_price_min' }
},
{
title: '成本价',
dataIndex: 'cost_price_min',
scopedSlots: { customRender: 'cost_price_min' }
},
{
title: '总销量',
dataIndex: 'sales_actual',
dataIndex: 'sales_actual'
},
{
title: '库存总量',
dataIndex: 'stock_total',
dataIndex: 'stock_total'
},
{
title: '状态',
dataIndex: 'status',
scopedSlots: { customRender: 'status' },
scopedSlots: { customRender: 'status' }
},
{
title: '排序',
dataIndex: 'sort',
dataIndex: 'sort'
},
{
title: '添加时间',
width: '180px',
dataIndex: 'create_time',
dataIndex: 'create_time'
},
{
title: '操作',
dataIndex: 'action',
width: '150px',
scopedSlots: { customRender: 'action' },
},
scopedSlots: { customRender: 'action' }
}
]
export default {
name: 'Index',
components: {
ContentHeader,
STable,
STable
},
data() {
data () {
return {
//
searchForm: this.$form.createForm(this),
@ -171,7 +186,7 @@ export default {
categoryListTree: [],
//
queryParam: {
listType: 'all',
listType: 'all'
},
//
isLoading: false,
@ -184,10 +199,10 @@ export default {
return GoodsApi.list({ ...param, ...this.queryParam }).then((response) => {
return response.data.list
})
},
}
}
},
created() {
created () {
//
if (this.$route.query.listType) {
this.queryParam.listType = this.$route.query.listType
@ -196,27 +211,27 @@ export default {
this.getCategoryList()
},
computed: {
rowSelection() {
rowSelection () {
return {
selectedRowKeys: this.selectedRowKeys,
onChange: this.onSelectChange,
onChange: this.onSelectChange
}
},
}
},
methods: {
//
onSelectChange(selectedRowKeys) {
onSelectChange (selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
},
// tab
handleTabs(e) {
handleTabs (e) {
this.queryParam.listType = e.target.value
this.handleRefresh(true)
},
//
handleSearch(e) {
handleSearch (e) {
e.preventDefault()
this.searchForm.validateFields((error, values) => {
if (!error) {
@ -227,12 +242,12 @@ export default {
},
//
handleReset() {
handleReset () {
this.searchForm.resetFields()
},
//
getCategoryList() {
getCategoryList () {
this.isLoading = true
CategoryModel.getListFromScreen()
.then((selectList) => {
@ -242,7 +257,7 @@ export default {
},
// ()
handleUpdateStatus(goodsIds, state = true) {
handleUpdateStatus (goodsIds, state = true) {
if (!this.$auth('/goods/index.status')) {
return false
}
@ -259,29 +274,29 @@ export default {
},
//
handleDelete(goodsIds) {
handleDelete (goodsIds) {
const app = this
const modal = this.$confirm({
title: '您确定要删除该记录吗?',
content: '删除后不可恢复',
onOk() {
onOk () {
return GoodsApi.deleted({ goodsIds })
.then((result) => {
app.$message.success(result.message, 1.5)
app.handleRefresh()
})
.finally((result) => modal.destroy())
},
}
})
},
//
handleCreate() {
handleCreate () {
this.$router.push('/goods/create')
},
//
handleImport() {
handleImport () {
this.$router.push('/goods/import/batch')
},
@ -289,11 +304,11 @@ export default {
* 刷新列表
* @param Boolean bool 强制刷新到第一页
*/
handleRefresh(bool = false) {
handleRefresh (bool = false) {
this.selectedRowKeys = []
this.$refs.table.refresh(bool)
},
},
}
}
}
</script>
<style lang="less" scoped>

@ -194,12 +194,12 @@
<span class="ml-10"></span>
</a-form-item>
<a-form-item
label="划线价"
label="成本价"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
extra="划线价仅用于商品页展示"
extra="成本价仅用于商品页展示"
>
<a-input-number :min="0" :precision="2" v-decorator="['line_price']" />
<a-input-number :min="0" :precision="2" v-decorator="['cost_price_min']" />
<span class="ml-10"></span>
</a-form-item>
<a-form-item
@ -611,7 +611,7 @@ export default {
//
const tabsFieldsMap = [
['goods_type', 'goods_name', 'categorys', 'imagesIds', 'delivery_id', 'is_ind_delivery_type', 'delivery_type','is_brand', 'is_in_store'],
['spec_type', 'goods_price', 'is_restrict', 'restrict_total', 'restrict_single'],
['spec_type', 'goods_price', 'is_restrict', 'restrict_total', 'restrict_single', 'cost_price_min'],
['content'],
['alone_grade_equity', 'first_money', 'second_money', 'third_money']
]

Loading…
Cancel
Save