增加产品排序
This commit is contained in:
@@ -76,3 +76,14 @@ export async function updateProductCps(data) {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
export async function updateProductSort(id, sort) {
|
||||
const res = await request.put('/car/product/sort', {
|
||||
id,
|
||||
sort
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
@@ -79,6 +79,15 @@
|
||||
v-model="form.discounts3"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序:">
|
||||
<el-input
|
||||
type="number"
|
||||
clearable
|
||||
:maxlength="60"
|
||||
placeholder=""
|
||||
v-model="form.sort"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="推广范围:" prop="">
|
||||
<regions-select
|
||||
v-model="form.provinceCity"
|
||||
@@ -228,7 +237,8 @@
|
||||
discounts3: '',
|
||||
promotion_text: [],
|
||||
carProductLabel: [],
|
||||
posterBg: []
|
||||
posterBg: [],
|
||||
sort: 0
|
||||
};
|
||||
return {
|
||||
editVersion: false,
|
||||
|
||||
@@ -221,6 +221,9 @@
|
||||
</div>
|
||||
-->
|
||||
</template>
|
||||
<template v-slot:sort="{ row }">
|
||||
<el-input v-model="row.sort" @change="editSort(row)" />
|
||||
</template>
|
||||
<template v-slot:status="{ row }">
|
||||
<el-switch
|
||||
:active-value="1"
|
||||
@@ -292,6 +295,7 @@
|
||||
import {
|
||||
pageProduct,
|
||||
removeProduct,
|
||||
updateProductSort,
|
||||
updateProductStatus
|
||||
} from '@/api/car/product';
|
||||
import edit from './components/edit.vue';
|
||||
@@ -367,6 +371,15 @@
|
||||
minWidth: 100,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'sort',
|
||||
label: '排序值',
|
||||
align: 'center',
|
||||
width: 90,
|
||||
resizable: false,
|
||||
sortable: 'sort',
|
||||
slot: 'sort'
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '上架状态',
|
||||
@@ -516,6 +529,20 @@
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
},
|
||||
/* 修改排序 */
|
||||
editSort(row) {
|
||||
const loading = this.$loading({ lock: true });
|
||||
updateProductSort(row.id, row.sort)
|
||||
.then((msg) => {
|
||||
loading.close();
|
||||
this.$message.success(msg);
|
||||
// this.reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.close();
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
},
|
||||
/* 重置搜索 */
|
||||
reset() {
|
||||
this.where = {
|
||||
|
||||
Reference in New Issue
Block a user